单据复制功能

prod
anthonywj 2 years ago
parent f51139f3d0
commit 719b2e3867

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<el-form :model="formData" :rules="formRules" ref="dataForm"> <el-form :model="formData" :rules="formRules" ref="dataForm" label-width="120px">
<el-button-group style="display: flex;margin: -40px 0 20px 80%; height: 35px"> <el-button-group style="display: flex;margin: -40px 0 20px 80%; height: 35px">
@ -13,30 +13,20 @@
</el-button-group> </el-button-group>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="3"> <el-col :span="11">
<div class="ao-text"> <el-form-item prop="corpOrderId" label="入库单号">
<span>入库单号</span> <el-input v-model="formData.corpOrderId" auto-complete="off" style="width: 90%"
</div>
</el-col>
<el-col :span="8">
<el-form-item prop="corpOrderId">
<el-input v-model="formData.corpOrderId" auto-complete="off"
:disabled="true"></el-input> :disabled="true"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="11">
<div class="ao-text"> <el-form-item prop="actDate" label="单据时间">
<span>单据时间</span>
</div>
</el-col>
<el-col :span="8">
<el-form-item prop="actDate">
<el-date-picker <el-date-picker
v-model="formData.actDate" v-model="formData.actDate"
type="datetime" type="datetime"
placeholder="日期" placeholder="日期"
:disabled="true" :disabled="true"
style="width: 100%; " style="width: 90%; "
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -44,17 +34,12 @@
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="3"> <el-col :span="11">
<div class="ao-text"> <el-form-item class="query-form-item" prop="billType" label="单据类型">
<span>单据类型</span> <el-select v-model="formData.action" placeholder="请选择单据类型" style="width: 90%"
</div>
</el-col>
<el-col :span="8">
<el-form-item class="query-form-item" prop="billType">
<el-select v-model="formData.action" placeholder="请选择单据类型"
@change="actionChange"> @change="actionChange">
<el-option <el-option
v-for="item in busTypes" v-for="item in busTypeOptions"
:key="item.name" :key="item.name"
:label="item.name" :label="item.name"
:value="item.action"> :value="item.action">
@ -64,17 +49,12 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="3">
<div class="ao-text">
<span>当前仓库</span>
</div>
</el-col>
<el-col :span="8"> <el-col :span="11">
<el-form-item prop="locStorageCode"> <el-form-item prop="locStorageCode" label="当前仓库">
<el-select v-model="formData.locStorageCode" placeholder="当前仓库信息" @change="locCHange"> <el-select v-model="formData.invCode" placeholder="当前仓库信息" @change="locCHange" style="width: 90%">
<el-option <el-option
v-for="item in storageList" v-for="item in curInvOptions"
:key="item.name" :key="item.name"
:label="item.name" :label="item.name"
:value="item.code"> :value="item.code">
@ -87,104 +67,68 @@
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="11">
<el-form-item class="query-form-item" prop="fromCorp" label="往来信息"
<el-col :span="3"> v-if="curAction.corpType === 0 || curAction.corpType === 2 || (curAction.corpType === 1 && !curAction.genUnit)">
<div class="ao-text">
<span>往来信息</span>
</div>
</el-col>
<el-col :span="8">
<el-form-item class="query-form-item" prop="fromCorp"
v-if="curAction.corpType ==0 ">
<el-select <el-select
v-model="formData.fromCorp" v-model="formData.fromCorp"
filterable filterable
remote remote
clearable="true" clearable="true"
style="width: 90%"
reserve-keyword reserve-keyword
placeholder="请输入往来单位" placeholder="请输入往来单位"
:remote-method="findMethod" :remote-method="findMethod"
:loading="loading" :loading="loading"
@change="unitChange"
> >
<el-option <el-option
v-for="item in fromOptions" v-for="item in fromOptions"
:key="item.name" :key="item.erpId"
:label="item.name" :label="item.name"
:value="item" :value="item.erpId"
> >
<span style="float: left">{{ item.name }}</span> <span style="float: left">{{ item.name }}</span>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item class="query-form-item" prop="fromCorp" <el-form-item class="query-form-item" prop="fromCorp" label="往来信息"
v-if="curAction.corpType ==1"> v-if="curAction.corpType ==3">
<el-select <el-select v-model="formData.fromInvCode" placeholder="请选择往来仓库信息" clearable="true" style="width: 90%"
v-model="formData.fromCorp"
filterable
remote
clearable="true"
reserve-keyword
placeholder="请输入仓库信息"
:remote-method="findStorageMethod"
:loading="loading"
@change="storageChange"
>
<el-option
v-for="item in fromStorageOptions"
:key="item.value"
:label="item.code"
:value="item">
<span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.code }}</span>
</el-option>
</el-select>
<el-select v-model="formData.fromSubInvCode" placeholder="请选择分库" clearable="true"
> >
<el-option <el-option
v-for="item in fromSubStorageOptions" v-for="item in fromInvOptions"
:key="item.code" :key="item.code"
:label="item.name" :label="item.name"
:value="item.code"> :value="item.code">
<span style="float: left">{{ item.name }}</span> <span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.code }}</span> <span style="float: right; color: #8492a6; font-size: 13px">{{
<!--<span style="float: right; color: #8492a6; font-size: 13px">{{ item.action }}</span>--> item.code
}}</span>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item class="query-form-item" prop="fromCorp" <el-form-item prop="fromCorp" label="往来信息:"
v-if="curAction.corpType ==2"> v-if="curAction.corpType ==1 && curAction.genUnit">
<el-input v-model="formData.fromCorp" auto-complete="off" <el-input v-model="formData.fromCorp" auto-complete="off"
clearable clearable
style="width: 90%"
placeholder="请输入病人住院号" placeholder="请输入病人住院号"
></el-input> ></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="11">
<el-form-item prop="remark" label="备注:">
<el-col :span="3"> <el-input v-model="formData.remark" auto-complete="off"
<div class="ao-text"> clearable
<span>当前分库</span> style="width: 90%"
</div> placeholder="请输入备注信息"
</el-col> ></el-input>
<el-col :span="8">
<el-form-item prop="invWarehouseCode">
<el-select v-model="formData.invWarehouseCode" placeholder="当前分库信息"
>
<el-option
v-for="item in subInvList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-table v-loading="detailLoading" <el-table v-loading="detailLoading"
@ -192,6 +136,7 @@
border border
@selection-change="changeFun" @selection-change="changeFun"
style="width: 100%; margin-top: 20px;"> style="width: 100%; margin-top: 20px;">
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column <el-table-column
label="物资名称" label="物资名称"
prop="coName" prop="coName"
@ -255,9 +200,11 @@ import {getLocalJoinByUser} from "@/api/basic/busLocalType";
import {submitOrderWeb} from "@/api/inout/order"; import {submitOrderWeb} from "@/api/inout/order";
import {orderChange} from "@/api/inout/order"; import {orderChange} from "@/api/inout/order";
import {getBizDetailList} from "@/api/inout/orderDetailBiz"; import {getBizDetailList} from "@/api/inout/orderDetailBiz";
import {filterSubByInv} from "@/api/system/invSubWarehouse"; import {filterSubByInv, findInvByUser} from "@/api/system/invSubWarehouse";
import {isBlank} from "@/utils/strUtil"; import {isBlank} from "@/utils/strUtil";
import {convertDate} from "@/utils/date" import {convertDate} from "@/utils/date"
import {findByInvUser} from "@/api/basic/busType";
import {stockOrderChange} from "@/api/inout/stockOrder";
export default { export default {
name: "DialogcChangeNewOrder", name: "DialogcChangeNewOrder",
@ -289,8 +236,13 @@ export default {
invWarehouseCode: null, invWarehouseCode: null,
mainAction: null mainAction: null
}, },
fromStorageOptions: [],
fromSubStorageOptions: [],
curInvOptions: [],
busTypeOptions: [],
fromInvOptions: [],
curAction: { curAction: {
corpType: 0, corpType: 0,
genUnit: false, genUnit: false,
@ -312,20 +264,16 @@ export default {
this.$message.warning("请选择单据类型!"); this.$message.warning("请选择单据类型!");
return; return;
} }
if (this.$isBlank(this.formData.locStorageCode)) { if ((this.curAction.corpType === 0 || this.curAction.corpType === 2 || (this.curAction.corpType === 1 && !this.curAction.genUnit)) && this.$isBlank(this.formData.fromCorp)) {
this.$message.error('当前仓库不能为空'); this.$message.error('当前往来信息不能为空');
return;
}
if (this.$isBlank(this.formData.fromCorp)) {
this.$message.error('当前往来单位不能为空');
return; return;
} }
if (this.$isBlank(this.formData.invWarehouseCode)) { if (this.$isBlank(this.formData.invCode)) {
this.$message.error("当前分库不能为空"); this.$message.error("当前分库不能为空");
return; return;
} }
if (this.curAction.corpType === 1 && this.$isBlank(this.formData.fromSubInvCode)) { if (this.curAction.corpType === 1 && this.$isBlank(this.formData.fromInvCode)) {
this.$message.error('往来单位库不能为空'); this.$message.error('往来单位库不能为空');
return; return;
} }
if (this.detailList.length == 0) { if (this.detailList.length == 0) {
@ -333,10 +281,10 @@ export default {
return; return;
} }
if (this.formData.locStorageCode === this.formData.fromCorp || this.formData.invWarehouseCode === this.formData.fromSubInvCode) { // if (this.formData.locStorageCode === this.formData.fromCorp || this.formData.invWarehouseCode === this.formData.fromSubInvCode) {
this.$message.error("当前仓库和往来仓库不能相同!"); // this.$message.error("");
return; // return;
} // }
let products = []; let products = [];
this.detailList.forEach(item => { this.detailList.forEach(item => {
@ -353,15 +301,12 @@ export default {
} }
}) })
let tQuery = { let tQuery = {
stockOrderId: this.curRow.id, orderId: this.curRow.billNo,
locStorageCode: this.formData.locStorageCode, corpOrderId: this.curRow.corpOrderId,
action: this.formData.action,
mainAction: this.formData.mainAction,
fromCorp: this.formData.fromCorp, fromCorp: this.formData.fromCorp,
fromCorpId: this.formData.fromCorpId, action: this.formData.action,
invWarehouseCode: this.formData.invWarehouseCode, fromInvCode: this.formData.fromInvCode,
fromSubInvCode: this.formData.fromSubInvCode, invCode: this.formData.invCode,
products: products products: products
}; };
stockOrderChange(tQuery) stockOrderChange(tQuery)
@ -377,13 +322,39 @@ export default {
}, },
locCHange() { //
findInvListByUser() {
this.curInvOptions = [];
findInvByUser()
.then(response => {
this.curInvOptions = response.data || [];
if (this.curInvOptions != null && this.curInvOptions.length > 0 && this.formData.invWarehouseCode == null) {
this.formData.invWarehouseCode = this.curInvOptions[0].code;
this.getBusTypeByInv()
}
})
.catch(() => {
});
},
if (this.$isNotBlank(this.formData.invWarehouseCode)) {
this.formData.invWarehouseCode = ""; //,
} getBusTypeByInv() {
this.findStorageMethod(); let query = {
this.findSubInvByInv(this.formData.locStorageCode); code: this.formData.invCode,
};
findByInvUser(query)
.then((response) => {
this.busTypeOptions = response.data || [];
})
.catch(() => {
});
},
locCHange() {
this.formData.action = null;
this.getBusTypeByInv();
}, },
@ -414,65 +385,33 @@ export default {
.catch(() => { .catch(() => {
}); });
}, },
findSubStorageMethod() {
let cQuery = {
pcode: this.formData.fromCorpId,
filter: 2,
};
filterSubByInv(cQuery)
.then((response) => {
this.fromSubStorageOptions = response.data || [];
})
.catch(() => {
});
},
findMethod(query) { findMethod(query) {
this.fromOptions = []; this.fromOptions = [];
let cQuery = { let cQuery = {
key: query, key: query,
corpType: null, corpType: null,
outType: null, outType: null,
page: 1,
limit: 20
}; };
if (this.curAction.corpType == 3) {// if (this.curAction.corpType == 3) {//
cQuery.corpType = 4; cQuery.corpType = 3;
this.formData.fromCorpId = this.curAction.defaultUnit; } else if (this.curAction.corpType == 2)//
} else if (this.curAction.corpType == 2)//
{ {
cQuery.corpType = 4; cQuery.corpType = 2;
cQuery.outType = 2;
} else if (this.curAction.corpType == 0) { } else if (this.curAction.corpType == 0) {
cQuery.corpType = 2; cQuery.corpType = 2;
} else return; } else return;
getBasicUnitMaintains(cQuery) getBasicUnitMaintains(cQuery)
.then((response) => { .then((response) => {
this.loading = false; this.loading = false;
this.fromOptions = response.data.page.list || []; this.fromOptions = response.data.list || [];
if (this.curAction.corpType == 3) {
for (let i = 0; i < this.fromOptions.length; i++) {
if (this.fromOptions[i].erpId == this.formData.fromCorpId) {
this.formData.fromCorp = this.fromOptions[i].name;
}
}
}
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false;
}); });
}, },
storageChange(row) {
this.formData.fromCorpId = row.code;
this.formData.fromCorp = row.name;
if (isBlank(this.formData.fromCorp)) {
this.fromSubStorageOptions = [];
this.formData.fromSubInvCode = null;
} else {
this.findSubStorageMethod();
}
},
unitChange(row) { unitChange(row) {
this.formData.fromCorpId = row.erpId; this.formData.fromCorpId = row.erpId;
@ -480,14 +419,21 @@ export default {
}, },
actionChange(item) { actionChange(item) {
this.curAction = this.getActionItem(item); this.curAction = this.getActionItem(item);
this.formData.fromCorp = null; if (this.curAction.corpType == 0 || this.curAction.corpType == 2 || (this.curAction.corpType == 1 && !this.curAction.genUnit)) {
this.formData.fromSubInvCode = null; //1.
this.findMethod(); this.orderFormData.fromCorp = null;
this.findMethod();
} else if (this.curAction.corpType == 3) {
//2.
this.orderFormData.fromInvCode = null;
this.findFromInvList();
}
}, },
getActionItem(action) { getActionItem(action) {
for (let i = 0; i < this.busTypes.length; i++) { for (let i = 0; i < this.busTypeOptions.length; i++) {
if (this.busTypes[i].action === action) { if (this.busTypeOptions[i].action == action) {
return this.busTypes[i]; return this.busTypeOptions[i];
} }
} }
}, },
@ -499,27 +445,8 @@ export default {
_this.multipId.push(item.id); _this.multipId.push(item.id);
}) })
}, },
getBusType() {
let query = {
enabled: true,
};
getLocalJoinByUser(query)
.then((response) => {
this.busTypes = response.data.list || [];
this.filterQuery.billAction = this.busTypes[0].action;
})
.catch(() => {
});
},
getStorage() {
this.storageList = [];
filterAllByUser()
.then((response) => {
this.storageList = response.data || [];
})
.catch(() => {
});
},
getStockOrderDetailList(orderId) { getStockOrderDetailList(orderId) {
let query = { let query = {
orderIdFk: orderId orderIdFk: orderId
@ -544,13 +471,12 @@ export default {
} }
}, },
created() { created() {
if (this.$isBlank(this.formData.corpOrderId)) { // if (this.$isBlank(this.formData.corpOrderId)) {
let date = new Date(); // let date = new Date();
this.formData.corpOrderId = parseTime(date, '{y}{m}{d}{h}{i}{s}') + Math.ceil(Math.random() * 89 + 10); // this.formData.corpOrderId = parseTime(date, '{y}{m}{d}{h}{i}{s}') + Math.ceil(Math.random() * 89 + 10);
} // }
this.getBusType(); this.findInvListByUser();
this.getStorage(); this.getStockOrderDetailList(this.curRow.billNo);
this.getStockOrderDetailList(this.curRow.id);
} }
} }
</script> </script>

@ -822,7 +822,7 @@ export default {
}; };
}, },
components: { components: {
IoEditOrderCodeDetail,DialogcChangeNewOrder IoEditOrderCodeDetail, DialogcChangeNewOrder
}, },
created() { created() {

Loading…
Cancel
Save