Просмотр исходного кода

Merge branch 'hcb' of kn-cost/cost-frontend into dev

hanchaobo 1 год назад
Родитель
Сommit
e3da2f821d

+ 1
- 0
package.json Просмотреть файл

@@ -20,6 +20,7 @@
20 20
     "@vueup/vue-quill": "1.2.0",
21 21
     "@vueuse/core": "10.6.1",
22 22
     "axios": "1.6.7",
23
+    "echarts": "^5.5.0",
23 24
     "element-plus": "2.4.3",
24 25
     "file-saver": "2.0.5",
25 26
     "js-cookie": "3.0.5",

+ 24
- 0
src/api/costCalculation.js Просмотреть файл

@@ -0,0 +1,24 @@
1
+import request from "@/service/request";
2
+
3
+/*新增版本号*/
4
+export function costStandardVersionAdd(data) {
5
+    return request.post("/costStandardVersion/add", {}, data, {
6
+        message: {
7
+            success: "生成成功",
8
+            error: true
9
+        }
10
+    });
11
+}
12
+// 查询列表
13
+export function costStandardList(params) {
14
+    return request.get(`/costStandard/list`, params);
15
+}
16
+//删除
17
+export function deleteCostStandard(data) {
18
+    return request.delete("/costStandard/delete", data,{
19
+        message: {
20
+            success: "删除成功",
21
+            error: true
22
+        }
23
+    });
24
+}

+ 15
- 0
src/api/singleLineQuery.js Просмотреть файл

@@ -0,0 +1,15 @@
1
+import request from "@/service/request";
2
+
3
+// 查询列表
4
+export function costStandardDetailList(params) {
5
+    return request.get(`/costStandardDetail/list`, params);
6
+}
7
+/*导出excel*/
8
+export function exportcostStandardDetail(data) {
9
+    return request.get("/costStandardDetail/exportXls", data, {
10
+        message: {
11
+            success: "导出成功",
12
+            error: true
13
+        }
14
+    });
15
+}

+ 14
- 0
src/api/treeQuery.js Просмотреть файл

@@ -0,0 +1,14 @@
1
+import request from "@/service/request";
2
+
3
+// 查询列表
4
+export function queryBomTree(params) {
5
+    return request.get(`/bomTree/queryBomTree`, params);
6
+}
7
+// 查询物料编号接口
8
+export function costMaterialBomList(params) {
9
+    return request.get(`/cost-material-bom/list`, params);
10
+}
11
+// 查询版本号接口
12
+export function costStandardVersionList(params) {
13
+    return request.get(`/costStandardVersion/list`, params);
14
+}

+ 36
- 0
src/components/Echarts/index.vue Просмотреть файл

@@ -0,0 +1,36 @@
1
+<script lang="tsx">
2
+//表格
3
+import { defineComponent, ref, onMounted, watch } from "vue";
4
+import * as echarts from 'echarts';
5
+export default defineComponent({
6
+    props: {
7
+        option:Object
8
+    },
9
+    setup(props) {
10
+        const chartRef = ref();
11
+        const render = () => {
12
+            return (
13
+                <div ref={chartRef} style="width: 100%; height: 100%;">
14
+
15
+                </div>
16
+            );
17
+        };
18
+        onMounted(() => {
19
+            // 初始化图表
20
+            const chartInstance = echarts.init(chartRef.value);
21
+            chartInstance.setOption(props.option);
22
+            window.addEventListener('resize', () => {
23
+                chartInstance.resize();
24
+            });
25
+        });
26
+        watch(props, (newVal, oldVal) => {
27
+            if (newVal.option) {
28
+                const chartInstance = echarts.init(chartRef.value);
29
+                chartInstance.setOption(props.option);
30
+            }
31
+        });
32
+        return render;
33
+    },
34
+});
35
+</script>
36
+<style lang="scss" scoped></style>

+ 1
- 0
src/main.js Просмотреть файл

