You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udiwms-vue-frame/src/views/inout/DialogSelectInvProduct.vue

232 lines
6.0 KiB
Vue

<template>
<div>
<el-card>
<el-form :inline="true" :model="filterQuery" class="query-form" size="mini">
<el-row>
<el-form-item class="query-form-item">
<el-input v-model="filterQuery.nameCode" placeholder="产品标识DI"></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-input v-model="filterQuery.cpmctymc" placeholder="产品名称"></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-input v-model="filterQuery.batchNo" placeholder="批次号"></el-input>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button
type="primary"
icon="el-icon-refresh"
@click="onReset"
></el-button>
<el-button type="primary" icon="search" @click="onSubmit"
>查询
</el-button
>
<el-button type="primary" icon="search" @click="combine"></el-button>
</el-button-group>
</el-form-item>
</el-row>
</el-form>
<el-table v-loading="loading" :data="list" style="width: 100%"
highlight-current-row="false"
ref="multipleTable">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="产品标识" prop="nameCode"></el-table-column>
<el-table-column label="产品名称" prop="cpmctymc">
</el-table-column>
<el-table-column label="规格型号" prop="ggxh"></el-table-column>
<el-table-column label="批次号" prop="batchNo"></el-table-column>
<el-table-column label="生产日期" prop="productionDate"></el-table-column>
<el-table-column label="失效日期" prop="expireDate"></el-table-column>
<el-table-column label="入库数量" prop="inCount"></el-table-column>
<el-table-column label="出库数量" prop="outCount"></el-table-column>
<el-table-column label="结余数量" prop="reCount"></el-table-column>
</el-table>
</el-card>
<el-pagination
:page-size="filterQuery.limit"
@current-change="handleCurrentChange"
layout="prev, pager, next"
:total="total"
:current-page="filterQuery.page"
></el-pagination>
</div>
</template>
<script>
import {
getInvProduct,
} from "@/api/inventory/invPorduct";
import {addDetail} from "@/api/inout/receiveOrder";
export default {
name: "DialogInvProduct",
props: {
closeDialog: {
type: Function,
required: true,
},
invQueryData: {
type: Object,
required: true,
},
type: {
type: Object,
required: true,
}
},
data() {
return {
filterQuery: {
cpmctymc: null,
nameCode: null,
relIdFk: null,
batchNo: null,
page: 1,
limit: 10,
customerId: null,
supId: null,
unitFk: null,
invCode: this.invQueryData.invCode,
},
detailQuery: {
code: null,
productIdFk: null,
page: 1,
limit: 20,
},
list: [],
total: 0,
loading: true,
index: null,
dialogTableVisible: false,
formLoading: false,
dialogVisible: false,
deleteLoading: false,
busTypes: [],
idQuery: null,
showSup: false,
fromOptions: [],
};
},
components: {},
methods: {
onReset() {
this.$router.push({
path: "",
});
this.filterQuery = {
cpmctymc: null,
nameCode: null,
relIdFk: null,
batchNo: null,
customerId: null,
unitFk: null,
supId: null,
page: 1,
limit: 10,
invCode: this.invQueryData.targetInvCode,
};
this.getList();
},
onSubmit() {
this.loading = true;
this.filterQuery.page = 1;
this.getList();
},
handleSizeChange(val) {
this.filterQuery.limit = val;
this.getList();
},
handleCurrentChange(val) {
this.filterQuery.page = val;
this.getList();
},
closeDetailDialog(val) {
this.codeDetailVisible = false;
},
getList() {
this.loading = true;
getInvProduct(this.filterQuery)
.then((response) => {
this.showSup = response.data.showSup;
this.loading = false;
this.list = response.data.list || [];
this.total = response.data.total || 0;
})
.catch(() => {
this.loading = false;
this.list = [];
this.total = 0;
});
},
combine() {
let selection = this.$refs.multipleTable.selection;
if (selection.length < 1) {
this.$message.error('未选择产品');
return;
}
let ids = [];
selection.forEach((obj, index) => {
let data = {
relId: obj.relIdFk,
batchNo: obj.batchNo,
productDate: obj.productionDate,
expireDate: obj.expireDate,
}
ids.push(data);
});
this.loading = true;
let tQuery = {
datas: ids,
purReceiveEntity: this.invQueryData,
};
addDetail(tQuery).then((response) => {
this.loading = false;
if (response.code === 20000) {
this.closeDialog(response.data);
} else {
this.$message.error(response.message);
}
}).catch(() => {
this.loading = false;
});
},
},
filters: {
statusFilterType(status) {
const statusMap = {
false: "success",
true: "danger",
};
return statusMap[status];
},
},
mounted() {
document.body.ondrop = function (event) {
event.preventDefault();
event.stopPropagation();
};
},
created() {
this.filterQuery.invCode = this.invQueryData.targetInvCode;
// 加载表格数据
this.getList();
},
};
</script>
<style type="text/scss" lang="scss">
</style>