From a565fec416d7aaafd00ccb1817cc101a53f68bd9 Mon Sep 17 00:00:00 2001 From: zhujiyan <17812234322@163.com> Date: Thu, 20 Jun 2024 13:26:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=B7=E5=BC=8F=E5=8F=8A?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=B6=8B=E5=8A=BF=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terminal/planData/components/device.vue | 80 ++- .../terminal/planData/components/popup.vue | 116 ++-- src/views/govern/terminal/planData/index.vue | 574 ++++++++++-------- 3 files changed, 403 insertions(+), 367 deletions(-) diff --git a/src/views/govern/terminal/planData/components/device.vue b/src/views/govern/terminal/planData/components/device.vue index 0e86e7f..56c5944 100644 --- a/src/views/govern/terminal/planData/components/device.vue +++ b/src/views/govern/terminal/planData/components/device.vue @@ -2,15 +2,17 @@ 新增 -
+
-
-
+
+
@@ -127,6 +125,7 @@ const addFlag = ref(false) const selectId: any = ref('') //查绑定测试项列表 const getSelectedTable = (id: any) => { + //新增传0已绑定传1 getDeviceList({ id: id, isTrueFlag: 1, pageNum: 1, pageSize: 1000 }).then(res => { tableData.value = res.data.records }) @@ -134,10 +133,10 @@ const getSelectedTable = (id: any) => { //新增设备列表 const tableStore = new TableStore({ url: '/cs-device-boot/wlRecord/queryPage', - // publicHeight: 65, + publicHeight: 310, method: 'POST', column: [ - { width: '60', type: 'checkbox' }, + { width: '60', type: 'checkbox', fixed: 'left' }, { title: '序号', type: 'seq', width: 80 }, { field: 'devName', title: '设备名称', minWidth: 170 }, { field: 'devMac', title: '设备MAC', minWidth: 170 }, @@ -149,6 +148,7 @@ const tableStore = new TableStore({ beforeSearchFun: () => { tableStore.table.params.id = selectId.value + //新增传0已绑定传1 tableStore.table.params.isTrueFlag = 0 tableStore.table.params.treeIds = treeIds.value } @@ -168,31 +168,45 @@ const open = (id: any) => { //查新增列表 tableStore.index() } -const close = () => { - addFlag.value = false - dialogVisible.value = false -} const tableRef = ref() //添加设备 const submit = () => { //选择的数据 let deviceIds = [] //新增的时候执行的逻辑 - if (addFlag.value == true) { - tableStore.table.selection.map(item => { - deviceIds.push(item.id) - }) - const addForm = { - id: selectId.value, - list: deviceIds - } - addDevice(addForm).then(res => { - if (res.code == 'A0000') { - ElMessage.success('添加成功') - getSelectedTable(selectId.value) - addFlag.value = false + if (addFlag.value) { + if (tableStore.table.selection.length != 0) { + tableStore.table.selection.map(item => { + deviceIds.push(item.id) + }) + const addForm = { + id: selectId.value, + list: deviceIds } - }) + addDevice(addForm).then(res => { + if (res.code == 'A0000') { + ElMessage.success('添加成功') + getSelectedTable(selectId.value) + //清除树节点选择状态 + defaultCheckedKeys.value = [] + //刷新新增列表状态 + tableStore.index() + addFlag.value = false + } + }) + } else { + ElMessage.warning('请选择设备信息') + } + } +} + +const close = () => { + if (addFlag.value) { + addFlag.value = false + checkedList.value = [] + checkedTableRef.value.clearCheckboxRow() + } else { + dialogVisible.value = false } } //删除设备 diff --git a/src/views/govern/terminal/planData/components/popup.vue b/src/views/govern/terminal/planData/components/popup.vue index 37fb7b0..0f3a33d 100644 --- a/src/views/govern/terminal/planData/components/popup.vue +++ b/src/views/govern/terminal/planData/components/popup.vue @@ -171,7 +171,7 @@
- +