From e0c9fa623af93aa248781489f657638c061586e4 Mon Sep 17 00:00:00 2001 From: leiqiaochu Date: Sat, 15 Jul 2023 16:18:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/device/Firmware/Task/index.vue | 12 +++++++----- src/views/link/AccessConfig/index.vue | 6 ++++++ src/views/link/Type/Detail/index.vue | 2 +- src/views/notice/Template/Detail/index.vue | 3 +++ .../system/DataSource/components/EditDialog.vue | 14 ++++++++++---- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/views/device/Firmware/Task/index.vue b/src/views/device/Firmware/Task/index.vue index fe517201..7322f405 100644 --- a/src/views/device/Firmware/Task/index.vue +++ b/src/views/device/Firmware/Task/index.vue @@ -8,7 +8,6 @@ :request="task" :defaultParams="{ sorts: [{ name: 'createTime', order: 'desc' }], - terms: defaultParams, }" :params="params" > @@ -125,7 +124,7 @@ const columns = [ }, ]; -const defaultParams = [ +const defaultParams = { terms: [ { @@ -133,8 +132,8 @@ const defaultParams = [ value: route.query.id, }, ], - }, -]; +} + const getActions = (data: Partial>): ActionsType[] => { if (!data) { @@ -233,7 +232,10 @@ const saveChange = (value: boolean) => { * @param params */ const handleSearch = (e: any) => { - params.value = e; + const query = {"terms":[ + e,defaultParams + ]} + params.value = query }; diff --git a/src/views/link/AccessConfig/index.vue b/src/views/link/AccessConfig/index.vue index 52fa9689..dc0b8db3 100644 --- a/src/views/link/AccessConfig/index.vue +++ b/src/views/link/AccessConfig/index.vue @@ -69,11 +69,17 @@ v-if="slotProps.channelInfo" class="card-item-content-text" > +
{{ slotProps.channelInfo.name }}
+
运行结果
+
正在运行......
@@ -127,6 +128,7 @@ type propertyType = { last?: string; }; const property = ref([]); +// virtualRule?.rule?.windowType === 'undefined' ? moment(item.time).format('HH:mm:ss') const columns = [ { diff --git a/src/views/Northbound/AliCloud/Detail/index.vue b/src/views/Northbound/AliCloud/Detail/index.vue index 01ea1b4c..4f2bddc0 100644 --- a/src/views/Northbound/AliCloud/Detail/index.vue +++ b/src/views/Northbound/AliCloud/Detail/index.vue @@ -613,6 +613,7 @@ const onPlatError = (val: any) => { _errorSet.value.add(val) } }; + const _validator = (_rule: any, value: string): Promise => new Promise((resolve, reject) => { const _item = productList.value.find((item) => item.id === value); @@ -657,7 +658,7 @@ watch( async (newId) => { if (newId) { queryRegionsList(); - getProduct(); + await getProduct(); if (newId === ':id' || !newId) return; const resp = await detail(newId as string); const _data: any = resp.result; diff --git a/src/views/Northbound/components/MSelect/index.vue b/src/views/Northbound/components/MSelect/index.vue index 8155a30d..ed0d37fc 100644 --- a/src/views/Northbound/components/MSelect/index.vue +++ b/src/views/Northbound/components/MSelect/index.vue @@ -17,60 +17,66 @@ \ No newline at end of file diff --git a/src/views/rule-engine/Scene/Save/action/Notify/NotifyTemplate.vue b/src/views/rule-engine/Scene/Save/action/Notify/NotifyTemplate.vue index 16c4ac1d..69b0162f 100644 --- a/src/views/rule-engine/Scene/Save/action/Notify/NotifyTemplate.vue +++ b/src/views/rule-engine/Scene/Save/action/Notify/NotifyTemplate.vue @@ -12,8 +12,9 @@ :request="(e) => handleData(e)" model="CARD" :bodyStyle="{ - padding: 0 + padding: 0, }" + ref="tableRef" :params="params" :gridColumn="2" :noPagination="true" @@ -83,6 +84,10 @@ const props = defineProps({ type: String, default: '', }, + notifyType: { + type: String, + default: '', + }, }); const emit = defineEmits(['update:value', 'change', 'update:detail']); @@ -97,6 +102,7 @@ const getMethodTxt = (type: string) => { const params = ref>({}); const _selectedRowKeys = ref([]); +const tableRef = ref(); const columns = [ { @@ -129,19 +135,70 @@ const handleSearch = (_params: any) => { params.value = _params; }; -const handleClick = (dt: any) => { +const typeObj = { + weixin: 'wechat', + dingTalk: 'dingtalk', +}; + +const queryUserList = async (id: string) => { + if (!(props.notifyType && props.notifierId)) return ''; + const resp = await TemplateApi.getUser( + typeObj[props.notifyType], + props.notifierId, + ); + if (resp.status === 200) { + return resp.result?.find((item: any) => item.id === id)?.name; + } else { + return ''; + } +}; + +const queryOrgList = async (id: string) => { + if (!(props.notifyType && props.notifierId)) return ''; + const resp = await TemplateApi.getDept( + typeObj[props.notifyType], + props.notifierId, + ); + if (resp.status === 200) { + return resp.result?.find((item: any) => item.id === id)?.name; + } else { + return ''; + } +}; + +const getOptions = async (dt: any) => { + const obj = {}; + // 钉钉,微信 + if (props.notifyType === 'weixin') { + if (dt?.template?.toParty) { + obj['orgName'] = await queryOrgList(dt?.template?.toParty); + } + if (dt?.template?.toUser) { + obj['sendTo'] = await queryUserList(dt?.template?.toUser); + } + } + if (props.notifyType === 'dingTalk') { + if (dt?.template?.departmentIdList) { + obj['orgName'] = await queryOrgList(dt?.template?.departmentIdList); + } + if (dt?.template?.userIdList) { + obj['sendTo'] = await queryUserList(dt?.template?.userIdList); + } + } + return obj; +}; + +const handleClick = async (dt: any) => { if (_selectedRowKeys.value.includes(dt.id)) { _selectedRowKeys.value = []; emit('update:value', undefined); - // emit('change', { templateName: undefined, orgName: undefined, sendTo: undefined }); - emit('change', { templateName: undefined }); + emit('change', { templateName: undefined, orgName: undefined, sendTo: undefined }); emit('update:detail', undefined); } else { - // console.log(dt) + const obj = await getOptions(dt) _selectedRowKeys.value = [dt.id]; + emit('change', { templateName: dt?.name, ...obj }); emit('update:value', dt.id); - // emit('change', { templateName: dt?.name, orgName: dt.template?.departmentIdList, sendTo: dt.template?.userIdList }); - emit('change', { templateName: dt?.name }); emit('update:detail', dt); } }; @@ -176,6 +233,7 @@ watch( (newValue) => { if (newValue) { _selectedRowKeys.value = [newValue]; + // (tableRef.value?._dataSource || []).find() } else { _selectedRowKeys.value = []; } diff --git a/src/views/rule-engine/Scene/Save/action/Notify/index.vue b/src/views/rule-engine/Scene/Save/action/Notify/index.vue index c6a09f3d..3b6259d8 100644 --- a/src/views/rule-engine/Scene/Save/action/Notify/index.vue +++ b/src/views/rule-engine/Scene/Save/action/Notify/index.vue @@ -48,6 +48,7 @@ diff --git a/src/views/system/User/components/EditUserDialog.vue b/src/views/system/User/components/EditUserDialog.vue index 6ae6eff5..bad17f77 100644 --- a/src/views/system/User/components/EditUserDialog.vue +++ b/src/views/system/User/components/EditUserDialog.vue @@ -104,7 +104,7 @@ mode="multiple" style="width: calc(100% - 40px)" placeholder="请选择角色" - :options="form.roleOptions" + :options="_roleOptions" :disabled="form.data.username === 'admin'" > @@ -123,7 +123,7 @@ show-search style="width: calc(100% - 40px)" placeholder="请选择组织" - :tree-data="form.departmentOptions" + :tree-data="_departmentOptions" :fieldNames="{ label: 'name', value: 'id' }" multiple :filterTreeNode=" @@ -205,6 +205,7 @@ import { DefaultOptionType } from 'ant-design-vue/es/vc-tree-select/TreeSelect'; import { AxiosResponse } from 'axios'; import { passwordRegEx } from '@/utils/validate'; import { filterSelectNode, onlyMessage } from '@/utils/comm'; +import { uniqBy } from 'lodash-es'; const deptPermission = 'system/Department'; const rolePermission = 'system/Role'; @@ -279,6 +280,9 @@ const form = reactive({ roleOptions: [] as optionType[], departmentOptions: [] as DefaultOptionType[], + _roleOptions: [] as optionType[], + _departmentOptions: [] as DefaultOptionType[], + init: () => { form.getDepartmentList(); form.getRoleList(); @@ -286,7 +290,6 @@ const form = reactive({ }, getUserInfo: () => { const id = props.data.id || ''; - console.log(111); if (props.type === 'add') form.data = {} as formType; else if (props.type === 'reset') form.data = { id } as formType; @@ -301,6 +304,10 @@ const form = reactive({ (item: dictType) => item.id, ), }; + form._roleOptions = resp.result?.roleList?.map((i: any) => { + return {label: i.name, value: i.id} + }); + form._departmentOptions = resp.result?.orgList nextTick(() => { formRef.value?.clearValidate(); }); @@ -358,6 +365,15 @@ const form = reactive({ }; }, }); + +const _roleOptions = computed(() => { + return uniqBy([...form.roleOptions, ...form._roleOptions], 'value') +}) + +const _departmentOptions = computed(() => { + return uniqBy([...form.departmentOptions, ...form._departmentOptions], 'id') +}) + form.init(); interface AxiosResponseRewrite extends AxiosResponse {