单据复制功能

prod
anthonywj 2 years ago
parent f51139f3d0
commit 719b2e3867

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

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

Loading…
Cancel
Save