add 报工历史

This commit is contained in:
lb 2023-08-21 16:16:23 +08:00
parent 02c8538d47
commit 7513d82d4d
5 changed files with 347 additions and 14 deletions

View File

@ -17,6 +17,7 @@
"babel-plugin-component": "^1.1.1",
"code-brick-zj": "^0.0.7",
"core-js": "^3.6.5",
"dayjs": "^1.11.9",
"echarts": "^5.3.3",
"element-theme": "^2.0.1",
"element-ui": "^2.15.7",

View File

@ -86,10 +86,23 @@ export default {
dialogBomCode: "",
overlayVisible: false,
cachedSearchCondition: {},
queryParams: {},
};
},
inject: ["urls"],
mounted() {
// listQueryExtra queryParams
if (this.listQueryExtra && Array.isArray(this.listQueryExtra)) {
this.listQueryExtra.map((item) => {
if (typeof item === "string") this.$set(this.queryParams, item, "");
else if (typeof item === "object") {
Object.keys(item).forEach((key) => {
this.$set(this.queryParams, key, item[key]);
});
}
});
}
this.initDataWhenLoad && this.getList();
},
methods: {
@ -104,17 +117,6 @@ export default {
limit: this.size,
};
if (!queryParams && this.listQueryExtra && this.listQueryExtra.length) {
this.listQueryExtra.map((nameOrObj) => {
if (typeof nameOrObj === "string") params[nameOrObj] = "";
else if (typeof nameOrObj === "object") {
Object.keys(nameOrObj).forEach((key) => {
params[key] = nameOrObj[key];
});
}
});
}
// if (this.urls.pageIsPostApi) {
// } else {
// get page
@ -122,10 +124,14 @@ export default {
this.urls.page,
this.urls.pageIsPostApi
? {
...this.queryParams,
...params,
}
: {
params,
params: {
...this.queryParams,
...params
},
}
)
.then(({ data: res }) => {
@ -253,7 +259,9 @@ export default {
.then(({ data: res }) => {
if (res.code === 0) {
this.$message({
message: `${type === "detach" ? "下发" : type === "pause-blender" ? "暂停" : "开始"}成功`,
message: `${
type === "detach" ? "下发" : type === "pause-blender" ? "暂停" : "开始"
}成功`,
type: "success",
duration: 1500,
onClose: () => {

View File

@ -33,7 +33,7 @@ export default function () {
prop: "operations",
name: "操作",
fixed: "right",
width: 188,
width: 196,
subcomponent: TableOperaionComponent,
options: [
{

View File

@ -0,0 +1,273 @@
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
// import switchBtn from "@/components/noTemplateComponents/switchBtn";
// import QuillRichInput from "@/components/noTemplateComponents/richInput";
// import request from "@/utils/request";
import { timeFilter, dictFilter } from "@/utils/filters";
export default function () {
const tableProps = [
{ width: 120, prop: "orderCode", label: "订单号", fixed: "left" },
{ width: 60, prop: "orderCate", label: "子号" },
{ width: 100, prop: "productCode", label: "物料" },
{ width: 100, prop: "shapeCode", label: "砖型" },
{ width: 160, prop: "brand", label: "牌号" },
{ width: 100, prop: "bomCode", label: "配方编码" },
// { width: 60, prop: "ai", label: "版本" },
{ width: 60, prop: "prodqty", label: "数量" },
{ width: 80, prop: "blenderCode", label: "混料机号" },
{ width: 80, prop: "pressCode", label: "压机号" },
{ width: 80, prop: "kilnCode", label: "隧道窑号" },
{ width: 120, prop: "planStartTime", label: "计划开始时间", filter: timeFilter },
{ width: 120, prop: "sapParam6", label: "烧成温度" },
{ width: 120, prop: "sapParam7", label: "烧成时间(min)" },
// { width: 200, prop: "packTechCode", label: "包装工艺代码" },
{ width: 120, prop: "pcsKilnCar", label: "托盘码放砖数" },
{ width: 120, prop: "customerCode", label: "客户" },
{ width: 120, prop: "specifications", label: "生产订单类型" },
// { width: 60, prop: "statusDictValue", label: "状态", filter: dictFilter("order_status") },
{ width: 200, prop: "saleNo", label: "销售订单号" },
{ width: 200, prop: "saleOrderItem", label: "销售订单item号" },
{ width: 120, prop: "soqty", label: "销售订单数" },
{ width: 120, prop: "deliveryTime", label: "销售时间", filter: timeFilter },
{ width: 65, prop: "sapParam1", label: "addon" },
{ width: 200, prop: "shapeShortDesc", label: "喷码描述" },
{ width: 120, prop: "prodqty", label: "要求生产数量" },
{ width: 128, prop: "paperboard", label: "是否贴纸板", filter: (val) => ["否", "是"][val] },
{ width: 128, prop: "palletType", label: "托盘类型", filter: dictFilter("pallet_type") },
{ width: 128, prop: "goodqty", label: "合格数量" },
{ width: 128, prop: "badqty", label: "报废数量" },
{ width: 120, prop: "remark", label: "备注" },
{ width: 120, prop: "createTime", label: "添加时间", filter: timeFilter },
{
width: 128,
prop: "team",
label: "班次",
filter: (val) => (val != null ? ["早班", "中班", "晚班"][val] : "-"),
},
{
prop: "operations",
name: "操作",
fixed: "right",
width: 90,
subcomponent: TableOperaionComponent,
options: [
{ name: "edit", label: "编辑", icon: "edit-outline" }, // enable: (row) => row.report == 0 },
// {
// name: "delete",
// icon: "delete",
// label: "删除",
// emitFull: true,
// permission: "pms:workReport:delete",
// },
],
},
];
const now = new Date();
const [y, m, d] = [now.getFullYear(), now.getMonth(), now.getDate()];
const today = new Date(y, m, d, 0, 0, 0, 0).getTime();
const headFormFields = [
{
prop: "team",
label: "班次",
select: [
{ label: "早班", value: "0" },
{ label: "中班", value: "1" },
{ label: "晚班", value: "2" },
],
default: { value: "" },
bind: {
placeholder: "请选择班次",
},
},
{
prop: "externalCode",
label: "工序",
select: [
{ label: "压机", value: "0" },
{ label: "检测线", value: "1" },
{ label: "包装", value: "2" },
],
default: { value: "" },
bind: {
placeholder: "请选择工序",
},
},
{
prop: "orderCode",
label: "订单号",
input: true,
default: { value: "" },
bind: {
placeholder: "请输入订单号",
},
},
{
timerange: true,
prop: "timerange",
label: "时间段",
default: { value: [today - 3600 * 24 * 6 * 1000, today + 3600 * 24 * 1000] },
bind: {
placeholder: "请选择时间段",
type: "datetimerange",
"start-placeholder": "开始时间",
"end-placeholder": "结束时间",
},
},
{
button: {
type: "primary",
name: "查询",
},
},
{
button: {
type: "primary",
name: "新增",
permission: "pms:workReport:save",
},
bind: {
plain: true,
},
},
];
/**
* dialog config 有两个版本一个适用于 DialogWithMenu 组件另一个适用于 DialogJustForm 组件
* 适用于 DialogWithMenu 组件的配置示例详见 blenderStep/config.js
* 此为后者的配置:
*/
const dialogJustFormConfigs = {
clickModalToClose: false,
form: {
rows: [
[
{
select: true,
label: "订单",
prop: "orderId",
options: [],
optionLabel: "code",
customLabel: "cate",
fetchData: () => this.$http.post("/pms/order/listForReport"),
elparams: { placeholder: "请选择订单" },
rules: [{ required: true, message: "必填项不能为空", trigger: "blur" }],
},
{
select: true,
label: "工序",
prop: "externalCode",
options: [
{ label: "压机", value: '0' },
{ label: "检测线", value: '1' },
{ label: "包装", value: '2' },
],
elparams: { placeholder: "请选择工序" },
},
],
[
{
select: true,
label: "班次",
prop: "team",
options: [
{ label: "早班", value: '0' },
{ label: "中班", value: '1' },
{ label: "晚班", value: '2' },
],
elparams: { placeholder: "请选择班次" },
},
{
input: true,
label: "数量",
prop: "qty",
rules: [
{ required: true, message: "必填项不能为空", trigger: "blur" },
{
type: "number",
message: "请输入正确的数字类型",
trigger: "blur",
transform: (val) => Number(val),
},
],
elparams: { placeholder: "请输入数量" },
},
],
[
{
input: true,
label: "合格数量",
prop: "goodqty",
rules: [
{ required: true, message: "必填项不能为空", trigger: "blur" },
{
type: "number",
message: "请输入正确的数字类型",
trigger: "blur",
transform: (val) => Number(val),
},
],
elparams: { placeholder: "请输入合格数量" },
},
{
input: true,
label: "报废数量",
prop: "badqty",
rules: [
{ required: true, message: "必填项不能为空", trigger: "blur" },
{
type: "number",
message: "请输入正确的数字类型",
trigger: "blur",
transform: (val) => Number(val),
},
],
elparams: { placeholder: "请输入报废数量" },
},
],
// [
// {
// richInput: true,
// label: "描述信息",
// prop: "description",
// },
// ],
// [{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }],
],
operations: [
{
name: "add",
label: "保存",
type: "primary",
permission: "pms:workReport:save",
showOnEdit: false,
},
{
name: "update",
label: "更新",
type: "primary",
permission: "pms:workReport:update",
showOnEdit: true,
},
{ name: "reset", label: "重置", type: "warning", 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/workReport",
page: "/pms/workReport/pageView",
pageIsPostApi: true,
},
};
}

View File

@ -0,0 +1,51 @@
<template>
<ListViewWithHead
:table-config="tableConfig"
:head-config="headFormConfigs"
:dialog-configs="dialogConfigs"
:listQueryExtra="['externalCode', 'orderCode', 'team', { report: 0, startTime: now[0], endTime: now[1] }]" />
</template>
<script>
import initConfig from "./config";
import ListViewWithHead from "@/views/atomViews/ListViewWithHead.vue";
import moment from "moment";
export default {
name: "WorkReportView",
components: { ListViewWithHead },
provide() {
return {
urls: this.allUrls,
};
},
data() {
const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this);
return {
tableConfig,
headFormConfigs,
allUrls: urls,
dialogConfigs,
};
},
computed: {
now() {
const curr = this.headFormConfigs.fields.find((item) => item.prop == "timerange").default.value;
return [
moment(curr[0]).format("YYYY-MM-DDTHH:mm:ss"),
moment(curr[1]).format("YYYY-MM-DDTHH:mm:ss"),
]
// const start = new Date(curr[0]);
// const end = new Date(curr[1]);
// return [
// start.toLocaleString().replace(' ', 'T').replace(/\//g, '-'),
// end.toLocaleString().replace(' ', 'T').replace(/\//g, '-'),
// ]
},
},
methods: {},
};
</script>
<style scoped></style>