<template>
|
<!-- 仓库信息 -->
|
<div id="input_finished_product"
|
class="global-content">
|
<!-- 筛选 -->
|
<inbound-inuqer ref="inref"
|
byfilter="计划单号"
|
:filterList="filterList"
|
:add="false"
|
:tolead="true"
|
:derive="true"
|
:imexcel="false"
|
:datetimeshow="true"
|
@refresh="refresh"
|
@addmodal="addmodal"
|
@inquer="inquer"
|
@derive="derive"
|
@importfile="importfile" />
|
<!-- <input type="file" accept=".xls,.xlsx" @change="readExcel($event)" /> -->
|
|
<!-- table -->
|
<div class="table">
|
<table-container :tableHead="tableHead"
|
:tableData="tableData"
|
:editShow="false"
|
:viewShow="true"
|
:weldingAuditShow="true"
|
:unlineCommitShow="true"
|
:relevanceShow="true"
|
:pageSize="pageSize"
|
:totle="totle"
|
:cellStyle="cellStyle"
|
@edit="edit"
|
@del="del"
|
@view="view"
|
@relevance="relevance"
|
@weldingAudit="weldingAudit"
|
@unlineCommit="unlineCommit"
|
@SizeChange="SizeChange"
|
@CurrentChange="CurrentChange" />
|
</div>
|
|
<transition name="modal">
|
<modal v-if="addmodalShow"
|
:modabg="true"
|
@cancel="addmodalShow = false">
|
<p slot="title">冲压生产计划单-{{ title }}</p>
|
<div class="height"
|
slot="centent">
|
<quotaion-edit @partclick="partShow = true"
|
:isReadOnly="partShow_readOnly"
|
@cancel="
|
addmodalShow = false;
|
refresh();
|
"
|
:chooselist="chooselist"
|
:rowitem="rowitem"
|
@addsubmit="addsubmit" />
|
</div>
|
</modal>
|
</transition>
|
<transition name="modal">
|
<modal v-if="relevanceModalShow"
|
:modabg="true"
|
@cancel="relevanceModalShow = false">
|
<p slot="title">关联完工入库零件-{{ relevanceModalShow_title }}</p>
|
<div class="height"
|
slot="centent">
|
<quotaion_relevanceEdit ref="quotaion_relevanceEditMethod"
|
@partclick="clickAddForRelevanceFinishedPart"
|
@cancel="
|
relevanceModalShow = false;
|
refresh();
|
"
|
:tableList="relevanceFinishedPartList"
|
:chooseClick="chooseClick"
|
:rowitem="rowitem"
|
@addsubmit="addsubmit" />
|
</div>
|
</modal>
|
</transition>
|
<transition name="modal">
|
<modal v-if="partShow"
|
:modabg="true"
|
@cancel="partShow = false">
|
<p slot="title">零件选择</p>
|
<div class="height"
|
slot="centent">
|
<choose ref="partChoose"
|
:wipelist="wipelist"
|
@chooseClick="chooseClick"
|
@cancel="partShow = false"
|
@addchoose="addchooseShow = true" />
|
</div>
|
</modal>
|
</transition>
|
<transition name="modal">
|
<modal v-if="aduitUserShow"
|
:modabg="true"
|
@cancel="aduitUserShow = false">
|
<p slot="title">选择审核人</p>
|
<div class="height"
|
slot="centent">
|
<chooseUser ref="userChoose"
|
:wipelist="wipelist"
|
@submitForm="do_weldingAudit"
|
@cancel="aduitUserShow = false"
|
@addchoose="addchooseShow = true" />
|
</div>
|
</modal>
|
</transition>
|
<transition name="modal">
|
<modal v-if="relevanceFinishedPartShow"
|
:modabg="true"
|
@cancel="relevanceFinishedPartShow = false">
|
<p slot="title">选择关联完工入库零件</p>
|
<div class="height"
|
slot="centent">
|
<chooseRelevanceFinishedPart ref="relevanceFinishedPartMethod"
|
:wipelist="wipelist"
|
:pItemName="pItemName"
|
:pItemDes="pItemDes"
|
@submitForm="submitRelevanceFinishedPart"
|
@cancel="relevanceFinishedPartShow = false"
|
@addchoose="addchooseShow = true" />
|
</div>
|
</modal>
|
</transition>
|
<el-dialog title="线下交付"
|
width="30%"
|
:visible.sync="unlineCommitModalShow">
|
<el-form :model="unlineCommitForm"
|
label-width="100px">
|
<el-form-item label="生产计划单号">
|
<el-input disabled
|
v-model="unlineCommitForm.inOrderCode"></el-input>
|
</el-form-item>
|
<el-form-item label="线下交付数量">
|
<el-input-number v-model="unlineCommitForm.qty"
|
:min="0"></el-input-number>
|
</el-form-item>
|
</el-form>
|
<div slot="footer"
|
class="dialog-footer">
|
<el-button @click="unlineCommitModalShow = false">取 消</el-button>
|
<el-button type="primary"
|
@click="onSubmitUnlineCommitForm">确 定</el-button>
|
</div>
|
</el-dialog>
|
|
</div>
|
</template>
|
|
<script>
|
import { TableContainer, Modal, Choose, AddChoose, chooseRelevanceFinishedPart, chooseUser } from '@/components/index';//这里引用的是 vue文件的名字
|
import inboundInuqer from '../../components/inboundinuqer';
|
import quotaionEdit from '../../components/quotaionEdit';
|
import quotaion_relevanceEdit from '../../components/quotaion_relevanceEdit';
|
import { getimestampDate, getymdhms } from '@/utils/date';
|
import { exportTableList } from '@/utils/excel';
|
//const { quotation } = require('@/components/tableContainer/tableHead');
|
import { getCache, setCache, removeToken } from '@/utils/sessionStorage';
|
import { InOrderSearch, InOrderDelete, ImportInOrder, InOrderSend, UpdateUnlineNum } from '@/api/quotation';
|
import XLSX from 'xlsx';
|
import { Collapse } from 'element-ui';
|
//列表显示列内容
|
const my_tableHead = [{
|
columnDescription: '生产计划单号',
|
columnName: 'inOrderCode',
|
sortable: true,
|
wipe: true,
|
width: 200
|
},
|
{
|
columnDescription: '生产类型',
|
columnName: 'orderType',
|
sortable: true,
|
wipe: true,
|
width: 150
|
},
|
|
{
|
columnDescription: '订单状态',
|
columnName: 'orderStatus',
|
sortable: true,
|
wipe: true,
|
width: 120
|
},
|
{
|
columnDescription: '零件编号',
|
columnName: 'itemName',
|
sortable: true,
|
wipe: true,
|
width: 150
|
},
|
{
|
columnDescription: '零件名称',
|
columnName: 'itemDes',
|
sortable: true,
|
wipe: true,
|
width: 200
|
},
|
{
|
columnDescription: '计划生产数量',
|
columnName: 'totalNum',
|
sortable: true,
|
wipe: true,
|
width: 100
|
},
|
{
|
columnDescription: '总完工数',
|
columnName: 'allFinishedNum',
|
sortable: true,
|
wipe: true,
|
width: 120
|
},
|
{
|
columnDescription: '入库数量',
|
columnName: 'DoneNum',
|
sortable: true,
|
wipe: true,
|
width: 100
|
},
|
{
|
columnDescription: '线下交付数量',
|
columnName: 'unLineNum',
|
sortable: true,
|
wipe: true,
|
width: 100
|
},
|
{
|
columnDescription: '提交人',
|
columnName: 'senderName',
|
sortable: true,
|
wipe: true,
|
width: 100
|
},
|
{
|
columnDescription: '提交时间',
|
columnName: 'SendTime',
|
sortable: true,
|
wipe: true,
|
width: 120
|
},
|
{
|
columnDescription: '审核人',
|
columnName: 'checkerName',
|
sortable: true,
|
wipe: true,
|
width: 100
|
},
|
{
|
columnDescription: '审核结果',
|
columnName: 'CheckResult',
|
sortable: true,
|
wipe: true,
|
width: 100
|
},
|
{
|
columnDescription: '审核时间',
|
columnName: 'CheckTime',
|
sortable: true,
|
wipe: true,
|
width: 120
|
},
|
{
|
columnDescription: '审核说明',
|
columnName: 'CheckRemark',
|
sortable: true,
|
wipe: true,
|
width: 120
|
},
|
{
|
columnDescription: '备注',
|
columnName: 'deviceName5',
|
sortable: true,
|
wipe: true
|
},
|
{
|
columnDescription: '创建人',
|
columnName: 'createName',
|
sortable: true,
|
wipe: true,
|
width: 100
|
},
|
{
|
columnDescription: '创建时间',
|
columnName: 'createTime',
|
sortable: true,
|
wipe: true,
|
width: 150
|
}, {
|
columnDescription: '修改人',
|
columnName: 'updateName',
|
sortable: true,
|
wipe: true,
|
width: 100
|
},
|
{
|
columnDescription: '修改时间',
|
columnName: 'updateTime',
|
sortable: true,
|
wipe: true,
|
width: 150
|
}
|
];
|
export default {
|
name: 'input_finished_product',
|
data () {
|
return {
|
curSelectInOrderCode: '',//当前选择的计划单号
|
aduitUserShow: false,
|
partShow_readOnly: false,
|
unlineCommitForm: {
|
inOrderCode: '',
|
qty: 0
|
},
|
unlineCommitModalShow: false,
|
pItemName: '',
|
pItemDes: '',
|
relevanceModalShow_title: '',
|
title: '',
|
tableData: [],
|
modalShow: false,
|
addmodalShow: false,
|
relevanceModalShow: false,
|
relevanceFinishedPartShow: false,
|
partShow: false,
|
addchooseShow: false,
|
|
chooselist: [],
|
relevanceFinishedPartList: [],
|
rowitem: {},
|
totle: 0,
|
page: 1,
|
pageSize: 20,
|
wipelist: ['inOrderCode'],
|
inuqerobg: {},
|
filterList: [
|
{
|
value: '计划单号',
|
label: '计划单号'
|
}
|
]
|
};
|
},
|
components: { TableContainer, inboundInuqer, Modal, quotaionEdit, Choose, AddChoose, quotaion_relevanceEdit, chooseRelevanceFinishedPart, chooseUser },
|
computed: {
|
tableHead () {
|
return my_tableHead;
|
}
|
},
|
created () { },
|
mounted () {
|
this.InOrderSearch();
|
console.log(getymdhms());
|
},
|
methods: {
|
cellStyle ({ row, rowIndex }) {
|
if (row.OrderStatusId === 3) {//3是 驳回
|
return 'background: #aa7798;color:white'
|
}
|
return ''
|
},
|
clickAddForRelevanceFinishedPart () {
|
//获取上一个窗体的内容
|
let itemName = this.$refs.quotaion_relevanceEditMethod.iqnuer.itemName;
|
let itemDes = this.$refs.quotaion_relevanceEditMethod.iqnuer.itemDes;
|
this.pItemName = itemName;
|
this.pItemDes = itemDes;
|
this.relevanceFinishedPartShow = true
|
// setTimeout(() => {
|
// //console.log('relevanceFinishedPartMethod:' + this.$refs.relevanceFinishedPartMethod)
|
|
// this.$refs.relevanceFinishedPartMethod.iqnuer.itemName = itemName;
|
// this.$refs.relevanceFinishedPartMethod.iqnuer.itemDes = itemDes;
|
// }, 0)
|
},
|
//刷新
|
refresh () {
|
this.inuqerobg = {};
|
this.$refs.inref.inrefclear();
|
this.InOrderSearch();
|
},
|
//查询
|
inquer (e) {
|
this.page = 1;
|
this.inuqerobg = e;
|
this.InOrderSearch();
|
},
|
//导出
|
derive () {
|
let tHeader = [];
|
let filterVal = [];
|
this.tableHead.forEach(item => {
|
tHeader.push(item.columnDescription);
|
filterVal.push(item.columnName);
|
});
|
this.$Loading(true);
|
const { 计划单号: inOrderCode } = this.inuqerobg;
|
const OrderStatusId = this.inuqerobg.OrderStatusId;
|
const orderType = this.inuqerobg.orderType;
|
InOrderSearch('1&onePageNum=99999999', {
|
inOrderCode, orderType, OrderStatusId, InOrderPageType: '完工品输入页面', createTimeStart: this.inuqerobg.timepick ? this.inuqerobg.timepick[0] : '',
|
createTimeEnd: this.inuqerobg.timepick ? this.inuqerobg.timepick[1] : ''
|
}).then(res => {
|
if (res.code == 0) {
|
let data = res.data;
|
data.forEach(item => {
|
item.doTime = item.doTime ? getimestampDate(item.doTime) : '';
|
item.updateTime = item.updateTime ? getimestampDate(item.updateTime) : '';
|
});
|
exportTableList(tHeader, filterVal, data, '冲压计划' + getymdhms());
|
}
|
this.$Loading(false);
|
});
|
},
|
//导入
|
importfile (e) {
|
this.readExcel(e);
|
},
|
|
//获取生产计划列表
|
InOrderSearch () {
|
this.$Loading(true);
|
const { 计划单号: inOrderCode } = this.inuqerobg;
|
const OrderStatusId = this.inuqerobg.OrderStatusId;
|
const orderType = this.inuqerobg.orderType;
|
InOrderSearch(this.page + '&onePageNum=' + this.pageSize, {
|
inOrderCode, orderType, OrderStatusId, InOrderPageType: '完工品输入页面',
|
createTimeStart: this.inuqerobg.timepick ? this.inuqerobg.timepick[0] : '',
|
createTimeEnd: this.inuqerobg.timepick ? this.inuqerobg.timepick[1] : ''
|
}).then(res => {
|
if (res.code == 0) {
|
this.tableData = res.data.filter(item => (item.doTime = getimestampDate(item.doTime)));
|
this.totle = res.num;
|
}
|
this.$Loading();
|
});
|
},
|
//分页
|
CurrentChange (e) {
|
console.log(e);
|
this.page = e;
|
this.InOrderSearch();
|
},
|
//页数
|
SizeChange (e) {
|
this.pageSize = e;
|
this.InOrderSearch();
|
},
|
//编辑
|
edit (row) {
|
this.title = '编辑';
|
this.partShow_readOnly = false;
|
this.addmodalShow = true;
|
this.rowitem = { ...row };
|
},
|
//查看
|
view (row) {
|
this.title = '查看';
|
this.partShow_readOnly = true;
|
this.addmodalShow = true;
|
this.rowitem = { ...row };
|
},
|
//关联
|
relevance (row) {
|
this.relevanceModalShow_title = '关联';
|
this.relevanceModalShow = true;
|
this.rowitem = { ...row };
|
},
|
//提出 焊装审核人
|
weldingAudit (row) {
|
const { inOrderCode } = { ...row };
|
this.curSelectInOrderCode = inOrderCode;
|
this.aduitUserShow = true;
|
},
|
//发送焊装审核
|
do_weldingAudit (e) {
|
let userId = 0;
|
if (e.length > 0) {
|
var checkList = [...e];
|
userId = checkList[0].id;
|
} else {
|
this.$message({
|
type: 'info',
|
message: '请勾选'
|
});
|
}
|
//console.log(userId + ' ' + this.curSelectInOrderCode)
|
this.$confirm('确定将计划单号"' + this.curSelectInOrderCode + '"提交焊装审核吗?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
InOrderSend({
|
InOrderCode: this.curSelectInOrderCode,
|
SendUserId: getCache('userInfo').id,//提交审核人
|
AuditUserId: userId,//审核人
|
Remark: ''
|
}).then(res => {
|
if (res.code == 0) {
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
});
|
this.aduitUserShow = false;
|
this.InOrderSearch();
|
} else {
|
this.$message({
|
type: 'warning',
|
message: '提交失败:' + res.msg
|
});
|
}
|
});
|
})
|
.catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消'
|
});
|
});
|
},
|
//弹出 线下交付
|
unlineCommit (row) {
|
this.unlineCommitForm.inOrderCode = row.inOrderCode;
|
this.unlineCommitForm.qty = row.unLineNum;
|
this.unlineCommitModalShow = true
|
},
|
//线下交付
|
onSubmitUnlineCommitForm () {
|
this.$confirm('确定将计划单号"' + this.unlineCommitForm.inOrderCode + '"提交线下交付数量吗?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
UpdateUnlineNum({
|
InOrderCode: this.unlineCommitForm.inOrderCode,
|
Qty: this.unlineCommitForm.qty
|
}).then(res => {
|
if (res.code == 0) {
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
});
|
this.unlineCommitModalShow = false;
|
this.InOrderSearch();
|
} else {
|
this.$message({
|
type: 'warning',
|
message: '提交失败:' + res.msg
|
});
|
}
|
});
|
})
|
.catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消'
|
});
|
});
|
},
|
//删除
|
del (row) {
|
console.log(row);
|
const { inOrderCode } = { ...row };
|
this.$confirm('此操作将永久删除该生产计划信息, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
InOrderDelete({ inOrderCode }).then(res => {
|
if (res.code == 0) {
|
this.$message({
|
type: 'success',
|
message: '删除成功'
|
});
|
this.InOrderSearch();
|
} else {
|
this.$message({
|
type: 'warning',
|
message: '删除失败'
|
});
|
}
|
});
|
})
|
.catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
//新建
|
addmodal () {
|
this.rowitem = {};
|
this.addmodalShow = true;
|
this.title = '新建';
|
},
|
//新增修改后
|
addsubmit () {
|
this.addmodalShow = false;
|
this.modalShow = false;
|
this.UserSearch();
|
},
|
//零件勾选数据
|
chooseClick (e) {
|
//alert(e)
|
if (e.length > 0) {
|
this.chooselist = [...e];
|
this.partShow = false;
|
} else {
|
this.$message({
|
type: 'info',
|
message: '请勾选'
|
});
|
}
|
},
|
//完工零件勾选数据
|
submitRelevanceFinishedPart (e) {
|
//alert(e)
|
//debugger
|
//alert(this.$refs.quotaion_relevanceEditMethod.tableData.length);
|
var oldDataList = this.$refs.quotaion_relevanceEditMethod.tableData;
|
if (e.length > 0) {
|
//处理,相同的就不再继续添加,没有的就添加
|
var checkList = [...e];
|
for (let i in checkList) {
|
debugger
|
//alert(checkList[i].id);
|
var result = oldDataList.find(x => x.id == checkList[i].id);
|
//alert(result)
|
if (result == undefined) {
|
//alert('填入')
|
//alert(this.relevanceFinishedPartList.length);
|
oldDataList.push(checkList[i]);
|
//console.log(checkList[i])
|
//alert('填入11')
|
}
|
}
|
this.relevanceFinishedPartList = [...oldDataList];
|
//alert(this.relevanceFinishedPartList.length);
|
this.relevanceFinishedPartShow = false;
|
} else {
|
this.$message({
|
type: 'info',
|
message: '请勾选'
|
});
|
}
|
},
|
//新增零件后
|
addchooseclick () {
|
this.addchooseShow = false;
|
this.$refs.partChoose.itemSearch();
|
},
|
readExcel (e) {
|
// 读取表格文件
|
let _this = this;
|
const files = e.file;
|
// debugger;
|
if (files.length <= 0) {
|
return false;
|
} else if (!/\.(xls|xlsx)$/.test(files.name.toLowerCase())) {
|
this.$message({
|
message: '上传格式不正确,请上传xls或者xlsx格式',
|
type: 'warning'
|
});
|
return false;
|
} else {
|
// 更新获取文件名
|
console.log(files);
|
}
|
|
const fileReader = new FileReader();
|
fileReader.onload = ev => {
|
try {
|
const data = ev.target.result;
|
const workbook = XLSX.read(data, {
|
type: 'binary'
|
});
|
const wsname = workbook.SheetNames[0]; //取第一张表
|
const ws = XLSX.utils.sheet_to_json(workbook.Sheets[wsname]); //生成json表格内容
|
console.log(ws);
|
let list = [];
|
|
ws.forEach(item => {
|
list.push({
|
itemCode: item['零件编号'],
|
inType: item['生产类型'],
|
Desc: item['生产班线'],
|
createTime: item['生产日期'],
|
itemNum: item['生产数量']
|
});
|
});
|
_this.ImportInOrder(JSON.stringify(list));
|
} catch (e) {
|
return false;
|
}
|
};
|
fileReader.readAsBinaryString(files);
|
},
|
//导入接口
|
ImportInOrder (list) {
|
ImportInOrder({ userName: getCache('userInfo').userName, items: list }).then(res => {
|
if (res.code == 0) {
|
this.$message({
|
type: 'success',
|
message: '导入成功'
|
});
|
} else {
|
this.$message({
|
type: 'warning',
|
message: '导入失败!请按照模板填入内容'
|
});
|
}
|
});
|
this.InOrderSearch();
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
//赋值id为input_finished_product的样式
|
#input_finished_product {
|
.table {
|
width: 100%;
|
margin-top: 10px;
|
height: calc(100% - 40px);
|
overflow: hidden;
|
}
|
}
|
</style>
|