496 lines
14 KiB
Vue
496 lines
14 KiB
Vue
<template>
|
|
<el-container>
|
|
<el-header>
|
|
<div class="left-panel">
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
@click="table_add(10)"
|
|
v-auth="'handover.create'"
|
|
>新增</el-button
|
|
>
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
@click="table_add(20)"
|
|
v-auth="'handover.create'"
|
|
v-if="mgroup_name!=='切片'&&mgroup_name!=='拉单丝'&&mgroup_name!=='一次复丝'&&mgroup_name!=='二次复丝'&&mgroup_name!=='切丝排版'"
|
|
>返工</el-button
|
|
>
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
@click="table_add(50)"
|
|
v-auth="'handover.create'"
|
|
>改版</el-button
|
|
>
|
|
</div>
|
|
<div class="right-panel">
|
|
<el-select
|
|
v-model="searchType"
|
|
placeholder="交接类型"
|
|
clearable
|
|
@change="searchTypeQuery"
|
|
style="width: 150px"
|
|
>
|
|
<el-option
|
|
v-for="item in typeOptions"
|
|
:key="item.value"
|
|
:label="item.name"
|
|
:value="item.value"
|
|
/>
|
|
</el-select>
|
|
<el-input
|
|
style="width: 180px; margin-right: 5px"
|
|
v-model="query.search"
|
|
placeholder="批次号/关键字/id"
|
|
clearable
|
|
@keydown.enter="handleQuery"
|
|
></el-input>
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-search"
|
|
@click="handleQuery"
|
|
></el-button>
|
|
</div>
|
|
</el-header>
|
|
<el-main class="nopadding">
|
|
<scTable
|
|
ref="table"
|
|
:apiObj="apiObj"
|
|
row-key="id"
|
|
:params="params"
|
|
:query="query"
|
|
>
|
|
<el-table-column
|
|
label="#"
|
|
type="index"
|
|
width="50"
|
|
></el-table-column>
|
|
<el-table-column type="expand">
|
|
<template #default="props">
|
|
<div style="padding-left: 50px">
|
|
<div v-if="props.row.new_batch&&props.row.new_batch!= null" style="font-size: 14px;">新批次号:{{ props.row.new_batch }}</div>
|
|
<template v-for="item in props.row.handoverb" :key="item.id">
|
|
<el-descriptions :column="3" style="margin-top: 10px;">
|
|
<el-descriptions-item label="批次">
|
|
{{item.batch}}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="数量">
|
|
{{item.count}}
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="不合格标记" v-if="item.defect_name!==null">
|
|
{{item.defect_name}}
|
|
</el-descriptions-item>
|
|
</el-descriptions>
|
|
<div v-if="item.handoverbw&&item.handoverbw.length>0" style="margin-top: -10px;">
|
|
板段号:<span v-for="bwItem in item.handoverbw" :key="bwItem.id">{{ bwItem.number }}、</span>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="物料"
|
|
prop="material_name"
|
|
min-width="140"
|
|
></el-table-column>
|
|
<el-table-column label="批次" prop="batch" width="60">
|
|
<template #default="scope">
|
|
<el-text v-if="scope.row.handoverb.length>0" type="primary">{{scope.row.handoverb.length}}批</el-text>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="数量" prop="count" min-width="80"></el-table-column>
|
|
<el-table-column label="交接类型" prop="type" min-width="80">
|
|
<template #default="scope">
|
|
<el-tag v-if="scope.row.type == 10&&scope.row.mtype == 10" type="success">正常</el-tag>
|
|
<el-tag v-if="scope.row.type == 10&&scope.row.mtype == 20" type="warning">分批</el-tag>
|
|
<el-tag v-if="scope.row.type == 10&&scope.row.mtype == 30" type="warning">合批</el-tag>
|
|
<el-tag v-if="scope.row.type == 20" type="warning">返工</el-tag>
|
|
<el-tag v-if="scope.row.type == 30" type="primary">检验</el-tag>
|
|
<el-tag v-if="scope.row.type == 40" type="danger">报废</el-tag>
|
|
<el-tag v-if="scope.row.type == 60" type="warning">退料</el-tag>
|
|
<el-text v-if="scope.row.send_mgroup == mgroupId" type="primary">交送</el-text>
|
|
<el-text v-if="scope.row.recive_mgroup == mgroupId" type="success">接收</el-text>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="接收工段" min-width="80" prop="recive_mgroup_name">
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="交送人"
|
|
prop="send_user_name"
|
|
width="80"
|
|
></el-table-column>
|
|
<el-table-column
|
|
label="接收人"
|
|
prop="recive_user_name"
|
|
width="80"
|
|
></el-table-column>
|
|
<el-table-column
|
|
label="交接日期"
|
|
prop="send_date"
|
|
width="120"
|
|
></el-table-column>
|
|
<el-table-column
|
|
label="操作"
|
|
fixed="right"
|
|
align="center"
|
|
width="300"
|
|
>
|
|
<template #default="scope">
|
|
<!-- <el-button
|
|
v-if="scope.row.send_mgroup == mgroupId||deptId==scope.row.send_dept"
|
|
@click="table_print(scope.row)"
|
|
type="success"
|
|
>打印</el-button
|
|
> -->
|
|
<el-button
|
|
@click="table_receive(scope.row)"
|
|
type="success"
|
|
v-if="(scope.row.recive_mgroup == mgroupId||scope.row.recive_dept == deptId)&&scope.row.submit_time == null"
|
|
>接收</el-button>
|
|
<el-button
|
|
@click="table_reBack(scope.row)"
|
|
type="danger"
|
|
v-if="scope.row.recive_mgroup == mgroupId&&scope.row.submit_time!== null&&scope.row.type == 10&&scope.row.mtype == 10"
|
|
>退回</el-button>
|
|
<el-button
|
|
@click="table_show(scope.row)"
|
|
type="warning"
|
|
>查看</el-button>
|
|
<el-popconfirm
|
|
title="确定撤消吗?"
|
|
v-if="scope.row.submit_time!== null"
|
|
@confirm="table_reBack2(scope.row)"
|
|
>
|
|
<template #reference>
|
|
<el-button type="danger">撤消</el-button>
|
|
</template>
|
|
</el-popconfirm>
|
|
<!-- <el-button
|
|
@click="table_edit(scope.row)"
|
|
v-auth="'handover.update'"
|
|
type="primary"
|
|
v-if="(scope.row.send_mgroup == mgroupId||deptId==scope.row.send_dept)&&scope.row.submit_time == null&&scope.row.mtype == 10"
|
|
>编辑</el-button
|
|
> -->
|
|
<el-popconfirm
|
|
title="确定删除吗?"
|
|
v-if="(scope.row.send_mgroup == mgroupId||deptId==scope.row.send_dept)&&scope.row.submit_time == null"
|
|
@confirm="table_del(scope.row, scope.$index)"
|
|
>
|
|
<template #reference>
|
|
<el-button
|
|
v-auth="'handover.delete'"
|
|
type="danger"
|
|
>删除</el-button
|
|
>
|
|
</template>
|
|
</el-popconfirm>
|
|
</template>
|
|
</el-table-column>
|
|
</scTable>
|
|
</el-main>
|
|
</el-container>
|
|
<save-dialog
|
|
v-if="dialog.save"
|
|
ref="saveDialog"
|
|
:type="type"
|
|
:mgroupName="mgroupName"
|
|
:mgroupId="mgroupId"
|
|
@success="handleSaveSuccess"
|
|
@closed="dialog.save = false"
|
|
>
|
|
</save-dialog>
|
|
<el-dialog title="退料操作" v-model="backDialogVisible" style="width: 70%;">
|
|
<el-row v-for="item in handoverbList" :key="item.id" style="padding: 10px 10px 0 20px;">
|
|
<el-col style="display: flex;border-bottom: 1px dashed #eee;">
|
|
<el-checkbox v-model="item.checked" :label="item.batch"/>
|
|
<el-form-item label="退料数量" label-width="150px" style="margin-bottom: 10px;">
|
|
<el-input-number disabled v-model="item.count" :min="0" controls-position="right"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-form ref="backForm" label-width="100px" :rules="rules" :model="form" style="margin-top: 15px;">
|
|
<el-form-item label="接收工段" prop="recive_mgroup">
|
|
<el-select
|
|
v-model="form.recive_mgroup"
|
|
placeholder="接收工段"
|
|
disabled
|
|
style="width: 100%"
|
|
>
|
|
<el-option
|
|
v-for="item in mgroupOptions"
|
|
:key="item.id"
|
|
:label="item.name"
|
|
:value="item.id"
|
|
></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="退料原因">
|
|
<el-input v-model="form.note"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-footer>
|
|
<el-button type="primary" @click="savePrinter">保存</el-button>
|
|
</el-footer>
|
|
</el-dialog>
|
|
<el-dialog v-model="printVisible" width="1200px">
|
|
<print :baseData="handoverItem" :tableData="handoverItem.handoverb" :type="'handover'" @closePrint="printVisible=false"/>
|
|
</el-dialog>
|
|
</template>
|
|
<script>
|
|
import saveDialog from "./handover_form.vue";
|
|
import print from "./../setting/print/A4.vue";
|
|
export default {
|
|
props: {
|
|
mgroupName: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
},
|
|
name: "handover",
|
|
components: {
|
|
saveDialog,print
|
|
},
|
|
data() {
|
|
return {
|
|
apiObj: null,
|
|
|
|
dialog: {
|
|
save: false,
|
|
permission: false,
|
|
},
|
|
params: {
|
|
// count_xtest__gte: 0,
|
|
},
|
|
query: {
|
|
send_mgroup: "",
|
|
recive_mgroup: "",
|
|
},
|
|
typeOptions: [
|
|
{ name: "交送", value: "send" },
|
|
{ name: "接收", value: "recive" },
|
|
],
|
|
form:{},
|
|
searchType: "",
|
|
options: ["交送", "接收"],
|
|
tableData: [],
|
|
selection: [],
|
|
handoverbList:[],
|
|
handoverItem:{},
|
|
values: "交送",
|
|
deptId:'',
|
|
mtask: "",
|
|
mlogId: "",
|
|
mgroupId: "",
|
|
processId: "",
|
|
processCate: "",
|
|
printer_name: "",
|
|
printVisible:false,
|
|
backDialogVisible: false,
|
|
mgroup_name:'',
|
|
};
|
|
},
|
|
watch: {
|
|
mgroupName: {
|
|
handler: function (newval,odlval) {
|
|
let that = this;
|
|
that.params.dept = "";
|
|
that.params.mgroup = "";
|
|
that.apiObj = null;
|
|
that.mgroup_name = newval;
|
|
that.getMgroupInfo();
|
|
},
|
|
},
|
|
},
|
|
mounted() {
|
|
this.getMgroupInfo();
|
|
this.getMgroupOptions();
|
|
},
|
|
methods: {
|
|
//获取工段列表
|
|
getMgroupOptions() {
|
|
let that = this;
|
|
that.$API.mtm.mgroup.list.req({ page: 0}).then((res) => {
|
|
that.mgroupOptions = res;
|
|
if(that.type==40){
|
|
res.forEach(item=>{
|
|
if(item.name=="废品库"){
|
|
that.form.recive_mgroup = item.id;
|
|
}
|
|
})
|
|
that.getCkUserList();//废品库接收人
|
|
}
|
|
});
|
|
},
|
|
getMgroupInfo(){
|
|
let that = this;
|
|
console.log('that.mgroupName',that.mgroupName);
|
|
that.printer_name = localStorage.getItem("printer_name");
|
|
that.$API.mtm.mgroup.list.req({ page: 0, name: that.mgroupName }).then((res) => {
|
|
if (res.length < 1) {
|
|
that.$message.error("获取工段错误");
|
|
return;
|
|
}
|
|
that.$TOOL.data.set('gx_deptID',res[0].belong_dept)
|
|
that.mgroupId = res[0].id;
|
|
that.processId = res[0].process;
|
|
that.processCate = res[0].process_cate;
|
|
that.params.mgroup = that.mgroupId;
|
|
that.apiObj = that.$API.wpm.handover.list;
|
|
that.$refs.table.refresh();
|
|
});
|
|
},
|
|
//添加
|
|
table_add(type) {
|
|
this.dialog.save = true;
|
|
this.type = type;
|
|
this.$nextTick(() => {
|
|
this.$refs.saveDialog.open("add");
|
|
});
|
|
},
|
|
//编辑
|
|
table_edit(row) {
|
|
this.type=row.type;
|
|
this.dialog.save = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.saveDialog.open("edit").setData(row);
|
|
});
|
|
},
|
|
table_show(row){
|
|
this.type=row.type;
|
|
this.dialog.save = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.saveDialog.open("show").setData(row);
|
|
});
|
|
},
|
|
//删除
|
|
async table_del(row) {
|
|
var id = row.id;
|
|
var res = await this.$API.wpm.handover.delete.req(id);
|
|
if (res.err_msg) {
|
|
this.$message.error(res.err_msg);
|
|
} else {
|
|
this.$refs.table.refresh();
|
|
this.$message.success("删除成功");
|
|
}
|
|
},
|
|
//表格选择后回调事件
|
|
selectionChange(selection) {
|
|
this.selection = selection;
|
|
},
|
|
//搜索
|
|
handleQuery() {
|
|
this.$refs.table.queryData(this.query);
|
|
},
|
|
searchTypeQuery() {
|
|
let that = this;
|
|
if (that.searchType == "send") {
|
|
if(that.mgroup_name=="size"||that.mgroup_name=="facade"){
|
|
that.query.send_dept = that.deptId;
|
|
that.query.recive_dept = "";
|
|
}else{
|
|
that.query.send_mgroup = that.mgroupId;
|
|
that.query.recive_mgroup = "";
|
|
}
|
|
} else if (that.searchType == "recive") {
|
|
if(that.mgroup_name=="size"||that.mgroup_name=="facade"){
|
|
that.query.send_dept = "";
|
|
that.query.recive_dept =that.deptId;
|
|
}else{
|
|
that.query.recive_mgroup = that.mgroupId;
|
|
that.query.send_mgroup = "";
|
|
}
|
|
} else {
|
|
that.query.send_mgroup = "";
|
|
that.query.recive_mgroup = "";
|
|
that.query.recive_dept = "";
|
|
that.query.send_dept = "";
|
|
}
|
|
console.log(that.query);
|
|
this.$refs.table.queryData(that.query);
|
|
},
|
|
table_receive(row) {
|
|
//接收
|
|
let that = this;
|
|
that.$API.wpm.handover.submit.req(row.id).then((res) => {
|
|
that.$refs.table.queryData(that.query);
|
|
});
|
|
},
|
|
//撤消
|
|
table_reBack2(row){
|
|
let that = this;
|
|
that.$API.wpm.handover.revert.req(row.id).then((res) => {
|
|
that.$refs.table.refresh();
|
|
});
|
|
},
|
|
//退回
|
|
table_reBack(row){
|
|
let that = this;
|
|
let form = {};
|
|
form.send_mgroup = row.recive_mgroup;
|
|
form.recive_mgroup = row.send_mgroup;
|
|
form.handoverb = [];
|
|
that.handoverbList = [];
|
|
row.handoverb.forEach((item) => {
|
|
let obj = {};
|
|
obj.wm = item.wm_to;
|
|
obj.checked = true;
|
|
obj.batch = item.batch;
|
|
obj.count = item.count;
|
|
form.handoverb.push(obj);
|
|
that.handoverbList.push(obj);
|
|
})
|
|
form.send_user = that.$TOOL.data.get('USER_INFO').id;
|
|
form.send_date = that.$TOOL.dateFormat2(new Date());
|
|
form.type = 60;//退料
|
|
that.form = form;
|
|
that.backDialogVisible = true;
|
|
},
|
|
table_print(row) {
|
|
let that = this;
|
|
that.handoverItem = row;
|
|
that.printVisible = true;
|
|
},
|
|
savePrinter() {
|
|
let that = this;
|
|
that.form.handoverb = [];
|
|
that.handoverbList.forEach(item=>{
|
|
if(item.checked){
|
|
let obj = {};
|
|
obj.wm = item.wm;
|
|
obj.batch = item.batch;
|
|
obj.count = item.count;
|
|
that.form.handoverb.push(obj);
|
|
}
|
|
})
|
|
// console.log(that.form)
|
|
that.$API.wpm.handover.create.req(that.form).then((res) => {
|
|
that.$message.success("操作成功");
|
|
that.backDialogVisible = false;
|
|
that.$refs.table.refresh();
|
|
that.form = {};
|
|
}).catch((err) => {
|
|
return err;
|
|
});
|
|
},
|
|
//本地更新数据
|
|
//新增岗位后更新数据
|
|
handleSaveSuccess(data, mode) {
|
|
this.dialog.save = true;
|
|
this.$refs.table.refresh();
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<style scoped>
|
|
.treeMain {
|
|
width: 100%;
|
|
height: 280px;
|
|
overflow: auto;
|
|
border: 1px solid #dcdfe6;
|
|
margin-bottom: 10px;
|
|
}
|
|
</style>
|