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