| | |
| | | content="这是低代码页面管理,在这能够根据实体类配置增删改功能页面。" |
| | | @back="goBack" |
| | | > |
| | | <a-card title="查询条件配置" :bordered="false"> |
| | | <BasicForm @register="register"> |
| | | <template #add="{ field }"> |
| | | <a-button |
| | | v-if="field" |
| | | class="mt-1 ml-1" |
| | | size="small" |
| | | @click="handleSelecNew" |
| | | preIcon="search|svg" |
| | | /> |
| | | <EntityModal @register="registerNewAdd" @success="handleNewSuccess" /> |
| | | </template> |
| | | <template #condAdd="{ field }"> |
| | | <a-button |
| | | v-if="field" |
| | | class="mt-1 ml-1" |
| | | size="small" |
| | | @click="condAdd" |
| | | preIcon="add_blue|svg" |
| | | /> |
| | | </template> |
| | | <template #subtract="{ field }"> |
| | | <a-button |
| | | v-if="field" |
| | | class="mt-1 ml-1" |
| | | size="small" |
| | | @click="del(field)" |
| | | preIcon="subtract|svg" |
| | | /> |
| | | </template> |
| | | <template #[item]="{ model, field }" v-for="(item, index) in searchSlots" :key="item"> |
| | | <a-input-group compact> |
| | | <ApiSelect |
| | | style="width: 25%" |
| | | :api="getEntityPropertieList" |
| | | :params="{ StartWith: getFieldsValue().ASSEMBLY_NAME, Namespace: 'Tiger.Model' }" |
| | | v-model:value="model[field]" |
| | | resultField="items" |
| | | label-field="DisplayName" |
| | | valueField="Name" |
| | | @change="(value, option) => change(value, option, field)" |
| | | /> |
| | | <a-input v-model:value="objInputs[field]" style="width: 55%" /> |
| | | <Select |
| | | ref="select" |
| | | v-model:value="searchSelectVals[field]" |
| | | 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]" /> --> |
| | | <CodeEditor v-model:value="model[field]" :mode="searchModeValue" :bordered="true"/> |
| | | </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> |
| | | <template #[item]="{ model, field }" v-for="item in searchOptionsSlots" :key="item"> |
| | | <!-- <a-input v-model:value="model[field]" /> --> |
| | | <CodeEditor v-model:value="model[field]" :mode="searchModeValue" :bordered="true"/> |
| | | </template> |
| | | <template #[item]="{ model, field }" v-for="item in searchOnChangeSlots" :key="item"> |
| | | <a-input v-model:value="model[field]" /> |
| | | </template> |
| | | <template #[item]="{ model, field }" v-for="item in searchPOptionsSlots" :key="item"> |
| | | <a-input v-model:value="model[field]" /> |
| | | </template> |
| | | </BasicForm> |
| | | </a-card> |
| | | <a-card title="主表格配置" :bordered="false" class="!mt-5"> |
| | | <template #footer> |
| | | <a-tabs default-active-key="detail" v-model:activeKey="currentKey"> |
| | | <a-tab-pane key="mainKey" tab="主表格配置" /> |
| | | <a-tab-pane key="searchKey" tab="查询条件配置" /> |
| | | <a-tab-pane key="crudKey" tab="增删改配置" /> |
| | | </a-tabs> |
| | | </template> |
| | | <a-card :bordered="false" v-show="currentKey == 'mainKey'"> |
| | | <div> |
| | | <BasicForm @register="registerMain"> |
| | | <template #add="{ field }"> |
| | |
| | | </template> |
| | | <template #[item]="{ model, field }" v-for="item in mainIaSlots" :key="item"> |
| | | <!-- <a-input v-model:value="model[field]" /> --> |
| | | <CodeEditor v-model:value="model[field]" :mode="modeValue" :bordered="true"/> |
| | | <CodeEditor v-model:value="model[field]" :mode="modeValue" :bordered="true" /> |
| | | </template> |
| | | </BasicForm> |
| | | </div> |
| | | </a-card> |
| | | <a-card title="增删改配置" :bordered="false" class="!mt-5"> |
| | | <a-card :bordered="false" v-show="currentKey == 'searchKey'"> |
| | | <BasicForm @register="register"> |
| | | <template #add="{ field }"> |
| | | <a-button |
| | | v-if="field" |
| | | class="mt-1 ml-1" |
| | | size="small" |
| | | @click="handleSelecNew" |
| | | preIcon="search|svg" |
| | | /> |
| | | <EntityModal @register="registerNewAdd" @success="handleNewSuccess" /> |
| | | </template> |
| | | <template #condAdd="{ field }"> |
| | | <a-button |
| | | v-if="field" |
| | | class="mt-1 ml-1" |
| | | size="small" |
| | | @click="condAdd(false)" |
| | | preIcon="add_blue|svg" |
| | | /> |
| | | </template> |
| | | <template #subtract="{ field }"> |
| | | <a-button |
| | | v-if="field" |
| | | class="mt-1 ml-1" |
| | | size="small" |
| | | @click="del(field)" |
| | | preIcon="subtract|svg" |
| | | /> |
| | | </template> |
| | | <template #[item]="{ model, field }" v-for="(item, index) in searchSlots" :key="item"> |
| | | <a-input-group compact> |
| | | <ApiSelect |
| | | v-if="IsSearch == 'Y'" |
| | | style="width: 25%" |
| | | :api="getEntityPropertieList" |
| | | :params="{ StartWith: getFieldsValue().ASSEMBLY_NAME, Namespace: 'Tiger.Model' }" |
| | | v-model:value="model[field]" |
| | | resultField="items" |
| | | label-field="DisplayName" |
| | | valueField="Name" |
| | | @change="(value, option) => change(value, option, field)" |
| | | /> |
| | | <a-input v-if="IsSearch == 'N'" v-model:value="objInputs2[field]" style="width: 25%" /> |
| | | <a-input v-model:value="objInputs[field]" style="width: 55%" /> |
| | | <Select |
| | | ref="select" |
| | | v-model:value="searchSelectVals[field]" |
| | | 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]" /> --> |
| | | <CodeEditor v-model:value="model[field]" :mode="searchModeValue" :bordered="true" /> |
| | | </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> |
| | | <template #[item]="{ model, field }" v-for="item in searchOptionsSlots" :key="item"> |
| | | <!-- <a-input v-model:value="model[field]" /> --> |
| | | <CodeEditor v-model:value="model[field]" :mode="searchModeValue" :bordered="true" /> |
| | | </template> |
| | | <template #[item]="{ model, field }" v-for="item in searchOnChangeSlots" :key="item"> |
| | | <a-input v-model:value="model[field]" /> |
| | | </template> |
| | | <template #[item]="{ model, field }" v-for="item in searchPOptionsSlots" :key="item"> |
| | | <a-input v-model:value="model[field]" /> |
| | | </template> |
| | | </BasicForm> |
| | | </a-card> |
| | | <a-card :bordered="false" v-show="currentKey == 'crudKey'"> |
| | | <BasicForm @register="registerCrud"> |
| | | <template #add="{ field }"> |
| | | <a-button |
| | |
| | | </template> |
| | | <template #[item]="{ model, field }" v-for="item in crudParamsSlots" :key="item"> |
| | | <!-- <a-input v-model:value="model[field]" /> --> |
| | | <CodeEditor v-model:value="model[field]" :mode="searchModeValue" :bordered="true"/> |
| | | <CodeEditor v-model:value="model[field]" :mode="searchModeValue" :bordered="true" /> |
| | | </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 crudOptionsSlots" :key="item"> |
| | | <!-- <a-input v-model:value="model[field]" /> --> |
| | | <CodeEditor v-model:value="model[field]" :mode="searchModeValue" :bordered="true"/> |
| | | <CodeEditor v-model:value="model[field]" :mode="searchModeValue" :bordered="true" /> |
| | | </template> |
| | | <template #[item]="{ model, field }" v-for="item in crudOnChangeSlots" :key="item"> |
| | | <a-input v-model:value="model[field]" /> |
| | |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import { BasicForm, FormSchema, useForm } from '/@/components/Form'; |
| | | import { h, nextTick, onMounted, ref, unref } from 'vue'; |
| | | import { 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 { newFormSchema, crudSchemas, mainSchemas } from './setting.data'; |
| | | import { useTabs } from '/@/hooks/web/useTabs'; |
| | | import EntityModal from '/@/views/components/EntityModal.vue'; |
| | | import { buildUUID } from '/@/utils/uuid'; |
| | | import { SelectTypes } from 'ant-design-vue/es/select'; |
| | | import { useMultipleTabStore } from '/@/store/modules/multipleTab'; |
| | | import { useModal } from '/@/components/Modal'; |
| | |
| | | import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; |
| | | import { useUserStore } from '/@/store/modules/user'; |
| | | import { CodeEditor, MODE } from '/@/components/CodeEditor'; |
| | | import { Tabs } from 'ant-design-vue'; |
| | | |
| | | const ACard = Card; |
| | | const AInputGroup = InputGroup; |
| | | const AInput = Input; |
| | | const ASwitch = Switch; |
| | | const ATabs = Tabs; |
| | | const currentKey = ref('mainKey'); |
| | | const route = useRoute(); |
| | | const go = useGo(); |
| | | const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); |
| | |
| | | /* 查询 */ |
| | | const SearchEntName = ref(''); |
| | | const objInputs = ref({} as { [key: string]: any }); |
| | | const objInputs2 = ref({} as { [key: string]: any }); |
| | | const searchProperties = ref([] as EntityPropertie[]); |
| | | const searchSlots = ref([] as string[]); |
| | | const searchSelectVals = ref({} as { [key: string]: any }); |
| | |
| | | const searchOnChangeSlots = ref([] as string[]); |
| | | const searchPOptionsSlots = ref([] as string[]); |
| | | const searchModeValue = ref<MODE>(MODE.JSON); |
| | | const IsSearch = ref('Y'); |
| | | /* 主表 */ |
| | | const MainEntName = ref(''); |
| | | const mainSelectVals = ref({} as { [key: string]: any }); |
| | |
| | | order: '', |
| | | }).then((data) => { |
| | | /* 查询加载 */ |
| | | var searchForms = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON); |
| | | const searchData = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON); |
| | | var searchForms = isNullOrEmpty(searchData.fields) ? searchData : searchData.fields; |
| | | SearchEntName.value = data.Data.Items[0].SEARCH_ASSY_NAME; |
| | | setFieldsValue({ ASSEMBLY_NAME: data.Data.Items[0].SEARCH_ASSY_NAME }); |
| | | setFieldsValue({ |
| | | ASSEMBLY_NAME: data.Data.Items[0].SEARCH_ASSY_NAME, |
| | | IsSearch: searchData.search ? 'Y' : 'N', |
| | | }); |
| | | IsSearch.value = searchData.search ? 'Y' : 'N'; |
| | | searchForms = searchForms.filter( |
| | | (item) => |
| | | !item['field'].toString().startsWith(SearchEntName.value) && |
| | | !item['field'].toString().endsWith('PSelect_0'), |
| | | ); |
| | | for (const i in searchForms) { |
| | | condAdd(); |
| | | condAdd(true); |
| | | if (searchForms[i]['component'] == 'ApiSelect') { |
| | | addApiSelectOption(`${SearchEntName.value}${Number(i) + 1}a`, 'search'); |
| | | setFieldsValue({ |
| | |
| | | [`Switch${Number(i) + 1}`]: searchForms[i]['ifShow'], |
| | | }); |
| | | objInputs.value[`${SearchEntName.value}${Number(i) + 1}a`] = searchForms[i]['label']; |
| | | objInputs2.value[`${SearchEntName.value}${Number(i) + 1}a`] = searchForms[i]['field']; |
| | | searchSelectVals.value[`${SearchEntName.value}${Number(i) + 1}a`] = searchForms[i]['comp'] |
| | | ? searchForms[i]['comp'] |
| | | : searchForms[i]['component']; |
| | |
| | | setFieldsValueMain({ |
| | | MainAssemblyName: MainEntName.value, |
| | | BY_ORG: data.Data.Items[0].BY_ORG, |
| | | CODE_NAME: data.Data.Items[0].CODE_NAME |
| | | }); |
| | | for (const i in objs) { |
| | | mainCondAdd(); |
| | |
| | | |
| | | /* 查询条件Json */ |
| | | const Keys = Object.getOwnPropertyNames(values); |
| | | var searchjsons = []; |
| | | var searchjsons = { search: getFieldsValue().IsSearch == 'Y', fields: [] as any[] }; |
| | | var _json = {}; |
| | | var _n = 0; |
| | | let firstField = ''; |
| | |
| | | console.log(`${k}:${Keys[k]}`); |
| | | if (Keys[k].toString().startsWith(getFieldsValue().ASSEMBLY_NAME)) { |
| | | firstField = Keys[k]; |
| | | _json['field'] = isNullOrEmpty(values[Keys[k]]) ? '' : values[Keys[k]]; |
| | | _json['field'] = |
| | | getFieldsValue().IsSearch == 'N' |
| | | ? objInputs2.value[Keys[k]] |
| | | : isNullOrEmpty(values[Keys[k]]) |
| | | ? '' |
| | | : values[Keys[k]]; |
| | | _json['label'] = objInputs.value[Keys[k]]; |
| | | _json['defaultValue'] = ''; |
| | | _json['component'] = searchSelectVals.value[Keys[k]]; |
| | |
| | | _json['component'] = 'Input'; |
| | | _json['comp'] = 'PoPSelect'; |
| | | _json['entityName'] = values[`PSelect${firstField}`]; |
| | | searchjsons.push(_json); |
| | | searchjsons.fields.push(_json); |
| | | _json = {}; |
| | | _json['field'] = `${firstField}PSelect_0`; |
| | | _json['label'] = '1'; |
| | |
| | | _json['ifShow'] = true; |
| | | _json['colSlot'] = `${firstField}add`; |
| | | } |
| | | searchjsons.push(_json); |
| | | searchjsons.fields.push(_json); |
| | | _json = {}; |
| | | _n = 0; |
| | | } |
| | |
| | | console.log(JSON.stringify(searchjsons)); |
| | | /* 主表格Json */ |
| | | const mKeys = Object.getOwnPropertyNames(mainvalues); |
| | | var mjsons = []; |
| | | var mjsons = [] as any[]; |
| | | var mjson = {}; |
| | | var i = 0; |
| | | for (const k in mKeys) { |
| | |
| | | } |
| | | } |
| | | console.log(JSON.stringify(cjsons)); |
| | | var entity: SYS_LOW_CODE = { |
| | | var entity = { |
| | | ID: objParams.value.ID, |
| | | CREATE_USER: useUserStore().getUserInfo.userId as string, |
| | | UPDATE_USER: useUserStore().getUserInfo.userId as string, |
| | |
| | | CRUD_ASSY_NAME: getFieldsValueCrud().crudAssemblyName, |
| | | SEARCH_ASSY_NAME: getFieldsValue().ASSEMBLY_NAME, |
| | | BY_ORG: getFieldsValueMain().BY_ORG, |
| | | CODE_NAME: getFieldsValueMain().CODE_NAME, |
| | | }; |
| | | SaveEntity(entity, unref(objParams.value.Update) == '1', 'SYS_LOW_CODE').then((action) => { |
| | | if (action.IsSuccessed) { |
| | |
| | | const j = ref(1); |
| | | /** |
| | | * @description: 批量添加 查询配置 |
| | | * @param {boolean} isMounted - 是否挂载时进入方法 |
| | | */ |
| | | function condAdd() { |
| | | function condAdd(isMounted: boolean) { |
| | | IsSearch.value = isMounted ? IsSearch.value : getFieldsValue().IsSearch; |
| | | appendSchemaByField( |
| | | [ |
| | | { |
| | |
| | | field: `InputNumber${n.value}`, |
| | | component: 'InputNumber', |
| | | label: '列宽', |
| | | colProps: { span: 3 }, |
| | | colProps: { span: 4 }, |
| | | }, |
| | | { |
| | | field: `${n.value}`, |
| | | component: 'Input', |
| | | label: ' ', |
| | | slot: 'subtract', |
| | | colProps: { span: 4 }, |
| | | colProps: { span: 3 }, |
| | | }, |
| | | ], |
| | | '', |
| | |
| | | label: '字段' + j.value, |
| | | // required: true, |
| | | slot: 'crudfac' + j.value, |
| | | colProps: { span: 12 }, |
| | | colProps: { span: 11 }, |
| | | }, |
| | | { |
| | | field: `Switch${j.value}`, |
| | |
| | | field: `InputNumber${j.value}`, |
| | | component: 'InputNumber', |
| | | label: '列宽', |
| | | colProps: { span: 3 }, |
| | | colProps: { span: 4 }, |
| | | }, |
| | | { |
| | | field: `${j.value}`, |