@@ -51,6 +51,7 @@ function render(props = {}) {
51 51
 
52 52
       // 使用element-plus 并且设置全局的大小
53 53
       app.use(ElementPlus, {
54
+        name:'testApp',
54 55
         locale: locale,
55 56
         // 支持 large、default、small
56 57
         size: Cookies.get("size") || "default"

+ 18
- 2
src/platform.ts Просмотреть файл

@@ -6,7 +6,22 @@ export const qomoPlatformOptions = {
6 6
   //字典配置
7 7
   dict: {
8 8
     //静态字典
9
-    staticDictMaps: {},
9
+    staticDictMaps: {
10
+      stageData: [
11
+        {
12
+          label: "初始",
13
+          value: "A"
14
+        },
15
+        {
16
+          label: "量产",
17
+          value: "B"
18
+        },
19
+        {
20
+          label: "首批",
21
+          value: "C"
22
+        }
23
+      ]
24
+    },
10 25
     async provider(dictType) {
11 26
       const result = await getDictCode({
12 27
         dictCode: dictType
@@ -31,7 +46,8 @@ export const qomoPlatformOptions = {
31 46
       relativePath: files.name,
32 47
       name: files.originalName,
33 48
       url: location.origin + files?.fileurl
34
-    })
49
+    }),
50
+    namespace: "testApp"
35 51
   }
36 52
 } as QomoPlatformInstallOptions;
37 53
 

+ 57
- 9
src/router/index.js Просмотреть файл

@@ -69,15 +69,39 @@ export const constantRoutes = [
69 69
       },
70 70
     ]
71 71
   },
72
+  // {
73
+  //   path: '',
74
+  //   component: Layout,
75
+  //   children: [
76
+  //     {
77
+  //       path: "/hour",
78
+  //       component: () => import("@/views/hour/index"),
79
+  //       name: "Hour",
80
+  //       meta: { title: "小时费率", icon: "money", affix: true }
81
+  //     }
82
+  //   ]
83
+  // },
84
+  // {
85
+  //   path: '',
86
+  //   component: Layout,
87
+  //   children: [
88
+  //     {
89
+  //       path: "/unitPrice",
90
+  //       component: () => import("@/views/unitPrice/index"),
91
+  //       name: "UnitPrice",
92
+  //       meta: { title: "7525单价", icon: "money", affix: true }
93
+  //     }
94
+  //   ]
95
+  // }
72 96
   {
73 97
     path: '',
74 98
     component: Layout,
75 99
     children: [
76 100
       {
77
-        path: "/hour",
78
-        component: () => import("@/views/hour/index"),
79
-        name: "Hour",
80
-        meta: { title: "小时费率", icon: "money", affix: true }
101
+        path: "convolution/costCalculation",
102
+        component: () => import("@/views/convolution/costCalculation/index"),
103
+        name: "CostCalculation",
104
+        meta: { title: "成本计算", icon: "money", affix: true }
81 105
       }
82 106
     ]
83 107
   },
@@ -86,13 +110,37 @@ export const constantRoutes = [
86 110
     component: Layout,
87 111
     children: [
88 112
       {
89
-        path: "/unitPrice",
90
-        component: () => import("@/views/unitPrice/index"),
91
-        name: "UnitPrice",
92
-        meta: { title: "7525单价", icon: "money", affix: true }
113
+        path: "convolution/singleLineQuery",
114
+        component: () => import("@/views/convolution/singleLineQuery/index"),
115
+        name: "SingleLineQuery",
116
+        meta: { title: "单行查询", icon: "money", affix: true }
93 117
       }
94 118
     ]
95
-  }
119
+  },
120
+  {
121
+    path: '',
122
+    component: Layout,
123
+    children: [
124
+      {
125
+        path: "convolution/treeQuery",
126
+        component: () => import("@/views/convolution/treeQuery/index"),
127
+        name: "TreeQuery",
128
+        meta: { title: "结构树查询", icon: "tree", affix: true }
129
+      }
130
+    ]
131
+  },
132
+  {
133
+    path: '',
134
+    component: Layout,
135
+    children: [
136
+      {
137
+        path: "miningAnalysis/statistics",
138
+        component: () => import("@/views/miningAnalysis/statistics/index"),
139
+        name: "Statistics",
140
+        meta: { title: "挖掘统计", icon: "tree", affix: true }
141
+      }
142
+    ]
143
+  },
96 144
 ];
97 145
 
98 146
 //本地调试默认路由

+ 120
- 0
src/views/convolution/costCalculation/component/calculate.vue Просмотреть файл

