Commit 0685ca34 authored by 何远江's avatar 何远江

打样申请调整

parent 52281b15
<template> <template>
<div class="process-prod"> <div class="process-prod">
<!-- 设置物料弹窗 -->
<el-dialog
:visible.sync="showProcessProd"
width="800px"
:before-close="beforeClose"
append-to-body
title="设置物料"
>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
...@@ -18,28 +26,36 @@ ...@@ -18,28 +26,36 @@
<el-table-column label="数量" prop="quantity" align="center" /> <el-table-column label="数量" prop="quantity" align="center" />
<el-table-column label="备注" prop="remark" align="center" /> <el-table-column label="备注" prop="remark" align="center" />
<el-table-column label="操作" align="center" width="150"> <el-table-column label="操作" align="center" width="150">
<template slot-scope="{ row, index }"> <template slot-scope="{ row, $index }">
<el-button <el-button
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
size="small" size="small"
@click="updateRow(row)" @click="updateRow(row, $index)"
>修改</el-button >修改</el-button
> >
<el-button <el-button
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
size="small" size="small"
@click="$emit('deleteRow', row)" @click="deleteRow($index)"
>删除</el-button >删除</el-button
> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div slot="footer">
<el-button type="primary" size="small" @click="cancleConnect"
>关闭</el-button
>
</div>
</el-dialog>
<!-- 选择Bom物料 -->
<el-dialog <el-dialog
:visible.sync="showFlag" :visible.sync="showFlag"
title="skkskks" title="选择Bom物料"
width="800px" width="800px"
append-to-body append-to-body
> >
...@@ -68,8 +84,13 @@ ...@@ -68,8 +84,13 @@
</div> </div>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="editConnectVisible" title="编辑物料关联信息"> <!-- 编辑物料关联信息 -->
<el-form :model="form" inline size="small" label-width="90px"> <el-dialog
:visible.sync="editConnectVisible"
width="400px"
title="编辑物料关联信息"
>
<el-form :model="form" inline size="small" label-width="80px">
<el-form-item label="物料名称"> <el-form-item label="物料名称">
<el-input disabled v-model="form.itemName"></el-input> <el-input disabled v-model="form.itemName"></el-input>
</el-form-item> </el-form-item>
...@@ -84,7 +105,7 @@ ...@@ -84,7 +105,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer"> <div slot="footer">
<el-button type="primary" size="small" @click="confirmEditConnect" <el-button type="primary" size="small" @click="submitEditConnect"
>确认</el-button >确认</el-button
> >
<el-button size="small" @click="editConnectVisible = false" <el-button size="small" @click="editConnectVisible = false"
...@@ -102,13 +123,9 @@ export default { ...@@ -102,13 +123,9 @@ export default {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
processId: { process: {
type: Number | undefined, type: Object,
default: undefined, default: () => ({}),
},
bomConnectProcessList: {
type: Array,
default: () => [],
}, },
}, },
data() { data() {
...@@ -119,38 +136,28 @@ export default { ...@@ -119,38 +136,28 @@ export default {
quantity: "", quantity: "",
remark: "", remark: "",
}, },
currentRow: null, currentRowIdx: undefined,
tableData: [], tableData: [],
selectedItemId: undefined, selectedItemId: undefined,
selectedRows: null, selectedRows: null,
showFlag: false, showFlag: false,
showProcessProd: false,
editConnectVisible: false, editConnectVisible: false,
}; };
}, },
computed: {
title () {
return '设置' + this.process.itemName + '物料'
}
},
watch: { watch: {
bomConnectProcessList: { process: {
handler(val) { handler(val) {
if (val.length) { this.tableData = val.processItemList;
this.tableData = this.bomConnectProcessList.filter(
(v) => v.processId == this.processId
);
} else {
this.tableData = [];
}
}, },
deep: true, deep: true,
}, },
}, },
// computed: {
// tableData() {
// if (this.bomConnectProcessList.length) {
// return this.bomConnectProcessList.filter(
// (v) => v.processId == this.processId
// );
// }
// return [];
// },
// },
methods: { methods: {
handleRowChange(row) { handleRowChange(row) {
if (row) { if (row) {
...@@ -160,12 +167,7 @@ export default { ...@@ -160,12 +167,7 @@ export default {
handleRowDbClick(row) { handleRowDbClick(row) {
if (row) { if (row) {
this.selectedRows = row; this.selectedRows = row;
// 添加数据,并且添加时间戳作为保存前 删除的唯一凭证 this.tableData.unshift(this.selectedRows);
this.$emit("onSetConnect", {
...this.selectedRows,
processId: this.processId,
createTimes: new Date().getTime(),
});
this.showFlag = false; this.showFlag = false;
} }
}, },
...@@ -178,19 +180,32 @@ export default { ...@@ -178,19 +180,32 @@ export default {
if (this.selectedItemId == null || this.selectedItemId == 0) { if (this.selectedItemId == null || this.selectedItemId == 0) {
return; return;
} }
// 添加数据,并且添加时间戳作为保存前 删除的唯一凭证 this.tableData.unshift({
this.$emit("onSetConnect", {
...this.selectedRows, ...this.selectedRows,
processId: this.processId, processId: this.process.processId,
createTime: new Date().getTime(),
}); });
this.showFlag = false; this.showFlag = false;
}, },
updateRow(row) { /**编辑 */
updateRow(row, idx) {
this.resetForm(); this.resetForm();
Object.assign(this.form, row); Object.assign(this.form, row);
this.currentRowIdx = idx;
this.editConnectVisible = true; this.editConnectVisible = true;
}, },
deleteRow(index) {
this.tableData.splice(index, 1);
},
cancleConnect() {
this.$emit("updateItem", this.tableData);
this.showProcessProd = false;
},
beforeClose(done) {
// 更新父组件的processItemList
this.$emit("updateItem", this.tableData);
done();
},
/**重置表单 */
resetForm() { resetForm() {
this.form = { this.form = {
itemName: "", itemName: "",
...@@ -199,8 +214,9 @@ export default { ...@@ -199,8 +214,9 @@ export default {
remark: "", remark: "",
}; };
}, },
confirmEditConnect() { /** 提交编辑关联信息 */
this.$emit('updateRow', this.form) submitEditConnect() {
this.tableData.splice(this.currentRowIdx, 1, this.form);
this.editConnectVisible = false; this.editConnectVisible = false;
}, },
}, },
......
...@@ -21,22 +21,6 @@ ...@@ -21,22 +21,6 @@
>删除</el-button >删除</el-button
> >
</el-col> </el-col>
<!-- <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-delete" size="mini"
>产品分类导入</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-delete"
size="mini"
@click="$refs['ItemBomSelectRef'].showFlag = true"
>产品导入</el-button
>
<ItemBomSelect ref="ItemBomSelectRef" @onSelected="onItemBomSelect" />
</el-col> -->
</el-row> </el-row>
<el-table :data="tableData" @selection-change="handleSelectionChange"> <el-table :data="tableData" @selection-change="handleSelectionChange">
...@@ -102,19 +86,19 @@ ...@@ -102,19 +86,19 @@
min-width="120" min-width="120"
/> />
<el-table-column label="操作" align="center" width="120"> <el-table-column label="操作" align="center" width="120">
<template slot-scope="{ row, index }"> <template slot-scope="{ row, $index }">
<el-button <el-button
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
size="small" size="small"
@click="updateRow(row)" @click="updateRow(row, $index)"
>修改</el-button >修改</el-button
> >
<el-button <el-button
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
size="small" size="small"
@click="deleteRow(index)" @click="deleteRow($index)"
>删除</el-button >删除</el-button
> >
</template> </template>
...@@ -248,6 +232,7 @@ export default { ...@@ -248,6 +232,7 @@ export default {
rules: {}, rules: {},
/**多选 */ /**多选 */
selection: [], selection: [],
optType: 'add',
/**表单初始化数据 */ /**表单初始化数据 */
form: { form: {
quantity: "", quantity: "",
...@@ -262,6 +247,7 @@ export default { ...@@ -262,6 +247,7 @@ export default {
bomItemRemark: "", bomItemRemark: "",
itemRemark: "", itemRemark: "",
}, },
currentRowIdx: undefined
}; };
}, },
created() {}, created() {},
...@@ -276,10 +262,13 @@ export default { ...@@ -276,10 +262,13 @@ export default {
handleAdd() { handleAdd() {
this.resetForm(); this.resetForm();
this.showFlag = true; this.showFlag = true;
this.optType = 'add'
}, },
/**更新行 */ /**更新行 */
updateRow(row) { updateRow(row, idx) {
Object.assign(this.form, row); Object.assign(this.form, row);
this.currentRowIdx = idx
this.optType = 'edit'
this.showFlag = true; this.showFlag = true;
}, },
/**删除行 */ /**删除行 */
...@@ -302,7 +291,11 @@ export default { ...@@ -302,7 +291,11 @@ export default {
submitForm() { submitForm() {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.optType == 'add') {
this.tableData.unshift({ ...this.form }); this.tableData.unshift({ ...this.form });
} else {
this.tableData.splice(this.currentRowIdx, 1, this.form)
}
this.showFlag = false; this.showFlag = false;
} }
}); });
......
<template> <template>
<div> <div>
<el-table :data="tableData" @selection-change="handleSelectionChange"> <el-table :data="tableData">
<el-table-column type="expand" width="55" align="center">
<template slot-scope="{ row, index }">
<ProcessProd
:key="index"
:processId="row.processId"
:bomList="bomList"
:bomConnectProcessList="bomConnectProcessList"
@onSetConnect="onSetConnect"
@deleteRow='deleteConnect'
@updateRow="updateConnect"
/>
</template>
</el-table-column>
<el-table-column label="工序名称" prop="processName" align="center" /> <el-table-column label="工序名称" prop="processName" align="center" />
<el-table-column label="工序编码" prop="processCode" align="center" /> <el-table-column label="工序编码" prop="processCode" align="center" />
<el-table-column <el-table-column
...@@ -24,18 +11,33 @@ ...@@ -24,18 +11,33 @@
<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 label="操作" align="center" width="150">
<template slot-scope="{ row }"> <template slot-scope="{ row, $index }">
<el-button
type="text"
icon="el-icon-edit"
size="small"
@click="openSetProd(row, $index)"
>
设置物料
</el-button>
<el-button <el-button
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
size="small" size="small"
@click="updateRow(row)" @click="updateRow(row, $index)"
>修改</el-button >修改</el-button
> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<ProcessProd
:process="currentRow"
:bomList="bomList"
ref="ProcessProdRef"
@updateItem="updateItem"
/>
<el-dialog <el-dialog
v-dialogDrag v-dialogDrag
:visible.sync="showFlag" :visible.sync="showFlag"
...@@ -153,9 +155,6 @@ export default { ...@@ -153,9 +155,6 @@ export default {
tableData: [], tableData: [],
/**表单规则 */ /**表单规则 */
rules: {}, rules: {},
/**多选 */
selection: [],
bomConnectProcessList: [],
/**表单初始化数据 */ /**表单初始化数据 */
form: { form: {
quantity: "", quantity: "",
...@@ -168,75 +167,42 @@ export default { ...@@ -168,75 +167,42 @@ export default {
bomItemRemark: "", bomItemRemark: "",
itemRemark: "", itemRemark: "",
}, },
currentRow: {},
currentRowIndex: undefined,
}; };
}, },
methods: { methods: {
setList(rows) { setList(rows) {
this.tableData = rows; this.tableData = rows.map(item => {
// 重置关联表 item.processItemList = []
this.bomConnectProcessList = [] return item
}, });
/**多选 */
handleSelectionChange(val) {
this.selection = val;
}, },
validateConnect(row) { /** 更新工序的物料信息 */
updateItem(items) {
this.tableData[this.currentRowIndex].processItemList = items;
}, },
onSetConnect(row) { openSetProd(row, idx) {
// 验证用料比例是否超过 this.currentRow = row;
this.currentRowIndex = idx;
// 验证通过 添加 this.$refs["ProcessProdRef"].showProcessProd = true;
this.bomConnectProcessList.push(row)
},
/**添加操作 */
handleAdd() {
this.resetForm();
this.showFlag = true;
}, },
/**更新行 */ /**更新行 */
updateRow(row) { updateRow(row, idx) {
Object.assign(this.form, row); Object.assign(this.form, row);
this.currentRowIndex = idx;
this.showFlag = true; this.showFlag = true;
}, },
updateConnect(row) {
const idx = this.bomConnectProcessList.findIndex(v => {
if (v.createTimes) {
return v.createTimes == row.createTimes
} else {
return v.prototypeRequestProcessItemId == row.prototypeRequestProcessItemId
}
})
this.bomConnectProcessList.splice(idx, 1, row)
},
deleteConnect(row) {
const idx = this.bomConnectProcessList.findIndex(v => {
if (v.createTimes) {
return v.createTimes == row.createTimes
} else {
return v.prototypeRequestProcessItemId == row.prototypeRequestProcessItemId
}
})
this.bomConnectProcessList.splice(idx, 1)
},
/**删除行 */
deleteRow(index) {
this.tableData.splice(index, 1);
},
/**表单提交 */ /**表单提交 */
submitForm() { submitForm() {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
this.tableData.unshift({ ...this.form });
this.showFlag = false; this.showFlag = false;
} }
}); });
}, },
getComData() { getComData() {
return { return this.tableData;
processList: this.tableData,
processItemList: this.bomConnectProcessList
}
}, },
/**重置表单 */ /**重置表单 */
resetForm() { resetForm() {
......
...@@ -178,8 +178,8 @@ import ProogingProcess from "./components/ProogingProcess.vue"; ...@@ -178,8 +178,8 @@ 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 { Loading } from "element-ui";
import { addPrototypeRequest } from '@/api/mes/pro/prototypeRequest' import { addPrototypeRequest } from "@/api/mes/pro/prototypeRequest";
export default { export default {
components: { ProogingBom, ProogingProcess, ItemSelect, RoutesProcessSelect }, components: { ProogingBom, ProogingProcess, ItemSelect, RoutesProcessSelect },
...@@ -264,17 +264,21 @@ export default { ...@@ -264,17 +264,21 @@ export default {
}, },
/**提交 */ /**提交 */
saveForm() { saveForm() {
const bomData = this.$refs.ProogingBomRef.getComData(); const bomList = this.$refs.ProogingBomRef.getComData();
const {processList, processItemList} = this.$refs.ProogingProcessRef.getComData(); const processList = this.$refs.ProogingProcessRef.getComData();
const params = { const params = {
...this.form, ...this.form,
bomList: bomData, bomList,
processList, processList,
processItemList
}; };
const loadingInstance = Loading.service({ fullscreen: true }) console.log('params', params)
addPrototypeRequest(params).then(res => { return
loadingInstance.close() const loadingInstance = Loading.service({ fullscreen: true });
addPrototypeRequest(params).then((res) => {
loadingInstance.close();
this.$modal.msgSuccess("提交成功!");
}).catch(() => {
loadingInstance.close();
}) })
}, },
/**重置表单 */ /**重置表单 */
......
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