| | |
| | | GetCrudForm: (type: string | undefined,) => [] | {}; |
| | | GetBaseForm: () => [] | {}; |
| | | GetBaseCards: (type: string | undefined) => []; |
| | | OthersValues: (val: string, id: string) => {}; |
| | | KeyFieldValues: (val: string, id: string) => {}; |
| | | GetTitle: (type: string | undefined) => {}; |
| | | GetCrudColSlots: () => []; |
| | | nodeChange: ({}) => void; |
| | |
| | | GetSlots: (type: string | undefined) => {}; |
| | | GenerateHtml: (type: string | null) => HTMLElement | null; |
| | | CustFunc: (type: string | undefined, ...args) => void | any; |
| | | SubmitAll: (data: Ref<any[]>) => void | any; |
| | | } |
| | |
| | | * 5. 初始化表格 GetBasicColumnAndInit |
| | | * 6. 设置返回 getHomeUrl |
| | | * 7. 设置标题 getTitle |
| | | * 8. 设置新增时就默认的值 getOthersValues |
| | | * 8. 设置新增时就默认的值 getKeyFieldValues |
| | | * 9. 替换删除方法 GetActionsData |
| | | * @param {*} params |
| | | * @param {array} args |
| | |
| | | }); |
| | | const objParams = inject('objParams') as Ref<any>; |
| | | const data = inject('data') as Ref<Recordable[]>; |
| | | const others = inject('others') as Ref<Recordable[]>; |
| | | const keyFieldValues = inject('keyFieldValues') as Ref<Recordable[]>; |
| | | const go = useGo(); |
| | | const [registerDrawer, { openDrawer }] = useDrawer(); |
| | | const [registerItemAdd, { openModal: openItemModal }] = useModal(); |
| | |
| | | const EntityCustFunction = ref([ |
| | | { |
| | | ActionItem(params, data, ...args) {}, |
| | | EditOperation(data, d, u) {}, |
| | | EditOperation(data, d, u, item) {}, |
| | | GetBaseColumns(type: string | undefined) {}, |
| | | GetSearchForm(type: string | undefined) {}, |
| | | GetCrudForm(type: string | undefined, ...args) {}, |
| | | OthersValues(val, id) {}, |
| | | KeyFieldValues(val, id) {}, |
| | | GetSelectSuccess(d, u, ...args) {}, |
| | | OpenSelectItem(openItemModal: Fn, ...args) {}, |
| | | } as EntityCustFunctionType, |
| | |
| | | GetBaseColumns, |
| | | GetSearchForm, |
| | | GetCrudForm, |
| | | OthersValues, |
| | | KeyFieldValues, |
| | | GetSelectSuccess, |
| | | OpenSelectItem, |
| | | }, |
| | | ] = isNullOrUnDef(custImport.value['default']) |
| | | ? EntityCustFunction.value |
| | | : custImport.value['default'](); |
| | | others.value = OthersValues(objParams['CODE'], objParams['ID']); |
| | | keyFieldValues.value = KeyFieldValues(objParams['CODE'], objParams['ID']); |
| | | const [registerTable, { getForm, reload, setProps }] = useTable({ |
| | | title: `${objParams['firstTitle']}列表`, |
| | | api: getListByPage, |
| | | searchInfo: { TABLE_NAME: objParams['Name'], ...objParams['others'] }, |
| | | searchInfo: { TABLE_NAME: objParams['Name'], ...objParams['keyFieldValues'] }, |
| | | columns: GetBaseColumns(), |
| | | formConfig: { |
| | | labelWidth: 140, |
| | |
| | | entityName: props.entityName, |
| | | formJson: GetCrudForm(), //getFormSchema(`${entityName.value}_Crud`), |
| | | crudColSlots: colSlots.value, |
| | | others: others.value, |
| | | keyFieldValues: keyFieldValues.value, |
| | | isExistSql: isExistSql, |
| | | }); |
| | | } |
| | |
| | | * @version: |
| | | * @Date: 2024-05-30 13:28:20 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-25 14:41:28 |
| | | * @LastEditTime: 2024-07-03 08:46:37 |
| | | --> |
| | | <template> |
| | | <PageWrapper :title="pageTitle" :content="contentStr" contentBackground @back="goBack"> |
| | |
| | | const cType = ref(''); |
| | | const dtlSlots = ref([] as any[]); |
| | | const selectVals = ref({}); |
| | | const others = ref<any>(null); |
| | | const keyFieldValues = ref<any>(null); |
| | | provide<Ref<any>>('objParams', objParams.value); |
| | | provide<Ref<any>>('others', others); |
| | | provide<Ref<any>>('keyFieldValues', keyFieldValues); |
| | | const [registerCust] = useModal(); |
| | | |
| | | var currentKey = ref('detailfirst'); |
| | |
| | | } |
| | | return data; |
| | | }, |
| | | OthersValues: (val: string, id: string) => { |
| | | KeyFieldValues: (val: string, id: string) => { |
| | | return { DFTG_CODE: val }; |
| | | } /** |
| | | * @description: 自定义明细表中编辑返回方法 |
| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-07-02 21:06:18 |
| | | * @LastEditTime: 2024-07-03 11:42:26 |
| | | */ |
| | | |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | |
| | | Title: '新增不良代码组', |
| | | // pCode: 'DFTG_CODE', |
| | | IsID: false, |
| | | drawers: [{ name: 'BAS_DEFECT', code: 'DFTG_CODE' }], //drawers是右边弹出增改侧框的名字列表 |
| | | drawers: [{ name: 'BAS_DEFECT', code: 'DFTG_CODE', type: 'one' }], //drawers是右边弹出增改侧框的名字列表 |
| | | }, |
| | | }; |
| | | }, |
| | |
| | | Title: `编辑不良代码组:${params['record']['DFTG_CODE']}`, |
| | | pCode: 'DFTG_CODE', |
| | | IsID: false, |
| | | drawers: [{ name: 'BAS_DEFECT', code: 'DFTG_CODE' }], //drawers是右边弹出增改侧框的名字列表 |
| | | drawers: [{ name: 'BAS_DEFECT', code: 'DFTG_CODE', type: 'one' }], //drawers是右边弹出增改侧框的名字列表 |
| | | }; |
| | | // 将对象转换为JSON字符串并保存到sessionStorage |
| | | sessionStorage.removeItem(`${param.SessionName}_params`); |
| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-28 10:52:45 |
| | | * @LastEditTime: 2024-07-03 08:52:24 |
| | | */ |
| | | |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | |
| | | pageTitle: '标签模板变量', //详情页面标题 |
| | | contentStr: '这里是标签模板变量管理页面,可以管理标签的模板变量或者打印过程中的变量', |
| | | detailName: `模板[${params['record'].LABEL_NAME}]`, |
| | | others: { LABEL_ID: params['record'].ID }, |
| | | keyFieldValues: { LABEL_ID: params['record'].ID }, |
| | | colSlots: ['BAS_LABEL_PV1add'], |
| | | }; |
| | | go(`/BAS_LABEL_VAR/${encodeURI(JSON.stringify(id))}`); |
| | |
| | | }, |
| | | ]; |
| | | }, |
| | | OthersValues: (val: string, id: string) => { |
| | | KeyFieldValues: (val: string, id: string) => { |
| | | return { LABEL_ID: id }; |
| | | }, |
| | | }; |
| | |
| | | GetCrudForm: (type: string) => { |
| | | return crudForms[type]; |
| | | }, |
| | | OthersValues: (val: string, id: string) => { |
| | | KeyFieldValues: (val: string, id: string) => { |
| | | return { PKG_RULE_ID: id }; |
| | | }, |
| | | /** |
| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-07-02 21:03:23 |
| | | * @LastEditTime: 2024-07-03 11:42:41 |
| | | */ |
| | | |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | |
| | | Title: '新增包装规则', |
| | | pCode: 'PKG_RULE_ID', |
| | | IsID: true, |
| | | drawers: [{ name: 'BAS_PKG_DTL', code: 'PKG_RULE_ID' }], //drawers是右边弹出增改侧框的名字列表 |
| | | drawers: [{ name: 'BAS_PKG_DTL', code: 'PKG_RULE_ID', type: 'one' }], //drawers是右边弹出增改侧框的名字列表 |
| | | }, |
| | | }; |
| | | }, |
| | |
| | | Title: `编辑包装规则:${params['record']['RULE_CODE']}`, |
| | | pCode: 'PKG_RULE_ID', |
| | | IsID: true, |
| | | drawers: [{ name: 'BAS_PKG_DTL', code: 'PKG_RULE_ID' }], //drawers是右边弹出增改侧框的名字列表 |
| | | drawers: [{ name: 'BAS_PKG_DTL', code: 'PKG_RULE_ID', type: 'one' }], //drawers是右边弹出增改侧框的名字列表 |
| | | }; |
| | | // 将对象转换为JSON字符串并保存到sessionStorage |
| | | sessionStorage.removeItem(`${param.SessionName}_params`); |
| | |
| | | } |
| | | return data; |
| | | }, |
| | | OthersValues: (val: string, id: string) => { |
| | | KeyFieldValues: (val: string, id: string) => { |
| | | return { RSNG_CODE: val }; |
| | | }, |
| | | /** |
| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-07-02 21:29:04 |
| | | * @LastEditTime: 2024-07-03 11:42:48 |
| | | */ |
| | | |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | |
| | | Title: '新增不良原因组', |
| | | pCode: 'RSNG_CODE', |
| | | IsID: false, |
| | | drawers: [{ name: 'BAS_REASON', code: 'RSNG_CODE' }], //drawers是右边弹出增改侧框的名字列表 |
| | | drawers: [{ name: 'BAS_REASON', code: 'RSNG_CODE', type: 'one' }], //drawers是右边弹出增改侧框的名字列表 |
| | | }, |
| | | }; |
| | | }, |
| | |
| | | Title: `编辑不良原因组:${params['record']['RSNG_CODE']}`, |
| | | pCode: 'RSNG_CODE', |
| | | IsID: false, |
| | | drawers: [{ name: 'BAS_REASON', code: 'RSNG_CODE' }], //drawers是右边弹出增改侧框的名字列表 |
| | | drawers: [{ name: 'BAS_REASON', code: 'RSNG_CODE', type: 'one' }], //drawers是右边弹出增改侧框的名字列表 |
| | | }; |
| | | // 将对象转换为JSON字符串并保存到sessionStorage |
| | | sessionStorage.removeItem(`${param.SessionName}_params`); |
| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-07-02 19:41:38 |
| | | * @LastEditTime: 2024-07-03 10:15:44 |
| | | */ |
| | | |
| | | import { Ref, h, ref, unref } from 'vue'; |
| | |
| | | } |
| | | return data; |
| | | }, |
| | | OthersValues: (val: string, id: string) => { |
| | | KeyFieldValues: (val: string, id: string) => { |
| | | return { SFTS_CODE: val }; |
| | | } /** |
| | | } |
| | | /** |
| | | * @description: 自定义明细表中编辑返回方法 |
| | | * @param {string} type |
| | | * @param {*} d |
| | |
| | | * @return {*} |
| | | */ |
| | | function Del(args: Fn[], params: {}) { |
| | | const name = params['name']; |
| | | if (!isNullOrEmpty(params['data'])) { |
| | | var _data = params['data'].value.filter((item) => item['ID'] != params['record']['ID']); |
| | | params['data'].value = _data; |
| | | var _data = params['data'].value[name].filter((item) => item['ID'] != params['record']['ID']); |
| | | params['data'].value[name] = _data; |
| | | args[6]({ |
| | | dataSource: [], |
| | | }); |
| | | args[6]({ |
| | | dataSource: params['data'], |
| | | dataSource: params['data'].value[name], |
| | | }); |
| | | args[1](); |
| | | } else { |
| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-07-02 21:28:53 |
| | | * @LastEditTime: 2024-07-03 11:42:15 |
| | | */ |
| | | |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | |
| | | pCode: 'SFTS_CODE', //主信息关键字段CODE |
| | | IsID: false, //是否带过去侧边框的是ID,false就是CODE,true是ID |
| | | drawers: [ |
| | | { name: 'MES_SHIFT', code: 'SFTS_CODE' }, |
| | | { name: 'MES_SHIFT_PRD', code: 'SFT_CODE' }, |
| | | { name: 'MES_SHIFT', code: 'SFTS_CODE', type: 'one' }, |
| | | { name: 'MES_SHIFT_PRD', code: 'SFT_CODE', type: 'all', keyName: 'MES_SHIFT' }, |
| | | ], //drawers是右边弹出增改侧框的名字列表 |
| | | }, |
| | | }; |
| | |
| | | // pCode: 'SFTS_CODE', //主信息关键字段CODE,高级表单用下面drawers里的code |
| | | IsID: false, //是否带过去侧边框的是ID,false就是CODE,true是ID |
| | | drawers: [ |
| | | { name: 'MES_SHIFT', code: 'SFTS_CODE' }, |
| | | { name: 'MES_SHIFT_PRD', code: 'SFT_CODE' }, |
| | | { name: 'MES_SHIFT', code: 'SFTS_CODE', type: 'one' }, //type: one-表示需要code: 'SFTS_CODE'只要唯一值 |
| | | { name: 'MES_SHIFT_PRD', code: 'SFT_CODE', type: 'all', keyName: 'MES_SHIFT' }, //type: all-表示需要code: 'SFT_CODE'所有的值,keyName:表示需要所有值的code的实体名 |
| | | ], //drawers是右边弹出增改侧框的名字列表 |
| | | }; |
| | | // 将对象转换为JSON字符串并保存到sessionStorage |
| | |
| | | } |
| | | return data; |
| | | }, |
| | | OthersValues: (val: string, id: string) => { |
| | | KeyFieldValues: (val: string, id: string) => { |
| | | return { TECH_STD: val }; |
| | | }, |
| | | /** |
| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-07-02 21:29:12 |
| | | * @LastEditTime: 2024-07-03 11:43:01 |
| | | */ |
| | | |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | |
| | | pCode: 'TECH_STD', //跳转到高级表单的关键字段名 |
| | | mCode: 'STD_CODE', //跳转到高级表单的关键字段名映射字段 |
| | | IsID: false, |
| | | drawers: [{ name: 'QMS_INS_ITEM', code: 'STD_CODE' }], //IfShow: true:高级表单是否显示子表格增删改,drawers是右边弹出增改侧框的名字列表 |
| | | drawers: [{ name: 'QMS_INS_ITEM', code: 'STD_CODE', type: 'one' }], //IfShow: true:高级表单是否显示子表格增删改,drawers是右边弹出增改侧框的名字列表 |
| | | }, |
| | | }; |
| | | }, |
| | |
| | | pCode: 'TECH_STD', //跳转到高级表单的关键字段名 |
| | | mCode: 'STD_CODE', //跳转到高级表单的关键字段名映射字段 |
| | | IsID: false, |
| | | drawers: [{ name: 'QMS_INS_ITEM', code: 'STD_CODE' }], //drawers是右边弹出增改侧框的名字列表 |
| | | drawers: [{ name: 'QMS_INS_ITEM', code: 'STD_CODE', type: 'one' }], //drawers是右边弹出增改侧框的名字列表 |
| | | }; |
| | | // 将对象转换为JSON字符串并保存到sessionStorage |
| | | sessionStorage.removeItem(`${param.SessionName}_params`); |
| | |
| | | }, |
| | | ]; |
| | | }, |
| | | OthersValues: (val: string, id: string) => { |
| | | KeyFieldValues: (val: string, id: string) => { |
| | | return { RSNG_CODE: val }; |
| | | }, |
| | | }; |
| | |
| | | <TableAction :actions="createActions(record, index, item.name)" /> |
| | | </template> |
| | | <template #[item]="{ field }" v-for="item in colSlots" :key="item"> |
| | | <!-- <template #form-BAS_REASON3aadd="{ field }"> --> |
| | | <a-button |
| | | v-if="field" |
| | | class="mt-1 ml-1" |
| | |
| | | </div> |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import { Ref, inject, nextTick, onMounted, ref, watch } from 'vue'; |
| | | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| | | import { BasicForm, useForm } from '/@/components/Form/index'; |
| | | import { Ref, inject, onMounted, ref, watch } from 'vue'; |
| | | import { BasicTable, TableAction } from '/@/components/Table'; |
| | | import { useForm } from '/@/components/Form/index'; |
| | | import GeneralModal from '/@/views/components/GeneralModal.vue'; |
| | | import normalDrawer from '../normalDrawer.vue'; |
| | | import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; |
| | |
| | | entityName: { type: String }, |
| | | crudColSlots: { type: Object as PropType<any> }, |
| | | }); |
| | | /* 主页面注入的变量 */ |
| | | const objParams = inject('objParams') as Ref<any>; |
| | | const data = inject('data') as Ref<any>; |
| | | const _useTables = inject('useTables') as Ref<any>; |
| | | const useFormData = inject('useFormData') as Ref<{}>; |
| | | const others = inject('others') as Ref<Recordable[]>; |
| | | const keyFieldValues = inject('keyFieldValues') as Ref<Recordable[]>; |
| | | |
| | | const go = useGo(); |
| | | const [registerItemAdd, { openModal: openItemModal }] = useModal(); |
| | | const cType = ref(''); |
| | | const dtlSlots = ref([] as any[]); |
| | | const selectVals = ref({}); |
| | | const baseCards = ref([] as any[]); |
| | | const useModalData = ref({}); //表单中插槽渲染按钮打开模态框useModal方法 |
| | | const custImport = ref<any[]>([]); |
| | | const EntityCustFunction = ref([ |
| | | { |
| | | ActionItem(params, data, ...args) {}, |
| | | EditOperation(data, d, u, item) {}, |
| | | GetBaseColumns(type: string | undefined) {}, |
| | | GetSearchForm(type: string | undefined) {}, |
| | | GetCrudForm(type: string | undefined, ...args) {}, |
| | | OthersValues(val, id) {}, |
| | | KeyFieldValues(val, id) {}, |
| | | GetTitle(type: string | undefined) {}, |
| | | GetUseTables(data: Ref<Recordable[]>, ...args) {}, |
| | | GetUseDrawers() {}, |
| | |
| | | { |
| | | ActionItem: nActionItem, |
| | | EditOperation, |
| | | GetBaseColumns, |
| | | GetSearchForm, |
| | | GetCrudForm, |
| | | OthersValues, |
| | | KeyFieldValues, |
| | | GetTitle, |
| | | GetUseTables, |
| | | GetUseDrawers, |
| | |
| | | ] = isNullOrUnDef(custImport.value['default']) |
| | | ? EntityCustFunction.value |
| | | : custImport.value['default'](); |
| | | others.value = OthersValues(objParams.value['CODE'], objParams.value['ID']); |
| | | const drawers = ref<any[]>(objParams.value['drawers']); |
| | | const useTables = GetUseTables(data, emit); |
| | | const useDrawers = GetUseDrawers(); |
| | | _useTables.value = useTables; |
| | | keyFieldValues.value = KeyFieldValues(objParams.value['CODE'], objParams.value['ID']); //获取一些其他有需要提供的值,这里是主页面跳转过来时带的关键字段值 |
| | | const drawers = ref<any[]>(objParams.value['drawers']); //是右侧边框列表,里面的name表示是哪一个实体,也就是高级表单中表格的名字,很多方法需要以这个名字为key |
| | | const useTables = GetUseTables(data, emit); //高级表单中各个表格(Table)的useTable方法实现列表 |
| | | const useDrawers = GetUseDrawers(); //高级表单中各个表格(Table)的右侧边框(Drawer)的useDrawer方法实现列表 |
| | | _useTables.value = useTables; //把useTable的列表响应到从主页面注入的_useTables,这样主页面能拿到useTable的结果,从而可以使用各个表格的内置方法 |
| | | // watch( |
| | | // () => props.dataSource, |
| | | // (newVal, oldVal) => { |
| | |
| | | // { deep: true, immediate: true }, |
| | | // ); |
| | | |
| | | /** |
| | | * @description: 挂载组件完成时 |
| | | * @return {*} |
| | | */ |
| | | onMounted(async () => { |
| | | for (const i in drawers.value) { |
| | | let sqlcmd = ' 1 =1 '; |
| | | if (!isNullOrEmpty(others.value[drawers.value[i].code])) { |
| | | sqlcmd += ` And ${drawers.value[i].code} = '${others.value[drawers.value[i].code]}'`; |
| | | if (!isNullOrEmpty(keyFieldValues.value[drawers.value[i].code])) { |
| | | sqlcmd += ` And ${drawers.value[i].code} = '${keyFieldValues.value[drawers.value[i].code]}'`; |
| | | } |
| | | const list = await getEntity({ |
| | | sqlcmd: sqlcmd, |
| | |
| | | * @param {*} record |
| | | * @return {*} |
| | | */ |
| | | function createActions(record,index, item) { |
| | | function createActions(record, index, item) { |
| | | const params = { |
| | | record, |
| | | isUpdate: true, |
| | |
| | | useFormData, |
| | | crudColSlots: props.crudColSlots, |
| | | data, |
| | | name: item, //drawers列表里面的name,表示是哪一个实体,也就是高级表单中表格的名字 |
| | | }; |
| | | const actionItem = [ |
| | | { |
| | |
| | | return validates; |
| | | } |
| | | |
| | | /** |
| | | * @description: 新增按钮方法 |
| | | * @param {*} index |
| | | * @param {*} item |
| | | * @return {*} |
| | | */ |
| | | function handleCreate(index, item) { |
| | | validate().then((res) => { |
| | | const Keys = Object.getOwnPropertyNames(useFormData.value); |
| | | let i; |
| | | for (i = 0; i < Keys.length; i++) { |
| | | others.value[objParams.value['pCode']] = objParams.value['IsID'] |
| | | keyFieldValues.value[objParams.value['pCode']] = objParams.value['IsID'] |
| | | ? res[Keys[i]]['ID'] |
| | | : res[Keys[i]][objParams.value['pCode']] == '0' || |
| | | isNullOrUnDef(res[Keys[i]][objParams.value['pCode']]) |
| | |
| | | isUpdate: false, |
| | | ifSave: true, |
| | | entityName: props.entityName, |
| | | formJson: GetCrudForm(item, data), //getFormSchema(`${entityName.value}_Crud`), |
| | | formJson: GetCrudForm(item, data), //获取增删改表单字段 |
| | | crudColSlots: props.crudColSlots, |
| | | others: others.value, |
| | | keyFieldValues: keyFieldValues.value, |
| | | }); |
| | | }); |
| | | } |
| | |
| | | * @description: 新增编辑返回成功方法 |
| | | * @param {*} d |
| | | * @param {*} u |
| | | * @param {*} item 页面上循环抽屉列表传入的实体名字,作为各表格相关方法的key,从而调用各表格相关的方法,如:useTables[item][1].setProps |
| | | * @return {*} |
| | | */ |
| | | */ |
| | | function handleSuccess(d, u, item) { |
| | | if (!isNullOrUnDef(custImport.value)) { |
| | | /* 自定义编辑方法,根据实体名去调用 */ |
| | |
| | | * @description: 弹出选择框选择成功后事件 |
| | | * @param {*} d |
| | | * @param {*} u |
| | | * @param {*} item |
| | | * @param {*} item 页面上循环抽屉列表传入的实体名字,作为各表格相关方法的key,从而调用各表格相关的方法,如:useTables[item][1].getForm() |
| | | * @return {*} |
| | | */ |
| | | function handleItemSuccess(d, u, item) { |
| | |
| | | * @version: |
| | | * @Date: 2024-06-18 15:09:48 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-07-02 22:51:31 |
| | | * @LastEditTime: 2024-07-03 14:36:19 |
| | | --> |
| | | <!-- |
| | | * _oo0oo_ |
| | |
| | | import { buildUUID } from '/@/utils/uuid'; |
| | | import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { isFunction } from 'xe-utils'; |
| | | |
| | | const { t } = useI18n(); |
| | | |
| | |
| | | const otherCards = ref([] as any[]); |
| | | const isMounted = ref(false); |
| | | const custImport = ref<any[]>([]); |
| | | const others = ref<any>(null); |
| | | const keyFieldValues = ref<any>(null); |
| | | const data = ref<any>({}); |
| | | const useTables = ref<any>({}); |
| | | for (const i in objParams.value['drawers']) { |
| | |
| | | } |
| | | provide<Ref<any>>('objParams', objParams); |
| | | provide<Ref<any>>('data', data); |
| | | provide<Ref<any>>('others', others); |
| | | provide<Ref<any>>('keyFieldValues', keyFieldValues); |
| | | provide<Ref<{}>>('useFormData', useFormData); |
| | | provide<Ref<any>>('baseCards', baseCards); |
| | | provide<Ref<any>>('useTables', useTables); |
| | |
| | | * @description: 异步全部提交方法 |
| | | * @return {*} |
| | | */ |
| | | function submitAll() { |
| | | async function submitAll() { |
| | | try { |
| | | validate().then((res) => { |
| | | const Keys = Object.getOwnPropertyNames(useFormData.value); |
| | | let i; |
| | | let p = [] as Promise<any>[]; |
| | | for (i = 0; i < Keys.length; i++) { |
| | | p.push(SaveEntity(res[Keys[i]], unref(isAllUpdate), baseCards.value[i]['entityName'])); |
| | | } |
| | | Promise.all(p).then((action) => { |
| | | // DeleteWhere( |
| | | // ` ${objParams.value.pCode} = '${others.value[objParams.value.pCode]}'`, |
| | | // entityName.value, |
| | | // ).then((res) => { |
| | | // if (res.IsSuccessed) { |
| | | // data.value.forEach((item) => { |
| | | // item.ID = buildUUID(); |
| | | // }); |
| | | // AddListEntity(data.value, entityName.value).then((action) => { |
| | | // if (action.IsSuccessed) { |
| | | // cancel(); |
| | | // } |
| | | // }); |
| | | // } |
| | | // }); |
| | | let where = `${objParams.value['drawers'][0]['code']} = '${others.value[objParams.value['drawers'][0]['code']]}'`; |
| | | data.value[objParams.value['drawers'][0]['name']].forEach((item) => { |
| | | const validates = await validate(); |
| | | const Keys = Object.getOwnPropertyNames(useFormData.value); |
| | | let i; |
| | | let p = [] as Promise<any>[]; |
| | | for (i = 0; i < Keys.length; i++) { |
| | | p.push( |
| | | SaveEntity(validates[Keys[i]], unref(isAllUpdate), baseCards.value[i]['entityName']), |
| | | ); |
| | | } |
| | | await Promise.all(p); |
| | | if ( |
| | | !custImport.value['default']()[0].SubmitAll && |
| | | !isFunction(custImport.value['default']()[0].SubmitAll) |
| | | ) { |
| | | /* 默认提交 */ |
| | | objParams.value['drawers'].forEach((d) => { |
| | | let where = `${d['code']} = '${keyFieldValues.value[d['code']]}'`; |
| | | /* type: all-表示需要code的所有的值 */ |
| | | if(d['type'] == 'all'){ |
| | | where = `${d['code']} in (${data.value[d['keyName']].map(value => `'${value[d['code']]}'`).join(',')})`; |
| | | } |
| | | data.value[d['name']].map((item) => { |
| | | item.ID = buildUUID(); |
| | | }); |
| | | AddAfterDelete( |
| | | objParams.value['drawers'][0]['name'], |
| | | data.value[objParams.value['drawers'][0]['name']], |
| | | d['name'], |
| | | data.value[d['name']], |
| | | where, |
| | | ).then((action) => { |
| | | if (action.IsSuccessed) { |
| | |
| | | } |
| | | }); |
| | | }); |
| | | }); |
| | | // values.ID = params.RULE_ID; |
| | | // const action = await SaveRule({ ...values, ...testValues }); |
| | | // if (action.IsSuccessed) { |
| | | // await DeleteRuleDtl(params.RULE_ID); |
| | | // const dtlAction = await SaveRuleDtl(data.value); |
| | | // if (dtlAction.IsSuccessed) { |
| | | // cancel(); |
| | | // } |
| | | // } |
| | | } else { |
| | | /* 如果自定义提交方法存在就用自定义提交 */ |
| | | custImport.value['default']()[0].SubmitAll(data); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | async function cancel() { |
| | |
| | | * @version: |
| | | * @Date: 2024-05-30 13:28:20 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-24 18:49:29 |
| | | * @LastEditTime: 2024-07-03 08:52:44 |
| | | --> |
| | | <template> |
| | | <div> |
| | |
| | | const custImport = ref<any>(null); |
| | | const isMounted = ref(false); |
| | | const buttons = ref([]); |
| | | const others = ref<any>(null); |
| | | const keyFieldValues = ref<any>(null); |
| | | provide<Ref<any>>('objParams', objParams.value); |
| | | provide<Ref<any[]>>('_columns', _columns); |
| | | provide<Ref<any[]>>('_searchFormSchema', _searchFormSchema); |
| | | provide<Ref<any[]>>('_crudFormSchema', _crudFormSchema); |
| | | provide<Ref<string>>('isExistSql', isExistSql); |
| | | provide<Ref<any>>('others', others); |
| | | provide<Ref<any>>('keyFieldValues', keyFieldValues); |
| | | |
| | | const [registerCust, { openModal: openCustomModal, closeModal }] = useModal(); |
| | | |
| | |
| | | const _crudFormSchema = inject('_crudFormSchema') as Ref<any[]>; |
| | | const buttons = ref<[]>(await getRoleButtons(currentRoute.value.meta.menuCode as string)); |
| | | const isExistSql = inject('isExistSql') as Ref<string>; |
| | | const others = inject('others') as Ref<Recordable[]>; |
| | | const keyFieldValues = inject('keyFieldValues') as Ref<Recordable[]>; |
| | | const entityName = ref(objParams['ID']); |
| | | const go = useGo(); |
| | | const [registerDrawer, { openDrawer }] = useDrawer(); |
| | |
| | | const EntityCustFunction = ref([ |
| | | { |
| | | ActionItem(params, data, ...args) {}, |
| | | EditOperation(data, d, u) {}, |
| | | GetBaseColumns(type: string | undefined) {}, |
| | | GetSearchForm(type: string | undefined) {}, |
| | | GetCrudForm(type: string | undefined, ...args) {}, |
| | | OthersValues(val, id) {}, |
| | | KeyFieldValues(val, id) {}, |
| | | } as EntityCustFunctionType, |
| | | ]); |
| | | /* 动态import实体名.ts的自定义方法 */ |
| | |
| | | const [ |
| | | { |
| | | ActionItem: nActionItem, |
| | | EditOperation, |
| | | GetBaseColumns, |
| | | GetSearchForm, |
| | | GetCrudForm, |
| | | OthersValues, |
| | | KeyFieldValues, |
| | | }, |
| | | ] = isNullOrUnDef(custImport.value['default']) |
| | | ? EntityCustFunction.value |
| | | : custImport.value['default'](); |
| | | others.value = isNullOrUnDef(OthersValues) |
| | | keyFieldValues.value = isNullOrUnDef(KeyFieldValues) |
| | | ? {} |
| | | : OthersValues(objParams['CODE'], objParams['ID']); |
| | | : KeyFieldValues(objParams['CODE'], objParams['ID']); |
| | | const [registerTable, { getForm, reload, setProps }] = useTable({ |
| | | title: '列表信息', |
| | | api: getListByPage, |
| | |
| | | ...data.record, |
| | | }); |
| | | } else { |
| | | if (!isNullOrUnDef(data?.others)) { |
| | | setFieldsValue(data?.others); |
| | | if (!isNullOrUnDef(data?.keyFieldValues)) { |
| | | setFieldsValue(data?.keyFieldValues); |
| | | } |
| | | } |
| | | }); |