| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-22 00:34:46 |
| | | * @LastEditTime: 2024-06-23 00:22:36 |
| | | */ |
| | | |
| | | import { Ref } from 'vue'; |
| | | import { DeleteEntity } from '/@/api/tigerapi/system'; |
| | | import { ActionItem } from '/@/components/Table'; |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | | import { isNullOrEmpty } from '/@/utils/is'; |
| | | import { buildUUID } from '/@/utils/uuid'; |
| | | import { useUserStore } from '/@/store/modules/user'; |
| | | import { formatToDateTime } from '/@/utils/dateUtil'; |
| | | |
| | | function _default() { |
| | | /** |
| | | * @description: 产品绑定工艺路线操作字段自定义按钮 |
| | | * @return {*} |
| | | */ |
| | | function ActionItem(params: Recordable<any>, data, ...args): ActionItem[] { |
| | | data[1].popConfirm.confirm = custDel.bind(null, args[1], params); |
| | | return data; |
| | | } |
| | | |
| | | /** |
| | | * @description: 自定义删除方法 |
| | | * @param {Fn} args |
| | |
| | | }); |
| | | } |
| | | } |
| | | /** |
| | | * @description: 公用编辑方法 |
| | | * @param {Fn} fn |
| | | * @param {*} params |
| | | * @return {*} |
| | | */ |
| | | function editRecord(fn: Fn, params: {}) { |
| | | fn(true, params); |
| | | } |
| | | |
| | | return [ActionItem]; |
| | | const ActionColumn: BasicColumn = { |
| | | width: 80, |
| | | title: '操作', |
| | | dataIndex: 'action', |
| | | slots: { customRender: 'action' }, |
| | | fixed: undefined, |
| | | }; |
| | | |
| | | const methods = { |
| | | /** |
| | | * @description: 获取新增按钮的行为 |
| | | * @return {*} |
| | | */ |
| | | CreateAction: () => { |
| | | return { |
| | | action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面) |
| | | }; |
| | | }, |
| | | /** |
| | | * @description: 产品绑定工艺路线操作字段自定义按钮 |
| | | * @return {*} |
| | | */ |
| | | ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => { |
| | | data[1].popConfirm.confirm = custDel.bind(null, args[1], params); |
| | | return data; |
| | | }, |
| | | /** |
| | | * @description: 自定义明细表中编辑返回方法 |
| | | * @param {string} type |
| | | * @param {*} d |
| | | * @param {*} u |
| | | * @return {*} |
| | | */ |
| | | EditeOperation: (data: Ref<any[]>, d, u) => { |
| | | if (u.isUpdate) { |
| | | //更新 |
| | | var _data = data.value.map((item) => { |
| | | if (item['ID'] == d.ID) |
| | | return { |
| | | ...item, |
| | | PKG_CODE: d.PKG_CODE, |
| | | PKG_LEVEL: d.PKG_LEVEL, |
| | | PKG_QTY: d.PKG_QTY, |
| | | LABEL_CODE: d.LABEL_CODE, |
| | | REMARK: d.REMARK, |
| | | }; |
| | | return item; |
| | | }); |
| | | data.value = _data; |
| | | } else { |
| | | //新增 |
| | | d.ID = buildUUID(); |
| | | d.CREATE_USER = useUserStore().getUserInfo.userId as string; |
| | | d.UPDATE_TIME = formatToDateTime(new Date()); |
| | | d.UPDATE_USER = useUserStore().getUserInfo.userId as string; |
| | | var _data2: any[] = []; |
| | | if (!isNullOrEmpty(data.value)) { |
| | | _data2 = data.value.map((item) => { |
| | | return item; |
| | | }); |
| | | } |
| | | _data2.push(d); |
| | | data.value = _data2; |
| | | } |
| | | }, |
| | | GetHomeUrl: () => { |
| | | return `/BAS_PKG_RULE/LC/${encodeURI(JSON.stringify({ ID: 'BAS_PKG_RULE', colSlots: [], crudColSlots: [] }))}`; |
| | | } |
| | | }; |
| | | |
| | | return [methods, ActionColumn]; |
| | | } |
| | | |
| | | export default _default; |