Showing
4 changed files
with
36 additions
and
18 deletions
| @@ -75,7 +75,7 @@ export function createPermissionGuard(router: Router) { | @@ -75,7 +75,7 @@ export function createPermissionGuard(router: Router) { | ||
| 75 | router.push('/dashboard/workbench'); | 75 | router.push('/dashboard/workbench'); |
| 76 | }, 1); | 76 | }, 1); |
| 77 | } else { | 77 | } else { |
| 78 | - const routeF = getMenuListData[0]?.children[0]?.path || getMenuListData[0].path; | 78 | + const routeF = getMenuListData[0]?.children[0]?.path || getMenuListData[0]?.path; |
| 79 | setTimeout(() => { | 79 | setTimeout(() => { |
| 80 | router.push(routeF); | 80 | router.push(routeF); |
| 81 | }, 1); | 81 | }, 1); |
| @@ -918,11 +918,11 @@ | @@ -918,11 +918,11 @@ | ||
| 918 | fliterTempRuleConditionTempArr.value.push({ | 918 | fliterTempRuleConditionTempArr.value.push({ |
| 919 | condition: addNewRuleTem.condition.condition, | 919 | condition: addNewRuleTem.condition.condition, |
| 920 | }); | 920 | }); |
| 921 | - if (isEditDataAndValue.value == true) { | ||
| 922 | - getEditDataAndValue.value.push({ | ||
| 923 | - condition: addNewRuleTem.condition.condition, | ||
| 924 | - }); | ||
| 925 | - } | 921 | + |
| 922 | + getEditDataAndValue.value.push({ | ||
| 923 | + condition: addNewRuleTem.condition.condition, | ||
| 924 | + }); | ||
| 925 | + console.log(getEditDataAndValue.value); | ||
| 926 | }; | 926 | }; |
| 927 | //格式化编辑 | 927 | //格式化编辑 |
| 928 | const isEditDataAndValueFunc = (v) => { | 928 | const isEditDataAndValueFunc = (v) => { |
| @@ -340,7 +340,7 @@ | @@ -340,7 +340,7 @@ | ||
| 340 | newFilterMap.value.push({ | 340 | newFilterMap.value.push({ |
| 341 | value: f2.tbDeviceId, | 341 | value: f2.tbDeviceId, |
| 342 | label: f2.name, | 342 | label: f2.name, |
| 343 | - }); | 343 | + } as never); |
| 344 | } | 344 | } |
| 345 | }); | 345 | }); |
| 346 | }); | 346 | }); |
| @@ -350,7 +350,7 @@ | @@ -350,7 +350,7 @@ | ||
| 350 | newConditionFilterMap.value.push({ | 350 | newConditionFilterMap.value.push({ |
| 351 | value: f2.tbDeviceId, | 351 | value: f2.tbDeviceId, |
| 352 | label: f2.name, | 352 | label: f2.name, |
| 353 | - }); | 353 | + } as never); |
| 354 | } | 354 | } |
| 355 | }); | 355 | }); |
| 356 | }); | 356 | }); |
| @@ -360,7 +360,7 @@ | @@ -360,7 +360,7 @@ | ||
| 360 | newActionFilterMap.value.push({ | 360 | newActionFilterMap.value.push({ |
| 361 | value: f2.tbDeviceId, | 361 | value: f2.tbDeviceId, |
| 362 | label: f2.name, | 362 | label: f2.name, |
| 363 | - }); | 363 | + } as never); |
| 364 | } | 364 | } |
| 365 | }); | 365 | }); |
| 366 | }); | 366 | }); |
| @@ -407,7 +407,7 @@ | @@ -407,7 +407,7 @@ | ||
| 407 | return e; | 407 | return e; |
| 408 | } | 408 | } |
| 409 | }; | 409 | }; |
| 410 | - watch(getData, async (newV) => { | 410 | + watch(getData, async (newV: string) => { |
| 411 | const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | 411 | const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); |
| 412 | options.items.forEach((v) => { | 412 | options.items.forEach((v) => { |
| 413 | return (v.value = v.tbDeviceId), (v.label = v.name); | 413 | return (v.value = v.tbDeviceId), (v.label = v.name); |
| @@ -464,7 +464,7 @@ | @@ -464,7 +464,7 @@ | ||
| 464 | let newTriggerArray = addTriggerPushData.value.concat(refTriggerChildData); | 464 | let newTriggerArray = addTriggerPushData.value.concat(refTriggerChildData); |
| 465 | let newConditionArray = addConditionPushData.value.concat(refConditionChildData); | 465 | let newConditionArray = addConditionPushData.value.concat(refConditionChildData); |
| 466 | let newActionArray = addActionPushData.value.concat(refActionChildData); | 466 | let newActionArray = addActionPushData.value.concat(refActionChildData); |
| 467 | - newTriggerArray = newTriggerArray.map((m) => { | 467 | + (newTriggerArray as any) = newTriggerArray.map((m) => { |
| 468 | return { | 468 | return { |
| 469 | triggerType: m?.triggerType, | 469 | triggerType: m?.triggerType, |
| 470 | entityId: m?.entityId || m?.entityId1 || m?.entityId2, | 470 | entityId: m?.entityId || m?.entityId1 || m?.entityId2, |
| @@ -492,7 +492,7 @@ | @@ -492,7 +492,7 @@ | ||
| 492 | }, | 492 | }, |
| 493 | }; | 493 | }; |
| 494 | }); | 494 | }); |
| 495 | - newConditionArray = newConditionArray.map((m) => { | 495 | + (newConditionArray as any) = newConditionArray.map((m) => { |
| 496 | return { | 496 | return { |
| 497 | triggerType: m?.triggerType, | 497 | triggerType: m?.triggerType, |
| 498 | entityId: m?.entityId, | 498 | entityId: m?.entityId, |
| @@ -626,7 +626,7 @@ | @@ -626,7 +626,7 @@ | ||
| 626 | if (!unref(isUpdate)) { | 626 | if (!unref(isUpdate)) { |
| 627 | refTriggerChildDataFunc(); | 627 | refTriggerChildDataFunc(); |
| 628 | unref(addTriggerPushData).push(refTriggerChildData as never); | 628 | unref(addTriggerPushData).push(refTriggerChildData as never); |
| 629 | - addTriggerPushData.value = addTriggerPushData.value.map((m) => { | 629 | + (addTriggerPushData.value as any) = addTriggerPushData.value.map((m) => { |
| 630 | return { | 630 | return { |
| 631 | triggerType: m?.triggerType, | 631 | triggerType: m?.triggerType, |
| 632 | entityId: m?.entityId || m?.entityId1 || m?.entityId2, | 632 | entityId: m?.entityId || m?.entityId1 || m?.entityId2, |
| @@ -725,7 +725,7 @@ | @@ -725,7 +725,7 @@ | ||
| 725 | if (!unref(isUpdate)) { | 725 | if (!unref(isUpdate)) { |
| 726 | refConditionChildDataFunc(); | 726 | refConditionChildDataFunc(); |
| 727 | unref(addConditionPushData).push(refConditionChildData as never); | 727 | unref(addConditionPushData).push(refConditionChildData as never); |
| 728 | - addConditionPushData.value = addConditionPushData.value.map((m) => { | 728 | + (addConditionPushData.value as any) = addConditionPushData.value.map((m) => { |
| 729 | return { | 729 | return { |
| 730 | triggerType: m?.triggerType, | 730 | triggerType: m?.triggerType, |
| 731 | entityId: m?.entityId, | 731 | entityId: m?.entityId, |
| @@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
| 25 | </BasicModal> | 25 | </BasicModal> |
| 26 | </template> | 26 | </template> |
| 27 | <script lang="ts"> | 27 | <script lang="ts"> |
| 28 | - import { defineComponent, ref, computed, unref } from 'vue'; | 28 | + import { defineComponent, ref, computed, unref, reactive } from 'vue'; |
| 29 | import { BasicModal, useModalInner } from '/@/components/Modal'; | 29 | import { BasicModal, useModalInner } from '/@/components/Modal'; |
| 30 | import { BasicForm, useForm } from '/@/components/Form/index'; | 30 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 31 | import { accountFormSchema } from './account.data'; | 31 | import { accountFormSchema } from './account.data'; |
| @@ -35,6 +35,7 @@ | @@ -35,6 +35,7 @@ | ||
| 35 | import { RoleOrOrganizationParam } from '/@/api/system/model/systemModel'; | 35 | import { RoleOrOrganizationParam } from '/@/api/system/model/systemModel'; |
| 36 | import { useMessage } from '/@/hooks/web/useMessage'; | 36 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 37 | import { copyTransTreeFun } from '/@/utils/fnUtils'; | 37 | import { copyTransTreeFun } from '/@/utils/fnUtils'; |
| 38 | + | ||
| 38 | export default defineComponent({ | 39 | export default defineComponent({ |
| 39 | name: 'AccountModal', | 40 | name: 'AccountModal', |
| 40 | components: { BasicModal, BasicForm, BasicTree }, | 41 | components: { BasicModal, BasicForm, BasicTree }, |
| @@ -46,6 +47,11 @@ | @@ -46,6 +47,11 @@ | ||
| 46 | const basicTreeRef = ref(); | 47 | const basicTreeRef = ref(); |
| 47 | const checkGroup = ref<string[]>([]); | 48 | const checkGroup = ref<string[]>([]); |
| 48 | const olderPhoneNumber = ref(); | 49 | const olderPhoneNumber = ref(); |
| 50 | + const postData = reactive({}); | ||
| 51 | + const singleEditPostPhoneNumber = reactive({ | ||
| 52 | + phoneNumber: '', | ||
| 53 | + }); | ||
| 54 | + | ||
| 49 | const [ | 55 | const [ |
| 50 | registerForm, | 56 | registerForm, |
| 51 | { setFieldsValue, updateSchema, resetFields, validate, getFieldsValue }, | 57 | { setFieldsValue, updateSchema, resetFields, validate, getFieldsValue }, |
| @@ -67,11 +73,11 @@ | @@ -67,11 +73,11 @@ | ||
| 67 | copyTransTreeFun(groupListModel); | 73 | copyTransTreeFun(groupListModel); |
| 68 | organizationTreeData.value = groupListModel; | 74 | organizationTreeData.value = groupListModel; |
| 69 | } | 75 | } |
| 70 | - | ||
| 71 | if (unref(isUpdate)) { | 76 | if (unref(isUpdate)) { |
| 72 | rowId.value = data.record.id; | 77 | rowId.value = data.record.id; |
| 73 | const roleParams = new RoleOrOrganizationParam(rowId.value, true, false); | 78 | const roleParams = new RoleOrOrganizationParam(rowId.value, true, false); |
| 74 | olderPhoneNumber.value = data.record.phoneNumber; | 79 | olderPhoneNumber.value = data.record.phoneNumber; |
| 80 | + singleEditPostPhoneNumber.phoneNumber = data.record.phoneNumber; | ||
| 75 | findCurrentUserRelation(roleParams).then((result) => { | 81 | findCurrentUserRelation(roleParams).then((result) => { |
| 76 | Reflect.set(data.record, 'roleIds', result); | 82 | Reflect.set(data.record, 'roleIds', result); |
| 77 | Reflect.set(data.record, 'password', '******'); | 83 | Reflect.set(data.record, 'password', '******'); |
| @@ -92,6 +98,9 @@ | @@ -92,6 +98,9 @@ | ||
| 92 | async function handleSubmit() { | 98 | async function handleSubmit() { |
| 93 | try { | 99 | try { |
| 94 | const { createMessage } = useMessage(); | 100 | const { createMessage } = useMessage(); |
| 101 | + if (unref(isUpdate)) { | ||
| 102 | + Object.assign(postData, singleEditPostPhoneNumber); | ||
| 103 | + } | ||
| 95 | const values = await validate([ | 104 | const values = await validate([ |
| 96 | 'id', | 105 | 'id', |
| 97 | 'username', | 106 | 'username', |
| @@ -105,13 +114,22 @@ | @@ -105,13 +114,22 @@ | ||
| 105 | 'organizationIds', | 114 | 'organizationIds', |
| 106 | olderPhoneNumber.value === getFieldsValue().phoneNumber ? '' : 'phoneNumber', | 115 | olderPhoneNumber.value === getFieldsValue().phoneNumber ? '' : 'phoneNumber', |
| 107 | ]); | 116 | ]); |
| 108 | - console.log(values); | ||
| 109 | values.accountExpireTime = | 117 | values.accountExpireTime = |
| 110 | typeof values.accountExpireTime != 'undefined' && values.accountExpireTime != null | 118 | typeof values.accountExpireTime != 'undefined' && values.accountExpireTime != null |
| 111 | ? values.accountExpireTime.format('YYYY-MM-DD HH:mm:ss') | 119 | ? values.accountExpireTime.format('YYYY-MM-DD HH:mm:ss') |
| 112 | : null; | 120 | : null; |
| 113 | setModalProps({ confirmLoading: true }); | 121 | setModalProps({ confirmLoading: true }); |
| 114 | - await SaveOrUpdateUserInfo(values, unref(isUpdate)); | 122 | + Object.assign(postData, values); |
| 123 | + if (unref(isUpdate)) { | ||
| 124 | + if (values.email == '') { | ||
| 125 | + delete postData.email; | ||
| 126 | + } | ||
| 127 | + } else { | ||
| 128 | + if (values.email == '') { | ||
| 129 | + delete postData.email; | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + await SaveOrUpdateUserInfo(postData as any, unref(isUpdate)); | ||
| 115 | closeModal(); | 133 | closeModal(); |
| 116 | emit('success'); | 134 | emit('success'); |
| 117 | createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功'); | 135 | createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功'); |