productApplicationManage.vue
6.63 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
<template>
<div class="container_wrap">
<div class="table_tool_wrap">
<TableTools :searchItems="searchItemList" :searchId="'data-application-search'" @search="toSearch" />
</div>
<div class="table_panel_wrap" :style="{ height: 'calc(100% - 48px)' }">
<Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" />
</div>
</div>
</template>
<script lang="ts" setup name="productApplicationManage">
import { commonPageConfig } from "@/components/PageNav";
import TableTools from "@/components/Tools/table_tools.vue";
import useUserStore from "@/store/modules/user";
import { TableColumnWidth } from "@/utils/enum";
import { getDamTypesList } from "@/api/modules/dataAsset";
const { proxy } = getCurrentInstance() as any;
const router = useRouter();
const userStore = useUserStore();
const userData = JSON.parse(userStore.userData);
const damTypes: any = ref([]);
const searchItemList: any = ref([
{
type: "input",
label: "",
field: "damName",
default: "",
placeholder: "产品名称",
clearable: true
},
{
type: "select",
label: "",
field: "damType",
default: "",
props: {
value: 'value',
label: 'label'
},
placeholder: "产品类型",
options: damTypes.value,
clearable: true,
},
{
type: 'select',
label: '',
field: 'approveState',
default: '',
placeholder: '审批状态',
options: [
{ label: '草稿中', value: 'N' },
{ label: '审批中', value: 'A' },
{ label: '已通过', value: 'Y' },
{ label: '已驳回', value: 'R' },
{ label: '已撤销', value: 'C' },
],
clearable: true
},
]);
const page = ref({
...commonPageConfig,
damName: '',
damType: null,
approveState: null,
});
const tableInfo = ref({
id: "mapping-table",
fields: [
{ label: "序号", type: "index", width: 56, align: "center", fixed: "left" },
{ label: "数据产品编号", field: "productCode", width: 265 },
{ label: "数据产品名称", field: "damName", width: 180 },
{
label: "产品类型", field: "damTypeName", width: 100
},
{
label: "审批状态", field: "approveState", type: "tag", width: TableColumnWidth.STATE, align: 'center'
},
{ label: "申请方", field: "tenantName", width: 240 },
{ label: "数据提供方", field: "dataProviderName", width: 240 },
{ label: "提交时间", field: "submitTime", width: 170 },
],
loading: false,
data: [],
page: {
type: "normal",
rows: 0,
...page.value,
},
actionInfo: {
label: "操作",
type: "btn",
width: 170,
btns: (scope) => {
const { row } = scope;
const bizApproveState = row.approveState;
let flowState;
if (bizApproveState == 'N') {
flowState = 1;
}
const currentStaffGuid = userData.userGuid
const staffGuid = row.createUserId || '';
let isShowCancel = false;
let list: any = [];
if (bizApproveState == 'N') {
flowState = 1;
}
if ((bizApproveState == 'D' || bizApproveState == 'C' || bizApproveState == 'R' || bizApproveState == 'E' || bizApproveState == 'R') && staffGuid == currentStaffGuid) {
flowState = 3;
}
if (bizApproveState == 'A' && staffGuid == currentStaffGuid) {
isShowCancel = true;
}
if (flowState === 1) {
list = [{ label: "编辑", value: "edit", click: btnHandlers.edit }, { label: "删除", value: "del", click: btnHandlers.del }]
}
if (flowState === 3) {
list.push({ label: "删除", value: "del", click: btnHandlers.del })
}
if (flowState === 3) { //重新提交过的不能再重新提交 && bizApproveState != 'D'
list.push({ label: "重新提交", value: "redit", click: btnHandlers.redit }) //已驳回
}
if (flowState !== 1) {
list.push({ label: "详情", value: "detail", click: btnHandlers.detail })
}
return list
},
}
});
const btnHandlers = {
edit: (scope) => {
router.push({
// name: "data-product-edit",
// query: {
// id: scope.row.id,
// },
});
},
redit: (scope) => {
},
detail: (scope) => {
router.push({
// name: "data-product-detail",
// query: {
// id: scope.row.id,
// },
})
},
del: (scope) => {
proxy.$openMessageBox('数据申请删除后不可恢复,确定继续删除吗?', () => {
// delCertificate([row.guid]).then((res: any) => {
// if (res?.code == proxy.$passCode) {
// proxy.$ElMessage.success('删除资产登记证件成功');
// page.value.curr = 1;
// getTableData();
// } else {
// proxy.$ElMessage.error(res.msg);
// }
// })
}, () => {
proxy.$ElMessage.info("已取消删除");
});
},
}
const toSearch = (val: any, clear: boolean = false) => {
if (clear) {
searchItemList.value.map(item => item.default = "");
page.value.damName = '';
page.value.approveState = null;
page.value.damType = null;
} else {
page.value.damName = val.damName;
page.value.approveState = val.approveState;
page.value.damType = val.damType;
}
page.value.curr = 1;
tableInfo.value.page.curr = 1;
getTableData();
};
const getTableData = () => {
// tableInfo.value.loading = true;
// getListingList({
// pageIndex: page.value.curr,
// pageSize: page.value.limit,
// damName: page.value.damName,
// damType: page.value.damType,
// approveState: page.value.approveState
// }).then((res: any) => {
// tableInfo.value.loading = false;
// tableInfo.value.data = res.data.records || [];
// tableInfo.value.page.curr = res.data.pageIndex;
// tableInfo.value.page.limit = res.data.pageSize;
// tableInfo.value.page.rows = res.data.totalRows;
// }).catch((res) => {
// tableInfo.value.loading = false;
// });
};
const tablePageChange = (info) => {
page.value.curr = Number(info.curr);
page.value.limit = Number(info.limit);
tableInfo.value.page.limit = page.value.limit;
tableInfo.value.page.curr = page.value.curr;
getTableData();
};
onBeforeMount(() => {
getDamTypesList({
dictType: "资产类型",
}).then((res: any) => {
if (res.code == proxy.$passCode) {
damTypes.value = res.data || [];
searchItemList.value[1].options = damTypes.value;
} else {
proxy.$ElMessage.error(res.msg);
}
})
})
</script>
<style lang="scss" scoped>
.container_wrap {
width: 100%;
height: 100%;
overflow-y: auto;
.table_tool_wrap {
width: 100%;
padding: 0 8px;
.tools_btns {
padding: 0px 0 8px;
}
}
.table_panel_wrap {
width: 100%;
padding: 0px 8px 0;
}
}
</style>