From bb1f9ebd40b18a99d0709271481092bc94a3a93c Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期二, 04 六月 2024 21:15:02 +0800 Subject: [PATCH] 低代码更新 --- src/views/tigerprojects/system/lowcode/setting/pageDetail.vue | 531 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 480 insertions(+), 51 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/setting/pageDetail.vue b/src/views/tigerprojects/system/lowcode/setting/pageDetail.vue index b97d7c7..07e88dd 100644 --- a/src/views/tigerprojects/system/lowcode/setting/pageDetail.vue +++ b/src/views/tigerprojects/system/lowcode/setting/pageDetail.vue @@ -54,11 +54,27 @@ style="width: 20%" :options="options" :readonly="true" + @change="(value, option) => searchOnChange(value, option, field)" /> </a-input-group> </template> <template #[item]="{ model, field }" v-for="item in swSlots" :key="item"> <a-switch v-model:checked="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in searchApiSlots" :key="item"> + <a-input v-model:value="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in searchParamsSlots" :key="item"> + <a-input v-model:value="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in searchResultFieldSlots" :key="item"> + <a-input v-model:value="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in searchLabelFieldSlots" :key="item"> + <a-input v-model:value="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in searchValueFieldSlots" :key="item"> + <a-input v-model:value="model[field]" /> </template> </BasicForm> </a-card> @@ -120,6 +136,9 @@ <template #[item]="{ model, field }" v-for="item in mainwSwSlots" :key="item"> <a-switch v-model:checked="model[field]" /> </template> + <template #[item]="{ model, field }" v-for="item in mainIaSlots" :key="item"> + <a-input v-model:value="model[field]" /> + </template> </BasicForm> </div> </a-card> @@ -175,6 +194,7 @@ style="width: 20%" :options="options" :readonly="true" + @change="(value, option) => componentChange(value, option, field)" /> </a-input-group> </template> @@ -183,6 +203,27 @@ </template> <template #[item]="{ model, field }" v-for="item in crudrSwSlots" :key="item"> <a-switch v-model:checked="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in crudApiSlots" :key="item"> + <a-input v-model:value="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in crudParamsSlots" :key="item"> + <a-input v-model:value="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in crudResultFieldSlots" :key="item"> + <a-input v-model:value="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in crudLabelFieldSlots" :key="item"> + <a-input v-model:value="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in crudValueFieldSlots" :key="item"> + <a-input v-model:value="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in crudOptionsSlots" :key="item"> + <a-input v-model:value="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in crudOnChangeSlots" :key="item"> + <a-input v-model:value="model[field]" /> </template> </BasicForm> </a-card> @@ -194,8 +235,8 @@ </PageWrapper> </template> <script lang="ts" setup> - import { BasicForm, useForm } from '/@/components/Form'; - import { onMounted, ref, unref } from 'vue'; + import { BasicForm, FormSchema, useForm } from '/@/components/Form'; + import { nextTick, onMounted, ref, unref } from 'vue'; import { Card, InputGroup, Select, Input, Switch } from 'ant-design-vue'; import { ApiSelect } from '/@/components/Form/index'; import { useRoute, useRouter } from 'vue-router'; @@ -208,7 +249,7 @@ import { SelectTypes } from 'ant-design-vue/es/select'; import { useMultipleTabStore } from '/@/store/modules/multipleTab'; import { useModal } from '/@/components/Modal'; - import { SaveEntity, getEntityPropertieList } from '/@/api/tigerapi/system'; + import { SaveEntity, getEntity, getEntityPropertieList } from '/@/api/tigerapi/system'; import { EntityPropertie, SYS_LOW_CODE } from '/@/api/tigerapi/model/systemModel'; import { isNullOrEmpty } from '/@/utils/is'; import { useUserStore } from '/@/store/modules/user'; @@ -249,7 +290,7 @@ validate, }, ] = useForm({ - labelWidth: 120, + labelWidth: 130, baseColProps: { span: 24, }, @@ -266,7 +307,7 @@ validate: crudvalidate, }, ] = useForm({ - labelWidth: 120, + labelWidth: 130, baseColProps: { span: 24, }, @@ -283,31 +324,51 @@ validate: validateMainForm, }, ] = useForm({ - labelWidth: 120, + labelWidth: 130, baseColProps: { span: 24, }, schemas: mainSchemas, showActionButtonGroup: false, }); + /* 鏌ヨ */ + const SearchEntName = ref(''); const objInputs = ref({} as { [key: string]: any }); - const mainInputs = ref({} as { [key: string]: any }); - const crudInputs = ref({} as { [key: string]: any }); const searchProperties = ref([] as EntityPropertie[]); - const mainProperties = ref([] as EntityPropertie[]); - const crudProperties = ref([] as EntityPropertie[]); const searchSlots = ref([] as string[]); - const mainSlots = ref([] as string[]); - const crudSlots = ref([] as string[]); + const searchSelectVals = ref({} as { [key: string]: any }); const swSlots = ref([] as string[]); + const searchApiSlots = ref([] as string[]); + const searchParamsSlots = ref([] as string[]); + const searchResultFieldSlots = ref([] as string[]); + const searchLabelFieldSlots = ref([] as string[]); + const searchValueFieldSlots = ref([] as string[]); + /* 涓昏〃 */ + const MainEntName = ref(''); + const mainSelectVals = ref({} as { [key: string]: any }); + const mainProperties = ref([] as EntityPropertie[]); + const mainInputs = ref({} as { [key: string]: any }); + const mainSlots = ref([] as string[]); const mainSwSlots = ref([] as string[]); - const crudSwSlots = ref([] as string[]); const mainsSwSlots = ref([] as string[]); const mainwSwSlots = ref([] as string[]); - const crudrSwSlots = ref([] as string[]); - const searchSelectVals = ref({} as { [key: string]: any }); - const mainSelectVals = ref({} as { [key: string]: any }); + const mainIaSlots = ref([] as string[]); + /* 澧炲垹鏀� */ + const CrudEntName = ref(''); + const crudInputs = ref({} as { [key: string]: any }); + const crudProperties = ref([] as EntityPropertie[]); const crudSelectVals = ref({} as { [key: string]: any }); + const crudSlots = ref([] as string[]); + const crudSwSlots = ref([] as string[]); + const crudrSwSlots = ref([] as string[]); + const crudApiSlots = ref([] as string[]); + const crudParamsSlots = ref([] as string[]); + const crudResultFieldSlots = ref([] as string[]); + const crudLabelFieldSlots = ref([] as string[]); + const crudValueFieldSlots = ref([] as string[]); + const crudOptionsSlots = ref([] as string[]); + const crudOnChangeSlots = ref([] as string[]); + const options = ref<SelectTypes['options']>([ { value: 'Input', @@ -334,17 +395,115 @@ label: 'Checkbox', }, { - value: 'TimePicker', + value: 'RangePicker', label: '鏃堕棿閫夋嫨鍣�', }, { value: 'Switch', label: '寮�鍏�', }, + { + value: 'PoPSelect', + label: '寮瑰嚭閫夋嫨妗�', + }, ]); - onMounted(async () => { - - + onMounted(() => { + if (unref(objParams.value.Update) == '1') { + getEntity({ + sqlcmd: "ID ='" + objParams.value.ID + "'", + entityName: 'SYS_LOW_CODE', + }).then((data) => { + var searchForms = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON); + SearchEntName.value = data.Data.Items[0].SEARCH_ASSY_NAME; + setFieldsValue({ ASSEMBLY_NAME: data.Data.Items[0].SEARCH_ASSY_NAME }); + for (const i in searchForms) { + if (searchForms[i]['field'] != '0') { + condAdd(); + if (searchForms[i]['component'] == 'ApiSelect') { + addApiSelectOption(`${SearchEntName.value}${Number(i) + 1}a`, 'search'); + setFieldsValue({ + [`ApiSelect${SearchEntName.value}${Number(i) + 1}a`]: + searchForms[i]['componentProps']['api'], + [`Params${SearchEntName.value}${Number(i) + 1}a`]: JSON.stringify( + searchForms[i]['componentProps']['params'], + ), + [`Result${SearchEntName.value}${Number(i) + 1}a`]: + searchForms[i]['componentProps']['resultField'], + [`Label${SearchEntName.value}${Number(i) + 1}a`]: + searchForms[i]['componentProps']['labelField'], + [`Value${SearchEntName.value}${Number(i) + 1}a`]: + searchForms[i]['componentProps']['valueField'], + }); + } + setFieldsValue({ + [`${SearchEntName.value}${Number(i) + 1}a`]: searchForms[i]['field'], + [`InputNumber${Number(i) + 1}`]: searchForms[i]['colProps'].span, + [`Switch${Number(i) + 1}`]: searchForms[i]['ifShow'], + }); + objInputs.value[`${SearchEntName.value}${Number(i) + 1}a`] = searchForms[i]['label']; + searchSelectVals.value[`${SearchEntName.value}${Number(i) + 1}a`] = searchForms[i][ + 'comp' + ] + ? searchForms[i]['comp'] + : searchForms[i]['component']; + } + } + var crudForms = JSON.parse(data.Data.Items[0].FORM_JSON); + CrudEntName.value = data.Data.Items[0].CRUD_ASSY_NAME; + setFieldsValueCrud({ crudAssemblyName: data.Data.Items[0].CRUD_ASSY_NAME }); + for (const i in crudForms) { + crudCondAdd(); + if (crudForms[i]['component'] == 'ApiSelect') { + addApiSelectOption(`${CrudEntName.value}${Number(i) + 1}a`, 'crud'); + setFieldsValueCrud({ + [`ApiSelect${CrudEntName.value}${Number(i) + 1}a`]: + crudForms[i]['componentProps']['api'], + [`Params${CrudEntName.value}${Number(i) + 1}a`]: JSON.stringify( + crudForms[i]['componentProps']['params'], + ), + [`Result${CrudEntName.value}${Number(i) + 1}a`]: + crudForms[i]['componentProps']['resultField'], + [`Label${CrudEntName.value}${Number(i) + 1}a`]: + crudForms[i]['componentProps']['labelField'], + [`Value${CrudEntName.value}${Number(i) + 1}a`]: + crudForms[i]['componentProps']['valueField'], + }); + } + if (crudForms[i]['component'] == 'Select') { + addSelectOption(`${CrudEntName.value}${Number(i) + 1}a`, 'crud'); + setFieldsValueCrud({ + [`XSelect${CrudEntName.value}${Number(i) + 1}a`]: JSON.stringify( + crudForms[i]['componentProps']['options'], + ), + [`XOnChange${CrudEntName.value}${Number(i) + 1}a`]: + crudForms[i]['componentProps']['onChange'], + }); + } + setFieldsValueCrud({ + [`${CrudEntName.value}${Number(i) + 1}a`]: crudForms[i]['field'], + [`InputNumber${Number(i) + 1}`]: crudForms[i]['colProps'].span, + [`Switch${Number(i) + 1}`]: crudForms[i]['show'], + [`rSwitch${Number(i) + 1}`]: crudForms[i]['required'], + }); + crudInputs.value[`${CrudEntName.value}${Number(i) + 1}a`] = crudForms[i]['label']; + crudSelectVals.value[`${CrudEntName.value}${Number(i) + 1}a`] = crudForms[i]['component']; + } + var objs = JSON.parse(data.Data.Items[0].BASE_FORM_JSON); + MainEntName.value = data.Data.Items[0].ASSEMBLY_NAME; + setFieldsValueMain({ MainAssemblyName: MainEntName.value }); + for (const i in objs) { + mainCondAdd(); + setFieldsValueMain({ + [`${MainEntName.value}${Number(i) + 1}a`]: objs[i]['dataIndex'], + [`Switch${Number(i) + 1}`]: objs[i]['ifShow'], + [`sSwitch${Number(i) + 1}`]: objs[i]['sorter'], + [`wSwitch${Number(i) + 1}`]: objs[i]['resizable'], + [`InputTextArea${Number(i) + 1}`]: objs[i]['customRender'], + }); + mainInputs.value[`${MainEntName.value}${Number(i) + 1}a`] = objs[i]['title']; + } + }); + } }); async function submitAll() { @@ -354,6 +513,7 @@ crudvalidate(), validateMainForm(), ]); + /* 鏌ヨ鏉′欢Json */ const Keys = Object.getOwnPropertyNames(values); var searchjsons = []; @@ -366,6 +526,15 @@ _json['label'] = objInputs.value[Keys[k]]; _json['defaultValue'] = ''; _json['component'] = searchSelectVals.value[Keys[k]]; + if (searchSelectVals.value[Keys[k]] == 'ApiSelect') { + _json['componentProps'] = { + api: values[`ApiSelect${Keys[k]}`], + params: JSON.parse(values[`Params${Keys[k]}`]), + resultField: values[`Result${Keys[k]}`], + labelField: values[`Label${Keys[k]}`], + valueField: values[`Value${Keys[k]}`], + }; + } _n = _n + 4; } if (Keys[k].toString().startsWith('InputNumber')) { @@ -377,6 +546,20 @@ _n++; } if (!isNullOrEmpty(_json) && _n == 6) { + //濡傛灉鏄脊鍑洪�夋嫨妗� + if (_json['component'] == 'PoPSelect') { + _json['component'] = 'Input'; + _json['comp'] = 'PoPSelect'; + searchjsons.push(_json); + _json = {}; + _json['field'] = '0'; + _json['label'] = '1'; + _json['defaultValue'] = ''; + _json['component'] = 'Input'; + _json['colProps'] = { span: 4 }; + _json['ifShow'] = true; + _json['colSlot'] = 'add'; + } searchjsons.push(_json); _json = {}; _n = 0; @@ -413,7 +596,11 @@ : (mainvalues[mKeys[k]] as boolean); i++; } - if (!isNullOrEmpty(mjson) && i == 5) { + if (mKeys[k].toString().startsWith('InputTextArea')) { + mjson['customRender'] = isNullOrEmpty(mainvalues[mKeys[k]]) ? '' : mainvalues[mKeys[k]]; + i++; + } + if (!isNullOrEmpty(mjson) && i == 6) { mjsons.push(mjson); i = 0; mjson = {}; @@ -428,19 +615,36 @@ for (const k in cKeys) { console.log(`${k}:${cKeys[k]}`); if (cKeys[k].toString().startsWith(getFieldsValueCrud().crudAssemblyName)) { - cjson['field'] = isNullOrEmpty(crudvalues[mKeys[k]]) ? '' : crudvalues[cKeys[k]]; - cjson['label'] = isNullOrEmpty(crudvalues[mKeys[k]]) ? '' : crudInputs.value[cKeys[k]]; + cjson['field'] = isNullOrEmpty(crudvalues[cKeys[k]]) ? '' : crudvalues[cKeys[k]]; + cjson['label'] = isNullOrEmpty(crudInputs.value[cKeys[k]]) + ? '' + : crudInputs.value[cKeys[k]]; cjson['component'] = crudSelectVals.value[cKeys[k]]; + if (crudSelectVals.value[cKeys[k]] == 'ApiSelect') { + cjson['componentProps'] = { + api: crudvalues[`ApiSelect${cKeys[k]}`], + params: JSON.parse(crudvalues[`Params${cKeys[k]}`]), + resultField: crudvalues[`Result${cKeys[k]}`], + labelField: crudvalues[`Label${cKeys[k]}`], + valueField: crudvalues[`Value${cKeys[k]}`], + }; + } + if (crudSelectVals.value[cKeys[k]] == 'Select') { + cjson['componentProps'] = { + options: JSON.parse(crudvalues[`XSelect${cKeys[k]}`]), + onChange: crudvalues[`XOnChange${cKeys[k]}`], + }; + } c = c + 3; } if (cKeys[k].toString().startsWith('Switch')) { - cjson['show'] = isNullOrEmpty(crudvalues[mKeys[k]]) + cjson['show'] = isNullOrEmpty(crudvalues[cKeys[k]]) ? false : (crudvalues[cKeys[k]] as boolean); c++; } if (cKeys[k].toString().startsWith('rSwitch')) { - cjson['required'] = isNullOrEmpty(crudvalues[mKeys[k]]) + cjson['required'] = isNullOrEmpty(crudvalues[cKeys[k]]) ? false : (crudvalues[cKeys[k]] as boolean); c++; @@ -457,6 +661,7 @@ } console.log(JSON.stringify(cjsons)); var entity: SYS_LOW_CODE = { + ID: objParams.value.ID, CREATE_USER: useUserStore().getUserInfo.userId as string, UPDATE_USER: useUserStore().getUserInfo.userId as string, SEARCH_FORM_JSON: JSON.stringify(searchjsons), @@ -486,7 +691,7 @@ } function handleEdit(record: Recordable) {} - //鐐瑰嚮鎵撳紑鐗╂枡鍒楄〃妗� + function handleSelecNew() { openNewModal(true, { data: 'content', @@ -517,6 +722,7 @@ Namespace: 'Tiger.Model', }); mainProperties.value = data.items; + MainEntName.value = d.values.values; } async function handleNewSuccess(d, u) { @@ -528,12 +734,19 @@ Namespace: 'Tiger.Model', }); searchProperties.value = data.items; + SearchEntName.value = d.values.values; } - function handleCrudSuccess(d, u) { + async function handleCrudSuccess(d, u) { setFieldsValueCrud({ crudAssemblyName: d.values.values, }); + var data = await getEntityPropertieList({ + StartWith: d.values.values, + Namespace: 'Tiger.Model', + }); + crudProperties.value = data.items; + CrudEntName.value = d.values.values; } function change(value, option, field) { console.log(value, option, field); @@ -547,6 +760,213 @@ console.log(value, option, field); crudInputs.value[field] = option.label; } + /* 鏌ヨ缁勪欢閫夋嫨浜嬩欢 */ + function searchOnChange(value, option, field) { + console.log(value, option, field); + if (value == 'ApiSelect') { + addApiSelectOption(field, 'search'); + } else { + delApiSelectOption(field, 'search'); + } + // if (value == 'PoPSelect') {} + } + /* 澧炲垹鏀圭粍浠堕�夋嫨浜嬩欢 */ + function componentChange(value, option, field) { + console.log(value, option, field); + if (value == 'ApiSelect') { + addApiSelectOption(field, 'crud'); + delSelectOption(field, 'crud'); + } else { + delApiSelectOption(field, 'crud'); + } + if (value == 'Select') { + addSelectOption(field, 'crud'); + delApiSelectOption(field, 'crud'); + } else { + delSelectOption(field, 'crud'); + } + // if (value == 'PoPSelect') {} + } + + function addApiSelectOption(field: string, type: string) { + const appendData: FormSchema[] = [ + { + field: `ApiSelect${field}`, + component: 'Input', + label: `api`, + slot: `Api${field}`, + colProps: { span: 5 }, + }, + { + field: `Params${field}`, + component: 'Input', + label: 'params', + slot: `Params_${field}`, + colProps: { span: 6 }, + }, + { + field: `Result${field}`, + component: 'Input', + label: 'resultField', + slot: `ResultField${field}`, + colProps: { span: 5 }, + }, + { + field: `Label${field}`, + component: 'Input', + label: 'labelField', + slot: `LabelField${field}`, + colProps: { span: 4 }, + }, + { + field: `Value${field}`, + component: 'Input', + label: 'valueField', + slot: `ValueField${field}`, + colProps: { span: 4 }, + }, + ]; + switch (type) { + case 'search': + appendSchemaByField(appendData, ''); + searchSlotsPush(field); + break; + case 'crud': + appendSchemaByFieldCrud(appendData, ''); + crudSlotsPush(field); + break; + } + } + + /* 澧炲垹鏀笰piSelect鎻掓Ы鏁版嵁娣诲姞 */ + function crudSlotsPush(field: string) { + crudApiSlots.value.push(`Api${field}`); + crudParamsSlots.value.push(`Params_${field}`); + crudResultFieldSlots.value.push(`ResultField${field}`); + crudLabelFieldSlots.value.push(`LabelField${field}`); + crudValueFieldSlots.value.push(`ValueField${field}`); + } + /* 鏌ヨApiSelect鎻掓Ы鏁版嵁娣诲姞 */ + function searchSlotsPush(field: string) { + searchApiSlots.value.push(`Api${field}`); + searchParamsSlots.value.push(`Params_${field}`); + searchResultFieldSlots.value.push(`ResultField${field}`); + searchLabelFieldSlots.value.push(`LabelField${field}`); + searchValueFieldSlots.value.push(`ValueField${field}`); + } + + function delApiSelectOption(field: string, type: string) { + const removeData: string[] = [ + `ApiSelect${field}`, + `Params${field}`, + `Result${field}`, + `Label${field}`, + `Value${field}`, + ]; + switch (type) { + case 'search': + //if (!isNullOrEmpty(getFieldsValue()[`ApiSelect${field}`])) { + removeSchemaByField(removeData); + searchSlotsSplice(field); + //} + break; + case 'crud': + //if (!isNullOrEmpty(getFieldsValueCrud()[`ApiSelect${field}`])) { + removeSchemaByFieldCrud(removeData); + crudSlotsSplice(field); + //} + break; + } + } + + /* 澧炲垹鏀规彃妲藉垹闄ら」 */ + function crudSlotsSplice(field: string) { + crudApiSlots.value = crudApiSlots.value.filter((item) => item !== `Api${field}`); + crudParamsSlots.value = crudParamsSlots.value.filter((item) => item !== `Params_${field}`); + crudResultFieldSlots.value = crudResultFieldSlots.value.filter( + (item) => item !== `ResultField${field}`, + ); + crudLabelFieldSlots.value = crudLabelFieldSlots.value.filter( + (item) => item !== `LabelField${field}`, + ); + crudValueFieldSlots.value = crudValueFieldSlots.value.filter( + (item) => item !== `ValueField${field}`, + ); + } + /* 澧炲垹鏀规彃妲藉垹闄ら」 */ + function searchSlotsSplice(field: string) { + searchApiSlots.value = searchApiSlots.value.filter((item) => item !== `Api${field}`); + searchParamsSlots.value = searchParamsSlots.value.filter((item) => item !== `Params_${field}`); + searchResultFieldSlots.value = searchResultFieldSlots.value.filter( + (item) => item !== `ResultField${field}`, + ); + searchLabelFieldSlots.value = searchLabelFieldSlots.value.filter( + (item) => item !== `LabelField${field}`, + ); + searchValueFieldSlots.value = searchValueFieldSlots.value.filter( + (item) => item !== `ValueField${field}`, + ); + } + + function addSelectOption(field: string, type: string) { + const appendData: FormSchema[] = [ + { + field: `XSelect${field}`, + component: 'Input', + label: `options`, + slot: `Select_${field}`, + colProps: { span: 12 }, + }, + { + field: `XOnChange${field}`, + component: 'Input', + label: 'onChange', + slot: `OnChange_${field}`, + colProps: { span: 12 }, + }, + ]; + switch (type) { + case 'search': + appendSchemaByField(appendData, ''); + // searchSelSlotsPush(field); + break; + case 'crud': + appendSchemaByFieldCrud(appendData, ''); + crudSelSlotsPush(field); + break; + } + } + + function delSelectOption(field: string, type: string) { + const removeData: string[] = [`XSelect${field}`, `XOnChange${field}`]; + switch (type) { + case 'search': + //if (!isNullOrEmpty(getFieldsValue()[`XSelect${field}`])) { + removeSchemaByField(removeData); + // searchSelSlotsSplice(field); + //} + break; + case 'crud': + //if (!isNullOrEmpty(getFieldsValueCrud()[`XSelect${field}`])) { + removeSchemaByFieldCrud(removeData); + crudSelSlotsSplice(field); + //} + break; + } + } + + /* 澧炲垹鏀筍elect鎻掓Ы鏁版嵁娣诲姞 */ + function crudSelSlotsPush(field: string) { + crudOptionsSlots.value.push(`Select_${field}`); + crudOnChangeSlots.value.push(`OnChange_${field}`); + } + + /* 澧炲垹鏀规彃妲藉垹闄ら」 */ + function crudSelSlotsSplice(field: string) { + crudOptionsSlots.value = crudOptionsSlots.value.filter((item) => item !== `Select_${field}`); + crudOnChangeSlots.value = crudOnChangeSlots.value.filter((item) => item !== `Select_${field}`); + } + const n = ref(1); const m = ref(1); const j = ref(1); @@ -557,10 +977,10 @@ appendSchemaByField( [ { - field: `${getFieldsValue().ASSEMBLY_NAME}${n.value}a`, + field: `${SearchEntName.value}${n.value}a`, component: 'InputGroup', label: '瀛楁' + n.value, - // required: true, + //required: true, slot: 'fac' + n.value, colProps: { span: 14 }, }, @@ -589,21 +1009,21 @@ ); searchSlots.value.push('fac' + n.value); swSlots.value.push(`sw${n.value}`); - objInputs.value[`${getFieldsValue().ASSEMBLY_NAME}${n.value}a`] = ''; - searchSelectVals.value[`${getFieldsValue().ASSEMBLY_NAME}${n.value}a`] = ''; + objInputs.value[`${SearchEntName.value}${n.value}a`] = ''; + searchSelectVals.value[`${SearchEntName.value}${n.value}a`] = ''; console.log(searchSlots.value); n.value++; } function del(field) { removeSchemaByField([ - `${getFieldsValue().ASSEMBLY_NAME}${field}a`, + `${SearchEntName.value}${field}a`, `Switch${field}`, `InputNumber${field}`, `${field}`, ]); - swSlots.value.splice(swSlots.value.indexOf(`sw${field}`), 1); - searchSlots.value.splice(searchSlots.value.indexOf(`fac${field}`), 1); + swSlots.value = swSlots.value.filter((item) => item !== `sw${field}`); + searchSlots.value = searchSlots.value.filter((item) => item !== `fac${field}`); if (searchSlots.value.length == 0) { n.value = 1; } @@ -614,7 +1034,7 @@ appendSchemaByFieldMain( [ { - field: `${getFieldsValueMain().MainAssemblyName}${m.value}a`, + field: `${MainEntName.value}${m.value}a`, component: 'InputGroup', label: '瀛楁' + m.value, // required: true, @@ -646,7 +1066,12 @@ field: `InputTextArea${m.value}`, component: 'InputTextArea', label: '鑷畾涔夋覆鏌�', + slot: `mainwIa${m.value}`, colProps: { span: 21 }, + componentProps: { + placeholder: '璇风紪杈戞覆鏌撲唬鐮�', + rows: 4, + }, }, { field: `${m.value}`, @@ -662,25 +1087,27 @@ mainSwSlots.value.push(`mainSw${m.value}`); mainsSwSlots.value.push(`mainsSw${m.value}`); mainwSwSlots.value.push(`mainwSw${m.value}`); - mainInputs.value[`${getFieldsValueMain().MainAssemblyName}${m.value}a`] = ''; - mainSelectVals.value[`${getFieldsValueMain().MainAssemblyName}${m.value}a`] = ''; + mainIaSlots.value.push(`mainwIa${m.value}`); + mainInputs.value[`${MainEntName.value}${m.value}a`] = ''; + mainSelectVals.value[`${MainEntName.value}${m.value}a`] = ''; console.log(mainSlots.value); m.value++; } function mainDel(field) { removeSchemaByFieldMain([ - `${getFieldsValueMain().MainAssemblyName}${field}a`, + `${MainEntName.value}${field}a`, `Switch${field}`, `sSwitch${field}`, `wSwitch${field}`, `InputTextArea${field}`, `${field}`, ]); - mainSwSlots.value.splice(mainSwSlots.value.indexOf(`mainSw${field}`), 1); - mainsSwSlots.value.splice(mainsSwSlots.value.indexOf(`mainsSw${field}`), 1); - mainwSwSlots.value.splice(mainwSwSlots.value.indexOf(`mainwSw${field}`), 1); - mainSlots.value.splice(mainSlots.value.indexOf(`mainfac${field}`), 1); + mainSwSlots.value = mainSwSlots.value.filter((item) => item !== `mainSw${field}`); + mainsSwSlots.value = mainsSwSlots.value.filter((item) => item !== `mainsSw${field}`); + mainwSwSlots.value = mainwSwSlots.value.filter((item) => item !== `mainwSw${field}`); + mainIaSlots.value = mainIaSlots.value.filter((item) => item !== `mainwIa${field}`); + mainSlots.value = mainSlots.value.filter((item) => item !== `mainfac${field}`); if (mainSlots.value.length == 0) { m.value = 1; } @@ -691,7 +1118,7 @@ appendSchemaByFieldCrud( [ { - field: `${getFieldsValueCrud().crudAssemblyName}${j.value}a`, + field: `${CrudEntName.value}${j.value}a`, component: 'InputGroup', label: '瀛楁' + j.value, // required: true, @@ -731,26 +1158,27 @@ crudSlots.value.push('crudfac' + j.value); crudSwSlots.value.push(`crudSw${j.value}`); crudrSwSlots.value.push(`crudrSw${j.value}`); - crudInputs.value[`${getFieldsValueCrud().crudAssemblyName}${j.value}a`] = ''; - crudSelectVals.value[`${getFieldsValueCrud().crudAssemblyName}${j.value}a`] = ''; + crudInputs.value[`${CrudEntName.value}${j.value}a`] = ''; + crudSelectVals.value[`${CrudEntName.value}${j.value}a`] = ''; console.log(crudSlots.value); j.value++; } function crudDel(field) { removeSchemaByFieldCrud([ - `${getFieldsValueCrud().crudAssemblyName}${field}a`, + `${CrudEntName.value}${field}a`, `Switch${field}`, `rSwitch${field}`, `InputNumber${field}`, `${field}`, ]); - crudSwSlots.value.splice(crudSwSlots.value.indexOf(`crudSw${field}`), 1); - crudrSwSlots.value.splice(crudrSwSlots.value.indexOf(`crudrSw${field}`), 1); - crudSlots.value.splice(crudSlots.value.indexOf(`crudfac${field}`), 1); + crudSwSlots.value = crudSwSlots.value.filter((item) => item !== `crudSw${field}`); + crudrSwSlots.value = crudrSwSlots.value.filter((item) => item !== `crudrSw${field}`); + crudSlots.value = crudSlots.value.filter((item) => item !== `crudfac${field}`); if (crudSlots.value.length == 0) { j.value = 1; } + delApiSelectOption(`${CrudEntName.value}${field}a`, 'crud'); } function goBack() { @@ -761,5 +1189,6 @@ <style lang="less" scoped> .high-form { padding-bottom: 48px; - } -</style>: { values: any[]; }: any: { values: any[]; }: any: { values: any[]; }: any: any: any: any: any: any: any + }</style +>: { values: any[]; }: any: { values: any[]; }: any: { values: any[]; }: any: any: any: any: any: +any: any -- Gitblit v1.9.3