782b8b6d by lxs

分类分级任务联调

1 parent 495dd53e
...@@ -29,7 +29,6 @@ const props = defineProps({ ...@@ -29,7 +29,6 @@ const props = defineProps({
29 } 29 }
30 }) 30 })
31 const formRef = ref() 31 const formRef = ref()
32 const formCascaderRef = ref();
33 const formInline: any = computed(() => { 32 const formInline: any = computed(() => {
34 let items = setFormFields(props.itemList); 33 let items = setFormFields(props.itemList);
35 return reactive(items); 34 return reactive(items);
...@@ -45,16 +44,10 @@ const resetForm = (formEl: FormInstance | undefined) => { ...@@ -45,16 +44,10 @@ const resetForm = (formEl: FormInstance | undefined) => {
45 emits('tableSearch', form, true) 44 emits('tableSearch', form, true)
46 }) 45 })
47 } 46 }
48 const getCascaderCheckedData = () => {
49 const formCascader = formCascaderRef.value[0] || formCascaderRef.value;
50 const data = formCascader.getCheckedNodes();
51 return data;
52 };
53 47
54 defineExpose({ 48 defineExpose({
55 formInline, 49 formInline,
56 formRef, 50 formRef
57 getCascaderCheckedData
58 }) 51 })
59 const setFormFields = (list: any) => { 52 const setFormFields = (list: any) => {
60 let obj = {} 53 let obj = {}
......
...@@ -57,10 +57,6 @@ const cascaderChange = (val, item) => { ...@@ -57,10 +57,6 @@ const cascaderChange = (val, item) => {
57 emits("cascaderChange", val, item); 57 emits("cascaderChange", val, item);
58 } 58 }
59 59
60 const getCascaderCheckedData = ()=>{
61 return toolSearch.value.getCascaderCheckedData();
62 }
63
64 defineExpose({ 60 defineExpose({
65 toolSearch, 61 toolSearch,
66 }) 62 })
......
...@@ -12,6 +12,7 @@ import { setItemsDisabled, tagMethod, tagType, changeNum, } from "@/utils/common ...@@ -12,6 +12,7 @@ import { setItemsDisabled, tagMethod, tagType, changeNum, } from "@/utils/common
12 import useDataAssetStore from "@/store/modules/dataAsset"; 12 import useDataAssetStore from "@/store/modules/dataAsset";
13 import TableTools from '@/components/Tools/table_tools.vue'; 13 import TableTools from '@/components/Tools/table_tools.vue';
14 import { getCgTaskDetail, getTaskExeTreeList, getTaskFieldCount, execTaskFieldList, execTaskSheetList, execTaskConfirm, execFieldConfirm, filterVal, } from "@/api/modules/dataInventory"; 14 import { getCgTaskDetail, getTaskExeTreeList, getTaskFieldCount, execTaskFieldList, execTaskSheetList, execTaskConfirm, execFieldConfirm, filterVal, } from "@/api/modules/dataInventory";
15 import { ro } from "element-plus/es/locale";
15 16
16 const { proxy } = getCurrentInstance() as any; 17 const { proxy } = getCurrentInstance() as any;
17 const router = useRouter(); 18 const router = useRouter();
...@@ -57,7 +58,7 @@ const tabsInfo = ref({ ...@@ -57,7 +58,7 @@ const tabsInfo = ref({
57 { label: '字段', name: 'field' }, 58 { label: '字段', name: 'field' },
58 ] 59 ]
59 }); 60 });
60 61 const cascaderRef = ref();
61 const sheetParams = ref({}); 62 const sheetParams = ref({});
62 const sheetItemList = ref([ 63 const sheetItemList = ref([
63 { 64 {
...@@ -128,7 +129,7 @@ const fieldItemList = ref([ ...@@ -128,7 +129,7 @@ const fieldItemList = ref([
128 options: [], 129 options: [],
129 showAllLevels: true, 130 showAllLevels: true,
130 props: { 131 props: {
131 checkStrictly: true, 132 checkStrictly: false,
132 expandTrigger: "hover", 133 expandTrigger: "hover",
133 label: "classifyName", 134 label: "classifyName",
134 value: "guid", 135 value: "guid",
...@@ -216,18 +217,22 @@ const fieldTableInfo = ref({ ...@@ -216,18 +217,22 @@ const fieldTableInfo = ref({
216 { label: "字段名", field: "fieldName", width: 120 }, 217 { label: "字段名", field: "fieldName", width: 120 },
217 { label: "字段中文名", field: "fieldChName", width: 200 }, 218 { label: "字段中文名", field: "fieldChName", width: 200 },
218 { 219 {
219 label: "分类", field: "classifyDetailName", width: 280, 220 label: "分类", field: "classifyGuids", width: 280,
220 type: "cascader", 221 type: "cascader",
221 options: [], 222 options: [],
222 showAllLevels: true, 223 showAllLevels: false,
223 props: { 224 props: {
224 checkStrictly: true, 225 checkStrictly: false,
225 expandTrigger: "hover", 226 expandTrigger: "hover",
226 label: "classifyName", 227 label: "classifyName",
227 value: "guid", 228 value: "guid",
228 }, 229 },
229 filterable: true, 230 filterable: true,
230 clearable: true, 231 clearable: true,
232 getName: (scope) => {
233 const classifyNames = scope.row.classifyNames || [];
234 return classifyNames.join('/');
235 }
231 }, 236 },
232 { label: "分级", field: "gradeDetailName", width: 120, type: 'select' }, 237 { label: "分级", field: "gradeDetailName", width: 120, type: 'select' },
233 { label: "标签", field: "label", width: 96 }, 238 { label: "标签", field: "label", width: 96 },
...@@ -251,6 +256,79 @@ const fieldTableInfo = ref({ ...@@ -251,6 +256,79 @@ const fieldTableInfo = ref({
251 }, 256 },
252 }) 257 })
253 258
259 const formItems = ref([
260 {
261 label: "分类",
262 type: "cascader",
263 placeholder: "请选择",
264 field: "classifyName",
265 default: [],
266 options: [],
267 showAllLevels: false,
268 props: {
269 checkStrictly: false,
270 expandTrigger: "hover",
271 label: "classifyName",
272 value: "guid",
273 },
274 filterable: true,
275 clearable: true,
276 required: true,
277 },
278 {
279 label: '分级',
280 type: 'select',
281 placeholder: '请选择',
282 field: 'gradeName',
283 default: '',
284 block: true,
285 options: [],
286 props: {
287 value: 'guid',
288 label: 'daName'
289 },
290 clearable: true,
291 required: true
292 },
293 ]);
294
295 const formRules = ref({
296 classifyName: [
297 { required: true, trigger: 'change', message: "请选择分类" }
298 ],
299 gradeName: [
300 { required: true, trigger: 'change', message: "请选择分级" }
301 ],
302 });
303
304 const dialogInfo: any = ref({
305 visible: false,
306 size: 480,
307 direction: "column",
308 header: {
309 title: "新建",
310 },
311 type: 'form',
312 contents: [
313 {
314 type: 'form',
315 title: '',
316 formInfo: {
317 id: 'confirm-upload-file',
318 items: formItems.value,
319 rules: formRules.value
320 }
321 }
322 ],
323 footer: {
324 visible: true,
325 btns: [
326 { type: "default", label: "取消", value: "cancel" },
327 { type: "primary", label: "确定", value: "submit" },
328 ],
329 },
330 })
331
254 // 获取任务详情 332 // 获取任务详情
255 const getTaskDetail = (data) => { 333 const getTaskDetail = (data) => {
256 getCgTaskDetail(data).then((res: any) => { 334 getCgTaskDetail(data).then((res: any) => {
...@@ -277,7 +355,9 @@ const getFieldCount = (data) => { ...@@ -277,7 +355,9 @@ const getFieldCount = (data) => {
277 355
278 // 获取字段统计 356 // 获取字段统计
279 const getFieldTree = (data) => { 357 const getFieldTree = (data) => {
358 treeInfo.value.loading = true;
280 getTaskExeTreeList(data).then((res: any) => { 359 getTaskExeTreeList(data).then((res: any) => {
360 treeInfo.value.loading = false;
281 if (res.code == proxy.$passCode) { 361 if (res.code == proxy.$passCode) {
282 const data = res.data || []; 362 const data = res.data || [];
283 treeData.value[0].children.splice(1); 363 treeData.value[0].children.splice(1);
...@@ -289,6 +369,8 @@ const getFieldTree = (data) => { ...@@ -289,6 +369,8 @@ const getFieldTree = (data) => {
289 fieldItemList.value[3].options = JSON.parse(JSON.stringify(classifyData.value)); 369 fieldItemList.value[3].options = JSON.parse(JSON.stringify(classifyData.value));
290 fieldTableInfo.value.fields[4].options = JSON.parse(JSON.stringify(classifyData.value)); 370 fieldTableInfo.value.fields[4].options = JSON.parse(JSON.stringify(classifyData.value));
291 } 371 }
372 }).catch(() => {
373 treeInfo.value.loading = false;
292 }) 374 })
293 } 375 }
294 376
...@@ -333,9 +415,9 @@ const getFieldTableData = () => { ...@@ -333,9 +415,9 @@ const getFieldTableData = () => {
333 isClassify: checked1.value ? 'Y' : 'N', 415 isClassify: checked1.value ? 'Y' : 'N',
334 changeStatus: '', 416 changeStatus: '',
335 execGuid: taskDetail.value.execGuid, 417 execGuid: taskDetail.value.execGuid,
336 classifyDetailGuid: currTreeNode.value.guid,
337 pageIndex: fieldTableInfo.value.page.curr, 418 pageIndex: fieldTableInfo.value.page.curr,
338 pageSize: fieldTableInfo.value.page.limit, 419 pageSize: fieldTableInfo.value.page.limit,
420 classifyDetailGuid: currTreeNode.value.guid == 'all' || currTreeNode.value.guid == 'unclassified' ? '' : currTreeNode.value.guid,
339 }) 421 })
340 ).then((res: any) => { 422 ).then((res: any) => {
341 fieldTableInfo.value.loading = false; 423 fieldTableInfo.value.loading = false;
...@@ -357,6 +439,12 @@ const tableCellClassName = (scope) => { ...@@ -357,6 +439,12 @@ const tableCellClassName = (scope) => {
357 return (scope.column.label == '分类' || scope.column.label == '分级') && scope.row['STATE'] === 'Running' ? 'edit_cell' : '' 439 return (scope.column.label == '分类' || scope.column.label == '分级') && scope.row['STATE'] === 'Running' ? 'edit_cell' : ''
358 } 440 }
359 441
442 const getCascaderCheckedData = () => {
443 const formCascader = cascaderRef.value[0] || cascaderRef.value;
444 const data = formCascader.getCheckedNodes();
445 return data;
446 };
447
360 const tableBtnClick = (scope, btn) => { 448 const tableBtnClick = (scope, btn) => {
361 const type = btn.value; 449 const type = btn.value;
362 const row = scope.row; 450 const row = scope.row;
...@@ -367,9 +455,24 @@ const tableBtnClick = (scope, btn) => { ...@@ -367,9 +455,24 @@ const tableBtnClick = (scope, btn) => {
367 } else if (type == "edit") { 455 } else if (type == "edit") {
368 row.STATE = 'Running'; 456 row.STATE = 'Running';
369 } else if (type == 'save') { 457 } else if (type == 'save') {
370 458 const cascaderData = getCascaderCheckedData();
459 row.classifyNames = cascaderData.length ? cascaderData.pathLabels : [];
460 row.classifyGuids = cascaderData.length ? cascaderData.pathValues : [];
461 row.classifyDetailGuid = cascaderData.length ? cascaderData.value : '';
462 row.classifyDetailName = cascaderData.length ? cascaderData.label : '';
371 row.STATE = ''; 463 row.STATE = '';
372 464 if (cascaderData.length && row.gradeDetailGuid) {
465 const params = [
466 {
467 guid: row.guid,
468 classifyDetailGuid: row.classifyDetailGuid,
469 classifyDetailName: row.classifyDetailName,
470 gradeDetailGuid: row.gradeDetailGuid,
471 gradeDetailName: row.gradeDetailName,
472 }
473 ];
474 saveFields(params)
475 }
373 } 476 }
374 }; 477 };
375 478
...@@ -401,6 +504,28 @@ const btnClick = async (btn, bType = null) => { ...@@ -401,6 +504,28 @@ const btnClick = async (btn, bType = null) => {
401 } 504 }
402 }; 505 };
403 506
507 // 保存字段
508 const saveFields = (params, isBatch = false) => {
509 execFieldConfirm(params).then((res: any) => {
510 if (res.code == proxy.$passCode) {
511 ElMessage.success('保存成功');
512 isBatch && getFieldTableData();
513 }
514 })
515 }
516
517 // 任务确认
518 const saveTask = (params) => {
519 execTaskConfirm(params).then((res: any) => {
520 if (res.code == proxy.$passCode) {
521 ElMessage.success('保存成功');
522 router.push({
523 name: "taskConfig",
524 });
525 }
526 })
527 }
528
404 /** 搜索查询分类分级模板。 */ 529 /** 搜索查询分类分级模板。 */
405 const searchSheet = (val: any, clear: boolean = false) => { 530 const searchSheet = (val: any, clear: boolean = false) => {
406 if (clear) { 531 if (clear) {
...@@ -418,6 +543,40 @@ const searchField = (val: any, clear: boolean = false) => { ...@@ -418,6 +543,40 @@ const searchField = (val: any, clear: boolean = false) => {
418 getFieldTableData(); 543 getFieldTableData();
419 }; 544 };
420 545
546 const cascaderChange = (val) => {
547 // dictionaryGuid.value = val ? val.at(-1) : ''
548 }
549
550 const selectChange = (val) => {
551 // standardSetGuid.value = val
552 }
553
554 const dialogBtnClick = (btn, info) => {
555 if (btn.value == 'submit') {
556 // let daInfo = assetListData.value.find(a => a.guid == info.registerGuid);
557 // savePromise.value = saveQuality({
558 // tenantGuid: userData.tenantGuid,
559 // registerGuid: info.registerGuid,
560 // daName: daInfo.daName,
561 // registerTime: daInfo.registerTime,
562 // issuingEntityGuid: daInfo.exchangeGuid,
563 // qualityEvaluationFile: info.qualityEvaluationFile?.map(f => f.url) || []
564 // }).then((res: any) => {
565 // savePromise.value = null;
566 // if (res?.code == proxy.$passCode) {
567 // ElMessage.success('质量评价发起成功');
568 // dialogInfo.value.visible = false;
569 // page.value.curr = 1;
570 // getTableData();
571 // } else {
572 // ElMessage.error(res.msg);
573 // }
574 // })
575 } else if (btn.value == 'cancel') {
576 dialogInfo.value.visible = false;
577 }
578 };
579
421 onActivated(() => { 580 onActivated(() => {
422 581
423 }) 582 })
...@@ -513,9 +672,9 @@ onBeforeMount(() => { ...@@ -513,9 +672,9 @@ onBeforeMount(() => {
513 </div> 672 </div>
514 </div> 673 </div>
515 <div class="table_panel_wrap panel"> 674 <div class="table_panel_wrap panel">
516 <div class="table_panel"> 675 <div class="table_panel" v-loading="fieldTableInfo.loading">
517 <el-table ref="costTableRef" :data="fieldTableInfo.data" border :height="'100%'" 676 <el-table ref="costTableRef" :data="fieldTableInfo.data" border :height="'100%'"
518 style="width: 100%; display: inline-block" :style="{ 'min-height': '100%' }" 677 style="width: 100%; display: inline-block" :style="{ 'max-height': 'calc(100% - 44px)' }"
519 :cell-class-name="tableCellClassName"> 678 :cell-class-name="tableCellClassName">
520 <el-table-column v-for="(item, i) in fieldTableInfo.fields" :label="item.label" :width="item.width" 679 <el-table-column v-for="(item, i) in fieldTableInfo.fields" :label="item.label" :width="item.width"
521 :min-width="item.minWidth" :fixed="item.fixed" :align="item.align" 680 :min-width="item.minWidth" :fixed="item.fixed" :align="item.align"
...@@ -530,8 +689,9 @@ onBeforeMount(() => { ...@@ -530,8 +689,9 @@ onBeforeMount(() => {
530 v-model="scope.row[item.field]" :placeholder="item.placeholder" 689 v-model="scope.row[item.field]" :placeholder="item.placeholder"
531 :disabled="item.disabled ?? false" :clearable="item.clearable ?? true" size="small" /> 690 :disabled="item.disabled ?? false" :clearable="item.clearable ?? true" size="small" />
532 <el-cascader v-else-if="item.type == 'cascader' && scope.row['STATE'] === 'Running'" 691 <el-cascader v-else-if="item.type == 'cascader' && scope.row['STATE'] === 'Running'"
533 v-model="scope.row[item.field]" :options="item.options" :props="item.props" 692 ref="cascaderRef" v-model="scope.row[item.field]" :options="item.options" :props="item.props"
534 :disabled="item.disabled ?? false" :clearable="item.clearable ?? true" size="small" /> 693 :show-all-levels="item.showAllLevels ?? true" :disabled="item.disabled ?? false"
694 :clearable="item.clearable ?? true" size="small" />
535 <span v-else> 695 <span v-else>
536 {{ item.getName ? item.getName(scope) : scope.row[item.field] !== 0 && !scope.row[item.field] 696 {{ item.getName ? item.getName(scope) : scope.row[item.field] !== 0 && !scope.row[item.field]
537 ? 697 ?
...@@ -562,6 +722,8 @@ onBeforeMount(() => { ...@@ -562,6 +722,8 @@ onBeforeMount(() => {
562 </div> 722 </div>
563 </div> 723 </div>
564 </div> 724 </div>
725 <Dialog :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @cascaderChange="cascaderChange"
726 @selectChange="selectChange" />
565 </div> 727 </div>
566 </template> 728 </template>
567 729
...@@ -733,6 +895,8 @@ onBeforeMount(() => { ...@@ -733,6 +895,8 @@ onBeforeMount(() => {
733 .box_right { 895 .box_right {
734 width: calc(100% - 240px); 896 width: calc(100% - 240px);
735 height: 100%; 897 height: 100%;
898 display: flex;
899 flex-direction: column;
736 } 900 }
737 } 901 }
738 } 902 }
...@@ -764,15 +928,16 @@ onBeforeMount(() => { ...@@ -764,15 +928,16 @@ onBeforeMount(() => {
764 928
765 .table_panel_wrap { 929 .table_panel_wrap {
766 width: 100%; 930 width: 100%;
767 height: calc(100% - 48px); 931 height: calc(100% - 49px);
768 padding: 4px 0 0; 932 padding: 4px 0 0;
769 933
770 &.panel { 934 &.panel {
771 height: calc(100% - 171px); 935 flex: 1;
772 936
773 .table_panel { 937 .table_panel {
774 width: 100%; 938 width: 100%;
775 height: 100%; 939 height: 100%;
940 overflow: hidden;
776 } 941 }
777 } 942 }
778 943
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!