|
@@ -20,22 +20,21 @@
|
|
|
<el-input v-model="deptBudgetList.billNo" placeholder="请输入任务编号" maxlength="20" size="small" disabled>
|
|
|
</el-input>
|
|
|
</el-col>
|
|
|
-
|
|
|
</el-form-item>
|
|
|
<el-form-item label="名头" prop="renown" class="forlist">
|
|
|
- <el-select v-model="deptBudgetList.renown" placeholder="请选择名头">
|
|
|
- <el-option :label="item.compName" :key="item.compId" :value="item.compId"
|
|
|
- v-for="(item,index) in compOptionList"></el-option>
|
|
|
+ <el-select v-model="deptBudgetList.renown" placeholder="请选择名头" @change="changeCompOptionList">
|
|
|
+ <el-option :label="item.compName" :key="index" :value="item.compId" v-for="(item,index) in compOptionList">
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="仓库名称" prop="warehouseName" class="forlist">
|
|
|
<el-select v-model="deptBudgetList.warehouseName" filterable placeholder="请选择仓库" @change="changeWarehouse">
|
|
|
- <el-option v-for="item in warehouseList" :key='item.id' :label="item.warehouseName" :value="item.id">
|
|
|
+ <el-option v-for="(item,index) in warehouseList" :key='index' :label="item.warehouseName" :value="item.id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="仓位号" prop="warehouseNo" class="forlist">
|
|
|
- <el-select v-model="deptBudgetList.warehouseNo" placeholder="请选择仓位号">
|
|
|
+ <el-select v-model="deptBudgetList.warehouseNo" placeholder="请选择仓位号" @change="changeWarehouseNo">
|
|
|
<el-option :label="item.binNumber" :value="item.id" v-for="(item,index) in cwNumberList" :key='index'>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
@@ -44,16 +43,17 @@
|
|
|
<el-input disabled v-model="deptBudgetList.warehouseAddress" placeholder="请输入仓库地址" size="small"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="goodsName" label="货名">
|
|
|
- <el-select v-model="deptBudgetList.goodsName" placeholder="请选择货名">
|
|
|
- <el-option v-for="item in goodsList" :key='item.id' :label="item.goodsName" :value="item.id"></el-option>
|
|
|
+ <el-select v-model="deptBudgetList.goodsName" placeholder="请选择货名" @change="changeGoodsName">
|
|
|
+ <el-option v-for="(item,index) in goodsList" :key='index' :label="item.goodsName" :value="item.id">
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="goodsName" label="品级">
|
|
|
<el-select v-model="deptBudgetList.grade" placeholder="请选择品级">
|
|
|
- <el-option label="一等" value="one"></el-option>
|
|
|
- <el-option label="二等" value="two"></el-option>
|
|
|
- <el-option label="三等" value="three"></el-option>
|
|
|
- <el-option label="等外" value="out"></el-option>
|
|
|
+ <el-option label="一等" value="一等"></el-option>
|
|
|
+ <el-option label="二等" value="二等"></el-option>
|
|
|
+ <el-option label="三等" value="三等"></el-option>
|
|
|
+ <el-option label="等外" value="等外"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="现有储量" prop="nowWeight" class="forlist">
|
|
@@ -63,13 +63,14 @@
|
|
|
<el-input disabled v-model="deptBudgetList.useWeight" placeholder="请输入可用储量" size="small"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="本单重量(吨)" prop="weight" class="forlist">
|
|
|
- <el-input v-model="deptBudgetList.weight" placeholder="输入本次仓单申请所需的重量" size="small"></el-input>
|
|
|
+ <el-input v-model="deptBudgetList.weight" placeholder="输入本次仓单申请所需的重量" size="small" @input='inputChange'>
|
|
|
+ </el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="单价(元/吨)" prop="unitPrice" class="forlist">
|
|
|
- <el-input v-model="deptBudgetList.unitPrice" placeholder="输入粮食单价" size="small"></el-input>
|
|
|
+ <el-input v-model="deptBudgetList.unitPrice" placeholder="输入粮食单价" size="small" @input='inputChange'></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="总价值(元)" prop="totalValue" class="forlist">
|
|
|
- <el-input v-model="deptBudgetList.totalValue" placeholder="自动计算,不可编辑" size="small"></el-input>
|
|
|
+ <el-input disabled v-model="deptBudgetList.totalValue" placeholder="自动计算,不可编辑" size="small"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="申请比例(%)" prop="applicationProportion" class="forlist">
|
|
|
<el-input v-model="deptBudgetList.applicationProportion" placeholder="输入申请比例" size="small"></el-input>
|
|
@@ -83,14 +84,14 @@
|
|
|
<div>外审部门</div>
|
|
|
<el-form-item prop="bank" label="银行">
|
|
|
<el-select v-model="deptBudgetList.bank" placeholder="请选择银行">
|
|
|
- <el-option label="中国银行" value="bank"></el-option>
|
|
|
- <el-option label="营口银行" value="bank"></el-option>
|
|
|
+ <el-option label="中国银行" value="bank1"></el-option>
|
|
|
+ <el-option label="营口银行" value="bank2"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="第三方" span="1" prop="three" class="forlist">
|
|
|
<el-select v-model="deptBudgetList.three" placeholder="请选择银行">
|
|
|
- <el-option label="第三方1" value="bank"></el-option>
|
|
|
- <el-option label="第三方2" value="bank"></el-option>
|
|
|
+ <el-option label="第三方1" value="three1"></el-option>
|
|
|
+ <el-option label="第三方2" value="three2"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<div>
|
|
@@ -123,32 +124,59 @@
|
|
|
deptBudgetList: {
|
|
|
warehouseName: '',
|
|
|
warehouseNo: '',
|
|
|
- compId:sessionStorage.getItem('ws-pf_compId')
|
|
|
+ compId: '',
|
|
|
+ renown: '',
|
|
|
+ grade: '',
|
|
|
+ bank: '',
|
|
|
+ three: ''
|
|
|
},
|
|
|
size: 10,
|
|
|
- compId: sessionStorage.getItem('ws-pf_compId'),
|
|
|
+ compId: '',
|
|
|
warehouseList: [],
|
|
|
compOptionList: [],
|
|
|
cwNumberList: [],
|
|
|
goodsList: [],
|
|
|
rules: {
|
|
|
- // name: [
|
|
|
- // { required: true, message: '请输入活动名称', trigger: 'blur' },
|
|
|
+ // unitPrice: [
|
|
|
+ // { required: true, message: '单价不能为空!', trigger: 'blur' },
|
|
|
// { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
|
|
|
// ],
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
activated() {
|
|
|
+ this.compId = sessionStorage.getItem('ws-pf_compId')
|
|
|
+ this.deptBudgetList.compId = this.compId
|
|
|
+ this.getcompList()
|
|
|
this.getList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ inputChange(e) {
|
|
|
+ if (this.deptBudgetList.unitPrice && this.deptBudgetList.weight) {
|
|
|
+ this.deptBudgetList.totalValue = this.deptBudgetList.unitPrice * this.deptBudgetList.weight
|
|
|
+ }
|
|
|
+ console.log(e)
|
|
|
+ },
|
|
|
getList() {
|
|
|
this.deptBudgetList.grade = '二等'
|
|
|
// 获取业务编号
|
|
|
getbillno().toPromise().then((response) => {
|
|
|
this.deptBudgetList.billNo = response
|
|
|
})
|
|
|
+ this.getWarehouse()
|
|
|
+ },
|
|
|
+ getcompList() {
|
|
|
+ //获取公司名头
|
|
|
+ getcompList()
|
|
|
+ .toPromise()
|
|
|
+ .then((res) => {
|
|
|
+ console.log('公司下拉列表数据', res)
|
|
|
+ this.compOptionList = res
|
|
|
+ this.deptBudgetList.renown = res[0].compName
|
|
|
+ })
|
|
|
+ .catch((err) => {})
|
|
|
+ },
|
|
|
+ getWarehouse() {
|
|
|
//获取仓库
|
|
|
selectWarehouseSelf({
|
|
|
compId: this.compId
|
|
@@ -158,63 +186,193 @@
|
|
|
this.warehouseList = response
|
|
|
this.deptBudgetList.warehouseName = response[0].warehouseName
|
|
|
this.cwNumberList = response[0].positionInfos
|
|
|
- this.deptBudgetList.warehouseNo = response[0].positionInfos[0].binNumber
|
|
|
+ this.deptBudgetList.warehouseNo = response[0].positionInfos.length != 0 ? response[0].positionInfos[0]
|
|
|
+ .binNumber : ''
|
|
|
+ this.deptBudgetList.baseId = response[0].positionInfos.length != 0 ? response[0].positionInfos[0]
|
|
|
+ .baseId : ''
|
|
|
this.deptBudgetList.warehouseAddress = response[0].warehousePrivate + response[0].warehouseCity +
|
|
|
response[0].warehouseArea + response[0].detailedAddress
|
|
|
this.goodsList = response[0].goodsNameInfos
|
|
|
- this.deptBudgetList.nowWeight = response[0].goodsNameInfos[0].storage
|
|
|
+ this.deptBudgetList.nowWeight = response[0].goodsNameInfos.length != 0 ? response[0].goodsNameInfos[0]
|
|
|
+ .storage : ''
|
|
|
// this.deptBudgetList.useWeight = response[0].goodsNameInfos[0].useWeight
|
|
|
this.deptBudgetList.useWeight = '10'
|
|
|
- this.deptBudgetList.goodsName = response[0].goodsNameInfos[0].goodsName
|
|
|
+ this.deptBudgetList.goodsName = response[0].goodsNameInfos.length != 0 ? response[0].goodsNameInfos[0]
|
|
|
+ .goodsName : ''
|
|
|
+ this.deptBudgetList.warehouseId = response[0].id
|
|
|
+ if (!this.deptBudgetList.renown) this.deptBudgetList.renown = this.compOptionList[0].compName
|
|
|
+ if (!this.deptBudgetList.renownId) this.deptBudgetList.renownId = this.compOptionList[0].compId
|
|
|
+ this.deptBudgetList.bankId = 'bankId'
|
|
|
+ this.deptBudgetList.threeId = 'threeId'
|
|
|
+ this.deptBudgetList.warehouseNoId = response[0].positionInfos.length != 0 ? response[0].positionInfos[0]
|
|
|
+ .id : ''
|
|
|
+ this.deptBudgetList.goodsNameKey = response[0].goodsNameInfos.length != 0 ? response[0].goodsNameInfos[0]
|
|
|
+ .goodsNameKey : ''
|
|
|
})
|
|
|
- //获取公司名头
|
|
|
- getcompList()
|
|
|
- .toPromise()
|
|
|
- .then((res) => {
|
|
|
- console.log('公司下拉列表数据', res)
|
|
|
- this.compOptionList = res
|
|
|
- this.deptBudgetList.renown = res[0].compName
|
|
|
- })
|
|
|
- .catch((err) => {})
|
|
|
+ },
|
|
|
+ //货名切换
|
|
|
+ changeGoodsName(val) {
|
|
|
+ let _data = this.goodsList
|
|
|
+ for (let i = 0; i < _data.length; i++) {
|
|
|
+ if (_data[i].id == val) {
|
|
|
+ this.deptBudgetList.goodsNameKey = _data[i].goodsNameKey
|
|
|
+ this.deptBudgetList.goodsName = _data[i].goodsName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //银行切换
|
|
|
+ changeBank(val) {
|
|
|
+ this.deptBudgetList.bankId = 'changebankId'
|
|
|
+ },
|
|
|
+ //第三方切换
|
|
|
+ changeThree(val) {
|
|
|
+ this.deptBudgetList.threeId = 'changethreeId'
|
|
|
+ },
|
|
|
+ //仓位号切换
|
|
|
+ changeWarehouseNo(val) {
|
|
|
+ let _data = this.cwNumberList
|
|
|
+ for (let i = 0; i < _data.length; i++) {
|
|
|
+ if (_data[i].id == val) {
|
|
|
+ this.deptBudgetList.warehouseNoId = _data[i].id
|
|
|
+ this.deptBudgetList.warehouseNo = _data[i].binNumber
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 名头切换
|
|
|
+ changeCompOptionList(val) {
|
|
|
+ let _data = this.compOptionList
|
|
|
+ for (let i = 0; i < _data.length; i++) {
|
|
|
+ if (_data[i].compId == val) {
|
|
|
+ this.deptBudgetList.renownId = _data[i].compId
|
|
|
+ this.deptBudgetList.renown = _data[i].compName
|
|
|
+ this.compId = val
|
|
|
+ this.getWarehouse()
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
//仓库切换
|
|
|
- changeWarehouse(val) {debugger
|
|
|
+ changeWarehouse(val) {
|
|
|
console.log('切换后仓库数据', val)
|
|
|
let _data = this.warehouseList
|
|
|
for (let i = 0; i < _data.length; i++) {
|
|
|
if (_data[i].id == val) {
|
|
|
this.deptBudgetList.warehouseName = _data[i].warehouseName
|
|
|
- this.cwNumberList =_data[i].positionInfos.length!=0?_data[i].positionInfos:[]
|
|
|
- this.deptBudgetList.warehouseNo = _data[i].positionInfos.length!=0?_data[i].positionInfos[0].binNumber:''
|
|
|
+ this.cwNumberList = _data[i].positionInfos.length != 0 ? _data[i].positionInfos : []
|
|
|
+ this.deptBudgetList.warehouseNo = _data[i].positionInfos.length != 0 ? _data[i].positionInfos[0].binNumber :
|
|
|
+ ''
|
|
|
this.deptBudgetList.warehouseAddress = _data[i].warehousePrivate + _data[i].warehouseCity +
|
|
|
_data[i].warehouseArea + _data[i].detailedAddress
|
|
|
- this.goodsList =_data[i].goodsNameInfos.length!=0?_data[i].goodsNameInfos:[]
|
|
|
- this.deptBudgetList.nowWeight =_data[i].goodsNameInfos.length!=0?_data[i].goodsNameInfos[0].storage:''
|
|
|
+ this.goodsList = _data[i].goodsNameInfos.length != 0 ? _data[i].goodsNameInfos : []
|
|
|
+ this.deptBudgetList.nowWeight = _data[i].goodsNameInfos.length != 0 ? _data[i].goodsNameInfos[0].storage :
|
|
|
+ ''
|
|
|
// this.deptBudgetList.useWeight =_data[i].goodsNameInfos.length!=0?_data[i].goodsNameInfos[0].useWeight:''
|
|
|
- this.deptBudgetList.useWeight ='10'
|
|
|
- this.deptBudgetList.goodsName = _data[i].goodsNameInfos.length!=0?_data[i].goodsNameInfos[0].goodsName:''
|
|
|
+ this.deptBudgetList.useWeight = '10'
|
|
|
+ this.deptBudgetList.goodsName = _data[i].goodsNameInfos.length != 0 ? _data[i].goodsNameInfos[0].goodsName :
|
|
|
+ ''
|
|
|
+ this.deptBudgetList.warehouseId = _data[i].id
|
|
|
+ this.deptBudgetList.goodsNameKey = _data[i].goodsNameInfos.length != 0 ? _data[i].goodsNameInfos[0]
|
|
|
+ .goodsNameKey : ''
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
inoutput() {
|
|
|
this.$router.push({
|
|
|
- name: 'inOutRecord'
|
|
|
+ name: 'inOutRecord',
|
|
|
+ query: {
|
|
|
+ baseId: this.deptBudgetList.baseId,
|
|
|
+ positionId: this.deptBudgetList.warehouseNoId,
|
|
|
+ warehouseName: this.deptBudgetList.warehouseName,
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
+ validate() {
|
|
|
+ function _Validate(min, max, saveNum, type, inputVal) {
|
|
|
+ let _val1 = inputVal
|
|
|
+ let _pointVal1 = _val1.toString().split('.')[1]
|
|
|
+ if (_pointVal1 == undefined) _pointVal1 = 0
|
|
|
+ if (typeof(_pointVal1) == 'string') _pointVal1 = _pointVal1.length
|
|
|
+ if (_val1 <= max && _val1 >= min && _pointVal1 <= saveNum) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ if (!this.deptBudgetList.weight || _Validate(0, this.deptBudgetList.useWeight, 3, '', this.deptBudgetList
|
|
|
+ .weight)) {
|
|
|
+ if (!this.deptBudgetList.weight) {
|
|
|
+ this.$message.error('本单重量不能为空!');
|
|
|
+ } else {
|
|
|
+ this.$message.error('本单重量输入错误且本单重量不可超过可用重量!');
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!this.deptBudgetList.unitPrice || _Validate(1, 20000, 3, '', this.deptBudgetList
|
|
|
+ .unitPrice)) {
|
|
|
+ if (!this.deptBudgetList.unitPrice) {
|
|
|
+ this.$message.error('单价不能为空!');
|
|
|
+ } else {
|
|
|
+ this.$message.error('单价输入错误,1-20000之间,最多保留3位小数!');
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!this.deptBudgetList.totalValue) {
|
|
|
+ this.$message.error('总价值不能为空!');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!this.deptBudgetList.applicationProportion || _Validate(10, 100, 2, '', this.deptBudgetList
|
|
|
+ .applicationProportion)) {
|
|
|
+ if (!this.deptBudgetList.applicationProportion) {
|
|
|
+ this.$message.error('申请比例不能为空!');
|
|
|
+ } else {
|
|
|
+ this.$message.error('申请比例输入错误,10-100之间,最多保留2位小数!');
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!this.deptBudgetList.interest || _Validate(1, 1000000000, 2, '', this.deptBudgetList
|
|
|
+ .interest)) {
|
|
|
+ if (!this.deptBudgetList.interest) {
|
|
|
+ this.$message.error('申请金额不能为空!');
|
|
|
+ } else {
|
|
|
+ this.$message.error('申请金额输入错误,1-10亿之间,最多保留2位小数!');
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!this.deptBudgetList.appendix) {
|
|
|
+ this.$message.error('附件不能为空!');
|
|
|
+ return false
|
|
|
+ } else if (this.deptBudgetList.appendix.split(',').length > 30) {
|
|
|
+ this.$message.error('附件数量需小于30!');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!this.deptBudgetList.bank) {
|
|
|
+ this.$message.error('银行不能为空!');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!this.deptBudgetList.three) {
|
|
|
+ this.$message.error('第三方不能为空!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ },
|
|
|
submit() {
|
|
|
- this.$confirm(`确定提交审核?`, {
|
|
|
- cancelButtonText: '取消',
|
|
|
- confirmButtonText: '确定',
|
|
|
- type: 'warning',
|
|
|
- }).then(() => {debugger
|
|
|
- addList(this.deptBudgetList).toPromise().then((response) => {
|
|
|
- // this.tableData = response.records
|
|
|
- this.$message.success('提交成功')
|
|
|
- }).catch((req) => {
|
|
|
- // this.tableData = response.records
|
|
|
- this.$message.success('提交失败')
|
|
|
+ let isValidate = false
|
|
|
+ isValidate = this.validate()
|
|
|
+ if (isValidate) {
|
|
|
+ this.$confirm(`确定提交审核?`, {
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ type: 'warning',
|
|
|
+ }).then(() => {
|
|
|
+ addList(this.deptBudgetList).toPromise().then((response) => {
|
|
|
+ // this.tableData = response.records
|
|
|
+ this.$message.success('提交成功')
|
|
|
+ this.$router.push({
|
|
|
+ path: 'warehouseReceiptRegulation'
|
|
|
+ })
|
|
|
+ }).catch((req) => {
|
|
|
+ // this.tableData = response.records
|
|
|
+ this.$message.success('提交失败')
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
+ }
|
|
|
},
|
|
|
onChange() {
|
|
|
this.$refs.upload
|