Commit 6a16981a7234068b8ca365bc8d9bdb6eee5f6410
Merge branch 'ww' into 'main'
fix: device detail query history data infinity loading See merge request huang/yun-teng-iot-front!439
Showing
7 changed files
with
40 additions
and
32 deletions
| ... | ... | @@ -406,12 +406,12 @@ export const step2Schemas: FormSchema[] = [ |
| 406 | 406 | }, |
| 407 | 407 | { |
| 408 | 408 | label: 'RSA公钥', |
| 409 | - component: 'Input', | |
| 409 | + component: 'InputTextArea', | |
| 410 | 410 | field: 'publicKey', |
| 411 | 411 | required: true, |
| 412 | 412 | ifShow: false, |
| 413 | 413 | componentProps: { |
| 414 | - maxLength: 36, | |
| 414 | + rows: 8, | |
| 415 | 415 | placeholder: '请输入RSA公钥', |
| 416 | 416 | }, |
| 417 | 417 | }, |
| ... | ... | @@ -604,12 +604,12 @@ export const TokenSchemas: FormSchema[] = [ |
| 604 | 604 | }, |
| 605 | 605 | { |
| 606 | 606 | label: 'RSA公钥', |
| 607 | - component: 'Input', | |
| 607 | + component: 'InputTextArea', | |
| 608 | 608 | field: 'publicKey', |
| 609 | 609 | required: true, |
| 610 | 610 | ifShow: false, |
| 611 | 611 | componentProps: { |
| 612 | - maxLength: 36, | |
| 612 | + rows: 8, | |
| 613 | 613 | placeholder: '请输入RSA公钥', |
| 614 | 614 | }, |
| 615 | 615 | }, | ... | ... |
| ... | ... | @@ -108,6 +108,7 @@ |
| 108 | 108 | entityId: props.deviceDetail.tbDeviceId, |
| 109 | 109 | }); |
| 110 | 110 | historyData.value = getTableHistoryData(res); |
| 111 | + loading.value = false; | |
| 111 | 112 | // 判断数据对象是否为空 |
| 112 | 113 | if (!Object.keys(res).length) { |
| 113 | 114 | isNull.value = false; |
| ... | ... | @@ -121,7 +122,6 @@ |
| 121 | 122 | ); |
| 122 | 123 | |
| 123 | 124 | setOptions(setChartOptions(res, selectedKeys)); |
| 124 | - loading.value = false; | |
| 125 | 125 | }, |
| 126 | 126 | }); |
| 127 | 127 | ... | ... |
| ... | ... | @@ -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> | ... | ... |
| ... | ... | @@ -522,14 +522,12 @@ export const actionSchema: FormSchema[] = [ |
| 522 | 522 | const { setFieldsValue } = formActionType; |
| 523 | 523 | return { |
| 524 | 524 | placeholder: '请选择类型', |
| 525 | - api: async () => { | |
| 526 | - const record = await findDictItemByCode({ | |
| 527 | - dictCode: 'custom_define', | |
| 528 | - }); | |
| 529 | - return record.map((item) => ({ ...item, itemValue: Number(item.itemValue) })); | |
| 530 | - }, | |
| 525 | + api: findDictItemByCode, | |
| 531 | 526 | labelField: 'itemText', |
| 532 | 527 | valueField: 'itemValue', |
| 528 | + params: { | |
| 529 | + dictCode: 'custom_define', | |
| 530 | + }, | |
| 533 | 531 | getPopupContainer: () => document.body, |
| 534 | 532 | onChange: () => { |
| 535 | 533 | setFieldsValue({ doContext: null, thingsModelId: null }); | ... | ... |