|
|
|
@ -5,7 +5,8 @@
|
|
|
|
|
<el-form-item label="来源单据号:" prop="code">
|
|
|
|
|
<el-input style="width: 90%" size="small" placeholder="请输入来源单据号"
|
|
|
|
|
disabled
|
|
|
|
|
v-model.trim="generateOrderDate.billNo"></el-input>
|
|
|
|
|
v-model.trim="generateOrderDate.billNo"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
@ -59,33 +60,34 @@
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row type="flex">
|
|
|
|
|
<el-form-item
|
|
|
|
|
prop="fromCorp"
|
|
|
|
|
label="往来信息:">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="generateOrderDate.fromCorp"
|
|
|
|
|
filterable
|
|
|
|
|
remote
|
|
|
|
|
clearable
|
|
|
|
|
reserve-keyword
|
|
|
|
|
style="width: 90%"
|
|
|
|
|
placeholder="请输入往来信息"
|
|
|
|
|
:remote-method="findMethod"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
:disabled="corpOrderIdDisabled"
|
|
|
|
|
prop="fromCorp"
|
|
|
|
|
label="往来信息:"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in fromOptions"
|
|
|
|
|
:key="item.erpId"
|
|
|
|
|
:label="item.name"
|
|
|
|
|
:value="item.erpId"
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="generateOrderDate.fromCorp"
|
|
|
|
|
filterable
|
|
|
|
|
remote
|
|
|
|
|
clearable
|
|
|
|
|
reserve-keyword
|
|
|
|
|
style="width: 90%"
|
|
|
|
|
placeholder="请输入往来信息"
|
|
|
|
|
:remote-method="findMethod"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
:disabled="corpOrderIdDisabled"
|
|
|
|
|
>
|
|
|
|
|
<span style="float: left">{{ item.name }}</span>
|
|
|
|
|
</el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in fromOptions"
|
|
|
|
|
:key="item.erpId"
|
|
|
|
|
:label="item.name"
|
|
|
|
|
:value="item.erpId"
|
|
|
|
|
>
|
|
|
|
|
<span style="float: left">{{ item.name }}</span>
|
|
|
|
|
</el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<div style='text-align: center; margin-bottom: 10px;'>
|
|
|
|
|
<div style="text-align: center; margin-bottom: 10px;">
|
|
|
|
|
<el-button type="primary" @click="generateOrder">提交</el-button>
|
|
|
|
|
<el-button type="primary" @click="closeAddDialog">取消</el-button>
|
|
|
|
|
</div>
|
|
|
|
@ -94,10 +96,10 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {generateOrder} from "@/api/thrsys/thrInvOrder";
|
|
|
|
|
import { generateOrder,generateGhOrder } from '@/api/thrsys/thrInvOrder'
|
|
|
|
|
import { findByFrom, findInvByUser } from '../../../api/system/invSubWarehouse'
|
|
|
|
|
import { parseTime } from '../../../utils/coTools'
|
|
|
|
|
import {findByInvUser, getBusTypeList} from "@/api/basic/busType";
|
|
|
|
|
import { findByInvUser, getBusTypeList } from '@/api/basic/busType'
|
|
|
|
|
import { getBasicUnitMaintains } from '../../../api/basic/basicUnitMaintain'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
@ -105,15 +107,19 @@ export default {
|
|
|
|
|
props: {
|
|
|
|
|
generateOrderDate: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
closeAddDialog: {
|
|
|
|
|
type: Function,
|
|
|
|
|
required: true,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
originTypes: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
sourceType: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
@ -146,133 +152,149 @@ export default {
|
|
|
|
|
corpType: 0,
|
|
|
|
|
genUnit: false,
|
|
|
|
|
checkWebNew: null,
|
|
|
|
|
mainAction: null,
|
|
|
|
|
mainAction: null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
methods:{
|
|
|
|
|
methods: {
|
|
|
|
|
//提交
|
|
|
|
|
generateOrder(){
|
|
|
|
|
generateOrder(this.generateOrderDate).then((res) => {
|
|
|
|
|
if (res.code == 20000) {
|
|
|
|
|
this.$message.success("生成成功!");
|
|
|
|
|
//清空弹窗数据
|
|
|
|
|
this.$emit("closeAddDialog", true);
|
|
|
|
|
this.closeAddDialog(true);
|
|
|
|
|
} else
|
|
|
|
|
this.$message.error(res.message);
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
this.$message.error(error.message);
|
|
|
|
|
})
|
|
|
|
|
generateOrder() {
|
|
|
|
|
if (this.sourceType === 1 || this.sourceType === 2 ){
|
|
|
|
|
generateOrder(this.generateOrderDate).then((res) => {
|
|
|
|
|
if (res.code == 20000) {
|
|
|
|
|
this.$message.success('生成成功!')
|
|
|
|
|
//清空弹窗数据
|
|
|
|
|
this.$emit('closeAddDialog', true)
|
|
|
|
|
this.closeAddDialog(true)
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.message)
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
this.$message.error(error.message)
|
|
|
|
|
})
|
|
|
|
|
}else if (this.sourceType === 3){
|
|
|
|
|
generateGhOrder(this.generateOrderDate).then((res) => {
|
|
|
|
|
if (res.code == 20000) {
|
|
|
|
|
this.$message.success('生成成功!')
|
|
|
|
|
//清空弹窗数据
|
|
|
|
|
this.$emit('closeAddDialog', true)
|
|
|
|
|
this.closeAddDialog(true)
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.message)
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
this.$message.error(error.message)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//获取用户仓库列表
|
|
|
|
|
findInvListByUser() {
|
|
|
|
|
this.curInvOptions = [];
|
|
|
|
|
this.curInvOptions = []
|
|
|
|
|
findInvByUser()
|
|
|
|
|
.then((response) => {
|
|
|
|
|
this.curInvOptions = response.data || [];
|
|
|
|
|
this.curInvOptions = response.data || []
|
|
|
|
|
if (
|
|
|
|
|
this.curInvOptions != null &&
|
|
|
|
|
this.curInvOptions.length > 0 &&
|
|
|
|
|
this.generateOrderDate.invWarehouseCode == null
|
|
|
|
|
) {
|
|
|
|
|
//this.orderFormData.invCode = this.curInvOptions[0].code;
|
|
|
|
|
this.getBusTypeByInv();
|
|
|
|
|
this.getBusTypeByInv()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
//仓库改变
|
|
|
|
|
changeInv(row) {
|
|
|
|
|
this.generateOrderDate.action = null;
|
|
|
|
|
this.generateOrderDate.checkPreInOrders = null;
|
|
|
|
|
this.checkPreInArray = [];
|
|
|
|
|
this.generateOrderDate.action = null
|
|
|
|
|
this.generateOrderDate.checkPreInOrders = null
|
|
|
|
|
this.checkPreInArray = []
|
|
|
|
|
if (this.documentShow) {
|
|
|
|
|
this.documentShow = false;
|
|
|
|
|
this.documentShow = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.curSpaceShow = false;
|
|
|
|
|
this.preInSpaceShow = false;
|
|
|
|
|
this.preSpaceShow = false;
|
|
|
|
|
this.generateOrderDate.curSpaceCode = false;
|
|
|
|
|
this.generateOrderDate.checkPreInSpaceCode = false;
|
|
|
|
|
this.generateOrderDate.preCurSpaceCode = false;
|
|
|
|
|
this.getBusTypeByInv();
|
|
|
|
|
this.curSpaceShow = false
|
|
|
|
|
this.preInSpaceShow = false
|
|
|
|
|
this.preSpaceShow = false
|
|
|
|
|
this.generateOrderDate.curSpaceCode = false
|
|
|
|
|
this.generateOrderDate.checkPreInSpaceCode = false
|
|
|
|
|
this.generateOrderDate.preCurSpaceCode = false
|
|
|
|
|
this.getBusTypeByInv()
|
|
|
|
|
},
|
|
|
|
|
//单据类型改变
|
|
|
|
|
actionChange(item) {
|
|
|
|
|
this.generateOrderDate.checkPreInOption = null;
|
|
|
|
|
this.generateOrderDate.checkPreInOrders = null;
|
|
|
|
|
this.checkPreInArray = [];
|
|
|
|
|
this.curAction = this.getActionItem(item);
|
|
|
|
|
this.bizShow = false;
|
|
|
|
|
this.generateOrderDate.checkPreInOption = null
|
|
|
|
|
this.generateOrderDate.checkPreInOrders = null
|
|
|
|
|
this.checkPreInArray = []
|
|
|
|
|
this.curAction = this.getActionItem(item)
|
|
|
|
|
this.bizShow = false
|
|
|
|
|
//2. 切换往来仓库
|
|
|
|
|
this.generateOrderDate.fromInvCode = null;
|
|
|
|
|
this.findMethod();
|
|
|
|
|
this.generateOrderDate.fromInvCode = null
|
|
|
|
|
this.findMethod()
|
|
|
|
|
},
|
|
|
|
|
//根据仓库,用户获取单据类型
|
|
|
|
|
getBusTypeByInv() {
|
|
|
|
|
let query = {
|
|
|
|
|
code: this.generateOrderDate.invCode,
|
|
|
|
|
editType: 2 //可编辑
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
findByInvUser(query)
|
|
|
|
|
.then((response) => {
|
|
|
|
|
this.busTypeOptions = response.data || [];
|
|
|
|
|
this.busTypeOptions = response.data || []
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
//获取当前单据类型
|
|
|
|
|
getActionItem(action) {
|
|
|
|
|
for (let i = 0; i < this.busTypeOptions.length; i++) {
|
|
|
|
|
if (this.busTypeOptions[i].action == action) {
|
|
|
|
|
return this.busTypeOptions[i];
|
|
|
|
|
return this.busTypeOptions[i]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//获取往来单位候选列表
|
|
|
|
|
findMethod(query) {
|
|
|
|
|
this.fromOptions = [];
|
|
|
|
|
this.fromOptions = []
|
|
|
|
|
let cQuery = {
|
|
|
|
|
key: query,
|
|
|
|
|
corpType: 4,
|
|
|
|
|
outType: null,
|
|
|
|
|
page: 1,
|
|
|
|
|
limit: 20,
|
|
|
|
|
};
|
|
|
|
|
limit: 20
|
|
|
|
|
}
|
|
|
|
|
getBasicUnitMaintains(cQuery)
|
|
|
|
|
.then((response) => {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
this.fromOptions = response.data.list || [];
|
|
|
|
|
this.loading = false
|
|
|
|
|
this.fromOptions = response.data.list || []
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
this.loading = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
//页面初始化
|
|
|
|
|
this.generateOrderDate.code = "";
|
|
|
|
|
this.generateOrderDate.orderType = this.viewType;
|
|
|
|
|
//新增页面
|
|
|
|
|
this.corpOrderIdDisabled = false;
|
|
|
|
|
let date = new Date();
|
|
|
|
|
this.generateOrderDate.createTime = parseTime(
|
|
|
|
|
date,
|
|
|
|
|
"{y}-{m}-{d} {h}:{i}:{s}"
|
|
|
|
|
);
|
|
|
|
|
this.generateOrderDate.corpOrderId =
|
|
|
|
|
parseTime(date, "{y}{m}{d}{h}{i}{s}") +
|
|
|
|
|
Math.ceil(Math.random() * 89 + 10);
|
|
|
|
|
this.generateOrderDate.deptCode = this.$store.getters.deptCode;
|
|
|
|
|
this.generateOrderDate.invCode = this.$store.getters.locInvCode;
|
|
|
|
|
this.findInvListByUser();
|
|
|
|
|
this.generateOrderDate.code = ''
|
|
|
|
|
this.generateOrderDate.orderType = this.viewType
|
|
|
|
|
//新增页面
|
|
|
|
|
this.corpOrderIdDisabled = false
|
|
|
|
|
let date = new Date()
|
|
|
|
|
this.generateOrderDate.createTime = parseTime(
|
|
|
|
|
date,
|
|
|
|
|
'{y}-{m}-{d} {h}:{i}:{s}'
|
|
|
|
|
)
|
|
|
|
|
this.generateOrderDate.corpOrderId =
|
|
|
|
|
parseTime(date, '{y}{m}{d}{h}{i}{s}') +
|
|
|
|
|
Math.ceil(Math.random() * 89 + 10)
|
|
|
|
|
this.generateOrderDate.deptCode = this.$store.getters.deptCode
|
|
|
|
|
this.generateOrderDate.invCode = this.$store.getters.locInvCode
|
|
|
|
|
this.findInvListByUser()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|