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

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

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

+ 2
- 2
.env.development Просмотреть файл

@@ -5,10 +5,10 @@ VITE_APP_TITLE='Qomo Ai'
5 5
 VITE_APP_ENV='development'
6 6
 
7 7
 # 子应用路径配置
8
-VITE_APP_PATH='/layoutApp/testApp'
8
+VITE_APP_PATH='/layoutApp/newEnergy'
9 9
 
10 10
 # 子应用名称
11
-VITE_APP_NAME='testApp'
11
+VITE_APP_NAME='newEnergy'
12 12
 
13 13
 # 开发环境
14 14
 VITE_APP_BASE_API=http://172.16.1.141:8082

+ 2
- 2
.env.production Просмотреть файл

@@ -5,10 +5,10 @@ VITE_APP_TITLE='Qomo Ai'
5 5
 VITE_APP_ENV='production'
6 6
 
7 7
 # 子应用路径配置
8
-VITE_APP_PATH='/layoutApp/testApp'
8
+VITE_APP_PATH='/layoutApp/newEnergy'
9 9
 
10 10
 # 子应用名称
11
-VITE_APP_NAME='testApp'
11
+VITE_APP_NAME='newEnergy'
12 12
 
13 13
 
14 14
 # 是否在打包时开启压缩,支持 gzip 和 brotli

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

@@ -21,7 +21,7 @@
21 21
     "@vueuse/core": "10.6.1",
22 22
     "axios": "1.6.7",
23 23
     "echarts": "^5.5.0",
24
-    "element-plus": "2.7.3",
24
+    "element-plus": "2.4.3",
25 25
     "file-saver": "2.0.5",
26 26
     "js-cookie": "3.0.5",
27 27
     "jsencrypt": "3.3.2",

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

@@ -1,4 +1,5 @@
1 1
 import { createApp } from "vue";
2
+import { isHttp } from "@/utils/validate";
2 3
 import "./assets/styles/tailwind.css";
3 4
 import Cookies from "js-cookie";
4 5
 import "@/utils/flexible.js";

+ 44
- 44
src/permission.js Просмотреть файл

@@ -10,51 +10,51 @@ import usePermissionStore from "@/store/modules/permission";
10 10
 
11 11
 NProgress.configure({ showSpinner: false });
12 12
 
13
-const whiteList = ["/login", "/register"];
13
+// const whiteList = ["/login", "/register"];
14 14
 
15
-router.beforeEach((to, from, next) => {
16
-  NProgress.start();
17
-  if (getToken()) {
18
-    to.meta.title && useSettingsStore().setTitle(to.meta.title);
19
-    /* has token*/
20
-    if (to.path === "/login") {
21
-      next({ path: "/" });
22
-      NProgress.done();
23
-    } else if (whiteList.indexOf(to.path) !== -1) {
24
-      next();
25
-    } else {
26
-      if (useUserStore().roles.length === 0) {
27
-        isRelogin.show = true;
28
-        useUserStore()
29
-          .getInfo()
30
-          .then(() => {
31
-            isRelogin.show = true;
32
-            usePermissionStore()
33
-              .generateRoutes()
34
-              .then(routes => {
35
-                routes.forEach(route => {
36
-                  if (!isHttp(route.path)) {
37
-                    router.addRoute(route); // 动态添加可访问路由表
38
-                  }
39
-                });
40
-                next({ ...to, replace: true });
41
-              });
42
-          });
43
-      } else {
44
-        next();
45
-      }
46
-    }
47
-  } else {
48
-    // 没有token
49
-    if (whiteList.indexOf(to.path) !== -1) {
50
-      // 在免登录白名单,直接进入
51
-      next();
52
-    } else {
53
-      next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页
54
-      NProgress.done();
55
-    }
56
-  }
57
-});
15
+// router.beforeEach((to, from, next) => {
16
+//   NProgress.start();
17
+//   if (getToken()) {
18
+//     to.meta.title && useSettingsStore().setTitle(to.meta.title);
19
+//     /* has token*/
20
+//     if (to.path === "/login") {
21
+//       next({ path: "/" });
22
+//       NProgress.done();
23
+//     } else if (whiteList.indexOf(to.path) !== -1) {
24
+//       next();
25
+//     } else {
26
+//       if (useUserStore().roles.length === 0) {
27
+//         isRelogin.show = true;
28
+//         useUserStore()
29
+//           .getInfo()
30
+//           .then(() => {
31
+//             isRelogin.show = true;
32
+//             usePermissionStore()
33
+//               .generateRoutes()
34
+//               .then(routes => {
35
+//                 routes.forEach(route => {
36
+//                   if (!isHttp(route.path)) {
37
+//                     router.addRoute(route); // 动态添加可访问路由表
38
+//                   }
39
+//                 });
40
+//                 next({ ...to, replace: true });
41
+//               });
42
+//           });
43
+//       } else {
44
+//         next();
45
+//       }
46
+//     }
47
+//   } else {
48
+//     // 没有token
49
+//     if (whiteList.indexOf(to.path) !== -1) {
50
+//       // 在免登录白名单,直接进入
51
+//       next();
52
+//     } else {
53
+//       next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页
54
+//       NProgress.done();
55
+//     }
56
+//   }
57
+// });
58 58
 