@@ -0,0 +1,120 @@
1
+<script lang="tsx">
2
+//表格
3
+import { defineComponent, ref, watch } from "vue";
4
+import { costStandardVersionAdd } from '@/api/costCalculation';
5
+export default defineComponent({
6
+    props: {
7
+        visible: Boolean,
8
+        tableRef: Object,
9
+    },
10
+    setup(props, { emit }) {
11
+        const forecastDialogRef = ref();
12
+        const rileForm = ref();
13
+        const formData = ref({
14
+            figureNumber: '',
15
+            stage: '',
16
+            createTime: '',
17
+            versionNumber: '',
18
+            materialNumber: '',
19
+            versionYear: ''
20
+        });
21
+        // const rules ={
22
+        //     figureNumber: [
23
+        //         { required: true, message: '请输入图号', trigger: ['blur','change'] }
24
+        //     ],
25
+        //     stage: [
26
+        //         { required: true, message: '请选择项目阶段', trigger: ['blur','change'] }
27
+        //     ],
28
+        //     createTime: [
29
+        //         { required: true, message: '请选择项目时间', trigger: ['blur','change'] }
30
+        //     ],
31
+        //     versionNumber: [
32
+        //         { required: true, message: '请生成版本号', trigger: ['blur','change'] }
33
+        //     ]
34
+        // };
35
+        const render = () => {
36
+            return (
37
+                <div>
38
+                    <base-dialog-form
39
+                        ref={forecastDialogRef}
40
+                        v-model={props.visible}
41
+                        title={"生成设置版本号"}
42
+                        width={400}
43
+                        labelWidth={0}
44
+                        confirm={() => {
45
+                            emit('cancelVisible');
46
+                            const year = formData.value.createTime.split("-")[0];
47
+                            formData.value.versionYear = year;
48
+                            costStandardVersionAdd(formData.value).then(res => {
49
+                                props.tableRef.doReload();
50
+                            })
51
+                        }}
52
+                        cancel={() => {
53
+                            emit('cancelVisible');
54
+                        }}
55
+                    >
56
+                        <el-form ref={rileForm} v-model={formData.value} label-width="100px">
57
+                            <el-form-item label="图号" prop="figureNumber">
58
+                                <el-input v-model={formData.value.figureNumber} onChange={splicing} />
59
+                            </el-form-item>
60
+                            <el-form-item label="物料号" prop="figurmaterialNumbereNumber">
61
+                                <el-input v-model={formData.value.materialNumber} />
62
+                            </el-form-item>
63
+                            <el-form-item label="项目阶段" prop="stage">
64
+                                <el-select v-model={formData.value.stage} placeholder="请选择项目阶段" onChange={splicing}>
65
+                                    <el-option label="初始" value="A"></el-option>
66
+                                    <el-option label="量产" value="B"></el-option>
67
+                                    <el-option label="首批" value="C"></el-option>
68
+                                </el-select>
69
+                            </el-form-item>
70
+                            {/* <el-form-item label="年份" prop="versionYear">
71
+                                <el-date-picker
72
+                                    v-model={formData.value.versionYear}
73
+                                    type="year"
74
+                                    value-format="YYYY"
75
+                                    onChange={splicing}
76
+                                    placeholder="选择年份">
77
+                                </el-date-picker>
78
+                            </el-form-item> */}
79
+                            <el-form-item label="创建日期" prop="createTime">
80
+                                <el-date-picker
81
+                                    v-model={formData.value.createTime}
82
+                                    type="datetime"
83
+                                    disabledDate={(time) => {
84
+                                        return time.getTime() > Date.now();
85
+                                    }}
86
+                                    value-format="YYYY-MM-DD HH:MM:ss"
87
+                                    onChange={splicing}
88
+                                    placeholder="选择日期">
89
+                                </el-date-picker>
90
+                            </el-form-item>
91
+                            <el-form-item label="生成版本号" prop="versionNumber">
92
+                                <el-input type="textarea" disabled rows="2" v-model={formData.value.versionNumber} />
93
+                            </el-form-item>
94
+                        </el-form>
95
+                    </base-dialog-form>
96
+                </div>
97
+
98
+            );
99
+        };
100
+        const splicing = () => {
101
+            formData.value.versionNumber = "";
102
+            formData.value.versionNumber = formData.value.figureNumber + '_' + formData.value.stage + '_' + formData.value.createTime;
103
+        };
104
+        watch(props, (newVal, oldVal) => {
105
+            if (newVal.visible) {
106
+                formData.value = {
107
+                    figureNumber: '',
108
+                    stage: '',
109
+                    createTime: '',
110
+                    versionNumber: '',
111
+                    materialNumber: '',
112
+                    versionYear: ''
113
+                }
114
+            }
115
+        });
116
+        return render;
117
+    },
118
+});
119
+</script>
120
+<style lang="scss" scoped></style>

+ 190
- 0
src/views/convolution/costCalculation/index.vue Просмотреть файл

