|
|
@@ -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>
|