59 59
 router.afterEach(() => {
60 60
   NProgress.done();

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

@@ -129,18 +129,18 @@ export const constantRoutes = [
129 129
       }
130 130
     ]
131 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
-  },
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
+  // },
144 144
   {
145 145
     path: '',
146 146
     component: Layout,
@@ -225,6 +225,19 @@ export const constantRoutes = [
225 225
       }
226 226
     ]
227 227
   },
228
+  //成本挖掘
229
+  {
230
+    path: '',
231
+    component: Layout,
232
+    children: [
233
+      {
234
+        path: "costMining",
235
+        component: () => import("@/views/costMining/index"),
236
+        name: "CostMining",
237
+        meta: { title: "成本挖掘", icon: "tree", affix: true }
238
+      }
239
+    ]
240
+  },
228 241
   // Bom,工序,采购价格
229 242
 ];
230 243
 

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

@@ -45,6 +45,6 @@ export const genHttp = function (baseURL = "") {
45 45
   return httpRequest;
46 46
 };
47 47
 //http
48
-export const request = genHttp("/qomo");
48
+export const request = genHttp("/newEnergy");
49 49
 
50 50
 export default request;

+ 30
- 3
src/store/modules/permission.js Просмотреть файл

@@ -10,6 +10,17 @@ import { qiankunWindow } from "vite-plugin-qiankun/dist/helper";
10 10
 // 匹配views里面所有的.vue文件
11 11
 const modules = import.meta.glob("./../../views/**/*.vue");
12 12
 const appPath = import.meta.env.VITE_APP_PATH;
13
+// const requireComponent = import.meta.glob('@/views', true, /\/index\.vue$/)
14
+// // const requireComponentjeep = require.context('@/jeep/views', true,/^(?!.*JVxeDemo).*\.vue$/)
15
+// const map = new Map([])
16
+// requireComponent.keys().forEach((fileName) => {
17
+//   const componentConfig = requireComponent(fileName)
18
+//   let componentName
19
+//   const _n = fileName.split('/').slice(1, fileName.split('/').length).join('/')
20
+//   if (_n) componentName = _n.replace(/.vue/g, '')
21
+//   else componentName = componentConfig.default.__file
22
+//   map.set(componentName, componentConfig.default || componentConfig)
23
+// })
13 24
 