@@ -0,0 +1,190 @@
1
+<script lang="tsx">
2
+//表格
3
+import { defineComponent, ref } from "vue";
4
+import { ElMessage } from "element-plus";
5
+import Calculate from "./component/calculate.vue";
6
+import { transformPageResponse } from "@/utils/qomo";
7
+import { costStandardList,deleteCostStandard } from '@/api/costCalculation';
8
+export default defineComponent({
9
+    setup() {
10
+        const tableRef = ref();
11
+        const visible = ref(false);
12
+        const forecastDialogRef = ref();
13
+        //列
14
+        const columns = ref([
15
+            { type: "selection" },
16
+            { label: "版本号", prop: "versionNumber" },
17
+            { label: "年份", prop: "versionYear", valueType: "year" },
18
+            { label: "物料编号", prop: "materialNumber" },
19
+            { prop: "bomCost", label: "bom材料费", hideInAddOrEditForm: true, hideInSearchForm: true },
20
+            { label: "包装费", prop: "packingCost", hideInSearchForm: true },
21
+            { label: "辅料费", prop: "auxiliaryCost", hideInSearchForm: true },
22
+            { label: "人工费", prop: "laborCost", hideInSearchForm: true },
23
+            { label: "机器折旧费", prop: "euipDepreciationCost", hideInSearchForm: true },
24
+            { label: "机器料消耗费", prop: "equipConsumeCost", hideInSearchForm: true },
25
+            { label: "水电费", prop: "hydroelectricityCost", hideInSearchForm: true },
26
+            { label: "其他制造费", prop: "otherCost", hideInSearchForm: true },
27
+            { label: "物流费用", prop: "trailCost", hideInSearchForm: true },
28
+            { label: "制造成本", prop: "manufactureCost", hideInSearchForm: true },
29
+            { label: "工装费", prop: "toolingCost", hideInSearchForm: true },
30
+            { label: "检具费", prop: "inspectionCost", hideInSearchForm: true },
31
+            { label: "模具费", prop: "moldCost", hideInSearchForm: true },
32
+            { label: "测试费", prop: "testCost", hideInSearchForm: true },
33
+            { label: "创建日期", prop: "createTime", hideInSearchForm: true, valueType: "datetime" },
34
+            { label: "阶段", prop: "stage", valueType: 'dict-select', extraProps: { dictType: 'stageData' } },
35
+            { label: "版本状态", prop: "versionStatus" },
36
+            { label: "总成本", prop: "totalCost", hideInSearchForm: true },
37
+            {
38
+                type: "operation",
39
+                label: "操作",
40
+                minWidth: 200,
41
+                render: ({ row, doAddOrEdit, doDeleteRows, doReload, doPreview }) => (
42
+                    <base-table-operation
43
+                        btnList={
44
+                            [{
45
+                                key: "edit",
46
+                                label: "重新计算",
47
+                                onclick: () => doAddOrEdit(row)
48
+                            },
49
+                            {
50
+                                key: "delete",
51
+                                label: "删除",
52
+                                onclick: () => doDeleteRows(row)
53
+                            },
54
+                            {
55
+                                key: "deletion",
56
+                                label: "部件缺失信息",
57
+                            },
58
+                            {
59
+                                key: "preview",
60
+                                label: "查看详情",
61
+                                onclick: () => doPreview(row)
62
+                            }
63
+                            ]
64
+                        }
65
+                    />
66
+                )
67
+            },
68
+        ]);
69
+
70
+        const render = () => {
71
+            return (
72
+                <div>
73
+                    <BasePageContainer flex-hidden={true} style={{ width: "100%", height: "800px", padding: "0" }}>
74
+                        <BaseTable
75
+                            columns={columns.value}
76
+                            queryParamsToUrl
77
+                            toolbar={{ layout: "search-dnamic,reload,column-setting,fullscreen" }}
78
+                            ref={tableRef}
79
+                            request={async ({
80
+                                pageSize = 10,
81
+                                current = 1,
82
+                                ...otherSearchParams
83
+                            }) => {
84
+                                let tableData = {};
85
+                                tableData = transformPageResponse(
86
+                                    await costStandardList({
87
+                                        pageNo: current,
88
+                                        pageSize,
89
+                                        ...otherSearchParams
90
+                                    })
91
+                                );
92
+                                tableData.data.forEach(item => {
93
+                                    if (item.stage == "A") {
94
+                                        item.stage = "初始"
95
+                                    } else if (item.stage == "B") {
96
+                                        item.stage = "量产"
97
+                                    } else if (item.stage == "C") {
98
+                                        item.stage = "首批"
99
+                                    }
100
+                                })
101
+                                return tableData;
102
+                            }}
103
+                            curdConfig={{
104
+                                unitColSpan: 12,
105
+                                async onDeleteRows(data) {
106
+                                    await deleteCostStandard({ id: data.id })
107
+                                },
108
+                            }}
109
+                            v-slots={{
110
+                                toolbar: () => (
111
+                                    <el-space>
112
+                                        <el-button type="primary" onClick={calculate}>
113
+                                            计算标准成本
114
+                                        </el-button>
115
+                                        <el-button type="success" onClick={batchCalculate}>批量计算</el-button>
116
+                                        <el-button type="info" onClick={batchExport}>批量导出</el-button>
117
+                                    </el-space>
118
+                                ),
119
+                            }}
120
+                        />
121
+                    </BasePageContainer>
122
+                    <Calculate visible={visible.value} onCancelVisible={cancelVisible} tableRef={tableRef.value}></Calculate>
123
+                    <base-dialog-form
124
+                        ref={forecastDialogRef}
125
+                        title={"批量计算"}
126
+                        width={400}
127
+                        labelWidth={0}
128
+                        rules={{
129
+                            filed: [
130
+                                { required: true, message: "请上传附件", trigger: "blur" }
131
+                            ]
132
+                        }}
133
+                        confirm={() => {
134
+                            {/* forecastDialogRef.value.open(); */ }
135
+                        }}
136
+                        cancel={() => {
137
+                            forecastDialogRef.value.close();
138
+                        }}
139
+                        v-slots={{
140
+                            default: ({ model }) => (
141
+                                <el-form-item label="" prop="filed">
142
+                                    <base-upload
143
+                                        drag
144
+                                        multiple
145
+                                        limit={1}
146
+                                        on-change={onChange}
147
+                                        v-model={model.fileIds}
148
+                                        accept=".xls,.xlsx,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
149
+                                    >
150
+                                        <el-icon class="el-icon-upload">
151
+                                            <upload-filled />
152
+                                        </el-icon>
153
+                                        <div class="w-full">请上传文件</div>
154
+                                    </base-upload>
155
+                                </el-form-item>
156
+                            )
157
+                        }}
158
+                    />
159
+                </div>
160
+            );
161
+        };
162
+        const calculate = () => {
163
+            visible.value = true;
164
+        }
165
+        const cancelVisible = () => {
166
+            visible.value = false;
167
+        }
168
+        const batchCalculate = () => {
169
+            forecastDialogRef.value.open();
170
+        }
171
+        const batchExport = () => {
172
+            console.log(tableRef.value.selectionRows, "批量导出");
173
+        }
174
+        const onChange = (file) => {
175
+            console.log(file, "PPPPPPPPPPPPPPPPPPPP");
176
+
177
+            const isExcel = file.raw.type === 'application/vnd.ms-excel' ||
178
+                file.raw.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
179
+            if (!isExcel) {
180
+                ElMessage.error('只能上传Excel文件!');
181
+                return false;
182
+            }
183
+            return true;
184
+        }
185
+        const doReload = () => { }
186
+        return render;
187
+    },
188
+});
189
+</script>
190
+<style lang="scss" scoped></style>

