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

打样申请调整

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