|
@@ -58,7 +58,7 @@
|
|
|
<el-row class="row3">
|
|
|
<div class="top">
|
|
|
<div class="title">粮价设置</div>
|
|
|
- <el-button v-if="priceList.length<4" class="btn" @click="newSetPrice" :disabled="!isEdit">新增</el-button>
|
|
|
+ <el-button v-if="checkList.length<4" class="btn" @click="newSetPrice" :disabled="!isEdit">新增</el-button>
|
|
|
</div>
|
|
|
<div class="content" v-for="(item,index) in priceList" :key="index">
|
|
|
<div class="top">
|
|
@@ -228,7 +228,13 @@
|
|
|
},
|
|
|
index: 0,
|
|
|
type: '',
|
|
|
- isEdit: true
|
|
|
+ isEdit: true,
|
|
|
+ isSHowNewBtn: true,
|
|
|
+ checkList: [],
|
|
|
+ checkList1: [],
|
|
|
+ checkList2: [],
|
|
|
+ checkList3: [],
|
|
|
+ checkList4: []
|
|
|
}
|
|
|
},
|
|
|
activated() {
|
|
@@ -259,6 +265,26 @@
|
|
|
switch (this.$route.query.type) {
|
|
|
case "新增":
|
|
|
this.submitName = "提交"
|
|
|
+ this.baseInfoForm = {
|
|
|
+ warehouseId: '',
|
|
|
+ warehouseName: '',
|
|
|
+ compId: '',
|
|
|
+ goodsNameKey: '',
|
|
|
+ goodsName: '',
|
|
|
+ waterBase: '',
|
|
|
+ deductWeight: '',
|
|
|
+ waterMin: '',
|
|
|
+ waterMax: '',
|
|
|
+ saleLimit: '',
|
|
|
+ statusFlag: '',
|
|
|
+ status: '',
|
|
|
+ workflowId: '',
|
|
|
+ approveStatus: '',
|
|
|
+ passDate: '',
|
|
|
+ dryGrainPrice: '',
|
|
|
+ details: [],
|
|
|
+ detailPrints: []
|
|
|
+ }
|
|
|
this.baseInfoForm.warehouseId = this.$route.query.warehouseId
|
|
|
this.baseInfoForm.warehouseName = this.$route.query.warehouseName
|
|
|
this.baseInfoForm.compId = this.$route.query.compId
|
|
@@ -366,19 +392,25 @@
|
|
|
}
|
|
|
},
|
|
|
// 设置表格颜色
|
|
|
-tableRowClassName ({ row, rowIndex }) {
|
|
|
- if ((rowIndex + 1) % 2 === 0) {
|
|
|
- return 'double';
|
|
|
- } else {
|
|
|
- return 'single';
|
|
|
- }
|
|
|
- }, getRowClass ({ rowIndex }) {
|
|
|
- if (rowIndex == 0) {
|
|
|
- return 'background:#ebeaef'
|
|
|
- } else {
|
|
|
- return ''
|
|
|
-}
|
|
|
- // return '';
|
|
|
+ tableRowClassName({
|
|
|
+ row,
|
|
|
+ rowIndex
|
|
|
+ }) {
|
|
|
+ if ((rowIndex + 1) % 2 === 0) {
|
|
|
+ return 'double';
|
|
|
+ } else {
|
|
|
+ return 'single';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getRowClass({
|
|
|
+ rowIndex
|
|
|
+ }) {
|
|
|
+ if (rowIndex == 0) {
|
|
|
+ return 'background:#ebeaef'
|
|
|
+ } else {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ // return '';
|
|
|
},
|
|
|
// 增加分界
|
|
|
add(item, item1, index) {
|
|
@@ -433,7 +465,15 @@ tableRowClassName ({ row, rowIndex }) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (i == 0) this.checkList1 = _data[i].checkList
|
|
|
+ if (i == 1) this.checkList2 = _data[i].checkList
|
|
|
+ if (i == 2) this.checkList3 = _data[i].checkList
|
|
|
+ if (i == 3) this.checkList4 = _data[i].checkList
|
|
|
}
|
|
|
+ console.log("-------------------------")
|
|
|
+ // console.log([...new Set(this.checkList)])
|
|
|
+ this.checkList = [...new Set([...this.checkList1, ...this.checkList2, ...this.checkList3, ...this.checkList4])]
|
|
|
+ console.log(this.checkList)
|
|
|
},
|
|
|
// 算价格纠正精度不准
|
|
|
accMul(arg1, arg2) {
|
|
@@ -496,6 +536,17 @@ tableRowClassName ({ row, rowIndex }) {
|
|
|
// 删除价格组
|
|
|
delSetPrice(item, index) {
|
|
|
let that = this
|
|
|
+ this.checkList1 = []
|
|
|
+ this.checkList2 = []
|
|
|
+ this.checkList3 = []
|
|
|
+ this.checkList4 = []
|
|
|
+ for (let i = 0; i < item.checkList.length; i++) {
|
|
|
+ for (let j = 0; j < this.checkList.length; j++) {
|
|
|
+ if (item.checkList[i] == this.checkList[j]) {
|
|
|
+ this.checkList.splice(j, 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
this.$confirm(
|
|
|
'确认删除本组设置?',
|
|
|
'提示', {
|
|
@@ -559,52 +610,60 @@ tableRowClassName ({ row, rowIndex }) {
|
|
|
}
|
|
|
},
|
|
|
//打印
|
|
|
- print() {debugger
|
|
|
+ print() {
|
|
|
localStorage.setItem('pricePrintList', JSON.stringify(this.baseInfoForm.detailPrints));
|
|
|
window.location.href = "../../../static/print.html?name=" + this.baseInfoForm.goodsName
|
|
|
},
|
|
|
validate() {
|
|
|
let that = this
|
|
|
- function _baseWaterValidate(min, max, saveNum, point, type) {
|
|
|
- let _val1 = parseFloat(that.baseInfoForm.waterBase)
|
|
|
+
|
|
|
+ function _baseWaterValidate(min, max, saveNum, point, type, inputVal) {
|
|
|
+ let _val1 = inputVal
|
|
|
let _pointVal1 = _val1.toString().split(".")[1]
|
|
|
- let _tobeVal1 = _val1 % saveNum
|
|
|
+ if (_pointVal1 == undefined) _pointVal1 = 0
|
|
|
+ if (typeof(_pointVal1) == "string") _pointVal1 = _pointVal1.length
|
|
|
+ let _tobeVal1 = _val1 % point
|
|
|
if (type == "waterBase") {
|
|
|
- if (_val1 < max && _val1 > min && _pointVal1 < point && _tobeVal1 == 0) {
|
|
|
+
|
|
|
+ if (_val1 <= max && _val1 >= min && _pointVal1 <= saveNum && _tobeVal1 == 0) {
|
|
|
return false
|
|
|
}
|
|
|
}
|
|
|
if (type == "deductWeight") {
|
|
|
- if (_val1 < max && _val1 > min && _pointVal1 < point) {
|
|
|
+
|
|
|
+ if (_val1 <= max && _val1 >= min && _pointVal1 <= saveNum) {
|
|
|
return false
|
|
|
}
|
|
|
}
|
|
|
if (type == "saleLimit") {
|
|
|
-
|
|
|
- if (_val1 < max && _val1 > min && Number.isInteger(this.baseInfoForm.saleLimit)) {
|
|
|
+ if (_val1 <= max && _val1 >= min) {
|
|
|
+ // Number.isInteger(that.baseInfoForm.saleLimit)
|
|
|
return false
|
|
|
}
|
|
|
}
|
|
|
return true
|
|
|
}
|
|
|
- if (_baseWaterValidate(1, 100, 1, 0.5, "waterBase") || this.baseInfoForm.waterBase == '') {
|
|
|
- if (_baseWaterValidate(1, 100, 1, 0.5, "waterBase")) {
|
|
|
+ if (this.baseInfoForm.waterBase == '' || _baseWaterValidate(1, 100, 1, 0.5, "waterBase", parseFloat(this
|
|
|
+ .baseInfoForm.waterBase))) {
|
|
|
+ if (_baseWaterValidate(1, 100, 1, 0.5, "waterBase", parseFloat(this.baseInfoForm.waterBase))) {
|
|
|
that.$message.error('水分基准输入错误,最多保留1位小数,基准水分须可被0.5整除!');
|
|
|
} else {
|
|
|
this.$message.error('基准水分不能为空!');
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
- if (_baseWaterValidate(0, 2, 2, '', 'deductWeight') || this.baseInfoForm.deductWeight == '') {
|
|
|
- if (_baseWaterValidate(0, 2, 2, '', 'deductWeight')) {
|
|
|
+ if (this.baseInfoForm.deductWeight == '' || _baseWaterValidate(0, 3, 2, '', 'deductWeight', parseFloat(this
|
|
|
+ .baseInfoForm.deductWeight))) {
|
|
|
+ if (_baseWaterValidate(0, 3, 2, '', 'deductWeight', parseFloat(this.baseInfoForm.deductWeight))) {
|
|
|
that.$message.error('扣重比输入错误!');
|
|
|
} else {
|
|
|
this.$message.error('扣重比不能为空!');
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
- if (_baseWaterValidate(0, 1000, 4, '', 'deductWeight') || this.baseInfoForm.dryGrainPrice == '') {
|
|
|
- if (_baseWaterValidate(0, 1000, 4, '', 'deductWeight')) {
|
|
|
+ if (this.baseInfoForm.dryGrainPrice == '' || _baseWaterValidate(0, 1000, 4, '', 'deductWeight', parseFloat(this
|
|
|
+ .baseInfoForm.dryGrainPrice))) {
|
|
|
+ if (_baseWaterValidate(0, 1000, 4, '', 'deductWeight', parseFloat(this.baseInfoForm.dryGrainPrice))) {
|
|
|
that.$message.error('干粮收购价输入错误!');
|
|
|
} else {
|
|
|
this.$message.error('干粮收购价格不能为空!');
|
|
@@ -612,42 +671,48 @@ tableRowClassName ({ row, rowIndex }) {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
- if (_baseWaterValidate(1, 100, 1, 0.5, "waterBase") || this.baseInfoForm.waterMin == '') {
|
|
|
- if (_baseWaterValidate(1, 100, 1, 0.5, "waterBase")) {
|
|
|
- that.$message.error('干粮水分输入错误!');
|
|
|
- } else {
|
|
|
- this.$message.error('干粮水分不能为空!');
|
|
|
+ if (this.baseInfoForm.waterMin == '' || _baseWaterValidate(1, 100, 1, 0.5, "waterBase", parseFloat(this
|
|
|
+ .baseInfoForm.waterMin))) {
|
|
|
+ if (this.baseInfoForm.waterMin == '') {
|
|
|
+ this.$message.error('干粮水分不能为空!')
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ if (_baseWaterValidate(1, 100, 1, 0.5, "waterBase", parseFloat(this.baseInfoForm.waterMin))) {
|
|
|
+ that.$message.error('干粮水分输入错误!')
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
- if (_baseWaterValidate(1, 100, 1, 0.5, "waterBase") || this.baseInfoForm.waterMax == '') {
|
|
|
- if (_baseWaterValidate(1, 100, 1, 0.5, "waterBase")) {
|
|
|
+ if (this.baseInfoForm.waterMax == '' || _baseWaterValidate(1, 100, 1, 0.5, "waterBase", parseFloat(this
|
|
|
+ .baseInfoForm.waterMax))) {
|
|
|
+ if (_baseWaterValidate(1, 100, 1, 0.5, "waterBase", parseFloat(this.baseInfoForm.waterMax))) {
|
|
|
that.$message.error('水分上限输入错误!');
|
|
|
} else {
|
|
|
this.$message.error('水分上限不能为空!');
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
- if (_baseWaterValidate(100, 100000, '', '', "saleLimit") || this.baseInfoForm.saleLimit == '') {
|
|
|
- if (_baseWaterValidate(100, 100000, '', '', "saleLimit")) {
|
|
|
+ if (this.baseInfoForm.saleLimit == '' || _baseWaterValidate(100, 100000, '', '', "saleLimit", parseFloat(this
|
|
|
+ .baseInfoForm.saleLimit))) {
|
|
|
+ if (_baseWaterValidate(100, 100000, '', '', "saleLimit", parseFloat(this.baseInfoForm.saleLimit))) {
|
|
|
that.$message.error('销售上限输入错误!');
|
|
|
} else {
|
|
|
this.$message.error('销售上限不能为空!');
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
- console.log(this.priceList.length)
|
|
|
- if (this.priceList.length != 4) {
|
|
|
- this.$message.error('粮价设置为4个等级!');
|
|
|
- return false
|
|
|
- }
|
|
|
+ // console.log(this.priceList.length)
|
|
|
+ // if (this.priceList.length != 4) {
|
|
|
+ // this.$message.error('粮价设置为4个等级!');
|
|
|
+ // return false
|
|
|
+ // }
|
|
|
for (let i = 0; i < this.priceList.length; i++) {
|
|
|
let _item = this.priceList[i]
|
|
|
- if (_baseWaterValidate(0, 50, 2, '', "deductWeight") || _item.basicUnitPrice == '') {
|
|
|
- if (_baseWaterValidate(0, 50, 2, '', "deductWeight")) {
|
|
|
- that.$message.error('基准单价输入错误!');
|
|
|
- } else {
|
|
|
+ if (_item.basicUnitPrice == '' || _baseWaterValidate(0, 50, 2, '', "deductWeight", parseFloat(_item
|
|
|
+ .basicUnitPrice))) {
|
|
|
+ if (_item.basicUnitPrice == '') {
|
|
|
this.$message.error('基准单价不能为空!');
|
|
|
+ } else {
|
|
|
+ that.$message.error('基准单价输入错误!');
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
@@ -658,20 +723,21 @@ tableRowClassName ({ row, rowIndex }) {
|
|
|
for (let j = 0; j < _item.detailList.length; j++) {
|
|
|
let _item1 = _item.detailList[j]
|
|
|
if (_item1.type == 4) {
|
|
|
- if (_baseWaterValidate(0, 100, 3, '', 'deductWeight') || _item1.jfprice == "") {
|
|
|
- if (_baseWaterValidate(0, 100, 3, '', 'deductWeight')) {
|
|
|
- that.$message.error('降幅输入错误!');
|
|
|
- } else {
|
|
|
+ if (_item1.jfprice == "" || _baseWaterValidate(0, 100, 3, '', 'deductWeight', parseFloat(_item1
|
|
|
+ .jfprice))) {
|
|
|
+ if (_item1.jfprice == "") {
|
|
|
this.$message.error('降幅价格不能为空!');
|
|
|
+ } else {
|
|
|
+ that.$message.error('降幅输入错误!');
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
} else {
|
|
|
- if (_baseWaterValidate(0, 100, 1, 0.5, "waterBase") || _item1.water == "") {
|
|
|
- if (_baseWaterValidate(1, 100, 1, 0.5, "waterBase")) {
|
|
|
- that.$message.error('分界值输入错误!');
|
|
|
+ if (_item1.water == "" || _baseWaterValidate(0, 100, 1, 0.5, "waterBase", parseFloat(_item1.water))) {
|
|
|
+ if (_item1.water == "") {
|
|
|
+ this.$message.error('分界水分不能为空!')
|
|
|
} else {
|
|
|
- this.$message.error('分界水分不能为空!');
|
|
|
+ that.$message.error('分界值输入错误!');
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
@@ -691,7 +757,7 @@ tableRowClassName ({ row, rowIndex }) {
|
|
|
this.isCountShow = false;
|
|
|
break;
|
|
|
case "新增":
|
|
|
- isValidate=this.validate()
|
|
|
+ isValidate = this.validate()
|
|
|
if (isValidate) {
|
|
|
purchasePriceAdd(this.baseInfoForm).toPromise().then((response) => {
|
|
|
console.log(response)
|
|
@@ -701,7 +767,7 @@ tableRowClassName ({ row, rowIndex }) {
|
|
|
}
|
|
|
break;
|
|
|
case "编辑":
|
|
|
- isValidate=this.validate()
|
|
|
+ isValidate = this.validate()
|
|
|
if (isValidate) {
|
|
|
purchasePriceEdit(this.baseInfoForm).toPromise().then((response) => {
|
|
|
console.log(response)
|
|
@@ -1231,19 +1297,24 @@ tableRowClassName ({ row, rowIndex }) {
|
|
|
font-weight: 500;
|
|
|
color: #262626;
|
|
|
}
|
|
|
+
|
|
|
.double {
|
|
|
background: #FEFBF6 !important;
|
|
|
}
|
|
|
+
|
|
|
.single {
|
|
|
background: #F7FBFF !important;
|
|
|
}
|
|
|
- .bottom-btn{
|
|
|
+
|
|
|
+ .bottom-btn {
|
|
|
display: flex;
|
|
|
- .left{
|
|
|
+
|
|
|
+ .left {
|
|
|
color: red;
|
|
|
}
|
|
|
+
|
|
|
margin: 20px 0;
|
|
|
- justify-content: space-around;
|
|
|
- align-items: center;
|
|
|
+ justify-content: space-around;
|
|
|
+ align-items: center;
|
|
|
}
|
|
|
</style>
|