cf478289 by xukangle

fix : 修改分类分级和标签管理问题

1 parent 7166760b
...@@ -603,7 +603,7 @@ export const getDictionary = (params) => request({ ...@@ -603,7 +603,7 @@ export const getDictionary = (params) => request({
603 * @path /biz-rule-config/save 603 * @path /biz-rule-config/save
604 */ 604 */
605 export const saveBizRuleConfig = (data) => request({ 605 export const saveBizRuleConfig = (data) => request({
606 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/biz-rule-config/save`, 606 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/biz-rule-config/save-or-update`,
607 method: 'post', 607 method: 'post',
608 data 608 data
609 }) 609 })
......
...@@ -99,8 +99,9 @@ onMounted(() => { ...@@ -99,8 +99,9 @@ onMounted(() => {
99 <el-form-item v-if="item.visible ?? true" :key="'item_' + index" 99 <el-form-item v-if="item.visible ?? true" :key="'item_' + index"
100 :class="{ 'width_auto': item.type == 'radio-button' }" :prop="item.field"> 100 :class="{ 'width_auto': item.type == 'radio-button' }" :prop="item.field">
101 <template v-if="item.type == 'select'"> 101 <template v-if="item.type == 'select'">
102 <el-select :class="{ 'is-multiple': item.multiple }" v-model="formInline[item.field]" 102 <el-select collapse-tags collapse-tags-tooltip :class="{ 'is-multiple': item.multiple }"
103 :placeholder="item.placeholder" :clearable="item.clearable" :filterable="item.filterable" 103 v-model="formInline[item.field]" :placeholder="item.placeholder" :clearable="item.clearable"
104 :filterable="item.filterable" :multiple="item.multiple" :max-collapse-tags="3"
104 :disabled="item.disabled ?? false" @change="(val) => selectChange(val, item)"> 105 :disabled="item.disabled ?? false" @change="(val) => selectChange(val, item)">
105 <el-option v-for="opt in item.options" :label="item.props?.label ? opt[item.props.label] : opt.label" 106 <el-option v-for="opt in item.options" :label="item.props?.label ? opt[item.props.label] : opt.label"
106 :value="item.props?.value ? opt[item.props.value] : opt.value" /> 107 :value="item.props?.value ? opt[item.props.value] : opt.value" />
......
...@@ -82,7 +82,7 @@ const routes: RouteRecordRaw[] = [ ...@@ -82,7 +82,7 @@ const routes: RouteRecordRaw[] = [
82 name: 'templateConfig', 82 name: 'templateConfig',
83 component: () => import('@/views/data_inventory/templateConfig.vue'), 83 component: () => import('@/views/data_inventory/templateConfig.vue'),
84 meta: { 84 meta: {
85 title: '分类分级标准', 85 title: '分类分级规则',
86 breadcrumb: false, 86 breadcrumb: false,
87 cache: true 87 cache: true
88 }, 88 },
......
...@@ -42,7 +42,7 @@ const classStandardFormItems = ref([{ ...@@ -42,7 +42,7 @@ const classStandardFormItems = ref([{
42 // clearable: true, 42 // clearable: true,
43 // disabled: false, 43 // disabled: false,
44 // visible: true, 44 // visible: true,
45 label: '分级标准', 45 label: '分级名称',
46 type: 'select', 46 type: 'select',
47 placeholder: '请选择', 47 placeholder: '请选择',
48 field: 'gradeStandard', 48 field: 'gradeStandard',
...@@ -83,7 +83,7 @@ const tableInfo = ref({ ...@@ -83,7 +83,7 @@ const tableInfo = ref({
83 multiple: false, 83 multiple: false,
84 fields: [ 84 fields: [
85 { label: "序号", type: "index", width: 56, align: "center" }, 85 { label: "序号", type: "index", width: 56, align: "center" },
86 { label: "分类", field: "classifyName", width: 160, type: 'expand' }, 86 { label: "规则名称", field: "classifyName", width: 160, type: 'expand' },
87 { 87 {
88 label: "层级", field: "level", width: 120, getName: (scope) => { 88 label: "层级", field: "level", width: 120, getName: (scope) => {
89 let level = scope.row.level; 89 let level = scope.row.level;
...@@ -121,7 +121,7 @@ const tableInfo = ref({ ...@@ -121,7 +121,7 @@ const tableInfo = ref({
121 selectParentEdit(scope.row.guid); 121 selectParentEdit(scope.row.guid);
122 currTableInfo.value = scope.row; 122 currTableInfo.value = scope.row;
123 drawerInfo.value.visible = true; 123 drawerInfo.value.visible = true;
124 drawerInfo.value.header.title = '编辑分类'; 124 drawerInfo.value.header.title = '编辑规则';
125 classEditFormItems.value.forEach(item => { 125 classEditFormItems.value.forEach(item => {
126 item.default = scope.row[item.field] 126 item.default = scope.row[item.field]
127 }) 127 })
...@@ -210,7 +210,7 @@ const classEditFormItems = ref([{ ...@@ -210,7 +210,7 @@ const classEditFormItems = ref([{
210 }, { 210 }, {
211 label: '定义说明', 211 label: '定义说明',
212 type: 'textarea', 212 type: 'textarea',
213 placeholder: '请输入', 213 placeholder: '分类规则的描述说明',
214 field: 'description', 214 field: 'description',
215 default: '', 215 default: '',
216 clearable: true, 216 clearable: true,
...@@ -305,7 +305,7 @@ const drawerInfo = ref({ ...@@ -305,7 +305,7 @@ const drawerInfo = ref({
305 direction: 'rtl', 305 direction: 'rtl',
306 size: 600, 306 size: 600,
307 header: { 307 header: {
308 title: '添加分类', 308 title: '添加规则',
309 }, 309 },
310 type: '', 310 type: '',
311 container: { 311 container: {
...@@ -324,7 +324,7 @@ const drawerBtnClick = async (btn, info) => { ...@@ -324,7 +324,7 @@ const drawerBtnClick = async (btn, info) => {
324 if (btn.value == 'cancel') { 324 if (btn.value == 'cancel') {
325 drawerInfo.value.visible = false; 325 drawerInfo.value.visible = false;
326 } else { 326 } else {
327 if (drawerInfo.value.header.title == '添加分类') { 327 if (drawerInfo.value.header.title == '添加规则') {
328 drawerInfo.value.footer.btns.map((item: any) => (item.disabled = true)); 328 drawerInfo.value.footer.btns.map((item: any) => (item.disabled = true));
329 const params = { 329 const params = {
330 ...info, 330 ...info,
...@@ -332,7 +332,7 @@ const drawerBtnClick = async (btn, info) => { ...@@ -332,7 +332,7 @@ const drawerBtnClick = async (btn, info) => {
332 } 332 }
333 const res: any = await saveClassify(params); 333 const res: any = await saveClassify(params);
334 if (res.code == proxy.$passCode) { 334 if (res.code == proxy.$passCode) {
335 proxy.$ElMessage.success('添加成功!'); 335 proxy.$ElMessage.success('添加规则成功!');
336 drawerInfo.value.visible = false; 336 drawerInfo.value.visible = false;
337 getTreeListData(); 337 getTreeListData();
338 drawerInfo.value.footer.btns.map((item: any) => delete item.disabled); 338 drawerInfo.value.footer.btns.map((item: any) => delete item.disabled);
...@@ -351,7 +351,7 @@ const drawerBtnClick = async (btn, info) => { ...@@ -351,7 +351,7 @@ const drawerBtnClick = async (btn, info) => {
351 } 351 }
352 const res: any = await updateClassify(params); 352 const res: any = await updateClassify(params);
353 if (res.code == proxy.$passCode) { 353 if (res.code == proxy.$passCode) {
354 proxy.$ElMessage.success('修改成功!'); 354 proxy.$ElMessage.success('编辑规则成功!');
355 drawerInfo.value.visible = false; 355 drawerInfo.value.visible = false;
356 drawerInfo.value.footer.btns.map((item: any) => delete item.disabled); 356 drawerInfo.value.footer.btns.map((item: any) => delete item.disabled);
357 getTreeListData(); 357 getTreeListData();
...@@ -462,7 +462,7 @@ const newCreateClass = () => { ...@@ -462,7 +462,7 @@ const newCreateClass = () => {
462 462
463 drawerInfo.value.visible = true; 463 drawerInfo.value.visible = true;
464 classEditFormItems.value[2].options = treeListData.value; 464 classEditFormItems.value[2].options = treeListData.value;
465 drawerInfo.value.header.title = '添加分类'; 465 drawerInfo.value.header.title = '添加规则';
466 classEditFormItems.value.forEach(item => { 466 classEditFormItems.value.forEach(item => {
467 if (item.field == 'status') { 467 if (item.field == 'status') {
468 item.default = 'Y'; 468 item.default = 'Y';
...@@ -481,7 +481,7 @@ const saveUpdate = async () => { ...@@ -481,7 +481,7 @@ const saveUpdate = async () => {
481 return; 481 return;
482 } 482 }
483 if (!formRef.value.formInline.gradeStandard) { 483 if (!formRef.value.formInline.gradeStandard) {
484 proxy.$ElMessage.error('分级标准不能为空'); 484 proxy.$ElMessage.error('分级名称不能为空');
485 return; 485 return;
486 } 486 }
487 saveLoading.value = true; 487 saveLoading.value = true;
...@@ -495,7 +495,7 @@ const saveUpdate = async () => { ...@@ -495,7 +495,7 @@ const saveUpdate = async () => {
495 console.log(params); 495 console.log(params);
496 const res: any = await updateClassifyGrad(params); 496 const res: any = await updateClassifyGrad(params);
497 if (res.code == proxy.$passCode) { 497 if (res.code == proxy.$passCode) {
498 proxy.$ElMessage.success('修改成功'); 498 proxy.$ElMessage.success('修改分类成功');
499 router.push({ 499 router.push({
500 name: 'templateConfig' 500 name: 'templateConfig'
501 }); 501 });
...@@ -512,9 +512,21 @@ const importClass = () => { ...@@ -512,9 +512,21 @@ const importClass = () => {
512 } 512 }
513 513
514 const dataShowMethod = ref('table'); 514 const dataShowMethod = ref('table');
515 // 创建聚合数据
516 const updatedTreeData = ref<any>();
515 /** 切换是图形展示,还是表格展示。 */ 517 /** 切换是图形展示,还是表格展示。 */
516 const changeShowMethod = () => { 518 const changeShowMethod = () => {
517 dataShowMethod.value = dataShowMethod.value == 'table' ? 'shape' : 'table'; 519 dataShowMethod.value = dataShowMethod.value == 'table' ? 'shape' : 'table';
520 console.log(shapeTreeListData.value);
521 if (dataShowMethod.value == 'shape') {
522 const tempArr = {
523 classifyName: router.currentRoute.value.query.classStandardName,
524 guid: "1",
525 children: shapeTreeListData.value
526 }
527 updatedTreeData.value = [tempArr];
528 console.log('updatedTreeData', [tempArr]);
529 }
518 } 530 }
519 531
520 const cancel = () => { 532 const cancel = () => {
...@@ -679,10 +691,11 @@ const initGraph = () => { ...@@ -679,10 +691,11 @@ const initGraph = () => {
679 }, 691 },
680 } 692 }
681 }); 693 });
682 graph.data(shapeTreeListData.value[0]); 694 graph.data(updatedTreeData.value[0]);
683 graph.on('node:mouseenter', (e) => { 695 graph.on('node:mouseenter', (e) => {
684 const nodeItem = e.item; // 获取鼠标进入的节点元素对象 696 const nodeItem = e.item; // 获取鼠标进入的节点元素对象
685 const nodeModel = nodeItem.getModel(); 697 const nodeModel = nodeItem.getModel();
698 if (nodeModel.guid == '1') return; // 根节点不显示
686 // 更新弹窗位置和显示节点详情 699 // 更新弹窗位置和显示节点详情
687 nodeDetails.value = nodeModel; 700 nodeDetails.value = nodeModel;
688 showNodeDetails.value = true; 701 showNodeDetails.value = true;
...@@ -804,7 +817,6 @@ onMounted(() => { ...@@ -804,7 +817,6 @@ onMounted(() => {
804 817
805 const isExpand = ref<boolean>(router.currentRoute.value.query.isExpand == 'true'); 818 const isExpand = ref<boolean>(router.currentRoute.value.query.isExpand == 'true');
806 819
807
808 </script> 820 </script>
809 821
810 <template> 822 <template>
...@@ -814,10 +826,10 @@ const isExpand = ref<boolean>(router.currentRoute.value.query.isExpand == 'true' ...@@ -814,10 +826,10 @@ const isExpand = ref<boolean>(router.currentRoute.value.query.isExpand == 'true'
814 :isExpand="isExpand"> 826 :isExpand="isExpand">
815 <Form ref="formRef" :itemList="classStandardFormItems" formId="main-model-edit" col="col3" /> 827 <Form ref="formRef" :itemList="classStandardFormItems" formId="main-model-edit" col="col3" />
816 </ContentWrap> 828 </ContentWrap>
817 <ContentWrap id="id-classStandard" class="detail-content" title="分类标准" description="" 829 <ContentWrap id="id-classStandard" class="detail-content" title="分类规则" description=""
818 style="margin-top:16px; height: calc(100% - 161px)"> 830 style="margin-top:16px; height: calc(100% - 161px)">
819 <div class="tools_btns"> 831 <div class="tools_btns">
820 <el-button v-show="dataShowMethod == 'table'" type="primary" @click="newCreateClass">添加分类</el-button> 832 <el-button v-show="dataShowMethod == 'table'" type="primary" @click="newCreateClass">添加规则</el-button>
821 <!-- <el-button v-show="dataShowMethod == 'table'" @click="importClass">导入分类</el-button> --> 833 <!-- <el-button v-show="dataShowMethod == 'table'" @click="importClass">导入分类</el-button> -->
822 <el-button class="show-change-btn" @click="changeShowMethod">{{ '图形展示' }}</el-button> 834 <el-button class="show-change-btn" @click="changeShowMethod">{{ '图形展示' }}</el-button>
823 </div> 835 </div>
......
...@@ -127,7 +127,7 @@ const tableInfo = ref({ ...@@ -127,7 +127,7 @@ const tableInfo = ref({
127 return classDataRef.value.find((item: any) => item.value === dataClassify)?.label; 127 return classDataRef.value.find((item: any) => item.value === dataClassify)?.label;
128 } 128 }
129 }, 129 },
130 { label: "分级描述", field: "gradeDesc", align: "left" }, 130 { label: "规则描述", field: "gradeDesc", align: "left" },
131 131
132 ], 132 ],
133 actionInfo: { 133 actionInfo: {
...@@ -242,10 +242,10 @@ const newCreateGradeFormItems = ref([{ ...@@ -242,10 +242,10 @@ const newCreateGradeFormItems = ref([{
242 regexp: /\D/g 242 regexp: /\D/g
243 }, 243 },
244 { 244 {
245 label: '分级描述', 245 label: '规则描述',
246 type: 'textarea', 246 type: 'textarea',
247 maxlength: 500, 247 maxlength: 500,
248 placeholder: '分类分级的描述说明', 248 placeholder: '分级规则的描述说明',
249 field: 'gradeDesc', 249 field: 'gradeDesc',
250 default: '', 250 default: '',
251 clearable: true, 251 clearable: true,
...@@ -326,6 +326,7 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -326,6 +326,7 @@ const newCreateGradeStandardDialogInfo = ref({
326 326
327 const newStandard = () => { 327 const newStandard = () => {
328 filterDataGrade(); 328 filterDataGrade();
329 newCreateGradeStandardDialogInfo.value.title = '新增标准';
329 newCreateGradeStandardDialogInfo.value.visible = true; 330 newCreateGradeStandardDialogInfo.value.visible = true;
330 newCreateGradeFormItems.value.forEach(item => item.default = ''); 331 newCreateGradeFormItems.value.forEach(item => item.default = '');
331 } 332 }
...@@ -362,7 +363,7 @@ const saveUpdate = async () => { ...@@ -362,7 +363,7 @@ const saveUpdate = async () => {
362 console.log(params); 363 console.log(params);
363 const res: any = await updateClassifyGrad(params); 364 const res: any = await updateClassifyGrad(params);
364 if (res.code == proxy.$passCode) { 365 if (res.code == proxy.$passCode) {
365 proxy.$ElMessage.success('修改成功'); 366 proxy.$ElMessage.success('修改分级成功');
366 router.push({ 367 router.push({
367 name: 'templateConfig' 368 name: 'templateConfig'
368 }); 369 });
...@@ -392,7 +393,7 @@ const cancel = () => { ...@@ -392,7 +393,7 @@ const cancel = () => {
392 <ContentWrap id="id-baseInfo" title="基础信息" description="" style="margin-top: 8px;"> 393 <ContentWrap id="id-baseInfo" title="基础信息" description="" style="margin-top: 8px;">
393 <Form ref="formRef" :itemList="classStandardFormItems" formId="main-model-edit" col="col3" /> 394 <Form ref="formRef" :itemList="classStandardFormItems" formId="main-model-edit" col="col3" />
394 </ContentWrap> 395 </ContentWrap>
395 <ContentWrap id="id-grade-info" title="分级标准" class="detail-content" description="" style="margin-top: 8px;"> 396 <ContentWrap id="id-grade-info" title="分级规则" class="detail-content" description="" style="margin-top: 8px;">
396 <div class="content" v-loading="fullscreenLoading"> 397 <div class="content" v-loading="fullscreenLoading">
397 <div class="table-top-btns"> 398 <div class="table-top-btns">
398 <el-button type="primary" @click="newStandard">新增标准</el-button> 399 <el-button type="primary" @click="newStandard">新增标准</el-button>
......
...@@ -9,6 +9,7 @@ import { getLabelList, getClassifyGradeTreeList, saveLabel, getLabelPageList, de ...@@ -9,6 +9,7 @@ import { getLabelList, getClassifyGradeTreeList, saveLabel, getLabelPageList, de
9 import { CirclePlus, Delete } from "@element-plus/icons-vue"; 9 import { CirclePlus, Delete } from "@element-plus/icons-vue";
10 10
11 11
12
12 const { proxy } = getCurrentInstance() as any; 13 const { proxy } = getCurrentInstance() as any;
13 const dialogLabelFormRef = ref(); 14 const dialogLabelFormRef = ref();
14 15
...@@ -74,6 +75,7 @@ const transformDataForTree = (data: any[]) => { ...@@ -74,6 +75,7 @@ const transformDataForTree = (data: any[]) => {
74 const labelPageList = ref<any>() 75 const labelPageList = ref<any>()
75 76
76 const getLabelPageData = async () => { 77 const getLabelPageData = async () => {
78 refCount.value++;
77 tableInfo.value.loading = true; 79 tableInfo.value.loading = true;
78 const params = { 80 const params = {
79 pageIndex: page.value.curr, 81 pageIndex: page.value.curr,
...@@ -111,7 +113,7 @@ const getLabelListData = async () => { ...@@ -111,7 +113,7 @@ const getLabelListData = async () => {
111 } 113 }
112 } 114 }
113 115
114 onMounted(async () => { 116 onBeforeMount(async () => {
115 await getClassifyGradeTree(); 117 await getClassifyGradeTree();
116 await getLabelPageData(); 118 await getLabelPageData();
117 await getLabelListData(); 119 await getLabelListData();
...@@ -136,8 +138,45 @@ const treeInfo = ref<any>({ ...@@ -136,8 +138,45 @@ const treeInfo = ref<any>({
136 loading: false 138 loading: false
137 }); 139 });
138 // 点击树节点修改分类guid 和 分类明细guid 140 // 点击树节点修改分类guid 和 分类明细guid
139 const nodeClick = (data: any) => { 141 // 存储大类的数据。
140 console.log('nodeClick', data); 142 const findNodeDetails = ref<any>('');
143 const isLastLayer = ref<boolean>(false);
144 // 所在层级的info
145 const atGradeinfo = ref<any>('');
146
147 const findTopParentNode = (node: any) => {
148 if (!node) return;
149
150 // 判断是否为最后一层
151 if (node.childNodes.length === 0) {
152 isLastLayer.value = true;
153 atGradeinfo.value = node.data;
154 } else {
155 isLastLayer.value = false;
156 }
157
158 // 如果当前节点的父节点符合条件
159 if (node.parent && node.parent.data.type === 'C') {
160 findNodeDetails.value = node.parent.data;
161 return; // 停止递归
162 }
163
164 // 如果当前节点的祖父节点符合条件
165 if (node.parent?.parent && node.parent.parent.data.type === 'C') {
166 findNodeDetails.value = node.parent.parent.data;
167 return; // 停止递归
168 }
169
170 // 如果未找到,继续递归向上查找
171 if (node.parent) {
172 findTopParentNode(node.parent);
173 }
174 };
175
176 const nodeClick = (data, node) => {
177 findTopParentNode(node);
178 newCreateGradeFormItems.value[1].options = transformDataForTree([findNodeDetails.value])
179
141 // 分类guid 180 // 分类guid
142 if (Object.keys(data).includes("type")) { 181 if (Object.keys(data).includes("type")) {
143 classifyGuid.value = data.guid; 182 classifyGuid.value = data.guid;
...@@ -180,8 +219,13 @@ const tableInfo = ref({ ...@@ -180,8 +219,13 @@ const tableInfo = ref({
180 fixedSelection: true, 219 fixedSelection: true,
181 fields: [ 220 fields: [
182 { label: "序号", type: "index", width: 56, align: "center" }, 221 { label: "序号", type: "index", width: 56, align: "center" },
183 { label: "标签名", field: "label", type: 'text_btn', class: 'drawer-detail-cell', width: 120, value: 'detail', columClass: 'text_btn' }, 222 { label: "标签名", field: "label", type: 'text_btn', class: 'drawer-detail-cell', width: 160, value: 'detail', columClass: 'text_btn' },
184 { label: "分类", field: "classifyDetailName", width: 140 }, 223 {
224 label: "分类", field: "classifyNames", getName: (scope) => {
225 let tempInfo = scope.row.classifyNames;
226 return tempInfo.join('/')
227 },
228 },
185 { label: "分级", field: "gradeDetailName", width: 140 }, 229 { label: "分级", field: "gradeDetailName", width: 140 },
186 { 230 {
187 label: '状态', field: 'bizState', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 100, align: 'center' 231 label: '状态', field: 'bizState', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 100, align: 'center'
...@@ -280,7 +324,6 @@ const batchRemobe = async () => { ...@@ -280,7 +324,6 @@ const batchRemobe = async () => {
280 message: '已取消删除' 324 message: '已取消删除'
281 }); 325 });
282 }); 326 });
283
284 }; 327 };
285 328
286 const tableSwitchBeforeChange = (scope, field, callback) => { 329 const tableSwitchBeforeChange = (scope, field, callback) => {
...@@ -410,7 +453,7 @@ const newCreateGradeFormItems = ref<any>([{ ...@@ -410,7 +453,7 @@ const newCreateGradeFormItems = ref<any>([{
410 { 453 {
411 label: '精确匹配', 454 label: '精确匹配',
412 type: 'textarea', 455 type: 'textarea',
413 maxlength: 500, 456 maxlength: 260,
414 placeholder: '请输入字段中文,中间用英文“,”分号隔开', 457 placeholder: '请输入字段中文,中间用英文“,”分号隔开',
415 field: 'matchChValue', 458 field: 'matchChValue',
416 default: '', 459 default: '',
...@@ -421,7 +464,7 @@ const newCreateGradeFormItems = ref<any>([{ ...@@ -421,7 +464,7 @@ const newCreateGradeFormItems = ref<any>([{
421 { 464 {
422 label: '', 465 label: '',
423 type: 'textarea', 466 type: 'textarea',
424 maxlength: 500, 467 maxlength: 260,
425 placeholder: '请输入字段中文,中间用英文“,”分号隔开', 468 placeholder: '请输入字段中文,中间用英文“,”分号隔开',
426 field: 'matchEnValue', 469 field: 'matchEnValue',
427 default: '', 470 default: '',
...@@ -459,7 +502,18 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -459,7 +502,18 @@ const newCreateGradeStandardDialogInfo = ref({
459 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false; 502 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
460 }, 503 },
461 submit: async (btn, info) => { 504 submit: async (btn, info) => {
462 console.log(info); 505
506 for (let i = 0; i < formRows.value.length; i++) {
507 const row = formRows.value[i];
508 // 如果某一条数据的 matchValue, position, name 都为空,则跳过,不校验
509 if (!row.matchValue && !row.position && !row.name) {
510 continue; // 如果全为空,跳过这一行的校验
511 }
512 if (!row.matchValue || !row.position || !row.name) {
513 proxy.$ElMessage.error('请填写完整的模糊匹配规则');
514 return;
515 }
516 }
463 newCreateGradeStandardDialogInfo.value.submitBtnLoading = true; 517 newCreateGradeStandardDialogInfo.value.submitBtnLoading = true;
464 if (newCreateGradeStandardDialogInfo.value.title === "添加标签") { 518 if (newCreateGradeStandardDialogInfo.value.title === "添加标签") {
465 const tempParams = formRows.value.map((item) => ({ 519 const tempParams = formRows.value.map((item) => ({
...@@ -482,6 +536,7 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -482,6 +536,7 @@ const newCreateGradeStandardDialogInfo = ref({
482 getLabelPageData(); 536 getLabelPageData();
483 getLabelListData(); 537 getLabelListData();
484 } else { 538 } else {
539 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
485 proxy.$ElMessage.error(res.msg); 540 proxy.$ElMessage.error(res.msg);
486 } 541 }
487 } 542 }
...@@ -508,6 +563,7 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -508,6 +563,7 @@ const newCreateGradeStandardDialogInfo = ref({
508 getLabelPageData(); 563 getLabelPageData();
509 getLabelListData(); 564 getLabelListData();
510 } else { 565 } else {
566 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
511 proxy.$ElMessage.error(res.msg); 567 proxy.$ElMessage.error(res.msg);
512 } 568 }
513 } 569 }
...@@ -516,30 +572,63 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -516,30 +572,63 @@ const newCreateGradeStandardDialogInfo = ref({
516 }) 572 })
517 573
518 // 新增标签 574 // 新增标签
519 const addNewLabel = () => { 575 const addNewLabel = async () => {
520 console.log('addNewLabel'); 576 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
521 newCreateGradeFormItems.value.forEach(item => { 577 newCreateGradeFormItems.value.forEach(item => {
522 item.default = ''; 578 item.default = '';
523 item.disabled = false; 579 item.disabled = false;
524 }); 580 });
525 formRows.value = [{ matchValue: '', position: '', name: '', disabled: false }]; 581 formRows.value = [{ matchValue: '', position: '', name: '', disabled: false }];
582
583 //
584 if (isLastLayer.value) {
585 // 选择了最后一级
586 newCreateGradeFormItems.value[1].default = atGradeinfo.value.guid;
587 treeInfo.value.expandedKey = [];
588 treeInfo.value.currentNodeKey = atGradeinfo.value.guid;
589 treeInfo.value.expandedKey.push(atGradeinfo.value.classifyGradeGuid);
590 if (atGradeinfo.value?.classifyGradeGuid) {
591 classifyGuid.value = atGradeinfo.value.classifyGradeGuid;
592 tempName.value = atGradeinfo.value.name;
593 classifyDetailGuid.value = atGradeinfo.value.guid;
594 }
595 // 遍历classGradeTreeData 找到对应的guid item的refGradeGuid
596 classGradeTreeData.value.forEach((element: any) => {
597 if (element.guid === classifyGuid.value) {
598 tempRefGradeGuid.value = element.refGradeGuid;
599 }
600 });
601
602 if (tempRefGradeGuid.value) {
603 await getGradeListData(tempRefGradeGuid.value);
604 const matchedGrade = gradeListData.value.find(
605 (element: any) => element.name === tempName.value
606 );
607 if (matchedGrade) {
608 newCreateGradeFormItems.value[2].default = matchedGrade.guid;
609 }
610 }
611 }
612
526 newCreateGradeStandardDialogInfo.value.title = '添加标签'; 613 newCreateGradeStandardDialogInfo.value.title = '添加标签';
527 newCreateGradeStandardDialogInfo.value.visible = true; 614 newCreateGradeStandardDialogInfo.value.visible = true;
615 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
528 } 616 }
529 617
530 618
531 const classSearchItemList = ref<any>([ 619 const classSearchItemList = ref<any>([
532 { 620 {
533 type: 'select-slots', 621 type: 'select',
534 multiple: true, 622 multiple: true,
535 label: '', 623 label: '',
536 field: 'labelName', 624 field: 'labelName',
537 default: [], 625 default: [],
538 options: [], 626 options: [],
539 placeholder: '请选择标签名称', 627 placeholder: '请选择标签名称',
540 clearable: false, 628 clearable: true,
541 filterable: true, 629 filterable: true,
542 visible: true 630 visible: true
631
543 } 632 }
544 ]); 633 ]);
545 634
...@@ -551,6 +640,7 @@ const selectChange = async (val: any, row: any) => { ...@@ -551,6 +640,7 @@ const selectChange = async (val: any, row: any) => {
551 }; 640 };
552 641
553 /** 搜索查询分类标准 */ 642 /** 搜索查询分类标准 */
643 const refCount = ref(0);
554 const searchClass = async (val: any, clear: boolean = false) => { 644 const searchClass = async (val: any, clear: boolean = false) => {
555 console.log('searchClass', val, clear); 645 console.log('searchClass', val, clear);
556 if (clear) { 646 if (clear) {
...@@ -559,7 +649,7 @@ const searchClass = async (val: any, clear: boolean = false) => { ...@@ -559,7 +649,7 @@ const searchClass = async (val: any, clear: boolean = false) => {
559 getLabelPageData(); 649 getLabelPageData();
560 return; 650 return;
561 } 651 }
562 if (val?.labelName?.length !== 0) { 652 if (val?.labelName?.length !== 0 || refCount.value >= 1) {
563 tableInfo.value.loading = true; 653 tableInfo.value.loading = true;
564 const params = { 654 const params = {
565 pageIndex: page.value.curr, 655 pageIndex: page.value.curr,
...@@ -579,7 +669,6 @@ const searchClass = async (val: any, clear: boolean = false) => { ...@@ -579,7 +669,6 @@ const searchClass = async (val: any, clear: boolean = false) => {
579 } 669 }
580 } 670 }
581 671
582
583 }; 672 };
584 673
585 674
...@@ -601,12 +690,13 @@ const handleSelectChange = async (val, row, info) => { ...@@ -601,12 +690,13 @@ const handleSelectChange = async (val, row, info) => {
601 newCreateGradeFormItems.value[2].default = matchedGrade.guid; 690 newCreateGradeFormItems.value[2].default = matchedGrade.guid;
602 newCreateGradeFormItems.value[0].default = tempFormData.value.label; 691 newCreateGradeFormItems.value[0].default = tempFormData.value.label;
603 newCreateGradeFormItems.value[1].default = tempFormData.value.classifyDetailGuid; 692 newCreateGradeFormItems.value[1].default = tempFormData.value.classifyDetailGuid;
693 newCreateGradeFormItems.value[3].default = tempFormData.value.matchChValue;
694 newCreateGradeFormItems.value[4].default = tempFormData.value.matchEnValue;
604 } 695 }
605 } 696 }
606 }; 697 };
607 698
608 const handleTreeSelectNodeChange = (node, item, nodeObj) => { 699 const handleTreeSelectNodeChange = (node, item, nodeObj) => {
609 console.log('handleTreeSelectNodeChange', node, item, nodeObj);
610 treeInfo.value.expandedKey = []; 700 treeInfo.value.expandedKey = [];
611 treeInfo.value.currentNodeKey = node.guid; 701 treeInfo.value.currentNodeKey = node.guid;
612 treeInfo.value.expandedKey.push(node.classifyGradeGuid); 702 treeInfo.value.expandedKey.push(node.classifyGradeGuid);
...@@ -702,8 +792,8 @@ const deleteRow = (index: number) => { ...@@ -702,8 +792,8 @@ const deleteRow = (index: number) => {
702 </div> 792 </div>
703 <div> 793 <div>
704 <el-button type="primary" class="v-add" @click="addNewLabel">新增</el-button> 794 <el-button type="primary" class="v-add" @click="addNewLabel">新增</el-button>
705 <el-button class="v-import">导入</el-button> 795 <!-- <el-button class="v-import">导入</el-button>
706 <el-button>导出</el-button> 796 <el-button>导出</el-button> -->
707 </div> 797 </div>
708 <div class="table_panel_wrap"> 798 <div class="table_panel_wrap">
709 <Table :tableInfo="tableInfo" @tableSwitchBeforeChange="tableSwitchBeforeChange" 799 <Table :tableInfo="tableInfo" @tableSwitchBeforeChange="tableSwitchBeforeChange"
...@@ -868,6 +958,11 @@ const deleteRow = (index: number) => { ...@@ -868,6 +958,11 @@ const deleteRow = (index: number) => {
868 line-height: 24px; 958 line-height: 24px;
869 font-weight: 600; 959 font-weight: 600;
870 } 960 }
961
962 .el-dialog__body {
963 height: 510px;
964 overflow: auto;
965 }
871 } 966 }
872 } 967 }
873 </style> 968 </style>
......
...@@ -96,7 +96,7 @@ const getFieldTypeData = async () => { ...@@ -96,7 +96,7 @@ const getFieldTypeData = async () => {
96 } 96 }
97 const res: any = await getFieldTypeList(params); 97 const res: any = await getFieldTypeList(params);
98 if (res.code == proxy.$passCode) { 98 if (res.code == proxy.$passCode) {
99 fieldData.value = options; 99 fieldData.value = res.data;
100 } else { 100 } else {
101 proxy.$ElMessage.error(res.msg); 101 proxy.$ElMessage.error(res.msg);
102 } 102 }
...@@ -253,6 +253,8 @@ const editableFields = { ...@@ -253,6 +253,8 @@ const editableFields = {
253 gradeDetailName: true, // 分级可编辑 253 gradeDetailName: true, // 分级可编辑
254 sourceFieldName: true, // 源字段英文名可编辑 254 sourceFieldName: true, // 源字段英文名可编辑
255 classifyDetailGuid: true, // 分类可编辑 255 classifyDetailGuid: true, // 分类可编辑
256 fieldType: true, // 字段类型可编辑
257 fieldChName: true, // 字段中文名可编辑
256 } 258 }
257 259
258 const tableFieldsLoading = ref(false) 260 const tableFieldsLoading = ref(false)
...@@ -542,7 +544,6 @@ const saveOrUpdate = async (params: any = {}, type) => { ...@@ -542,7 +544,6 @@ const saveOrUpdate = async (params: any = {}, type) => {
542 database: '', 544 database: '',
543 databaseChName: '', 545 databaseChName: '',
544 foundMode: 0, 546 foundMode: 0,
545 state: 0,
546 isDraft: '', 547 isDraft: '',
547 fieldRQVOList: tableDataDetailInfo.value 548 fieldRQVOList: tableDataDetailInfo.value
548 } 549 }
...@@ -716,16 +717,24 @@ const createNewSql = () => { ...@@ -716,16 +717,24 @@ const createNewSql = () => {
716 <el-table-column type="selection" :width="32" align="center" /> 717 <el-table-column type="selection" :width="32" align="center" />
717 <!-- 排序列(不可编辑) --> 718 <!-- 排序列(不可编辑) -->
718 <el-table-column type="index" label="排序" width="80" align="center" /> 719 <el-table-column type="index" label="排序" width="80" align="center" />
719 <!-- 字段中文名(可编辑)fieldChName --> 720 <!-- 字段中文名(可编辑)fieldChName -->
720 <el-table-column prop="fieldChName" label="目标字段中文名" width="150"> 721 <el-table-column prop="fieldChName" label="目标字段中文名" width="150">
722 <!-- 可以编辑 -->
721 <template #default="scope"> 723 <template #default="scope">
722 {{ scope.row.fieldChName ? scope.row.fieldChName : '--' }} 724 <span v-if="!scope.row.isEdit || !editableFields.fieldChName">{{ scope.row.fieldChName ?
725 scope.row.fieldChName
726 : '--' }}</span>
727 <el-input v-else v-model="scope.row.fieldChName" placeholder="请输入" />
723 </template> 728 </template>
729
724 </el-table-column> 730 </el-table-column>
725 <!-- 字段英文名(可编辑) --> 731 <!-- 字段英文名(可编辑) -->
726 <el-table-column prop="fieldName" label="目标字段英文名" width="150"> 732 <el-table-column prop="fieldName" label="目标字段英文名" width="150">
727 <template #default="scope"> 733 <template #default="scope">
728 {{ scope.row.fieldName ? scope.row.fieldName : '--' }} 734 <span v-if="!scope.row.isEdit || !editableFields.fieldName">{{ scope.row.fieldName ?
735 scope.row.fieldName
736 : '--' }}</span>
737 <el-input v-else v-model="scope.row.fieldName" placeholder="请输入" />
729 </template> 738 </template>
730 </el-table-column> 739 </el-table-column>
731 <!-- 源数据库 --> 740 <!-- 源数据库 -->
...@@ -756,10 +765,19 @@ const createNewSql = () => { ...@@ -756,10 +765,19 @@ const createNewSql = () => {
756 <el-input v-else v-model="scope.row.sourceFieldName" placeholder="请输入长度" /> 765 <el-input v-else v-model="scope.row.sourceFieldName" placeholder="请输入长度" />
757 </template> 766 </template>
758 </el-table-column> 767 </el-table-column>
759 <!-- 源端字段 fieldType--> 768 <!-- 源端字段 fieldType fieldTypeProps-->
760 <el-table-column prop="fieldType" label="源端字段类型" width="150"> 769 <el-table-column prop="fieldType" label="源端字段类型" width="150">
761 <template #default="scope"> 770 <template #default="scope">
762 {{ scope.row.fieldType ? scope.row.fieldType : '--' }} 771 <div v-if="scope.row.isEdit">
772 <el-select v-model="scope.row.fieldType" placeholder="选择类型" clearable filterable
773 :props="fieldTypeProps">
774 <el-option v-for="(item, index) in fieldData" :key="index" :label="item.label"
775 :value="item.value"></el-option>
776 </el-select>
777 </div>
778 <div v-else>
779 {{ fieldData.find(item => item.value === scope.row.fieldType)?.label || '--' }}
780 </div>
763 </template> 781 </template>
764 </el-table-column> 782 </el-table-column>
765 783
......
...@@ -57,9 +57,18 @@ const getClassifyGradListData = async () => { ...@@ -57,9 +57,18 @@ const getClassifyGradListData = async () => {
57 } 57 }
58 58
59 //获取分类列表 59 //获取分类列表
60 const getClassListData = async () => { 60 const getClassListData = async (params = {}) => {
61 const inParams = {
62 type: 'C',
63 pageIndex: 1,
64 pageSize: -1
65 }
66 const finalParams = {
67 ...inParams,
68 ...params
69 }
61 classListDataLoading.value = true; 70 classListDataLoading.value = true;
62 const res: any = await getClassifyGradList(refClassifyPageParams.value); 71 const res: any = await getClassifyGradList(finalParams);
63 if (res.code == proxy.$passCode) { 72 if (res.code == proxy.$passCode) {
64 classListData.value = res.data.records || []; 73 classListData.value = res.data.records || [];
65 classListDataLoading.value = false; 74 classListDataLoading.value = false;
...@@ -70,7 +79,7 @@ const getClassListData = async () => { ...@@ -70,7 +79,7 @@ const getClassListData = async () => {
70 79
71 onMounted(() => { 80 onMounted(() => {
72 getClassifyGradListData(); 81 getClassifyGradListData();
73 getClassListData(); 82 // getClassListData();
74 }) 83 })
75 84
76 85
...@@ -108,24 +117,30 @@ const cardBtnVisible: any = ref(false); ...@@ -108,24 +117,30 @@ const cardBtnVisible: any = ref(false);
108 117
109 /** 搜索查询分类标准 */ 118 /** 搜索查询分类标准 */
110 const searchClass = async (val: any, clear: boolean = false) => { 119 const searchClass = async (val: any, clear: boolean = false) => {
120 console.log(val, 'val');
121
111 if (clear) { 122 if (clear) {
112 classSearchItemList.value.map(item => item.default = '') 123 classSearchItemList.value.map(item => item.default = '')
113 getClassListData(); 124 getClassListData();
114 return; 125 return;
115 } 126 }
116 const params = { 127 // const params = {
117 type: 'C', 128 // type: 'C',
118 name: val.classStandardName, 129 // name: val.classStandardName,
119 pageIndex: 1, 130 // pageIndex: 1,
120 pageSize: -1 131 // pageSize: -1
121 } 132 // }
122 const res: any = await getClassifyGradList(params); 133 // const res: any = await getClassifyGradList(params);
123 if (res.code == proxy.$passCode) { 134 // if (res.code == proxy.$passCode) {
124 classListData.value = res.data.records || []; 135 // classListData.value = res.data.records || [];
125 } else { 136 // } else {
126 proxy.$ElMessage.error(res.msg); 137 // proxy.$ElMessage.error(res.msg);
127 } 138 // }
128 139 getClassListData(
140 {
141 name: val.classStandardName
142 }
143 );
129 }; 144 };
130 145
131 /** 编辑分类 */ 146 /** 编辑分类 */
...@@ -232,7 +247,7 @@ const classStandardFormItems = ref([{ ...@@ -232,7 +247,7 @@ const classStandardFormItems = ref([{
232 247
233 const classStandardFormRules = ref({ 248 const classStandardFormRules = ref({
234 classStandardName: [required('请填写分类名称')], 249 classStandardName: [required('请填写分类名称')],
235 gradeStandard: [required('请选择分级标准')] 250 refGradeGuid: [required('请选择分级标准')]
236 }); 251 });
237 252
238 const newCreateClassStandardDialogInfo = ref({ 253 const newCreateClassStandardDialogInfo = ref({
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!