Browse Source

验收问题处理

yangc 8 years ago
parent
commit
2d61cf9c67

+ 30 - 5
components/applyPurchase/BatchPublish.vue

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

+ 6 - 2
components/applyPurchase/PublishApply.vue

@@ -375,10 +375,14 @@
         }
         }
       },
       },
       onSuccess: function (data) {
       onSuccess: function (data) {
-        window.open('/applyPurchase/' + data.data)
+        if (data.success) {
+          window.open('/applyPurchase/' + data.data)
+        } else {
+          this.$message.error(data.message)
+        }
       },
       },
       onError: function () {
       onError: function () {
-        this.$message.error('上传失败')
+        this.$message.error('上传失败, 系统错误')
       },
       },
       downloadTemplate: function () {
       downloadTemplate: function () {
         window.location.href = '/seek/release/template'
         window.location.href = '/seek/release/template'