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

602 lines
20 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div>
<el-card>
<el-form :model="filterQuery" size="mini" label-width="100px" v-if="showSearch">
<el-row>
<el-col :span="6">
<el-form-item label="DI/物资编码:">
<el-input v-model="filterQuery.nameCode" style="width: 90%" placeholder="请输入DI/物资编码"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="物资名称:">
<el-input v-model="filterQuery.cpmctymc" style="width: 90%" placeholder="请输入物资名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="规格型号:">
<el-input v-model="filterQuery.ggxh" style="width: 90%" placeholder="请输入规格型号"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="批次号:">
<el-input v-model="filterQuery.batchNo" style="width: 90%" placeholder="请输入批次号"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="生产企业:" class="query-form-item">
<el-input v-model="filterQuery.manufactory" style="width: 100%" placeholder="请输入生产企业/注册备案人"
clearable="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="物资分类:" class="query-form-item">
<el-input v-model="filterQuery.category" style="width: 100%" placeholder="请输入物资分类名称"
clearable="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" v-if="productRemarkSet.remarkEnable1">
<el-form-item :label="productRemarkSet.remarkTitle1+':'" class="query-form-item">
<el-input v-model="filterQuery.basicPrductRemak1" style="width: 100%"
:placeholder="productRemarkSet.remarkTitle1"
clearable="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" v-if="productRemarkSet.remarkEnable2">
<el-form-item :label="productRemarkSet.remarkTitle2 +':'" class="query-form-item">
<el-input v-model="filterQuery.basicPrductRemak2" style="width: 100%"
:placeholder="productRemarkSet.remarkTitle2"
clearable="true"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="top-right-btn">
<el-button-group style="display:flex;">
<el-button icon="el-icon-view" type="primary" @click="hideSearch">显示/隐藏搜索栏</el-button>
<el-button type="primary" icon="el-icon-refresh" @click="onReset">重置</el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit">查询</el-button>
<el-button type="primary" icon="el-icon-plus" @click="combine">确定</el-button>
</el-button-group>
</div>
<el-divider style="margin: 15px"></el-divider>
<el-table v-loading="loading" :data="list" style="width: 100%" highlight-current-row="false" border
@current-change="handleChange"
ref="multipleTable">
<!-- <el-table-column label width="45" v-if="type==3 ">-->
<!-- <template slot-scope="scope">-->
<!-- <el-radio :label="scope.row.id" v-model="radioCheck"><span></span></el-radio>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column type="selection" width="55" v-if="type!=3"></el-table-column>-->
<!-- <el-table-column label="序号" type="index" width="55"></el-table-column>-->
<!-- <el-table-column label="DI/物资编码" prop="nameCode" width="120" show-overflow-tooltip></el-table-column>-->
<!-- <el-table-column label="物资名称" prop="cpmctymc" width="160" show-overflow-tooltip></el-table-column>-->
<!-- <el-table-column label="规格型号" prop="ggxh" width="160"></el-table-column>-->
<!-- <el-table-column label="包装规格" prop="bzgg" width="100"></el-table-column>-->
<!-- <el-table-column label="计量单位" prop="measname" width="90"></el-table-column>-->
<!-- <el-table-column label="批次号" prop="batchNo" width="90"></el-table-column>-->
<!-- <el-table-column label="价格" prop="price"></el-table-column>-->
<!-- <el-table-column label="生产日期" prop="productionDate" width="90"></el-table-column>-->
<!-- <el-table-column label="失效日期" prop="expireDate" width="90"></el-table-column>-->
<!-- <el-table-column label="入库数量" prop="inCount" width="90"></el-table-column>-->
<!-- <el-table-column label="出库数量" prop="outCount" width="90"></el-table-column>-->
<!-- <el-table-column label="结余数量" prop="reCount" width="90"></el-table-column>-->
<!-- <el-table-column label="生产企业" prop="ylqxzcrbarmc" width="180"></el-table-column>-->
<!-- <el-table-column label="注册/备案号" prop="zczbhhzbapzbh" width="180"></el-table-column>-->
<!-- <el-table-column label="供应商" prop="supName" width="180"></el-table-column>-->
<template v-for="(item, index) in tableHeader">
<el-table-column
v-if="item.columnType == 'id' && executeEval(row,item.expression,true)"
type="index" :label="item.columnDesc"></el-table-column>
<el-table-column
v-if="item.columnType == 'selection'"
type="selection"
:width="item.width"
:selectable="(row,number) => executeFuc(row,'3',item.clickFuc)"
></el-table-column>
<el-table-column
v-if="item.columnType == 'radio' && executeEval(row,item.expression,true)"
:prop="item.columnName"
:label="item.columnDesc"
:sortable="item.sort"
:width="item.width"
:show-overflow-tooltip="item.tooltip"
:key="item.columnName"
>
<template slot-scope="scope">
<el-radio :label="scope.row.id" v-model="radioCheck"><span></span></el-radio>
</template>
</el-table-column>
<el-table-column
v-if="item.columnType == 'laber' && executeEval(row,item.expression,true)"
:prop="item.columnName"
:label="item.columnDesc"
:sortable="item.sort"
:width="item.width"
:show-overflow-tooltip="item.tooltip"
:key="item.columnName"
>
<template slot-scope="scope">
<span :style="{color: executeFuc(scope.row,'4',item.lableRuleObj[scope.row[item.columnName]])}">{{
item.lableRuleObj[scope.row[item.columnName]]
}}</span>
</template>
</el-table-column>
<el-table-column
v-if="item.columnType == 'eltag' && executeEval(row,item.expression,true)"
:prop="item.columnName"
:label="item.columnDesc"
:sortable="item.sort"
:width="item.width"
:show-overflow-tooltip="item.tooltip"
:key="item.columnName"
>
<template slot-scope="scope">
<el-tag
:type="executeFuc(scope.row,'4',item,item.lableRuleObj?item.lableRuleObj[scope.row[item.columnName]]:scope.row[item.columnName])">
<span>{{
item.lableRuleObj ? item.lableRuleObj[scope.row[item.columnName]] : scope.row[item.columnName]
}}</span>
</el-tag>
</template>
</el-table-column>
<el-table-column
v-if="item.columnType == 'button' && executeEval(row,item.expression,true)"
:prop="item.columnName"
:label="item.columnDesc"
:width="item.width"
:key="item.columnName"
fixed="right"
>
<template slot-scope="scope">
<el-button v-for="(buttonItem, buttonIndex) in item.buttonRulObj"
:type="buttonItem.type"
:size="buttonItem.size"
:style="buttonItem.style"
:key="buttonItem"
v-if="executeEval(scope.row,buttonItem.hasPermi,true)"
:disabled="executeEval(scope.row,buttonItem.disabledFuc,false)"
@click.native.stop="executeFuc(scope.row,'1',buttonItem.clickFuc)"
>{{ buttonItem.name }}
</el-button>
</template>
</el-table-column>
<el-table-column
v-if="item.columnType == 'text' && executeEval(row,item.expression,true)"
:prop="item.columnName"
:label="item.columnDesc"
:sortable="item.sort"
:width="item.width"
:show-overflow-tooltip="item.tooltip"
:key="item.columnName"
>
<template slot-scope="scope">
<span :style="{color: executeFuc(scope.row,'4',item,scope.row[item.columnName])}">{{
scope.row[item.columnName]
}}</span>
</template>
</el-table-column>
</template>
</el-table>
</el-card>
<pagination
v-show="total>0"
:total="total"
:limit.sync="filterQuery.limit"
:page.sync="filterQuery.page"
@pagination="handleCurrentChange"
></pagination>
</div>
</template>
<script>
import {
getInvProduct, getInvProductStock, getProduct,
} from "@/api/inventory/invPorduct";
import {addDetail} from "@/api/inout/receiveOrder";
import {addBizProduct} from "@/api/inout/orderDetailCode";
import {getInvPreInProduct, getInvPreInProductStock} from "@/api/inventory/invPreInSearch";
import {getInvPreProduct, getInvPreProductStock} from "@/api/inventory/invPreProduct";
import {finProductSet} from "@/api/param/systemParamConfig";
import {executeFuc, getHead} from "@/utils/customConfig";
export default {
name: "DialogInvProduct",
props: {
closeDialog: {
type: Function,
required: true,
},
invQueryData: {
type: Object,
required: true,
},
codeArray: {
type: Object,
required: true,
},
orderQuery: {},
type: { //1.领用选入2业务单据选入
type: Object,
required: true,
}
},
data() {
return {
showSearch: true,
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: [],
productRemarkSet: {},
currentRow: null,
radioCheck: null,
tableHeader: [],
queryList: [],
fromList: [],
};
},
components: {},
methods: {
//界面配置----------------
executeFuc(row, type, clickFuc, value) {
return executeFuc(this, row, type, clickFuc, value);
},
executeEval(row, expression, defaultRet) {
if (expression) {
return eval(expression);
}
return defaultRet;
},
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,
};
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.page;
this.getList();
},
closeDetailDialog(val) {
this.codeDetailVisible = false;
},
getList() {
this.loading = true;
if (this.type == 1) {
this.filterQuery.invCode = this.invQueryData.targetInvCode;
} else
this.filterQuery.invCode = this.invQueryData.invCode;
this.filterQuery.filterNoInv = 1;
//寄售
if (this.invQueryData.advanceType == 3) {
getInvPreProductStock(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;
});
//预验收
} else if (this.invQueryData.advanceType == 2) {
getInvPreInProductStock(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;
});
} else {
getProduct(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;
});
}
},
hideSearch() {
this.showSearch = !this.showSearch;
},
combine() {
if (this.type == 3) {
let nameCode = this.currentRow.nameCode ?? '';
let productionDate = this.currentRow.productionDate ?? '';
let expireDate = this.currentRow.expireDate ?? '';
let batchNo = this.currentRow.batchNo ?? '';
let udiCode = "#" + nameCode
+ "#" + productionDate
+ "#" + expireDate +
"#" + batchNo + "#" + "#" + "#";
this.closeDialog(udiCode);
} else if (this.type == 1) {
let selection = this.$refs.multipleTable.selection;
if (selection.length < 1) {
this.$message.error('未选择产品');
return;
}
var idster = [];
if (this.codeArray != null || this.codeArray != undefined) {
if (this.codeArray.length > 0) {
for (var i = 0; i < this.codeArray.length; i++) {
idster.push(this.codeArray[i].relIdFk + '--' + this.codeArray[i].batchNo);
}
}
if (idster.length > 0) {
for (var i = 0; i < idster.length; i++) {
for (var j = 0; j < selection.length; j++) {
if (idster[i] == selection[j].relIdFk + '--' + selection[j].batchNo) {
this.$message.error("该产品已录入!");
return
}
}
}
}
}
var ids = [];
selection.forEach((obj, index) => {
let data = {
relId: obj.relIdFk,
batchNo: obj.batchNo,
productDate: obj.productionDate,
expireDate: obj.expireDate,
supId: obj.supId,
price: obj.price,
nameCode: obj.nameCode,
}
ids.push(data);
});
if (this.type == 2) { //新增业务单据选入
let data = {
datas: ids,
orderEntity: this.orderQuery,
}
this.loading = true;
addBizProduct(data)
.then((response) => {
this.loading = false;
if (response.code === 20000) {
this.closeDialog(response.data);
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.loading = false;
});
} else {
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;
});
}
}else {
let selection = this.$refs.multipleTable.selection;
if (selection.length < 1) {
this.$message.error('未选择产品');
return;
}
var idster = [];
if (this.codeArray != null || this.codeArray != undefined) {
if (this.codeArray.length > 0) {
for (var i = 0; i < this.codeArray.length; i++) {
idster.push(this.codeArray[i].relIdFk);
}
}
if (idster.length > 0) {
for (var i = 0; i < idster.length; i++) {
for (var j = 0; j < selection.length; j++) {
if (idster[i] == selection[j].relIdFk) {
this.$message.error("该产品已录入!");
return
}
}
}
}
}
var ids = [];
selection.forEach((obj, index) => {
let data = {
relId: obj.relIdFk,
batchNo: obj.batchNo,
productDate: obj.productionDate,
expireDate: obj.expireDate,
supId: obj.supId,
price: obj.price,
nameCode: obj.nameCode,
}
ids.push(data);
});
if (this.type == 2) { //新增业务单据选入
let data = {
datas: ids,
orderEntity: this.orderQuery,
}
this.loading = true;
addBizProduct(data)
.then((response) => {
this.loading = false;
if (response.code === 20000) {
this.closeDialog(response.data);
} else {
this.$message.error(response.message);
}
})
.catch(() => {
this.loading = false;
});
} else {
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;
});
}
}
},
findBasicProductSet() {
finProductSet().then((response) => {
if (response.code == 20000) {
this.productRemarkSet = response.data;
}
});
},
handleChange(val) {
this.currentRow = val;
this.radioCheck = val.id
},
},
filters: {
statusFilterType(status) {
const statusMap = {
false: "success",
true: "danger",
};
return statusMap[status];
}
,
}
,
mounted() {
document.body.ondrop = function (event) {
event.preventDefault();
event.stopPropagation();
};
}
,
created() {
this.findBasicProductSet();
// 加载表格数据
getHead("selectInvProduct", "1").then((re) => {
// 处理返回的数据
this.tableObj = re.data;
this.tableHeader = re.data.tableList;
this.queryList = re.data.queryList;
this.fromList = re.data.fromList;
this.getList();
});
}
,
}
;
</script>
<style type="text/scss" lang="scss">
</style>