169 lines
6.2 KiB
JavaScript
169 lines
6.2 KiB
JavaScript
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
|
||
// import switchBtn from "@/components/noTemplateComponents/switchBtn";
|
||
import request from "@/utils/request";
|
||
import { dictFilter } from '@/utils/filters'
|
||
import { timeFilter } from '@/utils/filters'
|
||
|
||
export default function () {
|
||
const tableProps = [
|
||
{ type: 'index', label: '序号' },
|
||
{ prop: "name", label: "料仓名称" },
|
||
{ prop: "code", label: "料仓编码" },
|
||
{ prop: "typeDictValue", label: "料仓类型", filter: dictFilter('liaocang') },
|
||
// { prop: "enabled", label: "状态", subcomponent: switchBtn }, // subcomponent
|
||
{ prop: "material", label: "原料" },
|
||
{ prop: "qty", label: "料位" },
|
||
{ prop: "unitDictValue", label: "单位", filter: dictFilter('unit') },
|
||
{ prop: "materialTypeDictValue", label: "原料类型", filter: dictFilter('material_category') },
|
||
{ prop: "density", label: "原料堆积密度" },
|
||
{ prop: "dosLow", label: "加料下限" },
|
||
{ prop: "dosHigh", label: "加料上限" },
|
||
{ prop: "description", label: "描述" },
|
||
// { prop: "remark", label: "备注" },
|
||
{ prop: "createTime", label: "添加时间", filter: timeFilter },
|
||
{
|
||
prop: "operations",
|
||
name: "操作",
|
||
fixed: "right",
|
||
width: 120,
|
||
subcomponent: TableOperaionComponent,
|
||
options: [
|
||
{ name: "edit", label: "编辑", icon: "edit-outline" },
|
||
{ name: "sync", label: "同步", icon: "refresh" },
|
||
{ name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:materialStorage:delete" }
|
||
],
|
||
},
|
||
];
|
||
|
||
const headFormFields = [
|
||
{
|
||
prop: 'name',
|
||
label: "料仓名称",
|
||
input: true,
|
||
default: { value: "" },
|
||
bind: {
|
||
// placeholder: '请输入产线名称或编码'
|
||
placeholder: '请输入料仓名称'
|
||
}
|
||
},
|
||
{
|
||
button: {
|
||
type: "primary",
|
||
name: "查询",
|
||
},
|
||
},
|
||
{
|
||
button: {
|
||
type: "primary",
|
||
name: "全部同步",
|
||
permission: ""
|
||
},
|
||
bind: {
|
||
plain: true,
|
||
}
|
||
},
|
||
];
|
||
|
||
/**
|
||
* dialog config 有两个版本,一个适用于 DialogWithMenu 组件,另一个适用于 DialogJustForm 组件
|
||
* 适用于 DialogWithMenu 组件的配置示例详见 blenderStep/config.js
|
||
* 此为后者的配置:
|
||
*/
|
||
const dialogJustFormConfigs = {
|
||
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: "请输入料仓编码" },
|
||
},
|
||
],
|
||
[
|
||
{
|
||
select: true,
|
||
label: "料仓类型",
|
||
prop: "typeDictValue",
|
||
// fetchData: () => this.$http.get("/pms/factory/page", { params: { limit: 999, page: 1 } }),
|
||
options: [
|
||
// TODO: 或许映射可以全权交给数据字典
|
||
{ label: '中间仓', value: '0' },
|
||
{ label: '日料仓', value: '1' },
|
||
],
|
||
rules: { required: true, message: "必填项不能为空", trigger: "change" },
|
||
elparams: { placeholder: "请选择料仓类型" },
|
||
},
|
||
{
|
||
select: true,
|
||
label: "原料",
|
||
prop: "materialId",
|
||
fetchData: () => this.$http.get("/pms/material/page", { params: { key: '', limit: 999, page: 1 } }),
|
||
options: [],
|
||
rules: { required: true, message: "必填项不能为空", trigger: "change" },
|
||
elparams: { placeholder: "请选择原料" },
|
||
},
|
||
// {
|
||
// input: true,
|
||
// label: "加料下限",
|
||
// prop: "dosLow",
|
||
// rules: [
|
||
// { required: true, message: "必填项不能为空", trigger: "blur" },
|
||
// { type: 'number', message: "请输入正确的数字类型", trigger: "blur", transform: val => Number(val) },
|
||
// ],
|
||
// elparams: { placeholder: "请输入加料下限" },
|
||
// },
|
||
// {
|
||
// input: true,
|
||
// label: "加料上限",
|
||
// prop: "dosHigh",
|
||
// rules: [
|
||
// { required: true, message: "必填项不能为空", trigger: "blur" },
|
||
// { type: 'number', message: "请输入正确的数字类型", trigger: "blur", transform: val => Number(val) },
|
||
// ],
|
||
// elparams: { placeholder: "请输入加料上限" },
|
||
// },
|
||
],
|
||
[{ textarea: true, label: "描述信息", prop: "description", elparams: { placeholder: "描述信息" } }],
|
||
[{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }],
|
||
],
|
||
operations: [
|
||
{ name: "add", label: "保存", type: "primary", permission: "pms:materialStorage:save", showOnEdit: false },
|
||
{ name: "update", label: "更新", type: "primary", permission: "pms:materialStorage:update", showOnEdit: true },
|
||
{ name: "reset", label: "重置", type: "warning", showAlways: true },
|
||
// { name: 'cancel', label: '取消', showAlways: true },
|
||
],
|
||
},
|
||
};
|
||
// 备注:弹窗弹出的时间和网速有关......
|
||
|
||
return {
|
||
dialogConfigs: dialogJustFormConfigs,
|
||
tableConfig: {
|
||
table: null, // 此处可省略,el-table 上的配置项
|
||
column: tableProps, // el-column-item 上的配置项
|
||
},
|
||
headFormConfigs: {
|
||
rules: null, // 名称是由 BaseSearchForm.vue 组件固定的
|
||
fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的
|
||
},
|
||
urls: {
|
||
base: "/pms/materialStorageDynamic",
|
||
page: "/pms/materialStorageDynamic/page",
|
||
syncUrl: "/pms/trans/matStoreSync",
|
||
syncSingleUrl: "/pms/trans/matStoreSingleSync"
|
||
// subase: '/pms/blenderStepParam',
|
||
// subpage: '/pms/blenderStepParam/page',
|
||
// more...
|
||
},
|
||
};
|
||
}
|