From ef8dc58ac42e76c6c4efc04f0a187e3f9e0f675e Mon Sep 17 00:00:00 2001 From: 100011797 <2642441182@qq.com> Date: Tue, 30 May 2023 18:21:34 +0800 Subject: [PATCH 01/14] =?UTF-8?q?fix:=2014203=E3=80=8114491=E3=80=819658?= =?UTF-8?q?=E3=80=8113663=E3=80=8114207=E3=80=8114226=E3=80=8114493?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- .../Metadata/MetricsParam/index.vue | 4 +- .../components/EditDialog.vue | 6 +- .../Detail/Info/components/Tags/index.vue | 2 +- .../Metadata/Base/Edit/BaseForm.vue | 6 +- .../link/Type/Detail/LocalAddressSelect.vue | 73 +++++++++++ src/views/link/Type/Detail/index.vue | 120 ++++++++++++------ src/views/link/plugin/index.vue | 2 +- src/views/media/Device/Channel/Save.vue | 2 + src/views/notice/Template/Detail/index.vue | 1 + src/views/system/Department/device/index.vue | 44 ++++++- src/views/system/Department/product/index.vue | 49 ++++++- .../Role/Detail/components/PermissTree.vue | 1 + yarn.lock | 8 +- 14 files changed, 259 insertions(+), 61 deletions(-) create mode 100644 src/views/link/Type/Detail/LocalAddressSelect.vue diff --git a/package.json b/package.json index 581ec969..7670fcf5 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "event-source-polyfill": "^1.0.31", "global": "^4.4.0", "jetlinks-store": "^0.0.3", - "jetlinks-ui-components": "^1.0.18", + "jetlinks-ui-components": "^1.0.21", "js-cookie": "^3.0.1", "less": "^4.1.3", "less-loader": "^11.1.0", diff --git a/src/components/Metadata/MetricsParam/index.vue b/src/components/Metadata/MetricsParam/index.vue index a830add2..5391cd3f 100644 --- a/src/components/Metadata/MetricsParam/index.vue +++ b/src/components/Metadata/MetricsParam/index.vue @@ -114,11 +114,11 @@ const handleAdd = () => { const validateIndicator = (value: any) => { if (value?.range) { - if (!value?.value || !value?.value[0] || !value?.value[1]) { + if (!value?.value || (!value?.value[0] && value?.value[0] !== 0) || (!value?.value[1] && value?.value[1] !== 0)) { return Promise.reject(new Error('请输入指标值')); } } else { - if (!value?.value) { + if (!value?.value && value?.value !== 0) { return Promise.reject(new Error('请输入指标值')); } } diff --git a/src/views/account/NotificationSubscription/components/EditDialog.vue b/src/views/account/NotificationSubscription/components/EditDialog.vue index f164c35f..ae2b02dd 100644 --- a/src/views/account/NotificationSubscription/components/EditDialog.vue +++ b/src/views/account/NotificationSubscription/components/EditDialog.vue @@ -46,7 +46,7 @@ :rules="[{ required: true, message: '请选择告警规则' }]" > item.label).join(','), + alarmConfigId: keys.length ? keys.join(',') : undefined, + alarmConfigName: items.length ? items.map((item) => item.label).join(',') : undefined, }; } diff --git a/src/views/device/Instance/Detail/Info/components/Tags/index.vue b/src/views/device/Instance/Detail/Info/components/Tags/index.vue index 4316a707..8fc6b195 100644 --- a/src/views/device/Instance/Detail/Info/components/Tags/index.vue +++ b/src/views/device/Instance/Detail/Info/components/Tags/index.vue @@ -53,6 +53,6 @@ const findName = (item: any) => { const _element = item.dataType.elements?.find((a: any) => a.value === item.value) name = _element?.text } - return name + return name || item.value } diff --git a/src/views/device/components/Metadata/Base/Edit/BaseForm.vue b/src/views/device/components/Metadata/Base/Edit/BaseForm.vue index 7660b5b7..6b48e943 100644 --- a/src/views/device/components/Metadata/Base/Edit/BaseForm.vue +++ b/src/views/device/components/Metadata/Base/Edit/BaseForm.vue @@ -47,10 +47,10 @@ + + + + \ No newline at end of file diff --git a/src/views/link/Type/Detail/index.vue b/src/views/link/Type/Detail/index.vue index 155aff62..2081e4be 100644 --- a/src/views/link/Type/Detail/index.vue +++ b/src/views/link/Type/Detail/index.vue @@ -209,7 +209,7 @@ /> - - + --> + ([]); const dynamicValidateForm = reactive<{ cluster: FormData2Type[] }>({ cluster: [{ ...cloneDeep(FormStates2), id: '1' }], @@ -1178,7 +1189,7 @@ const filterPortOption = (input: string, option: any) => { return JSON.stringify(option.label).indexOf(input) >= 0; }; -const filterConfigByType = (data: any, type: string) => { +const filterConfigByType = (data: any[], type: string) => { let _temp = type; if (TCPList.includes(type)) { _temp = 'TCP'; @@ -1197,7 +1208,7 @@ const filterConfigByType = (data: any, type: string) => { }); }; -const getPortOptions = (portOptions: object, index = 0) => { +const getPortOptions = (portOptions: any, index = 0) => { if (!portOptions) return; const type = formData.value.type; const host = dynamicValidateForm.cluster[index].configuration.host; @@ -1227,40 +1238,57 @@ const changeType = (value: string) => { const updateClustersListIndex = () => { const { cluster } = dynamicValidateForm; const filters = cluster?.map((item) => item.serverId); - const newConfigRef = Store.get('configRef')?.filter( + const newConfigRef = shareCluster.value ? Store.get('configRef')?.filter( (item: any) => !filters.includes(item.clusterNodeId), - ); + ) : configClustersList.value?.filter( + (item: any) => !filters.includes(item.id), + ) cluster.forEach((item, index) => { - !item.serverId && - (clustersListIndex.value[index] = newConfigRef?.map((i: any) => ({ - value: i.clusterNodeId, - lable: i.clusterNodeId, - }))); + clustersListIndex.value[index] = newConfigRef?.map((i: any) => { + if(shareCluster.value){ + return { + value: i.clusterNodeId, + label: i.clusterNodeId, + } + } else { + return { + value: i.id, + label: i.name, + } + } + }) + if(item.serverId) { + clustersListIndex.value[index].push({ + value: item.serverId, + label: item.serverId + }) + } }); }; -const changeServerId = (value: string | undefined, index: number) => { +const changeServerId = async (value: string | undefined, index: number) => { const { configuration } = dynamicValidateForm.cluster[index]; configuration.host = undefined; configuration.port = undefined; - const checked = cloneDeep(portOptionsConst).find( - (i: any) => i.clusterNodeId === value, - ); - const checkedHost = [{ value: checked?.host, lable: checked?.host }]; - hostOptionsIndex.value[index] = checked ? checkedHost : []; - updateClustersListIndex(); + hostOptionsIndex.value[index] = []; + if(value){ + updateClustersListIndex(); + } }; const changeHost = ( serverId: string | undefined, value: string | undefined, index: number, + flag?: boolean ) => { const { configuration } = dynamicValidateForm.cluster[index]; - configuration.port = undefined; - const checked = cloneDeep(portOptionsConst).find( - (i: any) => i.clusterNodeId === serverId && i.host === value, - ); - checked && getPortOptions([checked], index); + if(!flag){ + configuration.port = undefined; + } + const checked = Store.get('resourcesClusters')?.[serverId || ''] + if(checked){ + getPortOptions(checked, index) + } }; const changeParserType = (value: string | undefined, index: number) => { @@ -1346,9 +1374,20 @@ const getCertificates = async () => { const getResourcesCurrent = () => { resourcesCurrent().then((resp) => { if (resp.status === 200) { - portOptionsConst = resp.result; + const clusterNodeId = resp.result?.[0]?.clusterNodeId + const resourcesClusters = Store.get('resourcesClusters') || {} + resourcesClusters[clusterNodeId] = resp.result + Store.set('resourcesClusters', resourcesClusters) Store.set('configRef', resp.result); - getPortOptions(portOptionsConst); + getPortOptions(Store.get('resourcesClusters')?.[clusterNodeId]); + } + }); +}; + +const getResourcesClusters = () => { + resourceClusters().then((resp) => { + if (resp.status === 200) { + configClustersList.value = resp.result as any[] } }); }; @@ -1369,22 +1408,24 @@ const getDetail = () => { ...configuration, }; - const configRef = Store.get('configRef').filter( - (item: any) => item.host === '0.0.0.0', - ); - getPortOptions(configRef); //更新端口 + // const configRef = Store.get('configRef').filter( + // (item: any) => item.host === '0.0.0.0', + // ); + // getPortOptions(configRef); //更新端口 } else { dynamicValidateForm.cluster = cluster; + // const arr = cluster.map((item: any) => item.configuration.serverId) //遍历数据更新对应的本地端口 - setTimeout(() => { - cluster.forEach((item: any, index: number) => { - const { host } = item.configuration; - let configRef = Store.get('configRef').filter( - (item: any) => item.host === host, - ); - getPortOptions(configRef, index); - }); - }, 0); + // setTimeout(() => { + // cluster.forEach((item: any, index: number) => { + // const { serverId } = item.configuration + // if(!resourcesClustersMap.get(serverId)){ + // // await getResourcesClustersById(serverId) + // } + // const checked = resourcesClustersMap.get(serverId) + // getPortOptions(checked, index); + // }); + // }, 0); } if (dynamicValidateForm.cluster.length === 1) { @@ -1400,6 +1441,7 @@ onMounted(() => { getSupports(); getCertificates(); getResourcesCurrent(); + getResourcesClusters(); getDetail(); }); diff --git a/src/views/link/plugin/index.vue b/src/views/link/plugin/index.vue index 15331fe8..8b8cf5b0 100644 --- a/src/views/link/plugin/index.vue +++ b/src/views/link/plugin/index.vue @@ -250,7 +250,7 @@ const getActions = (data: any) => { message.success('操作成功!'); instanceRef.value?.reload(); } else { - message.error('操作失败!'); + message.error(resp?.message || '操作失败!'); } }, }, diff --git a/src/views/media/Device/Channel/Save.vue b/src/views/media/Device/Channel/Save.vue index d50f1212..c697fedd 100644 --- a/src/views/media/Device/Channel/Save.vue +++ b/src/views/media/Device/Channel/Save.vue @@ -247,6 +247,8 @@ watch( const validateChannelId = async (_rule: Rule, value: string) => { // ID非必填, 没有输入ID时, 不校验ID是否存在 if (!value) return; + // 编辑时不校验唯一性 + if(!!formData.value?.id) return; const { result } = await ChannelApi.validateField({ deviceId: route.query.id, channelId: value, diff --git a/src/views/notice/Template/Detail/index.vue b/src/views/notice/Template/Detail/index.vue index da25114b..f6b6e70a 100644 --- a/src/views/notice/Template/Detail/index.vue +++ b/src/views/notice/Template/Detail/index.vue @@ -944,6 +944,7 @@ const formRules = { } ], calledShowNumbers: [ + { required: true, message: '请输入被叫显号' }, { max: 64, message: '最多可输入64个字符' }, { validator(_rule: Rule, value: string) { diff --git a/src/views/system/Department/device/index.vue b/src/views/system/Department/device/index.vue index 9503d64d..b83831b8 100644 --- a/src/views/system/Department/device/index.vue +++ b/src/views/system/Department/device/index.vue @@ -13,8 +13,12 @@ :gridColumn="2" :params="queryParams" :rowSelection="{ + // selectedRowKeys: table._selectedRowKeys.value, + // onChange:(keys:string[])=>table._selectedRowKeys.value = [...keys], + // onSelectNone: table.cancelSelect selectedRowKeys: table._selectedRowKeys.value, - onChange:(keys:string[])=>table._selectedRowKeys.value = [...keys], + onSelect: table.onSelect, + onSelectAll: table.onSelectAll, onSelectNone: table.cancelSelect }" :columns="columns" @@ -408,6 +412,43 @@ const table = { table._selectedRowKeys.value = []; table.selectedRows = []; }, + onSelect: (record: any, selected: boolean) => { + const arr = [...table._selectedRowKeys.value] + const _index = arr.findIndex(item => item === record?.id) + if (selected) { + if (!(_index > -1)) { + table._selectedRowKeys.value.push(record.id) + table.selectedRows.push(record) + } + } else { + if (_index > -1) { // 去掉数据 + table._selectedRowKeys.value.splice(_index, 1) + table.selectedRows.splice(_index, 1) + } + } + }, + onSelectAll: (selected: boolean, _: any[], changeRows: any) => { + if (selected) { + changeRows.map((i: any) => { + if (!table._selectedRowKeys.value.includes(i.id)) { + table._selectedRowKeys.value.push(i.id) + table.selectedRows.push(i) + } + }) + } else { + const arr = changeRows.map((item: any) => item.id) + const _arr: string[] = []; + const _ids: string[] = []; + [...table.selectedRows].map((i: any) => { + if (!arr.includes(i?.id)) { + _arr.push(i) + _ids.push(i.id) + } + }) + table._selectedRowKeys.value = _ids + table.selectedRows = _arr + } + }, // 获取并整理数据 getData: (params: object, parentId: string) => new Promise((resolve) => { @@ -496,6 +537,7 @@ const table = { }, clickEdit: (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; diff --git a/src/views/system/Department/product/index.vue b/src/views/system/Department/product/index.vue index c214af6c..ade1a372 100644 --- a/src/views/system/Department/product/index.vue +++ b/src/views/system/Department/product/index.vue @@ -14,7 +14,8 @@ :params="queryParams" :rowSelection="{ selectedRowKeys: tableData._selectedRowKeys, - onChange:(keys:string[])=>tableData._selectedRowKeys = [...keys], + onSelect: table.onSelect, + onSelectAll: table.onSelectAll, onSelectNone: table.cancelSelect }" :columns="columns" @@ -384,23 +385,59 @@ const table = { }, // 选中 onSelectChange: (row: any) => { - const selectedRowKeys = tableData._selectedRowKeys; - const index = selectedRowKeys.indexOf(row.id); + const index = tableData._selectedRowKeys.indexOf(row.id); if (index === -1) { - selectedRowKeys.push(row.id); + tableData._selectedRowKeys.push(row.id); tableData.selectedRows.push(row); } else { - selectedRowKeys.splice(index, 1); + tableData._selectedRowKeys.splice(index, 1); tableData.selectedRows.splice(index, 1); } }, // 取消全选 cancelSelect: () => { - console.log(1111); + // console.log(1111); tableData._selectedRowKeys = []; tableData.selectedRows = []; }, + onSelect: (record: any, selected: boolean) => { + const arr = [...tableData._selectedRowKeys] + const _index = arr.findIndex(item => item === record?.id) + if (selected) { + if (!(_index > -1)) { + tableData._selectedRowKeys.push(record.id) + tableData.selectedRows.push(record) + } + } else { + if (_index > -1) { // 去掉数据 + tableData._selectedRowKeys.splice(_index, 1) + tableData.selectedRows.splice(_index, 1) + } + } + }, + onSelectAll: (selected: boolean, _: any[], changeRows: any) => { + if (selected) { + changeRows.map((i: any) => { + if (!tableData._selectedRowKeys.includes(i.id)) { + tableData._selectedRowKeys.push(i.id) + tableData.selectedRows.push(i) + } + }) + } else { + const arr = changeRows.map((item: any) => item.id) + const _arr: string[] = []; + const _ids: string[] = []; + [...tableData.selectedRows].map((i: any) => { + if (!arr.includes(i?.id)) { + _arr.push(i) + _ids.push(i.id) + } + }) + tableData._selectedRowKeys = _ids + tableData.selectedRows = _arr + } + }, // 获取并整理数据 getData: (params: object, parentId: string) => new Promise((resolve) => { diff --git a/src/views/system/Role/Detail/components/PermissTree.vue b/src/views/system/Role/Detail/components/PermissTree.vue index cd89b113..d8846ded 100644 --- a/src/views/system/Role/Detail/components/PermissTree.vue +++ b/src/views/system/Role/Detail/components/PermissTree.vue @@ -150,6 +150,7 @@ const indeterminate = ref(false); const selectAllChange = () => { flatTableData.forEach((item) => { item.granted = selectedAll.value; + item.indeterminate = false; item.buttons?.forEach((button) => { button.granted = selectedAll.value; }); diff --git a/yarn.lock b/yarn.lock index dd3db463..0bba6010 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3823,10 +3823,10 @@ jetlinks-store@^0.0.3: resolved "https://registry.npmjs.org/jetlinks-store/-/jetlinks-store-0.0.3.tgz" integrity sha512-AZf/soh1hmmwjBZ00fr1emuMEydeReaI6IBTGByQYhTmK1Zd5pQAxC7WLek2snRAn/HHDgJfVz2hjditKThl6Q== -jetlinks-ui-components@^1.0.18: - version "1.0.20" - resolved "https://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.20.tgz#ca8df39e35e99cf0e124029609a8fc25f7f97b24" - integrity sha512-McGHwvkwEKrb1Bp9EZzpQN3YQe790fkO0Z03pGsil+bZrZ7xqiEywESZtW3MIIRWo/6u+zwNQr4L4/ohvXRCpA== +jetlinks-ui-components@^1.0.21: + version "1.0.21" + resolved "https://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.21.tgz#e2dc28682db91b4b05332fb8ec76faa2a2f4dcd2" + integrity sha512-nlVGo2ze6e4YFPOyqS1GVCpaH9P4VGPMGYJIucTEjjMb/QqPmkwS7HcwyDX3kvb6Acb+dG5oQZlscMHIGqv0YQ== dependencies: "@vueuse/core" "^9.12.0" "@vueuse/router" "^9.13.0" From e0ada7d6e02938b056e4c67b37c412eadcd00fb8 Mon Sep 17 00:00:00 2001 From: 100011797 <2642441182@qq.com> Date: Wed, 31 May 2023 14:06:50 +0800 Subject: [PATCH 02/14] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9bug(14733?= =?UTF-8?q?=E3=80=8114793=E3=80=8113672=E3=80=8111767)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/DataCollect/Channel/Save/index.vue | 6 +-- src/views/DataCollect/Channel/data.ts | 6 +-- src/views/DataCollect/Channel/type.d.ts | 2 +- .../DataCollect/Collector/Tree/index.vue | 30 +++++++++---- src/views/system/Department/device/index.vue | 43 ++++++++++++------- src/views/system/Department/product/index.vue | 42 +++++++++++------- src/views/system/Menu/Setting/index.vue | 3 +- src/views/system/Menu/Setting/utils.ts | 8 +++- 8 files changed, 91 insertions(+), 49 deletions(-) diff --git a/src/views/DataCollect/Channel/Save/index.vue b/src/views/DataCollect/Channel/Save/index.vue index b0bb22c2..136f6950 100644 --- a/src/views/DataCollect/Channel/Save/index.vue +++ b/src/views/DataCollect/Channel/Save/index.vue @@ -111,12 +111,12 @@ { } else if (!!searchValue.value) { clickSearch = true; params.value = { ..._.cloneDeep(defualtParams) }; - params.value.terms[1] = { - terms: [ - { - column: 'name', - value: `%${searchValue.value}%`, - termType: 'like', - }, - ], - }; + // params.value.terms[1] = { + // terms: [ + // { + // column: 'name', + // value: `%${searchValue.value}%`, + // termType: 'like', + // }, + // ], + // }; + params.value.terms = [ + ...(params.value?.terms || []), + { + terms: [ + { + column: 'name', + value: `%${searchValue.value}%`, + termType: 'like', + }, + ], + } + ]; } else { !!value && (params.value = value); } diff --git a/src/views/system/Department/device/index.vue b/src/views/system/Department/device/index.vue index b83831b8..84a0630d 100644 --- a/src/views/system/Department/device/index.vue +++ b/src/views/system/Department/device/index.vue @@ -226,6 +226,7 @@ import { getPermissionDict_api, unBindDeviceOrProduct_api, getDeviceProduct_api, + getBindingsPermission, } from '@/api/system/department'; import { intersection } from 'lodash-es'; @@ -273,7 +274,8 @@ const columns = [ rename: 'productId$product-info', type: 'select', handleValue(value: string) { - return `id in ${value.toString()}`; + // return `id in ${value.toString()}` + return value && value.length ? `id in ${value.toString()}` : undefined; }, options: () => new Promise((resolve) => { @@ -535,24 +537,35 @@ const table = { departmentStore.setType(type); dialogs.addShow = true; }, - clickEdit: (row?: any) => { + queryPermissionList: async (ids: string[]) => { + const resp: any = await getBindingsPermission('device', ids) + if(resp.status === 200){ + const arr = resp.result.map((item: any) => { + return item?.permissionInfoList?.map((i: any) => i?.id) + }) + return intersection(...arr) + } + return [] + }, + 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[]; + // 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[]; + const _result = await table.queryPermissionList(ids) dialogs.selectIds = ids; - dialogs.permissList = mixPermissionList; + dialogs.permissList = _result as string[]; dialogs.editShow = true; }, clickUnBind: (row?: any) => { diff --git a/src/views/system/Department/product/index.vue b/src/views/system/Department/product/index.vue index ade1a372..9d406eee 100644 --- a/src/views/system/Department/product/index.vue +++ b/src/views/system/Department/product/index.vue @@ -245,6 +245,7 @@ import { getPermission_api, getPermissionDict_api, unBindDeviceOrProduct_api, + getBindingsPermission, } from '@/api/system/department'; import { intersection } from 'lodash-es'; @@ -532,25 +533,36 @@ const table = { }; } }, - clickEdit: (row?: any) => { + queryPermissionList: async (ids: string[]) => { + const resp: any = await getBindingsPermission('product', ids) + if(resp.status === 200){ + const arr = resp.result.map((item: any) => { + return item?.permissionInfoList?.map((i: any) => i?.id) + }) + return intersection(...arr) + } + return [] + }, + 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[]; - + // 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[]; + + const _result = await table.queryPermissionList(ids) dialogs.selectIds = ids; - dialogs.permissList = mixPermissionList; + dialogs.permissList = _result as string[]; dialogs.editShow = true; }, clickUnBind: (row?: any) => { diff --git a/src/views/system/Menu/Setting/index.vue b/src/views/system/Menu/Setting/index.vue index a5f34973..06681a91 100644 --- a/src/views/system/Menu/Setting/index.vue +++ b/src/views/system/Menu/Setting/index.vue @@ -213,7 +213,8 @@ onMounted(() => { cloneDeep(systemMenu.value), ); - treeData.value = AllMenu; + // 处理排序 + treeData.value = handleSorts(AllMenu); } }); }); diff --git a/src/views/system/Menu/Setting/utils.ts b/src/views/system/Menu/Setting/utils.ts index c49f6661..73457baf 100644 --- a/src/views/system/Menu/Setting/utils.ts +++ b/src/views/system/Menu/Setting/utils.ts @@ -1,4 +1,4 @@ -import { cloneDeep } from 'lodash-es'; +import { cloneDeep, omit } from 'lodash-es'; import type { AntTreeNodeDropEvent, TreeProps, @@ -39,6 +39,10 @@ export const mergeArr = (oldData: Array, newData: Array) => { return newItem; } + if(oldItem && newItem){ + oldItem = { ...oldData,...omit(newItem, ['children'])} + } + if (!oldItem.children && newItem.children) { oldItem.children = newItem.children; return oldItem; @@ -312,7 +316,7 @@ export const handleSorts = (node: any[]) => { if (item.index !== index) { item.sortIndex = index if (item.children) { - item.children = handleSorts(item.children) + item.children = handleSorts(item.children).sort((a, b) => a.sortIndex - b.sortIndex) } } return item From 5e0ca4e2aa630840d5c77d415665ce3449f9f676 Mon Sep 17 00:00:00 2001 From: 100011797 <2642441182@qq.com> Date: Wed, 31 May 2023 14:50:02 +0800 Subject: [PATCH 03/14] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=89=A9?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E6=98=A0=E5=B0=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Layout/FullPage.vue | 11 +++++++++-- .../Product/Detail/MetadataMap/index.vue | 18 +++++++++++------- src/views/device/Product/Detail/index.vue | 4 ++-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/components/Layout/FullPage.vue b/src/components/Layout/FullPage.vue index d4f61d7c..39ab0c7a 100644 --- a/src/components/Layout/FullPage.vue +++ b/src/components/Layout/FullPage.vue @@ -1,6 +1,8 @@ @@ -12,8 +14,13 @@ const { y } = useElementBounding(fullPage) - \ No newline at end of file diff --git a/src/views/device/Product/Detail/MetadataMap/index.vue b/src/views/device/Product/Detail/MetadataMap/index.vue index e6d6bf4a..9b0eb9ee 100644 --- a/src/views/device/Product/Detail/MetadataMap/index.vue +++ b/src/views/device/Product/Detail/MetadataMap/index.vue @@ -198,20 +198,24 @@ getDefaultMetadata()