14 25
 const usePermissionStore = defineStore("permission", {
15 26
   state: () => ({
@@ -41,7 +52,7 @@ const usePermissionStore = defineStore("permission", {
41 52
           data = menu;
42 53
         } else {
43 54
           const menus = await listByApp({
44
-            appId: this.$state.app.id
55
+            appId: JSON.parse(localStorage.getItem("appChild"))?.app.id
45 56
           });
46 57
           data = filterChangeType(menus);
47 58
         }
@@ -62,6 +73,22 @@ const usePermissionStore = defineStore("permission", {
62 73
         router.addRoute(rewriteRoutes);
63 74
         resolve(rewriteRoutes);
64 75
       });
76
+      // const data = menu;
77
+      // const sdata = JSON.parse(JSON.stringify(data));
78
+      // const rdata = JSON.parse(JSON.stringify(data));
79
+      // const defaultData = JSON.parse(JSON.stringify(data));
80
+      // const sidebarRoutes = filterAsyncRouter(sdata);
81
+      // const rewriteRoutes = filterAsyncRouter(rdata, false, true);
82
+      // const defaultRoutes = filterAsyncRouter(defaultData);
83
+      // const asyncRoutes = filterDynamicRoutes(dynamicRoutes);
84
+      // asyncRoutes.forEach(route => {
85
+      //   router.addRoute(route);
86
+      // });
87
+      // this.setRoutes(rewriteRoutes);
88
+      // this.setSidebarRouters(constantRoutes.concat(sidebarRoutes));
89
+      // this.setDefaultRoutes(sidebarRoutes);
90
+      // this.setTopbarRoutes(defaultRoutes);
91
+      // resolve(rewriteRoutes);
65 92
     }
66 93
   },
67 94
   persist: true
@@ -72,11 +99,11 @@ function filterChangeType(routes) {
72 99
     return {
73 100
       component: route.menuType === 0 ? undefined : route.component,
74 101
       hidden: route.hidden,
75
-      path: route.url.replace(appPath, ""),
102
+      path: route.url.replace(appPath, "") + (route?.redirect || ""),
76 103
       name: route.menuType === 0 ? undefined : route.name,
77 104
       menuType: route.menuType,
78 105
       externalLinks: route.externalLinks,
79
-      redirect: route.url.replace(appPath, "") + "/" + route.children[0]?.url,
106
+      // redirect:  route.children[0]?.url,
80 107
       meta: {
81 108
         title: route.name,
82 109
         icon: route.icon,

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

@@ -1,175 +1,330 @@
1 1
 <script lang="tsx">
2 2
 //表格
3
-import { defineComponent, ref } from "vue";
3
+import { defineComponent, ref, watch } from "vue";
4 4
 import { ElMessage } from "element-plus";
5 5
 import Calculate from "./component/calculate.vue";
6 6
 import { transformPageResponse } from "@/utils/qomo";
7
-import { costStandardList,deleteCostStandard } from '@/api/costCalculation';
7
+import { costStandardList, deleteCostStandard } from "@/api/costCalculation";
8
+import { costStandardVersionAdd } from "@/api/costCalculation";
9
+import { modelList } from "@/api/modelManagement";
8 10
 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: "costVersion" },
17
-            { label: "年份", prop: "year", valueType: "year" },
18
-            { label: "物料编号", prop: "materialNo" },
19
-            { label: "创建日期", prop: "createTime", hideInSearchForm: true, valueType: "datetime" },
20
-            { label: "阶段", prop: "stage", valueType: 'dict-select', extraProps: { dictType: 'stageData' } },
21
-            { label: "状态", prop: "status",valueType: 'dict-select',extraProps: { dictType: 'statusList' }  },
22
-            {
23
-                type: "operation",
24
-                label: "操作",
25
-                minWidth: 200,
26
-                render: ({ row, doAddOrEdit, doDeleteRows, doReload, doPreview }) => (
27
-                    <base-table-operation
28
-                        btnList={
29
-                            [{
30
-                                key: "edit",
31
-                                label: "重新计算",
32
-                                onclick: () => doAddOrEdit(row)
33
-                            },
34
-                            {
35
-                                key: "delete",
36
-                                label: "删除",
37
-                                onclick: () => doDeleteRows(row)
38
-                            },
39
-                            {
40
-                                key: "deletion",
41
-                                label: "部件缺失信息",
42
-                            },
43
-                            {
44
-                                key: "preview",
45
-                                label: "查看详情",
46
-                                onclick: () => doPreview(row)
47
-                            }
48
-                            ]
49
-                        }
50
-                    />
51
-                )
52
-            },
53
-        ]);
11
+  setup() {
12
+    const tableRef = ref();
13
+    const visible = ref(false);
14
+    const forecastDialogRef = ref();
15
+    const forecastDialogRefNum = ref();
16
+    const formData = ref({
17
+      drawingNo: "",
18
+      stage: "",
19
+      createTime: "",
20
+      costVersion: "",
21
+      materialNo: "",
22
+      year: "",
23
+      flowDefinitionId: ""
24
+    });
25
+    const rileForm = ref();
26
+    const modelSelect = ref([]);
27
+    //列
28
+    const columns = ref([
29
+      { type: "selection" },
30
+      { label: "版本号", prop: "costVersion" },
31
+      { label: "年份", prop: "year", valueType: "year" },
32
+      { label: "物料编号", prop: "materialNo" },
33
+      {
34
+        label: "创建日期",
35
+        prop: "createTime",
36
+        hideInSearchForm: true,
37
+        valueType: "datetime"
38
+      },
39
+      {
40
+        label: "阶段",
41
+        prop: "stage",
42
+        valueType: "dict-select",
43
+        extraProps: { dictType: "stageData" }
44
+      },
45
+      {
46
+        label: "状态",
47
+        prop: "status",
48
+        valueType: "dict-select",
49
+        extraProps: { dictType: "statusList" }
50
+      },
51
+      {
52
+        type: "operation",
53
+        label: "操作",
54
+        minWidth: 200,
55
+        render: ({ row, doAddOrEdit, doDeleteRows, doReload, doPreview }) => (
56
+          <base-table-operation
57
+            btnList={[
58
+              {
59
+                key: "edit",
60
+                label: "重新计算",
61
+                onclick: () => doAddOrEdit(row)
62
+              },
63
+              {
64
+                key: "delete",
65
+                label: "删除",
66
+                onclick: () => doDeleteRows(row)
67
+              },
68
+              {
69
+                key: "deletion",
70
+                label: "部件缺失信息"
71
+              },
72
+              {
73
+                key: "preview",
74
+                label: "查看详情",
75
+                onclick: () => doPreview(row)
76
+              }
77
+            ]}
78
+          />
79
+        )
80
+      }
81
+    ]);
54 82
 
55
-        const render = () => {
56
-            return (
57
-                <div>
58
-                    <BasePageContainer flex-hidden={true} style={{ width: "100%", height: "800px", padding: "0" }}>
59
-                        <BaseTable
60
-                            columns={columns.value}
61
-                            queryParamsToUrl
62
-                            toolbar={{ layout: "search-dnamic,reload,column-setting,fullscreen" }}
63
-                            ref={tableRef}
64
-                            request={async ({
65
-                                pageSize = 10,
66
-                                current = 1,
67
-                                ...otherSearchParams
68
-                            }) => {
69
-                                let tableData = {};
70
-                                tableData = transformPageResponse(
71
-                                    await costStandardList({
72
-                                        pageNo: current,
73
-                                        pageSize,
74
-                                        ...otherSearchParams
75
-                                    })
76
-                                );
77
-                                tableData.data.forEach(item => {
78
-                                    if (item.stage == "A") {
79
-                                        item.stage = "初始"
80
-                                    } else if (item.stage == "B") {
81
-                                        item.stage = "量产"
82
-                                    } else if (item.stage == "C") {
83
-                                        item.stage = "首批"
84
-                                    }
85
-                                })
86
-                                return tableData;
87
-                            }}
88
-                            curdConfig={{
89
-                                unitColSpan: 12,
90
-                                async onDeleteRows(data) {
91
-                                    await deleteCostStandard({ id: data.id })
92
-                                },
93
-                            }}
94
-                            v-slots={{
95
-                                toolbar: () => (
96
-                                    <el-space>
97
-                                        <el-button type="primary" onClick={calculate}>
98
-                                            计算标准成本
99
-                                        </el-button>
100
-                                        <el-button type="success" onClick={batchCalculate}>批量计算</el-button>
101
-                                        <el-button type="info" onClick={batchExport}>批量导出</el-button>
102
-                                    </el-space>
103
-                                ),
104
-                            }}
105
-                        />
106
-                    </BasePageContainer>
107
-                    <Calculate visible={visible.value} onCancelVisible={cancelVisible} tableRef={tableRef.value}></Calculate>
108
-                    <base-dialog-form
109
-                        ref={forecastDialogRef}
110
-                        title={"批量计算"}
111
-                        width={400}
112
-                        labelWidth={0}
113
-                        rules={{
114
-                            filed: [
115
-                                { required: true, message: "请上传附件", trigger: "blur" }
116
-                            ]
117
-                        }}
118
-                        confirm={() => {
119
-                            {/* forecastDialogRef.value.open(); */ }
120
-                        }}
121
-                        cancel={() => {
122
-                            forecastDialogRef.value.close();
123
-                        }}
124
-                        v-slots={{
125
-                            default: ({ model }) => (
126
-                                <el-form-item label="" prop="filed">
127
-                                    <base-upload
128
-                                        drag
129
-                                        multiple
130
-                                        limit={1}
131
-                                        on-change={onChange}
132
-                                        v-model={model.fileIds}
133
-                                        accept=".xls,.xlsx,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
134
-                                    >
135
-                                        <el-icon class="el-icon-upload">
136
-                                            <upload-filled />
137
-                                        </el-icon>
138
-                                        <div class="w-full">请上传文件</div>
139
-                                    </base-upload>
140
-                                </el-form-item>
141
-                            )
142
-                        }}
83
+    const render = () => {
84
+      return (
85
+        <div>
86
+          <BasePageContainer
87
+            flex-hidden={true}
88
+            style={{ width: "100%", height: "800px", padding: "0" }}
89
+          >
90
+            <BaseTable
91
+              columns={columns.value}
92
+              queryParamsToUrl
93
+              toolbar={{
94
+                layout: "search-dnamic,reload,column-setting,fullscreen"
95
+              }}
96
+              ref={tableRef}
97
+              request={async ({
98
+                pageSize = 10,
99
+                current = 1,
100
+                ...otherSearchParams
101
+              }) => {
102
+                let tableData = {};
103
+                tableData = transformPageResponse(
104
+                  await costStandardList({
105
+                    pageNo: current,
106
+                    pageSize,
107
+                    ...otherSearchParams
108
+                  })
109
+                );
110
+                tableData.data.forEach(item => {
111
+                  if (item.stage == "A") {
112
+                    item.stage = "初始";
113
+                  } else if (item.stage == "B") {
114
+                    item.stage = "量产";
115
+                  } else if (item.stage == "C") {
116
+                    item.stage = "首批";
117
+                  }
118
+                });
119
+                return tableData;
120
+              }}
121
+              curdConfig={{
122
+                unitColSpan: 12,
123
+                async onDeleteRows(data) {
124
+                  await deleteCostStandard({ id: data.id });
125
+                }
126
+              }}
127
+              v-slots={{
128
+                toolbar: () => (
129
+                  <el-space>
130
+                    <el-button type="primary" onClick={calculate}>
131
+                      计算标准成本
132
+                    </el-button>
133
+                    <el-button type="success" onClick={batchCalculate}>
134
+                      批量计算
135
+                    </el-button>
136
+                    <el-button type="info" onClick={batchExport}>
137
+                      批量导出
138
+                    </el-button>
139
+                  </el-space>
140
+                )
141
+              }}
142
+            />
143
+          </BasePageContainer>
144
+          <base-dialog-form
145
+            ref={forecastDialogRefNum}
146
+            v-model={visible.value}
147
+            title={"生成设置版本号"}
148
+            width={400}
149
+            labelWidth={0}
150
+            confirm={() => {
151
+              const year = formData.value.createTime.split("-")[0];
152
+              formData.value.year = year;
153
+              costStandardVersionAdd(formData.value).then(res => {
154
+                tableRef.value.doReload();
155
+              });
156
+            }}
157
+            cancel={() => {
158
+              
159
+            }}
160
+          >
161
+            <el-form
162
+              ref={rileForm}
163
+              v-model={formData.value}
164
+              label-width="100px"
165
+            >
166
+              <el-form-item label="图号" prop="drawingNo">
167
+                <el-input
168
+                  v-model={formData.value.drawingNo}
169
+                  onChange={splicing}
170
+                />
171
+              </el-form-item>
172
+              <el-form-item label="物料号" prop="materialNo">
173
+                <el-input v-model={formData.value.materialNo} />
174
+              </el-form-item>
175
+              <el-form-item label="项目阶段" prop="stage">
176
+                <el-select
177
+                  v-model={formData.value.stage}
178
+                  placeholder="请选择项目阶段"
179
+                  onChange={splicing}
180
+                >
181
+                  <el-option label="初始" value="A"></el-option>
182
+                  <el-option label="量产" value="B"></el-option>
183
+                  <el-option label="首批" value="C"></el-option>
184
+                </el-select>
185
+              </el-form-item>
186
+              <el-form-item label="选择模型" prop="stage">
187
+                <el-select
188
+                  v-model={formData.value.flowDefinitionId}
189
+                  placeholder="请选择项目阶段"
190
+                  onChange={splicing}
191
+                >
192
+                  {modelSelect.value.map(item => (
193
+                    <ElOption
194
+                      key={item.value}
195
+                      label={item.label}
196
+                      value={item.value}
143 197
                     />
144
-                </div>
145
-            );
146
-        };
147
-        const calculate = () => {
148
-            visible.value = true;
149
-        }
150
-        const cancelVisible = () => {
151
-            visible.value = false;
152
-        }
153
-        const batchCalculate = () => {
154
-            forecastDialogRef.value.open();
155
-        }
156
-        const batchExport = () => {
157
-            console.log(tableRef.value.selectionRows, "批量导出");
158
-        }
159
-        const onChange = (file) => {
160
-            console.log(file, "PPPPPPPPPPPPPPPPPPPP");
198
+                  ))}
199
+                </el-select>
200
+              </el-form-item>
201
+              <el-form-item label="创建日期" prop="createTime">
202
+                <el-date-picker
203
+                  v-model={formData.value.createTime}
204
+                  type="datetime"
205
+                  disabledDate={time => {
206
+                    return time.getTime() > Date.now();
207
+                  }}
208
+                  value-format="YYYY-MM-DD HH:MM:ss"
209
+                  onChange={splicing}
210
+                  placeholder="选择日期"
211
+                ></el-date-picker>
212
+              </el-form-item>
213
+              <el-form-item label="生成版本号" prop="costVersion">
214
+                <el-input
215
+                  type="textarea"
216
+                  disabled
217
+                  rows="2"
218
+                  v-model={formData.value.costVersion}
219
+                />
220
+              </el-form-item>
221
+            </el-form>
222
+          </base-dialog-form>
223
+          {/* <Calculate
224
+            visible={visible.value}
225
+            onCancelVisible={cancelVisible}
226
+            tableRef={tableRef.value}
227
+          ></Calculate> */}
228
+          <base-dialog-form
229
+            ref={forecastDialogRef}
230
+            title={"批量计算"}
231
+            width={400}
232
+            labelWidth={0}
233
+            rules={{
234
+              filed: [
235
+                { required: true, message: "请上传附件", trigger: "blur" }
236
+              ]
237
+            }}
238
+            confirm={() => {
239
+              {
240
+                /* forecastDialogRef.value.open(); */
241
+              }
242
+            }}
243
+            cancel={() => {
244
+              forecastDialogRef.value.close();
245
+            }}
246
+            v-slots={{
247
+              default: ({ model }) => (
248
+                <el-form-item label="" prop="filed">
249
+                  <base-upload
250
+                    drag
251
+                    multiple
252
+                    limit={1}
253
+                    on-change={onChange}
254
+                    v-model={model.fileIds}
255
+                    accept=".xls,.xlsx,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
256
+                  >
257
+                    <el-icon class="el-icon-upload">
258
+                      <upload-filled />
259
+                    </el-icon>
260
+                    <div class="w-full">请上传文件</div>
261
+                  </base-upload>
262
+                </el-form-item>
263
+              )
264
+            }}
265
+          />
266
+        </div>
267
+      );
268
+    };
269
+    const calculate = () => {
270
+      visible.value = true;
271
+    };
272
+    const cancelVisible = () => {
273
+      visible.value = false;
274
+    };
275
+    const batchCalculate = () => {
276
+      forecastDialogRef.value.open();
277
+    };
278
+    const batchExport = () => {
279
+      console.log(tableRef.value.selectionRows, "批量导出");
280
+    };
281
+    const onChange = file => {
282
+      console.log(file, "PPPPPPPPPPPPPPPPPPPP");
161 283
 
162
-            const isExcel = file.raw.type === 'application/vnd.ms-excel' ||
163
-                file.raw.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
164
-            if (!isExcel) {
165
-                ElMessage.error('只能上传Excel文件!');
166
-                return false;
167
-            }
168
-            return true;
169
-        }
170
-        const doReload = () => { }
171
-        return render;
172
-    },
284
+      const isExcel =
285
+        file.raw.type === "application/vnd.ms-excel" ||
286
+        file.raw.type ===
287
+          "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
288
+      if (!isExcel) {
289
+        ElMessage.error("只能上传Excel文件!");
290
+        return false;
291
+      }
292
+      return true;
293
+    };
294
+    const splicing = () => {
295
+      formData.value.costVersion = "";
296
+      formData.value.costVersion =
297
+        formData.value.drawingNo +
298
+        "_" +
299
+        formData.value.stage +
300
+        "_" +
301
+        formData.value.createTime;
302
+    };
303
+    watch(visible, (newVal, oldVal) => {
304
+      if (newVal) {
305
+        formData.value = {
306
+          drawingNo: "",
307
+          stage: "",
308
+          createTime: "",
309
+          costVersion: "",
310
+          materialNo: "",
311
+          year: "",
312
+          flowDefinitionId: ""
313
+        };
314
+        modelList({ pageNo: 1, pageSize: 999, projectId: 49 }).then(res => {
315
+          modelSelect.value = res.records.map(item => {
316
+            return {
317
+              value: item.id,
318
+              label: item.name
319
+            };
320
+          });
321
+          console.log(modelSelect.value, "PPPPPPPPPPPPPPPPPPPPP");
322
+        });
323
+      }
324
+    });
325
+    const doReload = () => {};
326
+    return render;
327
+  }
173 328
 });
