add 生成托盘弹窗

This commit is contained in:
lb 2023-08-22 10:36:46 +08:00
parent 7513d82d4d
commit a28544b671
5 changed files with 427 additions and 0 deletions

View File

@ -0,0 +1,185 @@
<!--
filename: palletDialog.vue
author: liubin
date: 2023-08-22 09:15:49
description: 生成托盘弹窗
-->
<template>
<el-dialog
:visible.sync="visible"
width="500px"
v-bind="$attrs"
@close="close"
@closed="$emit('destroy')"
custom-class="pms-dialog">
<!-- :class="{ 'pms-dialog--rotate-down': startLeave }"> -->
<span slot="title" class="dialog-title">生成托盘</span>
<el-form ref="dataForm" :model="dataForm" size="small" style="padding: 16px" v-loading="formLoading">
<el-row :gutter="20">
<el-col>
<el-form-item label="订单号" prop="orderId" :rules="null">
<el-select v-model="dataForm.orderId" filterable clearable placeholder="请选择订单号">
<el-option v-for="o in orderList" :key="o.id" :label="o.code" :value="o.id">
<div class="option-label">
<span>{{ o.code }}</span>
<span>{{ o.cate }}</span>
</div>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="ids.length > 0" :gutter="20">
<el-col>
<el-form-item label="尾托" prop="ids" :rules="null">
<el-input disabled v-model="ids[0].orderCode" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="close">取消</el-button>
<el-button size="small" type="primary" @click="handleConfirm">生成</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
name: "PalletDialog",
components: {},
props: ["ids"],
data() {
return {
visible: false,
loading: false,
orderList: [],
dataForm: {
orderId: null,
ids: [],
},
formLoading: false,
};
},
methods: {
async init() {
this.visible = true;
this.loading = true;
//
const { data: res } = await this.$http.post("/pms/order/listWithStock");
if (res.code === 0) {
this.orderList = res.data.map((item, index) => ({
code: item.code, //
cate: item.cate, //
id: item.id, // id
}));
}
this.loading = false;
},
close() {
this.visible = false;
},
async handleConfirm() {
this.loading = true;
const { data: res } = await this.$http.post("/pms/pallet/newPallet", this.dataForm);
this.loading = false;
if (res.code === 0) {
this.$message.success("提交成功");
this.$emit("refresh-list");
this.close();
}
},
//
clearDataForm() {
this.dataForm = {
orderId: null,
ids: [],
};
},
},
};
</script>
<style scoped>
.dialog-just-form >>> .dialog-title {
color: #000;
}
.dialog-just-form >>> .el-dialog__body {
/* padding-top: 16px !important;
padding-bottom: 16px !important; */
padding-top: 0 !important;
padding-bottom: 0 !important;
}
.el-select,
.el-cascader,
.el-date-editor {
width: 100% !important;
}
.dialog-just-form >>> .el-dialog__header {
padding: 10px 20px 10px;
/* background: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), white); */
}
</style>
<style>
.pms-dialog {
box-shadow: 0 0 24px 8px rgba(0, 0, 0, 0.125);
border-radius: 4px;
transition: transform 1.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.pms-dialog .el-dialog__header {
padding: 16px;
border-bottom: 1px solid #eaeaea;
}
.pms-dialog .el-dialog__header .dialog-title {
font-size: 1.2rem;
}
.pms-dialog .el-dialog__body {
padding: 0;
overflow-x: hidden;
}
.pms-dialog .el-dialog__footer {
background: #fafafa;
min-height: 3.2rem;
padding: 0;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
text-align: unset;
display: flex;
justify-content: flex-end;
padding: 8px 16px;
align-items: center;
}
.option-label {
display: flex;
align-items: center;
}
.option-label > span {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.option-label > span:first-child {
width: 128px;
margin-right: 8px;
}
/* .option-label > span:last-child {
} */
</style>

View File

@ -70,6 +70,13 @@
@destroy="carReportDialogVisible = false"
@refresh-list="getList"
:ids="tableSelectedIds" />
<PalletDialog
ref="pallet-dialog"
v-if="palletDialogVisible"
@destroy="palletDialogVisible = false"
@refresh-list="getList"
:ids="tableSelectedIds" />
</div>
</template>
@ -85,6 +92,7 @@ import moment from "moment";
import AttachmentDialog from "@/components/attachmentDialog.vue";
import PrintDom from "../../components/PrintDom.vue";
import ReportDialog from "../../components/ReportDialog.vue";
import PalletDialog from "../../components/palletDialog.vue";
const DIALOG_WITH_MENU = "DialogWithMenu";
const DIALOG_JUST_FORM = "DialogJustForm";
@ -103,6 +111,7 @@ export default {
AttachmentDialog,
PrintDom,
ReportDialog,
PalletDialog,
},
props: {
navigator: {
@ -192,6 +201,7 @@ export default {
printDOMmount: false,
queryParams: {},
carReportDialogVisible: false,
palletDialogVisible: false,
};
},
inject: ["urls"],
@ -713,6 +723,13 @@ export default {
});
break;
case "打印":
if (this.tableSelectedIds.length === 0) {
return this.$message({
message: "请先选择要打印的项",
type: "warning",
duration: 1500,
});
}
return this.$confirm("开始打印么", "提示", {
confirmButtonText: "确认",
cancelButtonText: "我再想想",
@ -737,6 +754,27 @@ export default {
this.$refs["car-report-dialog"].init();
});
break;
case "生成托盘":
if (this.tableSelectedIds.length > 1) {
return this.$message({
message: "只能选择一项",
type: "warning",
duration: 1500,
});
}
//
if (this.tableSelectedIds.length == 1 && this.tableSelectedIds[0].typeDictValue != "2") {
return this.$message({
message: "只能选择尾托",
type: "warning",
duration: 1500,
});
}
this.palletDialogVisible = true;
this.$nextTick(() => {
this.$refs["pallet-dialog"].init();
});
break;
}
},

View File

@ -15,6 +15,7 @@ export default function () {
{ prop: "realQty", label: "数量" },
{ prop: "typeDictValue", label: "类型", filter: dictFilter("pallet_type") },
{ prop: "stifling", label: "熏蒸", filter: (val) => (val != null ? ["非熏蒸", "熏蒸"][val] : "-") },
{ prop: "externalCode", label: "提库单" },
{ prop: "printTime", label: "打印时间", filter: timeFilter },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{
@ -68,6 +69,15 @@ export default function () {
plain: true,
},
},
{
button: {
type: "warning",
name: "生成托盘",
},
bind: {
plain: true,
},
},
];
const dialogJustFormConfigs = {

View File

@ -0,0 +1,147 @@
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
import request from "@/utils/request";
import { timeFilter, dictFilter } from "@/utils/filters";
import { getDictDataList } from "@/utils";
// import StateSelect from '@/components/StateSelect.vue';
export default function () {
const tableProps = [
{ type: "index", label: "序号" },
{ type: "selection" },
{ prop: "code", label: "流水号" },
{ prop: "carCode", label: "窑车号" },
{ prop: "orderCode", label: "订单号" },
{ prop: "realQty", label: "数量" },
{ prop: "typeDictValue", label: "类型", filter: dictFilter("pallet_type") },
{ prop: "stifling", label: "熏蒸", filter: (val) => (val != null ? ["非熏蒸", "熏蒸"][val] : "-") },
{ prop: "externalCode", label: "提库单" },
{ prop: "printTime", label: "打印时间", filter: timeFilter },
{ prop: "createTime", label: "添加时间", filter: timeFilter },
{
prop: "operations",
name: "操作",
fixed: "right",
width: 90,
subcomponent: TableOperaionComponent,
options: [
{ name: "print", label: "打印", icon: "printer" },
{ name: "view-car-record", label: "窑车记录", emitField: "hisId", icon: "shopping-cart-1" },
],
},
];
tableProps.defaultPageSize = 999;
const headFormFields = [
{
button: {
type: "primary",
name: "打印",
},
bind: {
plain: true,
},
},
];
const dialogJustFormConfigs = {
form: {
rows: [
[
{
select: true,
label: "窑车号",
prop: "carId",
options: [],
fetchData: () => this.$http.get("/pms/car/page", { params: { page: 1, limit: 999 } }),
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: {
disabled: true,
},
},
{
select: true,
label: "状态",
prop: "stateDictValue",
options: getDictDataList("car_state").map((i) => ({ label: i.dictLabel, value: i.dictValue })),
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: {
fliterable: true,
},
},
],
[
{
// select: true,
input: true,
label: "位置",
prop: "pos",
// options: getDictDataList(),
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
elparams: {
// fliterable: true
},
},
{
label: "查看载砖详情",
button: true,
onClick: function (id) {
// 必须用 function 形式
console.log(`查看载砖详情`, id);
this.$emit("emit-data", { type: "to-car-payload", data: id });
},
},
],
],
operations: [
// { name: "add", label: "保存", type: "primary", permission: "", showOnEdit: false },
// { name: "update", label: "更新", type: "primary", permission: "", showOnEdit: true },
// { name: "reset", label: "重置", type: "warning", showAlways: true },
],
},
};
const carPayloadDialogConfigs = {
dialogWidth: "70%",
carPayloadDialog: true,
clickModalToClose: false,
tableConfig: {
table: null,
column: [
// 窑车的 装载详情
// tableProps
{ width: 56, type: "index", label: "序号" },
{ prop: "orderCode", label: "订单号" },
{ width: 80, prop: "orderCate", label: "订单子号" },
{ prop: "bomCode", label: "配方" },
{ prop: "shapeCode", label: "砖型" },
{ width: 80, prop: "qty", label: "订单数量" },
{ width: 72, prop: "goodqty", label: "合格数" },
{ width: 72, prop: "badqty", label: "废砖数" },
// { prop: "startTime", label: "开始时间" },
// { prop: "endTime", label: "结束时间" },
// { prop: "remark", label: "备注" },
],
},
};
return {
carPayloadDialogConfigs,
dialogConfigs: dialogJustFormConfigs,
tableConfig: {
table: null, // 此处可省略el-table 上的配置项
column: tableProps, // el-column-item 上的配置项
},
headFormConfigs: {
rules: null, // 名称是由 BaseSearchForm.vue 组件固定的
fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的
},
urls: {
base: "/pms/carHistory",
payload: "/pms/carHandle", // hisId 查询 载砖详情
page: "/pms/pallet/listForPrint",
pageIsPostApi: true,
printLog: "/pms/pallet/print", // post
},
};
}

View File

@ -0,0 +1,47 @@
<template>
<ListViewWithHead
:table-config="tableConfig"
:head-config="headFormConfigs"
:dialog-configs="dialogConfigs"
:car-payload-dialog-configs="carPayloadDialogConfigs"
:list-query-extra="[
/** { pos: [] } **/
]"
:trigger-update="triggerUpdateKey"
/>
<!-- :car-payload-dialog-configs="carPayloadDialogConfigs" -->
</template>
<script>
import initConfig from "./config";
import ListViewWithHead from "@/views/atomViews/ListViewWithHead.vue";
export default {
name: "currentCarLocationView",
components: { ListViewWithHead },
provide() {
return {
urls: this.allUrls,
};
},
data() {
const { tableConfig, headFormConfigs, urls, carPayloadDialogConfigs, dialogConfigs } = initConfig.call(this);
return {
tableConfig,
carPayloadDialogConfigs,
headFormConfigs,
allUrls: urls,
dialogConfigs,
triggerUpdateKey: "",
};
},
created() {},
mounted() {},
methods: {},
activated() {
this.triggerUpdateKey = Math.random().toString();
},
};
</script>
<style scoped></style>