From 4c73175e4ef244c74e360a5eeafbcc2f83284d7e Mon Sep 17 00:00:00 2001 From: yuwanchiren <863666755@qq.com> Date: Tue, 15 Oct 2024 10:11:07 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=8F=B0=E8=B4=A6?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipment/equipmentManagement/index.vue | 53 +++++++++++++++---- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue b/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue index a1d9a2ac..49cc5deb 100644 --- a/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue +++ b/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue @@ -132,10 +132,10 @@ - + + + + + + + + + + + @@ -277,10 +287,10 @@ - + + + + + + + + + + + @@ -416,7 +436,6 @@ const equipTypeList = () => { formQuery.pageNum = currentPage.value formQuery.objectType = res.data[0].equipmentTypeId equipQuery(formQuery).then((res) => { - deviceList.value = res.rows pageTotal.value = res.total }) @@ -424,7 +443,7 @@ const equipTypeList = () => { equipModeList({ objectType: res.data[0].equipmentTypeId, }) - queryParameter.value.equipmentTypeId = res.data[0].equipmentTypeId + queryParameter.value.equipmentTypeId = res.data[0].equipmentTypeId }) }) } @@ -451,9 +470,17 @@ const equipOrgList = () => { const belongingEquipment = ref() const equipOrgBelonging = () => { equipTree().then((res) => { - belongingEquipment.value = res.data + belongingEquipment.value = filterEquipments(res.data) }) } +const filterEquipments = (data: any) => { + return data + .filter((item: any) => item.objectType == 10001) + ?.map((item: any) => ({ + ...item, + equipChildren: filterEquipments(item.equipChildren), + })) +} const treeSelectLoad = (node: any, resolve: any) => { if (node.level === 0) { @@ -474,8 +501,7 @@ const treeSelectLoad = (node: any, resolve: any) => { } return resolve(res.data) }) - .catch((err) => { - }) + .catch((err) => {}) } } @@ -600,6 +626,8 @@ const addDeviceList = () => { editAddDeviceData.orgId = '' editAddDeviceData.parentEquipmentId = '' editAddDeviceData.iotModelId = '' + editAddDeviceData.belongingLine = '' + editAddDeviceData.isbenchMarkUnit = false } // 查看设备详情 @@ -620,6 +648,8 @@ const editDeviceData = reactive({ parentEquipmentId: '', iotModelId: '', id: '', + belongingLine: '', + isbenchMarkUnit: false, }) const size = ref<'default' | 'large' | 'small'>('default') @@ -647,6 +677,8 @@ const viewDeviceDetails = (data: any) => { editDeviceData.orgId = data.row.orgId editDeviceData.parentEquipmentId = data.row.parentEquipmentId editDeviceData.iotModelId = data.row.iotModelId + editDeviceData.belongingLine = data.row.belongingLine + editDeviceData.isbenchMarkUnit = data.row.isbenchMarkUnit } // 设备删除 @@ -766,6 +798,8 @@ const editAddDeviceData = reactive({ orgId: '', parentEquipmentId: '', iotModelId: '', + belongingLine: '', + isbenchMarkUnit: false, }) // 设备新增字段校验 @@ -798,6 +832,7 @@ const saveAddData = () => { editAddDeviceData.objectType = ele.equipmentTypeId } }) + equipAdd(editAddDeviceData).then((res) => { if (res.code == 200) { ElMessage({ From 2f23bad2377dea14b3abe4009b0bb5b940242754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=8E=89=E9=9C=9E?= Date: Tue, 15 Oct 2024 10:18:32 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix=EF=BC=9A=E7=89=88=E6=9C=AC=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/dasadmin/package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/dasadmin/package.json b/ui/dasadmin/package.json index 88722da6..21178c9d 100644 --- a/ui/dasadmin/package.json +++ b/ui/dasadmin/package.json @@ -40,15 +40,16 @@ "@types/node": "20.14.0", "@types/nprogress": "0.2.3", "@types/sortablejs": "1.15.8", - "@typescript-eslint/eslint-plugin": "^7.13.1", - "@typescript-eslint/parser": "^7.13.1", + "@typescript-eslint/eslint-plugin": "^8.9.0", + "@typescript-eslint/parser": "^8.9.0", "@vitejs/plugin-vue": "5.0.5", "async-validator": "4.2.5", "crypto-js": "^4.2.0", - "eslint": "^8.57.0", + "eslint": "^9.0.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-react": "^7.34.3", "eslint-plugin-vue": "9.26.0", + "glob": "^11.0.0", "globals": "^15.6.0", "prettier": "^3.3.2", "sass": "1.77.4", From 3728641a2947264d74c8a09ed6d49a420a850ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E4=BA=91=E9=B9=8F?= Date: Tue, 15 Oct 2024 12:49:39 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9C=BA=E6=9E=84=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=97=A0=E4=B8=8A=E7=BA=A7=E6=9C=BA=E6=9E=84=E6=97=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=90=8D=E7=A7=B0,=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91=20=E8=A7=92=E8=89=B2?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/backend/auth/org/index.vue | 24 ++++++++++++------- .../src/views/backend/auth/role/index.vue | 6 +++-- .../src/views/backend/auth/role/type.ts | 4 +++- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/ui/dasadmin/src/views/backend/auth/org/index.vue b/ui/dasadmin/src/views/backend/auth/org/index.vue index 9779b841..5d464af1 100644 --- a/ui/dasadmin/src/views/backend/auth/org/index.vue +++ b/ui/dasadmin/src/views/backend/auth/org/index.vue @@ -322,7 +322,7 @@ const addInstitutional = (rightClick = false) => { const submitAddForm = () => { console.log(formModel.value) if (!formRef.value) return - formRef.value.validate((valid:boolean) => { + formRef.value.validate((valid: boolean) => { if (valid) { if (dialogTitle.value === '新增机构') { formModel.value.parentOrgId = formModel.value.parentOrgId ?? '0' @@ -330,7 +330,7 @@ const submitAddForm = () => { .then((res) => { if (res.success) { ElMessage.success('新增成功') - getInstitutionList() + getInstitutionList({parentOrgId:rightClickMenuData.value?.parentOrgId}) dialogVible.value = false refreshTreeData(formModel.value.parentOrgId) } else { @@ -345,7 +345,7 @@ const submitAddForm = () => { .then((res) => { if (res.success) { ElMessage.success('编辑成功') - getInstitutionList() + getInstitutionList({parentOrgId:rightClickMenuData.value?.parentOrgId}) dialogVible.value = false refreshTreeData(rightClickMenuData.value!.parentOrgId).then(() => { refreshTreeData(formModel.value.parentOrgId) @@ -368,7 +368,14 @@ const closeAddForm = () => { const getInstitutionList = (data: getDataType = { name: null }) => { getInstitutionalListReq(data).then((res) => { pageTotal.value = res.total - originData.value = res.rows + console.log(res.rows); + + originData.value = res.rows.map(item=>{ + return { + ...item, + parentOrgName:item.parentOrgName ? item.parentOrgName : '无' + } + }) }) } @@ -450,7 +457,7 @@ const delForm = (column: getTreeDataReturnType) => { .then((res) => { if (res.success) { ElMessage.success('删除成功') - getInstitutionList() + getInstitutionList({parentOrgId:rightClickMenuData.value?.parentOrgId}) refreshTreeData(column.parentOrgId) } else { ElMessage.error(res?.msg ?? '删除失败') @@ -470,6 +477,7 @@ const treeReplaceProps = { const treeSelectReplaceProps = { label: 'name', children: 'children', + isLeaf: 'isLeaf', } const loadTreeData = (node: Node, resolve: any) => { if (node.level === 0) { @@ -489,7 +497,6 @@ const loadTreeData = (node: Node, resolve: any) => { }) } const loadSelectTreeData = (node: Node, resolve: any) => { - console.log(node) if (node.level === 0) { return getTreeData(null) @@ -497,7 +504,8 @@ const loadSelectTreeData = (node: Node, resolve: any) => { if (!res.length) { node.data.isLeaf = true } - resolve(res) + + resolve([{ id: '0', name: '无', isLeaf: true }, ...res]) }) .catch((err) => { console.log(err) @@ -552,8 +560,6 @@ const refreshTreeData = (parentOrgId: string | number | null) => { return new Promise((resolve) => { const data = parentOrgId === 0 || parentOrgId === '0' ? null : parentOrgId getTreeData(data).then((res) => { - console.log('res,', res) - console.log(data) if (data) { treeRef.value?.updateKeyChildren(parentOrgId!, res) } else { diff --git a/ui/dasadmin/src/views/backend/auth/role/index.vue b/ui/dasadmin/src/views/backend/auth/role/index.vue index 07d94f44..56697eca 100644 --- a/ui/dasadmin/src/views/backend/auth/role/index.vue +++ b/ui/dasadmin/src/views/backend/auth/role/index.vue @@ -5,7 +5,7 @@