| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-24 15:51:12 |
| | | * @LastEditTime: 2024-06-26 03:14:01 |
| | | */ |
| | | |
| | | import { Ref } from 'vue'; |
| | | import { DeleteEntity, getEntity } from '/@/api/tigerapi/system'; |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | | import { isNullOrEmpty } from '/@/utils/is'; |
| | | import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; |
| | | import { buildUUID } from '/@/utils/uuid'; |
| | | import { useUserStore } from '/@/store/modules/user'; |
| | | import { formatToDateTime } from '/@/utils/dateUtil'; |
| | | |
| | | function _default(): any[] { |
| | | /** |
| | | * @description: 自定义删除方法 |
| | | * @param {Fn} args |
| | | * @param {*} params |
| | | * @return {*} |
| | | */ |
| | | function custDel(args: Fn[], params: {}) { |
| | | if (!isNullOrEmpty(params['data'])) { |
| | | var _data = params['data'].value.filter((item) => item['ID'] != params['record']['ID']); |
| | | params['data'].value = _data; |
| | | args[6]({ |
| | | dataSource: [], |
| | | }); |
| | | args[6]({ |
| | | dataSource: params['data'], |
| | | }); |
| | | args[1](); |
| | | } else { |
| | | DeleteEntity(params['record'], params['entityName']).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | args[1](); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | const ActionColumn: BasicColumn = { |
| | | width: 80, |
| | | title: '操作', |
| | |
| | | fixed: undefined, |
| | | }; |
| | | |
| | | /** |
| | | * @description: 一些自定义方法 |
| | | * @return {*} |
| | | */ |
| | | const methods = { |
| | | /** |
| | | * @description: 获取新增按钮的行为 |
| | |
| | | }; |
| | | }, |
| | | /** |
| | | * @description: 产品绑定工艺路线操作字段自定义按钮 |
| | | * @description: 操作字段自定义按钮 |
| | | * @return {*} |
| | | */ |
| | | ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => { |
| | | /* 重写删除方法 */ |
| | | data[1].popConfirm.confirm = custDel.bind(null, args, params); |
| | | if (!isNullOrUnDef(data[1])) { |
| | | data[1].popConfirm.confirm = custDel.bind(null, args, params); |
| | | } |
| | | return data; |
| | | }, |
| | | /** |
| | |
| | | * @param {*} u |
| | | * @return {*} |
| | | */ |
| | | EditeOperation: (data: Ref<any[]>, d, u) => { |
| | | EditOperation: (data: Ref<any[]>, d, u) => { |
| | | if (u.isUpdate) { |
| | | //更新 |
| | | var _data = data.value.map((item) => { |
| | |
| | | data.value = _data2; |
| | | } |
| | | }, |
| | | /** |
| | | * @description: 高级表单和详情页面返回主页面的url |
| | | * @return {*} |
| | | */ |
| | | GetHomeUrl: () => { |
| | | return `/BAS_PKG_RULE/LC/${encodeURI(JSON.stringify({ ID: 'BAS_PKG_RULE', colSlots: [], crudColSlots: [] }))}`; |
| | | }, |
| | |
| | | }, |
| | | ]; |
| | | }, |
| | | /** |
| | | * @description: 获取标题信息 |
| | | * @param {string} type |
| | | * @return {*} |
| | | */ |
| | | GetTitle: () => { |
| | | return { |
| | | pageTitle: '包装规则管理', |
| | | pageContent: '这里可以添加和修改包装规则和包装信息。', |
| | | baseTableTitle: '包装信息管理', |
| | | }; |
| | | }, |
| | | }; |
| | | |
| | | /* 以下是内部方法,不export,供上面的方法调用 */ |
| | | |
| | | /** |
| | | * @description: 自定义删除方法 |
| | | * @param {Fn} args |
| | | * @param {*} params |
| | | * @return {*} |
| | | */ |
| | | function custDel(args: Fn[], params: {}) { |
| | | if (!isNullOrEmpty(params['data'])) { |
| | | var _data = params['data'].value.filter((item) => item['ID'] != params['record']['ID']); |
| | | params['data'].value = _data; |
| | | args[6]({ |
| | | dataSource: [], |
| | | }); |
| | | args[6]({ |
| | | dataSource: params['data'], |
| | | }); |
| | | args[1](); |
| | | } else { |
| | | DeleteEntity(params['record'], params['entityName']).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | args[1](); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | return [methods, ActionColumn]; |
| | | } |
| | | |