Commit 21d2c7f18804ce0bbd8123fc6c6544392aaada28
Merge branch 'ft-dev' into 'main'
feat:新增租户配置批量删除,新增角色管理批量删除,新增租户配置默认启用,新增场景联动根据设备获取属性列表 See merge request huang/yun-teng-iot-front!148
Showing
15 changed files
with
387 additions
and
210 deletions
| @@ -19,6 +19,7 @@ enum ScreenManagerApi { | @@ -19,6 +19,7 @@ enum ScreenManagerApi { | ||
| 19 | SCREEN_ORGANIZATION_URL = '/organization/me/list', | 19 | SCREEN_ORGANIZATION_URL = '/organization/me/list', |
| 20 | SCREEN_CHANGE_STATUS = '/convert/update/scene', | 20 | SCREEN_CHANGE_STATUS = '/convert/update/scene', |
| 21 | SCREEN_GET_BY_DEPTID = '/sceneLinkage/device/', | 21 | SCREEN_GET_BY_DEPTID = '/sceneLinkage/device/', |
| 22 | + SCREEN_BYDEVICEID_GET_ATTRBUTELIST = '/plugins/telemetry/', | ||
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | /** | 25 | /** |
| @@ -96,3 +97,25 @@ export const screenLinkPageByDeptIdGetDevice = (params: ScreenByDeptIdParams) => | @@ -96,3 +97,25 @@ export const screenLinkPageByDeptIdGetDevice = (params: ScreenByDeptIdParams) => | ||
| 96 | params, | 97 | params, |
| 97 | }); | 98 | }); |
| 98 | }; | 99 | }; |
| 100 | + | ||
| 101 | +/** | ||
| 102 | + * 根据设备id获取属性列表 | ||
| 103 | + */ | ||
| 104 | +export const screenLinkPageByDeviceIdGetAttribut = (entityType, entityId) => { | ||
| 105 | + return defHttp.get( | ||
| 106 | + { | ||
| 107 | + url: | ||
| 108 | + ScreenManagerApi.SCREEN_BYDEVICEID_GET_ATTRBUTELIST + | ||
| 109 | + `${entityType}` + | ||
| 110 | + '/' + | ||
| 111 | + `${entityId}` + | ||
| 112 | + '/' + | ||
| 113 | + 'keys' + | ||
| 114 | + '/' + | ||
| 115 | + 'timeseries', | ||
| 116 | + }, | ||
| 117 | + { | ||
| 118 | + joinPrefix: false, | ||
| 119 | + } | ||
| 120 | + ); | ||
| 121 | +}; |
| @@ -32,15 +32,13 @@ enum Api { | @@ -32,15 +32,13 @@ enum Api { | ||
| 32 | postAddTenantProfile = '/tenantProfile', | 32 | postAddTenantProfile = '/tenantProfile', |
| 33 | getTenantProfile = '/tenantProfiles', | 33 | getTenantProfile = '/tenantProfiles', |
| 34 | deleteTenantProfile = '/tenantProfile', | 34 | deleteTenantProfile = '/tenantProfile', |
| 35 | + setTenantProfile = '/tenantProfile', | ||
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | -export async function deleteTenantProfileApi(ids: string[]) { | 38 | +export async function deleteTenantProfileApi(ids: string) { |
| 38 | await defHttp.delete( | 39 | await defHttp.delete( |
| 39 | { | 40 | { |
| 40 | - url: Api.deleteTenantProfile, | ||
| 41 | - data: { | ||
| 42 | - ids: ids, | ||
| 43 | - }, | 41 | + url: Api.deleteTenantProfile + '/' + ids, |
| 44 | }, | 42 | }, |
| 45 | { | 43 | { |
| 46 | joinPrefix: false, | 44 | joinPrefix: false, |
| @@ -48,12 +46,40 @@ export async function deleteTenantProfileApi(ids: string[]) { | @@ -48,12 +46,40 @@ export async function deleteTenantProfileApi(ids: string[]) { | ||
| 48 | ); | 46 | ); |
| 49 | } | 47 | } |
| 50 | 48 | ||
| 49 | +// export async function deleteTenantProfileApi(ids: string[]) { | ||
| 50 | +// await defHttp.delete( | ||
| 51 | +// { | ||
| 52 | +// url: Api.deleteTenantProfile, | ||
| 53 | +// data: { | ||
| 54 | +// ids: ids, | ||
| 55 | +// }, | ||
| 56 | +// }, | ||
| 57 | +// { | ||
| 58 | +// joinPrefix: false, | ||
| 59 | +// } | ||
| 60 | +// ); | ||
| 61 | +// } | ||
| 62 | + | ||
| 51 | export const getTableTenantProfileApi = (params?: QueryTenantProfilesParam) => { | 63 | export const getTableTenantProfileApi = (params?: QueryTenantProfilesParam) => { |
| 52 | return defHttp.get({ | 64 | return defHttp.get({ |
| 53 | url: Api.getTenantProfile, | 65 | url: Api.getTenantProfile, |
| 54 | params, | 66 | params, |
| 55 | }); | 67 | }); |
| 56 | }; | 68 | }; |
| 69 | + | ||
| 70 | +//设置该租户为默认 | ||
| 71 | +export const setTenantProfileIsDefaultApi = (id: string, v, params?: {}) => { | ||
| 72 | + return defHttp.post( | ||
| 73 | + { | ||
| 74 | + url: Api.setTenantProfile + '/' + id + '/' + v, | ||
| 75 | + params, | ||
| 76 | + }, | ||
| 77 | + { | ||
| 78 | + joinPrefix: false, | ||
| 79 | + } | ||
| 80 | + ); | ||
| 81 | +}; | ||
| 82 | + | ||
| 57 | export const selectTenantProfileApi = async (params?: QueryTenantProfilesParam) => { | 83 | export const selectTenantProfileApi = async (params?: QueryTenantProfilesParam) => { |
| 58 | const { items } = await getTableTenantProfileApi(params); | 84 | const { items } = await getTableTenantProfileApi(params); |
| 59 | items.forEach((item) => { | 85 | items.forEach((item) => { |
| @@ -210,6 +210,7 @@ | @@ -210,6 +210,7 @@ | ||
| 210 | try { | 210 | try { |
| 211 | proxy.$refs.DeviceProfileStep3Ref.initAddAlarmRuleFunc(); | 211 | proxy.$refs.DeviceProfileStep3Ref.initAddAlarmRuleFunc(); |
| 212 | proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormCreateAlarmFunc(); | 212 | proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormCreateAlarmFunc(); |
| 213 | + proxy.$refs.DeviceProfileStep3Ref.resetAlarmSeverityRefFunc(); | ||
| 213 | } catch {} | 214 | } catch {} |
| 214 | } else if (isUpdate.value == 2) { | 215 | } else if (isUpdate.value == 2) { |
| 215 | try { | 216 | try { |
| @@ -339,6 +340,8 @@ | @@ -339,6 +340,8 @@ | ||
| 339 | proxy.$refs.DeviceProfileStep4Ref.clearAlaramContactAndNoticeMethodFunc(); | 340 | proxy.$refs.DeviceProfileStep4Ref.clearAlaramContactAndNoticeMethodFunc(); |
| 340 | proxy.$refs.DeviceProfileStep3Ref.clearDetailTemplateFunc(); | 341 | proxy.$refs.DeviceProfileStep3Ref.clearDetailTemplateFunc(); |
| 341 | proxy.$refs.DeviceProfileStep3Ref.clearEditAllRegisterFormFunc(); | 342 | proxy.$refs.DeviceProfileStep3Ref.clearEditAllRegisterFormFunc(); |
| 343 | + proxy.$refs.DeviceProfileStep3Ref.resetAlarmSeverityRefFunc(); | ||
| 344 | + emit('success'); | ||
| 342 | } catch (e) { | 345 | } catch (e) { |
| 343 | return e; | 346 | return e; |
| 344 | } | 347 | } |
| @@ -3,37 +3,40 @@ import { FormSchema } from '/@/components/Form'; | @@ -3,37 +3,40 @@ import { FormSchema } from '/@/components/Form'; | ||
| 3 | export const formSchema: FormSchema[] = [ | 3 | export const formSchema: FormSchema[] = [ |
| 4 | { | 4 | { |
| 5 | field: 'default', | 5 | field: 'default', |
| 6 | - component: 'Select', | ||
| 7 | label: '报警严重程度:', | 6 | label: '报警严重程度:', |
| 8 | colProps: { | 7 | colProps: { |
| 9 | span: 17, | 8 | span: 17, |
| 10 | }, | 9 | }, |
| 11 | - componentProps() { | ||
| 12 | - return { | ||
| 13 | - placeholder: '请选择报警严重程度', | ||
| 14 | - options: [ | ||
| 15 | - { | ||
| 16 | - value: 'CRITICAL', | ||
| 17 | - label: '危险', | ||
| 18 | - }, | ||
| 19 | - { | ||
| 20 | - value: 'MAJOR', | ||
| 21 | - label: '重要', | ||
| 22 | - }, | ||
| 23 | - { | ||
| 24 | - value: 'MINOR', | ||
| 25 | - label: '次要', | ||
| 26 | - }, | ||
| 27 | - { | ||
| 28 | - value: 'WARNING', | ||
| 29 | - label: '警告', | ||
| 30 | - }, | ||
| 31 | - { | ||
| 32 | - value: 'INDETERMINATE', | ||
| 33 | - label: '不确定', | ||
| 34 | - }, | ||
| 35 | - ], | ||
| 36 | - }; | 10 | + component: 'Select', |
| 11 | + componentProps: { | ||
| 12 | + placeholder: '请选择报警严重程度', | ||
| 13 | + options: [ | ||
| 14 | + { | ||
| 15 | + value: 'CRITICAL', | ||
| 16 | + label: '危险', | ||
| 17 | + disabled: false, | ||
| 18 | + }, | ||
| 19 | + { | ||
| 20 | + value: 'MAJOR', | ||
| 21 | + label: '重要', | ||
| 22 | + disabled: false, | ||
| 23 | + }, | ||
| 24 | + { | ||
| 25 | + value: 'MINOR', | ||
| 26 | + label: '次要', | ||
| 27 | + disabled: false, | ||
| 28 | + }, | ||
| 29 | + { | ||
| 30 | + value: 'WARNING', | ||
| 31 | + label: '警告', | ||
| 32 | + disabled: false, | ||
| 33 | + }, | ||
| 34 | + { | ||
| 35 | + value: 'INDETERMINATE', | ||
| 36 | + label: '不确定', | ||
| 37 | + disabled: false, | ||
| 38 | + }, | ||
| 39 | + ], | ||
| 37 | }, | 40 | }, |
| 38 | }, | 41 | }, |
| 39 | ]; | 42 | ]; |
| @@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
| 17 | import { BasicForm, useForm } from '/@/components/Form/index'; | 17 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 18 | import { Input } from 'ant-design-vue'; | 18 | import { Input } from 'ant-design-vue'; |
| 19 | import { useConditionDrawerSchema } from '../config'; | 19 | import { useConditionDrawerSchema } from '../config'; |
| 20 | + import { screenLinkPageByDeviceIdGetAttribut } from '/@/api/ruleengine/ruleengineApi'; | ||
| 20 | 21 | ||
| 21 | export default defineComponent({ | 22 | export default defineComponent({ |
| 22 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, | 23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
| @@ -38,11 +39,60 @@ | @@ -38,11 +39,60 @@ | ||
| 38 | resetFields(); | 39 | resetFields(); |
| 39 | }; | 40 | }; |
| 40 | const updateFieldDeviceId = (v) => { | 41 | const updateFieldDeviceId = (v) => { |
| 42 | + const option = v; | ||
| 41 | setTimeout(() => { | 43 | setTimeout(() => { |
| 42 | updateSchema({ | 44 | updateSchema({ |
| 43 | field: 'entityId', | 45 | field: 'entityId', |
| 44 | componentProps: { | 46 | componentProps: { |
| 45 | - options: v, | 47 | + options: option, |
| 48 | + onChange(e) { | ||
| 49 | + updateFieldType2Func(e); | ||
| 50 | + }, | ||
| 51 | + }, | ||
| 52 | + }); | ||
| 53 | + }, 10); | ||
| 54 | + }; | ||
| 55 | + const updateFieldType2Func = async (e) => { | ||
| 56 | + const data1 = await screenLinkPageByDeviceIdGetAttribut('DEVICE', e); | ||
| 57 | + const data = data1.map((m) => { | ||
| 58 | + return { | ||
| 59 | + label: m, | ||
| 60 | + value: m, | ||
| 61 | + }; | ||
| 62 | + }); | ||
| 63 | + setTimeout(() => { | ||
| 64 | + updateSchema({ | ||
| 65 | + field: 'type', | ||
| 66 | + componentProps() { | ||
| 67 | + return { | ||
| 68 | + placeholder: '请选择属性', | ||
| 69 | + options: data, | ||
| 70 | + onChange(e) { | ||
| 71 | + if (e) { | ||
| 72 | + updateSchema([ | ||
| 73 | + { | ||
| 74 | + field: 'operation', | ||
| 75 | + ifShow: true, | ||
| 76 | + }, | ||
| 77 | + { | ||
| 78 | + field: 'value', | ||
| 79 | + ifShow: true, | ||
| 80 | + }, | ||
| 81 | + ]); | ||
| 82 | + } else { | ||
| 83 | + updateSchema([ | ||
| 84 | + { | ||
| 85 | + field: 'operation', | ||
| 86 | + ifShow: false, | ||
| 87 | + }, | ||
| 88 | + { | ||
| 89 | + field: 'value', | ||
| 90 | + ifShow: false, | ||
| 91 | + }, | ||
| 92 | + ]); | ||
| 93 | + } | ||
| 94 | + }, | ||
| 95 | + }; | ||
| 46 | }, | 96 | }, |
| 47 | }); | 97 | }); |
| 48 | }, 10); | 98 | }, 10); |
| @@ -19,6 +19,7 @@ | @@ -19,6 +19,7 @@ | ||
| 19 | import { BasicForm, useForm } from '/@/components/Form/index'; | 19 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 20 | import { Input } from 'ant-design-vue'; | 20 | import { Input } from 'ant-design-vue'; |
| 21 | import { useTriggerDrawerSchema } from '../config'; | 21 | import { useTriggerDrawerSchema } from '../config'; |
| 22 | + import { screenLinkPageByDeviceIdGetAttribut } from '/@/api/ruleengine/ruleengineApi'; | ||
| 22 | 23 | ||
| 23 | export default defineComponent({ | 24 | export default defineComponent({ |
| 24 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, | 25 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
| @@ -36,11 +37,63 @@ | @@ -36,11 +37,63 @@ | ||
| 36 | return fieldValue.value; | 37 | return fieldValue.value; |
| 37 | }; | 38 | }; |
| 38 | const updateFieldDeviceId = (v) => { | 39 | const updateFieldDeviceId = (v) => { |
| 40 | + const option = v; | ||
| 39 | setTimeout(() => { | 41 | setTimeout(() => { |
| 40 | updateSchema({ | 42 | updateSchema({ |
| 41 | field: 'entityId', | 43 | field: 'entityId', |
| 42 | - componentProps: { | ||
| 43 | - options: v, | 44 | + componentProps() { |
| 45 | + return { | ||
| 46 | + options: option, | ||
| 47 | + onChange(e) { | ||
| 48 | + updateFieldType2Func(e); | ||
| 49 | + }, | ||
| 50 | + }; | ||
| 51 | + }, | ||
| 52 | + }); | ||
| 53 | + }, 10); | ||
| 54 | + }; | ||
| 55 | + | ||
| 56 | + const updateFieldType2Func = async (e) => { | ||
| 57 | + const data1 = await screenLinkPageByDeviceIdGetAttribut('DEVICE', e); | ||
| 58 | + const data = data1.map((m) => { | ||
| 59 | + return { | ||
| 60 | + label: m, | ||
| 61 | + value: m, | ||
| 62 | + }; | ||
| 63 | + }); | ||
| 64 | + setTimeout(() => { | ||
| 65 | + updateSchema({ | ||
| 66 | + field: 'type2', | ||
| 67 | + componentProps() { | ||
| 68 | + return { | ||
| 69 | + placeholder: '请选择属性', | ||
| 70 | + options: data, | ||
| 71 | + onChange(e) { | ||
| 72 | + if (e) { | ||
| 73 | + updateSchema([ | ||
| 74 | + { | ||
| 75 | + field: 'operation', | ||
| 76 | + ifShow: true, | ||
| 77 | + }, | ||
| 78 | + { | ||
| 79 | + field: 'value', | ||
| 80 | + ifShow: true, | ||
| 81 | + }, | ||
| 82 | + ]); | ||
| 83 | + } else { | ||
| 84 | + updateSchema([ | ||
| 85 | + { | ||
| 86 | + field: 'operation', | ||
| 87 | + ifShow: false, | ||
| 88 | + }, | ||
| 89 | + { | ||
| 90 | + field: 'value', | ||
| 91 | + ifShow: false, | ||
| 92 | + }, | ||
| 93 | + ]); | ||
| 94 | + } | ||
| 95 | + }, | ||
| 96 | + }; | ||
| 44 | }, | 97 | }, |
| 45 | }); | 98 | }); |
| 46 | }, 10); | 99 | }, 10); |
| @@ -58,13 +111,25 @@ | @@ -58,13 +111,25 @@ | ||
| 58 | entityId1: props.editTriggerFather.entityId, | 111 | entityId1: props.editTriggerFather.entityId, |
| 59 | entityId2: props.editTriggerFather.entityId, | 112 | entityId2: props.editTriggerFather.entityId, |
| 60 | type1: props.editTriggerFather?.triggerCondition?.condition[0]?.key?.type, | 113 | type1: props.editTriggerFather?.triggerCondition?.condition[0]?.key?.type, |
| 61 | - type2: props.editTriggerFather?.triggerCondition?.condition[0]?.predicate?.type, | 114 | + type2: props.editTriggerFather?.triggerCondition?.condition[0]?.key?.key, |
| 62 | operation: | 115 | operation: |
| 63 | props.editTriggerFather?.triggerCondition?.condition[0]?.predicate?.operation, | 116 | props.editTriggerFather?.triggerCondition?.condition[0]?.predicate?.operation, |
| 64 | value: | 117 | value: |
| 65 | props.editTriggerFather?.triggerCondition?.condition[0]?.predicate?.value | 118 | props.editTriggerFather?.triggerCondition?.condition[0]?.predicate?.value |
| 66 | ?.defaultValue, | 119 | ?.defaultValue, |
| 67 | }); | 120 | }); |
| 121 | + if (props.editTriggerFather?.triggerCondition?.condition[0]?.key?.key) { | ||
| 122 | + updateSchema([ | ||
| 123 | + { | ||
| 124 | + field: 'operation', | ||
| 125 | + ifShow: true, | ||
| 126 | + }, | ||
| 127 | + { | ||
| 128 | + field: 'value', | ||
| 129 | + ifShow: true, | ||
| 130 | + }, | ||
| 131 | + ]); | ||
| 132 | + } | ||
| 68 | }, 10); | 133 | }, 10); |
| 69 | } | 134 | } |
| 70 | }; | 135 | }; |
| @@ -79,6 +144,14 @@ | @@ -79,6 +144,14 @@ | ||
| 79 | }, | 144 | }, |
| 80 | }); | 145 | }); |
| 81 | }; | 146 | }; |
| 147 | + const clearSelectAttribute = () => { | ||
| 148 | + updateSchema({ | ||
| 149 | + field: 'type2', | ||
| 150 | + componentProps: { | ||
| 151 | + options: [], | ||
| 152 | + }, | ||
| 153 | + }); | ||
| 154 | + }; | ||
| 82 | const editSelectDevice = () => { | 155 | const editSelectDevice = () => { |
| 83 | if (props.newFilterMapFather != 1) { | 156 | if (props.newFilterMapFather != 1) { |
| 84 | setTimeout(() => { | 157 | setTimeout(() => { |
| @@ -110,6 +183,8 @@ | @@ -110,6 +183,8 @@ | ||
| 110 | }); | 183 | }); |
| 111 | }; | 184 | }; |
| 112 | return { | 185 | return { |
| 186 | + clearSelectAttribute, | ||
| 187 | + updateFieldType2Func, | ||
| 113 | updateFieldDeviceId, | 188 | updateFieldDeviceId, |
| 114 | resetFieldsValueFunc, | 189 | resetFieldsValueFunc, |
| 115 | clearSelectScene, | 190 | clearSelectScene, |
| @@ -209,6 +209,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -209,6 +209,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 209 | colProps: { span: 6 }, | 209 | colProps: { span: 6 }, |
| 210 | component: 'ApiTreeSelect', | 210 | component: 'ApiTreeSelect', |
| 211 | componentProps: { | 211 | componentProps: { |
| 212 | + placeholder: '请选择组织', | ||
| 212 | api: async () => { | 213 | api: async () => { |
| 213 | const data = await screenLinkOrganizationGetApi(); | 214 | const data = await screenLinkOrganizationGetApi(); |
| 214 | copyTransFun(data as any as any[]); | 215 | copyTransFun(data as any as any[]); |
| @@ -223,15 +224,15 @@ export const searchFormSchema: FormSchema[] = [ | @@ -223,15 +224,15 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 223 | colProps: { span: 6 }, | 224 | colProps: { span: 6 }, |
| 224 | componentProps: { | 225 | componentProps: { |
| 225 | maxLength: 36, | 226 | maxLength: 36, |
| 226 | - placeholder: '请输入名称', | 227 | + placeholder: '请输入场景联动名称', |
| 227 | }, | 228 | }, |
| 228 | }, | 229 | }, |
| 229 | { | 230 | { |
| 230 | field: 'status', | 231 | field: 'status', |
| 231 | - label: '设备状态', | 232 | + label: '状态', |
| 232 | component: 'Select', | 233 | component: 'Select', |
| 233 | componentProps: { | 234 | componentProps: { |
| 234 | - placeholder: '请选择状态', | 235 | + placeholder: '请选择', |
| 235 | options: [ | 236 | options: [ |
| 236 | { label: '已启用', value: '1' }, | 237 | { label: '已启用', value: '1' }, |
| 237 | { label: '未启用', value: '0' }, | 238 | { label: '未启用', value: '0' }, |
| @@ -261,8 +262,10 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -261,8 +262,10 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
| 261 | field: 'entityId', | 262 | field: 'entityId', |
| 262 | label: '', | 263 | label: '', |
| 263 | component: 'Select', | 264 | component: 'Select', |
| 264 | - componentProps: { | ||
| 265 | - placeholder: '请选择设备', | 265 | + componentProps() { |
| 266 | + return { | ||
| 267 | + placeholder: '请选择设备', | ||
| 268 | + }; | ||
| 266 | }, | 269 | }, |
| 267 | ifShow: ({ values }) => | 270 | ifShow: ({ values }) => |
| 268 | !isTime(Reflect.get(values, 'triggerType')) && | 271 | !isTime(Reflect.get(values, 'triggerType')) && |
| @@ -292,7 +295,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -292,7 +295,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
| 292 | componentProps: { | 295 | componentProps: { |
| 293 | placeholder: '属性触发', | 296 | placeholder: '属性触发', |
| 294 | options: [ | 297 | options: [ |
| 295 | - { label: '属性触发', value: 'ATTRIBUTE' }, | 298 | + { label: '属性触发', value: 'TIME_SERIES' }, |
| 296 | // { label: '上下线触发', value: 'ATTRIBUTE' }, | 299 | // { label: '上下线触发', value: 'ATTRIBUTE' }, |
| 297 | ], | 300 | ], |
| 298 | }, | 301 | }, |
| @@ -325,12 +328,13 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -325,12 +328,13 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
| 325 | field: 'type2', | 328 | field: 'type2', |
| 326 | label: '', | 329 | label: '', |
| 327 | component: 'Select', | 330 | component: 'Select', |
| 328 | - componentProps: { | ||
| 329 | - placeholder: '全部属性', | ||
| 330 | - options: [ | ||
| 331 | - { label: '全部属性', value: 'STRING' }, | ||
| 332 | - { label: 'wendu', value: 'NUMERIC' }, | ||
| 333 | - ], | 331 | + componentProps() { |
| 332 | + return { | ||
| 333 | + placeholder: '请选择属性', | ||
| 334 | + onChange(v) { | ||
| 335 | + console.log(v); | ||
| 336 | + }, | ||
| 337 | + }; | ||
| 334 | }, | 338 | }, |
| 335 | ifShow: ({ values }) => | 339 | ifShow: ({ values }) => |
| 336 | !isTime(Reflect.get(values, 'triggerType')) && | 340 | !isTime(Reflect.get(values, 'triggerType')) && |
| @@ -353,12 +357,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -353,12 +357,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
| 353 | { label: '>=', value: 'GREATER_OR_EQUAL' }, | 357 | { label: '>=', value: 'GREATER_OR_EQUAL' }, |
| 354 | ], | 358 | ], |
| 355 | }, | 359 | }, |
| 356 | - ifShow: ({ values }) => | ||
| 357 | - isWenDu(Reflect.get(values, 'type2')) && | ||
| 358 | - !isUpAndDown(Reflect.get(values, 'type1')) && | ||
| 359 | - !isTime(Reflect.get(values, 'triggerType')) && | ||
| 360 | - !isScene(Reflect.get(values, 'triggerType')) && | ||
| 361 | - !isHand(Reflect.get(values, 'triggerType')), | 360 | + ifShow: false, |
| 362 | colProps: { span: 12 }, | 361 | colProps: { span: 12 }, |
| 363 | }, | 362 | }, |
| 364 | { | 363 | { |
| @@ -369,47 +368,41 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -369,47 +368,41 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
| 369 | maxLength: 16, | 368 | maxLength: 16, |
| 370 | placeholder: '请输入比较值', | 369 | placeholder: '请输入比较值', |
| 371 | }, | 370 | }, |
| 372 | - ifShow: ({ values }) => | ||
| 373 | - isWenDu(Reflect.get(values, 'type2')) && | ||
| 374 | - !isUpAndDown(Reflect.get(values, 'type1')) && | ||
| 375 | - !isTime(Reflect.get(values, 'triggerType')) && | ||
| 376 | - !isScene(Reflect.get(values, 'triggerType')) && | ||
| 377 | - !isHand(Reflect.get(values, 'triggerType')), | 371 | + ifShow: false, |
| 378 | colProps: { | 372 | colProps: { |
| 379 | span: 12, | 373 | span: 12, |
| 380 | }, | 374 | }, |
| 381 | }, | 375 | }, |
| 382 | 376 | ||
| 383 | { | 377 | { |
| 384 | - field: 'entityId2', | 378 | + field: 'sceneLinkageId', |
| 385 | label: '', | 379 | label: '', |
| 386 | component: 'Select', | 380 | component: 'Select', |
| 387 | colProps: { | 381 | colProps: { |
| 388 | span: 12, | 382 | span: 12, |
| 389 | }, | 383 | }, |
| 390 | componentProps: { | 384 | componentProps: { |
| 391 | - placeholder: '请输入场景触发器', | 385 | + placeholder: '请选择场景', |
| 392 | options: [ | 386 | options: [ |
| 393 | - { label: '场景触发器1', value: '1' }, | ||
| 394 | - { label: '场景触发器2', value: '2' }, | ||
| 395 | - { label: '场景触发器3', value: '3' }, | 387 | + { label: '场景触发器1', value: '' }, |
| 388 | + { label: '场景触发器2', value: '' }, | ||
| 396 | ], | 389 | ], |
| 397 | }, | 390 | }, |
| 398 | ifShow: ({ values }) => isScene(Reflect.get(values, 'triggerType')), | 391 | ifShow: ({ values }) => isScene(Reflect.get(values, 'triggerType')), |
| 399 | }, | 392 | }, |
| 400 | 393 | ||
| 401 | - { | ||
| 402 | - field: 'no3', | ||
| 403 | - label: '', | ||
| 404 | - component: 'ApiSelect', | ||
| 405 | - colProps: { | ||
| 406 | - span: 12, | ||
| 407 | - }, | ||
| 408 | - componentProps: { | ||
| 409 | - placeholder: '暂不实现', | ||
| 410 | - }, | ||
| 411 | - ifShow: ({ values }) => isHand(Reflect.get(values, 'triggerType')), | ||
| 412 | - }, | 394 | + // { |
| 395 | + // field: 'no3', | ||
| 396 | + // label: '', | ||
| 397 | + // component: 'ApiSelect', | ||
| 398 | + // colProps: { | ||
| 399 | + // span: 12, | ||
| 400 | + // }, | ||
| 401 | + // componentProps: { | ||
| 402 | + // placeholder: '暂不实现', | ||
| 403 | + // }, | ||
| 404 | + // ifShow: ({ values }) => isHand(Reflect.get(values, 'triggerType')), | ||
| 405 | + // }, | ||
| 413 | ]; | 406 | ]; |
| 414 | 407 | ||
| 415 | export const useConditionDrawerSchema: FormSchema[] = [ | 408 | export const useConditionDrawerSchema: FormSchema[] = [ |
| @@ -430,8 +423,10 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -430,8 +423,10 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
| 430 | field: 'entityId', | 423 | field: 'entityId', |
| 431 | label: '', | 424 | label: '', |
| 432 | component: 'Select', | 425 | component: 'Select', |
| 433 | - componentProps: { | ||
| 434 | - placeholder: '请选择设备', | 426 | + componentProps() { |
| 427 | + return { | ||
| 428 | + placeholder: '请选择设备', | ||
| 429 | + }; | ||
| 435 | }, | 430 | }, |
| 436 | ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'triggerType')), | 431 | ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'triggerType')), |
| 437 | colProps: { | 432 | colProps: { |
| @@ -466,54 +461,19 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -466,54 +461,19 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
| 466 | field: 'type', | 461 | field: 'type', |
| 467 | label: '', | 462 | label: '', |
| 468 | component: 'Select', | 463 | component: 'Select', |
| 469 | - componentProps: { | ||
| 470 | - placeholder: '请选择或者输入属性', | ||
| 471 | - options: [ | ||
| 472 | - { label: 'shidu', value: 'NUMERIC1' }, | ||
| 473 | - { label: 'wendu', value: 'NUMERIC2' }, | ||
| 474 | - ], | 464 | + componentProps() { |
| 465 | + return { | ||
| 466 | + placeholder: '请选择属性', | ||
| 467 | + onChange(v) { | ||
| 468 | + console.log(v); | ||
| 469 | + }, | ||
| 470 | + }; | ||
| 475 | }, | 471 | }, |
| 476 | ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'triggerType')), | 472 | ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'triggerType')), |
| 477 | colProps: { span: 12 }, | 473 | colProps: { span: 12 }, |
| 478 | }, | 474 | }, |
| 479 | { | 475 | { |
| 480 | - field: 'operation1', | ||
| 481 | - label: '', | ||
| 482 | - component: 'Select', | ||
| 483 | - componentProps: { | ||
| 484 | - placeholder: '', | ||
| 485 | - options: [ | ||
| 486 | - { label: '=', value: 'EQUAL' }, | ||
| 487 | - { label: '<', value: 'LESS' }, | ||
| 488 | - { label: '>', value: 'GREATER' }, | ||
| 489 | - { label: '<=', value: 'LESS_OR_EQUAL' }, | ||
| 490 | - { label: '>=', value: 'GREATER_OR_EQUAL' }, | ||
| 491 | - ], | ||
| 492 | - }, | ||
| 493 | - ifShow: ({ values }) => | ||
| 494 | - isConditionShiDu(Reflect.get(values, 'type')) && | ||
| 495 | - !isTimeAll(Reflect.get(values, 'triggerType')), | ||
| 496 | - colProps: { span: 12 }, | ||
| 497 | - }, | ||
| 498 | - { | ||
| 499 | - field: 'value1', | ||
| 500 | - component: 'Input', | ||
| 501 | - label: '', | ||
| 502 | - componentProps: { | ||
| 503 | - maxLength: 16, | ||
| 504 | - placeholder: '请输入比较值', | ||
| 505 | - }, | ||
| 506 | - | ||
| 507 | - ifShow: ({ values }) => | ||
| 508 | - isConditionShiDu(Reflect.get(values, 'type')) && | ||
| 509 | - !isTimeAll(Reflect.get(values, 'triggerType')), | ||
| 510 | - colProps: { | ||
| 511 | - span: 12, | ||
| 512 | - }, | ||
| 513 | - }, | ||
| 514 | - | ||
| 515 | - { | ||
| 516 | - field: 'operation2', | 476 | + field: 'operation', |
| 517 | label: '', | 477 | label: '', |
| 518 | component: 'Select', | 478 | component: 'Select', |
| 519 | componentProps: { | 479 | componentProps: { |
| @@ -526,22 +486,18 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -526,22 +486,18 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
| 526 | { label: '>=', value: 'GREATER_OR_EQUAL' }, | 486 | { label: '>=', value: 'GREATER_OR_EQUAL' }, |
| 527 | ], | 487 | ], |
| 528 | }, | 488 | }, |
| 529 | - ifShow: ({ values }) => | ||
| 530 | - isConditionWenDu(Reflect.get(values, 'type')) && | ||
| 531 | - !isTimeAll(Reflect.get(values, 'triggerType')), | 489 | + ifShow: false, |
| 532 | colProps: { span: 12 }, | 490 | colProps: { span: 12 }, |
| 533 | }, | 491 | }, |
| 534 | { | 492 | { |
| 535 | - field: 'value2', | 493 | + field: 'value', |
| 536 | component: 'Input', | 494 | component: 'Input', |
| 537 | label: '', | 495 | label: '', |
| 538 | componentProps: { | 496 | componentProps: { |
| 539 | maxLength: 16, | 497 | maxLength: 16, |
| 540 | placeholder: '请输入比较值', | 498 | placeholder: '请输入比较值', |
| 541 | }, | 499 | }, |
| 542 | - ifShow: ({ values }) => | ||
| 543 | - isConditionWenDu(Reflect.get(values, 'type')) && | ||
| 544 | - !isTimeAll(Reflect.get(values, 'triggerType')), | 500 | + ifShow: false, |
| 545 | colProps: { | 501 | colProps: { |
| 546 | span: 12, | 502 | span: 12, |
| 547 | }, | 503 | }, |
| @@ -555,7 +511,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -555,7 +511,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
| 555 | component: 'Select', | 511 | component: 'Select', |
| 556 | required: true, | 512 | required: true, |
| 557 | componentProps: { | 513 | componentProps: { |
| 558 | - placeholder: '请选择设备输出', | 514 | + placeholder: '设备输出', |
| 559 | options: [ | 515 | options: [ |
| 560 | { label: '设备输出', value: 'DEVICE_OUT' }, | 516 | { label: '设备输出', value: 'DEVICE_OUT' }, |
| 561 | { label: '消息通知', value: 'MSG_NOTIFY' }, | 517 | { label: '消息通知', value: 'MSG_NOTIFY' }, |
| @@ -579,7 +535,9 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -579,7 +535,9 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
| 579 | }, | 535 | }, |
| 580 | { | 536 | { |
| 581 | field: 'doContext', | 537 | field: 'doContext', |
| 582 | - component: 'Input', | 538 | + component: 'InputTextArea', |
| 539 | + defaultValue: | ||
| 540 | + '{"method": "setDOValue","params": {"devID": "492S211218028819","data": {"DO1": 1,"DO2": 1,"DO3": 1,"DO4": 1}}}', | ||
| 583 | label: '', | 541 | label: '', |
| 584 | componentProps: { | 542 | componentProps: { |
| 585 | maxLength: 255, | 543 | maxLength: 255, |
| @@ -624,12 +582,10 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -624,12 +582,10 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
| 624 | span: 12, | 582 | span: 12, |
| 625 | }, | 583 | }, |
| 626 | componentProps: { | 584 | componentProps: { |
| 627 | - placeholder: '请选择场景触发器', | 585 | + placeholder: '请选择场景', |
| 628 | options: [ | 586 | options: [ |
| 629 | { label: '场景触发器1', value: '1' }, | 587 | { label: '场景触发器1', value: '1' }, |
| 630 | { label: '场景触发器2', value: '2' }, | 588 | { label: '场景触发器2', value: '2' }, |
| 631 | - { label: '场景触发器3', value: '3' }, | ||
| 632 | - { label: '场景触发器4', value: '4' }, | ||
| 633 | ], | 589 | ], |
| 634 | }, | 590 | }, |
| 635 | ifShow: ({ values }) => isScene(Reflect.get(values, 'outTarget')), | 591 | ifShow: ({ values }) => isScene(Reflect.get(values, 'outTarget')), |
| @@ -6,14 +6,15 @@ | @@ -6,14 +6,15 @@ | ||
| 6 | :rowSelection="{ type: 'checkbox' }" | 6 | :rowSelection="{ type: 'checkbox' }" |
| 7 | > | 7 | > |
| 8 | <template #toolbar> | 8 | <template #toolbar> |
| 9 | - <a-button | ||
| 10 | - v-if="isTenant || isSysadmin || isCustomer || isPlatform" | ||
| 11 | - type="primary" | ||
| 12 | - @click="handleAdd" | ||
| 13 | - > | 9 | + <a-button v-if="isTenant || isCustomer || isPlatform" type="primary" @click="handleAdd"> |
| 14 | 新增场景联动 | 10 | 新增场景联动 |
| 15 | </a-button> | 11 | </a-button> |
| 16 | - <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> | 12 | + <a-button |
| 13 | + v-if="isTenant || isCustomer || isPlatform" | ||
| 14 | + color="error" | ||
| 15 | + @click="handleDeleteOrBatchDelete(null)" | ||
| 16 | + :disabled="hasBatchDelete" | ||
| 17 | + > | ||
| 17 | 批量删除 | 18 | 批量删除 |
| 18 | </a-button> | 19 | </a-button> |
| 19 | </template> | 20 | </template> |
| @@ -24,13 +25,13 @@ | @@ -24,13 +25,13 @@ | ||
| 24 | label: '编辑', | 25 | label: '编辑', |
| 25 | icon: 'clarity:note-edit-line', | 26 | icon: 'clarity:note-edit-line', |
| 26 | onClick: handleEdit.bind(null, record), | 27 | onClick: handleEdit.bind(null, record), |
| 27 | - ifShow: isTenant || isCustomer, | 28 | + ifShow: isTenant || isCustomer || isPlatform, |
| 28 | }, | 29 | }, |
| 29 | { | 30 | { |
| 30 | label: '删除', | 31 | label: '删除', |
| 31 | icon: 'ant-design:delete-outlined', | 32 | icon: 'ant-design:delete-outlined', |
| 32 | color: 'error', | 33 | color: 'error', |
| 33 | - ifShow: isTenant || isCustomer, | 34 | + ifShow: isTenant || isCustomer || isPlatform, |
| 34 | popConfirm: { | 35 | popConfirm: { |
| 35 | title: '是否确认删除', | 36 | title: '是否确认删除', |
| 36 | confirm: handleDeleteOrBatchDelete.bind(null, record), | 37 | confirm: handleDeleteOrBatchDelete.bind(null, record), |
| @@ -294,6 +294,7 @@ | @@ -294,6 +294,7 @@ | ||
| 294 | setTimeout(() => { | 294 | setTimeout(() => { |
| 295 | proxy.$refs.refTriggerChild?.resetFieldsValueFunc(); | 295 | proxy.$refs.refTriggerChild?.resetFieldsValueFunc(); |
| 296 | proxy.$refs.refTriggerChild?.clearSelectDevice(); | 296 | proxy.$refs.refTriggerChild?.clearSelectDevice(); |
| 297 | + proxy.$refs.refTriggerChild?.clearSelectAttribute(); | ||
| 297 | proxy.$refs.refConditionChild?.resetFieldsValueFunc(); | 298 | proxy.$refs.refConditionChild?.resetFieldsValueFunc(); |
| 298 | proxy.$refs.refConditionChild?.clearSelectDevice(); | 299 | proxy.$refs.refConditionChild?.clearSelectDevice(); |
| 299 | proxy.$refs.refActionChild?.resetFieldsValueFunc(); | 300 | proxy.$refs.refActionChild?.resetFieldsValueFunc(); |
| @@ -492,17 +493,19 @@ | @@ -492,17 +493,19 @@ | ||
| 492 | condition: [ | 493 | condition: [ |
| 493 | { | 494 | { |
| 494 | key: { | 495 | key: { |
| 495 | - key: m.key1 == null ? 'CO2' : m.key1, | 496 | + key: m.type2 == null ? 'CO2' : m.type2, |
| 496 | type: m.type1 == null ? 'TIME_SERIES' : m.type1, | 497 | type: m.type1 == null ? 'TIME_SERIES' : m.type1, |
| 497 | }, | 498 | }, |
| 498 | - valueType: m.type2 == null ? 'NUMERIC' : m.type2, | ||
| 499 | - value: {}, | 499 | + // valueType: m.type2 == null ? 'NUMERIC' : m.type2, |
| 500 | + valueType: 'NUMERIC', | ||
| 501 | + // value: {}, | ||
| 500 | predicate: { | 502 | predicate: { |
| 501 | - type: m.type2 == null ? 'NUMERIC' : m.type2, | 503 | + // type: m.type2 == null ? 'NUMERIC' : m.type2, |
| 504 | + type: 'NUMERIC', | ||
| 502 | value: { | 505 | value: { |
| 503 | defaultValue: Number(m.value) == null ? 0 : Number(m.value), | 506 | defaultValue: Number(m.value) == null ? 0 : Number(m.value), |
| 504 | }, | 507 | }, |
| 505 | - operation: m.operation == null ? 'GREATER_OR_EQUAL' : m.operation, | 508 | + operation: m.operation == null ? 'EQUAL' : m.operation, |
| 506 | }, | 509 | }, |
| 507 | }, | 510 | }, |
| 508 | ], | 511 | ], |
| @@ -520,32 +523,17 @@ | @@ -520,32 +523,17 @@ | ||
| 520 | condition: [ | 523 | condition: [ |
| 521 | { | 524 | { |
| 522 | key: { | 525 | key: { |
| 526 | + key: m.type == null ? 'CO2' : m.type, | ||
| 523 | type: 'TIME_SERIES', | 527 | type: 'TIME_SERIES', |
| 524 | - key: 'CO2', | ||
| 525 | }, | 528 | }, |
| 526 | - valueType: | ||
| 527 | - m.type == 'NUMERIC1' | ||
| 528 | - ? 'NUMERIC' | ||
| 529 | - : m.type == 'NUMERIC2' | ||
| 530 | - ? 'NUMERIC' | ||
| 531 | - : 'NUMERIC', | ||
| 532 | - value: {}, | 529 | + valueType: 'NUMERIC', |
| 530 | + // value: {}, | ||
| 533 | predicate: { | 531 | predicate: { |
| 534 | - type: | ||
| 535 | - m.type == 'NUMERIC1' | ||
| 536 | - ? 'NUMERIC' | ||
| 537 | - : m.type == 'NUMERIC2' | ||
| 538 | - ? 'NUMERIC' | ||
| 539 | - : 'NUMERIC', | 532 | + type: 'NUMERIC', |
| 540 | value: { | 533 | value: { |
| 541 | - defaultValue: | ||
| 542 | - Number(m.value1) == null | ||
| 543 | - ? 0 | ||
| 544 | - : Number(m.value1) || Number(m.value2) == null | ||
| 545 | - ? 0 | ||
| 546 | - : Number(m.value2), | 534 | + defaultValue: Number(m.value) == null ? 0 : Number(m.value), |
| 547 | }, | 535 | }, |
| 548 | - operation: m.operation1 || m.operatio2, | 536 | + operation: m.operation, |
| 549 | }, | 537 | }, |
| 550 | }, | 538 | }, |
| 551 | ], | 539 | ], |
| @@ -650,18 +638,21 @@ | @@ -650,18 +638,21 @@ | ||
| 650 | (addTriggerPushData.value as any) = addTriggerPushData.value.map((m: any) => { | 638 | (addTriggerPushData.value as any) = addTriggerPushData.value.map((m: any) => { |
| 651 | return { | 639 | return { |
| 652 | triggerType: m?.triggerType, | 640 | triggerType: m?.triggerType, |
| 653 | - entityId: m?.entityId || m?.entityId1 || m?.entityId2, | 641 | + entityId: m?.entityId || m?.entityId1, |
| 642 | + sceneLinkageId: m?.sceneLinkageId, | ||
| 654 | triggerCondition: { | 643 | triggerCondition: { |
| 655 | condition: [ | 644 | condition: [ |
| 656 | { | 645 | { |
| 657 | key: { | 646 | key: { |
| 658 | - key: m.key1 == null ? 'CO2' : m.key1, | 647 | + key: m.type2 == null ? 'CO2' : m.type2, |
| 659 | type: m.type1 == null ? 'TIME_SERIES' : m.type1, | 648 | type: m.type1 == null ? 'TIME_SERIES' : m.type1, |
| 660 | }, | 649 | }, |
| 661 | - valueType: m.type2 == null ? 'NUMERIC' : m.type2, | ||
| 662 | - value: {}, | 650 | + // valueType: m.type2 == null ? 'NUMERIC' : m.type2, |
| 651 | + valueType: 'NUMERIC', | ||
| 652 | + // value: {}, | ||
| 663 | predicate: { | 653 | predicate: { |
| 664 | - type: m.type2 == null ? 'NUMERIC' : m.type2, | 654 | + // type: m.type2 == null ? 'NUMERIC' : m.type2, |
| 655 | + type: 'NUMERIC', | ||
| 665 | value: { | 656 | value: { |
| 666 | defaultValue: Number(m.value) == null ? 0 : Number(m.value), | 657 | defaultValue: Number(m.value) == null ? 0 : Number(m.value), |
| 667 | }, | 658 | }, |
| @@ -754,32 +745,17 @@ | @@ -754,32 +745,17 @@ | ||
| 754 | condition: [ | 745 | condition: [ |
| 755 | { | 746 | { |
| 756 | key: { | 747 | key: { |
| 748 | + key: m.type == null ? 'CO2' : m.type, | ||
| 757 | type: 'TIME_SERIES', | 749 | type: 'TIME_SERIES', |
| 758 | - key: 'CO2', | ||
| 759 | }, | 750 | }, |
| 760 | - valueType: | ||
| 761 | - m.type == 'NUMERIC1' | ||
| 762 | - ? 'NUMERIC' | ||
| 763 | - : m.type == 'NUMERIC2' | ||
| 764 | - ? 'NUMERIC' | ||
| 765 | - : 'NUMERIC', | ||
| 766 | - value: {}, | 751 | + valueType: 'NUMERIC', |
| 752 | + // value: {}, | ||
| 767 | predicate: { | 753 | predicate: { |
| 768 | - type: | ||
| 769 | - m.type == 'NUMERIC1' | ||
| 770 | - ? 'NUMERIC' | ||
| 771 | - : m.type == 'NUMERIC2' | ||
| 772 | - ? 'NUMERIC' | ||
| 773 | - : 'NUMERIC', | 754 | + type: 'NUMERIC', |
| 774 | value: { | 755 | value: { |
| 775 | - defaultValue: | ||
| 776 | - Number(m.value1) == null | ||
| 777 | - ? 0 | ||
| 778 | - : Number(m.value1) || Number(m.value2) == null | ||
| 779 | - ? 0 | ||
| 780 | - : Number(m.value2), | 756 | + defaultValue: Number(m.value) == null ? 0 : Number(m.value), |
| 781 | }, | 757 | }, |
| 782 | - operation: m.operation1 || m.operatio2, | 758 | + operation: m.operation, |
| 783 | }, | 759 | }, |
| 784 | }, | 760 | }, |
| 785 | ], | 761 | ], |
| @@ -45,7 +45,6 @@ | @@ -45,7 +45,6 @@ | ||
| 45 | const permissionStore = usePermissionStore(); | 45 | const permissionStore = usePermissionStore(); |
| 46 | const { createMessage } = useMessage(); | 46 | const { createMessage } = useMessage(); |
| 47 | const userInfo = getAuthCache(USER_INFO_KEY); | 47 | const userInfo = getAuthCache(USER_INFO_KEY); |
| 48 | - // console.log(userInfo, 'userInfo'); | ||
| 49 | async function handleSubmit() { | 48 | async function handleSubmit() { |
| 50 | try { | 49 | try { |
| 51 | const values = await validate(); | 50 | const values = await validate(); |
| @@ -33,7 +33,6 @@ | @@ -33,7 +33,6 @@ | ||
| 33 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | 33 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
| 34 | await resetFields(); | 34 | await resetFields(); |
| 35 | setDrawerProps({ confirmLoading: false }); | 35 | setDrawerProps({ confirmLoading: false }); |
| 36 | - console.log(data); | ||
| 37 | isUpdate.value = !!data?.isUpdate; | 36 | isUpdate.value = !!data?.isUpdate; |
| 38 | if (unref(isUpdate)) { | 37 | if (unref(isUpdate)) { |
| 39 | id = data.record.id; | 38 | id = data.record.id; |
| @@ -45,7 +45,6 @@ | @@ -45,7 +45,6 @@ | ||
| 45 | ...data.record, | 45 | ...data.record, |
| 46 | }); | 46 | }); |
| 47 | organizationId = Reflect.get(data.record, 'id'); | 47 | organizationId = Reflect.get(data.record, 'id'); |
| 48 | - console.log(organizationId); | ||
| 49 | let treeData: any = await getOrganizationList(); | 48 | let treeData: any = await getOrganizationList(); |
| 50 | 49 | ||
| 51 | // 过滤当前选中的组织, | 50 | // 过滤当前选中的组织, |
| @@ -66,7 +65,6 @@ | @@ -66,7 +65,6 @@ | ||
| 66 | }); | 65 | }); |
| 67 | } else { | 66 | } else { |
| 68 | let treeData = await getOrganizationList(); | 67 | let treeData = await getOrganizationList(); |
| 69 | - console.log(treeData); | ||
| 70 | await updateSchema({ | 68 | await updateSchema({ |
| 71 | field: 'parentId', | 69 | field: 'parentId', |
| 72 | componentProps: { treeData }, | 70 | componentProps: { treeData }, |
| @@ -6,7 +6,7 @@ export const formSchema: FormSchema[] = [ | @@ -6,7 +6,7 @@ export const formSchema: FormSchema[] = [ | ||
| 6 | field: 'type', | 6 | field: 'type', |
| 7 | label: '类型', | 7 | label: '类型', |
| 8 | component: 'Select', | 8 | component: 'Select', |
| 9 | - defaultValue: '默认', | 9 | + defaultValue: 'DEFAULT', |
| 10 | colProps: { span: 24 }, | 10 | colProps: { span: 24 }, |
| 11 | componentProps: { | 11 | componentProps: { |
| 12 | placeholder: '请选择类型', | 12 | placeholder: '请选择类型', |
| @@ -15,6 +15,11 @@ | @@ -15,6 +15,11 @@ | ||
| 15 | <TableAction | 15 | <TableAction |
| 16 | :actions="[ | 16 | :actions="[ |
| 17 | { | 17 | { |
| 18 | + label: '设置该租户为默认', | ||
| 19 | + icon: 'ant-design:eye-outlined', | ||
| 20 | + onClick: handleDefault.bind(null, record), | ||
| 21 | + }, | ||
| 22 | + { | ||
| 18 | label: '编辑', | 23 | label: '编辑', |
| 19 | icon: 'clarity:note-edit-line', | 24 | icon: 'clarity:note-edit-line', |
| 20 | onClick: handleEdit.bind(null, record), | 25 | onClick: handleEdit.bind(null, record), |
| @@ -46,7 +51,11 @@ | @@ -46,7 +51,11 @@ | ||
| 46 | import TenantSettingDrawer from './useDrawer.vue'; | 51 | import TenantSettingDrawer from './useDrawer.vue'; |
| 47 | import { columns, searchFormSchema } from './config'; | 52 | import { columns, searchFormSchema } from './config'; |
| 48 | import { useMessage } from '/@/hooks/web/useMessage'; | 53 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 49 | - import { getTableTenantProfileApi, deleteTenantProfileApi } from '/@/api/tenant/tenantApi'; | 54 | + import { |
| 55 | + getTableTenantProfileApi, | ||
| 56 | + deleteTenantProfileApi, | ||
| 57 | + setTenantProfileIsDefaultApi, | ||
| 58 | + } from '/@/api/tenant/tenantApi'; | ||
| 50 | 59 | ||
| 51 | export default defineComponent({ | 60 | export default defineComponent({ |
| 52 | name: 'Index', | 61 | name: 'Index', |
| @@ -93,28 +102,57 @@ | @@ -93,28 +102,57 @@ | ||
| 93 | echoEditData = record; | 102 | echoEditData = record; |
| 94 | } | 103 | } |
| 95 | async function handleDelete(record: Recordable) { | 104 | async function handleDelete(record: Recordable) { |
| 96 | - let ids = [record.id]; | 105 | + let ids = record.id.id; |
| 97 | await deleteTenantProfileApi(ids); | 106 | await deleteTenantProfileApi(ids); |
| 98 | createMessage.success('删除成功'); | 107 | createMessage.success('删除成功'); |
| 99 | reload(); | 108 | reload(); |
| 100 | } | 109 | } |
| 101 | const useSelectionChange = () => { | 110 | const useSelectionChange = () => { |
| 102 | - selectedRowKeys = getSelectRowKeys(); | 111 | + selectedRowKeys = getSelectRows(); |
| 103 | if (selectedRowKeys.length !== 0) { | 112 | if (selectedRowKeys.length !== 0) { |
| 104 | disabled.value = false; | 113 | disabled.value = false; |
| 105 | } else { | 114 | } else { |
| 106 | disabled.value = true; | 115 | disabled.value = true; |
| 107 | } | 116 | } |
| 108 | }; | 117 | }; |
| 109 | - const handleMutilteDelete = async () => { | ||
| 110 | - await deleteTenantProfileApi(selectedRowKeys); | ||
| 111 | - createMessage.success('删除成功'); | 118 | + const handleMutilteDelete = () => { |
| 119 | + selectedRowKeys.forEach(async (f: any) => { | ||
| 120 | + await deleteTenantProfileApi(f.id.id); | ||
| 121 | + createMessage.success('删除成功'); | ||
| 122 | + reload(); | ||
| 123 | + selectedRowKeys.length = 0; | ||
| 124 | + }); | ||
| 125 | + }; | ||
| 126 | + | ||
| 127 | + const handleDefault = async (record: Recordable) => { | ||
| 128 | + let id = record.id.id; | ||
| 129 | + const obj = { | ||
| 130 | + headers: { | ||
| 131 | + normalizedNames: {}, | ||
| 132 | + lazyUpdate: null, | ||
| 133 | + }, | ||
| 134 | + params: { | ||
| 135 | + updates: null, | ||
| 136 | + cloneFrom: null, | ||
| 137 | + encoder: {}, | ||
| 138 | + map: null, | ||
| 139 | + interceptorConfig: { | ||
| 140 | + ignoreLoading: false, | ||
| 141 | + ignoreErrors: false, | ||
| 142 | + resendRequest: false, | ||
| 143 | + }, | ||
| 144 | + }, | ||
| 145 | + }; | ||
| 146 | + const data = await setTenantProfileIsDefaultApi(id, 'default', obj); | ||
| 147 | + if (!data) return createMessage.error('设置该租户配置为默认失败'); | ||
| 148 | + createMessage.success('设置该租户配置为默认成功'); | ||
| 112 | reload(); | 149 | reload(); |
| 113 | }; | 150 | }; |
| 114 | function handleSuccess() { | 151 | function handleSuccess() { |
| 115 | reload(); | 152 | reload(); |
| 116 | } | 153 | } |
| 117 | return { | 154 | return { |
| 155 | + handleDefault, | ||
| 118 | disabled, | 156 | disabled, |
| 119 | echoEditData, | 157 | echoEditData, |
| 120 | registerTable, | 158 | registerTable, |
| 1 | <template> | 1 | <template> |
| 2 | <div> | 2 | <div> |
| 3 | - <BasicTable @register="registerTable"> | 3 | + <BasicTable |
| 4 | + @register="registerTable" | ||
| 5 | + @selection-change="useSelectionChange" | ||
| 6 | + :rowSelection="{ type: 'checkbox' }" | ||
| 7 | + > | ||
| 4 | <template #toolbar> | 8 | <template #toolbar> |
| 5 | <a-button type="primary" @click="handleCreate"> 新增角色 </a-button> | 9 | <a-button type="primary" @click="handleCreate"> 新增角色 </a-button> |
| 10 | + <a-button type="default" :disabled="disabled" @click="handleBatchDelete"> | ||
| 11 | + 批量删除 | ||
| 12 | + </a-button> | ||
| 6 | </template> | 13 | </template> |
| 7 | <template #action="{ record }"> | 14 | <template #action="{ record }"> |
| 8 | <TableAction | 15 | <TableAction |
| @@ -29,11 +36,10 @@ | @@ -29,11 +36,10 @@ | ||
| 29 | </div> | 36 | </div> |
| 30 | </template> | 37 | </template> |
| 31 | <script lang="ts"> | 38 | <script lang="ts"> |
| 32 | - import { defineComponent } from 'vue'; | ||
| 33 | - | 39 | + import { defineComponent, ref } from 'vue'; |
| 34 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 40 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 35 | import { delRole, getRoleListByPage } from '/@/api/system/system'; | 41 | import { delRole, getRoleListByPage } from '/@/api/system/system'; |
| 36 | - | 42 | + import { useMessage } from '/@/hooks/web/useMessage'; |
| 37 | import { useDrawer } from '/@/components/Drawer'; | 43 | import { useDrawer } from '/@/components/Drawer'; |
| 38 | import RoleDrawer from './RoleDrawer.vue'; | 44 | import RoleDrawer from './RoleDrawer.vue'; |
| 39 | import { columns, searchFormSchema } from './role.data'; | 45 | import { columns, searchFormSchema } from './role.data'; |
| @@ -44,7 +50,10 @@ | @@ -44,7 +50,10 @@ | ||
| 44 | components: { BasicTable, RoleDrawer, TableAction }, | 50 | components: { BasicTable, RoleDrawer, TableAction }, |
| 45 | setup() { | 51 | setup() { |
| 46 | const [registerDrawer, { openDrawer }] = useDrawer(); | 52 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 47 | - const [registerTable, { reload }] = useTable({ | 53 | + let selectedRowKeys: Array<string> = []; |
| 54 | + const disabled = ref(true); | ||
| 55 | + const { createMessage } = useMessage(); | ||
| 56 | + const [registerTable, { reload, getSelectRows }] = useTable({ | ||
| 48 | title: '租户角色列表', | 57 | title: '租户角色列表', |
| 49 | api: getRoleListByPage, | 58 | api: getRoleListByPage, |
| 50 | columns, | 59 | columns, |
| @@ -82,14 +91,35 @@ | @@ -82,14 +91,35 @@ | ||
| 82 | async function handleDelete(record: Recordable) { | 91 | async function handleDelete(record: Recordable) { |
| 83 | const roleIds = [record.id]; | 92 | const roleIds = [record.id]; |
| 84 | delRole(roleIds).then(() => { | 93 | delRole(roleIds).then(() => { |
| 94 | + createMessage.success('删除成功'); | ||
| 85 | reload(); | 95 | reload(); |
| 86 | }); | 96 | }); |
| 87 | } | 97 | } |
| 98 | + | ||
| 99 | + const useSelectionChange = () => { | ||
| 100 | + selectedRowKeys = getSelectRows(); | ||
| 101 | + if (selectedRowKeys.length !== 0) { | ||
| 102 | + disabled.value = false; | ||
| 103 | + } else { | ||
| 104 | + disabled.value = true; | ||
| 105 | + } | ||
| 106 | + }; | ||
| 107 | + const handleBatchDelete = async () => { | ||
| 108 | + let roleIds = selectedRowKeys.map((m: any) => { | ||
| 109 | + return m.id; | ||
| 110 | + }); | ||
| 111 | + await delRole(roleIds); | ||
| 112 | + createMessage.success('批量删除成功'); | ||
| 113 | + reload(); | ||
| 114 | + }; | ||
| 88 | function handleSuccess() { | 115 | function handleSuccess() { |
| 89 | reload(); | 116 | reload(); |
| 90 | } | 117 | } |
| 91 | 118 | ||
| 92 | return { | 119 | return { |
| 120 | + disabled, | ||
| 121 | + useSelectionChange, | ||
| 122 | + handleBatchDelete, | ||
| 93 | registerTable, | 123 | registerTable, |
| 94 | registerDrawer, | 124 | registerDrawer, |
| 95 | handleCreate, | 125 | handleCreate, |