浏览代码

前端gjy

gjy 3 年之前
父节点
当前提交
71f9b3f98d

+ 93 - 64
src/views/purchasingManagement/procurementPlanAdd.vue

@@ -81,10 +81,10 @@
             v-show="dataList.procurementPlanType=='现货'"
             label="采购价格(元)"
             span="1"
-            prop="procurementPrice"
+            prop="unitPrice"
           >
             <el-input
-              v-model="dataList.procurementPrice"
+              v-model="dataList.unitPrice"
               maxlength="120"
               size="small"
               placeholder="请输入采购价格"
@@ -148,18 +148,20 @@
           </ws-form-item>
           <el-form-item v-if="dataList.packingType!='散装'" label="装袋备注" span="1" prop="baggingNotes">
             <el-input
+            maxlength='30'
               v-model="dataList.baggingNotes"
               size="small"
               placeholder="请输入装袋要求如:98斤,王中王彩袋"
             />
           </el-form-item>
           <ws-form-item label="买方" span="1" prop="buyer">
-            <el-input v-model="dataList.buyer" maxlength="120" size="small" placeholder="请输入买方名称" />
+            <el-input maxlength='25' v-model="dataList.buyer" size="small" placeholder="请输入买方名称" />
           </ws-form-item>
           <el-form-item label="买方电话" span="1" prop="buyerPhone">
             <el-input
               v-model="dataList.buyerPhone"
               filterable
+              type="number"
               :filter-method="dataFilter"
               placeholder="请输入买方电话"
             ></el-input>
@@ -520,17 +522,6 @@ export default {
               this.warehouseList[i].warehouseCity
             ][this.warehouseList[i].warehouseArea].code
           this.selectedOptions = tmp
-          this.deptBudgetList.tranProcessInfoList[0].selectedOptions = tmp
-          this.$set(
-            this.deptBudgetList,
-            'startDetailedAddress',
-            this.warehouseList[i].detailedAddress
-          )
-          this.$set(
-            this.deptBudgetList.tranProcessInfoList[0],
-            'sendDetailedAddress',
-            this.deptBudgetList.startDetailedAddress
-          )
         }
       }
     },
@@ -586,6 +577,34 @@ export default {
           this.freightPayerList = response
         })
     },
