Showing
5 changed files
with
34 additions
and
13 deletions
@@ -5,14 +5,14 @@ import { DictEnum } from '/@/enums/dictEnum'; | @@ -5,14 +5,14 @@ import { DictEnum } from '/@/enums/dictEnum'; | ||
5 | 5 | ||
6 | export const columns: BasicColumn[] = [ | 6 | export const columns: BasicColumn[] = [ |
7 | { | 7 | { |
8 | - title: '领域', | ||
9 | - dataIndex: 'dictItemName', | ||
10 | - }, | ||
11 | - { | ||
12 | title: '名称', | 8 | title: '名称', |
13 | dataIndex: 'name', | 9 | dataIndex: 'name', |
14 | }, | 10 | }, |
15 | { | 11 | { |
12 | + title: '领域', | ||
13 | + dataIndex: 'dictItemName', | ||
14 | + }, | ||
15 | + { | ||
16 | title: '状态', | 16 | title: '状态', |
17 | dataIndex: 'status', | 17 | dataIndex: 'status', |
18 | slots: { customRender: 'status' }, | 18 | slots: { customRender: 'status' }, |
@@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
45 | rowSelection: { | 45 | rowSelection: { |
46 | type: 'checkbox', | 46 | type: 'checkbox', |
47 | getCheckboxProps: (record: any) => { | 47 | getCheckboxProps: (record: any) => { |
48 | - return { disabled: !!record.customerId }; | 48 | + return { disabled: !!record.status }; |
49 | }, | 49 | }, |
50 | }, | 50 | }, |
51 | }); | 51 | }); |
@@ -166,6 +166,7 @@ | @@ -166,6 +166,7 @@ | ||
166 | auth: 'api:yt:product:category:delete', | 166 | auth: 'api:yt:product:category:delete', |
167 | icon: 'ant-design:delete-outlined', | 167 | icon: 'ant-design:delete-outlined', |
168 | ifShow: authBtn(role) && !record.status, | 168 | ifShow: authBtn(role) && !record.status, |
169 | + color: 'error', | ||
169 | popConfirm: { | 170 | popConfirm: { |
170 | title: '是否确认删除', | 171 | title: '是否确认删除', |
171 | confirm: handleDelete.bind(null, record), | 172 | confirm: handleDelete.bind(null, record), |
@@ -240,7 +240,7 @@ export const step1Schemas: FormSchema[] = [ | @@ -240,7 +240,7 @@ export const step1Schemas: FormSchema[] = [ | ||
240 | field: 'categoryId', | 240 | field: 'categoryId', |
241 | label: '产品品类', | 241 | label: '产品品类', |
242 | component: 'Input', | 242 | component: 'Input', |
243 | - defaultValue: 1, | 243 | + defaultValue: undefined, |
244 | ifShow: false, | 244 | ifShow: false, |
245 | }, | 245 | }, |
246 | { | 246 | { |
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | v-model:value="model.categoryName" | 7 | v-model:value="model.categoryName" |
8 | placeholder="请选择所属品类" | 8 | placeholder="请选择所属品类" |
9 | style="width: 300px" | 9 | style="width: 300px" |
10 | + :disabled="cateGoryDisabled" | ||
10 | @focus="handleFocus" | 11 | @focus="handleFocus" |
11 | /> | 12 | /> |
12 | <Button type="link" :disabled="!model.categoryName" @click="handleCategoryId" | 13 | <Button type="link" :disabled="!model.categoryName" @click="handleCategoryId" |
@@ -58,6 +59,8 @@ | @@ -58,6 +59,8 @@ | ||
58 | submitFunc: customSubmitFunc, | 59 | submitFunc: customSubmitFunc, |
59 | }); | 60 | }); |
60 | 61 | ||
62 | + const cateGoryDisabled = ref<boolean>(false); | ||
63 | + | ||
61 | const editOrAddNameStatus = (nameStatus) => | 64 | const editOrAddNameStatus = (nameStatus) => |
62 | updateSchema({ | 65 | updateSchema({ |
63 | field: 'name', | 66 | field: 'name', |
@@ -77,7 +80,7 @@ | @@ -77,7 +80,7 @@ | ||
77 | emits('emitDeviceType', values?.deviceType); | 80 | emits('emitDeviceType', values?.deviceType); |
78 | } | 81 | } |
79 | //回显数据 | 82 | //回显数据 |
80 | - const setFormData = (v) => { | 83 | + const setFormData = async (v) => { |
81 | if (v.image) { | 84 | if (v.image) { |
82 | setFieldsValue({ | 85 | setFieldsValue({ |
83 | image: [{ uid: buildUUID(), name: 'name', url: v.image } as FileItem], | 86 | image: [{ uid: buildUUID(), name: 'name', url: v.image } as FileItem], |
@@ -86,6 +89,23 @@ | @@ -86,6 +89,23 @@ | ||
86 | const { image, ...params } = v; | 89 | const { image, ...params } = v; |
87 | console.log(image); | 90 | console.log(image); |
88 | 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; | ||
89 | }; | 109 | }; |
90 | //获取数据 | 110 | //获取数据 |
91 | async function getFormData() { | 111 | async function getFormData() { |
@@ -168,23 +168,23 @@ | @@ -168,23 +168,23 @@ | ||
168 | params.deviceProfileId = props.record.id; | 168 | params.deviceProfileId = props.record.id; |
169 | 169 | ||
170 | if (unref(openModalMode) === OpenModelMode.CREATE) { | 170 | if (unref(openModalMode) === OpenModelMode.CREATE) { |
171 | - (await (unref(isSysadmin) || unref(isPlatformAdmin))) && props.record.ifShowClass | ||
172 | - ? createModelCategory({ | 171 | + (unref(isSysadmin) || unref(isPlatformAdmin)) && props.record.ifShowClass |
172 | + ? await createModelCategory({ | ||
173 | ...params, | 173 | ...params, |
174 | deviceProfileId: undefined, | 174 | deviceProfileId: undefined, |
175 | categoryId: props.record.id, | 175 | categoryId: props.record.id, |
176 | }) | 176 | }) |
177 | - : createModel(params); | 177 | + : await createModel(params); |
178 | createMessage.success('创建成功'); | 178 | createMessage.success('创建成功'); |
179 | } else { | 179 | } else { |
180 | params.id = unref(openModalParams)?.record.id; | 180 | params.id = unref(openModalParams)?.record.id; |
181 | - (await (unref(isSysadmin) || unref(isPlatformAdmin))) && props.record.ifShowClass | ||
182 | - ? updateModelCategory({ | 181 | + (unref(isSysadmin) || unref(isPlatformAdmin)) && props.record.ifShowClass |
182 | + ? await updateModelCategory({ | ||
183 | ...params, | 183 | ...params, |
184 | deviceProfileId: undefined, | 184 | deviceProfileId: undefined, |
185 | categoryId: props.record.id, | 185 | categoryId: props.record.id, |
186 | }) | 186 | }) |
187 | - : updateModel(params); | 187 | + : await updateModel(params); |
188 | createMessage.success('修改成功'); | 188 | createMessage.success('修改成功'); |
189 | } | 189 | } |
190 | closeModal(); | 190 | closeModal(); |