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

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

hanchaobo 1 год назад
Родитель
Сommit
f58e15fe60
4 измененных файлов: 273 добавлений и 224 удалений
  1. 12
    0
      src/router/index.js
  2. 103
    0
      src/views/actualCost/index.vue
  3. 12
    18
      src/views/costMining/index.vue
  4. 146
    206
      src/views/hour/index.vue

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

@@ -239,6 +239,18 @@ export const constantRoutes = [
239 239
     ]
240 240
   },
241 241
   // Bom,工序,采购价格
242
+  {
243
+    path: '',
244
+    component: Layout,
245
+    children: [
246
+      {
247
+        path: "actualCost",
248
+        component: () => import("@/views/actualCost/index"),
249
+        name: "ActualCost",
250
+        meta: { title: "实际成本", icon: "tree", affix: true }
251
+      }
252
+    ]
253
+  },
242 254
 ];
243 255
 
244 256
 //本地调试默认路由

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

@@ -0,0 +1,103 @@
1
+<script lang="tsx">
2
+//表格
3
+import { defineComponent, ref } from "vue";
4
+import {
5
+  costStandardDetailList,
6
+  exportcostStandardDetail
7
+} from "@/api/singleLineQuery.js";
8
+import { transformPageResponse } from "@/utils/qomo";
9
+import { download } from "@qomo-platform/utils";
10
+import { ElMessage } from "element-plus";
11
+export default defineComponent({
12
+  setup() {
13
+    const tableRef = ref();
14
+    //列
15
+    const columns = ref([
16
+      { type: "selection" },
17
+      { prop: "materialNumber", label: "内部订单号" },
18
+      { label: "物料号", prop: "versionNumber" },
19
+      { label: "总实际成本", prop: "level", hideInSearchForm: true },
20
+      { label: "材料成本", prop: "figureNumber", hideInSearchForm: true },
21
+      { label: "直接人工", prop: "dosage", hideInSearchForm: true },
22
+      { label: "折旧", prop: "unit", hideInSearchForm: true },
23
+      { label: "燃动力", prop: "materialCost", hideInSearchForm: true },
24
+      { label: "辅料", prop: "laborCost", hideInSearchForm: true },
25
+      { label: "其他费用", prop: "equipmentCost", hideInSearchForm: true },
26
+      { label: "人工工时(分钟)", prop: "driveCost", hideInSearchForm: true },
27
+      {
28
+        label: "机器工时(分钟)",
29
+        prop: "supplyMaterialCost",
30
+        hideInSearchForm: true
31
+      },
32
+      {
33
+        type: "operation",
34
+        label: "操作",
35
+        minWidth: 120,
36
+        render: ({ row }) => (
37
+          <base-table-operation
38
+            btnList={[
39
+              {
40
+                key: "edit",
41
+                label: "查看结构树",
42
+                onclick: () => checkTree(row)
43
+              },
44
+            ]}
45
+          />
46
+        )
47
+      }
48
+    ]);
49
+
50
+    const render = () => {
51
+      return (
52
+        <BaseTable
53
+          columns={columns.value}
54
+          queryParamsToUrl
55
+          toolbar={{ layout: "search-dnamic,reload,column-setting,fullscreen" }}
56
+          ref={tableRef}
57
+          issortTable
58
+          request={async ({
59
+            pageSize = 10,
60
+            current = 1,
61
+            ...otherSearchParams
62
+          }) => {
63
+            return transformPageResponse(
64
+              await costStandardDetailList({
65
+                pageNo: current,
66
+                pageSize,
67
+                ...otherSearchParams
68
+              })
69
+            );
70
+          }}
71
+          v-slots={{
72
+            toolbar: ({ doAddOrEdit }) => (
73
+              <el-space>
74
+                <el-button type="success" onclick={handleExport}>
75
+                  批量导出
76
+                </el-button>
77
+              </el-space>
78
+            )
79
+          }}
80
+        />
81
+      );
82
+    };
83
+    const handleExport = () => {
84
+      exportcostStandardDetail(
85
+        tableRef.value.selectionRows
86
+          ? {
87
+              selections: tableRef.value.selectionRows
88
+                .map(item => item.id)
89
+                .join(",")
90
+            }
91
+          : {}
92
+      ).then(res => {
93
+        download(res, "费用预测明细.xlsx");
94
+      });
95
+    };
96
+    const checkTree = (row) => {
97
+      ElMessage.info("查看结构树");
98
+    };
99
+    return render;
100
+  }
101
+});
102
+</script>
103
+<style lang="scss" scoped></style>