+    getdate() {
+      var date = new Date()
+      var year = date.getFullYear() //获取完整的年份(4位)
+      var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
+      var datetime = date.getDate() //获取当前日(1-31)
+      if (mouth < 10) {
+        mouth = '0' + mouth
+      }
+      if (datetime < 10) {
+        datetime = '0' + datetime
+      }
+      return year + mouth + datetime
+    },
+    // 随机验证码
+    verifyinit() {
+      var arr = []
+      for (var i = 48; i < 123; i++) {
+        if (i > 57 && i < 65) continue
+        if (i > 90 && i < 97) continue
+        arr.push(String.fromCharCode(i))
+      }
+      arr.sort(function () {
+        return Math.random() - 0.5
+      })
+      arr.length = 4
+
+      return arr.join('')
+    },
     submit() {
       // if(!this.dataList.goodName) {
       //   this.$message({
@@ -596,57 +615,59 @@ export default {
       // }
       if (!this.dataList.title) {
         this.$message({
-          message: '标题不能为空',
+          message: '标题不能为空',
           type: 'warning'
         })
         return
       }
       if (this.dataList.title.length>16) {
         this.$message({
-          message: '标题输入错误',
+          message: '标题输入错误',
           type: 'warning'
         })
         return
       }
       if (!this.dataList.plannedPurchaseVolume) {
         this.$message({
-          message: '计划采购量不能为空',
+          message: '计划采购量不能为空',
           type: 'warning'
         })
         return
       }
-      if (this.dataList.plannedPurchaseVolume>1000000||this.dataList.plannedPurchaseVolume>1) {
+      if (this.dataList.plannedPurchaseVolume>10000000||this.dataList.plannedPurchaseVolume<1) {
         this.$message({
-          message: '计划采购量输入错误',
+          message: '计划采购量输入错误',
           type: 'warning'
         })
         return
       }
-      if (this.dataList.plannedPurchaseVolume.indexOf('.')) {
+      if (this.dataList.plannedPurchaseVolume.indexOf('.')!=-1) {
         if(this.dataList.plannedPurchaseVolume.split('.')[1].length>2){
           this.$message({
-            message: '计划采购量输入错误',
+            message: '计划采购量输入错误',
             type: 'warning'
           })
           return
         }
       }
+      if (!this.dataList.minimumVolume) {
+        this.$message({
+          message: '最小交易量不能为空!',
+          type: 'warning'
+        })
+        return
+      }
       if (
-        !this.dataList.minimumVolume ||
-        (String(this.dataList.minimumVolume).indexOf('.') != -1 &&
-          String(this.dataList.minimumVolume).length -
-            (String(this.dataList.minimumVolume).indexOf('.') + 1) >
-            2)
-      ) {
+        this.dataList.minimumVolume>10000000||this.dataList.minimumVolume<1) {
         this.$message({
-          message: '最小交易量输入错误',
+          message: '最小交易量输入错误!',
           type: 'warning'
         })
         return
       }
-      if (!this.dataList.procurementPlanType) {
+      if (this.dataList.minimumVolume.indexOf('.') != -1 &&this.dataList.minimumVolume.split('.')[1].length >2) {
         this.$message({
-          message: '类型不能为空',
+          message: '最小交易量输入错误!',
           type: 'warning'
         })
         return
@@ -665,16 +686,16 @@ export default {
       //   })
       //   return
       // }
-      if (!this.dataList.packingType) {
+      if (!this.dataList.buyer) {
         this.$message({
-          message: '包装方式不能为空',
+          message: '买方不能为空!',
           type: 'warning'
         })
         return
       }
-      if (!this.dataList.buyer) {
+      if (this.dataList.buyer.length>25||this.dataList.buyer.length<1) {
         this.$message({
-          message: '买方不能为空',
+          message: '买方输入错误!',
           type: 'warning'
         })
         return
@@ -686,37 +707,42 @@ export default {
         })
         return
       }
-      if (isNaN(this.dataList.buyerPhone)) {
+      if (this.dataList.buyerPhone.length!=11) {
         this.$message({
-          message: '输入买方电话有误!',
+          message: '买方电话输入错误!',
           type: 'warning'
         })
         return
       }
-      if (
-        this.dataList.buyerPhone.length < 6 ||
-        this.dataList.buyerPhone.length > 15
-      ) {
+      if (!this.dataList.waterContent) {
         this.$message({
-          message: '买方电话输入错误',
+          message: '水分不能为空!',
           type: 'warning'
         })
         return
       }
-      if (!this.dataList.waterContent) {
+      if (this.dataList.waterContent>40||this.dataList.waterContent<1) {
+        this.$message({
+          message: '水分输入错误!',
+          type: 'warning'
+        })
+        return
+      }
+      if (String(this.dataList.waterContent).indexOf('.') != -1 &&
+          String(this.dataList.waterContent).length -
+            (String(this.dataList.waterContent).indexOf('.') + 1) >
+            2) {
         this.$message({
-          message: '水分不能为空',
+          message: '水分输入错误',
           type: 'warning'
         })
         return
       }
       if (
-        !this.dataList.bulkDensity ||
-        (String(this.dataList.bulkDensity).indexOf('.') != -1 &&
+        this.dataList.bulkDensity&&String(this.dataList.bulkDensity).indexOf('.') != -1 &&
           String(this.dataList.bulkDensity).length -
             (String(this.dataList.bulkDensity).indexOf('.') + 1) >
-            2)
-      ) {
+            2||this.dataList.bulkDensity>1000||this.dataList.bulkDensity<500){
         this.$message({
           message: '容重输入错误',
           type: 'warning'
@@ -724,12 +750,20 @@ export default {
         return
       }
       if (
-        !this.dataList.impurity ||
-        (String(this.dataList.impurity).indexOf('.') != -1 &&
+        this.dataList.protein&&String(this.dataList.protein).indexOf('.') != -1 &&
+          String(this.dataList.protein).length -
+            (String(this.dataList.protein).indexOf('.') + 1) >
+            2||this.dataList.protein>40||this.dataList.protein<1){
+        this.$message({
+          message: '蛋白占比输入错误',
+          type: 'warning'
+        })
+        return
+      }
+      if (
+        this.dataList.impurity&&String(this.dataList.impurity).indexOf('.') != -1 &&
           String(this.dataList.impurity).length -
-            (String(this.dataList.impurity).indexOf('.') + 1) >
-            2)
-      ) {
+            (String(this.dataList.impurity).indexOf('.') + 1) >2) {
         this.$message({
           message: '杂质输入错误',
           type: 'warning'
@@ -737,12 +771,10 @@ export default {
         return
       }
       if (
-        !this.dataList.mildewGrain ||
-        (String(this.dataList.mildewGrain).indexOf('.') != -1 &&
+        this.dataList.mildewGrain&&String(this.dataList.mildewGrain).indexOf('.') != -1 &&
           String(this.dataList.mildewGrain).length -
             (String(this.dataList.mildewGrain).indexOf('.') + 1) >
-            2)
-      ) {
+            2) {
         this.$message({
           message: '霉变粒输入错误',
           type: 'warning'
@@ -750,12 +782,10 @@ export default {
         return
       }
       if (
-        !this.dataList.jiaorenli ||
-        (String(this.dataList.jiaorenli).indexOf('.') != -1 &&
+        this.dataList.jiaorenli&&String(this.dataList.jiaorenli).indexOf('.') != -1 &&
           String(this.dataList.jiaorenli).length -
             (String(this.dataList.jiaorenli).indexOf('.') + 1) >
-            2)
-      ) {
+            2) {
         this.$message({
           message: '热损伤输入错误',
           type: 'warning'
@@ -763,12 +793,10 @@ export default {
         return
       }
       if (
-        !this.dataList.imperfectGrain ||
-        (String(this.dataList.imperfectGrain).indexOf('.') != -1 &&
+        this.dataList.imperfectGrain&&String(this.dataList.imperfectGrain).indexOf('.') != -1 &&
           String(this.dataList.imperfectGrain).length -
             (String(this.dataList.imperfectGrain).indexOf('.') + 1) >
-            2)
-      ) {
+            2) {
         this.$message({
           message: '不完整粒输入错误',
           type: 'warning'
@@ -784,6 +812,7 @@ export default {
         .then(() => {
           this.$refs.dataList.validate(valid => {
             if (valid) {
+              this.dataList.procurementPlanNo='CGJH'+this.getdate()+this.verifyinit()
               this.dataList.sourceProvince = CodeToText[this.selectedOptions[0]]
               this.dataList.sourceCity = CodeToText[this.selectedOptions[1]]
 

+ 3 - 3
src/views/purchasingManagement/procurementPlanList.vue

@@ -37,7 +37,7 @@
       <el-table-column class="table_td" prop="procurementPlanNo" label="采购计划编号"></el-table-column>
       <el-table-column class="table_td" prop="title" label="标题"></el-table-column>
       <el-table-column class="table_td" prop="goodsName" label="货名"></el-table-column>
-      <el-table-column class="table_td" prop="weight" label="重量(吨)"></el-table-column>
+      <el-table-column class="table_td" prop="plannedPurchaseVolume" label="重量(吨)"></el-table-column>
       <el-table-column class="table_td" prop="basisPrice" label="基差(元/吨)"></el-table-column>
       <el-table-column class="table_td" prop="unitPrice" label="单价(元/吨)"></el-table-column>
       <el-table-column class="table_td" prop="receiveWarehouse" label="收货库"></el-table-column>
@@ -52,8 +52,8 @@
           >
             <template>
               <span slot="reference">
-                <span v-if="scope.row.showFlag == '展示中'" class="executory"></span>
-                <span v-if="scope.row.showFlag == '已隐藏'" class="inExecution"></span>
+                <span v-if="scope.row.showFlag == 1"> <span class="executory"></span>展示中</span>
+                <span v-if="scope.row.showFlag == 0"> <span  class="inExecution"></span>已隐藏</span>
               </span>
             </template>
             <div>