| | |
| | | :params="{ StartWith: getFieldsValue().ASSEMBLY_NAME, Namespace: 'Tiger.Model' }" |
| | | v-model:value="model[field]" |
| | | resultField="items" |
| | | label-field="Name" |
| | | label-field="DisplayName" |
| | | valueField="Name" |
| | | @change="(value, option) => change(value, option, field)" |
| | | /> |
| | | <a-input v-model:value="objInputs[field]" style="width: 55%" /> |
| | | <Select |
| | |
| | | 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> |
| | |
| | | }" |
| | | v-model:value="model[field]" |
| | | resultField="items" |
| | | label-field="Name" |
| | | label-field="DisplayName" |
| | | valueField="Name" |
| | | @change="(value, option) => mainChange(value, option, field)" |
| | | /> |
| | | <a-input v-model:value="mainInputs[field]" style="width: 70%" /> |
| | | </a-input-group> |
| | |
| | | </template> |
| | | <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> |
| | |
| | | }" |
| | | v-model:value="model[field]" |
| | | resultField="items" |
| | | label-field="Name" |
| | | label-field="DisplayName" |
| | | valueField="Name" |
| | | @change="(value, option) => crudChange(value, option, field)" |
| | | /> |
| | | <a-input v-model:value="crudInputs[field]" style="width: 55%" /> |
| | | <Select |
| | |
| | | style="width: 20%" |
| | | :options="options" |
| | | :readonly="true" |
| | | @change="(value, option) => componentChange(value, option, field)" |
| | | /> |
| | | </a-input-group> |
| | | </template> |
| | |
| | | </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> |
| | |
| | | </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'; |
| | |
| | | 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'; |
| | |
| | | validate, |
| | | }, |
| | | ] = useForm({ |
| | | labelWidth: 120, |
| | | labelWidth: 130, |
| | | baseColProps: { |
| | | span: 24, |
| | | }, |
| | |
| | | validate: crudvalidate, |
| | | }, |
| | | ] = useForm({ |
| | | labelWidth: 120, |
| | | labelWidth: 130, |
| | | baseColProps: { |
| | | span: 24, |
| | | }, |
| | |
| | | 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', |
| | |
| | | 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() { |
| | | try { |
| | |
| | | crudvalidate(), |
| | | validateMainForm(), |
| | | ]); |
| | | |
| | | /* 查询条件Json */ |
| | | const Keys = Object.getOwnPropertyNames(values); |
| | | var searchjsons = []; |
| | |
| | | var _n = 0; |
| | | for (const k in Keys) { |
| | | console.log(`${k}:${Keys[k]}`); |
| | | if (!isNullOrEmpty(values[Keys[k]])) { |
| | | if (Keys[k].toString().startsWith(getFieldsValue().ASSEMBLY_NAME)) { |
| | | _json['field'] = values[Keys[k]]; |
| | | _json['label'] = objInputs.value[Keys[k]]; |
| | | _json['defaultValue'] = ''; |
| | | _json['component'] = searchSelectVals.value[Keys[k]]; |
| | | _n = _n + 4; |
| | | if (Keys[k].toString().startsWith(getFieldsValue().ASSEMBLY_NAME)) { |
| | | _json['field'] = isNullOrEmpty(values[Keys[k]]) ? '' : values[Keys[k]]; |
| | | _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]}`], |
| | | }; |
| | | } |
| | | if (Keys[k].toString().startsWith('InputNumber')) { |
| | | _json['colProps'] = { span: values[Keys[k]] }; |
| | | _n++; |
| | | } |
| | | if (Keys[k].toString().startsWith('Switch')) { |
| | | _json['ifShow'] = values[Keys[k]] as boolean; |
| | | _n++; |
| | | } |
| | | if (!isNullOrEmpty(_json) && _n == 6) { |
| | | _n = _n + 4; |
| | | } |
| | | if (Keys[k].toString().startsWith('InputNumber')) { |
| | | _json['colProps'] = { span: values[Keys[k]] }; |
| | | _n++; |
| | | } |
| | | if (Keys[k].toString().startsWith('Switch')) { |
| | | _json['ifShow'] = isNullOrEmpty(values[Keys[k]]) ? false : (values[Keys[k]] as boolean); |
| | | _n++; |
| | | } |
| | | if (!isNullOrEmpty(_json) && _n == 6) { |
| | | //如果是弹出选择框 |
| | | if (_json['component'] == 'PoPSelect') { |
| | | _json['component'] = 'Input'; |
| | | _json['comp'] = 'PoPSelect'; |
| | | searchjsons.push(_json); |
| | | _json = {}; |
| | | _n = 0; |
| | | _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; |
| | | } |
| | | } |
| | | console.log(JSON.stringify(searchjsons)); |
| | |
| | | var i = 0; |
| | | for (const k in mKeys) { |
| | | console.log(`${k}:${mKeys[k]}`); |
| | | if (isNullOrEmpty(mainvalues[mKeys[k]])) { |
| | | if ( |
| | | mKeys[k].toString().startsWith('Switch') || |
| | | mKeys[k].toString().startsWith('sSwitch') || |
| | | mKeys[k].toString().startsWith('wSwitch') |
| | | ) { |
| | | mainvalues[mKeys[k]] = false; |
| | | } |
| | | if (mKeys[k].toString().startsWith(getFieldsValueMain().MainAssemblyName)) { |
| | | mjson['dataIndex'] = isNullOrEmpty(mainvalues[mKeys[k]]) ? '' : mainvalues[mKeys[k]]; |
| | | mjson['title'] = isNullOrEmpty(mainvalues[mKeys[k]]) ? '' : mainInputs.value[mKeys[k]]; |
| | | i = i + 2; |
| | | } |
| | | if (!isNullOrEmpty(mainvalues[mKeys[k]])) { |
| | | if (mKeys[k].toString().startsWith(getFieldsValueMain().MainAssemblyName)) { |
| | | mjson['dataIndex'] = mainvalues[mKeys[k]]; |
| | | mjson['title'] = mainInputs.value[mKeys[k]]; |
| | | i = i + 2; |
| | | } |
| | | if (mKeys[k].toString().startsWith('Switch')) { |
| | | mjson['ifShow'] = mainvalues[mKeys[k]] as boolean; |
| | | i++; |
| | | } |
| | | if (mKeys[k].toString().startsWith('sSwitch')) { |
| | | mjson['sorter'] = mainvalues[mKeys[k]] as boolean; |
| | | i++; |
| | | } |
| | | if (mKeys[k].toString().startsWith('wSwitch')) { |
| | | mjson['resizable'] = mainvalues[mKeys[k]] as boolean; |
| | | i++; |
| | | } |
| | | if (!isNullOrEmpty(mjson) && i == 5) { |
| | | mjsons.push(mjson); |
| | | i = 0; |
| | | mjson = {}; |
| | | } |
| | | if (mKeys[k].toString().startsWith('Switch')) { |
| | | mjson['ifShow'] = isNullOrEmpty(mainvalues[mKeys[k]]) |
| | | ? false |
| | | : (mainvalues[mKeys[k]] as boolean); |
| | | i++; |
| | | } |
| | | if (mKeys[k].toString().startsWith('sSwitch')) { |
| | | mjson['sorter'] = isNullOrEmpty(mainvalues[mKeys[k]]) |
| | | ? false |
| | | : (mainvalues[mKeys[k]] as boolean); |
| | | i++; |
| | | } |
| | | if (mKeys[k].toString().startsWith('wSwitch')) { |
| | | mjson['resizable'] = isNullOrEmpty(mainvalues[mKeys[k]]) |
| | | ? false |
| | | : (mainvalues[mKeys[k]] as boolean); |
| | | i++; |
| | | } |
| | | 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 = {}; |
| | | } |
| | | } |
| | | console.log(JSON.stringify(mjsons)); |
| | |
| | | var c = 0; |
| | | for (const k in cKeys) { |
| | | console.log(`${k}:${cKeys[k]}`); |
| | | if (isNullOrEmpty(crudvalues[mKeys[k]])) { |
| | | if ( |
| | | cKeys[k].toString().startsWith('Switch') || |
| | | cKeys[k].toString().startsWith('rSwitch') |
| | | ) { |
| | | crudvalues[mKeys[k]] = false; |
| | | if (cKeys[k].toString().startsWith(getFieldsValueCrud().crudAssemblyName)) { |
| | | 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 (!isNullOrEmpty(crudvalues[cKeys[k]])) { |
| | | if (cKeys[k].toString().startsWith(getFieldsValueCrud().crudAssemblyName)) { |
| | | cjson['field'] = crudvalues[cKeys[k]]; |
| | | cjson['label'] = crudInputs.value[cKeys[k]]; |
| | | cjson['component'] = crudSelectVals.value[cKeys[k]]; |
| | | c = c + 3; |
| | | } |
| | | if (cKeys[k].toString().startsWith('Switch')) { |
| | | cjson['show'] = crudvalues[cKeys[k]] as boolean; |
| | | c++; |
| | | } |
| | | if (cKeys[k].toString().startsWith('rSwitch')) { |
| | | cjson['required'] = crudvalues[cKeys[k]] as boolean; |
| | | c++; |
| | | } |
| | | if (cKeys[k].toString().startsWith('InputNumber')) { |
| | | cjson['colProps'] = { span: crudvalues[cKeys[k]] }; |
| | | c++; |
| | | } |
| | | if (!isNullOrEmpty(cjson) && c == 6) { |
| | | cjsons.push(cjson); |
| | | c = 0; |
| | | cjson = {}; |
| | | } |
| | | if (cKeys[k].toString().startsWith('Switch')) { |
| | | cjson['show'] = isNullOrEmpty(crudvalues[cKeys[k]]) |
| | | ? false |
| | | : (crudvalues[cKeys[k]] as boolean); |
| | | c++; |
| | | } |
| | | if (cKeys[k].toString().startsWith('rSwitch')) { |
| | | cjson['required'] = isNullOrEmpty(crudvalues[cKeys[k]]) |
| | | ? false |
| | | : (crudvalues[cKeys[k]] as boolean); |
| | | c++; |
| | | } |
| | | if (cKeys[k].toString().startsWith('InputNumber')) { |
| | | cjson['colProps'] = { span: crudvalues[cKeys[k]] }; |
| | | c++; |
| | | } |
| | | if (!isNullOrEmpty(cjson) && c == 6) { |
| | | cjsons.push(cjson); |
| | | c = 0; |
| | | cjson = {}; |
| | | } |
| | | } |
| | | 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), |
| | |
| | | } |
| | | |
| | | function handleEdit(record: Recordable) {} |
| | | //点击打开物料列表框 |
| | | |
| | | function handleSelecNew() { |
| | | openNewModal(true, { |
| | | data: 'content', |
| | |
| | | |
| | | async function mainAssySuccess(d, u) { |
| | | setFieldsValueMain({ |
| | | MainAssemblyName: d.values.values, |
| | | MainAssemblyName: d.values['val'], |
| | | }); |
| | | var data = await getEntityPropertieList({ |
| | | StartWith: d.values.values, |
| | | StartWith: d.values['val'], |
| | | Namespace: 'Tiger.Model', |
| | | }); |
| | | mainProperties.value = data.items; |
| | | MainEntName.value = d.values['val']; |
| | | } |
| | | |
| | | async function handleNewSuccess(d, u) { |
| | | setFieldsValue({ |
| | | ASSEMBLY_NAME: d.values.values, |
| | | ASSEMBLY_NAME: d.values['val'], |
| | | }); |
| | | var data = await getEntityPropertieList({ |
| | | StartWith: d.values.values, |
| | | StartWith: d.values['val'], |
| | | Namespace: 'Tiger.Model', |
| | | }); |
| | | searchProperties.value = data.items; |
| | | SearchEntName.value = d.values['val']; |
| | | } |
| | | |
| | | function handleCrudSuccess(d, u) { |
| | | async function handleCrudSuccess(d, u) { |
| | | setFieldsValueCrud({ |
| | | crudAssemblyName: d.values.values, |
| | | crudAssemblyName: d.values['val'], |
| | | }); |
| | | var data = await getEntityPropertieList({ |
| | | StartWith: d.values['val'], |
| | | Namespace: 'Tiger.Model', |
| | | }); |
| | | crudProperties.value = data.items; |
| | | CrudEntName.value = d.values['val']; |
| | | } |
| | | function change(value, option, field) { |
| | | console.log(value, option, field); |
| | | objInputs.value[field] = option.label; |
| | | } |
| | | function mainChange(value, option, field) { |
| | | console.log(value, option, field); |
| | | mainInputs.value[field] = option.label; |
| | | } |
| | | function crudChange(value, option, field) { |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | /* 增删改ApiSelect插槽数据添加 */ |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | /* 增删改Select插槽数据添加 */ |
| | | 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); |
| | |
| | | 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 }, |
| | | }, |
| | |
| | | ); |
| | | 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; |
| | | } |
| | |
| | | appendSchemaByFieldMain( |
| | | [ |
| | | { |
| | | field: `${getFieldsValueMain().MainAssemblyName}${m.value}a`, |
| | | field: `${MainEntName.value}${m.value}a`, |
| | | component: 'InputGroup', |
| | | label: '字段' + m.value, |
| | | // required: true, |
| | |
| | | component: 'Switch', |
| | | label: '是否显示', |
| | | slot: `mainSw${m.value}`, |
| | | colProps: { span: 3 }, |
| | | colProps: { span: 4 }, |
| | | }, |
| | | { |
| | | field: `sSwitch${m.value}`, |
| | | component: 'Switch', |
| | | label: '是否排序', |
| | | slot: `mainsSw${m.value}`, |
| | | colProps: { span: 3 }, |
| | | colProps: { span: 4 }, |
| | | }, |
| | | { |
| | | field: `wSwitch${m.value}`, |
| | | component: 'Switch', |
| | | label: '是否可调宽', |
| | | slot: `mainwSw${m.value}`, |
| | | colProps: { span: 3 }, |
| | | colProps: { span: 4 }, |
| | | }, |
| | | // { |
| | | // field: `InputNumber${m.value}`, |
| | | // component: 'InputNumber', |
| | | // label: '列宽', |
| | | // colProps: { span: 3 }, |
| | | // }, |
| | | { |
| | | field: `InputTextArea${m.value}`, |
| | | component: 'InputTextArea', |
| | | label: '自定义渲染', |
| | | slot: `mainwIa${m.value}`, |
| | | colProps: { span: 21 }, |
| | | componentProps: { |
| | | placeholder: '请编辑渲染代码', |
| | | rows: 4, |
| | | }, |
| | | }, |
| | | { |
| | | field: `${m.value}`, |
| | | component: 'Input', |
| | |
| | | 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}`, |
| | | `InputNumber${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; |
| | | } |
| | |
| | | appendSchemaByFieldCrud( |
| | | [ |
| | | { |
| | | field: `${getFieldsValueCrud().crudAssemblyName}${j.value}a`, |
| | | field: `${CrudEntName.value}${j.value}a`, |
| | | component: 'InputGroup', |
| | | label: '字段' + j.value, |
| | | // required: true, |
| | |
| | | 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() { |
| | |
| | | <style lang="less" scoped> |
| | | .high-form { |
| | | padding-bottom: 48px; |
| | | } |
| | | </style> |
| | | }</style |
| | | >: { values: any[]; }: any: { values: any[]; }: any: { values: any[]; }: any: any: any: any: any: |
| | | any: any |