Commit da9fcd945573636bde8d82d111ce29aa0b05bcff
Merge branch 'sqy_dev' into 'main'
fix:修改租户管理bug,修改站内通知的问题,修改设备更改 See merge request huang/yun-teng-iot-front!42
Showing
12 changed files
with
56 additions
and
154 deletions
| @@ -4,7 +4,7 @@ import { Rule } from 'ant-design-vue/lib/form/interface'; | @@ -4,7 +4,7 @@ import { Rule } from 'ant-design-vue/lib/form/interface'; | ||
| 4 | * | 4 | * |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | -// 手机号验证 | 7 | +// 数字验证 |
| 8 | export const numberRule: Rule[] = [ | 8 | export const numberRule: Rule[] = [ |
| 9 | { | 9 | { |
| 10 | required: true, | 10 | required: true, |
| @@ -51,3 +51,12 @@ export const emailRule: Rule[] = [ | @@ -51,3 +51,12 @@ export const emailRule: Rule[] = [ | ||
| 51 | validateTrigger: 'blur', | 51 | validateTrigger: 'blur', |
| 52 | }, | 52 | }, |
| 53 | ]; | 53 | ]; |
| 54 | + | ||
| 55 | +// 中文正则 | ||
| 56 | +export const ChineseRegexp = /[\u4E00-\u9FA5]/g; | ||
| 57 | + | ||
| 58 | +// 电子邮箱正则 | ||
| 59 | +export const EmailRegexp = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/; | ||
| 60 | + | ||
| 61 | +// 手机号正则 | ||
| 62 | +export const PhoneRegexp = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; |
| @@ -73,7 +73,7 @@ export const step1Schemas: FormSchema[] = [ | @@ -73,7 +73,7 @@ export const step1Schemas: FormSchema[] = [ | ||
| 73 | slot: 'deviceAddress', | 73 | slot: 'deviceAddress', |
| 74 | }, | 74 | }, |
| 75 | { | 75 | { |
| 76 | - field: 'remark', | 76 | + field: 'description', |
| 77 | label: '备注', | 77 | label: '备注', |
| 78 | component: 'InputTextArea', | 78 | component: 'InputTextArea', |
| 79 | }, | 79 | }, |
| 1 | import { FormSchema } from '/@/components/Form'; | 1 | import { FormSchema } from '/@/components/Form'; |
| 2 | import { BasicColumn } from '/@/components/Table'; | 2 | import { BasicColumn } from '/@/components/Table'; |
| 3 | +import { DeviceTypeEnum } from '/@/api/device/model/deviceModel'; | ||
| 4 | + | ||
| 3 | export const columns: BasicColumn[] = [ | 5 | export const columns: BasicColumn[] = [ |
| 4 | { | 6 | { |
| 5 | title: '设备名称', | 7 | title: '设备名称', |
| @@ -24,12 +26,19 @@ export const columns: BasicColumn[] = [ | @@ -24,12 +26,19 @@ export const columns: BasicColumn[] = [ | ||
| 24 | title: '设备类型', | 26 | title: '设备类型', |
| 25 | dataIndex: 'deviceType', | 27 | dataIndex: 'deviceType', |
| 26 | key: 'deviceType', | 28 | key: 'deviceType', |
| 29 | + customRender({ text }) { | ||
| 30 | + return text === DeviceTypeEnum.GATEWAY | ||
| 31 | + ? '网关设备' | ||
| 32 | + : text == DeviceTypeEnum.DIRECT_CONNECTION | ||
| 33 | + ? '直连设备' | ||
| 34 | + : '网关子设备'; | ||
| 35 | + }, | ||
| 27 | }, | 36 | }, |
| 28 | { | 37 | { |
| 29 | title: '描述', | 38 | title: '描述', |
| 30 | - dataIndex: 'label', | 39 | + dataIndex: 'description', |
| 31 | width: 180, | 40 | width: 180, |
| 32 | - key: 'label', | 41 | + key: 'description', |
| 33 | }, | 42 | }, |
| 34 | ]; | 43 | ]; |
| 35 | 44 |
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | ><RealTimeData | 15 | ><RealTimeData |
| 16 | /></TabPane> | 16 | /></TabPane> |
| 17 | <TabPane key="3" tab="告警"><Alarm :id="deviceId" /></TabPane> | 17 | <TabPane key="3" tab="告警"><Alarm :id="deviceId" /></TabPane> |
| 18 | - <TabPane key="4" tab="子设备" v-if="deviceDetail?.deviceType === 'SENSOR'" | 18 | + <TabPane key="4" tab="子设备" v-if="deviceDetail?.deviceType === 'GATEWAY'" |
| 19 | ><ChildDevice | 19 | ><ChildDevice |
| 20 | /></TabPane> | 20 | /></TabPane> |
| 21 | </Tabs> | 21 | </Tabs> |
| @@ -57,7 +57,7 @@ | @@ -57,7 +57,7 @@ | ||
| 57 | const DeviceStep2Ref = ref<InstanceType<typeof DeviceStep2>>(); | 57 | const DeviceStep2Ref = ref<InstanceType<typeof DeviceStep2>>(); |
| 58 | const { createMessage } = useMessage(); | 58 | const { createMessage } = useMessage(); |
| 59 | const current = ref(0); | 59 | const current = ref(0); |
| 60 | - const isUpdate = ref(true); | 60 | + const isUpdate = ref<Boolean>(); |
| 61 | const deviceInfo = ref({}); | 61 | const deviceInfo = ref({}); |
| 62 | const getTitle = computed(() => (!unref(isUpdate) ? '新增设备' : '编辑设备')); | 62 | const getTitle = computed(() => (!unref(isUpdate) ? '新增设备' : '编辑设备')); |
| 63 | // 所有参数 | 63 | // 所有参数 |
| @@ -68,17 +68,15 @@ | @@ -68,17 +68,15 @@ | ||
| 68 | DeviceStep1Ref?.value?.parentSetFieldsValue(data.record); | 68 | DeviceStep1Ref?.value?.parentSetFieldsValue(data.record); |
| 69 | DeviceStep1Ref?.value?.parentSetFieldsValue({ | 69 | DeviceStep1Ref?.value?.parentSetFieldsValue({ |
| 70 | profile: data.record.deviceProfile.name, | 70 | profile: data.record.deviceProfile.name, |
| 71 | - remark: data.record.deviceInfo.description, | ||
| 72 | profileId: data.record.profileId, | 71 | profileId: data.record.profileId, |
| 73 | deviceType: data.record.deviceType, | 72 | deviceType: data.record.deviceType, |
| 74 | }); | 73 | }); |
| 75 | deviceInfo.value = data.record.deviceInfo; | 74 | deviceInfo.value = data.record.deviceInfo; |
| 76 | } else { | 75 | } else { |
| 77 | - DeviceStep1Ref?.value?.parentResetDevicePic(); | ||
| 78 | DeviceStep1Ref?.value?.parentResetPositionState(); | 76 | DeviceStep1Ref?.value?.parentResetPositionState(); |
| 79 | deviceInfo.value = {}; | 77 | deviceInfo.value = {}; |
| 80 | } | 78 | } |
| 81 | - isUpdate.value = !!data?.isUpdate; | 79 | + isUpdate.value = data?.isUpdate; |
| 82 | }); | 80 | }); |
| 83 | 81 | ||
| 84 | // 上一步 | 82 | // 上一步 |
| @@ -95,9 +93,11 @@ | @@ -95,9 +93,11 @@ | ||
| 95 | stepState.value = { ...stepState, ...step2Values }; | 93 | stepState.value = { ...stepState, ...step2Values }; |
| 96 | } | 94 | } |
| 97 | function handleCancel() { | 95 | function handleCancel() { |
| 96 | + if (unref(isUpdate)) { | ||
| 97 | + DeviceStep1Ref?.value?.parentResetDevicePic(deviceInfo.value); | ||
| 98 | + } | ||
| 98 | current.value = 0; | 99 | current.value = 0; |
| 99 | DeviceStep1Ref?.value?.resetFields(); | 100 | DeviceStep1Ref?.value?.resetFields(); |
| 100 | - DeviceStep1Ref.value?.parentResetDevicePic(); | ||
| 101 | DeviceStep2Ref?.value?.resetFields(); | 101 | DeviceStep2Ref?.value?.resetFields(); |
| 102 | } | 102 | } |
| 103 | // 提交 | 103 | // 提交 |
| @@ -230,8 +230,8 @@ | @@ -230,8 +230,8 @@ | ||
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | // 父组件重置图片 | 232 | // 父组件重置图片 |
| 233 | - function parentResetDevicePic() { | ||
| 234 | - devicePic.value = ''; | 233 | + function parentResetDevicePic(deviceInfo) { |
| 234 | + devicePic.value = deviceInfo.avatar; | ||
| 235 | } | 235 | } |
| 236 | // 父组件重置位置 | 236 | // 父组件重置位置 |
| 237 | function parentResetPositionState() { | 237 | function parentResetPositionState() { |
| @@ -228,7 +228,7 @@ export const formSchema: FormSchema[] = [ | @@ -228,7 +228,7 @@ export const formSchema: FormSchema[] = [ | ||
| 228 | component: 'InputTextArea', | 228 | component: 'InputTextArea', |
| 229 | }, | 229 | }, |
| 230 | { | 230 | { |
| 231 | - label: '租户id', | 231 | + label: '租户ID', |
| 232 | field: 'tenantId', | 232 | field: 'tenantId', |
| 233 | component: 'Input', | 233 | component: 'Input', |
| 234 | show: false, | 234 | show: false, |
| @@ -134,6 +134,7 @@ export const formSchema: FormSchema[] = [ | @@ -134,6 +134,7 @@ export const formSchema: FormSchema[] = [ | ||
| 134 | component: 'ApiTreeSelect', | 134 | component: 'ApiTreeSelect', |
| 135 | required: true, | 135 | required: true, |
| 136 | componentProps: { | 136 | componentProps: { |
| 137 | + multiple: true, | ||
| 137 | api: async () => { | 138 | api: async () => { |
| 138 | const data = await getOrganizationList(); | 139 | const data = await getOrganizationList(); |
| 139 | copyTransFun(data as any as any[]); | 140 | copyTransFun(data as any as any[]); |
| @@ -37,126 +37,6 @@ | @@ -37,126 +37,6 @@ | ||
| 37 | components: { BasicDrawer, BasicForm, Button }, | 37 | components: { BasicDrawer, BasicForm, Button }, |
| 38 | emits: ['success', 'register'], | 38 | emits: ['success', 'register'], |
| 39 | setup(_, { emit }) { | 39 | setup(_, { emit }) { |
| 40 | - // const isUpdate = ref(true); | ||
| 41 | - // // const pointArray = ref([] as any); | ||
| 42 | - // // const isJudgeWherePoint = ref(); | ||
| 43 | - // // const newArray = ref([]); | ||
| 44 | - // let getId = ref(''); | ||
| 45 | - // // let getOranAndDeptId = ref(null); | ||
| 46 | - // // let getAllData: any = reactive({}); | ||
| 47 | - // // let getAllEditData: any = reactive({}); | ||
| 48 | - // // let postAllEditData: any = reactive({}); | ||
| 49 | - // const [registerForm, { setFieldsValue, resetFields, validate, getFieldsValue }] = useForm({ | ||
| 50 | - // labelWidth: 120, | ||
| 51 | - // schemas: formSchema, | ||
| 52 | - // showActionButtonGroup: false, | ||
| 53 | - // }); | ||
| 54 | - // const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | ||
| 55 | - // await resetFields(); | ||
| 56 | - // setDrawerProps({ confirmLoading: false }); | ||
| 57 | - // isUpdate.value = !!data?.isUpdate; | ||
| 58 | - // //编辑 | ||
| 59 | - // if (unref(isUpdate)) { | ||
| 60 | - // getId.value = data.record.id; | ||
| 61 | - // await setFieldsValue({ | ||
| 62 | - // ...data.record, | ||
| 63 | - // receiverType: data.record.receiverType === '全部' ? '0' : '1', | ||
| 64 | - // organizationId: isDeptId.value, | ||
| 65 | - // }); | ||
| 66 | - // } | ||
| 67 | - // }); | ||
| 68 | - // const getTitle = computed(() => (!unref(isUpdate) ? '新增通知' : '编辑通知')); | ||
| 69 | - | ||
| 70 | - // watch(selectWhere, (nV) => { | ||
| 71 | - // isJudgeWherePoint.value = nV; | ||
| 72 | - // }); | ||
| 73 | - // watch(isDeptId, (nV) => { | ||
| 74 | - // getOranAndDeptId.value = nV; | ||
| 75 | - // }); | ||
| 76 | - // // 发布 | ||
| 77 | - // async function handleSend() { | ||
| 78 | - // // 直接新增通知 | ||
| 79 | - // if (!unref(isUpdate)) { | ||
| 80 | - // const values = await validate(); | ||
| 81 | - // Object.assign(getAllData, values); | ||
| 82 | - // switch (unref(isJudgeWherePoint)) { | ||
| 83 | - // case '0': | ||
| 84 | - // pointArray.value = []; | ||
| 85 | - // break; | ||
| 86 | - // case '1': | ||
| 87 | - // if (pointArray.value.length === 0) { | ||
| 88 | - // pointArray.value.push(getOranAndDeptId.value); | ||
| 89 | - // } | ||
| 90 | - // break; | ||
| 91 | - // } | ||
| 92 | - // getAllData.pointId = pointArray.value; | ||
| 93 | - // await notifyAddLeaseApi(getAllData); | ||
| 94 | - | ||
| 95 | - // resetFields(); | ||
| 96 | - // } else { | ||
| 97 | - // const values = await validate(); | ||
| 98 | - // getAllEditData = values; | ||
| 99 | - // getAllEditData.id = unref(getId); | ||
| 100 | - // switch (unref(isJudgeWherePoint)) { | ||
| 101 | - // case '0': | ||
| 102 | - // pointArray.value = []; | ||
| 103 | - // break; | ||
| 104 | - // case '1': | ||
| 105 | - // if (pointArray.value.length === 0) { | ||
| 106 | - // pointArray.value.push(getOranAndDeptId.value); | ||
| 107 | - // } | ||
| 108 | - // break; | ||
| 109 | - // } | ||
| 110 | - // getAllEditData.pointId = pointArray.value; | ||
| 111 | - // Object.assign(postAllEditData, getAllEditData); | ||
| 112 | - // await notifyAddLeaseApi(postAllEditData); | ||
| 113 | - // } | ||
| 114 | - // closeDrawer(); | ||
| 115 | - // createMessage.success('发布成功'); | ||
| 116 | - // emit('success'); | ||
| 117 | - // } | ||
| 118 | - // // 保存草稿 | ||
| 119 | - // async function handleSaveDraft() { | ||
| 120 | - // if (!unref(isUpdate)) { | ||
| 121 | - // const values = await validate(); | ||
| 122 | - // Object.assign(getAllData, values); | ||
| 123 | - // switch (isJudgeWherePoint.value) { | ||
| 124 | - // case '0': | ||
| 125 | - // pointArray.value = []; | ||
| 126 | - // break; | ||
| 127 | - // case '1': | ||
| 128 | - // if (pointArray.value.length === 0) { | ||
| 129 | - // pointArray.value.push(getOranAndDeptId.value); | ||
| 130 | - // } | ||
| 131 | - // break; | ||
| 132 | - // } | ||
| 133 | - // getAllData.pointId = pointArray.value; | ||
| 134 | - // await notifyAddDraftApi(getAllData); | ||
| 135 | - | ||
| 136 | - // resetFields(); | ||
| 137 | - // } else { | ||
| 138 | - // const values = await validate(); | ||
| 139 | - // getAllEditData = values; | ||
| 140 | - // getAllEditData.id = getId.value; | ||
| 141 | - // switch (isJudgeWherePoint.value) { | ||
| 142 | - // case '0': | ||
| 143 | - // pointArray.value = []; | ||
| 144 | - // break; | ||
| 145 | - // case '1': | ||
| 146 | - // if (pointArray.value.length === 0) { | ||
| 147 | - // pointArray.value.push(getOranAndDeptId.value); | ||
| 148 | - // } | ||
| 149 | - // break; | ||
| 150 | - // } | ||
| 151 | - // getAllEditData.pointId = pointArray.value; | ||
| 152 | - // Object.assign(postAllEditData, getAllEditData); | ||
| 153 | - // await notifyAddDraftApi(postAllEditData); | ||
| 154 | - // } | ||
| 155 | - // createMessage.success('保存草稿成功'); | ||
| 156 | - // closeDrawer(); | ||
| 157 | - // emit('success'); | ||
| 158 | - // } | ||
| 159 | - // 取消 | ||
| 160 | const { createMessage } = useMessage(); | 40 | const { createMessage } = useMessage(); |
| 161 | const isUpdate = ref<Boolean>(); | 41 | const isUpdate = ref<Boolean>(); |
| 162 | const getTitle = computed(() => (!unref(isUpdate) ? '新增通知' : '编辑通知')); | 42 | const getTitle = computed(() => (!unref(isUpdate) ? '新增通知' : '编辑通知')); |
| @@ -167,22 +47,24 @@ | @@ -167,22 +47,24 @@ | ||
| 167 | showActionButtonGroup: false, | 47 | showActionButtonGroup: false, |
| 168 | }); | 48 | }); |
| 169 | const [registerDrawer, { closeDrawer }] = useDrawerInner(async (data) => { | 49 | const [registerDrawer, { closeDrawer }] = useDrawerInner(async (data) => { |
| 50 | + await resetFields(); | ||
| 170 | isUpdate.value = data.isUpdate; | 51 | isUpdate.value = data.isUpdate; |
| 171 | //编辑 | 52 | //编辑 |
| 172 | - if (unref(isUpdate)) { | 53 | + if (data.isUpdate) { |
| 173 | noticeId.value = data.record.id; | 54 | noticeId.value = data.record.id; |
| 174 | - console.log(data.record); | ||
| 175 | - await setFieldsValue({ | ||
| 176 | - ...data.record, | ||
| 177 | - receiverType: data.record.receiverType === '全部' ? '0' : '1', | ||
| 178 | - }); | 55 | + Reflect.set(data.record, 'receiverType', data.record.receiverType === '全部' ? '0' : '1'); |
| 56 | + if (data.record.receiverType === '1') { | ||
| 57 | + const organizationId = data.record.pointId.split(','); | ||
| 58 | + Reflect.set(data.record, 'organizationId', organizationId); | ||
| 59 | + } | ||
| 60 | + setFieldsValue(data.record); | ||
| 179 | } | 61 | } |
| 180 | }); | 62 | }); |
| 181 | // 发布通知 | 63 | // 发布通知 |
| 182 | const handleSend = async () => { | 64 | const handleSend = async () => { |
| 183 | await validate(); | 65 | await validate(); |
| 184 | const field = getFieldsValue(); | 66 | const field = getFieldsValue(); |
| 185 | - const pointId = field.receiverType === '1' ? [field.organizationId] : []; | 67 | + const pointId = field.receiverType === '1' ? field.organizationId + '' : null; |
| 186 | // 新增情况 | 68 | // 新增情况 |
| 187 | if (!unref(isUpdate)) { | 69 | if (!unref(isUpdate)) { |
| 188 | const addNotice = { | 70 | const addNotice = { |
| @@ -206,7 +88,7 @@ | @@ -206,7 +88,7 @@ | ||
| 206 | const handleSaveDraft = async () => { | 88 | const handleSaveDraft = async () => { |
| 207 | await validate(); | 89 | await validate(); |
| 208 | const field = getFieldsValue(); | 90 | const field = getFieldsValue(); |
| 209 | - const pointId = field.receiverType === '1' ? [field.organizationId] : []; | 91 | + const pointId = field.receiverType === '1' ? field.organizationId + '' : null; |
| 210 | if (!unref(isUpdate)) { | 92 | if (!unref(isUpdate)) { |
| 211 | const saveDraft = { | 93 | const saveDraft = { |
| 212 | ...field, | 94 | ...field, |
| @@ -66,9 +66,7 @@ | @@ -66,9 +66,7 @@ | ||
| 66 | console.log(result); | 66 | console.log(result); |
| 67 | Reflect.set(data.record, 'roleIds', result); | 67 | Reflect.set(data.record, 'roleIds', result); |
| 68 | Reflect.set(data.record, 'password', '******'); | 68 | Reflect.set(data.record, 'password', '******'); |
| 69 | - setFieldsValue({ | ||
| 70 | - ...data.record, | ||
| 71 | - }); | 69 | + setFieldsValue(data.record); |
| 72 | }); | 70 | }); |
| 73 | const organizationParams = new RoleOrOrganizationParam(rowId.value, false, true); | 71 | const organizationParams = new RoleOrOrganizationParam(rowId.value, false, true); |
| 74 | checkGroup.value = await findCurrentUserRelation(organizationParams); | 72 | checkGroup.value = await findCurrentUserRelation(organizationParams); |
| 1 | import { getAllRoleList, isAccountExist } from '/@/api/system/system'; | 1 | import { getAllRoleList, isAccountExist } from '/@/api/system/system'; |
| 2 | import { BasicColumn } from '/@/components/Table'; | 2 | import { BasicColumn } from '/@/components/Table'; |
| 3 | import { FormSchema } from '/@/components/Table'; | 3 | import { FormSchema } from '/@/components/Table'; |
| 4 | -import { emailRule, phoneRule } from '/@/utils/rules'; | 4 | +import { emailRule, phoneRule, ChineseRegexp, EmailRegexp } from '/@/utils/rules'; |
| 5 | 5 | ||
| 6 | export const columns: BasicColumn[] = [ | 6 | export const columns: BasicColumn[] = [ |
| 7 | { | 7 | { |
| @@ -68,14 +68,14 @@ export const accountFormSchema: FormSchema[] = [ | @@ -68,14 +68,14 @@ export const accountFormSchema: FormSchema[] = [ | ||
| 68 | dynamicRules: ({ values }) => { | 68 | dynamicRules: ({ values }) => { |
| 69 | return [ | 69 | return [ |
| 70 | { | 70 | { |
| 71 | - message: '请输入用户名', | ||
| 72 | - required: true, | ||
| 73 | - }, | ||
| 74 | - { | ||
| 75 | validator(_, value) { | 71 | validator(_, value) { |
| 76 | return new Promise((resolve, reject) => { | 72 | return new Promise((resolve, reject) => { |
| 77 | if (value == '') { | 73 | if (value == '') { |
| 78 | reject('请输入用户名'); | 74 | reject('请输入用户名'); |
| 75 | + } else if (ChineseRegexp.test(value)) { | ||
| 76 | + reject('用户名不能含有中文'); | ||
| 77 | + } else if (EmailRegexp.test(value)) { | ||
| 78 | + reject('用户名不能为电子邮箱格式'); | ||
| 79 | } else { | 79 | } else { |
| 80 | if (values.username != undefined && values.id == undefined) { | 80 | if (values.username != undefined && values.id == undefined) { |
| 81 | isAccountExist(value).then((data) => { | 81 | isAccountExist(value).then((data) => { |
| @@ -37,26 +37,26 @@ | @@ -37,26 +37,26 @@ | ||
| 37 | }, | 37 | }, |
| 38 | { | 38 | { |
| 39 | field: 'username', | 39 | field: 'username', |
| 40 | - label: '账号:', | 40 | + label: '账号', |
| 41 | required: true, | 41 | required: true, |
| 42 | component: 'Input', | 42 | component: 'Input', |
| 43 | }, | 43 | }, |
| 44 | { | 44 | { |
| 45 | field: 'realName', | 45 | field: 'realName', |
| 46 | - label: '真实名字:', | 46 | + label: '真实名字', |
| 47 | required: true, | 47 | required: true, |
| 48 | component: 'Input', | 48 | component: 'Input', |
| 49 | }, | 49 | }, |
| 50 | { | 50 | { |
| 51 | field: 'phoneNumber', | 51 | field: 'phoneNumber', |
| 52 | - label: '电话号码:', | 52 | + label: '电话号码', |
| 53 | required: true, | 53 | required: true, |
| 54 | component: 'Input', | 54 | component: 'Input', |
| 55 | rules: phoneRule, | 55 | rules: phoneRule, |
| 56 | }, | 56 | }, |
| 57 | { | 57 | { |
| 58 | field: 'email', | 58 | field: 'email', |
| 59 | - label: '邮件:', | 59 | + label: '邮件', |
| 60 | required: true, | 60 | required: true, |
| 61 | component: 'Input', | 61 | component: 'Input', |
| 62 | rules: emailRule, | 62 | rules: emailRule, |
| @@ -86,11 +86,14 @@ | @@ -86,11 +86,14 @@ | ||
| 86 | await resetFields(); | 86 | await resetFields(); |
| 87 | isUpdate.value = !!data?.isUpdate; | 87 | isUpdate.value = !!data?.isUpdate; |
| 88 | tenantId.value = data?.tenantId; | 88 | tenantId.value = data?.tenantId; |
| 89 | - await updateSchema({ field: 'title', componentProps: { disabled: false } }); | 89 | + |
| 90 | if (unref(isUpdate)) { | 90 | if (unref(isUpdate)) { |
| 91 | + await updateSchema({ field: 'username', componentProps: { disabled: true } }); | ||
| 91 | await setFieldsValue({ | 92 | await setFieldsValue({ |
| 92 | ...data.record, | 93 | ...data.record, |
| 93 | }); | 94 | }); |
| 95 | + } else { | ||
| 96 | + await updateSchema({ field: 'username', componentProps: { disabled: false } }); | ||
| 94 | } | 97 | } |
| 95 | } | 98 | } |
| 96 | ); | 99 | ); |