Commit ab1ac65baf17250145a4a1576dba16b4e03f4d98
1 parent
0e9d85b5
fix: disabled device type select && transport type select on edit mode in product profile modal
Showing
4 changed files
with
31 additions
and
21 deletions
| ... | ... | @@ -107,21 +107,16 @@ |
| 107 | 107 | const res = data.record !== undefined ? await deviceConfigGetDetail(data.record.id) : {}; |
| 108 | 108 | isEditId.value = data.record !== undefined ? data.record.id : null; |
| 109 | 109 | isEditCreatTime.value = data.record !== undefined ? data.record.createTime : null; |
| 110 | - if (!unref(isViewDetail)) { | |
| 111 | - dynamicWidth.value = 55 + 'rem'; | |
| 112 | - const title = !unref(isUpdate) ? '编辑产品' : '新增产品'; | |
| 113 | - setModalProps({ title, showOkBtn: true, showCancelBtn: true }); | |
| 114 | - if (!unref(isUpdate)) { | |
| 115 | - await setDeviceConfEditFormData(res); | |
| 116 | - await setTransConfEditFormData(res); | |
| 117 | - handleStepNext(false, res); | |
| 118 | - } | |
| 119 | - } else { | |
| 120 | - dynamicWidth.value = 60 + 'rem'; | |
| 121 | - setModalProps({ showOkBtn: false, showCancelBtn: false, title: '产品详情' }); | |
| 110 | + | |
| 111 | + const title = unref(isUpdate) ? '编辑产品' : '新增产品'; | |
| 112 | + setModalProps({ title, showOkBtn: true, showCancelBtn: true }); | |
| 113 | + if (unref(isUpdate)) { | |
| 122 | 114 | await setDeviceConfEditFormData(res); |
| 123 | 115 | await setTransConfEditFormData(res); |
| 124 | 116 | handleStepNext(false, res); |
| 117 | + unref(DevConStRef)?.editOrAddDeviceTypeStatus(true); | |
| 118 | + } else { | |
| 119 | + unref(DevConStRef)?.editOrAddDeviceTypeStatus(false); | |
| 125 | 120 | } |
| 126 | 121 | }); |
| 127 | 122 | const handleChange = (e) => { |
| ... | ... | @@ -132,6 +127,9 @@ |
| 132 | 127 | const handleStepNext = (e, data) => { |
| 133 | 128 | if (e) { |
| 134 | 129 | current.value++; |
| 130 | + unref(isUpdate) | |
| 131 | + ? unref(TransConStRef)?.editOrAddTransportTypeStatus(true) | |
| 132 | + : unref(TransConStRef)?.editOrAddTransportTypeStatus(false); | |
| 135 | 133 | } else { |
| 136 | 134 | setTransConfEditFormData(data); |
| 137 | 135 | } | ... | ... |
| ... | ... | @@ -244,16 +244,14 @@ |
| 244 | 244 | //新增 |
| 245 | 245 | function handleCreate() { |
| 246 | 246 | openModal(true, { |
| 247 | - isUpdate: true, | |
| 248 | - isView: false, | |
| 247 | + isUpdate: false, | |
| 249 | 248 | }); |
| 250 | 249 | } |
| 251 | 250 | //编辑 |
| 252 | 251 | function handleEdit(record: Recordable) { |
| 253 | 252 | openModal(true, { |
| 254 | 253 | record, |
| 255 | - isUpdate: false, | |
| 256 | - isView: false, | |
| 254 | + isUpdate: true, | |
| 257 | 255 | }); |
| 258 | 256 | } |
| 259 | 257 | |
| ... | ... | @@ -261,11 +259,6 @@ |
| 261 | 259 | //详情 |
| 262 | 260 | function handleDetailView(record: Recordable) { |
| 263 | 261 | openDrawer(true, { record }); |
| 264 | - // openModal(true, { | |
| 265 | - // record, | |
| 266 | - // isUpdate: false, | |
| 267 | - // isView: true, | |
| 268 | - // }); | |
| 269 | 262 | } |
| 270 | 263 | |
| 271 | 264 | function defaultHeader({ filename, bookType }: ExportModalResult) { | ... | ... |
| ... | ... | @@ -113,11 +113,21 @@ |
| 113 | 113 | deviceConfigPic.value = ''; |
| 114 | 114 | }; |
| 115 | 115 | |
| 116 | + const editOrAddDeviceTypeStatus = (status: boolean) => { | |
| 117 | + updateSchema({ | |
| 118 | + field: 'deviceType', | |
| 119 | + componentProps: { | |
| 120 | + disabled: status, | |
| 121 | + }, | |
| 122 | + }); | |
| 123 | + }; | |
| 124 | + | |
| 116 | 125 | defineExpose({ |
| 117 | 126 | editOrAddNameStatus, |
| 118 | 127 | setFormData, |
| 119 | 128 | resetFormData, |
| 120 | 129 | getFormData, |
| 130 | + editOrAddDeviceTypeStatus, | |
| 121 | 131 | }); |
| 122 | 132 | </script> |
| 123 | 133 | <style lang="less" scoped> | ... | ... |
| ... | ... | @@ -147,10 +147,19 @@ |
| 147 | 147 | return step2Data; |
| 148 | 148 | }; |
| 149 | 149 | |
| 150 | + const editOrAddTransportTypeStatus = (status: boolean) => { | |
| 151 | + updateSchema({ | |
| 152 | + field: 'transportType', | |
| 153 | + componentProps: { | |
| 154 | + disabled: status, | |
| 155 | + }, | |
| 156 | + }); | |
| 157 | + }; | |
| 150 | 158 | defineExpose({ |
| 151 | 159 | getFormData, |
| 152 | 160 | resetFormData, |
| 153 | 161 | setFormData, |
| 162 | + editOrAddTransportTypeStatus, | |
| 154 | 163 | }); |
| 155 | 164 | </script> |
| 156 | 165 | <style lang="less" scoped> | ... | ... |