dataDelivery.vue
12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
<script lang="ts" setup name="dataDelivery">
import TableTools from "@/components/Tools/table_tools.vue";
import { commonPageConfig, TableColumnWidth } from '@/utils/enum';
import {
getPageList,
deleteDeliveryContract,
getDeliveryVerifyDetail,
verifyStatusChange,
deliveryContract
} from "@/api/modules/dataDelivery";
const router = useRouter();
const route = useRoute();
const { proxy } = getCurrentInstance() as any;
/** 核验状态列表 */
const verifySatusList = ref([{
value: 1,
label: '未执行'
}, {
value: 2,
label: '已执行'
}, {
value: 3,
label: '通过'
}, {
value: 4,
label: '未通过'
}]);
const searchItemList = ref([
{
type: "input",
label: "",
field: "dataProductName",
default: "",
placeholder: "数据产品名称",
maxlength: 50,
clearable: true,
},
{
type: "input",
label: "",
field: "contractName",
default: "",
placeholder: "合约名称",
maxlength: 50,
clearable: true,
},
{
type: 'select',
label: '',
field: 'verifySatus',
default: '',
placeholder: '核验状态',
options: verifySatusList.value,
filterable: true,
clearable: true
}
]);
const tableFields = ref([
{ label: "序号", type: "index", width: 56, align: "center" },
{
label: "数据产品名称", field: "dataProductName", width: 150, type: "text_btn", columClass: 'text_btn', value: "detail", click: (scope) => {
router.push({
name: 'productListingDetail',
query: {
guid: scope.row.dataProductGuid,
type: 'detail',
name: scope.row.dataProductName,
}
});
}
},
{
label: "合约名称", field: "contractName", width: 160, type: "text_btn", columClass: 'text_btn', value: "detail1", click: (scope) => {
//履约中的合约状态
router.push({
name: 'smartContractDetail',
query: {
guid: scope.row.guid,
name: scope.row.contractName,
type: 'keepAgree',
isDetail: 'Y'
}
});
}
},
{
label: "交付方式", field: "deliveryMethod", width: 120, getName: (scope) => {
return scope.row.deliveryMethod == 1 ? '文件' : 'API';
}
},
{
label: "交付状态", field: "deliveryStatus", type: "tag", width: 96, align: 'center',
getName: (scope) => {
const deliveryStatus = scope.row.deliveryStatus
switch (deliveryStatus) {
case 1:
return '未交付';
case 2:
return '已交付';
case 3:
return '交付中';
default:
return '--';
}
}, tagType: (scope) => {
const deliveryStatus = scope.row.deliveryStatus
switch (deliveryStatus) {
case 3:
return 'warning';
case 2:
return 'success';
case 1:
return 'info';
default:
return 'info';
}
}
},
{
label: "核验状态", field: "verifySatus", type: "tag", width: 148, align: 'center',
btn: {
label: '查看', visible: (scope) => {
return scope.row.verifySatus != 1;
}, click: (scope) => {
//弹出查看日志框。
dialogInfo.value.visible = true;
execTableInfo.value.loading = true;
getDeliveryVerifyDetail(scope.row.guid).then((res: any) => {
execTableInfo.value.loading = false;
if (res?.code == proxy.$passCode) {
execTableInfo.value.data = res.data || [];
} else {
res?.msg && proxy.$ElMessage.error(res?.msg);
}
})
},
},
getName: (scope) => {
const verifySatus = scope.row.verifySatus
switch (verifySatus) {
case 1:
return '未执行';
case 2:
return '已执行';
case 3:
return '通过';
case 4:
return '未通过';
default:
return '--';
}
}, tagType: (scope) => {
const verifySatus = scope.row.verifySatus
switch (verifySatus) {
case 1:
return 'info';
case 3:
return 'success';
case 2:
return 'warning';
case 4:
return 'danger';
default:
return 'info';
}
}
},
{ label: "核验时间", field: "verifyTime", width: 170 },
{ label: "交付时间", field: "deliveryTime", width: 170 },
]);
const page = ref({
...commonPageConfig,
dataProductName: '',
contractName: '',
verifySatus: ''
});
const currTableData: any = ref({});
const tableInfo = ref({
id: 'contract-table',
rowKey: 'guid',
loading: false,
fields: tableFields.value,
data: [], //{ verifySatus: 2 }, { verifySatus: 4 }, { verifySatus: 3, deliveryStatus: 2, }
page: {
type: "normal",
rows: 0,
...page.value,
},
actionInfo: {
label: "操作",
type: "btn",
width: 160,
btns: (scope) => {
let btns: any = [];
let row = scope.row;
let deliveryStatus = row.deliveryStatus;
if (deliveryStatus == 2) {//已交付有删除按钮
btns.push({
value: 'del', label: '删除', click: (scope) => {
proxy.$openMessageBox("此操作将永久删除, 是否继续?", () => {
deleteDeliveryContract([scope.row.guid]).then((res: any) => {
if (res?.code == proxy.$passCode) {
page.value.curr = 1;
getTableData();
proxy.$ElMessage.success('删除成功');
} else {
res?.msg && proxy.$ElMessage.error(res?.msg);
}
});
}, () => {
proxy.$ElMessage.info("已取消");
})
}
});
} else {
}
// 交付只有核验通过有。
let verifySatus = row.verifySatus;
(verifySatus == 1 || verifySatus == 4) && btns.push({
value: 'refresh', label: '刷新', click: (scope) => {
}
});
if (verifySatus == 2) {
btns.push({
value: 'verify', label: '核验', click: (scope) => {
currTableData.value = scope.row;
verifyDialogInfo.value.visible = true;
verifyDialogInfo.value.contents[0].formInfo.items[0].default = 'TG';
verifyDialogInfo.value.contents[0].formInfo.items[1].default = '';
}
});
}
//已通过且未交付时,有交付按钮
verifySatus == 3 && deliveryStatus != 2 && btns.push({
value: 'delivery', label: '交付', click: (scope) => {
deliveryContract(scope.row.guid).then((res: any) => {
if (res?.code == proxy.$passCode) {
getTableData();
proxy.$ElMessage.success('交付提交成功');
} else {
res?.msg && proxy.$ElMessage.error(res?.msg);
}
})
}
});
return btns;
}
}
});
const toSearch = (val: any, clear: boolean = false) => {
if (clear) {
searchItemList.value.map((item) => (item.default = ""));
page.value.dataProductName = '';
page.value.contractName = '';
page.value.verifySatus = "";
} else {
page.value.dataProductName = val.dataProductName;
page.value.contractName = val.contractName;
page.value.verifySatus = val.verifySatus;
}
getTableData();
};
const getTableData = () => {
tableInfo.value.loading = true
getPageList({
pageIndex: page.value.curr,
pageSize: page.value.limit,
dataProductName: page.value.dataProductName,
contractName: page.value.contractName,
verifySatus: page.value.verifySatus
}).then((res: any) => {
tableInfo.value.loading = false
if (res?.code == proxy.$passCode) {
const data = res.data || {};
tableInfo.value.data = data.records || []
tableInfo.value.page.limit = data.pageSize
tableInfo.value.page.curr = data.pageIndex
tableInfo.value.page.rows = data.totalRows
} else {
res?.msg && proxy.$ElMessage.error(res?.msg)
}
}).catch(() => {
tableInfo.value.loading = false
})
};
const tablePageChange = (info) => {
page.value.curr = Number(info.curr);
page.value.limit = Number(info.limit);
tableInfo.value.page.curr = page.value.curr;
tableInfo.value.page.limit = page.value.limit;
getTableData();
};
onBeforeMount(() => {
toSearch({});
});
const dialogInfo = ref({
visible: false,
size: 700,
direction: "column",
header: {
title: "查看执行内容",
},
footer: {
visible: false
}
});
const handleDialogCancel = () => {
dialogInfo.value.visible = false;
}
const execTableInfo = ref({
id: "exec-table",
height: '214px',
fields: <any[]>[
{ label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
{ label: "策略id", field: "strategyId", width: 260 },
{ label: "操作行为", field: "action", width: 120 },
{ label: "操作行为英文名称", field: "actionEnName", width: 140 },
{ label: "约束条件", field: "constraintName", width: 120 },
{ label: "约束条件英文名称", field: "constraintEnName", width: 140 },
{ label: "约束条件运算符", field: "constraintOperatorName", width: 140 },
{ label: "约束条件值", field: "constraintValue", width: 150 },
{ label: "检验结果", field: "result", width: 130 },
// { label: "上报时间", field: "reportingTime", width: 170 },
],
data: [],
showPage: false,
actionInfo: {
show: false
},
loading: false
});
const verifyDialogInfo = ref({
visible: false,
size: 460,
direction: "column",
header: {
title: "核验",
},
type: '',
contents: [
{
type: 'form',
title: '',
formInfo: {
id: 'batch-pass-form',
items: [
{
type: 'radio-group',
label: ' ',
field: 'verifySatus',
default: 'TG',
required: false,
options: [
{ label: '通过', value: 'TG' },
{ label: '未通过', value: 'NTG' },
],
},
{
label: '',
type: "textarea",
placeholder: "请填写未通过理由(必填)",
field: "verifySuggest",
clearable: true,
required: true,
maxlength: 200,
visible: false,
block: true,
col: 'margin_b_0',
}
]
}
}
],
footer: {
btns: [
{ type: "default", label: "取消", value: "cancel" },
{ type: "primary", label: "确定", value: "submit", loading: false },
],
},
});
const verifyDialogRadioChange = (val, info) => {
verifyDialogInfo.value.contents[0].formInfo.items[1].visible = val == 'NTG';
}
const verifyDialogBtnClick = (btn, info) => {
if (btn.value == 'submit') {
if (!info.verifySuggest) {
proxy.$ElMessage.error('请先填写未通过理由');
return;
}
verifyDialogInfo.value.footer.btns[1].loading = true;
verifyStatusChange(Object.assign({}, info, {
deliveryGuid: currTableData.value.guid
})).then((res: any) => {
verifyDialogInfo.value.footer.btns[1].loading = false;
if (res?.code == proxy.$passCode) {
proxy.$ElMessage.success('核验状态提交成功');
getTableData();
} else {
res?.msg && proxy.$ElMessage.error(res?.msg)
}
})
} else if (btn.value == 'cancel') {
verifyDialogInfo.value.visible = false;
}
};
</script>
<template>
<div class="container_wrap">
<div class="table_tool_wrap">
<TableTools :searchItems="searchItemList" :searchId="'contract-search'" @search="toSearch" :init="false" />
</div>
<div class="table_panel_wrap" style="height: calc(100% - 44px);">
<Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" />
</div>
<el-dialog v-model="dialogInfo.visible" :title="dialogInfo.header.title" width="700" :modal="true"
:close-on-click-modal="true" destroy-on-close align-center @close="handleDialogCancel">
<Table ref="execTableRef" :tableInfo="execTableInfo" class="exec-table" />
</el-dialog>
<Dialog :dialogInfo="verifyDialogInfo" @btnClick="verifyDialogBtnClick"
@radio-group-change=verifyDialogRadioChange />
</div>
</template>
<style lang="scss" scoped>
.container_wrap {
padding: 0px 16px;
}
</style>