+ 71
- 0
src/views/convolution/singleLineQuery/index.vue Просмотреть файл

@@ -0,0 +1,71 @@
1
+<script lang="tsx">
2
+//表格
3
+import { defineComponent, ref } from "vue";
4
+import { costStandardDetailList,exportcostStandardDetail } from "@/api/singleLineQuery.js";
5
+import { transformPageResponse } from "@/utils/qomo";
6
+import { ElMessage } from "element-plus";
7
+export default defineComponent({
8
+  setup() {
9
+    const tableRef = ref();
10
+    //列
11
+    const columns = ref([
12
+    { type: "selection" },
13
+      { prop: "materialNumber", label: "物料编号" },
14
+      { label: "版本号", prop: "versionNumber" },
15
+      { label: "层级", prop: "level", hideInSearchForm: true },
16
+      { label: "图号", prop: "figureNumber", hideInSearchForm: true },
17
+      { label: "规格", prop: "specification", hideInSearchForm: true },
18
+      { label: "用量", prop: "dosage", hideInSearchForm: true },
19
+      { label: "bom材料费", prop: "bomCost", hideInSearchForm: true },
20
+      { label: "本阶人工费", prop: "laborCost", hideInSearchForm: true },
21
+      { label: "机器折旧费", prop: "euipDepreciationCost", hideInSearchForm: true },
22
+      { label: "水电费", prop: "hydroelectricityCost", hideInSearchForm: true },
23
+      { label: "本阶辅料费", prop: "auxiliaryCost", hideInSearchForm: true },
24
+      { label: "其他制造费", prop: "otherCost", hideInSearchForm: true },
25
+      // { label: "累计bom材料费", prop: "date123", hideInSearchForm: true  },
26
+      { label: "累计人工费", prop: "totalLaborCost", hideInSearchForm: true },
27
+      // { label: "累计设备费", prop: "date123", hideInSearchForm: true  },
28
+      { label: "累计水电费", prop: "totalHydroelectricityCost", hideInSearchForm: true },
29
+      // { label: "累计辅料费", prop: "date123", hideInSearchForm: true  },
30
+      { label: "累计其他费", prop: "totalOtherCost", hideInSearchForm: true },
31
+    ]);
32
+
33
+    const render = () => {
34
+      return (
35
+        <BaseTable
36
+          columns={columns.value}
37
+          queryParamsToUrl
38
+          toolbar={{ layout: "search-dnamic,reload,column-setting,fullscreen" }}
39
+          ref={tableRef}
40
+          issortTable
41
+          request={async ({
42
+            pageSize = 10,
43
+            current = 1,
44
+            ...otherSearchParams
45
+          }) => {
46
+            return transformPageResponse(
47
+              await costStandardDetailList({
48
+                pageNo: current,
49
+                pageSize,
50
+                ...otherSearchParams
51
+              })
52
+            );
53
+          }}
54
+          v-slots={{
55
+            toolbar: ({ doAddOrEdit }) => (
56
+              <el-space>
57
+                <el-button type="success" onclick={handleExport}>批量导出</el-button>
58
+              </el-space>
59
+            ),
60
+          }}
61
+        />
62
+      );
63
+    };
64
+    const handleExport = () => {
65
+      exportcostStandardDetail(tableRef.value.selectionRows ? {selections:tableRef.value.selectionRows.map(item => item.id).join(',')} : {} )
66
+    };
67
+    return render;
68
+  },
69
+});
70
+</script>
71
+<style lang="scss" scoped></style>

