/*
|
* @Description: 产品工艺路线相关
|
* @Author: Ben Lin
|
* @version:
|
* @Date: 2024-06-19 20:34:27
|
* @LastEditors: Ben Lin
|
* @LastEditTime: 2024-08-08 01:01:39
|
*/
|
|
import { ActionItem, BasicColumn } from '/@/components/Table';
|
|
function _default() {
|
const ActionColumn: BasicColumn = {
|
width: 80,
|
title: '操作',
|
dataIndex: 'action',
|
slots: { customRender: 'action' },
|
fixed: undefined,
|
};
|
|
/**
|
* @description: 一些自定义方法
|
* @return {*}
|
*/
|
const methods = {
|
/**
|
* @description: 获取新增按钮的行为
|
* @return {*}
|
*/
|
CreateAction: (type: string) => {
|
return {
|
action: 'drawer', //drawer(打开左侧抽屉框) | go(跳转到新的页面) | edit(如果是表格可编辑页面就是自定义方法)
|
};
|
},
|
/**
|
* @description: 产品绑定工艺路线操作字段自定义按钮
|
* @return {*}
|
*/
|
ActionItem: (params: Recordable<any>, data, ...args): ActionItem[] => {
|
return [
|
{
|
icon: 'binding|svg',
|
tooltip: '绑定工艺',
|
onClick: handleBinding.bind(null, args[5], params),
|
name: undefined
|
},
|
];
|
},
|
KeyFieldValues: (val: string, id: string) => {
|
return { RSNG_CODE: val };
|
},
|
GetUseForm: () => {
|
return {};
|
},
|
};
|
|
/* 以下是内部方法,不export,供上面的方法调用 */
|
|
/**
|
* @description: 跳转产品工艺绑定页面
|
* @param {*} params
|
* @return {*}
|
*/
|
function handleBinding(go: Fn, params: Recordable<any>) {
|
const id = {
|
ID: params['record'].ID,
|
Name: 'ProdRouteBinding', /* 一般是实体名 */
|
CODE: params['record'].ITEM_CODE, /* 关键字段编码 */
|
Title: `产品[${params['record'].ITEM_CODE}]工艺绑定`, /* 跳转后tab页签的标题 */
|
colSlots: [] /* 表格内的查询表单字段的插槽列表,一般用于弹出选择框按钮 */,
|
crudColSlots: {BAS_PKG_DTL:['BAS_LABEL_TEMP1add'], ItemCode: ['BAS_CODE_RULE1add']} /* 增删改表单字段的插槽列表,一般用于弹出选择框按钮 */,
|
OtherTableName: ['BAS_PKG_DTL', 'ItemCode'], /* 自定义显示列表的表名,跟上面增删改的表名一致,有多个就放列表中 */
|
dense: true,
|
pageTitle: `产品工艺绑定`,
|
pageContent: `这里是管理产品的工艺绑定,一个产品可以绑定多个工艺路线`,
|
SessionName: 'ProdRouteBinding_update', /* session名,用来传递参数,不在浏览器地址栏显示 */
|
ifSave: false, /* 新增编辑是否保存到数据库 */
|
rotType: 'Route'
|
};
|
// 将对象转换为JSON字符串并保存到sessionStorage
|
sessionStorage.removeItem(`${id.SessionName}_params`);
|
sessionStorage.setItem(`${id.SessionName}_params`, encodeURI(JSON.stringify(id)));
|
go(`/ProdRouteBinding/CP/${encodeURI(JSON.stringify({ sName: id.SessionName, Name: id.Name }))}`);
|
}
|
return [methods, ActionColumn];
|
}
|
|
export default _default;
|