update 0801docs
This commit is contained in:
父節點
87298d1c37
當前提交
ff46d76396
@ -26,13 +26,7 @@
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
|
||||
<DialogJustForm
|
||||
ref="edit-dialog"
|
||||
v-if="!!dialogConfigs"
|
||||
:dialog-visible.sync="dialogVisible"
|
||||
:configs="dialogConfigs"
|
||||
@refreshDataList="getList"
|
||||
@emit-data="handleOperate" />
|
||||
<edit ref="edit" v-if="dialogVisible" :blenderOrderId="blenderOrderId" @destroy="handleDestroy('edit', $event)" />
|
||||
<Overlay v-if="overlayVisible" />
|
||||
</div>
|
||||
</template>
|
||||
@ -41,6 +35,7 @@
|
||||
import BaseListTable from "@/components/BaseListTable.vue";
|
||||
import BaseSearchForm from "@/components/BaseSearchForm.vue";
|
||||
import DialogJustForm from "./DialogJustForm.vue";
|
||||
import edit from "./edit.vue";
|
||||
import Overlay from "@/components/Overlay.vue";
|
||||
import moment from "moment";
|
||||
|
||||
@ -50,6 +45,7 @@ export default {
|
||||
BaseSearchForm,
|
||||
BaseListTable,
|
||||
DialogJustForm,
|
||||
edit,
|
||||
Overlay,
|
||||
},
|
||||
props: {
|
||||
@ -97,6 +93,11 @@ export default {
|
||||
dialogType() {
|
||||
return this.dialogConfigs.menu ? DIALOG_WITH_MENU : DIALOG_JUST_FORM;
|
||||
},
|
||||
blenderOrderId() {
|
||||
const item = this.listQueryExtra.find((item) => item.blenderOrderId);
|
||||
console.log("Find blenderOrderId", item);
|
||||
return item ? item.blenderOrderId : null;
|
||||
},
|
||||
},
|
||||
activated() {
|
||||
this.refreshLayoutKey = this.layoutTable();
|
||||
@ -119,6 +120,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
editVisible: false,
|
||||
dialogVisible: false,
|
||||
topBtnConfig: null,
|
||||
totalPage: 0,
|
||||
@ -142,6 +144,19 @@ export default {
|
||||
this.initDataWhenLoad && this.getList();
|
||||
},
|
||||
methods: {
|
||||
handleDestroy(type, refresh) {
|
||||
switch (type) {
|
||||
case "edit":
|
||||
this.dialogVisible = false;
|
||||
if (refresh) {
|
||||
this.getList();
|
||||
}
|
||||
break;
|
||||
case "detail":
|
||||
this.dialogVisible = false;
|
||||
break;
|
||||
}
|
||||
},
|
||||
/** 获取 列表数据 */
|
||||
getList(queryParams) {
|
||||
this.tableLoading = true;
|
||||
@ -281,7 +296,6 @@ export default {
|
||||
.catch((err) => {});
|
||||
}
|
||||
case "edit": {
|
||||
console.log("[edit] ", data);
|
||||
this.openDialog(data); /** data is ==> id */
|
||||
break;
|
||||
}
|
||||
@ -303,7 +317,6 @@ export default {
|
||||
},
|
||||
|
||||
handleBtnClick({ btnName, payload }) {
|
||||
console.log("[search] form handleBtnClick", btnName, payload);
|
||||
switch (btnName) {
|
||||
case "批量同步":
|
||||
this.overlayVisible = true;
|
||||
@ -354,7 +367,6 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
console.log("查询", this.cachedSearchCondition);
|
||||
this.getList(this.cachedSearchCondition);
|
||||
break;
|
||||
}
|
||||
@ -396,18 +408,10 @@ export default {
|
||||
},
|
||||
|
||||
/** 打开对话框 */
|
||||
openDialog(row_id, detail_mode, tag_info) {
|
||||
openDialog(row_id, detail_mode) {
|
||||
this.dialogVisible = true;
|
||||
let extraParams = null;
|
||||
if (this.attachListQueryExtra && this.listQueryExtra.length) {
|
||||
this.listQueryExtra.forEach((item) => {
|
||||
let found = item[this.attachListQueryExtra];
|
||||
if (found !== null && found !== undefined) extraParams = item;
|
||||
});
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
console.log(`[edit-dialog] extraParams: ${extraParams}`);
|
||||
this.$refs["edit-dialog"].init(/** some args... */ row_id, detail_mode, tag_info, extraParams);
|
||||
this.$refs["edit"].init(row_id, detail_mode);
|
||||
});
|
||||
},
|
||||
},
|
||||
|
225
src/views/modules/pms/blenderBatch/components/edit.vue
Normal file
225
src/views/modules/pms/blenderBatch/components/edit.vue
Normal file
@ -0,0 +1,225 @@
|
||||
<!--
|
||||
filename: edit.vue
|
||||
author: liubin
|
||||
date: 2023-07-19 09:00:04
|
||||
description:
|
||||
-->
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
class="dialog-just-form"
|
||||
:visible="dialogVisible"
|
||||
@close="handleClose"
|
||||
:close-on-click-modal="false"
|
||||
width="'50%'">
|
||||
<!-- title -->
|
||||
<div slot="title" class="dialog-title">
|
||||
<h1 class="">{{ dataForm.id ? "编辑" : "新增" }}</h1>
|
||||
</div>
|
||||
|
||||
<!-- form -->
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="rules" v-loading="loading || detailLoading">
|
||||
<el-row :gutter="20">
|
||||
<el-col>
|
||||
<el-form-item label="批次重量" prop="batchSize">
|
||||
<el-input v-model="dataForm.batchSize" clearable placeholder="请输入批次重量"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-if="dataForm.id">
|
||||
<el-form-item label="牌号" prop="bomName">
|
||||
<el-input v-model="dataForm.bomName" clearable placeholder="请输入牌号"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-if="dataForm.id">
|
||||
<el-form-item label="版本号" prop="techId">
|
||||
<el-select
|
||||
v-model="dataForm.bomVersion"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择版本"
|
||||
@change="handleBomVersionChange">
|
||||
<el-option v-for="(bom, index) in bomList" :key="bom.label" :label="bom.label" :value="bom.value">
|
||||
<div style="display: flex; align-items: center">
|
||||
<!-- <span style="display: inline-block; width: 150px; overflow: hidden; text-overflow: ellipsis"> -->
|
||||
{{ bom.label }}
|
||||
<!-- </span> -->
|
||||
<!-- <span style="display: inline-block; margin-left: 12px; font-size: 0.9em">
|
||||
{{ bom.remark || "无" }}
|
||||
</span> -->
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<!-- footer -->
|
||||
<div slot="footer">
|
||||
<el-button v-if="!dataForm.id" type="primary" @click="handleBtnClick('保存')" :loading="btnLoading">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button v-else type="primary" @click="handleBtnClick('更新')" :loading="btnLoading">更新</el-button>
|
||||
<el-button @click="handleBtnClick('取消')">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "BlenderBatchAndBomEdit",
|
||||
components: {},
|
||||
props: {
|
||||
blenderOrderId: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
detailLoading: false,
|
||||
dataForm: {
|
||||
id: null,
|
||||
batchSize: null,
|
||||
bomName: null,
|
||||
bomVersion: null,
|
||||
},
|
||||
rules: {
|
||||
batchSize: [
|
||||
{ required: true, message: "批次重量不能为空", trigger: "blur" },
|
||||
{ type: "number", message: "批次重量必须为数字", trigger: "blur", transform: (value) => Number(value) },
|
||||
],
|
||||
},
|
||||
bomList: [],
|
||||
bomId: null,
|
||||
btnLoading: false,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
blenderOrderId: {
|
||||
handler(val) {
|
||||
// console.log("blenderOrderId changed", val);
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 初始化
|
||||
init(id) {
|
||||
this.dataForm.id = id;
|
||||
this.getBomList(id);
|
||||
this.getDetail(id);
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
// 获取详情
|
||||
async getDetail(id) {
|
||||
if (!id) return;
|
||||
this.detailLoading = true;
|
||||
const {
|
||||
data: { data: batch },
|
||||
} = await this.$http.get(`/pms/blenderBatch/${id}`);
|
||||
this.dataForm.batchSize = batch.batchSize;
|
||||
this.dataForm.bomName = batch.bomName;
|
||||
this.dataForm.bomVersion = batch.bomVersion;
|
||||
this.bomId = batch.bomId;
|
||||
this.detailLoading = false;
|
||||
},
|
||||
// 获取工艺列表
|
||||
async getBomList(id) {
|
||||
if (!id) return;
|
||||
this.loading = true;
|
||||
const { data: res } = await this.$http.post("/pms/blenderBatch/getBoms", {
|
||||
id,
|
||||
blenderOrderId: this.blenderOrderId,
|
||||
});
|
||||
this.loading = false;
|
||||
if (res.code == 0) {
|
||||
this.bomList = res.data.list.map((item) => {
|
||||
return {
|
||||
label: item.version,
|
||||
value: item.version,
|
||||
id: item.id,
|
||||
brand: item.code,
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 改变version
|
||||
handleBomVersionChange(version) {
|
||||
const bom = this.bomList.find((item) => item.value == version);
|
||||
this.bomId = bom.id;
|
||||
},
|
||||
|
||||
// 按钮事件
|
||||
handleBtnClick(type) {
|
||||
switch (type) {
|
||||
case "保存":
|
||||
case "更新":
|
||||
this.$refs.dataForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.btnLoading = true;
|
||||
this.$http[type == "保存" ? "post" : "put"](
|
||||
"/pms/blenderBatch",
|
||||
type == "保存"
|
||||
? {
|
||||
batchSize: this.dataForm.batchSize,
|
||||
blenderOrderId: this.blenderOrderId,
|
||||
}
|
||||
: {
|
||||
id: this.dataForm.id,
|
||||
blenderOrderId: this.blenderOrderId,
|
||||
batchSize: this.dataForm.batchSize,
|
||||
bomId: this.bomId,
|
||||
}
|
||||
).then((res) => {
|
||||
if (res.data.code == 0) {
|
||||
this.$message.success(type + "成功");
|
||||
this.handleClose(true);
|
||||
} else {
|
||||
this.$message.error(res.data.msg);
|
||||
}
|
||||
this.btnLoading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "取消":
|
||||
this.handleClose();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
handleClose(refresh = false) {
|
||||
this.dialogVisible = false;
|
||||
setTimeout(() => {
|
||||
this.$emit("destroy", refresh);
|
||||
}, 500);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.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>
|
@ -24,8 +24,8 @@ export default function () {
|
||||
// { prop: "remark", label: "备注" },
|
||||
// { prop: 'status', label: '状态', subcomponent: StatusComponent }, // subcomponent
|
||||
{ prop: "description", label: "详情", subcomponent: TableTextComponent, actionName: "view-blender-batch-details" },
|
||||
{ prop: 'bomName', label: '牌号' },
|
||||
{ prop: 'bomVersion', label: '版本号' },
|
||||
{ prop: "bomName", label: "牌号" },
|
||||
{ prop: "bomVersion", label: "版本号" },
|
||||
// { width: 160, prop: "createTime", label: "添加时间", filter: timeFilter },
|
||||
{
|
||||
prop: "operations",
|
||||
@ -93,6 +93,8 @@ export default function () {
|
||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
elparams: { placeholder: "请输入批次重量" },
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: "牌号",
|
||||
@ -100,6 +102,8 @@ export default function () {
|
||||
rules: { required: true, message: "必填项不能为空", trigger: "blur" },
|
||||
elparams: { placeholder: "请输入批次重量" },
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
select: [],
|
||||
label: "版本号",
|
||||
|
@ -4,7 +4,6 @@
|
||||
:head-config="headFormConfigs"
|
||||
:dialog-configs="dialogConfigs"
|
||||
:list-query-extra="[{ blenderOrderId: id }]"
|
||||
attach-list-query-extra="blenderOrderId"
|
||||
:trigger-update="triggerUpdateKey" />
|
||||
</template>
|
||||
|
||||
@ -24,7 +23,7 @@ export default {
|
||||
computed: {
|
||||
// 混料订单id
|
||||
id() {
|
||||
console.log("computed id");
|
||||
console.log("computed id", this.$route.query.id || "");
|
||||
return this.$route.query.id || "";
|
||||
},
|
||||
refreshPage() {
|
||||
|
Loading…
Reference in New Issue
Block a user