Commit ce98d2ab771d12a1af44a1833980e40cc4916651

Authored by loveumiko
1 parent 9459700a

fix: 修复产品编辑和新增产品品类禁用的问题

... ... @@ -4,6 +4,7 @@
4 4 :maskClosable="false"
5 5 v-bind="$attrs"
6 6 :width="dynamicWidth"
  7 + :destroy-on-close="true"
7 8 @register="register"
8 9 @ok="handleSubmit"
9 10 @cancel="handleCancel"
... ... @@ -112,6 +113,7 @@
112 113 setModalProps({ confirmLoading: false });
113 114 current.value = 0;
114 115 isUpdate.value = data.isUpdate;
  116 + console.log(isUpdate.value, 'isUpdate');
115 117 isViewDetail.value = data.isView;
116 118 const res =
117 119 data.record !== undefined
... ...
... ... @@ -25,6 +25,9 @@
25 25 formConfig: {
26 26 schemas: searchFormSchema,
27 27 },
  28 + searchInfo: {
  29 + status: 1,
  30 + },
28 31 useSearchForm: true,
29 32 showTableSetting: false,
30 33 bordered: true,
... ...
... ... @@ -129,7 +129,7 @@ export const searchFormSchema: FormSchema[] = [
129 129 field: 'name',
130 130 label: '',
131 131 component: 'Input',
132   - colProps: { span: 10 },
  132 + colProps: { span: 9 },
133 133 componentProps: {
134 134 placeholder: '请输入品类名称',
135 135 },
... ...
... ... @@ -87,25 +87,8 @@
87 87 });
88 88 }
89 89 const { image, ...params } = v;
90   - console.log(image);
  90 + console.log(image, props.isUpdate);
91 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 94 async function getFormData() {
... ... @@ -124,12 +107,32 @@
124 107 };
125 108
126 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 // 查看功能
... ...