Commit 875167bafa22445a8ce0508e32fbe6700f05671e
Merge branch 'fix/DEFECT-1753' into 'main_dev'
fix: 修复编辑产品品类成功后,没有提示框和产品品类删除报错 See merge request yunteng/thingskit-front!1010
Showing
8 changed files
with
51 additions
and
47 deletions
@@ -6,11 +6,13 @@ | @@ -6,11 +6,13 @@ | ||
6 | import { useForm, BasicForm } from '/@/components/Form'; | 6 | import { useForm, BasicForm } from '/@/components/Form'; |
7 | 7 | ||
8 | import { deviceProfileCategory } from '/@/api/device/classModal'; | 8 | import { deviceProfileCategory } from '/@/api/device/classModal'; |
9 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
9 | 10 | ||
10 | const emit = defineEmits(['handleReload', 'register']); | 11 | const emit = defineEmits(['handleReload', 'register']); |
11 | 12 | ||
12 | const isUpdate = ref<Boolean>(false); | 13 | const isUpdate = ref<Boolean>(false); |
13 | const getTitle = computed(() => (!unref(isUpdate) ? '新增分类' : '编辑分类')); | 14 | const getTitle = computed(() => (!unref(isUpdate) ? '新增分类' : '编辑分类')); |
15 | + const { createMessage } = useMessage(); | ||
14 | 16 | ||
15 | const [registerForm, { getFieldsValue, setFieldsValue, validate }] = useForm({ | 17 | const [registerForm, { getFieldsValue, setFieldsValue, validate }] = useForm({ |
16 | labelWidth: 140, | 18 | labelWidth: 140, |
@@ -43,8 +45,8 @@ | @@ -43,8 +45,8 @@ | ||
43 | if (unref(isUpdate)) { | 45 | if (unref(isUpdate)) { |
44 | values = { ...values, id: unref(recordInfo).id }; | 46 | values = { ...values, id: unref(recordInfo).id }; |
45 | } | 47 | } |
46 | - console.log(unref(isUpdate), values, 'values'); | ||
47 | await deviceProfileCategory(values); | 48 | await deviceProfileCategory(values); |
49 | + createMessage.success('操作成功'); | ||
48 | emit('handleReload'); | 50 | emit('handleReload'); |
49 | handleCancel(); | 51 | handleCancel(); |
50 | }; | 52 | }; |
src/views/device/classIfication/components/physicalModel.vue
deleted
100644 → 0
1 | -<script setup lang="ts"> | ||
2 | - import { ref } from 'vue'; | ||
3 | - import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | ||
4 | - import PhysicalModelManagementStep from '/@/views/device/profiles/step/PhysicalModelManagementStep.vue'; | ||
5 | - | ||
6 | - defineEmits(['register']); | ||
7 | - const record = ref<any>({}); | ||
8 | - const [register, {}] = useDrawerInner(async (data: { record: any }) => { | ||
9 | - record.value = { ...data.record, ifShowClass: true }; | ||
10 | - }); | ||
11 | -</script> | ||
12 | -<template> | ||
13 | - <BasicDrawer v-bind="$attrs" title="物模型" @register="register" width="60%" destroy-on-close> | ||
14 | - <PhysicalModelManagementStep :record="record" /> | ||
15 | - </BasicDrawer> | ||
16 | -</template> |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | import { useMessage } from '/@/hooks/web/useMessage'; | 7 | import { useMessage } from '/@/hooks/web/useMessage'; |
8 | import { Authority } from '/@/components/Authority'; | 8 | import { Authority } from '/@/components/Authority'; |
9 | import { useModal } from '/@/components/Modal'; | 9 | import { useModal } from '/@/components/Modal'; |
10 | - import { classModal, physicalModel } from './components/index'; | 10 | + import { classModal } from './components/index'; |
11 | import { useDrawer } from '/@/components/Drawer'; | 11 | import { useDrawer } from '/@/components/Drawer'; |
12 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | 12 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; |
13 | import { getAuthCache } from '/@/utils/auth'; | 13 | import { getAuthCache } from '/@/utils/auth'; |
@@ -17,6 +17,9 @@ | @@ -17,6 +17,9 @@ | ||
17 | deleteDeviceClass, | 17 | deleteDeviceClass, |
18 | deviceProfileCategory, | 18 | deviceProfileCategory, |
19 | } from '/@/api/device/classModal'; | 19 | } from '/@/api/device/classModal'; |
20 | + | ||
21 | + import { BasicDrawer } from '/@/components/Drawer'; | ||
22 | + import PhysicalModelManagementStep from '/@/views/device/profiles/step/PhysicalModelManagementStep.vue'; | ||
20 | const [ | 23 | const [ |
21 | registerTable, | 24 | registerTable, |
22 | { reload, setLoading, getSelectRowKeys, setSelectedRowKeys, getRowSelection }, | 25 | { reload, setLoading, getSelectRowKeys, setSelectedRowKeys, getRowSelection }, |
@@ -82,8 +85,13 @@ | @@ -82,8 +85,13 @@ | ||
82 | }; | 85 | }; |
83 | 86 | ||
84 | // 详情 | 87 | // 详情 |
88 | + const registerDetailRecord = ref<any>({}); | ||
85 | const handleDetail = (record?: any) => { | 89 | const handleDetail = (record?: any) => { |
86 | - openDrawer(true, { record }); | 90 | + openDrawer(true); |
91 | + registerDetailRecord.value = { | ||
92 | + ...record, | ||
93 | + ifShowClass: true, | ||
94 | + }; | ||
87 | }; | 95 | }; |
88 | 96 | ||
89 | // 状态->编辑 | 97 | // 状态->编辑 |
@@ -93,7 +101,7 @@ | @@ -93,7 +101,7 @@ | ||
93 | await deviceProfileCategory({ ...record, status: e }); | 101 | await deviceProfileCategory({ ...record, status: e }); |
94 | switchLoading.value = false; | 102 | switchLoading.value = false; |
95 | createMessage.success('操作成功'); | 103 | createMessage.success('操作成功'); |
96 | - reload(); | 104 | + handleReload(); |
97 | }; | 105 | }; |
98 | 106 | ||
99 | // 删除 | 107 | // 删除 |
@@ -177,6 +185,9 @@ | @@ -177,6 +185,9 @@ | ||
177 | </template> | 185 | </template> |
178 | </BasicTable> | 186 | </BasicTable> |
179 | <classModal @register="registerModal" @handleReload="handleReload" /> | 187 | <classModal @register="registerModal" @handleReload="handleReload" /> |
180 | - <physicalModel @register="registerDetailDrawer" /> | 188 | + <!-- <physicalModel @register="registerDetailDrawer" :record /> --> |
189 | + <BasicDrawer title="物模型" @register="registerDetailDrawer" width="60%" destroy-on-close> | ||
190 | + <PhysicalModelManagementStep :record="registerDetailRecord" /> | ||
191 | + </BasicDrawer> | ||
181 | </div> | 192 | </div> |
182 | </template> | 193 | </template> |
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | :maskClosable="false" | 4 | :maskClosable="false" |
5 | v-bind="$attrs" | 5 | v-bind="$attrs" |
6 | :width="dynamicWidth" | 6 | :width="dynamicWidth" |
7 | + :destroy-on-close="true" | ||
7 | @register="register" | 8 | @register="register" |
8 | @ok="handleSubmit" | 9 | @ok="handleSubmit" |
9 | @cancel="handleCancel" | 10 | @cancel="handleCancel" |
@@ -112,6 +113,7 @@ | @@ -112,6 +113,7 @@ | ||
112 | setModalProps({ confirmLoading: false }); | 113 | setModalProps({ confirmLoading: false }); |
113 | current.value = 0; | 114 | current.value = 0; |
114 | isUpdate.value = data.isUpdate; | 115 | isUpdate.value = data.isUpdate; |
116 | + console.log(isUpdate.value, 'isUpdate'); | ||
115 | isViewDetail.value = data.isView; | 117 | isViewDetail.value = data.isView; |
116 | const res = | 118 | const res = |
117 | data.record !== undefined | 119 | data.record !== undefined |
@@ -25,6 +25,9 @@ | @@ -25,6 +25,9 @@ | ||
25 | formConfig: { | 25 | formConfig: { |
26 | schemas: searchFormSchema, | 26 | schemas: searchFormSchema, |
27 | }, | 27 | }, |
28 | + searchInfo: { | ||
29 | + status: 1, | ||
30 | + }, | ||
28 | useSearchForm: true, | 31 | useSearchForm: true, |
29 | showTableSetting: false, | 32 | showTableSetting: false, |
30 | bordered: true, | 33 | bordered: true, |
@@ -129,7 +129,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -129,7 +129,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
129 | field: 'name', | 129 | field: 'name', |
130 | label: '', | 130 | label: '', |
131 | component: 'Input', | 131 | component: 'Input', |
132 | - colProps: { span: 10 }, | 132 | + colProps: { span: 9 }, |
133 | componentProps: { | 133 | componentProps: { |
134 | placeholder: '请输入品类名称', | 134 | placeholder: '请输入品类名称', |
135 | }, | 135 | }, |
@@ -87,25 +87,8 @@ | @@ -87,25 +87,8 @@ | ||
87 | }); | 87 | }); |
88 | } | 88 | } |
89 | const { image, ...params } = v; | 89 | const { image, ...params } = v; |
90 | - console.log(image); | 90 | + console.log(image, props.isUpdate); |
91 | setFieldsValue({ ...params, category: params?.categoryId ? 1 : 2 }); | 91 | setFieldsValue({ ...params, category: params?.categoryId ? 1 : 2 }); |
92 | - updateSchema({ | ||
93 | - field: 'category', | ||
94 | - componentProps({ formModel }) { | ||
95 | - return { | ||
96 | - options: [ | ||
97 | - { label: '自定义品类', value: 2 }, | ||
98 | - { label: '标准品类', value: 1 }, | ||
99 | - ], | ||
100 | - onChange() { | ||
101 | - formModel.categoryId = null; | ||
102 | - formModel.categoryName = undefined; | ||
103 | - }, | ||
104 | - disabled: true, | ||
105 | - }; | ||
106 | - }, | ||
107 | - }); | ||
108 | - cateGoryDisabled.value = true; | ||
109 | }; | 92 | }; |
110 | //获取数据 | 93 | //获取数据 |
111 | async function getFormData() { | 94 | async function getFormData() { |
@@ -124,12 +107,32 @@ | @@ -124,12 +107,32 @@ | ||
124 | }; | 107 | }; |
125 | 108 | ||
126 | const editOrAddDeviceTypeStatus = (status: boolean) => { | 109 | const editOrAddDeviceTypeStatus = (status: boolean) => { |
127 | - updateSchema({ | ||
128 | - field: 'deviceType', | ||
129 | - componentProps: { | ||
130 | - disabled: status, | 110 | + updateSchema([ |
111 | + { | ||
112 | + field: 'deviceType', | ||
113 | + componentProps: { | ||
114 | + disabled: status, | ||
115 | + }, | ||
131 | }, | 116 | }, |
132 | - }); | 117 | + { |
118 | + field: 'category', | ||
119 | + componentProps({ formModel }) { | ||
120 | + return { | ||
121 | + options: [ | ||
122 | + { label: '自定义品类', value: 2 }, | ||
123 | + { label: '标准品类', value: 1 }, | ||
124 | + ], | ||
125 | + onChange() { | ||
126 | + formModel.categoryId = null; | ||
127 | + formModel.categoryName = undefined; | ||
128 | + }, | ||
129 | + disabled: status, | ||
130 | + }; | ||
131 | + }, | ||
132 | + }, | ||
133 | + ]); | ||
134 | + | ||
135 | + cateGoryDisabled.value = status; | ||
133 | }; | 136 | }; |
134 | 137 | ||
135 | // 查看功能 | 138 | // 查看功能 |