update:分类配置开发
Showing
6 changed files
with
349 additions
and
133 deletions
| ... | @@ -54,7 +54,6 @@ declare module '@vue/runtime-core' { | ... | @@ -54,7 +54,6 @@ declare module '@vue/runtime-core' { |
| 54 | Table_tools: typeof import('./src/components/Tools/table_tools.vue')['default'] | 54 | Table_tools: typeof import('./src/components/Tools/table_tools.vue')['default'] |
| 55 | Table_v2: typeof import('./src/components/Table/table_v2.vue')['default'] | 55 | Table_v2: typeof import('./src/components/Table/table_v2.vue')['default'] |
| 56 | Tabs: typeof import('./src/components/Tabs/index.vue')['default'] | 56 | Tabs: typeof import('./src/components/Tabs/index.vue')['default'] |
| 57 | TemplateItem: typeof import('./src/components/TemplateItem/index.vue')['default'] | ||
| 58 | Toolbar: typeof import('./src/components/LineageGraph/toolbar.vue')['default'] | 57 | Toolbar: typeof import('./src/components/LineageGraph/toolbar.vue')['default'] |
| 59 | Topbar: typeof import('./src/components/LineageGraph/topbar.vue')['default'] | 58 | Topbar: typeof import('./src/components/LineageGraph/topbar.vue')['default'] |
| 60 | Transfer: typeof import('./src/components/Transfer/index.vue')['default'] | 59 | Transfer: typeof import('./src/components/Transfer/index.vue')['default'] | ... | ... |
| ... | @@ -129,3 +129,47 @@ export const getGradeTreeList = () => request({ | ... | @@ -129,3 +129,47 @@ export const getGradeTreeList = () => request({ |
| 129 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/grade/tree-list`, | 129 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/grade/tree-list`, |
| 130 | method: 'post', | 130 | method: 'post', |
| 131 | }) | 131 | }) |
| 132 | |||
| 133 | /** | ||
| 134 | * 分类树形列表 | ||
| 135 | * @param {Object} | ||
| 136 | * @path /classify/tree-list | ||
| 137 | * */ | ||
| 138 | export const getClassifyTreeList = (data) => request({ | ||
| 139 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/classify/tree-list`, | ||
| 140 | method: 'post', | ||
| 141 | data | ||
| 142 | }) | ||
| 143 | |||
| 144 | /** | ||
| 145 | * 分类新增 | ||
| 146 | * @param {Object} | ||
| 147 | * @path /classify/save | ||
| 148 | * */ | ||
| 149 | |||
| 150 | export const saveClassify = (data) => request({ | ||
| 151 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/classify/save`, | ||
| 152 | method: 'post', | ||
| 153 | data | ||
| 154 | }) | ||
| 155 | |||
| 156 | /** | ||
| 157 | * 分类更新 | ||
| 158 | * @param {Object} | ||
| 159 | * @path /classify/update | ||
| 160 | */ | ||
| 161 | |||
| 162 | export const updateClassify = (data) => request({ | ||
| 163 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/classify/update`, | ||
| 164 | method: 'post', | ||
| 165 | data | ||
| 166 | }) | ||
| 167 | |||
| 168 | /**删除分类 | ||
| 169 | * @param {Object} | ||
| 170 | * @path /classify/delete | ||
| 171 | */ | ||
| 172 | export const deleteClassify = (data) => request({ | ||
| 173 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/classify/delete?guid=${data.guid}`, | ||
| 174 | method: 'delete', | ||
| 175 | }) | ... | ... |
| ... | @@ -552,6 +552,18 @@ export const tagType = (row, type) => { | ... | @@ -552,6 +552,18 @@ export const tagType = (row, type) => { |
| 552 | state = 'danger'//发布中 | 552 | state = 'danger'//发布中 |
| 553 | break; | 553 | break; |
| 554 | } | 554 | } |
| 555 | }else if (type == 'status'){ | ||
| 556 | switch (row[type]) { | ||
| 557 | case 'Y': | ||
| 558 | state = 'success'; | ||
| 559 | break; | ||
| 560 | case 'S': | ||
| 561 | state = 'info'; | ||
| 562 | break; | ||
| 563 | default: | ||
| 564 | state = 'info'; | ||
| 565 | break; | ||
| 566 | } | ||
| 555 | } | 567 | } |
| 556 | return state; | 568 | return state; |
| 557 | } | 569 | } | ... | ... |
| ... | @@ -9,6 +9,7 @@ import { useValidator } from '@/hooks/useValidator'; | ... | @@ -9,6 +9,7 @@ import { useValidator } from '@/hooks/useValidator'; |
| 9 | import { TableColumnWidth } from '@/utils/enum'; | 9 | import { TableColumnWidth } from '@/utils/enum'; |
| 10 | import G6 from '@antv/g6'; | 10 | import G6 from '@antv/g6'; |
| 11 | import { IGroup, ModelConfig } from '@antv/g6'; | 11 | import { IGroup, ModelConfig } from '@antv/g6'; |
| 12 | import { getClassifyGradList, getClassifyTreeList, getGradeList, saveClassify, updateClassify, deleteClassify } from "@/api/modules/dataInventory"; | ||
| 12 | 13 | ||
| 13 | const { required, orderNum } = useValidator(); | 14 | const { required, orderNum } = useValidator(); |
| 14 | const { proxy } = getCurrentInstance() as any; | 15 | const { proxy } = getCurrentInstance() as any; |
| ... | @@ -18,51 +19,70 @@ const fullPath = route.query.fullPath; | ... | @@ -18,51 +19,70 @@ const fullPath = route.query.fullPath; |
| 18 | const userStore = useUserStore(); | 19 | const userStore = useUserStore(); |
| 19 | 20 | ||
| 20 | const fullscreenLoading = ref(false); | 21 | const fullscreenLoading = ref(false); |
| 21 | |||
| 22 | const formRef = ref(); | 22 | const formRef = ref(); |
| 23 | |||
| 23 | const classStandardFormItems = ref([{ | 24 | const classStandardFormItems = ref([{ |
| 24 | label: '分类名称', | 25 | label: '分类名称', |
| 25 | type: 'input', | 26 | type: 'input', |
| 26 | maxlength: 50, | 27 | maxlength: 50, |
| 27 | placeholder: '请输入', | 28 | placeholder: '请输入', |
| 28 | field: 'classStandardName', | 29 | field: 'classStandardName', |
| 29 | default: '', | 30 | default: router.currentRoute.value.query.classStandardName, |
| 30 | clearable: true, | 31 | clearable: true, |
| 31 | disabled: true, | 32 | disabled: true, |
| 32 | required: true | 33 | required: true |
| 33 | }, { | 34 | }, { |
| 34 | label: '分级标准', | 35 | label: '分级标准', |
| 35 | type: 'select', | 36 | type: 'input', |
| 36 | placeholder: '请选择', | 37 | placeholder: '请选择', |
| 37 | field: 'gradeStandard', | 38 | field: 'gradeStandard', |
| 38 | default: 1, | 39 | default: '', |
| 39 | options: [], //TODO | ||
| 40 | required: true, | 40 | required: true, |
| 41 | filterable: true, | 41 | filterable: true, |
| 42 | clearable: true, | 42 | clearable: true, |
| 43 | disabled: true, | 43 | disabled: true, |
| 44 | visible: true, | 44 | visible: true, |
| 45 | }]); | 45 | }]); |
| 46 | const currTableInfo = ref({}); | 46 | |
| 47 | // 定义层级映射1->一级,2->二级,3->三级,4->四级 | ||
| 48 | const levelMap = { | ||
| 49 | 1: '一级', | ||
| 50 | 2: '二级', | ||
| 51 | 3: '三级', | ||
| 52 | 4: '四级', | ||
| 53 | } | ||
| 54 | const currTableInfo = ref<any>({}); | ||
| 55 | |||
| 47 | const tableInfo = ref({ | 56 | const tableInfo = ref({ |
| 48 | id: "data-class-standard-table", | 57 | id: "data-class-standard-table", |
| 49 | multiple: false, | 58 | multiple: false, |
| 50 | fields: [ | 59 | fields: [ |
| 51 | { label: "序号", type: "index", width: 56, align: "center" }, | 60 | { label: "序号", type: "index", width: 56, align: "center" }, |
| 52 | { label: "分类", field: "className", width: 160, type: 'expand' }, | 61 | { label: "分类", field: "classifyName", width: 160, type: 'expand' }, |
| 53 | { label: "层级", field: "levelName", width: 120 }, | 62 | { |
| 54 | { label: "状态", field: "state", type: "tag", width: 120, align: "center" }, | 63 | label: "层级", field: "level", width: 120, getName: (scope) => { |
| 55 | { label: "定义说明", field: "description", width: TableColumnWidth.DESCRIPTION }, | 64 | let level = scope.row.level; |
| 56 | { label: "最低安全级别参考", field: "minLevel", width: 140 }, | 65 | return levelMap[level]; |
| 57 | { label: "修改人", field: "updateUserName", width: 140 }, | 66 | } |
| 58 | { label: "更新时间", field: "updateTime", width: 180 }, | 67 | }, |
| 68 | { | ||
| 69 | label: "状态", field: "status", type: "tag", width: 120, align: "center", getName: (scope) => { | ||
| 70 | let status = scope.row.status; | ||
| 71 | return status == 'Y' ? '有效' : '停用'; | ||
| 72 | } | ||
| 73 | }, | ||
| 74 | { label: "定义说明", field: "description", }, | ||
| 75 | { | ||
| 76 | label: "最低安全级别参考", field: "levelCode", width: 140, getName: (scope) => { | ||
| 77 | let levelCode = scope.row.levelCode; | ||
| 78 | return levelCode + '级'; | ||
| 79 | } | ||
| 80 | }, | ||
| 81 | // { label: "修改人", field: "updateUserName", width: 140 }, | ||
| 82 | // { label: "更新时间", field: "updateTime", width: 180 }, | ||
| 59 | ], | 83 | ], |
| 60 | data: [{ | 84 | data: [], |
| 61 | guid: '1', | 85 | rowKey: 'guid', |
| 62 | children: [{ | ||
| 63 | guid: '1-1' | ||
| 64 | }] | ||
| 65 | }], | ||
| 66 | showPage: false, | 86 | showPage: false, |
| 67 | actionInfo: { | 87 | actionInfo: { |
| 68 | label: "操作", | 88 | label: "操作", |
| ... | @@ -81,15 +101,16 @@ const tableInfo = ref({ | ... | @@ -81,15 +101,16 @@ const tableInfo = ref({ |
| 81 | }, | 101 | }, |
| 82 | { | 102 | { |
| 83 | label: "删除", value: "delete", click: (scope) => { | 103 | label: "删除", value: "delete", click: (scope) => { |
| 104 | console.log(scope); | ||
| 84 | proxy.$openMessageBox("此操作将永久删除该分类, 是否继续", () => { | 105 | proxy.$openMessageBox("此操作将永久删除该分类, 是否继续", () => { |
| 85 | // deleteBizTerm([scope.row.guid]).then((res: any) => { | 106 | deleteClassify({ guid: scope.row.guid }).then((res: any) => { |
| 86 | // if (res.code == proxy.$passCode) { | 107 | if (res.code == proxy.$passCode) { |
| 87 | // getTableData(); | 108 | getTreeListData(); |
| 88 | // proxy.$ElMessage.success('该分类删除成功'); | 109 | proxy.$ElMessage.success('该分类删除成功'); |
| 89 | // } else { | 110 | } else { |
| 90 | // proxy.$ElMessage.error(res.msg); | 111 | proxy.$ElMessage.error(res.msg); |
| 91 | // } | 112 | } |
| 92 | // }); | 113 | }); |
| 93 | }) | 114 | }) |
| 94 | } | 115 | } |
| 95 | }, | 116 | }, |
| ... | @@ -103,7 +124,7 @@ const classEditFormItems = ref([{ | ... | @@ -103,7 +124,7 @@ const classEditFormItems = ref([{ |
| 103 | type: 'input', | 124 | type: 'input', |
| 104 | maxlength: 50, | 125 | maxlength: 50, |
| 105 | placeholder: '请输入', | 126 | placeholder: '请输入', |
| 106 | field: 'classStandardName', | 127 | field: 'classifyName', |
| 107 | default: '', | 128 | default: '', |
| 108 | clearable: true, | 129 | clearable: true, |
| 109 | required: true | 130 | required: true |
| ... | @@ -127,7 +148,7 @@ const classEditFormItems = ref([{ | ... | @@ -127,7 +148,7 @@ const classEditFormItems = ref([{ |
| 127 | checkStrictly: true, | 148 | checkStrictly: true, |
| 128 | lazy: false, | 149 | lazy: false, |
| 129 | props: { | 150 | props: { |
| 130 | label: "className", | 151 | label: "classifyName", |
| 131 | value: "guid", | 152 | value: "guid", |
| 132 | }, | 153 | }, |
| 133 | block: true, | 154 | block: true, |
| ... | @@ -138,9 +159,13 @@ const classEditFormItems = ref([{ | ... | @@ -138,9 +159,13 @@ const classEditFormItems = ref([{ |
| 138 | label: '最低安全级别参考', | 159 | label: '最低安全级别参考', |
| 139 | type: 'select', | 160 | type: 'select', |
| 140 | placeholder: '请选择', | 161 | placeholder: '请选择', |
| 141 | field: 'lowerLevel', | 162 | field: 'gradeGuid', |
| 142 | default: 1, | 163 | default: 1, |
| 143 | options: [], //TODO | 164 | options: [], //TODO |
| 165 | props: { | ||
| 166 | label: "name", | ||
| 167 | value: "guid", | ||
| 168 | }, | ||
| 144 | required: false, | 169 | required: false, |
| 145 | filterable: true, | 170 | filterable: true, |
| 146 | clearable: true, | 171 | clearable: true, |
| ... | @@ -148,12 +173,12 @@ const classEditFormItems = ref([{ | ... | @@ -148,12 +173,12 @@ const classEditFormItems = ref([{ |
| 148 | }, { | 173 | }, { |
| 149 | label: '业务状态', | 174 | label: '业务状态', |
| 150 | type: 'switch', | 175 | type: 'switch', |
| 151 | field: 'state', | 176 | field: 'status', |
| 152 | default: 'Y', | 177 | default: 'Y', |
| 153 | activeText: "有效", | 178 | activeText: "有效", |
| 154 | inactiveText: "停用", | 179 | inactiveText: "停用", |
| 155 | activeValue: 'Y', | 180 | activeValue: 'Y', |
| 156 | inactiveValue: 'N' | 181 | inactiveValue: 'S' |
| 157 | }, { | 182 | }, { |
| 158 | label: '定义说明', | 183 | label: '定义说明', |
| 159 | type: 'textarea', | 184 | type: 'textarea', |
| ... | @@ -203,11 +228,105 @@ const drawerInfo = ref({ | ... | @@ -203,11 +228,105 @@ const drawerInfo = ref({ |
| 203 | } | 228 | } |
| 204 | }) | 229 | }) |
| 205 | 230 | ||
| 206 | const drawerBtnClick = (btn, info) => { | 231 | const drawerBtnClick = async (btn, info) => { |
| 207 | if (btn.value == 'cancel') { | 232 | if (btn.value == 'cancel') { |
| 208 | drawerInfo.value.visible = false; | 233 | drawerInfo.value.visible = false; |
| 209 | } else { | 234 | } else { |
| 235 | if (drawerInfo.value.header.title == '添加分类') { | ||
| 236 | const params = { | ||
| 237 | ...info, | ||
| 238 | classifyGradeGuid: router.currentRoute.value.query.guid, | ||
| 239 | } | ||
| 240 | const res: any = await saveClassify(params); | ||
| 241 | if (res.code == proxy.$passCode) { | ||
| 242 | proxy.$ElMessage.success('添加成功!'); | ||
| 243 | drawerInfo.value.visible = false; | ||
| 244 | getTreeListData(); | ||
| 245 | } else { | ||
| 246 | proxy.$ElMessage.error(res.msg); | ||
| 247 | } | ||
| 248 | } else { | ||
| 249 | // 编辑分类 | ||
| 250 | const params = { | ||
| 251 | ...info, | ||
| 252 | classifyGradeGuid: router.currentRoute.value.query.guid, | ||
| 253 | guid: currTableInfo.value.guid | ||
| 254 | } | ||
| 255 | const res: any = await updateClassify(params); | ||
| 256 | if (res.code == proxy.$passCode) { | ||
| 257 | proxy.$ElMessage.success('修改成功!'); | ||
| 258 | drawerInfo.value.visible = false; | ||
| 259 | getTreeListData(); | ||
| 260 | } else { | ||
| 261 | proxy.$ElMessage.error(res.msg); | ||
| 262 | } | ||
| 263 | } | ||
| 264 | } | ||
| 265 | } | ||
| 266 | const refGradePageParams = ref({ | ||
| 267 | pageIndex: 1, | ||
| 268 | pageSize: -1, | ||
| 269 | type: "G" | ||
| 270 | }); | ||
| 271 | const classifyGradListData = ref([]); | ||
| 272 | |||
| 273 | // 获取分级列表 | ||
| 274 | const getClassifyGradListData = async () => { | ||
| 275 | const res: any = await getClassifyGradList(refGradePageParams.value); | ||
| 276 | if (res.code == proxy.$passCode) { | ||
| 277 | classifyGradListData.value = res.data.records || []; | ||
| 278 | const gradeName = findStandardName(router.currentRoute.value.query.refGradeGuid as any); | ||
| 279 | classStandardFormItems.value[1].default = gradeName; | ||
| 280 | } else { | ||
| 281 | proxy.$ElMessage.error(res.msg); | ||
| 282 | } | ||
| 283 | } | ||
| 284 | const findStandardName = (guid: string) => { | ||
| 285 | const item: any = classifyGradListData.value.find((item: any) => item.guid == guid); | ||
| 286 | return item ? item.name : ''; | ||
| 287 | } | ||
| 288 | |||
| 289 | // 获取分类树形列表 | ||
| 290 | const treeListParams = ref({ | ||
| 291 | pageIndex: 1, | ||
| 292 | pageSize: -1, | ||
| 293 | classifyGradeGuid: router.currentRoute.value.query.guid, | ||
| 294 | }); | ||
| 295 | const treeListData = ref([]); | ||
| 296 | const getTreeListData = async () => { | ||
| 297 | const res: any = await getClassifyTreeList(treeListParams.value); | ||
| 298 | if (res.code == proxy.$passCode) { | ||
| 299 | treeListData.value = res.data || []; | ||
| 300 | tableInfo.value.data = treeListData.value; | ||
| 301 | classEditFormItems.value[2].options = treeListData.value; | ||
| 302 | } else { | ||
| 303 | proxy.$ElMessage.error(res.msg); | ||
| 304 | } | ||
| 305 | } | ||
| 306 | // 这里有个需求就是编辑时,不能选择自己和自己的子分类作为上级分类,每条数据加上disabled属性true or false | ||
| 307 | const selectParentEdit = (value: any) => { | ||
| 210 | 308 | ||
| 309 | } | ||
| 310 | |||
| 311 | |||
| 312 | // 获取最低安全级别参考 // 获取分级列表 | ||
| 313 | const gradeTablelist = ref<any>([]); | ||
| 314 | const getGradeListData = async () => { | ||
| 315 | const params = { | ||
| 316 | pageIndex: 1, | ||
| 317 | pageSize: -1, | ||
| 318 | classifyGradeGuid: router.currentRoute.value.query.refGradeGuid, | ||
| 319 | } | ||
| 320 | const res: any = await getGradeList(params); | ||
| 321 | if (res.code == proxy.$passCode) { | ||
| 322 | gradeTablelist.value = res.data.records; | ||
| 323 | console.log('gradeTablelist', gradeTablelist.value); | ||
| 324 | for (let i = 0; i < gradeTablelist.value.length; i++) { | ||
| 325 | gradeTablelist.value[i].name = gradeTablelist.value[i].dataGrade + '级'; | ||
| 326 | } | ||
| 327 | classEditFormItems.value[3].options = gradeTablelist.value; | ||
| 328 | } else { | ||
| 329 | proxy.$ElMessage.error(res.msg); | ||
| 211 | } | 330 | } |
| 212 | } | 331 | } |
| 213 | 332 | ||
| ... | @@ -331,7 +450,9 @@ G6.registerNode('tree-node', { | ... | @@ -331,7 +450,9 @@ G6.registerNode('tree-node', { |
| 331 | }, 'single-shape'); | 450 | }, 'single-shape'); |
| 332 | 451 | ||
| 333 | onMounted(() => { | 452 | onMounted(() => { |
| 334 | 453 | getClassifyGradListData(); | |
| 454 | getTreeListData(); | ||
| 455 | getGradeListData(); | ||
| 335 | graph.value = new G6.TreeGraph({ | 456 | graph.value = new G6.TreeGraph({ |
| 336 | container: shapeMain.value, | 457 | container: shapeMain.value, |
| 337 | width: shapeMain.value.clientWidth, | 458 | width: shapeMain.value.clientWidth, | ... | ... |
| ... | @@ -237,7 +237,7 @@ const newCreateGradeFormItems = ref([{ | ... | @@ -237,7 +237,7 @@ const newCreateGradeFormItems = ref([{ |
| 237 | { | 237 | { |
| 238 | label: '分级描述', | 238 | label: '分级描述', |
| 239 | type: 'textarea', | 239 | type: 'textarea', |
| 240 | maxlength: 50, | 240 | maxlength: 500, |
| 241 | placeholder: '分类分级的描述说明', | 241 | placeholder: '分类分级的描述说明', |
| 242 | field: 'gradeDesc', | 242 | field: 'gradeDesc', |
| 243 | default: '', | 243 | default: '', | ... | ... |
| ... | @@ -12,47 +12,63 @@ import { useValidator } from '@/hooks/useValidator'; | ... | @@ -12,47 +12,63 @@ import { useValidator } from '@/hooks/useValidator'; |
| 12 | import TemplateItem from './templateItem.vue'; | 12 | import TemplateItem from './templateItem.vue'; |
| 13 | import { getTempleteClassifyData, saveClassifyGrad, getClassifyGradList, deleteClassifyGrad, updateClassifyGrad, getGradeTreeList } from "@/api/modules/dataInventory"; | 13 | import { getTempleteClassifyData, saveClassifyGrad, getClassifyGradList, deleteClassifyGrad, updateClassifyGrad, getGradeTreeList } from "@/api/modules/dataInventory"; |
| 14 | 14 | ||
| 15 | |||
| 16 | |||
| 17 | const router = useRouter(); | 15 | const router = useRouter(); |
| 18 | const { required } = useValidator(); | 16 | const { required } = useValidator(); |
| 19 | const { proxy } = getCurrentInstance() as any; | 17 | const { proxy } = getCurrentInstance() as any; |
| 20 | 18 | ||
| 21 | const refClassifyPageParams = ref({ | 19 | const refGradePageParams = ref({ |
| 22 | pageIndex: 1, | 20 | pageIndex: 1, |
| 23 | pageSize: 10, | 21 | pageSize: -1, |
| 24 | type: "G" | 22 | type: "G" |
| 25 | }); | 23 | }); |
| 26 | const classifyGradListData = ref(); | ||
| 27 | 24 | ||
| 25 | const refClassifyPageParams = ref({ | ||
| 26 | pageIndex: 1, | ||
| 27 | pageSize: -1, | ||
| 28 | type: "C" | ||
| 29 | }); | ||
| 30 | // 分级列表 | ||
| 31 | const classifyGradListData: any = ref([]); | ||
| 32 | |||
| 33 | // 分类列表 | ||
| 34 | const classListData: any = ref([]); | ||
| 35 | |||
| 36 | //记录分级guid | ||
| 37 | const classifyGradGuid = ref(''); | ||
| 38 | |||
| 39 | // 记录分类guid | ||
| 40 | const classGuid = ref(''); | ||
| 41 | |||
| 42 | |||
| 43 | |||
| 44 | const classListDataLoading = ref(false); | ||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | // 获取分级列表 | ||
| 28 | const getClassifyGradListData = async () => { | 49 | const getClassifyGradListData = async () => { |
| 29 | const res: any = await getClassifyGradList(refClassifyPageParams.value); | 50 | const res: any = await getClassifyGradList(refGradePageParams.value); |
| 30 | if (res.code == proxy.$passCode) { | 51 | if (res.code == proxy.$passCode) { |
| 31 | classifyGradListData.value = res.data.records || []; | 52 | classifyGradListData.value = res.data.records || []; |
| 53 | (classStandardFormItems.value[1].options as any) = classifyGradListData.value; | ||
| 32 | } else { | 54 | } else { |
| 33 | proxy.$ElMessage.error(res.msg); | 55 | proxy.$ElMessage.error(res.msg); |
| 34 | } | 56 | } |
| 35 | } | 57 | } |
| 36 | 58 | ||
| 37 | // 获取分级树形列表 | 59 | //获取分类列表 |
| 38 | const getGradeTreeListData = async () => { | 60 | const getClassListData = async () => { |
| 39 | const res: any = await getGradeTreeList(); | 61 | const res: any = await getClassifyGradList(refClassifyPageParams.value); |
| 40 | if (res.code == proxy.$passCode) { | 62 | if (res.code == proxy.$passCode) { |
| 41 | gradeTreeData.value = res.data || []; | 63 | classListData.value = res.data.records || []; |
| 42 | (classStandardFormItems.value[1].options as any) = gradeTreeData.value; | ||
| 43 | } else { | 64 | } else { |
| 44 | proxy.$ElMessage.error(res.msg); | 65 | proxy.$ElMessage.error(res.msg); |
| 45 | } | 66 | } |
| 46 | } | 67 | } |
| 47 | 68 | ||
| 48 | //记录分级guid | ||
| 49 | const classifyGradGuid = ref(''); | ||
| 50 | // 分级列表 | ||
| 51 | const gradeTreeData = ref(''); | ||
| 52 | |||
| 53 | onMounted(() => { | 69 | onMounted(() => { |
| 54 | getClassifyGradListData(); | 70 | getClassifyGradListData(); |
| 55 | getGradeTreeListData(); | 71 | getClassListData(); |
| 56 | }) | 72 | }) |
| 57 | 73 | ||
| 58 | 74 | ||
| ... | @@ -114,88 +130,90 @@ const classSearchItemList = ref([ | ... | @@ -114,88 +130,90 @@ const classSearchItemList = ref([ |
| 114 | } | 130 | } |
| 115 | ]); | 131 | ]); |
| 116 | 132 | ||
| 117 | const classPage: any = ref({ | ||
| 118 | ...commonPageConfig, | ||
| 119 | classStandardName: '' | ||
| 120 | }); | ||
| 121 | |||
| 122 | const classListDataLoading = ref(false); | ||
| 123 | |||
| 124 | const classListData: any = ref([{ | ||
| 125 | guid: '1', | ||
| 126 | name: '工业数据分类', | ||
| 127 | updateTime: '2020-12-12 10:10:10' | ||
| 128 | }, { | ||
| 129 | guid: '2' | ||
| 130 | }, { | ||
| 131 | guid: '3' | ||
| 132 | }, { | ||
| 133 | guid: '4' | ||
| 134 | }, { | ||
| 135 | guid: '5' | ||
| 136 | }, { | ||
| 137 | guid: '6' | ||
| 138 | }, { | ||
| 139 | guid: '7' | ||
| 140 | }]); | ||
| 141 | |||
| 142 | /** 记录点击省略号弹出菜单的visible */ | 133 | /** 记录点击省略号弹出菜单的visible */ |
| 143 | const cardBtnVisible: any = ref(false); | 134 | const cardBtnVisible: any = ref(false); |
| 144 | 135 | ||
| 145 | /** 搜索查询分类标准 */ | 136 | /** 搜索查询分类标准 */ |
| 146 | const searchClass = (val: any, clear: boolean = false) => { | 137 | const searchClass = async (val: any, clear: boolean = false) => { |
| 147 | classPage.value.curr = 1; | ||
| 148 | if (clear) { | 138 | if (clear) { |
| 149 | classSearchItemList.value.map(item => item.default = '') | 139 | classSearchItemList.value.map(item => item.default = '') |
| 150 | // classPage.value.planName = ''; | ||
| 151 | getClassListData(); | 140 | getClassListData(); |
| 152 | return; | 141 | return; |
| 153 | } | 142 | } |
| 154 | // classPage.value.planName = ''; | 143 | const params = { |
| 155 | getClassListData(); | 144 | type: 'C', |
| 156 | }; | 145 | name: val.classStandardName, |
| 157 | 146 | pageIndex: 1, | |
| 158 | 147 | pageSize: -1 | |
| 148 | } | ||
| 149 | const res: any = await getClassifyGradList(params); | ||
| 150 | if (res.code == proxy.$passCode) { | ||
| 151 | classListData.value = res.data.records || []; | ||
| 152 | } else { | ||
| 153 | proxy.$ElMessage.error(res.msg); | ||
| 154 | } | ||
| 159 | 155 | ||
| 160 | const getClassListData = () => { | 156 | }; |
| 161 | // classListDataLoading.value = true; | ||
| 162 | // getPlanList({ | ||
| 163 | // pageIndex: classPage.value.curr, | ||
| 164 | // pageSize: classPage.value.limit, | ||
| 165 | // //TODO | ||
| 166 | // }).then((res: any) => { | ||
| 167 | // classListDataLoading.value = false; | ||
| 168 | // if (res === undefined) { | ||
| 169 | // return; | ||
| 170 | // } | ||
| 171 | // if (res.code == proxy.$passCode) { | ||
| 172 | // const data = res.data || {} | ||
| 173 | // classListData.value.data = data.records || []; | ||
| 174 | // } else { | ||
| 175 | // proxy.$ElMessage.error(res.msg); | ||
| 176 | // } | ||
| 177 | // }) | ||
| 178 | } | ||
| 179 | 157 | ||
| 180 | /** 编辑分类 */ | 158 | /** 编辑分类 */ |
| 181 | const handleClassDataEdit = (item, des = '') => { | 159 | const handleClassDataEdit = (params) => { |
| 182 | 160 | classGuid.value = params.guid; | |
| 161 | newCreateClassStandardDialogInfo.value.submitBtnLoading = false; | ||
| 162 | newCreateClassStandardDialogInfo.value.visible = true; | ||
| 163 | newCreateClassStandardDialogInfo.value.title = '编辑分类'; | ||
| 164 | classStandardFormItems.value.forEach(item => { | ||
| 165 | if (item.field === 'refGradeGuid') { | ||
| 166 | item.default = params.refGradeGuid | ||
| 167 | } | ||
| 168 | if (item.field === 'classStandardName') { | ||
| 169 | item.default = params.name | ||
| 170 | } | ||
| 171 | }) | ||
| 183 | } | 172 | } |
| 184 | 173 | ||
| 174 | // 配置分类 | ||
| 185 | const handleClassDataClick = (item, des = '') => { | 175 | const handleClassDataClick = (item, des = '') => { |
| 176 | // 获取分级标准 | ||
| 186 | router.push({ | 177 | router.push({ |
| 187 | name: 'classStandardEdit', | 178 | name: 'classStandardEdit', |
| 188 | query: { | 179 | query: { |
| 180 | guid: item.guid, | ||
| 189 | type: des === '' ? '配置' : des, | 181 | type: des === '' ? '配置' : des, |
| 190 | classStandardName: '工业分类' | 182 | classStandardName: item.name, |
| 183 | refGradeGuid: item.refGradeGuid | ||
| 191 | } | 184 | } |
| 192 | }); | 185 | }); |
| 193 | } | 186 | } |
| 194 | 187 | ||
| 195 | const handleClassDataDel = (item) => { | 188 | const handleClassDataDel = async (item) => { |
| 189 | try { | ||
| 190 | // 弹出确认框 | ||
| 191 | await proxy.$confirm('此操作将永久删除该分级, 是否继续?', '提示', { | ||
| 192 | confirmButtonText: '确定', | ||
| 193 | cancelButtonText: '取消', | ||
| 194 | type: 'warning' | ||
| 195 | }); | ||
| 196 | const res: any = await deleteClassifyGrad({ guid: item.guid }); | ||
| 197 | if (res.code === proxy.$passCode) { | ||
| 198 | await getClassListData(); // 获取更新后的列表数据 | ||
| 199 | proxy.$ElMessage({ | ||
| 200 | type: 'success', | ||
| 201 | message: '删除成功!' | ||
| 202 | }); | ||
| 203 | } else { | ||
| 204 | proxy.$ElMessage.error(res.msg); // 显示错误信息 | ||
| 205 | } | ||
| 206 | } catch (error) { | ||
| 207 | if (error !== 'cancel') { | ||
| 208 | proxy.$ElMessage({ | ||
| 209 | type: 'info', | ||
| 210 | message: '已取消删除' | ||
| 211 | }); | ||
| 212 | } | ||
| 213 | } | ||
| 196 | 214 | ||
| 197 | } | 215 | } |
| 198 | /** ------------------------------- 分类标准相关 ------------------------------------- */ | 216 | |
| 199 | 217 | ||
| 200 | const classStandardFormItems = ref([{ | 218 | const classStandardFormItems = ref([{ |
| 201 | label: '分类名称', | 219 | label: '分类名称', |
| ... | @@ -209,25 +227,19 @@ const classStandardFormItems = ref([{ | ... | @@ -209,25 +227,19 @@ const classStandardFormItems = ref([{ |
| 209 | required: true | 227 | required: true |
| 210 | }, { | 228 | }, { |
| 211 | label: '分级标准', | 229 | label: '分级标准', |
| 212 | type: 'tree-select', | 230 | type: 'select', |
| 213 | placeholder: '请选择', | 231 | placeholder: '请选择', |
| 214 | field: 'gradeStandard', | 232 | field: 'refGradeGuid', |
| 215 | options: [], | 233 | options: [], |
| 216 | nodeKey: 'guid', | ||
| 217 | checkStrictly: false,//只能选择叶子节点。 | ||
| 218 | lazy: false, | ||
| 219 | multiple: false, | ||
| 220 | collapseTagsTooltip: true, | ||
| 221 | collapseTags: true, | ||
| 222 | props: { | 234 | props: { |
| 223 | label: "name", | 235 | label: "name", |
| 224 | value: "guid", | 236 | value: "guid", |
| 225 | children: "gradeRSVOList" | ||
| 226 | }, | 237 | }, |
| 227 | filterable: true, | 238 | filterable: true, |
| 228 | clearable: true, | 239 | clearable: true, |
| 229 | default: '', | 240 | default: '', |
| 230 | required: true | 241 | required: true, |
| 242 | block: true, | ||
| 231 | }]); | 243 | }]); |
| 232 | 244 | ||
| 233 | const classStandardFormRules = ref({ | 245 | const classStandardFormRules = ref({ |
| ... | @@ -250,18 +262,46 @@ const newCreateClassStandardDialogInfo = ref({ | ... | @@ -250,18 +262,46 @@ const newCreateClassStandardDialogInfo = ref({ |
| 250 | cancel: () => { | 262 | cancel: () => { |
| 251 | newCreateClassStandardDialogInfo.value.visible = false; | 263 | newCreateClassStandardDialogInfo.value.visible = false; |
| 252 | }, | 264 | }, |
| 253 | submit: (btn, info) => { | 265 | submit: async (btn, info) => { |
| 266 | if (newCreateClassStandardDialogInfo.value.title === '新增分类') { | ||
| 267 | newCreateClassStandardDialogInfo.value.submitBtnLoading = true; | ||
| 268 | const params = { | ||
| 269 | name: info.classStandardName, | ||
| 270 | refGradeGuid: info.refGradeGuid, | ||
| 271 | type: 'C' | ||
| 272 | } | ||
| 273 | const res: any = await saveClassifyGrad(params); | ||
| 274 | if (res.code == proxy.$passCode) { | ||
| 275 | await getClassListData(); | ||
| 276 | proxy.$ElMessage({ | ||
| 277 | type: 'success', | ||
| 278 | message: '新增分类成功' | ||
| 279 | }) | ||
| 280 | newCreateClassStandardDialogInfo.value.submitBtnLoading = false; | ||
| 254 | newCreateClassStandardDialogInfo.value.visible = false; | 281 | newCreateClassStandardDialogInfo.value.visible = false; |
| 255 | classPage.value.curr = 1; | 282 | } else { |
| 283 | proxy.$ElMessage.error(res.msg); | ||
| 284 | } | ||
| 285 | } else { | ||
| 286 | newCreateClassStandardDialogInfo.value.submitBtnLoading = true; | ||
| 287 | const params = { | ||
| 288 | name: info.classStandardName, | ||
| 289 | refGradeGuid: info.refGradeGuid, | ||
| 290 | guid: classGuid.value, | ||
| 291 | type: 'C' | ||
| 292 | } | ||
| 293 | const res: any = await updateClassifyGrad(params); | ||
| 294 | if (res.code == proxy.$passCode) { | ||
| 256 | getClassListData(); | 295 | getClassListData(); |
| 257 | //跳转到编辑页面 | 296 | proxy.$ElMessage({ |
| 258 | router.push({ | 297 | type: 'success', |
| 259 | name: 'classStandardEdit', | 298 | message: '修改分类成功' |
| 260 | query: { | 299 | }) |
| 261 | guid: '1', | 300 | newCreateClassStandardDialogInfo.value.visible = false; |
| 262 | classStandardName: '工业分类' | 301 | } else { |
| 302 | proxy.$ElMessage.error(res.msg); | ||
| 303 | } | ||
| 263 | } | 304 | } |
| 264 | }); | ||
| 265 | } | 305 | } |
| 266 | } | 306 | } |
| 267 | }) | 307 | }) |
| ... | @@ -389,6 +429,7 @@ const handleClassifyGradDataDel = async (item) => { | ... | @@ -389,6 +429,7 @@ const handleClassifyGradDataDel = async (item) => { |
| 389 | 429 | ||
| 390 | // 编辑分级 | 430 | // 编辑分级 |
| 391 | const handleClassifyGradDataEdit = (itemGradeName) => { | 431 | const handleClassifyGradDataEdit = (itemGradeName) => { |
| 432 | newCreateGradeStandardDialogInfo.value.submitBtnLoading = false; | ||
| 392 | classifyGradGuid.value = itemGradeName.guid; | 433 | classifyGradGuid.value = itemGradeName.guid; |
| 393 | newCreateGradeStandardDialogInfo.value.visible = true; | 434 | newCreateGradeStandardDialogInfo.value.visible = true; |
| 394 | newCreateGradeStandardDialogInfo.value.title = '编辑分级'; | 435 | newCreateGradeStandardDialogInfo.value.title = '编辑分级'; |
| ... | @@ -461,7 +502,6 @@ const getClassificationTemplateList = async () => { | ... | @@ -461,7 +502,6 @@ const getClassificationTemplateList = async () => { |
| 461 | } | 502 | } |
| 462 | 503 | ||
| 463 | onBeforeMount(() => { | 504 | onBeforeMount(() => { |
| 464 | getClassListData(); | ||
| 465 | getClassificationTemplateList(); | 505 | getClassificationTemplateList(); |
| 466 | }) | 506 | }) |
| 467 | 507 | ||
| ... | @@ -512,10 +552,10 @@ onBeforeMount(() => { | ... | @@ -512,10 +552,10 @@ onBeforeMount(() => { |
| 512 | <svg-icon name="folder" /> | 552 | <svg-icon name="folder" /> |
| 513 | </el-icon> | 553 | </el-icon> |
| 514 | <div class="title">{{ item.name }}</div> | 554 | <div class="title">{{ item.name }}</div> |
| 515 | <div class="desc-row"> | 555 | <!-- <div class="desc-row"> |
| 516 | <div class="desc">{{ '分级标准' }}</div> | 556 | <div class="desc">{{ '分级标准' }}</div> |
| 517 | <div class="desc">{{ item.updateTime }}</div> | 557 | <div class="desc">{{ item.updateTime }}</div> |
| 518 | </div> | 558 | </div> --> |
| 519 | </div> | 559 | </div> |
| 520 | <div v-if="!classListData.length" class="card-noData"> | 560 | <div v-if="!classListData.length" class="card-noData"> |
| 521 | <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" /> | 561 | <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" /> |
| ... | @@ -554,7 +594,7 @@ onBeforeMount(() => { | ... | @@ -554,7 +594,7 @@ onBeforeMount(() => { |
| 554 | <div class="desc">{{ item.updateTime }}</div> | 594 | <div class="desc">{{ item.updateTime }}</div> |
| 555 | </div> --> | 595 | </div> --> |
| 556 | </div> | 596 | </div> |
| 557 | <div v-if="!classListData.length" class="card-noData"> | 597 | <div v-if="!classifyGradListData.length" class="card-noData"> |
| 558 | <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" /> | 598 | <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" /> |
| 559 | <span>暂无分类标准</span> | 599 | <span>暂无分类标准</span> |
| 560 | </div> | 600 | </div> | ... | ... |
-
Please register or sign in to post a comment