From 6750e7787253641f3e1b8e98e9b19a85279d1d26 Mon Sep 17 00:00:00 2001 From: 100011797 <2642441182@qq.com> Date: Thu, 1 Jun 2023 10:49:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9opc=5Fua=E5=86=99?= =?UTF-8?q?=E5=85=A5=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Point/components/WritePoint/index.vue | 6 ++--- .../components/EditPermissionDialog.vue | 5 +++- src/views/system/Department/device/index.vue | 25 ++++++++----------- src/views/system/Department/product/index.vue | 19 ++++---------- 4 files changed, 23 insertions(+), 32 deletions(-) diff --git a/src/views/DataCollect/Collector/Point/components/WritePoint/index.vue b/src/views/DataCollect/Collector/Point/components/WritePoint/index.vue index be170d52..e9ec5764 100644 --- a/src/views/DataCollect/Collector/Point/components/WritePoint/index.vue +++ b/src/views/DataCollect/Collector/Point/components/WritePoint/index.vue @@ -42,13 +42,13 @@ v-else-if="data.provider === 'OPC_UA'" > (); // 弹窗相关 const loading = ref(false); @@ -51,10 +52,12 @@ const confirm = () => { }) .finally(() => (loading.value = false)); }; + const form = reactive({ assetIdList: [...props.ids], - permission: [...props.permissionList], + permission: Array.isArray(props.defaultPermission) && props.defaultPermission?.length ? props.defaultPermission : ['read'], }); + const options = computed(() => { const result: optionsType = []; props.allPermission.forEach((item) => { diff --git a/src/views/system/Department/device/index.vue b/src/views/system/Department/device/index.vue index 84a0630d..cf245c32 100644 --- a/src/views/system/Department/device/index.vue +++ b/src/views/system/Department/device/index.vue @@ -208,6 +208,7 @@ :parent-id="props.parentId" :all-permission="table.permissionList.value" asset-type="device" + :defaultPermission="table.defaultPermission" @confirm="table.refresh" /> @@ -274,8 +275,11 @@ const columns = [ rename: 'productId$product-info', type: 'select', handleValue(value: string) { - // return `id in ${value.toString()}` - return value && value.length ? `id in ${value.toString()}` : undefined; + return value && value.length ? [{ + column: 'id', + termType: 'in', + value: `${value.toString()}` + }] : undefined; }, options: () => new Promise((resolve) => { @@ -344,6 +348,7 @@ const table = { _selectedRowKeys: ref([]), selectedRows: [] as any[], permissionList: ref([]), + defaultPermission: [] as string[], init: () => { table.getPermissionDict(); @@ -550,18 +555,10 @@ const table = { clickEdit: async (row?: any) => { const ids = row ? [row.id] : [...table._selectedRowKeys.value]; if (ids.length < 1) return message.warning('请勾选需要编辑的数据'); - // if (row || table.selectedRows.length === 1) { - // const permissionList = - // row?.permission || table.selectedRows[0].permission; - // dialogs.selectIds = ids; - // dialogs.permissList = permissionList; - // dialogs.editShow = true; - // return; - // } else if (table.selectedRows.length === 0) return; - // const permissionList = table.selectedRows.map( - // (item) => item.permission, - // ); - // const mixPermissionList = intersection(...permissionList) as string[]; + + table.defaultPermission = row ? row?.permission : intersection(...table.selectedRows.map( + (item) => item.permission, + )) as string[] const _result = await table.queryPermissionList(ids) dialogs.selectIds = ids; diff --git a/src/views/system/Department/product/index.vue b/src/views/system/Department/product/index.vue index 9d406eee..c6136df2 100644 --- a/src/views/system/Department/product/index.vue +++ b/src/views/system/Department/product/index.vue @@ -222,6 +222,7 @@ :parent-id="parentId" :all-permission="tableData.permissionList" asset-type="product" + :defaultPermission="tableData.defaultPermission" @confirm="table.refresh" /> { @@ -546,20 +548,9 @@ const table = { clickEdit: async (row?: any) => { const ids = row ? [row.id] : [...tableData._selectedRowKeys]; if (ids.length < 1) return message.warning('请勾选需要编辑的数据'); - - // if (row || tableData.selectedRows.length === 1) { - // const permissionList = - // row?.permission || tableData.selectedRows[0].permission; - // dialogs.selectIds = ids; - // dialogs.permissList = permissionList; - // dialogs.editShow = true; - // return; - // } else if (tableData.selectedRows.length === 0) return; - // const permissionList = tableData.selectedRows.map( - // (item) => item.permission, - // ); - // const mixPermissionList = intersection(...permissionList) as string[]; - + tableData.defaultPermission = row ? row?.permission : intersection(...tableData.selectedRows.map( + (item) => item.permission, + )) as string[] const _result = await table.queryPermissionList(ids) dialogs.selectIds = ids; dialogs.permissList = _result as string[];