174 329
 </script>
175 330
 <style lang="scss" scoped></style>

+ 118
- 0
src/views/costMining/component/artificial.vue Просмотреть файл

@@ -0,0 +1,118 @@
1
+<script lang="tsx">
2
+//表格
3
+import { defineComponent, ref } from "vue";
4
+import { ElMessage } from "element-plus";
5
+import { useRouter } from 'vue-router';
6
+export default defineComponent({
7
+  setup() {
8
+    const tableRef = ref();
9
+    const router = useRouter();
10
+    //列
11
+    const columns = ref([
12
+      { prop: "districtName", label: "内部订单号",hideInSearchForm: true },
13
+      { label: "物料编码", prop: "name",hideInSearchForm: true },
14
+      { label: "物料信息", prop: "date123",hideInSearchForm: true },
15
+      { prop: "createTime", label: "成本中心代码" ,hideInSearchForm: true },
16
+
17
+      { prop: "districtName", label: "成本中心名称",hideInSearchForm: true },
18
+      { label: "基于成品结构用量(版本1)", prop: "name",hideInSearchForm: true },
19
+      { label: "单个零件报工工时(版本1)", prop: "date123",hideInSearchForm: true },
20
+      { prop: "createTime", label: "人工工时(版本1)" ,hideInSearchForm: true },
21
+
22
+      { prop: "districtName", label: "人工费率(版本1)",hideInSearchForm: true },
23
+      { label: "基于成品结构用量(版本2)", prop: "name",hideInSearchForm: true },
24
+      { label: "单个零件报工工时(版本2)", prop: "date123",hideInSearchForm: true },
25
+      { prop: "createTime", label: "人工工时(版本2)" ,hideInSearchForm: true },
26
+
27
+      { prop: "districtName", label: "人工费率(版本2)",hideInSearchForm: true },
28
+      { label: "人工差价", prop: "name",hideInSearchForm: true },
29
+      { label: "人工量差", prop: "date123",hideInSearchForm: true },
30
+      { prop: "createTime", label: "人工总差" ,hideInSearchForm: true },
31
+
32
+      { prop: "districtName", label: "基于成品结构用量(版本1)",hideInSearchForm: true },
33
+      { label: "单个零件报工工时(版本1)", prop: "name",hideInSearchForm: true },
34
+      { label: "燃动力工时(版本1)", prop: "date123",hideInSearchForm: true },
35
+      { prop: "createTime", label: "燃动力费率(版本1)" ,hideInSearchForm: true },
36
+
37
+      { prop: "districtName", label: "基于成品结构用量(版本2)",hideInSearchForm: true },
38
+      { label: "单个零件报工工时(版本2)", prop: "name",hideInSearchForm: true },
39
+      { label: "燃动力工时(版本2)", prop: "date123",hideInSearchForm: true },
40
+      { prop: "createTime", label: "燃动力费率(版本2)" ,hideInSearchForm: true },
41
+
42
+      { prop: "districtName", label: "燃动力价差",hideInSearchForm: true },
43
+      { label: "燃动力量差", prop: "name",hideInSearchForm: true },
44
+      { label: "燃动力总差", prop: "date123",hideInSearchForm: true },
45
+      { prop: "createTime", label: "基于成品结构用量(版本1)" ,hideInSearchForm: true },
46
+
47
+      { prop: "districtName", label: "单个零件报工工时(版本1)",hideInSearchForm: true },
48
+      { label: "辅料工时(版本1)", prop: "name",hideInSearchForm: true },
49
+      { label: "辅料费率(版本1)", prop: "date123",hideInSearchForm: true },
50
+      { prop: "createTime", label: "基于成品结构用量(版本2)" ,hideInSearchForm: true },
51
+
52
+      { prop: "districtName", label: "单个零件报工工时(版本2)",hideInSearchForm: true },
53
+      { label: "辅料工时(版本2)", prop: "name",hideInSearchForm: true },
54
+      { label: "辅料费率(版本2)", prop: "date123",hideInSearchForm: true },
55
+      { prop: "createTime", label: "辅料价差" ,hideInSearchForm: true },
56
+
57
+      { prop: "districtName", label: "辅料量差",hideInSearchForm: true },
58
+      { label: "辅料总差", prop: "name",hideInSearchForm: true },
59
+      { label: "基于成品结构用量(版本1)", prop: "date123",hideInSearchForm: true },
60
+      { prop: "createTime", label: "单个零件报工工时(版本1)" ,hideInSearchForm: true },
61
+
62
+      { prop: "districtName", label: "其他工时(版本1)",hideInSearchForm: true },
63
+      { label: "其他费率(版本1)", prop: "name",hideInSearchForm: true },
64
+      { label: "基于成品结构用量(版本2)", prop: "date123",hideInSearchForm: true },
65
+      { prop: "createTime", label: "单个零件报工工时(版本2)" ,hideInSearchForm: true },
66
+
67
+      { prop: "districtName", label: "其他工时(版本2)",hideInSearchForm: true },
68
+      { label: "其他费率(版本2)", prop: "name",hideInSearchForm: true },
69
+      { label: "其他价差", prop: "date123",hideInSearchForm: true },
70
+      { prop: "createTime", label: "其他量差" ,hideInSearchForm: true },
71
+
72
+      { prop: "districtName", label: "其他总差",hideInSearchForm: true },
73
+    ]);
74
+
75
+    const render = () => {
76
+      return (
77
+        <BaseTable
78
+          columns={columns.value}
79
+          queryParamsToUrl
80
+          ref={tableRef}
81
+          request={async ({ pageSize = 10, current = 1, ...otherSearchParams }) => {
82
+            await new Promise((resolve) => setTimeout(resolve, Math.random() * 1111));
83
+            return {
84
+              data: Array(pageSize)
85
+                .fill(0)
86
+                .map((item, index) => ({
87
+                  id: Math.random(),
88
+                  name: "Tom" + current,
89
+                  date123: "date123" + current,
90
+                  createTime: new Date().getTime(),
91
+                  districtName: "区划" + index,
92
+                  districtName1: "区划1" + index,
93
+                })),
94
+              current,
95
+              // pages: 500 / pageSize,
96
+              total: 500,
97
+            };
98
+          }}
99
+          curdConfig={{
100
+          }}
101
+          v-slots={{
102
+            toolbar: ({ doAddOrEdit }) => (
103
+              <el-space>
104
+                <el-button type="danger" onClick={toBack}>返回</el-button>
105
+              </el-space>
106
+            ),
107
+          }}
108
+        />
109
+      );
110
+    };
111
+    const toBack = ()=>{
112
+      router.go(-1);
113
+    }
114
+    return render;
115
+  },
116
+});
117
+</script>
118
+<style lang="scss" scoped></style>