+ 207
- 0
src/views/convolution/treeQuery/index.vue Просмотреть файл

@@ -0,0 +1,207 @@
1
+<script lang="tsx">
2
+//表格
3
+import { defineComponent, ref, onMounted } from "vue";
4
+import { queryBomTree, costMaterialBomList, costStandardVersionList } from "@/api/treeQuery.js";
5
+import { ElMessage } from "element-plus";
6
+export default defineComponent({
7
+    setup() {
8
+        const tableRef = ref();
9
+        const materialNumberList = ref([]);
10
+        const versionNumberList = ref([]);
11
+        //列
12
+        const columns = ref([
13
+            { prop: "materialNumber", label: "物料编号", valueType: "select", extraProps: { options: materialNumberList } },
14
+            { label: "版本号", prop: "versionNumber", valueType: "select", extraProps: { options: versionNumberList } },
15
+        ]);
16
+        const treeData = ref([
17
+
18
+        ])
19
+        const defaultProps = {
20
+            children: 'children',
21
+            label: 'label'
22
+        }
23
+        const formData = ref({});
24
+        const render = () => {
25
+            return (
26
+                <BaseTable
27
+                    columns={columns.value}
28
+                    queryParamsToUrl
29
+                    pagination={false}
30
+                    toolbar={{ layout: "reload,fullscreen" }}
31
+                    ref={tableRef}
32
+                    request={async ({
33
+                        ...otherSearchParams
34
+                    }) => {
35
+                        await queryBomTree({
36
+                            ...otherSearchParams
37
+                        }).then((res) => {
38
+                            console.log(res, "PPPPPPPPPPPPPPPPPPP")
39
+                            treeData.value = addLabelRecursively(res);
40
+                        });
41
+                    }}
42
+                    v-slots={{
43
+                        body: ({ data }) => (
44
+                            <div class="treeMain">
45
+                                <div class="treeMain-left">
46
+                                    <el-tree data={treeData.value} props={defaultProps} onNodeClick={handleNodeClick}></el-tree>
47
+                                </div>
48
+                                <div class="treeMain-right">
49
+                                    <el-form v-model={formData.value} label-width="150px" disabled>
50
+                                        <el-row>
51
+                                            <el-col span="12">
52
+                                                <el-form-item label="物料编号" prop="materialNumber">
53
+                                                    <el-input v-model={formData.value.materialNumber} />
54
+                                                </el-form-item>
55
+                                            </el-col>
56
+                                            <el-col span="12">
57
+                                                <el-form-item label="图号" prop="figureNumber">
58
+                                                    <el-input v-model={formData.value.figureNumber} />
59
+                                                </el-form-item>
60
+                                            </el-col>
61
+                                            <el-col span="12">
62
+                                                <el-form-item label="本阶标准成本" prop="standardCost">
63
+                                                    <el-input v-model={formData.value.standardCost} />
64
+                                                </el-form-item>
65
+                                            </el-col>
66
+                                            <el-col span="12">
67
+                                                <el-form-item label="累计标准成本" prop="accumulatedStandardCost">
68
+                                                    <el-input v-model={formData.value.accumulatedStandardCost} />
69
+                                                </el-form-item>
70
+                                            </el-col>
71
+                                            <el-col span="12">
72
+                                                <el-form-item label="本阶物料成本" prop="materialCost">
73
+                                                    <el-input v-model={formData.value.materialCost} />
74
+                                                </el-form-item>
75
+                                            </el-col>
76
+                                            <el-col span="12">
77
+                                                <el-form-item label="累计物料成本" prop="accumulatedMaterialCost">
78
+                                                    <el-input v-model={formData.value.accumulatedMaterialCost} />
79
+                                                </el-form-item>
80
+                                            </el-col>
81
+                                            <el-col span="12">
82
+                                                <el-form-item label="本阶人工成本" prop="laborCost">
83
+                                                    <el-input v-model={formData.value.laborCost} />
84
+                                                </el-form-item>
85
+                                            </el-col>
86
+                                            <el-col span="12">
87
+                                                <el-form-item label="累计人工成本" prop="accumulatedLaborCost">
88
+                                                    <el-input v-model={formData.value.accumulatedLaborCost} />
89
+                                                </el-form-item>
90
+                                            </el-col>
91
+                                            {/* <el-col span="12">
92
+                                                <el-form-item label="本阶制造费用" prop="figureNumber">
93
+                                                    <el-input v-model={formData.value.figureNumber} />
94
+                                                </el-form-item>
95
+                                            </el-col> */}
96
+                                            {/* <el-col span="12">
97
+                                                <el-form-item label="累计制作费用" prop="figureNumber">
98
+                                                    <el-input v-model={formData.value.figureNumber} />
99
+                                                </el-form-item>
100
+                                            </el-col> */}
101
+                                            <el-col span="12">
102
+                                                <el-form-item label="人工工时" prop="figureNumber">
103
+                                                    <el-input v-model={formData.value.figureNumber} />
104
+                                                </el-form-item>
105
+                                            </el-col>
106
+                                            <el-col span="12">
107
+                                                <el-form-item label="人工费率" prop="figureNumber">
108
+                                                    <el-input v-model={formData.value.figureNumber} />
109
+                                                </el-form-item>
110
+                                            </el-col>
111
+                                            <el-col span="12">
112
+                                                <el-form-item label="设备工时" prop="figureNumber">
113
+                                                    <el-input v-model={formData.value.figureNumber} />
114
+                                                </el-form-item>
115
+                                            </el-col>
116
+                                            <el-col span="12">
117
+                                                <el-form-item label="设备费率" prop="figureNumber">
118
+                                                    <el-input v-model={formData.value.figureNumber} />
119
+                                                </el-form-item>
120
+                                            </el-col>
121
+                                            <el-col span="12">
122
+                                                <el-form-item label="燃动工时" prop="figureNumber">
123
+                                                    <el-input v-model={formData.value.figureNumber} />
124
+                                                </el-form-item>
125
+                                            </el-col>
126
+                                            <el-col span="12">
127
+                                                <el-form-item label="燃动费率" prop="figureNumber">
128
+                                                    <el-input v-model={formData.value.figureNumber} />
129
+                                                </el-form-item>
130
+                                            </el-col>
131
+                                            <el-col span="12">
132
+                                                <el-form-item label="辅料工时" prop="figureNumber">
133
+                                                    <el-input v-model={formData.value.figureNumber} />
134
+                                                </el-form-item>
135
+                                            </el-col>
136
+                                            <el-col span="12">
137
+                                                <el-form-item label="辅料费率" prop="figureNumber">
138
+                                                    <el-input v-model={formData.value.figureNumber} />
139
+                                                </el-form-item>
140
+                                            </el-col>
141
+                                            <el-col span="12">
142
+                                                <el-form-item label="其他工时" prop="figureNumber">
143
+                                                    <el-input v-model={formData.value.figureNumber} />
144
+                                                </el-form-item>
145
+                                            </el-col>
146
+                                            <el-col span="12">
147
+                                                <el-form-item label="其他费率" prop="figureNumber">
148
+                                                    <el-input v-model={formData.value.figureNumber} />
149
+                                                </el-form-item>
150
+                                            </el-col>
151
+                                        </el-row>
152
+
153
+                                    </el-form>
154
+                                </div>
155
+                            </div>
156
+                        ),
157
+                    }}
158
+                />
159
+            );
160
+        };
161
+        const handleNodeClick = (data) => {
162
+            console.log(data, "PPPPPPPPPPPPPPPPPPPPPPPP");
163
+            formData.value = data;
164
+        }
165
+        const addLabelRecursively = (data) => {
166
+            data.forEach((item) => {
167
+                item.label = `${item.materialNumber}${item.materialName ? ' ' + '_' + item.materialName : ''}`;
168
+                if (item.children && item.children.length > 0) {
169
+                    addLabelRecursively(item.children);
170
+                }
171
+            });
172
+            return data;
173
+        }
174
+        onMounted(() => {
175
+            costMaterialBomList().then(res => {
176
+                res.forEach(item => {
177
+                    item.label = item.materialCode;
178
+                    item.value = item.materialCode;
179
+                })
180
+                materialNumberList.value = res;
181
+            })
182
+            costStandardVersionList().then(res => {
183
+                res.forEach(item => {
184
+                    item.label = item.versionNumber;
185
+                    item.value = item.versionNumber;
186
+                })
187
+                versionNumberList.value = res;
188
+            })
189
+        })
190
+        return render;
191
+    },
192
+});
193
+</script>
194
+<style lang="scss" scoped>
195
+.treeMain {
196
+    width: 100%;
197
+    display: flex;
198
+
199
+    .treeMain-left {
200
+        width: 50%;
201
+    }
202
+
203
+    .treeMain-right {
204
+        width: 50%;
205
+    }
206
+}
207
+</style>

