update 进行中订单--查看批次--编辑
This commit is contained in:
parent
454d9c6dac
commit
9a01934fac
108
src/views/modules/pms/order/components/BatchDialog--edit.vue
Normal file
108
src/views/modules/pms/order/components/BatchDialog--edit.vue
Normal file
@ -0,0 +1,108 @@
|
||||
<!--
|
||||
filename: BatchDialog--edit.vue
|
||||
author: liubin
|
||||
date: 2023-07-21 15:43:49
|
||||
description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
<!-- 编辑弹窗 -->
|
||||
<el-dialog
|
||||
:title="edit ? '编辑批次' : '新增批次'"
|
||||
width="35%"
|
||||
:visible="visible"
|
||||
@close="visible = false"
|
||||
@closed="$emit('destroy')"
|
||||
:append-to-body="true"
|
||||
:close-on-click-modal="false">
|
||||
<el-form ref="dataForm" :model="dataForm" size="small">
|
||||
<el-form-item prop="batchSize" label="批次重量">
|
||||
<el-input v-model="dataForm.batchSize" clearable placeholder="请输入批次重量"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- footer -->
|
||||
<div slot="footer">
|
||||
<el-button type="primary" @click="handleBatchClick('保存')">保存</el-button>
|
||||
<el-button @click="handleBatchClick('取消')">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "BatchDialog--editDialog",
|
||||
components: {},
|
||||
props: ['blenderOrderId'],
|
||||
data() {
|
||||
return {
|
||||
/** 子弹窗相关 */
|
||||
visible: false,
|
||||
edit: false,
|
||||
dataForm: {
|
||||
// 批次重量
|
||||
id: null,
|
||||
batchSize: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.visible = true;
|
||||
if (id) this.edit = true
|
||||
this.edit && this.getBatch(id);
|
||||
},
|
||||
|
||||
handleBatchClick(type) {
|
||||
if (type == "保存") {
|
||||
this.handleSubmit();
|
||||
} else {
|
||||
this.visible = false;
|
||||
}
|
||||
},
|
||||
/** 提交编辑信息 */
|
||||
async handleSubmit() {
|
||||
const isUpdate = this.edit;
|
||||
try {
|
||||
const {
|
||||
data: { code, data, msg },
|
||||
} = await this.$http[isUpdate ? "put" : "post"]("/pms/blenderBatch", {
|
||||
blenderOrderId: this.blenderOrderId,
|
||||
id: isUpdate ? this.dataForm.id : null,
|
||||
batchSize: this.dataForm.batchSize,
|
||||
});
|
||||
|
||||
if (code == 0) {
|
||||
this.$message.success("操作成功");
|
||||
this.visible = false;
|
||||
this.$emit("refreshDataList");
|
||||
} else {
|
||||
throw new Error(msg);
|
||||
}
|
||||
} catch (err) {
|
||||
this.$message.error("message" in err ? err.message : err);
|
||||
}
|
||||
},
|
||||
/** 获取批次重量 */
|
||||
async getBatch(batchId) {
|
||||
try {
|
||||
const {
|
||||
data: { code, data, msg },
|
||||
} = await this.$http.get("/pms/blenderBatch/" + batchId);
|
||||
if (code == 0) {
|
||||
console.log("[BatchDialog] getBatch", data);
|
||||
this.$set(this.dataForm, "id", data.id);
|
||||
this.$set(this.dataForm, "batchSize", data.batchSize);
|
||||
} else {
|
||||
throw new Error(msg);
|
||||
}
|
||||
} catch (err) {
|
||||
this.$message.error("message" in err ? err.message : err);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
@ -1,21 +1,48 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
class="dialog-just-form"
|
||||
class="batch-dialog"
|
||||
title="查看批次"
|
||||
width="75%"
|
||||
width="85%"
|
||||
:visible="visible"
|
||||
@close="handleClose"
|
||||
@closed="$emit('destroy')"
|
||||
:append-to-body="true"
|
||||
:close-on-click-modal="false">
|
||||
<el-row>
|
||||
<el-col style="text-align: right">
|
||||
<el-button type="text" @click="handleOperate({ type: 'create' })" icon="el-icon-plus">新增</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- list -->
|
||||
<BaseListTable
|
||||
:key="Math.random()"
|
||||
v-loading="tableLoading"
|
||||
:column-config="tableConfigs"
|
||||
:table-data="dataList"
|
||||
:current-page="page"
|
||||
:current-size="limit"
|
||||
@operate-event="handleOperate"
|
||||
:refresh-layout-key="refreshLayoutKey" />
|
||||
|
||||
<el-pagination
|
||||
style="margin-top: 12px; text-align: right"
|
||||
:current-page.sync="page"
|
||||
:current-size="limit"
|
||||
:page-sizes="[5, 10, 20]"
|
||||
:page-size.sync="limit"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
|
||||
<BatchDialogEdit
|
||||
v-if="editDialogVisible"
|
||||
ref="batchDialogEdit"
|
||||
:blender-order-id="blenderOrderId"
|
||||
@refreshDataList="getBatchList"
|
||||
@destroy="editDialogVisible = false" />
|
||||
<!-- footer -->
|
||||
<div slot="footer">
|
||||
<el-button @click="handleBtnClick({ name: 'cancel' })">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@ -24,12 +51,12 @@ import BaseListTable from "@/components/BaseListTable.vue";
|
||||
import TableTextComponent from "@/components/noTemplateComponents/detailComponent";
|
||||
import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent";
|
||||
import { timeFilter } from "@/utils/filters";
|
||||
|
||||
import BatchDialogEdit from "./BatchDialog--edit.vue";
|
||||
// import { pick as __pick } from "@/utils/filters";
|
||||
|
||||
export default {
|
||||
name: "DialogList",
|
||||
components: { BaseListTable },
|
||||
components: { BaseListTable, BatchDialogEdit },
|
||||
props: {
|
||||
configs: {
|
||||
type: Object,
|
||||
@ -42,8 +69,12 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
editDialogVisible: false,
|
||||
blenderOrderId: null, // 用来获取批次列表
|
||||
loading: false,
|
||||
dataForm: {},
|
||||
limit: 20,
|
||||
page: 1,
|
||||
total: 0,
|
||||
refreshLayoutKey: Math.random(),
|
||||
tableLoading: false,
|
||||
dataList: [],
|
||||
@ -95,16 +126,80 @@ export default {
|
||||
],
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
page() {
|
||||
this.getBatchList();
|
||||
},
|
||||
limit() {
|
||||
this.getBatchList();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.visible = true;
|
||||
console.log("[BatchDialog] init", id);
|
||||
this.blenderOrderId = id;
|
||||
this.getBatchList();
|
||||
},
|
||||
|
||||
/** 获取批次列表 */
|
||||
async getBatchList() {
|
||||
this.tableLoading = true;
|
||||
try {
|
||||
const {
|
||||
data: { code, data, msg },
|
||||
} = await this.$http.get("/pms/blenderBatch/pageView", {
|
||||
params: {
|
||||
page: this.page,
|
||||
limit: this.limit,
|
||||
blenderOrderId: this.blenderOrderId,
|
||||
},
|
||||
});
|
||||
console.log("[BatchDialog] getBatchList", data);
|
||||
if (code == 0) {
|
||||
this.dataList = data.list;
|
||||
this.total = data.total;
|
||||
} else {
|
||||
throw new Error(msg);
|
||||
}
|
||||
// this.dataList = data;
|
||||
this.tableLoading = false;
|
||||
} catch (err) {
|
||||
this.$message.error("message" in err ? err.message : err);
|
||||
}
|
||||
},
|
||||
|
||||
handleClose() {
|
||||
this.visible = false;
|
||||
},
|
||||
|
||||
handleOperate() {},
|
||||
handleOperate({ type, data }) {
|
||||
console.log("[BatchDialog] handleOperate", type, data);
|
||||
switch (type) {
|
||||
case "create":
|
||||
this.editDialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.batchDialogEdit.init();
|
||||
});
|
||||
break;
|
||||
case "查看详情":
|
||||
break;
|
||||
case "edit":
|
||||
this.editDialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.batchDialogEdit.init(data);
|
||||
});
|
||||
break;
|
||||
case "delete":
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.batch-dialog >>> .el-dialog__body {
|
||||
padding: 0 20px;
|
||||
}
|
||||
</style>
|
||||
|
@ -89,7 +89,7 @@ export default {
|
||||
// 查看批次
|
||||
this.batchDialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.batchDialog.init();
|
||||
this.$refs.batchDialog.init(id);
|
||||
});
|
||||
break;
|
||||
case "detach":
|
||||
|
@ -26,20 +26,20 @@ export default function () {
|
||||
// { name: 'confirm-order', label: '确认', icon: 'success', showText: true },
|
||||
{ name: "view-ongoing", label: "查看详情", icon: "view", emitFull: true },
|
||||
{ name: "end-order", label: "结束", icon: "finished" },
|
||||
// { name: "move-up", label: "上移", icon: "arrow-up" },
|
||||
// { name: "move-down", label: "下移", icon: "arrow-down" },
|
||||
// { name: "move-to-top", label: "至顶", icon: "upload2" },
|
||||
// { name: "move-to-bottom", label: "至底", icon: "download" },
|
||||
{ name: "move-up", label: "上移", icon: "arrow-up" },
|
||||
{ name: "move-down", label: "下移", icon: "arrow-down" },
|
||||
{ name: "move-to-top", label: "至顶", icon: "upload2" },
|
||||
{ name: "move-to-bottom", label: "至底", icon: "download" },
|
||||
// { name: "destroy-order", label: "废除", icon: "close" },
|
||||
],
|
||||
pending: [
|
||||
{ name: "edit", label: "编辑", icon: "edit-outline" },
|
||||
{ name: "view", label: "查看详情", icon: "view" },
|
||||
{ name: "confirm-order", label: "确认订单", icon: "success" },
|
||||
// { name: "move-up", label: "上移", icon: "arrow-up" },
|
||||
// { name: "move-down", label: "下移", icon: "arrow-down" },
|
||||
// { name: "move-to-top", label: "至顶", icon: "upload2" }, // , showText: true },
|
||||
// { name: "move-to-bottom", label: "至底", icon: "download" }, // , showText: true },
|
||||
{ name: "move-up", label: "上移", icon: "arrow-up" },
|
||||
{ name: "move-down", label: "下移", icon: "arrow-down" },
|
||||
{ name: "move-to-top", label: "至顶", icon: "upload2" }, // , showText: true },
|
||||
{ name: "move-to-bottom", label: "至底", icon: "download" }, // , showText: true },
|
||||
{ name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "" },
|
||||
],
|
||||
finished: [
|
||||
|
Loading…
Reference in New Issue
Block a user