+ 73
- 0
src/views/costMining/component/manHour.vue Просмотреть файл

@@ -0,0 +1,73 @@
1
+<script lang="tsx">
2
+//表格
3
+import { defineComponent, ref } from "vue";
4
+import { ElMessage } from "element-plus";
5
+import { useRouter } from 'vue-router';
6
+export default defineComponent({
7
+  setup() {
8
+    const tableRef = ref();
9
+    const router = useRouter();
10
+    //列
11
+    const columns = ref([
12
+      { prop: "districtName", label: "成本中心代码",hideInSearchForm: true },
13
+      { label: "成本中心代码名称", prop: "name",hideInSearchForm: true },
14
+      { label: "基于成品结构用量(版本1)", prop: "date123",hideInSearchForm: true },
15
+      { prop: "createTime", label: "单个零件报工工时(版本1)" ,hideInSearchForm: true },
16
+      { prop: "districtName", label: "人工工时(版本1)",hideInSearchForm: true },
17
+      { label: "基于成品结构用量(版本2)", prop: "name",hideInSearchForm: true },
18
+      { label: "单个零件报工工时(版本2)", prop: "date123",hideInSearchForm: true },
19
+      { prop: "createTime", label: "人工工时(版本2)" ,hideInSearchForm: true },
20
+      { prop: "districtName", label: "人工工时总差",hideInSearchForm: true },
21
+      { label: "基于成品结构用量(版本1)", prop: "name",hideInSearchForm: true },
22
+      { label: "单个零件报工工时(版本1)", prop: "date123",hideInSearchForm: true },
23
+      { prop: "createTime", label: "机器工时(版本1)" ,hideInSearchForm: true },
24
+      { prop: "districtName", label: "基于成品结构用量(版本2)",hideInSearchForm: true },
25
+      { label: "单个零件报工工时(版本2)", prop: "name",hideInSearchForm: true },
26
+      { label: "机器工时(版本2)", prop: "date123",hideInSearchForm: true },
27
+      { prop: "createTime", label: "机器工时总差" ,hideInSearchForm: true },
28
+    ]);
29
+
30
+    const render = () => {
31
+      return (
32
+        <BaseTable
33
+          columns={columns.value}
34
+          queryParamsToUrl
35
+          ref={tableRef}
36
+          request={async ({ pageSize = 10, current = 1, ...otherSearchParams }) => {
37
+            await new Promise((resolve) => setTimeout(resolve, Math.random() * 1111));
38
+            return {
39
+              data: Array(pageSize)
40
+                .fill(0)
41
+                .map((item, index) => ({
42
+                  id: Math.random(),
43
+                  name: "Tom" + current,
44
+                  date123: "date123" + current,
45
+                  createTime: new Date().getTime(),
46
+                  districtName: "区划" + index,
47
+                  districtName1: "区划1" + index,
48
+                })),
49
+              current,
50
+              // pages: 500 / pageSize,
51
+              total: 500,
52
+            };
53
+          }}
54
+          curdConfig={{
55
+          }}
56
+          v-slots={{
57
+            toolbar: ({ doAddOrEdit }) => (
58
+              <el-space>
59
+                <el-button type="danger" onClick={toBack}>返回</el-button>
60
+              </el-space>
61
+            ),
62
+          }}
63
+        />
64
+      );
65
+    };
66
+    const toBack = ()=>{
67
+      router.go(-1);
68
+    }
69
+    return render;
70
+  },
71
+});
72
+</script>
73
+<style lang="scss" scoped></style>

