Commit 788b0c8c615f78a0e80f824471d69072dcf6846b

Authored by fengwotao
2 parents 5e110fdb 7f439937

Merge branch 'main_dev' into ft

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