生产管理bug修改
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
</div>
|
||||
|
||||
<div class="attr-list">
|
||||
<!-- <el-button v-show="!isdetail" type="success" size="small" style="float: right" @click="addRow()">添加一行</el-button> -->
|
||||
<el-table
|
||||
border
|
||||
:data="tableData"
|
||||
@@ -43,76 +42,32 @@
|
||||
<el-table-column type="index" label="序号" width='50' align="center" />
|
||||
<el-table-column prop="orderName" label="订单名称" />
|
||||
<el-table-column prop="orderCode" label="订单编码" />
|
||||
<el-table-column prop="priority" label="优先级" />
|
||||
<el-table-column prop="planAssignmentQuantity" label="计划分配数量" >
|
||||
<el-table-column prop="priority" label="优先级">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.planAssignmentQuantity" :disabled="scope.row.actualAssignmentQuantity"></el-input>
|
||||
{{scope.row.priority == 1 ? '低' : scope.row.priority == 2 ? '正常' : scope.row.priority == 3 ? '高' : ''}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="planAssignmentQuantity" label="计划分配数量" />
|
||||
<el-table-column prop="actualAssignmentQuantity" label="实际分配数量">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.actualAssignmentQuantity" :disabled="scope.row.actualAssignmentQuantity"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width='50' align="center" fixed='right'>
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="saveData(scope.row)">保存</el-button>
|
||||
<!-- <el-tooltip v-if="!scope.row.isEdit" placement="top" content="编辑">
|
||||
<el-button
|
||||
type="text"
|
||||
:style="{color:'#0B58FF'}"
|
||||
size="mini"
|
||||
@click="edit(scope.row)"
|
||||
>
|
||||
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="edit" />
|
||||
</el-button>
|
||||
</el-tooltip> -->
|
||||
|
||||
<!-- <el-tooltip placement="top" content="删除">
|
||||
<el-button
|
||||
type="text"
|
||||
:style="{color:'#FF5454'}"
|
||||
size="mini"
|
||||
@click="deleteDetail(scope.row)"
|
||||
>
|
||||
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="table_delete" />
|
||||
</el-button>
|
||||
</el-tooltip> -->
|
||||
<el-input-number :disabled='isSaved' v-model="scope.row.actualAssignmentQuantity" style='width: 100%;' controls-position="right" :min="0" :max="dataForm.actualQuantity"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="listQuery.total > 0"
|
||||
:total="listQuery.total"
|
||||
:page.sync="listQuery.pageNo"
|
||||
:limit.sync="listQuery.pageSize"
|
||||
:page-sizes="[5, 10, 15]"
|
||||
@pagination="getList" />
|
||||
</div>
|
||||
|
||||
<div class="drawer-body__footer">
|
||||
<el-button style="" type="primary" @click="goback()">关闭</el-button>
|
||||
<!-- <el-button v-if="isdetail" type="primary" @click="goEdit()">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-else type="primary" @click="dataFormSubmit()">确定</el-button> -->
|
||||
<el-button plain type="primary" @click="goback()">关闭</el-button>
|
||||
<el-button type="primary" @click="saveData()" :disabled='isSaved'>保存</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <attr-add
|
||||
v-if="addOrUpdateVisible"
|
||||
ref="addOrUpdate"
|
||||
:material-id="dataForm.id"
|
||||
@refreshDataList="getList" /> -->
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import basicAdd from '../../core/mixins/basic-add';
|
||||
import { getConOrderList, createConCoreWOr, getCoreWO } from '@/api/base/coreWorkOrder';
|
||||
import { getConOrderList, updateBatch, getCoreWO } from '@/api/base/coreWorkOrder';
|
||||
import SmallTitle from './SmallTitle';
|
||||
// import { parseTime } from '../../core/mixins/code-filter';
|
||||
// import attrAdd from './attr-add';
|
||||
|
||||
export default {
|
||||
mixins: [basicAdd],
|
||||
@@ -123,100 +78,51 @@ export default {
|
||||
urlOptions: {
|
||||
infoURL: getCoreWO,
|
||||
},
|
||||
listQuery: {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 0,
|
||||
},
|
||||
dataForm: {
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
productId: '',
|
||||
remark: undefined,
|
||||
},
|
||||
productList: [],
|
||||
materialAttrList: [],
|
||||
materialList: [],
|
||||
tableData: [],
|
||||
visible: false,
|
||||
isdetail: false,
|
||||
idAttrShow: false
|
||||
isSaved:false
|
||||
};
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
initData() {
|
||||
// this.materialAttrList.splice(0);
|
||||
this.listQuery.total = 0;
|
||||
},
|
||||
edit(row) {
|
||||
row.isEdit = true
|
||||
},
|
||||
saveData(row) {
|
||||
if (row.actualAssignmentQuantity) {
|
||||
if (row.id) {
|
||||
// updateMaterialPBDet({
|
||||
// ...row
|
||||
// }).then((response) => {
|
||||
// this.$modal.msgSuccess('修改成功');
|
||||
// // this.visible = false;
|
||||
// this.getList();
|
||||
// });
|
||||
// return;
|
||||
}
|
||||
// 添加的提交
|
||||
createConCoreWOr({
|
||||
...row,
|
||||
workOrderId: this.dataForm.id
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('分配成功');
|
||||
// this.visible = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
this.$message.warning('请填写实际分配数量');
|
||||
saveData() {
|
||||
console.log(this.tableData)
|
||||
let sunNum = 0
|
||||
this.tableData.forEach(row => {
|
||||
sunNum+=(row.actualAssignmentQuantity || 0)
|
||||
})
|
||||
if (sunNum > this.dataForm.actualQuantity) {
|
||||
this.$message.warning('各订单实际分配数量之和不能大于实际生产数量');
|
||||
return
|
||||
}
|
||||
updateBatch(this.tableData).then((response) => {
|
||||
this.$modal.msgSuccess('分配成功');
|
||||
this.isSaved = true;
|
||||
});
|
||||
},
|
||||
getList() {
|
||||
// 获取产品Bom详细列表
|
||||
getConOrderList({
|
||||
...this.listQuery,
|
||||
workOrderId: this.dataForm.id
|
||||
}).then((response) => {
|
||||
this.tableData = response.data.map(item => {
|
||||
item.isEdit = false
|
||||
item.actualAssignmentQuantity = item.actualAssignmentQuantity || 0
|
||||
item.workOrderId = this.dataForm.id
|
||||
return item
|
||||
});
|
||||
this.listQuery.total = response.data.total;
|
||||
});
|
||||
},
|
||||
// 构造一行
|
||||
// addRow() {
|
||||
// const row = {
|
||||
// bomId: this.dataForm.id,
|
||||
// materialId: '',
|
||||
// num: 0,
|
||||
// materialCode: undefined,
|
||||
// unit: undefined,
|
||||
// remark: '',
|
||||
// isEdit: true
|
||||
// }
|
||||
// this.tableData.push(row)
|
||||
// },
|
||||
init(id, isdetail) {
|
||||
this.initData();
|
||||
this.isdetail = isdetail || false;
|
||||
init(id) {
|
||||
this.dataForm.id = id || undefined;
|
||||
this.visible = true;
|
||||
// if (id) {
|
||||
// this.idAttrShow = true
|
||||
// } else {
|
||||
// this.idAttrShow = false
|
||||
// }
|
||||
|
||||
this.isSaved = false;
|
||||
this.$nextTick(() => {
|
||||
// this.$refs['dataForm'].resetFields();
|
||||
|
||||
if (this.dataForm.id) {
|
||||
// 获取工单详情
|
||||
this.urlOptions.infoURL(id).then(response => {
|
||||
@@ -230,17 +136,6 @@ export default {
|
||||
goback() {
|
||||
this.$emit('refreshDataList');
|
||||
this.visible = false;
|
||||
// this.initData();
|
||||
},
|
||||
goEdit() {
|
||||
this.isdetail = false;
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user