+ 75
- 0
src/views/costMining/component/materials.vue Просмотреть файл

@@ -0,0 +1,75 @@
1
+<script lang="tsx">
2
+//表格
3
+import { defineComponent, ref } from "vue";
4
+import { ElMessage } from "element-plus";
5
+import { useRouter } from 'vue-router';
6
+export default defineComponent({
7
+  setup() {
8
+    const tableRef = ref();
9
+    const router = useRouter();
10
+    //列
11
+    const columns = ref([
12
+      { prop: "districtName", label: "单位",hideInSearchForm: true },
13
+      { label: "采购类型", prop: "name",hideInSearchForm: true },
14
+      { label: "特殊采购类型", prop: "date123",hideInSearchForm: true },
15
+      { prop: "createTime", label: "结构用量" ,hideInSearchForm: true },
16
+
17
+      { prop: "districtName", label: "单位材料价格",hideInSearchForm: true },
18
+      { label: "单位总成本", prop: "name",hideInSearchForm: true },
19
+      { label: "版本1", prop: "date123",hideInSearchForm: true },
20
+      { prop: "createTime", label: "结构用量" ,hideInSearchForm: true },
21
+
22
+      { prop: "districtName", label: "单位材料价格",hideInSearchForm: true },
23
+      { label: "单位总成本", prop: "name",hideInSearchForm: true },
24
+      { label: "版本2", prop: "date123",hideInSearchForm: true },
25
+      { prop: "createTime", label: "结构用量量差" ,hideInSearchForm: true },
26
+
27
+      { prop: "districtName", label: "材料价格价差",hideInSearchForm: true },
28
+      { label: "单位成本差异", prop: "name",hideInSearchForm: true },
29
+      { label: "备注", prop: "date123",hideInSearchForm: true },
30
+    ]);
31
+
32
+    const render = () => {
33
+      return (
34
+        <BaseTable
35
+          columns={columns.value}
36
+          queryParamsToUrl
37
+          ref={tableRef}
38
+          request={async ({ pageSize = 10, current = 1, ...otherSearchParams }) => {
39
+            await new Promise((resolve) => setTimeout(resolve, Math.random() * 1111));
40
+            return {
41
+              data: Array(pageSize)
42
+                .fill(0)
43
+                .map((item, index) => ({
44
+                  id: Math.random(),
45
+                  name: "Tom" + current,
46
+                  date123: "date123" + current,
47
+                  createTime: new Date().getTime(),
48
+                  districtName: "区划" + index,
49
+                  districtName1: "区划1" + index,
50
+                })),
51
+              current,
52
+              // pages: 500 / pageSize,
53
+              total: 500,
54
+            };
55
+          }}
56
+          curdConfig={{
57
+          }}
58
+          v-slots={{
59
+            toolbar: ({ doAddOrEdit }) => (
60
+              <el-space>
61
+                <el-button type="danger" onClick={toBack}>返回</el-button>
62
+              </el-space>
63
+            ),
64
+          }}
65
+        />
66
+      );
67
+    };
68
+    const toBack = ()=>{
69
+      router.go(-1);
70
+    }
71
+    return render;
72
+  },
73
+});
74
+</script>
75
+<style lang="scss" scoped></style>

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

