update order

This commit is contained in:
lb 2023-03-10 11:22:53 +08:00
parent 2eaafd5786
commit 7ddeb7d0a5
2 changed files with 558 additions and 409 deletions

View File

@ -2,11 +2,11 @@
<el-dialog <el-dialog
class="dialog-just-form" class="dialog-just-form"
style="padding: 40px" style="padding: 40px"
:fullscreen="fullscreen"
:visible="dialogVisible" :visible="dialogVisible"
@close="handleClose" @close="handleClose"
:destroy-on-close="false" :destroy-on-close="false"
:close-on-click-modal="configs.clickModalToClose ?? true" :close-on-click-modal="configs.clickModalToClose ?? true"
:fullscreen="fullscreen"
> >
<!-- title --> <!-- title -->
<div slot="title" class="dialog-title" style="padding: 40px 40px 0"> <div slot="title" class="dialog-title" style="padding: 40px 40px 0">
@ -48,19 +48,8 @@
:disabled="detailMode" :disabled="detailMode"
/> />
<el-input v-if="col.textarea" type="textarea" v-model="dataForm[col.prop]" :disabled="detailMode" v-bind="col.elparams" /> <el-input v-if="col.textarea" type="textarea" v-model="dataForm[col.prop]" :disabled="detailMode" v-bind="col.elparams" />
<el-upload <el-date-picker v-if="col.datetime" v-model="dataForm[col.prop]" :disabled="detailMode" v-bind="col.elparams" />
v-if="col.upload"
:key="'upload_' + Math.random()"
:action="col.actionUrl"
:file-list="col.fileList"
:disabled="detailMode || !dataForm.id"
:on-change="handleUploadChange"
v-bind="col.elparams"
:headers="uploadHeaders"
>
<el-button type="primary" size="small">选择文件</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
<div class="" v-if="col.component" style="margin: 42px 0 0"> <div class="" v-if="col.component" style="margin: 42px 0 0">
<!-- 下面这个 component 几乎是为 富文本 quill 定制的了... TODO后续可能会根据业务需求创建新的版本 --> <!-- 下面这个 component 几乎是为 富文本 quill 定制的了... TODO后续可能会根据业务需求创建新的版本 -->
<component <component
@ -69,6 +58,7 @@
@update:modelValue="handleComponentModelUpdate(col.prop, $event)" @update:modelValue="handleComponentModelUpdate(col.prop, $event)"
:modelValue="dataForm[col.prop] ?? ''" :modelValue="dataForm[col.prop] ?? ''"
:mode="detailMode ? 'detail' : dataForm.id ? 'edit' : 'create'" :mode="detailMode ? 'detail' : dataForm.id ? 'edit' : 'create'"
v-bind="col.bind"
/> />
</div> </div>
<!-- add more... --> <!-- add more... -->
@ -78,7 +68,7 @@
</el-form> </el-form>
<!-- footer --> <!-- footer -->
<div slot="footer"> <div slot="footer" style="padding: 0 40px 0">
<template v-for="(operate, index) in configs.form.operations"> <template v-for="(operate, index) in configs.form.operations">
<el-button v-if="showButton(operate)" :key="'operation_' + index" :type="operate.type" @click="handleBtnClick(operate)">{{ <el-button v-if="showButton(operate)" :key="'operation_' + index" :type="operate.type" @click="handleBtnClick(operate)">{{
operate.label operate.label
@ -92,9 +82,11 @@
<script> <script>
import { pick as __pick } from "@/utils/filters"; import { pick as __pick } from "@/utils/filters";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import moment from "moment";
export default { export default {
name: "DialogJustForm", name: "DialogJustForm",
components: {},
props: { props: {
configs: { configs: {
type: Object, type: Object,
@ -115,25 +107,44 @@ export default {
inject: ["urls"], inject: ["urls"],
data() { data() {
const dataForm = {}; const dataForm = {};
this.configs.form.rows.forEach((row) => { this.configs.form.rows.forEach((row) => {
row.forEach((col) => { row.forEach((col) => {
dataForm[col.prop] = col.default ?? null; dataForm[col.prop] = col.default ?? null;
if (col.fetchData) if (col.fetchData)
col.fetchData().then(({ data: res }) => { col.fetchData().then(({ data: res }) => {
console.log("[DialogJustForm fetchData -->]", res.data.list);
if (res.code === 0 && res.data.list) { if (res.code === 0 && res.data.list) {
this.$set( this.$set(
col, col,
"options", "options",
res.data.list.map((i) => ({ res.data.list.map((i) => ({
label: i.name, label: col.optionLabel ? i[col.optionLabel] : i.name,
value: col.optionValueProp && `${col.optionValueProp}` in i ? i[col.optionValueProp] : i.id, value: col.optionValue ? i[col.optionValue] : i.id,
})) }))
); );
// col.options = res.data.list;
} else {
col.options.splice(0);
}
// dataForm[col.prop] = col.default ?? null; // not perfect!
});
else if (col.fetchTreeData) {
// parentId 0
col.fetchTreeData().then(({ data: res }) => {
console.log("[DialogJustForm fetchTreeData -->]", res.data);
if (res.code === 0 && res.data) {
if ("list" in res.data) {
this.$set(col, "options", res.data.list);
} else if (Array.isArray(res.data)) {
this.$set(col, "options", res.data);
}
} else { } else {
col.options.splice(0); col.options.splice(0);
} }
}); });
}
}); });
}); });
return { return {
@ -143,6 +154,9 @@ export default {
baseDialogConfig: null, baseDialogConfig: null,
}; };
}, },
created() {
// console.log('[dialog] created!!! wouldn\'t create again...')
},
computed: { computed: {
uploadHeaders() { uploadHeaders() {
return { return {
@ -151,6 +165,25 @@ export default {
}, },
}, },
methods: { methods: {
handleFilelistUpdate(newFilelist) {
// TODO: 访 .files
this.dataForm.files = newFilelist.map((file) => ({
id: file.id,
name: file.name,
url: file.url,
typeCode: file.typeCode,
}));
//
if ("id" in this.dataForm && this.dataForm.id !== null && this.dataForm.id !== undefined) this.addOrUpdate("PUT");
else
this.$notify({
title: "等待保存",
message: "已添加文件,请手动点击保存!",
type: "warning",
duration: 2500,
});
},
/** utitilities */ /** utitilities */
showButton(operate) { showButton(operate) {
const notDetailMode = !this.detailMode; const notDetailMode = !this.detailMode;
@ -164,12 +197,11 @@ export default {
resetForm(excludeId = false, immediate = false) { resetForm(excludeId = false, immediate = false) {
setTimeout( setTimeout(
() => { () => {
console.log("[Dialog Just Form] clearing form...");
Object.keys(this.dataForm).forEach((key) => { Object.keys(this.dataForm).forEach((key) => {
if (excludeId && key === "id") return; if (excludeId && key === "id") return;
this.dataForm[key] = null; this.dataForm[key] = null;
}); });
console.log("[Dialog Just Form] cleared form...", this.dataForm); console.log("[DialogJustForm resetForm()] clearing form...");
this.$refs.dataForm.clearValidate(); this.$refs.dataForm.clearValidate();
this.$emit("dialog-closed"); // this.$emit("dialog-closed"); //
}, },
@ -178,23 +210,157 @@ export default {
}, },
/** init **/ /** init **/
init(parentId, detailMode) { init(id, detailMode) {
console.log("herer........", this.fullscreen); // console.log("[DialogJustForm] init", this.dataForm, id, detailMode);
if (this.$refs.dataForm) { if (this.$refs.dataForm) {
// console.log("[DialogJustForm] clearing form validation...");
// dialog dataForm [0]
this.$refs.dataForm.clearValidate(); this.$refs.dataForm.clearValidate();
} }
this.detailMode = detailMode ?? false; this.detailMode = detailMode ?? false;
this.$nextTick(() => { this.$nextTick(() => {
this.dataForm.parentId = parentId || null; this.dataForm.id = id || null;
if (this.dataForm.id) {
//
this.loadingStatus = true;
//
this.$http
.get(this.urls.base + `/${this.dataForm.id}`)
.then(({ data: res }) => {
if (res && res.code === 0) {
this.dataForm = __pick(res.data, Object.keys(this.dataForm));
/** 格式化文件上传列表 */
if (Array.isArray(this.dataForm.files)) {
this.dataForm.files = this.dataForm.files.map((file) => ({
id: file.id,
name: file.fileUrl.split("/").pop(),
typeCode: file.typeCode,
url: file.fileUrl,
}));
}
// console.log("[DialogJustForm] init():", this.dataForm);
} else {
this.$message({
message: `${res.code}: ${res.msg}`,
type: "error",
duration: 1500,
});
}
this.loadingStatus = false;
})
.catch((err) => {
this.loadingStatus = false;
this.$message({
message: `${err}`,
type: "error",
duration: 1500,
});
});
} else {
//
this.loadingStatus = false;
}
}); });
}, },
/** handlers */
handleSelectChange(col, eventValue) {
// console.log("[dialog] select change: ", col, eventValue);
this.$forceUpdate();
},
handleSwitchChange(val) {
console.log("[dialog] switch change: ", val, this.dataForm);
},
handleComponentModelUpdate(propName, { subject, payload: { data } }) { handleComponentModelUpdate(propName, { subject, payload: { data } }) {
this.dataForm[propName] = JSON.stringify(data); this.dataForm[propName] = JSON.stringify(data);
console.log("[DialogJustForm] handleComponentModelUpdate", this.dataForm[propName]); console.log("[DialogJustForm] handleComponentModelUpdate", this.dataForm[propName]);
}, },
addOrUpdate(method = "POST") {
if ("parentId" in this.dataForm) {
console.log("[DialogJustForm parentId]", this.dataForm.parentId);
// parentId cascader ["xxx"]xxx
const lastItem = this.dataForm.parentId.length - 1;
this.dataForm.parentId = this.dataForm.parentId[lastItem];
}
this.$refs.dataForm.validate((passed, result) => {
if (passed) {
this.loadingStatus = true;
let httpPayload = null;
/** 针对有文件上传选项的弹窗提供特殊的 payload */
if (this.dataForm.files) {
httpPayload = {
...this.dataForm,
fileIds: this.dataForm.files.map((file) => file.id),
};
} else {
httpPayload = this.dataForm;
}
/** 针对时间段设置 payload */
if ("startTime" in this.dataForm && "endTime" in this.dataForm) {
const { startTime, endTime } = this.dataForm;
httpPayload = {
...httpPayload,
startTime: startTime ? moment(startTime).format("YYYY-MM-DDTHH:mm:ss") : moment().format("YYYY-MM-DDTHH:mm:ss"),
endTime: endTime ? moment(endTime).format("YYYY-MM-DDTHH:mm:ss") : moment().format("YYYY-MM-DDTHH:mm:ss"),
};
}
// /** payload */
// if ("updateTime" in this.dataForm) {
// const { updateTime } = this.dataForm;
// httpPayload = {
// ...httpPayload,
// updateTime: updateTime ? moment(updateTime).format("YYYY-MM-DDTHH:mm:ss") : moment().format("YYYY-MM-DDTHH:mm:ss"),
// };
// }
/** 针对时间段设置 payload */
if ("deliveryTime" in this.dataForm) {
const { deliveryTime } = this.dataForm;
httpPayload = {
...httpPayload,
deliveryTime: deliveryTime ? moment(deliveryTime).format("YYYY-MM-DDTHH:mm:ss") : null,
};
}
/** 发送 */
return this.$http({
url: this.urls.base,
method,
data: httpPayload,
})
.then(({ data: res }) => {
console.log("[add&update] res is: ", res);
this.loadingStatus = false;
if (res.code === 0) {
this.$message.success(method === "POST" ? "添加成功" : "更新成功");
this.$emit("refreshDataList");
if (method === "POST") this.handleClose();
} else {
this.$message({
message: `${res.code}: ${res.msg}`,
type: "error",
duration: 2000,
});
}
})
.catch((errMsg) => {
this.$message.error("参数错误:" + errMsg);
if (this.loadingStatus) this.loadingStatus = false;
});
} else {
this.$message.error("请核查字段信息");
}
});
},
handleBtnClick(payload) { handleBtnClick(payload) {
console.log("btn click payload: ", payload); console.log("btn click payload: ", payload);
@ -207,47 +373,19 @@ export default {
this.resetForm(true, true); // true means exclude id, immediate execution this.resetForm(true, true); // true means exclude id, immediate execution
break; break;
case "add": case "add":
case "update": { case "update":
this.$refs.dataForm.validate((passed, result) => { this.addOrUpdate(payload.name === "add" ? "POST" : "PUT");
if (passed) { break;
//
this.loadingStatus = true;
const method = payload.name === "add" ? "POST" : "PUT";
this.$http({
url: this.urls.base,
method,
data: this.dataForm,
})
.then(({ data: res }) => {
console.log("[add&update] res is: ", res);
this.loadingStatus = false;
if (res.code === 0) {
this.$message.success(payload.name === "add" ? "添加成功" : "更新成功");
this.$emit("refreshDataList");
this.handleClose();
} else {
this.$message({
message: `${res.code}: ${res.msg}`,
type: "error",
duration: 2000,
});
}
})
.catch((errMsg) => {
this.$message.error("参数错误:" + errMsg);
if (this.loadingStatus) this.loadingStatus = false;
});
} else {
//
// this.$message.error(JSON.stringify(result));
this.$message.error("请核查字段信息");
}
});
}
} }
} else {
console.log("[x] 不是这么用的! 缺少name属性");
} }
}, },
handleUploadChange(file, fileList) {
console.log("[Upload] handleUploadChange...", file, fileList);
},
handleClose() { handleClose() {
this.resetForm(); this.resetForm();
this.$emit("update:dialogVisible", false); this.$emit("update:dialogVisible", false);
@ -265,7 +403,8 @@ export default {
} }
.el-select, .el-select,
.el-cascader { .el-cascader,
.el-date-editor {
width: 100% !important; width: 100% !important;
} }

View File

@ -5,206 +5,212 @@ import { timeFilter, dictFilter } from "@/utils/filters";
function changeOrderSort(orderId, location) { function changeOrderSort(orderId, location) {
/** this - vue instance, 0 - to top, 1 - up, 2 - down, 3 - to bottom */ /** this - vue instance, 0 - to top, 1 - up, 2 - down, 3 - to bottom */
return this.$http.get('/pms/order/change', { params: { id: orderId, location } }).then(({ data: res }) => { return this.$http
if (res.code === 0) { .get("/pms/order/change", { params: { id: orderId, location } })
} else throw new Error(`${res.code}: ${res.msg}`) .then(({ data: res }) => {
}).catch(err => { if (res.code === 0) {
this.$message({ } else throw new Error(`${res.code}: ${res.msg}`);
message: err,
type: 'error',
duration: 1500
}) })
}) .catch((err) => {
this.$message({
message: err,
type: "error",
duration: 1500,
});
});
} }
export default function () { export default function () {
const operations = { const operations = {
'ongoing': [ ongoing: [
// { name: 'view-detail', label: '查看详情' }, // { name: 'view-detail', label: '查看详情' },
// { name: 'confirm-order', label: '确认', icon: 'success', showText: true }, // { name: 'confirm-order', label: '确认', icon: 'success', showText: true },
{ name: 'end-order', label: '结束', icon: 'error', showText: true }, { name: "end-order", label: "结束", icon: "error", showText: true },
{ name: 'move-up', label: '上移', icon: 'caret-top', showText: true }, { name: "move-up", label: "上移", icon: "caret-top", showText: true },
{ name: 'move-down', label: '下移', icon: 'caret-bottom', showText: true }, { name: "move-down", label: "下移", icon: "caret-bottom", showText: true },
{ name: 'move-to-top', label: '至顶', icon: 'upload2', showText: true }, { name: "move-to-top", label: "至顶", icon: "upload2", showText: true },
{ name: 'move-to-bottom', label: '至底', icon: 'download', showText: true }, { name: "move-to-bottom", label: "至底", icon: "download", showText: true },
{ name: 'destroy-order', label: '废除', icon: 'delete-solid', showText: true }, { name: "destroy-order", label: "废除", icon: "delete-solid", showText: true },
], ],
'pending': [ pending: [
'edit', "edit",
{ name: 'confirm-order', label: '确认订单', icon: 'success', showText: true }, { name: "confirm-order", label: "确认订单", icon: "success", showText: true },
{ name: 'move-up', label: '上移', icon: 'caret-top', showText: true }, { name: "move-up", label: "上移", icon: "caret-top", showText: true },
{ name: 'move-down', label: '下移', icon: 'caret-bottom', showText: true }, { name: "move-down", label: "下移", icon: "caret-bottom", showText: true },
{ name: 'move-to-top', label: '至顶', icon: 'upload2', showText: true }, { name: "move-to-top", label: "至顶", icon: "upload2", showText: true },
{ name: 'move-to-bottom', label: '至底', icon: 'download', showText: true }, { name: "move-to-bottom", label: "至底", icon: "download", showText: true },
{ name: 'delete', emitFull: true, permission: '' } { name: "delete", emitFull: true, permission: "" },
], ],
'finished': [ finished: [
// { name: 'view', label: '查看详情' } // { name: 'view', label: '查看详情' }
// { name: 'end-order', label: '结束订单', icon: 'error', showText: true }, // { name: 'end-order', label: '结束订单', icon: 'error', showText: true },
]
}
const genTableProps = (type /** ongoing, pending, finished */) =>
[
{ width: 80, type: 'index', label: '序号', fixed: true },
{ width: 120, prop: "code", label: "订单号", fixed: 'left' },
{ width: 120, prop: "createTime", label: "添加时间", filter: timeFilter },
{ width: 120, prop: "statusDictValue", label: "订单状态", filter: dictFilter('order_status') }, // 不可编辑
{ width: 200, prop: "cate", label: "子订单号" },
{ width: 200, prop: "productCode", label: "物料编号" }, // select, filterable
{ width: 200, prop: "shapeCode", label: "砖型编号" }, // select, filterable
{ width: 120, prop: "brand", label: "牌号" }, // select, filterable
{ width: 80, prop: "addon", label: "addon" },
{ width: 120, prop: "ai", label: "版本号" }, // auto display according to the 配方
{ width: 200, prop: "shortDesc", label: "物料号销售文本" },
{ width: 200, prop: "bomCode", label: "配方编码" },
{ width: 200, prop: "pressCode", label: "压机号" }, // select, filterable
{ width: 200, prop: "blenderCode", label: "混料机号" }, // select, filterable
{ width: 200, prop: "kilnCode", label: "隧道窑号" }, // select, filterable
{ width: 120, prop: "prodqty", label: "订单砖数" },
{ width: 120, prop: "ktmp", label: "烧成温度" },
{ width: 120, prop: "tt", label: "烧成时间" },
{ width: 120, prop: "yieldqty", label: "已生产数量" }, // uneditable
{ width: 120, prop: "soqty", label: "销售订单数" },
{ width: 200, prop: "saleNo", label: "销售订单号" },
{ width: 200, prop: "saleOrderItem", label: "销售订单item号" },
{ width: 200, prop: "packTechCode", label: "包装工艺代码" }, // select, filterable
{ width: 120, prop: "specifications", label: "生产订单类型" },
{ width: 120, prop: "deliveryTime", label: "发货时间" },
{ width: 120, prop: "customerCode", label: "客户" },
{ width: 120, prop: "pcsKilnCar", label: "托盘码放砖数", },
{ prop: "description", label: "详情", subcomponent: TableTextComponent },
{ width: 200, prop: "remark", label: "备注" },
type !== 'finished' ? {
prop: "operations",
name: "操作",
fixed: "right",
subcomponent: TableOperaionComponent,
options: operations[type],
width: operations[type].length * 64
} : {}
];
const genHeadFormFields = type => ({
'ongoing': [
{
label: '订单号',
prop: 'code',
input: true,
default: { value: '' },
bind: { placeholder: '请输入订单号' }
},
{
// 时间段
timerange: true,
prop: 'timerange',
label: "时间段",
bind: {
placeholder: "选择日期时间",
type: "datetimerange",
"start-placeholder": "开始时间",
"end-placeholder": "结束时间",
},
},
{
// 查询
button: {
type: "primary",
name: "查询",
},
},
], ],
'pending': [ };
{
label: '订单号', const genTableProps = (type /** ongoing, pending, finished */) => [
prop: 'code', { width: 80, type: "index", label: "序号", fixed: true },
input: true, { width: 120, prop: "code", label: "订单号", fixed: "left" },
bind: { placeholder: '请输入订单号' } { width: 120, prop: "createTime", label: "添加时间", filter: timeFilter },
}, { width: 120, prop: "statusDictValue", label: "订单状态", filter: dictFilter("order_status") }, // 不可编辑
{ { width: 200, prop: "cate", label: "子订单号" },
// 查询 { width: 200, prop: "productCode", label: "物料编号" }, // select, filterable
button: { { width: 200, prop: "shapeCode", label: "砖型编号" }, // select, filterable
type: "primary", { width: 120, prop: "brand", label: "牌号" }, // select, filterable
name: "查询", { width: 80, prop: "addon", label: "addon" },
}, { width: 120, prop: "ai", label: "版本号" }, // auto display according to the 配方
}, { width: 200, prop: "shortDesc", label: "物料号销售文本" },
{ { width: 200, prop: "bomCode", label: "配方编码" },
// 新增订单 { width: 200, prop: "pressCode", label: "压机号" }, // select, filterable
button: { { width: 200, prop: "blenderCode", label: "混料机号" }, // select, filterable
type: "primary", { width: 200, prop: "kilnCode", label: "隧道窑号" }, // select, filterable
name: "新增", { width: 120, prop: "prodqty", label: "订单砖数" },
permission: "", { width: 120, prop: "ktmp", label: "烧成温度" },
}, { width: 120, prop: "tt", label: "烧成时间" },
bind: { { width: 120, prop: "yieldqty", label: "已生产数量" }, // uneditable
plain: true, { width: 120, prop: "soqty", label: "销售订单数" },
}, { width: 200, prop: "saleNo", label: "销售订单号" },
}, { width: 200, prop: "saleOrderItem", label: "销售订单item号" },
{ { width: 200, prop: "packTechCode", label: "包装工艺代码" }, // select, filterable
// 导入订单 - TODO: 需完善具体接口和功能 { width: 120, prop: "specifications", label: "生产订单类型" },
button: { { width: 120, prop: "deliveryTime", label: "发货时间" },
type: "success", { width: 120, prop: "customerCode", label: "客户" },
name: "导入订单", { width: 120, prop: "pcsKilnCar", label: "托盘码放砖数" },
}, { prop: "description", label: "详情", subcomponent: TableTextComponent },
bind: { { width: 200, prop: "remark", label: "备注" },
plain: true type !== "finished"
? {
prop: "operations",
name: "操作",
fixed: "right",
subcomponent: TableOperaionComponent,
options: operations[type],
width: operations[type].length * 64,
} }
}, : {},
];
], const genHeadFormFields = (type) =>
'finished': [ ({
{ ongoing: [
label: '订单号', {
prop: 'code', label: "订单号",
input: true, prop: "code",
bind: { placeholder: '请输入订单号' } input: true,
}, default: { value: "" },
{ bind: { placeholder: "请输入订单号" },
// 查询
button: {
type: "primary",
name: "查询",
}, },
}, {
] // 时间段
})[type] timerange: true,
prop: "timerange",
label: "时间段",
bind: {
placeholder: "选择日期时间",
type: "datetimerange",
"start-placeholder": "开始时间",
"end-placeholder": "结束时间",
},
},
{
// 查询
button: {
type: "primary",
name: "查询",
},
},
],
pending: [
{
label: "订单号",
prop: "code",
input: true,
bind: { placeholder: "请输入订单号" },
},
{
// 查询
button: {
type: "primary",
name: "查询",
},
},
{
// 新增订单
button: {
type: "primary",
name: "新增",
permission: "",
},
bind: {
plain: true,
},
},
{
// 导入订单 - TODO: 需完善具体接口和功能
button: {
type: "success",
name: "导入订单",
},
bind: {
plain: true,
},
},
],
finished: [
{
label: "订单号",
prop: "code",
input: true,
bind: { placeholder: "请输入订单号" },
},
{
// 查询
button: {
type: "primary",
name: "查询",
},
},
],
}[type]);
const textOnlyComponent = { const textOnlyComponent = {
props: { props: {
modelValue: { modelValue: {
type: String, type: String | Number,
required: true required: true,
} },
useBuiltin: {
type: Boolean,
default: true,
},
}, },
data() { data() {
return { return {
orderStatusMap: [ orderStatusMap: ["等待", "确认", "生产", "暂停", "结束", "接受", "拒绝"],
'等待', '确认', '生产', '暂停', '结束', '接受', '拒绝' };
]
}
}, },
methods: {}, methods: {},
mounted() { mounted() {
console.log('this.modelValue', this.modelValue) console.log("this.modelValue", this.modelValue);
}, },
render: function (h) { render: function (h) {
return h('span', { style: { display: 'block', marginTop: '0' } }, this.orderStatusMap[this.modelValue] ?? '-') return h(
} "span",
} { style: { display: "block", marginTop: "0" } },
this.useBuiltin ? this.orderStatusMap[this.modelValue] ?? "-" : this.modelValue.toString().trim() === "" ? "-" : this.modelValue.toString()
);
},
};
const dictList = JSON.parse(localStorage.getItem("dictList")); const dictList = JSON.parse(localStorage.getItem("dictList"));
const dialogConfigs = { const dialogConfigs = {
form: { form: {
rows: [ rows: [
// 订单号
// 订单子号 int
// 订单状态
// 生产订单类型
// 物料 - 产品 select fitler
[ [
{
label: "订单状态",
prop: "statusDictValue",
component: textOnlyComponent,
},
{ {
input: true, input: true,
label: "订单号", label: "订单号",
@ -212,22 +218,16 @@ export default function () {
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入订单号" }, elparams: { placeholder: "请输入订单号" },
}, },
{},
{ {
input: true, input: true,
label: "订单子号", label: "订单子号",
prop: "cate", prop: "cate",
rules: [ rules: [
{ required: true, message: "必填项不能为空", trigger: "blur" }, { required: true, message: "必填项不能为空", trigger: "blur" },
{ type: 'number', message: "请输入正确的数字类型", trigger: "blur", transform: val => Number(val) }, { type: "number", message: "请输入正确的数字类型", trigger: "blur", transform: (val) => Number(val) },
], ],
elparams: { placeholder: "请输入订单子号" }, elparams: { placeholder: "请输入订单子号" },
}, },
{
label: "订单状态",
prop: "statusDictValue",
component: textOnlyComponent
},
{ {
input: true, input: true,
label: "生产订单类型", label: "生产订单类型",
@ -237,22 +237,32 @@ export default function () {
}, },
{ {
select: true, select: true,
label: "物料", label: "物料编号",
prop: "productCode", prop: "productId",
options: [], options: [],
fetchData: () => this.$http.get('/pms/product/page', { params: { limit: 999, page: 1, key: '' } }), optionLabel: "code",
// optionValue: 'code',
// fetchedDataIdConvertTo: 'productId',
// optionValue: 'id',
fetchData: () => this.$http.get("/pms/product/page", { params: { limit: 999, page: 1, key: "" } }),
// label: "单位",
// prop: "unitDictValue",
// options: dictList["unit"].map((u) => ({ label: u.dictLabel, value: u.dictValue })),
elparams: { placeholder: "请选择物料", filterable: true },
},
{
select: true,
label: "包装代码",
prop: "packTech",
options: [],
optionLabel: "code",
fetchData: () => this.$http.post("/pms/equipmentTech/pageView", { limit: 999, page: 1, key: "", shape: "", wsId: 5 }),
// label: "单位", // label: "单位",
// prop: "unitDictValue", // prop: "unitDictValue",
// options: dictList["unit"].map((u) => ({ label: u.dictLabel, value: u.dictValue })), // options: dictList["unit"].map((u) => ({ label: u.dictLabel, value: u.dictValue })),
elparams: { placeholder: "请选择物料", filterable: true }, elparams: { placeholder: "请选择物料", filterable: true },
}, },
], ],
// 生产订单数 int
// 已生产数 int uneditable
// 托盘码放砖数
// 包装代码 - 包装工艺 s f
// addon
[ [
{ {
input: true, input: true,
@ -282,121 +292,103 @@ export default function () {
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入addon" }, elparams: { placeholder: "请输入addon" },
}, },
{
select: true,
label: "包装代码",
prop: "packTechCode",
options: [],
fetchData: () => this.$http.post('/pms/equipmentTech/pageView', { limit: 999, page: 1, key: '', shape: '', wsId: 5 }),
// label: "单位",
// prop: "unitDictValue",
// options: dictList["unit"].map((u) => ({ label: u.dictLabel, value: u.dictValue })),
elparams: { placeholder: "请选择物料", filterable: true },
},
],
// 砖型 select fitler
// 牌号 select f
// 压机号 - 设备 s f
// 混料机号 - 设备 s f
// 隧道窑号 - 设备 s f
[
{ {
select: true, select: true,
label: "砖型", label: "砖型",
prop: "shapeCode", prop: "shape",
optionLabel: "code",
options: [], options: [],
fetchData: () => this.$http.get('/pms/shape/page', { params: { limit: 999, page: 1, key: '' } }), fetchData: () => this.$http.get("/pms/shape/page", { params: { limit: 999, page: 1, key: "" } }),
// label: "单位", // label: "单位",
// prop: "unitDictValue", // prop: "unitDictValue",
// options: dictList["unit"].map((u) => ({ label: u.dictLabel, value: u.dictValue })), // options: dictList["unit"].map((u) => ({ label: u.dictLabel, value: u.dictValue })),
elparams: { placeholder: "请选择砖型", filterable: true }, elparams: { placeholder: "请选择砖型", filterable: true },
}, },
{
select: true,
label: "压机",
prop: "press",
options: [],
optionLabel: "code",
fetchData: () => this.$http.get("/pms/equipment/page", { params: { limit: 999, page: 1, name: "" } }),
elparams: { placeholder: "请选择压机号", filterable: true },
},
],
[
{ {
select: true, select: true,
label: "牌号", label: "牌号",
prop: "brand", prop: "brand",
options: [], options: [],
fetchData: () => this.$http.get('/pms/bom/page', { params: { limit: 999, page: 1, key: '' } }), // optionLabel: '',
fetchData: () => this.$http.get("/pms/bom/page", { params: { limit: 999, page: 1, key: "" } }),
elparams: { placeholder: "请选择牌号", filterable: true }, elparams: { placeholder: "请选择牌号", filterable: true },
// TODO: 选择后,需要带出一些数据 // TODO: 选择后,需要带出一些数据
}, },
{ {
select: true, // input: true,
label: "压机号", // select: true,
prop: "pressCode", label: "配方号代码",
options: [], prop: "bomCode",
fetchData: () => this.$http.get('/pms/equipment/page', { params: { limit: 999, page: 1, name: '' } }), // options: [],
elparams: { placeholder: "请选择压机号", filterable: true }, // optionLabel: 'code',
// fetchData: () => this.$http.get("/pms/bom/page", { params: { limit: 999, page: 1, key: "" } }),
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请选择配方" },
component: textOnlyComponent,
bind: {
useBuiltin: false,
},
},
{
label: "版本号",
prop: "ai",
component: textOnlyComponent,
bind: {
useBuiltin: false,
},
}, },
{ {
select: true, select: true,
label: "混料机号", label: "混料机号",
prop: "blenderCode", prop: "blender",
options: [], options: [],
fetchData: () => this.$http.get('/pms/equipment/page', { params: { limit: 999, page: 1, name: '' } }), optionLabel: "code",
fetchData: () => this.$http.get("/pms/equipment/page", { params: { limit: 999, page: 1, name: "" } }),
elparams: { placeholder: "请选择混料机号", filterable: true }, elparams: { placeholder: "请选择混料机号", filterable: true },
}, },
{ {
select: true, select: true,
label: "隧道窑号", label: "隧道窑号",
prop: "kilnCode", prop: "kiln",
options: [], options: [],
fetchData: () => this.$http.get('/pms/equipment/page', { params: { limit: 999, page: 1, name: '' } }), optionLabel: "code",
fetchData: () => this.$http.get("/pms/equipment/page", { params: { limit: 999, page: 1, name: "" } }),
elparams: { placeholder: "请选择隧道窑号", filterable: true }, elparams: { placeholder: "请选择隧道窑号", filterable: true },
}, },
],
// 烧成温度
// 烧成时间
// ai 随配方自动带出
// 配方号代码 随配方自动带出
// 物料号销售文本 随配方自动带出
[
{ {
input: true, input: true,
label: "烧成温度", label: "烧成温度 ℃",
prop: "ktmp", prop: "ktmp",
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入烧成温度" }, elparams: { placeholder: "请输入烧成温度" },
}, },
// {
// input: true,
// label: "版本号",
// prop: "ai",
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请输入版本号" },
// },
],
[
{ {
input: true, input: true,
label: "烧成时间", label: "烧成时间 H",
prop: "tt", prop: "tt",
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入烧成时间" }, elparams: { placeholder: "请输入烧成时间" },
}, },
{
input: true,
label: "版本号",
prop: "ai",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入版本号" },
},
{
input: true,
label: "配方号代码",
prop: "bomCode",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入配方号代码" },
},
{
input: true,
label: "物料号销售文本",
prop: "shortDesc",
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入物料号销售文本" },
},
],
// 销售订单号
// 销售订单item号
// 销售订单砖数 int
// 销售时间
// 客户名
[
{ {
input: true, input: true,
label: "销售订单号", label: "销售订单号",
@ -408,7 +400,7 @@ export default function () {
input: true, input: true,
label: "销售订单item号", label: "销售订单item号",
prop: "saleOrderItem", prop: "saleOrderItem",
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, // rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入销售订单item号" }, elparams: { placeholder: "请输入销售订单item号" },
}, },
{ {
@ -420,36 +412,55 @@ export default function () {
}, },
{ {
// time // time
input: true, datetime: true,
label: "销售时间", label: "销售时间",
prop: "deliveryTime", prop: "deliveryTime",
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入销售时间" }, elparams: { placeholder: "请选择销售时间" },
}, },
{ {
input: true, select: true,
label: "客户", label: "客户",
prop: "customerCode", prop: "customerId",
option: [],
optionLabel: "name",
fetchData: () => this.$http.get("/pms/customer/page", { params: { limit: 999, page: 1, name: "" } }),
rules: { required: true, message: "必填项不能为空", trigger: "blur" }, rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: { placeholder: "请输入客户" }, elparams: { placeholder: "请选择客户" },
},
],
[
// {
// input: true,
// label: "物料号销售文本",
// prop: "shortDesc",
// rules: { required: true, message: "必填项不能为空", trigger: "blur" },
// elparams: { placeholder: "请输入物料号销售文本" },
// },
{
label: "物料号销售文本",
prop: "shortDesc",
component: textOnlyComponent,
bind: {
useBuiltin: false,
},
}, },
], ],
// 备注 // 备注
[{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }], [{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }],
// { // {
// select: true, // select: true,
// label: "原料类别", // label: "原料类别",
// prop: "typeDictValue", // prop: "typeDictValue",
// options: dictList["material_category"].map((u) => ({ label: u.dictLabel, value: u.dictValue })), // options: dictList["material_category"].map((u) => ({ label: u.dictLabel, value: u.dictValue })),
// elparams: { placeholder: "原料类别" }, // elparams: { placeholder: "原料类别" },
// // autoDisabled: true // // autoDisabled: true
// }, // },
], ],
operations: [ operations: [
{ name: "add", label: "保存", type: "primary", permission: "pms:material:save", showOnEdit: false }, { name: "add", label: "保存", type: "primary", permission: "", showOnEdit: false },
{ name: "update", label: "更新", type: "primary", permission: "pms:material:save", showOnEdit: true }, { name: "update", label: "更新", type: "primary", permission: "", showOnEdit: true },
{ name: "reset", label: "重置", type: "warning", showAlways: true }, { name: "reset", label: "重置", type: "warning", showAlways: true },
], ],
}, },
@ -458,19 +469,20 @@ export default function () {
return { return {
dialogConfigs, dialogConfigs,
tableConfigs: { tableConfigs: {
ongoingTable: genTableProps('ongoing'), ongoingTable: genTableProps("ongoing"),
pendingTable: genTableProps('pending'), pendingTable: genTableProps("pending"),
finishedTable: genTableProps('finished'), finishedTable: genTableProps("finished"),
}, },
headFormConfigs: { headFormConfigs: {
ongoingTableSearch: genHeadFormFields('ongoing'), ongoingTableSearch: genHeadFormFields("ongoing"),
pendingTableSearch: genHeadFormFields('pending'), pendingTableSearch: genHeadFormFields("pending"),
finishedTableSearch: genHeadFormFields('finished') finishedTableSearch: genHeadFormFields("finished"),
}, },
urls: { urls: {
confirmedOrder: '/pms/order/pageCom', confirmedOrder: "/pms/order/pageCom",
finishedOrder: '/pms/order/pageEnd', finishedOrder: "/pms/order/pageEnd",
unConfirmedOrder: '/pms/order/pageUnCom', unConfirmedOrder: "/pms/order/pageUnCom",
base: "/pms/order",
// base: "/pms/material", // base: "/pms/material",
// page: "/pms/material/page", // page: "/pms/material/page",
// tree: "/pms/material/tree", // tree: "/pms/material/tree",
@ -481,71 +493,69 @@ export default function () {
}; };
} }
// const headFormFields = [
// {
// const headFormFields = [ // label: '订单号',
// { // prop: 'code',
// label: '订单号', // input: true,
// prop: 'code', // bind: { placeholder: '请输入订单号' }
// input: true, // },
// bind: { placeholder: '请输入订单号' } // // {
// }, // // label: '子订单号',
// // { // // prop: 'cate',
// // label: '子订单号', // // input: true,
// // prop: 'cate', // // bind: { placeholder: '请输入子订单号', rules: [{ type: 'number', message: '请输入整数', trigger: 'blur', transform: val => Number(val) }] }
// // input: true, // // },
// // bind: { placeholder: '请输入子订单号', rules: [{ type: 'number', message: '请输入整数', trigger: 'blur', transform: val => Number(val) }] } // // {
// // }, // // label: "配方",
// // { // // prop: "bomId",
// // label: "配方", // // select: [],
// // prop: "bomId", // // fn: () => this.$http.get('/pms/bom/page', { params: { key: '', limit: 999, page: 1 } }),
// // select: [], // // bind: { placeholder: "请选择配方" },
// // fn: () => this.$http.get('/pms/bom/page', { params: { key: '', limit: 999, page: 1 } }), // // },
// // bind: { placeholder: "请选择配方" }, // // {
// // }, // // label: '砖型',
// // { // // prop: 'shapeId',
// // label: '砖型', // // select: [],
// // prop: 'shapeId', // // fn: () => this.$http.get('/pms/shape/page', { params: { key: '', limit: 999, page: 1 } }),
// // select: [], // // bind: { placeholder: "请选择砖型" },
// // fn: () => this.$http.get('/pms/shape/page', { params: { key: '', limit: 999, page: 1 } }), // // },
// // bind: { placeholder: "请选择砖型" }, // // {
// // }, // // label: '工艺',
// // { // // prop: 'techId',
// // label: '工艺', // // select: [],
// // prop: 'techId', // // fn: () => this.$http.post('/pms/equipmentTech/pageView', { key: '', shape: '', wsId: 0, limit: 999, page: 1 }),
// // select: [], // // bind: { placeholder: "请选择砖型" },
// // fn: () => this.$http.post('/pms/equipmentTech/pageView', { key: '', shape: '', wsId: 0, limit: 999, page: 1 }), // // },
// // bind: { placeholder: "请选择砖型" }, // // {
// // }, // // label: '订单状态',
// // { // // prop: 'types', // 0等待, 1确认, 2生产3暂停, 4结束, 5接受, 6拒绝
// // label: '订单状态', // // select: [
// // prop: 'types', // 0等待, 1确认, 2生产3暂停, 4结束, 5接受, 6拒绝 // // {label: '等待', value: 0},
// // select: [ // // {label: '确认', value: 1},
// // {label: '等待', value: 0}, // // {label: '生产', value: 2},
// // {label: '确认', value: 1}, // // {label: '暂停', value: 3},
// // {label: '生产', value: 2}, // // {label: '结束', value: 4},
// // {label: '暂停', value: 3}, // // {label: '接受', value: 5},
// // {label: '结束', value: 4}, // // {label: '拒绝', value: 6},
// // {label: '接受', value: 5}, // // ],
// // {label: '拒绝', value: 6}, // // // fn: () => this.$http.post('/pms/equipmentTech/pageView', { key: '', shape: '', wsId: 0, limit: 999, page: 1 }),
// // ], // // bind: { placeholder: "请选择订单状态" },
// // // fn: () => this.$http.post('/pms/equipmentTech/pageView', { key: '', shape: '', wsId: 0, limit: 999, page: 1 }), // // },
// // bind: { placeholder: "请选择订单状态" }, // {
// // }, // button: {
// { // type: "primary",
// button: { // name: "查询",
// type: "primary", // },
// name: "查询", // },
// }, // {
// }, // button: {
// { // type: "primary",
// button: { // name: "新增",
// type: "primary", // permission: "",
// name: "新增", // },
// permission: "", // bind: {
// }, // plain: true,
// bind: { // },
// plain: true, // },
// }, // ];
// },
// ];