|
|
@@ -95,7 +95,7 @@
|
|
|
<input class="form-control" type="number" v-model="modifyObj.unitPrice" :class="{'error': !validObj.unitPrice}" @blur="checkUnitPrice" @input="onUnitPriceInput">
|
|
|
</td>
|
|
|
<td>
|
|
|
- <input type="text" class="form-control" v-model="modifyObj.encapsulation" maxlength="20" @input="onEncapsulationChange">
|
|
|
+ <input type="text" class="form-control" v-model="modifyObj.encapsulation" @input="onEncapsulationChange">
|
|
|
</td>
|
|
|
<td>
|
|
|
<input type="text" class="form-control" v-model="modifyObj.produceDate" @input="onProduceDateChange">
|
|
|
@@ -106,6 +106,7 @@
|
|
|
type="date"
|
|
|
:picker-options="pickerOptions"
|
|
|
:editable="false"
|
|
|
+ :class="{'error': !validObj.deadline}"
|
|
|
size="mini">
|
|
|
</el-date-picker>
|
|
|
<!--<input type="text" class="form-control" v-model="modifyObj.deadline">-->
|
|
|
@@ -258,6 +259,15 @@
|
|
|
deadline: ''
|
|
|
}
|
|
|
},
|
|
|
+ initValidObj: function () {
|
|
|
+ this.validObj = {
|
|
|
+ code: true,
|
|
|
+ brand: true,
|
|
|
+ unitPrice: true,
|
|
|
+ amount: true,
|
|
|
+ deadline: true
|
|
|
+ }
|
|
|
+ },
|
|
|
listenPage: function (page) {
|
|
|
this.nowPage = page
|
|
|
this.reloadData()
|
|
|
@@ -267,8 +277,13 @@
|
|
|
},
|
|
|
submitBOM: function () {
|
|
|
let str = ''
|
|
|
+// let _this = this
|
|
|
for (let i = 0; i < this.bomList.content.length; i++) {
|
|
|
if (this.bomList.content[i].checked) {
|
|
|
+ if (!this.getSingleValidInfo(this.bomList.content[i])) {
|
|
|
+ this.$message.error('请选择信息完善的产品发布求购')
|
|
|
+ return
|
|
|
+ }
|
|
|
str += this.bomList.content[i].id + ','
|
|
|
}
|
|
|
}
|
|
|
@@ -318,12 +333,14 @@
|
|
|
this.bomList.content[index].active = true
|
|
|
let _this = this
|
|
|
this.initModifyObj()
|
|
|
+ this.initValidObj()
|
|
|
for (let attr in this.bomList.content[index]) {
|
|
|
+// console.log(attr + ':' + _this.bomList.content[index][attr])
|
|
|
_this.$set(_this.modifyObj, attr, _this.bomList.content[index][attr])
|
|
|
// _this.modifyObj[attr] = _this.bomList.content[index][attr]
|
|
|
}
|
|
|
// this.modifyObj = this.bomList.content[index]
|
|
|
- this.modifyObj.deadline = this.getDate(this.bomList.content[index].deadline)
|
|
|
+ this.modifyObj.deadline = this.bomList.content[index].deadline ? this.getDate(this.bomList.content[index].deadline) : ''
|
|
|
},
|
|
|
cancelModify: function (index) {
|
|
|
this.bomList.content[index].active = false
|
|
|
@@ -336,6 +353,10 @@
|
|
|
const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
|
|
|
return year + '-' + month + '-' + day
|
|
|
},
|
|
|
+// validDate: function (timestamp) {
|
|
|
+// let now = new Date().getTime()
|
|
|
+// return timestamp - now <= 1000 * 60 * 60 * 24 * 90 && timestamp - now > 0
|
|
|
+// },
|
|
|
submitModify: function (index) {
|
|
|
let checkValid = this.checkAll()
|
|
|
if (this.getSingleValidInfo(this.modifyObj) && checkValid) {
|
|
|
@@ -364,7 +385,11 @@
|
|
|
this.$message.error('请输入正确的数值')
|
|
|
}
|
|
|
} else {
|
|
|
- this.$message.error('请完善信息')
|
|
|
+ if (!this.isValidDate(this.modifyObj.deadline)) {
|
|
|
+ this.$message.error('截止日期需在90天以内')
|
|
|
+ } else {
|
|
|
+ this.$message.error('请完善信息')
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -431,7 +456,7 @@
|
|
|
})
|
|
|
},
|
|
|
getSingleValidInfo: function (item) {
|
|
|
- return item.code && item.brand && item.deadline && item.deadline !== 'NaN-NaN-NaN' && this.isValidDate(item.deadline)
|
|
|
+ return item.code && item.brand && item.deadline && this.isValidDate(item.deadline)
|
|
|
},
|
|
|
checkCode: function () {
|
|
|
this.validObj.code = this.modifyObj.code && this.modifyObj.code !== ''
|
|
|
@@ -459,7 +484,7 @@
|
|
|
return this.checkCode() && this.checkBrand() && this.checkDeadline() && this.checkUnitPrice() && this.checkAmount()
|
|
|
},
|
|
|
checkDeadline: function () {
|
|
|
- this.validObj.deadline = Boolean(this.modifyObj.deadline)
|
|
|
+ this.validObj.deadline = this.modifyObj.deadline && this.modifyObj.deadline !== '' && this.isValidDate(this.modifyObj.deadline)
|
|
|
return this.validObj.deadline
|
|
|
},
|
|
|
onUnitPriceInput: function () {
|