@@ -0,0 +1,216 @@
1
+<script lang="tsx">
2
+//表格
3
+import { defineComponent, ref } from "vue";
4
+import { ElMessage } from "element-plus";
5
+import { transformPageResponse } from "@/utils/qomo";
6
+import { useRouter } from "vue-router";
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
+    ]);
93
+
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) {},
134
+
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
+  }
214
+});
215
+</script>
216
+<style lang="scss" scoped></style>

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

@@ -3,154 +3,214 @@
3 3
 import { defineComponent, ref } from "vue";
4 4
 import { ElMessage } from "element-plus";
5 5
 import { transformPageResponse } from "@/utils/qomo";
6
-import { hourRateList, addHourRate, editHourRate, deleteHourRate, deleteBatchHourRate } from '@/api/hour';
6
+import { useRouter } from "vue-router";
7 7
 export default defineComponent({
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
-        ]);
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
+    ]);
50 93
 
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>
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) {},
142 134
 
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
-    },
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
+  }
154 214
 });
155 215
 </script>
156 216
 <style lang="scss" scoped></style>

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

@@ -53,26 +53,26 @@ export default defineConfig(({ mode, command }) => {
53 53
       hmr: { overlay: false },
54 54
       proxy: {
55 55
         // https://cn.vitejs.dev/config/#server-proxy
56
-        "/qomo": {
56
+        "/newEnergy": {
57 57
           // target: "http://172.16.0.241:8095", //wq
58 58
           // target: "http://172.16.0.162:8082",  //bgy
59
-          target: "http://172.16.2.127:8082",  //bgy远程
60
-          // target: "http://192.168.50.9:2999",//中平台
59
+          // target: "http://192.168.43.195:8098",  //bgy远程
60
+          // target: "http://192.168.50.9:2999",//中平台
61 61
           changeOrigin: true,
62 62
           pathRewrite: {
63
-            "^/qomo": "/qomo"
63
+            "^/newEnergy": "/newEnergy"
64 64
           }
65 65
         },
66
-        "/qomo/flowSocket": {
66
+        "/newEnergy/flowSocket": {
67 67
           // target: 'ws://192.168.0.66:60601/',这是后端接口地址
68
-          target: 'ws://172.16.0.162:8082',
68
+          // target: 'ws://192.168.43.195:8098',
69 69
           // target: 'ws://192.168.50.99:2999',
70 70
           changeOrigin: true,
71 71
           ws: true
72 72
         },
73
-        "/qomo/taskSocket": {
73
+        "/newEnergy/taskSocket": {
74 74
           // target: 'ws://192.168.0.66:60601/',这是后端接口地址
75
-          target: 'ws://172.16.0.162:8082',
75
+          // target: 'ws://192.168.43.195:8098',
76 76
           // target: 'ws://192.168.50.99:2999',
77 77
           changeOrigin: true,
78 78
           ws: true