| | |
| | | /* |
| | | * @Description: file content |
| | | * @Description: 不良原因相关 |
| | | * @Author: Ben Lin |
| | | * @version: |
| | | * @Date: 2024-06-22 00:58:43 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-23 18:28:55 |
| | | * @LastEditTime: 2024-06-26 03:13:26 |
| | | */ |
| | | /* |
| | | * @Description: 不良原因相关 |
| | | * @Author: Ben Lin |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-23 18:12:40 |
| | | */ |
| | | |
| | | import { Ref, h } 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'; |
| | | import { Tag } from 'ant-design-vue'; |
| | | |
| | | function _default() { |
| | | /** |
| | | * @description: 自定义删除方法 |
| | | * @param {Fn} args |
| | | * @param {*} params |
| | | * @return {*} |
| | | */ |
| | | function rsnGrpDel(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: 获取新增按钮的行为 |
| | | * @return {*} |
| | | */ |
| | | CreateAction: () => { |
| | | CreateAction: (fnName: string) => { |
| | | return { |
| | | action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面) |
| | | }; |
| | | }, |
| | | /** |
| | | * @description: 产品绑定工艺路线操作字段自定义按钮 |
| | | * @description: 操作字段自定义按钮 |
| | | * @return {*} |
| | | */ |
| | | ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => { |
| | | data[1].popConfirm.confirm = rsnGrpDel.bind(null, args, params); |
| | | if (!isNullOrUnDef(data[1])) { |
| | | data[1].popConfirm.confirm = rsnGrpDel.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_REASON_GRP/LC/${encodeURI(JSON.stringify({ ID: 'BAS_REASON_GRP', colSlots: [], crudColSlots: [] }))}`; |
| | | }, |
| | |
| | | OthersValues: (val: string, id: string) => { |
| | | return { RSNG_CODE: val }; |
| | | }, |
| | | /** |
| | | * @description: 获取标题信息 |
| | | * @param {string} type |
| | | * @return {*} |
| | | */ |
| | | GetTitle: () => { |
| | | return { |
| | | pageTitle: '不良原因组管理', |
| | | pageContent: '这里可以添加和修改不良原因组和不良代码。', |
| | | baseTableTitle: '不良原因管理', |
| | | }; |
| | | }, |
| | | }; |
| | | |
| | | /* 以下是内部方法,不export,供上面的方法调用 */ |
| | | |
| | | /** |
| | | * @description: 自定义删除方法 |
| | | * @param {Fn} args |
| | | * @param {*} params |
| | | * @return {*} |
| | | */ |
| | | function rsnGrpDel(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]; |
| | | } |
| | | |