334 lines
13 KiB
JavaScript
334 lines
13 KiB
JavaScript
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
|
||
import TableTextComponent from "@/components/noTemplateComponents/detailComponent";
|
||
import { timeFilter, dictFilter } from "@/utils/filters";
|
||
// import switchBtn from "@/components/noTemplateComponents/switchBtn";
|
||
import techBox from "@/components/noTemplateComponents/techBox";
|
||
|
||
export default function () {
|
||
const tableProps = [
|
||
{ type: "index", label: "序号" },
|
||
{ type: "selection" },
|
||
{ width: 160, prop: "code", label: "配方号" },
|
||
{ prop: "name", label: "牌号" },
|
||
{ prop: "syncTime", label: "同步时间", filter: timeFilter },
|
||
{ width: 120, prop: "techCode", label: "烧制曲线", subcomponent: techBox },
|
||
{ width: 110, prop: "upweight", label: "建议混料上限" },
|
||
{ width: 110, prop: "downweight", label: "建议混料下限" },
|
||
{ prop: "shortDesc", label: "喷码描述" },
|
||
// { prop: "specifications", label: "程序号" },
|
||
// { prop: "unitDictValue", label: "砖型", filter: dictFilter("unit") },
|
||
// { prop: "unitDictValue", label: "物料号", filter: dictFilter("unit") },
|
||
// { prop: "enabled", label: "状态", subcomponent: switchBtn }, // subcomponent
|
||
// { prop: "sumqty", label: "配方总重量[kg]", filter: val => !!val ? val + ' kg' : '-' },
|
||
// { prop: "sync", label: "同步状态" },
|
||
// { prop: "syncTime", label: "同步时间", fitler: timeFilter },
|
||
// { prop: "remark", label: "备注" },
|
||
// { prop: "description", label: "详情", subcomponent: TableTextComponent, buttonContent: "查看配方详情", actionName: 'view-recipe' },
|
||
{
|
||
prop: "description",
|
||
label: "配方",
|
||
subcomponent: TableTextComponent,
|
||
buttonContent: "查看配方",
|
||
actionName: "to-bom-detail",
|
||
emitFullData: true,
|
||
},
|
||
{
|
||
prop: "operations",
|
||
name: "操作",
|
||
fixed: "right",
|
||
width: 120,
|
||
subcomponent: TableOperaionComponent,
|
||
options: [
|
||
// { name: "sync", label: "同步", icon: "refresh", emitFull: true, showOverlay: true }
|
||
// { name: "copy", label: "复制", icon: "copy-document" },
|
||
{ name: "edit", label: "编辑", icon: "edit-outline" },
|
||
// { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:bom:delete" },
|
||
],
|
||
},
|
||
];
|
||
|
||
const headFormFields = [
|
||
{
|
||
label: "物料配方",
|
||
prop: "key",
|
||
input: true,
|
||
default: { value: "" },
|
||
bind: { placeholder: "请输入物料配方" },
|
||
},
|
||
{
|
||
button: {
|
||
type: "primary",
|
||
name: "查询",
|
||
},
|
||
},
|
||
{
|
||
button: {
|
||
type: "plain",
|
||
name: "导入",
|
||
permission: "",
|
||
},
|
||
},
|
||
// {
|
||
// button: {
|
||
// type: "plain",
|
||
// name: "新增",
|
||
// permission: "pms:bom:save",
|
||
// },
|
||
// },
|
||
{
|
||
button: {
|
||
type: "warning",
|
||
name: "批量同步",
|
||
},
|
||
},
|
||
];
|
||
|
||
const dictList = JSON.parse(localStorage.getItem("dictList") || {});
|
||
// const dialogConfigs = {
|
||
// menu: [
|
||
// { name: "配方", key: "info" },
|
||
// { name: "配方详情", key: "attr", onlyEditMode: true },
|
||
// // {
|
||
// // name: "附件",
|
||
// // key: "attachment",
|
||
// // onlyEditMode: true,
|
||
// // actionUrl: window.SITE_CONFIG["apiURL"] + "/pms/attachment/uploadFileFormData?typeCode=ProductAttachment",
|
||
// // },
|
||
// ],
|
||
// form: {
|
||
// rows: [
|
||
// [
|
||
// {
|
||
// input: true,
|
||
// label: "牌号",
|
||
// prop: "name",
|
||
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||
// elparams: { placeholder: "请输入牌号" },
|
||
// },
|
||
// {
|
||
// input: true,
|
||
// label: "配方编码",
|
||
// prop: "code",
|
||
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||
// elparams: { placeholder: "请输入配方编码" },
|
||
// },
|
||
// // { input: true, label: '版本号', prop: 'version', elparams: { placeholder: '请输入版本号' } },
|
||
// // {
|
||
// // select: true,
|
||
// // label: "产品类型",
|
||
// // prop: "typeDictValue",
|
||
// // options: "product_type" in dictList ? dictList["product_type"].map((item) => ({ value: item.dictValue, label: item.dictLabel })) : [],
|
||
// // elparams: { placeholder: "选择一个产品类型" },
|
||
// // },
|
||
// ],
|
||
// [
|
||
// // { input: true, label: '单位平方数', prop: 'code', rules: { required: true, message: '必填项不能为空', trigger: 'blur' }, elparams: { placeholder: '请输入设备名称编码' } },
|
||
// // {
|
||
// // select: true,
|
||
// // label: "单位",
|
||
// // prop: "unitDictValue",
|
||
// // options: "unit" in dictList ? dictList["unit"].map((item) => ({ value: item.dictValue, label: item.dictLabel })) : [],
|
||
// // elparams: { placeholder: "选择单位" },
|
||
// // },
|
||
// {
|
||
// input: true,
|
||
// label: "版本号",
|
||
// prop: "externalCode",
|
||
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||
// elparams: { placeholder: "请输入版本号" },
|
||
// },
|
||
// { input: true, label: "物料销售文本(短)", prop: "shortDesc", elparams: { placeholder: "物料销售文本" } },
|
||
// ],
|
||
// [{ textarea: true, label: "物料销售文本", prop: "description", elparams: { placeholder: "物料销售文本" } }],
|
||
// [{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }],
|
||
// [
|
||
// {
|
||
// // input: true,
|
||
// forceDisabled: true,
|
||
// label: "同步状态",
|
||
// prop: "sync",
|
||
// key: "sync",
|
||
// // rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||
// // elparams: { placeholder: "请输入同步状态" },
|
||
// },
|
||
// ],
|
||
// ],
|
||
// operations: [
|
||
// { name: "add", label: "保存", type: "primary", permission: "pms:bom:save", showOnEdit: false },
|
||
// { name: "update", label: "更新", type: "primary", permission: "pms:bom:update", showOnEdit: true },
|
||
// { name: "reset", label: "重置", type: "warning", showAlways: true },
|
||
// // { name: 'cancel', label: '取消', showAlways: true },
|
||
// ],
|
||
// },
|
||
// table: {
|
||
// // extraParams: ['stepId'],
|
||
// extraParams: "bomId",
|
||
// props: [
|
||
// { type: "index", label: "序号" },
|
||
// { prop: "material", label: "物料", isEditField: true },
|
||
// {
|
||
// width: 130,
|
||
// prop: "qty",
|
||
// label: "配方物料重量",
|
||
// filter: (val) => (!!val ? val + " kg" : "-"),
|
||
// isEditField: true,
|
||
// },
|
||
// {
|
||
// width: 130,
|
||
// prop: "sumqty",
|
||
// label: "配方总重量",
|
||
// filter: (val) => (!!val ? val + " kg" : "-"),
|
||
// isEditField: true,
|
||
// },
|
||
// { prop: "percent", label: "配比 [%]", filter: (val) => (!!val ? val + " %" : "-"), isEditField: true },
|
||
// { prop: "remark", label: "备注", isEditField: true },
|
||
// { prop: "createTime", label: "添加时间", filter: timeFilter },
|
||
// {
|
||
// prop: "operations",
|
||
// name: "操作",
|
||
// fixed: "right",
|
||
// width: 90,
|
||
// subcomponent: TableOperaionComponent,
|
||
// options: [
|
||
// { name: "edit", label: "编辑", icon: "edit-outline", permission: "pms:bomMaterial:update" },
|
||
// { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:bomMaterial:delete" },
|
||
// ],
|
||
// },
|
||
// ],
|
||
// data: [
|
||
// // TOOD 暂时用不到,但获取可以考虑把拉取接口数据的函数迁移到此文件(没有太大必要)
|
||
// ],
|
||
// },
|
||
|
||
// subDialog: {
|
||
// extraParam: "bomId",
|
||
// forceAttachCode: true, // 产品属性新增必填 code 字段......
|
||
// rows: [
|
||
// [
|
||
// {
|
||
// select: true,
|
||
// label: "物料",
|
||
// prop: "materialId",
|
||
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||
// elparams: { placeholder: "请选择物料", filterable: true },
|
||
// options: [],
|
||
// fetchData: () => this.$http.get("/pms/material/page", { params: { limit: 999, page: 1 } }),
|
||
// // fetchData: () => new Promise((resolve) => {
|
||
// // setTimeout(() => {
|
||
// // resolve({
|
||
// // data: {
|
||
// // code: 0,
|
||
// // data: {
|
||
// // total: 0,
|
||
// // list:
|
||
// // [
|
||
// // { id: 10001, name: 'mock物料1' },
|
||
// // { id: 10002, name: 'mock物料2' },
|
||
// // { id: 10003, name: 'mock物料3' },
|
||
// // { id: 10004, name: 'mock物料4' },
|
||
// // { id: 10005, name: 'mock物料5' },
|
||
// // ]
|
||
// // }
|
||
// // }
|
||
// // })
|
||
// // }, 800)
|
||
// // })
|
||
// },
|
||
// {
|
||
// input: true,
|
||
// label: "物料重量[kg]",
|
||
// prop: "qty",
|
||
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||
// elparams: { placeholder: "请输入物料重量" },
|
||
// },
|
||
// ],
|
||
// [{ textarea: true, label: "备注", prop: "remark", elparams: { placeholder: "添加备注" } }],
|
||
// ],
|
||
// operations: [
|
||
// { name: "add", label: "保存", type: "primary", permission: "pms:bomMaterial:save", showOnEdit: false },
|
||
// { name: "update", label: "更新", type: "primary", permission: "pms:bomMaterial:update", showOnEdit: true },
|
||
// ],
|
||
// },
|
||
// };
|
||
|
||
const dialogConfigs = {
|
||
form: {
|
||
rows: [
|
||
[
|
||
{
|
||
forceDisabled: true,
|
||
label: "配方号",
|
||
prop: "code",
|
||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||
// disabledOnEdit: true
|
||
elparams: { disabled: true },
|
||
},
|
||
{
|
||
forceDisabled: true,
|
||
label: "牌号",
|
||
prop: "name",
|
||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||
elparams: { disabled: true },
|
||
},
|
||
],
|
||
[
|
||
{
|
||
input: true,
|
||
label: "建议混料下限",
|
||
prop: "downweight",
|
||
rules: [{ type: "number", trigger: "blur", message: "请输入数字类型", transform: (val) => Number(val) }],
|
||
elparams: { placeholder: "请输入建议混料下限" },
|
||
},
|
||
{
|
||
input: true,
|
||
label: "建议混料上限",
|
||
prop: "upweight",
|
||
rules: [{ type: "number", trigger: "blur", message: "请输入数字类型", transform: (val) => Number(val) }],
|
||
elparams: { placeholder: "请输入建议混料上限" },
|
||
},
|
||
],
|
||
[
|
||
{
|
||
input: true,
|
||
label: "喷码描述",
|
||
prop: "shortDesc",
|
||
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||
// elparams: { disabled: true },
|
||
},
|
||
null
|
||
],
|
||
],
|
||
operations: [
|
||
{ name: "add-bom", label: "保存", type: "primary", permission: "", showOnEdit: false },
|
||
{ name: "update-bom", label: "更新", type: "primary", permission: "", showOnEdit: true },
|
||
{ name: "reset", label: "重置", type: "warning", showAlways: true },
|
||
],
|
||
},
|
||
};
|
||
|
||
return {
|
||
dialogConfigs,
|
||
tableConfig: {
|
||
table: null, // 此处可省略,el-table 上的配置项
|
||
column: tableProps, // el-column-item 上的配置项
|
||
},
|
||
headFormConfigs: {
|
||
rules: null, // 名称是由 BaseSearchForm.vue 组件固定的
|
||
fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的
|
||
},
|
||
urls: {
|
||
base: "/pms/bom",
|
||
editUrl: "/pms/bom/modify",
|
||
page: "/pms/bom/page",
|
||
// syncUrl: "/pms/bom/sync",
|
||
syncUrl: "/pms/trans/batchBomSync",
|
||
copyUrl: "/pms/bom/copy",
|
||
subase: "/pms/bomMaterial",
|
||
subpage: "/pms/bomMaterial/page",
|
||
importUrl: "/pms/order/importExcelBom", // 导入的api
|
||
templateUrl: "/importTemplates/bomImport.xlsx",
|
||
syncSingleUrl: "/pms/trans/bomSync",
|
||
},
|
||
};
|
||
}
|