fix 0801 上料管理

This commit is contained in:
lb 2023-08-01 16:02:31 +08:00
parent 2f1bc5906c
commit c4187de9a0
3 changed files with 415 additions and 55 deletions

View File

@ -1,11 +1,11 @@
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent"; import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
// import switchBtn from "@/components/noTemplateComponents/switchBtn"; // import switchBtn from "@/components/noTemplateComponents/switchBtn";
import request from "@/utils/request"; import request from "@/utils/request";
import { timeFilter, dictFilter } from '@/utils/filters' import { timeFilter, dictFilter } from "@/utils/filters";
export default function () { export default function () {
const tableProps = [ const tableProps = [
{ type: 'index', label: '序号' }, { type: "index", label: "序号" },
// { prop: "updateTime", label: "上料时间", filter: timeFilter }, // { prop: "updateTime", label: "上料时间", filter: timeFilter },
{ prop: "materialName", label: "原料" }, { prop: "materialName", label: "原料" },
// { prop: "material", label: "原料编码" }, // { prop: "material", label: "原料编码" },
@ -13,9 +13,12 @@ export default function () {
{ prop: "siloName1", label: "上料料仓1" }, { prop: "siloName1", label: "上料料仓1" },
{ prop: "siloName2", label: "上料料仓2" }, { prop: "siloName2", label: "上料料仓2" },
{ prop: "siloName3", label: "上料料仓3" }, { prop: "siloName3", label: "上料料仓3" },
{ prop: 'startTime', label: "开始上料时间", filter: timeFilter }, { prop: "startTime", label: "开始上料时间", filter: timeFilter },
{ prop: 'endTime', label: "结束上料时间", filter: timeFilter }, { prop: "endTime", label: "结束上料时间", filter: timeFilter },
{ prop: "statusDictValue", label: "破碎作业", filter: val => ['正常停止', '废除'][val] ?? '-' }, { prop: "silo1Change", label: "料仓1变化" },
{ prop: "silo2Change", label: "料仓2变化" },
{ prop: "silo3Change", label: "料仓3变化" },
{ prop: "statusDictValue", label: "破碎作业", filter: (val) => ["正常停止", "废除"][val] ?? "-" },
// { prop: "description", label: "描述" }, // { prop: "description", label: "描述" },
{ prop: "remark", label: "备注" }, { prop: "remark", label: "备注" },
{ prop: "createTime", label: "添加时间", filter: timeFilter }, { prop: "createTime", label: "添加时间", filter: timeFilter },
@ -25,11 +28,13 @@ export default function () {
fixed: "right", fixed: "right",
width: 90, width: 90,
subcomponent: TableOperaionComponent, subcomponent: TableOperaionComponent,
options: [{ name: "edit", label: "编辑", icon: "edit-outline" }, { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:brokeLog:delete" }], options: [
{ name: "edit", label: "编辑", icon: "edit-outline" },
{ name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:brokeLog:delete" },
],
}, },
]; ];
/** /**
* 数据字典hack * 数据字典hack
* @param {object} row 行数据 * @param {object} row 行数据
@ -40,56 +45,56 @@ export default function () {
let dictList; let dictList;
tableProps.attachDictValue = (row, dictId, dataProp, dictProp, forceFlushDictList = false) => { tableProps.attachDictValue = (row, dictId, dataProp, dictProp, forceFlushDictList = false) => {
/** 缓存一下 dictList **/ /** 缓存一下 dictList **/
if (!dictList || (dictList && forceFlushDictList)) dictList = dictFilter(dictId) if (!dictList || (dictList && forceFlushDictList)) dictList = dictFilter(dictId);
if (typeof row === 'object' && dictList) { if (typeof row === "object" && dictList) {
const value = dictList(row[dictProp]) const value = dictList(row[dictProp]);
const data = row[dataProp] const data = row[dataProp];
row[dataProp] = data + ' ' + (value === '-' ? '' : value) row[dataProp] = data + " " + (value === "-" ? "" : value);
} else { } else {
this.$message({ this.$message({
message: 'tableProps.attachDictValue() 出错!', message: "tableProps.attachDictValue() 出错!",
type: 'error', type: "error",
duration: 1500 duration: 1500,
}) });
} }
} };
const headFormFields = [ const headFormFields = [
{ {
prop: 'material', prop: "material",
label: "按原料搜索", label: "按原料搜索",
// input: true, // input: true,
select: [], select: [],
fieldOptionValue: 'name', // 把料仓筛选条件的label改为展示code而不是展示name fieldOptionValue: "name", // 把料仓筛选条件的label改为展示code而不是展示name
default: { value: "" }, default: { value: "" },
fn: () => this.$http.get("/pms/material/page", { params: { page: 1, limit: 999 } }), fn: () => this.$http.get("/pms/material/page", { params: { page: 1, limit: 999 } }),
bind: { bind: {
placeholder: '请输入原料名', placeholder: "请输入原料名",
filterable: true filterable: true,
} },
}, },
{ {
prop: 'silo', prop: "silo",
label: "按料仓搜索", label: "按料仓搜索",
fieldOptionLabel: 'name', // 把料仓筛选条件的label改为展示code而不是展示name fieldOptionLabel: "name", // 把料仓筛选条件的label改为展示code而不是展示name
select: [], select: [],
fn: () => this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: '0' } }), fn: () => this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: "0" } }),
bind: { bind: {
placeholder: '请选择料仓', placeholder: "请选择料仓",
filterable: true, filterable: true,
} },
}, },
{ {
timerange: true, timerange: true,
prop: 'timerange', prop: "timerange",
label: "时间段", label: "时间段",
bind: { bind: {
placeholder: '请选择上料时间段', placeholder: "请选择上料时间段",
type: "datetimerange", type: "datetimerange",
"start-placeholder": "开始时间", "start-placeholder": "开始时间",
"end-placeholder": "结束时间", "end-placeholder": "结束时间",
} },
}, },
{ {
button: { button: {
@ -101,11 +106,11 @@ export default function () {
button: { button: {
type: "primary", type: "primary",
name: "新增", name: "新增",
permission: "pms:brokeLog:save" permission: "pms:brokeLog:save",
}, },
bind: { bind: {
plain: true, plain: true,
} },
}, },
]; ];
@ -124,8 +129,8 @@ export default function () {
options: [], options: [],
label: "原料", label: "原料",
prop: "material", prop: "material",
optionValue: 'code', optionValue: "code",
customLabel: 'description', customLabel: "description",
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请输入原料名称" }, // elparams: { placeholder: "请输入原料名称" },
elparams: { filterable: true, placeholder: "请选择原料" }, elparams: { filterable: true, placeholder: "请选择原料" },
@ -136,42 +141,79 @@ export default function () {
input: true, input: true,
label: "上料量", label: "上料量",
prop: "qty", prop: "qty",
rules: [{ required: true, message: "必填项不能为空", trigger: "blur" }, { type: 'number', message: '请输入正确的数字类型', trigger: 'blur', transform: val => Number(val) }], rules: [
{ required: true, message: "必填项不能为空", trigger: "blur" },
{ type: "number", message: "请输入正确的数字类型", trigger: "blur", transform: (val) => Number(val) },
],
elparams: { placeholder: "请输入上料量" }, elparams: { placeholder: "请输入上料量" },
}, },
{ select: true, label: "破碎作业", prop: "statusDictValue", options: [{ label: '正常停止', value: 0 }, { label: '废除', value: '1' }], elparams: { placeholder: "破碎作业", filterable: true } }, {
select: true,
label: "破碎作业",
prop: "statusDictValue",
options: [
{ label: "正常停止", value: 0 },
{ label: "废除", value: "1" },
],
elparams: { placeholder: "破碎作业", filterable: true },
},
], ],
[ [
{ {
prop: 'silo1', prop: "silo1",
label: '上料料仓1', label: "上料料仓1",
select: true, select: true,
options: [], options: [],
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
fetchData: () => this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: '0' } }), fetchData: () =>
this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: "0" } }),
elparams: { filterable: true, placeholder: "请选择上料料仓1" }, elparams: { filterable: true, placeholder: "请选择上料料仓1" },
customLabel: 'description', customLabel: "description",
}, },
{ {
prop: 'silo2', prop: "silo2",
label: '上料料仓2', label: "上料料仓2",
select: true, select: true,
options: [], options: [],
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
fetchData: () => this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: '0' } }), fetchData: () =>
this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: "0" } }),
elparams: { filterable: true, placeholder: "请选择上料料仓2" }, elparams: { filterable: true, placeholder: "请选择上料料仓2" },
customLabel: 'description', customLabel: "description",
}, },
{ {
prop: 'silo3', prop: "silo3",
label: '上料料仓3', label: "上料料仓3",
select: true, select: true,
options: [], options: [],
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
fetchData: () => this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: '0' } }), fetchData: () =>
this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: "0" } }),
elparams: { filterable: true, placeholder: "请选择上料料仓3" }, elparams: { filterable: true, placeholder: "请选择上料料仓3" },
customLabel: 'description', customLabel: "description",
},
],
[
{
prop: "silo1Change",
label: "料仓1变化",
input: true,
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请填写料仓1变化" },
},
{
prop: "silo2Change",
label: "料仓2变化",
input: true,
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请填写料仓2变化" },
},
{
prop: "silo3Change",
label: "料仓3变化",
input: true,
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请填写料仓3变化" },
}, },
], ],
[ [
@ -180,18 +222,27 @@ export default function () {
label: "开始上料时间", label: "开始上料时间",
prop: "startTime", prop: "startTime",
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请选择上料时间", type: 'datetime' }, elparams: { placeholder: "请选择上料时间", type: "datetime" },
}, },
{ {
datetime: true, datetime: true,
label: "结束上料时间", label: "结束上料时间",
prop: "endTime", prop: "endTime",
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请选择上料结束时间", type: 'datetime' }, elparams: { placeholder: "请选择上料结束时间", type: "datetime" },
}, },
{ input: true, label: "描述信息", prop: "description", elparams: { placeholder: "描述信息" } }, { input: true, label: "描述信息", prop: "description", elparams: { placeholder: "描述信息" } },
], ],
[{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }], [
{
forceDisabled: true,
// input: true,
label: "备注",
prop: "remark",
default: "Crushing",
elparams: { placeholder: "备注" },
},
],
], ],
operations: [ operations: [
{ name: "add", label: "保存", type: "primary", permission: "pms:brokeLog:save", showOnEdit: false }, { name: "add", label: "保存", type: "primary", permission: "pms:brokeLog:save", showOnEdit: false },
@ -215,7 +266,8 @@ export default function () {
}, },
urls: { urls: {
base: "/pms/brokeLog", base: "/pms/brokeLog",
page: "/pms/brokeLog/page", // page: "/pms/brokeLog/page",
page: "/pms/brokeLog/pagebroke",
// subase: '/pms/blenderStepParam', // subase: '/pms/blenderStepParam',
// subpage: '/pms/blenderStepParam/page', // subpage: '/pms/blenderStepParam/page',
// more... // more...

View File

@ -0,0 +1,276 @@
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
// import switchBtn from "@/components/noTemplateComponents/switchBtn";
import request from "@/utils/request";
import { timeFilter, dictFilter } from "@/utils/filters";
export default function () {
const tableProps = [
{ type: "index", label: "序号" },
// { prop: "updateTime", label: "上料时间", filter: timeFilter },
{ prop: "materialName", label: "原料" },
// { prop: "material", label: "原料编码" },
{ prop: "qty", label: "计划上料量" },
{ prop: "siloName1", label: "上料料仓" },
// { prop: "siloName2", label: "上料料仓2" },
// { prop: "siloName3", label: "上料料仓3" },
{ prop: "startTime", label: "开始上料时间", filter: timeFilter },
{ prop: "endTime", label: "结束上料时间", filter: timeFilter },
{ prop: "silo1Change", label: "料仓变化" },
// { prop: "silo2Change", label: "料仓2变化" },
// { prop: "silo3Change", label: "料仓3变化" },
{ prop: "statusDictValue", label: "破碎作业", filter: (val) => ["正常停止", "废除"][val] ?? "-" },
// { prop: "description", label: "描述" },
{ prop: "remark", label: "备注" },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{
prop: "operations",
name: "操作",
fixed: "right",
width: 90,
subcomponent: TableOperaionComponent,
options: [
{ name: "edit", label: "编辑", icon: "edit-outline" },
{ name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:brokeLog:delete" },
],
},
];
/**
* 数据字典hack
* @param {object} row 行数据
* @param {string} dictId 从哪个数据字典映射数据
* @param {string} dataProp 把字典值附加到哪个 prop 字段上
* @param {string} dictProp 哪个prop是字典数据
**/
let dictList;
tableProps.attachDictValue = (row, dictId, dataProp, dictProp, forceFlushDictList = false) => {
/** 缓存一下 dictList **/
if (!dictList || (dictList && forceFlushDictList)) dictList = dictFilter(dictId);
if (typeof row === "object" && dictList) {
const value = dictList(row[dictProp]);
const data = row[dataProp];
row[dataProp] = data + " " + (value === "-" ? "" : value);
} else {
this.$message({
message: "tableProps.attachDictValue() 出错!",
type: "error",
duration: 1500,
});
}
};
const headFormFields = [
{
prop: "material",
label: "按原料搜索",
// input: true,
select: [],
fieldOptionValue: "name", // 把料仓筛选条件的label改为展示code而不是展示name
default: { value: "" },
fn: () => this.$http.get("/pms/material/page", { params: { page: 1, limit: 999 } }),
bind: {
placeholder: "请输入原料名",
filterable: true,
},
},
{
prop: "silo",
label: "按料仓搜索",
fieldOptionLabel: "name", // 把料仓筛选条件的label改为展示code而不是展示name
select: [],
fn: () => this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: "0" } }),
bind: {
placeholder: "请选择料仓",
filterable: true,
},
},
{
timerange: true,
prop: "timerange",
label: "时间段",
bind: {
placeholder: "请选择上料时间段",
type: "datetimerange",
"start-placeholder": "开始时间",
"end-placeholder": "结束时间",
},
},
{
button: {
type: "primary",
name: "查询",
},
},
{
button: {
type: "primary",
name: "新增",
permission: "pms:brokeLog:save",
},
bind: {
plain: true,
},
},
];
/**
* dialog config 有两个版本一个适用于 DialogWithMenu 组件另一个适用于 DialogJustForm 组件
* 适用于 DialogWithMenu 组件的配置示例详见 blenderStep/config.js
* 此为后者的配置:
*/
const dialogJustFormConfigs = {
form: {
rows: [
[
{
// input: true,
select: true,
options: [],
label: "原料",
prop: "material",
optionValue: "code",
customLabel: "description",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请输入原料名称" },
elparams: { filterable: true, placeholder: "请选择原料" },
fetchData: () => this.$http.get("/pms/material/page", { params: { limit: 999, page: 1 } }),
// rules: { required: true, message: "必填项不能为空", trigger: "change" },
},
{
input: true,
label: "计划上料量",
prop: "qty",
rules: [
{ required: true, message: "必填项不能为空", trigger: "blur" },
{ type: "number", message: "请输入正确的数字类型", trigger: "blur", transform: (val) => Number(val) },
],
elparams: { placeholder: "请输入计划上料量" },
},
{
select: true,
label: "破碎作业",
prop: "statusDictValue",
options: [
{ label: "正常停止", value: 0 },
{ label: "废除", value: "1" },
],
elparams: { placeholder: "破碎作业", filterable: true },
},
{
prop: "silo1",
label: "上料料仓",
select: true,
options: [],
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
fetchData: () =>
this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: "0" } }),
elparams: { filterable: true, placeholder: "请选择上料料仓" },
customLabel: "description",
},
],
// [
// {
// prop: "silo2",
// label: "上料料仓2",
// select: true,
// options: [],
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// fetchData: () =>
// this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: "0" } }),
// elparams: { filterable: true, placeholder: "请选择上料料仓2" },
// customLabel: "description",
// },
// {
// prop: "silo3",
// label: "上料料仓3",
// select: true,
// options: [],
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// fetchData: () =>
// this.$http.get("/pms/materialStorage/page", { params: { page: 1, limit: 999, typeDictValue: "0" } }),
// elparams: { filterable: true, placeholder: "请选择上料料仓3" },
// customLabel: "description",
// },
// ],
// [
// {
// prop: "silo2Change",
// label: "料仓2变化",
// input: true,
// // rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请填写料仓2变化" },
// },
// {
// prop: "silo3Change",
// label: "料仓3变化",
// input: true,
// // rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请填写料仓3变化" },
// },
// ],
[
{
prop: "silo1Change",
label: "料仓变化",
input: true,
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请填写料仓变化" },
},
{
datetime: true,
label: "开始上料时间",
prop: "startTime",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请选择上料时间", type: "datetime" },
},
{
datetime: true,
label: "结束上料时间",
prop: "endTime",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请选择上料结束时间", type: "datetime" },
},
{ input: true, label: "描述信息", prop: "description", elparams: { placeholder: "描述信息" } },
],
[
{
forceDisabled: true,
// input: true,
label: "备注",
prop: "remark",
default: "Handload",
elparams: { placeholder: "备注" },
},
],
],
operations: [
{ name: "add", label: "保存", type: "primary", permission: "pms:brokeLog:save", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "pms:brokeLog: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/brokeLog",
// page: "/pms/brokeLog/page",
page: "/pms/brokeLog/pagehand",
// subase: '/pms/blenderStepParam',
// subpage: '/pms/blenderStepParam/page',
// more...
},
};
}

View File

@ -0,0 +1,32 @@
<template>
<ListViewWithHead :table-config="tableConfig" :head-config="headFormConfigs" :dialog-configs="dialogConfigs" />
</template>
<script>
import initConfig from './config';
import ListViewWithHead from '@/views/atomViews/ListViewWithHead.vue';
export default {
name: 'ProductionLineView',
components: { ListViewWithHead },
provide() {
return {
urls: this.allUrls
}
},
data() {
const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
return {
tableConfig,
headFormConfigs,
allUrls: urls,
dialogConfigs,
};
},
created() {},
mounted() {},
methods: {},
};
</script>
<style scoped></style>