productCatalogManage.vue
9.64 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
<template>
<div class="container_wrap full flex">
<div class="aside_wrap">
<div class="aside_title">产品分类</div>
<Tree ref="treeRef" :treeInfo="treeInfo" @nodeCheck="handleTreeNodeChange" />
</div>
<div class="main_wrap">
<div class="header-bg">
<el-input v-model.trim="page.searchKey" size="large" placeholder="请输入关键字搜索" :prefix-icon="Search"
@blur="toSearch(true, true)" @keyup.enter.native="searchEnterFun" clearable />
</div>
<Table :tableInfo="tableInfo" @tablePageChange="tablePageChange"
style="height: calc(100% - 96px);margin: 16px 16px 0px;" />
</div>
</div>
</template>
<script lang="ts" setup name="productCatalogManage">
import { commonPageConfig } from '@/components/PageNav';
import { Search } from '@element-plus/icons-vue';
import {
getDamTypesList
} from "@/api/modules/dataAsset";
import { USERROLE } from '@/utils/enum';
const router = useRouter();
const route = useRoute();
const { proxy } = getCurrentInstance() as any;
const dataSourceList = ref([{ //如果是授权数据则不能选择其余的
value: 1,
label: '授权数据',
}, {
value: 2,
label: '自有数据',
},
{
value: 3,
label: '购买数据',
},
{
value: 4,
label: '其他来源',
}]);
/** 是否是数据使用方 */
const isDataUse = computed(() => {
return localStorage.getItem('userRole') == USERROLE.USE;
})
const treeRef = ref();
const treeInfo = ref({
id: "data-product-tree",
filter: true,
queryValue: "",
queryPlaceholder: "请输入关键字搜索",
showCheckbox: true,
checkStrictly: false,
props: {
label: "label",
value: "value",
children: 'childDictList'
},
nodeKey: 'value',
expandOnNodeClick: false,
data: <any>[],
loading: false
});
//记录每次点击的节点。
const handleTreeNodeChange = (checkedObj, id, nodeObj) => {
debugger
let treeRefs = treeRef.value.treeRef;
let checkedKeys = checkedObj.checkedObj || [];//全勾选的所有节点。
let halfCheckedKeys = checkedObj.halfCheckedKeys || [];//半勾选的节点。
//思路,一个个的分类判断是否在半勾选,如果是,就将其勾选的子节点获取出来。
/** 先damType */
if (halfCheckedKeys.includes('damType')) {
// 获取出来勾选的子节点。
treeRefs.getNode("damType").childNodes?.filter(c=> c.checked == true);
} //如果是全选,则不需要处理传参。
/** 数据来源 */
if (halfCheckedKeys.includes('dataSources')) {
}
/** 行业分类 */
/** 机构分类 */
/** 复杂的领域及应用场景。 */
if (halfCheckedKeys.includes('domain')) {
//计算领域下勾选的子节点。同时判断医疗健康和工业制造。
}
}
const page = ref({
...commonPageConfig,
searchKey: '',
});
const oldKeyWord = ref(""); //记录上次输入的关键字,若是输入值未变化,则失去焦点时不用触发搜索。
const isEnter = ref(false);
/** 触发搜索查询 */
const toSearch = (clear: boolean = true, isBlur: boolean = false) => {
if (clear) {
page.value.curr = 1
}
if (isBlur && !isEnter.value && oldKeyWord.value === page.value.searchKey) {
return;
}
isEnter.value = false;
oldKeyWord.value = page.value.searchKey;
getSearchData(clear);
}
const searchEnterFun = (event) => {
isEnter.value = true;
event.target?.blur();
}
/** 查询表格数据 */
const getSearchData = (clear = false) => {
}
const tableInfo = ref({
id: 'contract-table',
rowKey: 'guid',
loading: false,
fields: [{ label: "序号", type: "index", width: 56, align: "center" },
{
label: "数据产品名称", field: "dataProductName", width: 160, type: "text_btn", columClass: 'text_btn', value: "detail", disabled: (scope) => {
return scope.row.contractStatus == '06';
}, click: (scope) => {
if (scope.row.contractStatus == '06') {
return;
}
router.push({
name: 'productSortCatalogDetail',
query: {
guid: scope.row.dataProductGuid,
type: 'detail',
foundMode: 'use',
name: scope.row.dataProductName,
}
});
}
},
{ label: "产品类型", field: "damTypeName", width: 100 },
{ label: "应用场景", field: "scenarioName", width: 120 },
{ label: "行业分类", field: "industryName", width: 140 },
{ label: "机构分类", field: "institutionTypeName", width: 120 },
{
label: "数据来源", field: "dataSources", width: 100, getName: (scope) => {
return scope.row.dataSources && dataSourceList.value.find(i => i.value == scope.row.dataSources)?.label || '--'
}
},
{ label: "上架时间", field: "listingTime", width: 170 },
],
data: [{}],
page: {
type: "normal",
rows: 0,
...page.value,
},
actionInfo: {
label: "操作",
type: "btn",
show: isDataUse.value,
width: 120,
btns: (scope) => {
return [{
value: 'approve', label: "数据申请", click: (scope) => { //TODO,是否申请过的不能再申请?
}
}]
}
}
});
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;
getSearchData();
};
const damTypes: any = ref([]);
/** 所属主题多级列表 */
const subjectDomainListData: any = ref([]);
/** 行业分类类型列表 */
const industryDictList: any = ref([]);
/** 领域字典列表 */
const domainDictList: any = ref([]);
/** 机构类型字典列表 */
const institutionTypeDictList: any = ref([]);
/** 所属科室下拉列表 */
const medDepartmentCodeList: any = ref([]);
onBeforeMount(() => {
treeInfo.value.loading = true;
let psAll: any[] = [];
psAll.push(getDamTypesList({
dictType: "资产类型",
}).then((res: any) => {
if (res.code == proxy.$passCode) {
damTypes.value = res.data || [];
} else {
proxy.$ElMessage.error(res.msg);
}
}))
psAll.push(getDamTypesList({
dictType: "行业分类",
level: 1
}).then((res: any) => {
if (res.code == proxy.$passCode) {
industryDictList.value = res.data || [];
} else {
proxy.$ElMessage.error(res.msg);
}
}))
psAll.push(getDamTypesList({ dictType: '领域' }).then((res: any) => {
if (res.code == proxy.$passCode) {
domainDictList.value = res.data || [];
} else {
proxy.$ElMessage.error(res.msg);
}
}));
psAll.push(getDamTypesList({
dictType: "组织机构性质",
}).then((res: any) => {
if (res.code == proxy.$passCode) {
institutionTypeDictList.value = res.data || [];
} else {
proxy.$ElMessage.error(res.msg);
}
}))
psAll.push(getDamTypesList({
dictType: "数据资产目录主题名称",
}).then((res: any) => {
if (res.code == proxy.$passCode) {
subjectDomainListData.value = res.data?.find(d => d.value == '1')?.childDictList || [];
} else {
proxy.$ElMessage.error(res.msg);
}
}))
psAll.push(getDamTypesList({
dictType: "科室",
}).then((res: any) => {
if (res.code == proxy.$passCode) {
medDepartmentCodeList.value = res.data || [];
} else {
proxy.$ElMessage.error(res.msg);
}
}));
Promise.all(psAll).then(() => {
treeInfo.value.loading = false;
treeInfo.value.data = [];
treeInfo.value.data.push({
value: 'damType',
label: '产品类型',
childDictList: damTypes.value
});
let item = domainDictList.value.find(i => i.value == '003');//医疗健康,下级应用场景和所属科室
let childDictList = item.childDictList || [];
item.childDictList = [{
value: 'scenario',
label: '应用场景',
childDictList: childDictList
}];
item.childDictList.push({
value: 'medDepartmentCode',
label: '所属科室',
childDictList: medDepartmentCodeList.value
});
let item4 = domainDictList.value.find(i => i.value == '004'); //工业制造
let childDictList4 = item4.childDictList || [];
item4.childDictList = [{
value: 'scenario',
label: '应用场景',
childDictList: childDictList4
}];
item4.childDictList.push({
value: 'subjectDomain',
label: '所属主题',
childDictList: subjectDomainListData.value
});
treeInfo.value.data.push({
value: 'domain',
label: '领域及应用场景',
childDictList: domainDictList.value //TODO,需要带上主题和科室。
});
treeInfo.value.data.push({
value: 'dataSource',
label: '数据来源',
childDictList: dataSourceList.value
});
treeInfo.value.data.push({
value: 'industry',
label: '行业分类',
childDictList: industryDictList.value
});
treeInfo.value.data.push({
value: 'institutionType',
label: '机构分类',
childDictList: institutionTypeDictList.value
});
}).catch(() => {
treeInfo.value.loading = false;
})
})
</script>
<style lang="scss" scoped>
.container_wrap {
padding: 0;
display: flex;
justify-content: space-between;
.aside_wrap {
width: 220px;
border-right: 1px solid #d9d9d9;
box-shadow: none;
.aside_title {
display: inline-block;
}
}
.tree_panel {
height: calc(100% - 36px);
padding-top: 0;
:deep(.el-tree) {
margin: 0;
overflow: hidden auto;
}
}
}
.container_wrap.flex {
.main_wrap {
padding: 0px;
}
}
.header-bg {
height: 80px;
background-image: url('@/assets/images/product-catalog-bg.png');
background-size: cover;
/* 背景图覆盖整个元素 */
background-position: center;
/* 背景图居中 */
background-repeat: no-repeat;
display: flex;
align-items: center;
justify-content: center;
.el-input {
width: 60%;
}
}
</style>