+ 143
- 0
src/views/miningAnalysis/statistics/index.vue Просмотреть файл

@@ -0,0 +1,143 @@
1
+<script lang="tsx">
2
+//表格
3
+import { defineComponent, ref } from "vue";
4
+import { ElMessage } from "element-plus";
5
+import Echarts from "@/components/Echarts/index.vue";
6
+export default defineComponent({
7
+  setup() {
8
+    const tableRef = ref();
9
+    const tableRef1 = ref();
10
+    //列
11
+    const columns1 = ref([
12
+      { prop: "districtName", label: "物料编号", hideInAddOrEditForm: true, hideInSearchForm: true },
13
+      { label: "版本号", prop: "name" },
14
+      { label: "实际总成本", prop: "date123" },
15
+      { label: "标准总成本", prop: "date123" },
16
+      { label: "总额差", prop: "date123" },
17
+      { label: "总额比", prop: "date123" },
18
+      { label: "时间", prop: "date123" },
19
+      {
20
+        type: "operation",
21
+        label: "操作",
22
+        minWidth: 270,
23
+        render: ({ row, doPreview }) => (
24
+          <base-table-operation
25
+            btnList={
26
+              [
27
+                {
28
+                  key: "preview",
29
+                  label: "查看详情",
30
+                  onclick: () => doPreview(row)
31
+                }
32
+              ]
33
+            }
34
+          />
35
+        )
36
+      },
37
+    ]);
38
+    const columns = ref([
39
+      { prop: "districtName", label: "物料编号"},
40
+      { label: "版本号", prop: "name"},
41
+    ]);
42
+    const option1 = ref({
43
+      title: {
44
+        text: '物料,人工,制造费用占比情况',
45
+        left: 'center',
46
+        top: 'bottom'
47
+      },
48
+      tooltip: {},
49
+      legend: {
50
+        orient: 'horizontal',
51
+        left: 'center'
52
+      },
53
+      series: [
54
+        {
55
+          name: '访问来源',
56
+          type: 'pie',
57
+          radius: '50%',
58
+          data: [
59
+            { value: 335, name: '直接访问' },
60
+            { value: 310, name: '邮件营销' },
61
+            { value: 234, name: '联盟广告' },
62
+            { value: 135, name: '视频广告' },
63
+            { value: 1548, name: '搜索引擎' }
64
+          ]
65
+        }
66
+      ]
67
+    });
68
+    const option2 = ref({
69
+      title: {
70
+        text: '标准成本与实际成本统计图',
71
+        left: 'center',
72
+        top: 'bottom'
73
+      },
74
+      tooltip: {},
75
+      legend: {
76
+        orient: 'horizontal',
77
+        left: 'center'
78
+      },
79
+      xAxis: {
80
+        data: ['第一网格', '第二网格', '第三网格', '第丝网格', '第五网格', '第六网格', '第七网格',],
81
+      },
82
+      yAxis: [{
83
+        type: 'value',
84
+      }],
85
+      series: [
86
+        {
87
+          name: '住房',
88
+          type: 'bar',
89
+          data: [90, 70, 98, 11, 22, 66, 77, 77],
90
+        },
91
+        {
92
+          name: '企业',
93
+          type: 'bar',
94
+          data: [22, 33, 33, 44, 66, 66, 77, 88],
95
+        }
96
+      ]
97
+    });
98
+    const render = () => {
99
+      return (
100
+        <div>
101
+          <BaseTable
102
+            columns={columns.value}
103
+            queryParamsToUrl
104
+            ref={tableRef}
105
+            curdConfig={{
106
+
107
+            }}
108
+            v-slots={{
109
+              body: ({ data }) => (
110
+                <div>
111
+                  <div class='topEacharts'>
112
+                    <Echarts option={option1.value}></Echarts>
113
+                    <Echarts option={option2.value}></Echarts>
114
+                  </div>
115
+                  <BaseTable
116
+                    columns={columns1.value}
117
+                    toolbar={false}
118
+                    ref={tableRef1}
119
+                    curdConfig={{
120
+
121
+                    }}
122
+                  />
123
+                </div>
124
+              ),
125
+            }}
126
+          />
127
+        </div>
128
+
129
+      );
130
+    };
131
+
132
+    return render;
133
+  },
134
+});
135
+</script>
136
+<style lang="scss" scoped>
137
+.topEacharts {
138
+  width: 100%;
139
+  height: 400px;
140
+  display: flex;
141
+  justify-content: space-between;
142
+}
143
+</style>

+ 2
- 2
vite.config.js Просмотреть файл

@@ -52,8 +52,8 @@ export default defineConfig(({ mode, command }) => {
52 52
       proxy: {
53 53
         // https://cn.vitejs.dev/config/#server-proxy
54 54
         "/qomo": {
55
-          target: "http://172.16.0.241:8095", //wq
56
-          // target: "http://172.16.0.87:8095",  //bgy
55
+          // target: "http://172.16.0.241:8095", //wq
56
+          target: "http://172.16.0.214:8095",  //bgy
57 57
           // target: "http://192.168.50.9:8095",
58 58
           changeOrigin: true,
59 59
           pathRewrite: {