+ 12
- 18
src/views/costMining/index.vue Просмотреть файл

@@ -10,34 +10,28 @@ export default defineComponent({
10 10
     const tableRef = ref();
11 11
     const forecastDialogRef = ref();
12 12
     const selectionRows = ref([]);
13
-    const btnTitle = ref("工时差异");
13
+    const btnTitle = ref("工时差异"); 
14 14
     // const uploadUrl = ref("/c7525cost/importExcel");
15 15
     //列
16 16
     const columnsCheck = ref([
17 17
       { prop: "type", label: "对比项", hideInSearchForm: true },
18 18
       {
19
-        label: "金额(单位:元)",
19
+        label: "实际",
20 20
         prop: "costCenterCode",
21 21
         hideInSearchForm: true
22 22
       },
23
-      { label: "版本1", prop: "factory", hideInSearchForm: true },
24
-      { label: "版本2", prop: "factory", hideInSearchForm: true },
25
-      { label: "差异金额", prop: "factory", hideInSearchForm: true },
23
+      { label: "标准", prop: "factory", hideInSearchForm: true },
24
+      { label: "差值", prop: "factory", hideInSearchForm: true },
26 25
       {
27 26
         type: "operation",
28
-        label: "差异分析",
27
+        label: "挖掘分析",
29 28
         minWidth: 120,
30 29
         render: ({ row }) => (
31 30
           <base-table-operation
32 31
             btnList={[
33 32
               {
34 33
                 key: "check",
35
-                label:
36
-                  row.type === 0
37
-                    ? "工时差异"
38
-                    : row.type === 1
39
-                    ? "人工制费差异"
40
-                    : "材料成本差异",
34
+                label:"查看明细",
41 35
                 onclick: () => timeVariance(row)
42 36
               }
43 37
             ]}
@@ -47,20 +41,20 @@ export default defineComponent({
47 41
     ]);
48 42
     const columns = ref([
49 43
       { type: "selection" },
50
-      { prop: "year", label: "内部订单号" },
44
+      { prop: "year", label: "工厂号" },
51 45
       { label: "物料号", prop: "costCenterCode" },
52 46
       { label: "成本阶段", prop: "factory" },
53 47
       { prop: "laborHourRate", label: "版本号", hideInSearchForm: true },
54
-      { prop: "equipHourRate", label: "状态",hideInAddOrEditForm: true},
48
+      { prop: "equipHourRate", label: "工单年月",hideInAddOrEditForm: true},
55 49
       {
56 50
         prop: "fuelHourRate",
57
-        label: "总标准成本(版本1)",
51
+        label: "实际总成本",
58 52
         hideInSearchForm: true,
59 53
         hideInAddOrEditForm: true
60 54
       },
61 55
       {
62 56
         prop: "auxiliaryHourRate",
63
-        label: "标准成本(版本2)",
57
+        label: "标准成本",
64 58
         hideInSearchForm: true,
65 59
         hideInAddOrEditForm: true
66 60
       },
@@ -75,7 +69,7 @@ export default defineComponent({
75 69
       },
76 70
       {
77 71
         type: "operation",
78
-        label: "操作",
72
+        label: "报告状态",
79 73
         minWidth: 120,
80 74
         render: ({ row, doAddOrEdit, doDeleteRows, doPreview }) => (
81 75
           <base-table-operation
@@ -138,7 +132,7 @@ export default defineComponent({
138 132
               toolbar: ({ doAddOrEdit, doDeleteRows }) => (
139 133
                 <el-space>
140 134
                   <el-button type="primary" onClick={doAddOrEdit}>
141
-                    添加对比项
135
+                    新增挖掘任务
142 136
                   </el-button>
143 137
                 </el-space>
144 138
               )

+ 146
- 206
src/views/hour/index.vue Просмотреть файл

@@ -3,214 +3,154 @@
3 3
 import { defineComponent, ref } from "vue";
4 4
 import { ElMessage } from "element-plus";
5 5
 import { transformPageResponse } from "@/utils/qomo";
6
-import { useRouter } from "vue-router";
6
+import { hourRateList, addHourRate, editHourRate, deleteHourRate, deleteBatchHourRate } from '@/api/hour';
7 7
 export default defineComponent({
8
-  setup() {
9
-    const router = useRouter();
10
-    const tableRef = ref();
11
-    const forecastDialogRef = ref();
12
-    const selectionRows = ref([]);
13
-    const btnTitle = ref("工时差异");
14
-    // const uploadUrl = ref("/c7525cost/importExcel");
15
-    //列
16
-    const columnsCheck = ref([
17
-      { prop: "type", label: "对比项", hideInSearchForm: true },
18
-      {
19
-        label: "金额(单位:元)",
20
-        prop: "costCenterCode",
21
-        hideInSearchForm: true
22
-      },
23
-      { label: "版本1", prop: "factory", hideInSearchForm: true },
24
-      { label: "版本2", prop: "factory", hideInSearchForm: true },
25
-      { label: "差异金额", prop: "factory", hideInSearchForm: true },
26
-      {
27
-        type: "operation",
28
-        label: "差异分析",
29
-        minWidth: 120,
30
-        render: ({ row }) => (
31
-          <base-table-operation
32
-            btnList={[
33
-              {
34
-                key: "check",
35
-                label:
36
-                  row.type === 0
37
-                    ? "工时差异"
38
-                    : row.type === 1
39
-                    ? "人工制费差异"
40
-                    : "材料成本差异",
41
-                onclick: () => timeVariance(row)
42
-              }
43
-            ]}
44
-          />
45
-        )
46
-      }
47
-    ]);
48
-    const columns = ref([
49
-      { type: "selection" },
50
-      { prop: "year", label: "内部订单号" },
51
-      { label: "物料号", prop: "costCenterCode" },
52
-      { label: "成本阶段", prop: "factory" },
53
-      { prop: "laborHourRate", label: "版本号", hideInSearchForm: true },
54
-      { prop: "equipHourRate", label: "状态",hideInAddOrEditForm: true},
55
-      {
56
-        prop: "fuelHourRate",
57
-        label: "总标准成本(版本1)",
58
-        hideInSearchForm: true,
59
-        hideInAddOrEditForm: true
60
-      },
61
-      {
62
-        prop: "auxiliaryHourRate",
63
-        label: "总标准成本(版本2)",
64
-        hideInSearchForm: true,
65
-        hideInAddOrEditForm: true
66
-      },
67
-      { prop: "otherHourRate", label: "总差额", hideInSearchForm: true,hideInAddOrEditForm: true },
68
-      { prop: "effectiveDate", label: "差额比", hideInSearchForm: true,hideInAddOrEditForm: true },
69
-      {
70
-        valueType: "date",
71
-        prop: "expirationDate",
72
-        label: "创建时间",
73
-        hideInSearchForm: true,
74
-        hideInAddOrEditForm: true
75
-      },
76
-      {
77
-        type: "operation",
78
-        label: "操作",
79
-        minWidth: 120,
80
-        render: ({ row, doAddOrEdit, doDeleteRows, doPreview }) => (
81
-          <base-table-operation
82
-            btnList={[
83
-              {
84
-                key: "check",
85
-                label: "查看报告",
86
-                onclick: () => checkReport(row)
87
-              }
88
-            ]}
89
-          />
90
-        )
91
-      }
92
-    ]);
8
+    setup() {
9
+        const tableRef = ref();
10
+        const forecastDialogRef = ref();
11
+        const selectionRows = ref([]);
12
+        // const uploadUrl = ref("/c7525cost/importExcel");
13
+        //列
14
+        const columns = ref([
15
+            { type: "selection" },
16
+            { prop: "year", label: "年度" },
17
+            { label: "成本中心代码", prop: "costCenterCode" },
18
+            { label: "工厂代码", prop: "factory" },
19
+            { prop: "laborHourRate", label: "人工小时费率", hideInSearchForm: true },
20
+            { prop: "equipHourRate", label: "设备小时费率", hideInSearchForm: true },
21
+            { prop: "fuelHourRate", label: "燃动小时费率", hideInSearchForm: true },
22
+            { prop: "auxiliaryHourRate", label: "辅料小时费率", hideInSearchForm: true },
23
+            { prop: "otherHourRate", label: "其他小时费率", hideInSearchForm: true },
24
+            { valueType: "date", prop: "effectiveDate", label: "生效日期", hideInSearchForm: true },
25
+            { valueType: "date", prop: "expirationDate", label: "失效日期", hideInSearchForm: true },
26
+            { prop: "guardian", label: "维护人员", hideInSearchForm: true },
27
+            {
28
+                type: "operation",
29
+                label: "操作",
30
+                minWidth: 120,
31
+                render: ({ row, doAddOrEdit, doDeleteRows, doPreview }) => (
32
+                    <base-table-operation
33
+                        btnList={
34
+                            [{
35
+                                key: "edit",
36
+                                label: "编辑",
37
+                                onclick: () => doAddOrEdit(row)
38
+                            },
39
+                            {
40
+                                key: "delete",
41
+                                label: "删除",
42
+                                onclick: () => doDeleteRows(row)
43
+                            }
44
+                            ]
45
+                        }
46
+                    />
47
+                )
48
+            },
49
+        ]);
93 50
 
94
-    const render = () => {
95
-      return (
96
-        <div>
97
-          <BaseTable
98
-            columns={columns.value}
99
-            ref={tableRef}
100
-            selectionRows={selectionRows.value}
101
-            toolbar={{
102
-              layout: "search-dnamic,reload,column-setting,fullscreen"
103
-            }}
104
-            request={async ({
105
-              pageSize = 10,
106
-              current = 1,
107
-              ...otherSearchParams
108
-            }) => {
109
-              await new Promise(resolve =>
110
-                setTimeout(resolve, Math.random() * 1111)
111
-              );
112
-              return {
113
-                data: Array(pageSize)
114
-                  .fill(0)
115
-                  .map((item, index) => ({
116
-                    id: Math.random(),
117
-                    name: "Tom" + current,
118
-                    date123: "date123" + current,
119
-                    createTime: new Date().getTime(),
120
-                    districtName: "区划" + index,
121
-                    districtName1: "区划1" + index
122
-                  })),
123
-                current,
124
-                // pages: 500 / pageSize,
125
-                total: 500
126
-              };
127
-            }}
128
-            curdConfig={{
129
-              /**
130
-               * 接受自动表单的数据
131
-               * @param data
132
-               */
133
-              async onAddOrEdit(data) {},
51
+        const render = () => {
52
+            return (
53
+                <div>
54
+                    <BaseTable
55
+                        columns={columns.value}
56
+                        ref={tableRef}
57
+                        selectionRows = {selectionRows.value}
58
+                        toolbar={{ layout: "search-dnamic,reload,column-setting,fullscreen" }}
59
+                        request={async ({
60
+                            pageSize = 10,
61
+                            current = 1,
62
+                            ...otherSearchParams
63
+                        }) => {
64
+                            return transformPageResponse(
65
+                                await hourRateList({
66
+                                    pageNo: current,
67
+                                    pageSize,
68
+                                    ...otherSearchParams
69
+                                })
70
+                            );
71
+                        }}
72
+                        curdConfig={{
73
+                            /**
74
+                             * 接受自动表单的数据
75
+                             * @param data
76
+                             */
77
+                            async onAddOrEdit(data) {
78
+                                if (data.id) {
79
+                                    await editHourRate(data)
80
+                                } else {
81
+                                    await addHourRate(data)
82
+                                }
83
+                            },
84
+                            /*删除*/
85
+                            async onDeleteRows(data) {
86
+                                if (Array.isArray(data)) {
87
+                                    await deleteBatchHourRate({ ids: data.map(item => item.id).join(',') })
88
+                                } else {
89
+                                    await deleteHourRate({ id: data.id })
90
+                                }
91
+                            },
92
+                            unitColSpan: 12,
93
+                            // rules: {
94
+                            //   'name': [{required:true}]
95
+                            // },
96
+                        }}
97
+                        v-slots={{
98
+                            toolbar: ({ doAddOrEdit, doDeleteRows }) => (
99
+                                <el-space>
100
+                                    <el-button type="success" onclick={handleBatchImport}>批量导入</el-button>
101
+                                    <el-button type="success" onclick={handleExport}>导出</el-button>
102
+                                    <el-button type="primary" onClick={doAddOrEdit}>
103
+                                        添加
104
+                                    </el-button>
105
+                                    <el-button type="warning" onClick={doDeleteRows}>批量删除</el-button>
106
+                                </el-space>
107
+                            ),
108
+                        }}
109
+                    />
110
+                    <base-dialog-form
111
+                        ref={forecastDialogRef}
112
+                        title={"批量导入文件"}
113
+                        width={400}
114
+                        labelWidth={0}
115
+                        rules={{
116
+                            filed: [
117
+                                { required: true, message: "请上传附件", trigger: "blur" }
118
+                            ]
119
+                        }}
120
+                        confirm= { () =>{
121
+                            {/* forecastDialogRef.value.open() */}
122
+                        }}
123
+                        v-slots={{
124
+                            default: ({ model }) => (
125
+                                <el-form-item label="" prop="filed">
126
+                                    <base-upload
127
+                                        dragx
128
+                                        multiple
129
+                                        limit={1}
130
+                                        v-model={model.fileIds}
131
+                                    >
132
+                                        <el-icon>
133
+                                            <upload-filled />
134
+                                        </el-icon>
135
+                                        <div class="w-full">请上传文件</div>
136
+                                    </base-upload>
137
+                                </el-form-item>
138
+                            )
139
+                        }}
140
+                    />
141
+                </div>
134 142
 
135
-              unitColSpan: 24
136
-            }}
137
-            v-slots={{
138
-              toolbar: ({ doAddOrEdit, doDeleteRows }) => (
139
-                <el-space>
140
-                  <el-button type="primary" onClick={doAddOrEdit}>
141
-                    添加对比项
142
-                  </el-button>
143
-                </el-space>
144
-              )
145
-            }}
146
-          />
147
-          <BaseDialog
148
-            title="报告详情"
149
-            width="80%"
150
-            ref={forecastDialogRef}
151
-            confirmButtonProps={false}
152
-          >
153
-            <BaseTable
154
-              columns={columnsCheck.value}
155
-              ref={tableRef}
156
-              selectionRows={selectionRows.value}
157
-              request={async ({ pageSize = 10, current = 1 }) => {
158
-                await new Promise(resolve =>
159
-                  setTimeout(resolve, Math.random() * 1111)
160
-                );
161
-                return {
162
-                  data: Array(pageSize)
163
-                    .fill(0)
164
-                    .map((item, index) => ({
165
-                      id: Math.random(),
166
-                      name: "Tom" + current,
167
-                      date123: "date123" + current,
168
-                      createTime: new Date().getTime(),
169
-                      districtName: "区划" + index,
170
-                      districtName1: "区划1" + index,
171
-                      type: index % 3
172
-                    })),
173
-                  current,
174
-                  total: 500
175
-                };
176
-              }}
177
-              curdConfig={{
178
-                /**
179
-                 * 接受自动表单的数据
180
-                 * @param data
181
-                 */
182
-                async onAddOrEdit(data) {},
183
-
184
-                unitColSpan: 24
185
-              }}
186
-            />
187
-          </BaseDialog>
188
-        </div>
189
-      );
190
-    };
191
-    const checkReport = () => {
192
-      forecastDialogRef.value.open();
193
-    };
194
-    const timeVariance = row => {
195
-      if (row.type == 0) {
196
-        // 工时
197
-        router.push({
198
-          path: "/standardComparison/manHour",
199
-        });
200
-      } else if (row.type == 1) {
201
-        // 人工
202
-        router.push({
203
-          path: "/standardComparison/artificial",
204
-        });
205
-      } else if (row.type == 2) {
206
-        // 材料
207
-        router.push({
208
-          path: "/standardComparison/materials",
209
-        });
210
-      }
211
-    };
212
-    return render;
213
-  }
143
+            );
144
+        };
145
+        const handleBatchImport = () => {
146
+            forecastDialogRef.value.open()
147
+        };
148
+        const handleExport = () => {
149
+            console.log(selectionRows.value,"PPPPPPPPPPPPPPPPPP");
150
+            
151
+        };
152
+        return render;
153
+    },
214 154
 });
215 155
 </script>
216
-<style lang="scss" scoped></style>
156
+<style lang="scss" scoped></style>