Commit bab8d8b79f8092a923a6b50fecfb761dea4f00f9

Authored by xp.Huang
2 parents 6808b942 2e024266

Merge branch 'ft-dev' into 'main'

fix:修改账号管理点击编辑时,没修改手机号和邮箱,手机号为空字符串,邮箱为空字符问题

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