Commit 12dd60d5 authored by 何远江's avatar 何远江

完善打样申请模版

parent cc2d3fab
<template> <template>
<div> <div>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8" v-if="mode != 'info'">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
...@@ -85,7 +85,12 @@ ...@@ -85,7 +85,12 @@
prop="itemRemark" prop="itemRemark"
min-width="120" min-width="120"
/> />
<el-table-column label="操作" align="center" width="120"> <el-table-column
v-if="mode != 'info'"
label="操作"
align="center"
width="120"
>
<template slot-scope="{ row, $index }"> <template slot-scope="{ row, $index }">
<el-button <el-button
type="text" type="text"
...@@ -232,7 +237,7 @@ export default { ...@@ -232,7 +237,7 @@ export default {
rules: {}, rules: {},
/**多选 */ /**多选 */
selection: [], selection: [],
optType: 'add', optType: "add",
/**表单初始化数据 */ /**表单初始化数据 */
form: { form: {
quantity: "", quantity: "",
...@@ -247,7 +252,7 @@ export default { ...@@ -247,7 +252,7 @@ export default {
bomItemRemark: "", bomItemRemark: "",
itemRemark: "", itemRemark: "",
}, },
currentRowIdx: undefined currentRowIdx: undefined,
}; };
}, },
created() {}, created() {},
...@@ -262,13 +267,13 @@ export default { ...@@ -262,13 +267,13 @@ export default {
handleAdd() { handleAdd() {
this.resetForm(); this.resetForm();
this.showFlag = true; this.showFlag = true;
this.optType = 'add' this.optType = "add";
}, },
/**更新行 */ /**更新行 */
updateRow(row, idx) { updateRow(row, idx) {
Object.assign(this.form, row); Object.assign(this.form, row);
this.currentRowIdx = idx this.currentRowIdx = idx;
this.optType = 'edit' this.optType = "edit";
this.showFlag = true; this.showFlag = true;
}, },
/**删除行 */ /**删除行 */
...@@ -291,10 +296,10 @@ export default { ...@@ -291,10 +296,10 @@ export default {
submitForm() { submitForm() {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.optType == 'add') { if (this.optType == "add") {
this.tableData.unshift({ ...this.form }); this.tableData.unshift({ ...this.form });
} else { } else {
this.tableData.splice(this.currentRowIdx, 1, this.form) this.tableData.splice(this.currentRowIdx, 1, this.form);
} }
this.showFlag = false; this.showFlag = false;
} }
...@@ -316,6 +321,11 @@ export default { ...@@ -316,6 +321,11 @@ export default {
itemRemark: "", itemRemark: "",
}; };
}, },
/**重置组件状态 */
resetState() {
this.resetForm()
this.tableData = []
},
/**获取组件数据 */ /**获取组件数据 */
getComData() { getComData() {
return this.tableData; return this.tableData;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
/> />
<el-table-column label="工作站" prop="workstationId" align="center" /> <el-table-column label="工作站" prop="workstationId" align="center" />
<el-table-column label="甘特图显示颜色" prop="colorCode" align="center" /> <el-table-column label="甘特图显示颜色" prop="colorCode" align="center" />
<el-table-column label="操作" align="center" width="150"> <el-table-column v-if="mode != 'info'" label="操作" align="center" width="150">
<template slot-scope="{ row, $index }"> <template slot-scope="{ row, $index }">
<el-button <el-button
type="text" type="text"
...@@ -141,6 +141,7 @@ import ItemBomSelect from "@/components/itemBomSelect/single.vue"; ...@@ -141,6 +141,7 @@ import ItemBomSelect from "@/components/itemBomSelect/single.vue";
import ProcessProd from "./ProcessProd.vue"; import ProcessProd from "./ProcessProd.vue";
export default { export default {
components: { ItemBomSelect, ProcessProd }, components: { ItemBomSelect, ProcessProd },
inject: ['mode'],
props: { props: {
bomList: { bomList: {
type: Array, type: Array,
...@@ -218,6 +219,11 @@ export default { ...@@ -218,6 +219,11 @@ export default {
itemRemark: "", itemRemark: "",
}; };
}, },
/**重置组件状态 */
resetState() {
this.resetForm()
this.tableData = []
}
}, },
}; };
</script> </script>
......
<template> <template>
<div class="form-page"> <div class="form-page" v-loading="loading">
<PageTitle> <PageTitle>
{{ pageTitle }} {{ pageTitle }}
<!-- 申请按钮显示 -->
<template slot="buttons" v-if="mode == 'apply'"> <template slot="buttons" v-if="mode == 'apply'">
<el-button size="mini" @click="resetForm">重置</el-button> <el-button size="mini" @click="resetForm">重置</el-button>
<el-button size="mini" type="primary" @click="saveForm">提交</el-button> <el-button size="mini" type="primary" @click="saveForm">提交</el-button>
</template> </template>
<!-- 修改 按钮显示 -->
<template slot="buttons" v-if="mode == 'edit'">
<el-button size="mini" type="primary" @click="saveForm">提交</el-button>
</template>
</PageTitle> </PageTitle>
<PageWrapper> <PageWrapper>
...@@ -179,8 +185,12 @@ import ProogingProcess from "./components/ProogingProcess.vue"; ...@@ -179,8 +185,12 @@ import ProogingProcess from "./components/ProogingProcess.vue";
import ItemSelect from "@/components/itemSelect/single.vue"; import ItemSelect from "@/components/itemSelect/single.vue";
import RoutesProcessSelect from "@/components/routesProcessSelect/index.vue"; import RoutesProcessSelect from "@/components/routesProcessSelect/index.vue";
import { listRouteprocess } from "@/api/mes/pro/routeprocess"; import { listRouteprocess } from "@/api/mes/pro/routeprocess";
import { Loading } from "element-ui"; import { closeOpenPage } from "@/plugins/tab";
import { addPrototypeRequest } from "@/api/mes/pro/prototypeRequest"; import {
addPrototypeRequest,
getPrototypeRequest,
updatePrototypeRequest,
} from "@/api/mes/pro/prototypeRequest";
export default { export default {
components: { ProogingBom, ProogingProcess, ItemSelect, RoutesProcessSelect }, components: { ProogingBom, ProogingProcess, ItemSelect, RoutesProcessSelect },
...@@ -192,6 +202,7 @@ export default { ...@@ -192,6 +202,7 @@ export default {
}, },
data() { data() {
return { return {
loading: false,
bomList: [], bomList: [],
// 表单参数 // 表单参数
form: { form: {
...@@ -233,11 +244,34 @@ export default { ...@@ -233,11 +244,34 @@ export default {
}, },
}, },
created() { created() {
genCode("PROTOTYPE_REQUEST_CODE").then((response) => { this.getFormInfo();
this.form.prototypeRequestCode = response; this.gCode();
});
}, },
methods: { methods: {
/** 根据 id 获取页面数据 */
getFormInfo() {
if (this.mode != "apply") {
const id = this.$route.query.prototypeRequestId;
this.loading = true;
getPrototypeRequest(id)
.then(({ data }) => {
Object.assign(this.form, data);
this.bomList = data.bomList;
// 设置组件数据
this.$refs["ProogingBomRef"].tableData = data.bomList;
this.$refs["ProogingProcess"].tableData = data.processList;
})
.finally(() => {
this.loading = false;
});
}
},
/** 生成编码 */
gCode() {
genCode("PROTOTYPE_REQUEST_CODE").then((response) => {
this.form.prototypeRequestCode = response;
});
},
/** 点击tab 获取bom的数据,将参数传递给后面的组件 */ /** 点击tab 获取bom的数据,将参数传递给后面的组件 */
tabClick(val) { tabClick(val) {
if (val.index != 0) { if (val.index != 0) {
...@@ -275,16 +309,29 @@ export default { ...@@ -275,16 +309,29 @@ export default {
bomList, bomList,
processList, processList,
}; };
console.log("params", params); this.loading = true;
const loadingInstance = Loading.service({ fullscreen: true }); if (mode == "apply") {
addPrototypeRequest(params) addPrototypeRequest(params)
.then((res) => { .then((res) => {
loadingInstance.close(); this.loading = false;
this.$modal.msgSuccess("提交成功!"); this.$modal.msgSuccess("提交成功!");
})
.catch(() => { // 关闭页签
loadingInstance.close(); closeOpenPage();
}); })
.catch(() => {
this.loading = false;
});
} else {
updatePrototypeRequest(params)
.then(() => {
this.loading = false;
this.$modal.msgSuccess("提交成功!");
})
.catch(() => {
this.loading = false;
});
}
}, },
/**重置表单 */ /**重置表单 */
resetForm() { resetForm() {
...@@ -305,6 +352,9 @@ export default { ...@@ -305,6 +352,9 @@ export default {
testStandard: "", testStandard: "",
remark: "", remark: "",
}; };
this.$refs["ProogingBomRef"].resetState();
this.$refs["ProogingProcessRef"].resetState();
this.gCode();
}, },
}, },
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment