451 lines
13 KiB
Vue
451 lines
13 KiB
Vue
<template>
|
|
<el-container>
|
|
<el-header>
|
|
<div class="right-panel">
|
|
<el-date-picker
|
|
v-model="query.mio__inout_date__gte"
|
|
type="date"
|
|
placeholder="开始日期"
|
|
format="YYYY-MM-DD"
|
|
value-format="YYYY-MM-DD"
|
|
style="width: 150px;"
|
|
/>
|
|
<el-date-picker
|
|
v-model="query.mio__inout_date__lte"
|
|
type="date"
|
|
format="YYYY-MM-DD"
|
|
value-format="YYYY-MM-DD"
|
|
placeholder="结束日期"
|
|
style="width: 150px;"
|
|
/>
|
|
<xtSelect
|
|
:apiObj="apiObjm"
|
|
v-model="query.material"
|
|
v-model:obj="selectObj"
|
|
:labelField="'full_name'"
|
|
style="width: 150px;"
|
|
:params="mquery"
|
|
@change="selectMaterialChange"
|
|
>
|
|
<el-table-column label="物料" prop="full_name"></el-table-column>
|
|
</xtSelect>
|
|
<el-input
|
|
v-model="query.search"
|
|
placeholder="名称"
|
|
clearable
|
|
style="width: 150px;"
|
|
></el-input>
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-search"
|
|
@click="handleQuery"
|
|
></el-button>
|
|
</div>
|
|
</el-header>
|
|
<el-main style="padding: 0;">
|
|
<el-table
|
|
ref="table"
|
|
:data="tableData"
|
|
row-key="id"
|
|
stripe
|
|
border
|
|
style="height: 100%;"
|
|
:summary-method="getSummaries"
|
|
show-summary
|
|
>
|
|
<el-table-column type="index" width="50" />
|
|
<el-table-column label="类型" width="80">
|
|
<template #default="scope">
|
|
<span v-if="scope.row.mio_">{{typeDict[scope.row.mio_.type] }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="日期" prop="inout_date" sortable width="90">
|
|
</el-table-column>
|
|
<el-table-column label="物料编号" show-overflow-tooltip min-width="80"
|
|
:filters="nameFilters1"
|
|
:filter-method="filterName1"
|
|
filter-placement="bottom-end">
|
|
<template #default="scope">
|
|
<span v-if="scope.row.material_">{{ scope.row.material_.number }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="名称" show-overflow-tooltip min-width="80"
|
|
:filters="nameFilters2"
|
|
:filter-method="filterName2"
|
|
filter-placement="bottom-end">
|
|
<template #default="scope">
|
|
<span v-if="scope.row.material_">{{ scope.row.material_.name }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="货位号"
|
|
:filters="nameFilters3"
|
|
:filter-method="filterName3"
|
|
filter-placement="bottom-end">
|
|
<template #default="scope">
|
|
<span v-if="scope.row.material_">{{ scope.row.material_.bin_number_main }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="规格"
|
|
:filters="nameFilters4"
|
|
:filter-method="filterName4"
|
|
filter-placement="bottom-end">
|
|
<template #default="scope">
|
|
<span v-if="scope.row.material_">{{ scope.row.material_.specification }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="品牌型号"
|
|
:filters="nameFilters5"
|
|
:filter-method="filterName5"
|
|
filter-placement="bottom-end">
|
|
<template #default="scope">
|
|
<span v-if="scope.row.material_">{{ scope.row.material_.model }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="单位" prop="batch" width="70"
|
|
:filters="nameFilters6"
|
|
:filter-method="filterName6"
|
|
filter-placement="bottom-end">
|
|
<template #default="scope">
|
|
<span v-if="scope.row.material_">{{ scope.row.material_.unit }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="入库数量" prop="count" sortable>
|
|
</el-table-column>
|
|
<el-table-column label="单价" prop="unit_price" sortable>
|
|
</el-table-column>
|
|
<el-table-column label="总金额" prop="price" sortable>
|
|
</el-table-column>
|
|
<el-table-column label="入库人"
|
|
:filters="nameFilters7"
|
|
:filter-method="filterName7"
|
|
filter-placement="bottom-end">
|
|
<template #default="scope">
|
|
<span v-if="scope.row.mio_">{{ scope.row.mio_.submit_user_name }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="入库凭证号"
|
|
:filters="nameFilters8"
|
|
:filter-method="filterName8"
|
|
filter-placement="bottom-end">
|
|
<template #default="scope">
|
|
<span v-if="scope.row.mio_">{{ scope.row.mio_.number }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="类别" prop="type"
|
|
:filters="nameFilters9"
|
|
:filter-method="filterName9"
|
|
filter-placement="bottom-end">
|
|
<template #default="scope">
|
|
<span v-if="scope.row.mio_">{{ typeDict[scope.row.mio_.type] }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="供应商" prop="supplier_name">
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="操作"
|
|
fixed="right"
|
|
width="80"
|
|
>
|
|
<template #default="scope">
|
|
<el-button
|
|
size="small"
|
|
type="danger"
|
|
@click="revertAndDel(scope.row)"
|
|
v-if="scope.row.mio_&&scope.row.mio_.state == 20"
|
|
>撤消</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-main>
|
|
<el-footer>
|
|
<el-pagination
|
|
background
|
|
:small="true"
|
|
:total="dataTotal"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
:page-size="params.page_size"
|
|
:page-sizes="[20, 50, 100, 200]"
|
|
:current-page="params.page"
|
|
@current-change="getList"
|
|
@update:page-size="getList2"
|
|
></el-pagination>
|
|
</el-footer>
|
|
</el-container>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
name: "mioitemlist",
|
|
data() {
|
|
return {
|
|
apiObj: null,
|
|
params: {
|
|
page:1,
|
|
page_size:20,
|
|
with_mio:'yes',
|
|
material__type:40,
|
|
mio__state:20
|
|
},
|
|
mquery:{
|
|
page: 0,
|
|
type__in: "40, 50, 60, 70",
|
|
is_hidden: false,
|
|
is_assemb: false,
|
|
},
|
|
selection: [],
|
|
tableData:[],
|
|
nameFilters1: [],
|
|
nameFilters2: [],
|
|
nameFilters3: [],
|
|
nameFilters4: [],
|
|
nameFilters5: [],
|
|
nameFilters6: [],
|
|
nameFilters7: [],
|
|
nameFilters8: [],
|
|
nameFilters9: [],
|
|
query: {
|
|
search : "",
|
|
material : "",
|
|
mio__inout_date__gte : "",
|
|
mio__inout_date__lte : "",
|
|
},
|
|
stateDict: {
|
|
10: "创建中",
|
|
20: "已提交",
|
|
},
|
|
typeDict: {
|
|
do_out: "生产领料",
|
|
sale_out: "销售发货",
|
|
pur_in: "采购入库",
|
|
do_in: "生产入库",
|
|
other_in: "其他入库",
|
|
other_out: "其他出库",
|
|
},
|
|
selectObj: {},
|
|
project_code:'',
|
|
dataTotal:0,
|
|
apiObjm:this.$API.mtm.material.list,
|
|
};
|
|
},
|
|
mounted() {
|
|
this.checkTemplate = this.checkTemplate+"?t=" + new Date().getTime();
|
|
this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
|
|
this.params.mio = this.mioId;
|
|
let that = this;
|
|
that.getList();
|
|
},
|
|
methods: {
|
|
getList(val){
|
|
let that = this;
|
|
that.params.page = val?val:1;
|
|
that.params.with_mio = 'yes';
|
|
that.params.search = that.query.search;
|
|
that.params.mio__inout_date__gte = that.query.mio__inout_date__gte;
|
|
that.params.mio__inout_date__lte = that.query.mio__inout_date__lte;
|
|
if(that.query.material!==''||that.query.material!==undefined||that.query.material!==null){
|
|
that.params.material = that.query.material;
|
|
}
|
|
that.$API.inm.mioitem.list.req(that.params).then((res) => {
|
|
if (res.count > 0) {
|
|
that.tableData = res.results;
|
|
that.dataTotal = res.count;
|
|
let numberList=[],nameList = [],batchlist=[],specificationList=[],modelList=[],unitList=[],userList=[],mioNumberList=[],typeList=[];
|
|
res.results.forEach((ite) => {
|
|
if (numberList.indexOf(ite.material_.number) > -1) {} else {
|
|
numberList.push(ite.material_.number);
|
|
let obj = {};
|
|
obj.text = ite.material_.number;
|
|
obj.value = ite.material_.number;
|
|
that.nameFilters1.push(obj);
|
|
}
|
|
if (nameList.indexOf(ite.material_.name) > -1) {} else {
|
|
nameList.push(ite.material_.name);
|
|
let obj = {};
|
|
obj.text = ite.material_.name;
|
|
obj.value = ite.material_.name;
|
|
that.nameFilters2.push(obj);
|
|
}
|
|
if (batchlist.indexOf(ite.material_.bin_number_main) > -1) {} else {
|
|
batchlist.push(ite.material_.bin_number_main);
|
|
let obj = {};
|
|
obj.text = ite.material_.bin_number_main;
|
|
obj.value = ite.material_.bin_number_main;
|
|
that.nameFilters3.push(obj);
|
|
}
|
|
if (specificationList.indexOf(ite.material_.specification) > -1) {} else {
|
|
specificationList.push(ite.material_.specification);
|
|
let obj = {};
|
|
obj.text = ite.material_.specification;
|
|
obj.value = ite.material_.specification;
|
|
that.nameFilters4.push(obj);
|
|
}
|
|
if (modelList.indexOf(ite.material_.model) > -1) {} else {
|
|
modelList.push(ite.material_.model);
|
|
let obj = {};
|
|
obj.text = ite.material_.model;
|
|
obj.value = ite.material_.model;
|
|
that.nameFilters5.push(obj);
|
|
}
|
|
if (unitList.indexOf(ite.material_.unit) > -1) {} else {
|
|
unitList.push(ite.material_.unit);
|
|
let obj = {};
|
|
obj.text = ite.material_.unit;
|
|
obj.value = ite.material_.unit;
|
|
that.nameFilters6.push(obj);
|
|
}
|
|
if (userList.indexOf(ite.mio_.submit_user_name) > -1) {} else {
|
|
userList.push(ite.mio_.submit_user_name);
|
|
let obj = {};
|
|
obj.text = ite.mio_.submit_user_name;
|
|
obj.value = ite.mio_.submit_user_name;
|
|
that.nameFilters7.push(obj);
|
|
}
|
|
if (mioNumberList.indexOf(ite.mio_.number) > -1) {} else {
|
|
mioNumberList.push(ite.mio_.number);
|
|
let obj = {};
|
|
obj.text = ite.mio_.number;
|
|
obj.value = ite.mio_.number;
|
|
that.nameFilters8.push(obj);
|
|
}
|
|
if (typeList.indexOf(ite.mio_.type) > -1) {} else {
|
|
typeList.push(ite.mio_.type);
|
|
let obj = {};
|
|
obj.text = that.typeDict[ite.mio_.type];
|
|
obj.value = that.typeDict[ite.mio_.type];
|
|
that.nameFilters9.push(obj);
|
|
}
|
|
})
|
|
}else{
|
|
that.tableData = [];
|
|
that.dataTotal = 0;
|
|
}
|
|
});
|
|
},
|
|
getList2(val){
|
|
let that = this;
|
|
that.params.page = 1;
|
|
that.params.page_size = val;
|
|
that.getList(1);
|
|
},
|
|
handleCheckSuccess() {
|
|
this.$refs.table.refresh();
|
|
this.dialog.check = false;
|
|
},
|
|
handleQuery() {
|
|
let that = this;
|
|
that.params.page = 1;
|
|
that.getList(1);
|
|
},
|
|
resetQuery() {
|
|
this.query = {};
|
|
},
|
|
selectMaterialChange() {
|
|
var that = this;
|
|
that.query.material = that.selectObj.id;
|
|
},
|
|
//打印物料标签
|
|
printMaterial(row,type){
|
|
let that = this;
|
|
if(that.printer_name!==''&&that.printer_name!==null&&that.printer_name!==undefined){
|
|
if(type=='mioitem'){
|
|
let params = {};
|
|
params.tid = row.id;
|
|
params.extra_data={count:row.count};
|
|
params.label_template_name = '库存标签模板';
|
|
that.$API.cm.labelmat.fromMioitem.req(params).then((res) => {
|
|
let obj = {};
|
|
obj.printer_commands = res.commands;
|
|
obj.printer_name = that.printer_name;
|
|
that.$API.wpm.prints.req(obj).then((response) => {
|
|
that.$message.success("打印成功");
|
|
});
|
|
})
|
|
}else{
|
|
let params = {};
|
|
let name = that.printMaterialName.split('|')[0];
|
|
params.label_template_name = '单件打印模板';
|
|
params.data = {number:row.number,name:name};
|
|
that.$API.cm.labeltemplate.commands.req(params).then((res) => {
|
|
let obj = {};
|
|
obj.printer_commands = res.commands;
|
|
obj.printer_name = that.printer_name;
|
|
that.$API.wpm.prints.req(obj).then((response) => {
|
|
that.$message.success("打印成功");
|
|
});
|
|
});
|
|
}
|
|
}else{
|
|
that.printSetting();
|
|
}
|
|
},
|
|
getSummaries({ columns, data }) {
|
|
const sums = [];
|
|
columns.forEach((column, index) => {
|
|
if (index === 0) {
|
|
sums[index] = "合计";
|
|
return;
|
|
}
|
|
if (index == 9|| index == 11) {
|
|
const values = data.map((item) =>
|
|
Number(item[column.property])
|
|
);
|
|
if (!values.every((value) => Number.isNaN(value))) {
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
const value = Number(curr); //Number转换为数值
|
|
let sum = Number(
|
|
Number(prev) + Number(curr)
|
|
).toFixed(2); //toFixed(2)数据项保留两位小数
|
|
if (!isNaN(value)) {
|
|
return sum;
|
|
} else {
|
|
return prev;
|
|
}
|
|
}, 0);
|
|
}
|
|
}
|
|
});
|
|
return sums;
|
|
},
|
|
filterName1(value, row) {
|
|
return row.物料编号 === value;
|
|
},
|
|
filterName2(value, row) {
|
|
return row.名称 === value;
|
|
},
|
|
filterName3(value, row) {
|
|
return row.货位号 === value;
|
|
},
|
|
filterName4(value, row) {
|
|
return row.规格 === value;
|
|
},
|
|
filterName5(value, row) {
|
|
return row.品牌型号 === value;
|
|
},
|
|
filterName6(value, row) {
|
|
return row.单位 === value;
|
|
},
|
|
filterName7(value, row) {
|
|
return row.单价 === value;
|
|
},
|
|
filterName8(value, row) {
|
|
return row.入库人 === value;
|
|
},
|
|
filterName9(value, row) {
|
|
return row. 入库凭证号 === value;
|
|
},
|
|
revertAndDel(row){
|
|
let that = this;
|
|
that.$confirm('此操作将撤回并删除该记录, 是否继续?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(res=>{
|
|
that.$API.inm.mioitem.revertDel.req(row.id).then(res=>{
|
|
that.$message.success("撤回并删除成功");
|
|
that.getList(1);
|
|
})
|
|
})
|
|
},
|
|
},
|
|
};
|
|
</script>
|