Commit 788b0c8c615f78a0e80f824471d69072dcf6846b

Authored by fengwotao
2 parents 5e110fdb 7f439937

Merge branch 'main_dev' into ft

@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 import { Divider, Button } from 'ant-design-vue'; 13 import { Divider, Button } from 'ant-design-vue';
14 import { OpenModalMode, OpenModalParams, StructRecord } from './type'; 14 import { OpenModalMode, OpenModalParams, StructRecord } from './type';
15 import { cloneDeep } from 'lodash-es'; 15 import { cloneDeep } from 'lodash-es';
  16 + import { isArray } from '/@/utils/is';
16 17
17 const emit = defineEmits(['update:value']); 18 const emit = defineEmits(['update:value']);
18 19
@@ -30,7 +31,8 @@ @@ -30,7 +31,8 @@
30 31
31 const getValue = computed<StructRecord[]>(() => { 32 const getValue = computed<StructRecord[]>(() => {
32 const { value } = props; 33 const { value } = props;
33 - return value.map((item) => { 34 +
  35 + return (isArray(value) ? value : []).map((item) => {
34 return { 36 return {
35 ...(item as StructRecord), 37 ...(item as StructRecord),
36 ...((item as StructRecord).id ? {} : { id: buildUUID() }), 38 ...((item as StructRecord).id ? {} : { id: buildUUID() }),
@@ -65,7 +65,7 @@ export const formSchemas = (hasStructForm: boolean): FormSchema[] => { @@ -65,7 +65,7 @@ export const formSchemas = (hasStructForm: boolean): FormSchema[] => {
65 }, 65 },
66 defaultValue: 'INT', 66 defaultValue: 'INT',
67 componentProps: ({ formActionType }) => { 67 componentProps: ({ formActionType }) => {
68 - const { updateSchema } = formActionType; 68 + const { updateSchema, setFieldsValue } = formActionType;
69 return { 69 return {
70 placeholder: '请选择数据类型', 70 placeholder: '请选择数据类型',
71 api: async (params: Recordable) => { 71 api: async (params: Recordable) => {
@@ -86,13 +86,15 @@ export const formSchemas = (hasStructForm: boolean): FormSchema[] => { @@ -86,13 +86,15 @@ export const formSchemas = (hasStructForm: boolean): FormSchema[] => {
86 valueField: 'itemValue', 86 valueField: 'itemValue',
87 getPopupContainer: () => document.body, 87 getPopupContainer: () => document.body,
88 onChange: (value: string) => { 88 onChange: (value: string) => {
89 - value === DataTypeEnum.IS_STRUCT && 89 + if (value == DataTypeEnum.IS_STRUCT) {
90 updateSchema({ 90 updateSchema({
91 field: FormField.SPECS_LIST, 91 field: FormField.SPECS_LIST,
92 componentProps: { 92 componentProps: {
93 hasStructForm: true, 93 hasStructForm: true,
94 }, 94 },
95 }); 95 });
  96 + setFieldsValue({ [FormField.SPECS_LIST]: [] });
  97 + }
96 }, 98 },
97 }; 99 };
98 }, 100 },
@@ -120,7 +120,12 @@ @@ -120,7 +120,12 @@
120 setFormData(record.functionType, record as unknown as ModelOfMatterParams); 120 setFormData(record.functionType, record as unknown as ModelOfMatterParams);
121 } 121 }
122 if (unref(openModalMode) === OpenModelMode.VIEW) { 122 if (unref(openModalMode) === OpenModelMode.VIEW) {
123 - setModalProps({ showOkBtn: false, showCancelBtn: false, title: '查看物模型' }); 123 + setModalProps({
  124 + showOkBtn: false,
  125 + showCancelBtn: false,
  126 + title: '查看物模型',
  127 + footer: null,
  128 + });
124 } else { 129 } else {
125 const title = unref(openModalMode) === OpenModelMode.UPDATE ? '编辑物模型' : '新增物模型'; 130 const title = unref(openModalMode) === OpenModelMode.UPDATE ? '编辑物模型' : '新增物模型';
126 setModalProps({ title, showOkBtn: true, showCancelBtn: true }); 131 setModalProps({ title, showOkBtn: true, showCancelBtn: true });