Pārlūkot izejas kodu

Signed-off-by: 段小段 <1729609802@qq.com>

段小段 2 gadi atpakaļ
vecāks
revīzija
12b9dc856a

BIN
dist.zip


+ 16 - 4
src/api/common.js

@@ -270,10 +270,22 @@ export function DownloadExcel(data, filename) {
     navigator.msSaveBlob(blob, fileName)
   }
 }
-// 取小数
-export function formatNum(f, digit) {
-  var m = Math.pow(10, digit);
-  return parseInt(f * m, 10) / m;
+// 取小数
+// export function formatNum(f, digit) {
+//   var m = Math.pow(10, digit);
+//   return parseInt(f * m, 10) / m;
+// }
+export function formatNum(value, n) {
+  var f = Math.round(value*Math.pow(10,n))/Math.pow(10,n);
+  var s = f.toString();
+  var rs = s.indexOf('.');   
+  if(rs < 0) {     
+    s += '.';   
+  }
+  for(var i = s.length - s.indexOf('.'); i <= n; i++){
+    s += "0";
+  }
+  return s;
 }
 
 export function compareSort(property){

+ 1 - 1
src/views/basicData/defaultParameter/function/index.vue

@@ -211,7 +211,7 @@ export default {
       numberList: [{ id: '0', name: '1' }, { id: '1', name: '2' }, { id: '2', name: '3' }, { id: '3', name: '4' }], // 班次数量
       feedontractList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用饲料合同
       leftoverMaterialList: [{ id: '0', name: '顶额分配' }, { id: '1', name: '剩料分配' }],
-      weightDecimalPlacesList: [{ id: '0', name: '整数' }, { id: '1', name: '一位小数' }, { id: '2', name: '两位小数' }, { id: '3', name: '三位小数' }], // 重量小数点位数
+      weightDecimalPlacesList: [{ id: '0', name: '整数' }, { id: '1', name: '一位小数' }, { id: '2', name: '两位小数' }, { id: '3', name: '三位小数' }, { id: '4', name: '四位小数' }], // 重量小数点位数
       rateDecimalPlacesList:  [{ id: '0', name: '整数' }, { id: '1', name: '一位小数' }, { id: '2', name: '两位小数' }],//比例小数点位数
       smallMaterialList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 小料是否称量
       dataSynchronizationList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用数据同步

+ 13 - 31
src/views/formulationPlan/dailyExecutionPlan/typePage/materialIssuancePlan.vue

@@ -576,28 +576,15 @@ export default {
           this.TMRNumberList = []
         }
       })
-      const url2 = 'authdata/tmrListEnableTypeAll'
-      const data2 = {
-        name: 'getTMRListEnableTypeAll',
-        offset: 0,
-        parammaps: {
-          pastureid: Cookies.get('pastureid'),
-          eqtype: '1'
-        }
-      }
-      // 临时注释
-      // const data2 = {
-      //   parammaps: {
-      //     pastureid: Cookies.get('pastureid')
-      //   }
-      // }
-      // 临时注释
-      postJson(url, data2).then(response => {
-        if (response.data !== null) {
-          // 临时注释
-          // this.equipmentList = response.data
-          // 临时注释
-          this.equipmentList = response.data.list
+      const url2 = 'authdata/tmrListEnableTypeAll'
+      const data2 = {
+        parammaps: {
+          pastureid: Cookies.get('pastureid')
+        }
+      }
+      postJson(url2, data2).then(response => {
+        if (response.data !== null) {
+          this.equipmentList = response.data
           if(this.create.dialogStatus == 'update'){
             if(this.equipmentList.find(obj => obj.id ==  this.create.temp.tmrid) !== undefined){
               this.create.temp.tclassname = this.equipmentList.find(obj => obj.id ==  this.create.temp.tmrid).tclassname
@@ -1185,16 +1172,11 @@ export default {
       //   console.log('temp',this.create.temp)
       // }
       if(this.create.temp.tclassname == '固定式'){
-        if(this.equipmentList.find(obj => obj.tclassname == '任意车') !== undefined){
-          this.create.temp.tmrname = this.equipmentList.find(obj => obj.tclassname == '任意车').eqcode
-          this.create.temp.tmrid = this.equipmentList.find(obj => obj.tclassname == '任意车').id
+
+        if(this.equipmentList.find(obj => obj.tclassname == '任意车1') !== undefined){
+          this.create.temp.tmrname = this.equipmentList.find(obj => obj.tclassname == '任意车1').eqcode
+          this.create.temp.tmrid = this.equipmentList.find(obj => obj.tclassname == '任意车1').id
         }
-        // 临时注释
-        // if(this.equipmentList.find(obj => obj.tclassname == '任意车1') !== undefined){
-        //   this.create.temp.tmrname = this.equipmentList.find(obj => obj.tclassname == '任意车1').eqcode
-        //   this.create.temp.tmrid = this.equipmentList.find(obj => obj.tclassname == '任意车1').id
-        // }
-        // 临时注释
       }
       console.log('this.create.temp.sumweight', this.create.temp.sumweight)
       var evt = this.create.temp

+ 7 - 20
src/views/formulationPlan/materialIssuancePlan/index.vue

@@ -506,28 +506,15 @@ export default {
           this.TMRNumberList = []
         }
       })
+      const url2 = 'authdata/tmrListEnableTypeAll'
       const data2 = {
-        name: 'getTMRListEnableTypeAll',
-        offset: 0,
         parammaps: {
-          pastureid: Cookies.get('pastureid'),
-          eqtype: '1'
+          pastureid: Cookies.get('pastureid')
         }
       }
-      const url2 = 'authdata/tmrListEnableTypeAll'
-      // 临时注释
-      // const data2 = {
-      //   parammaps: {
-      //     pastureid: Cookies.get('pastureid')
-      //   }
-      // }
-      // 临时注释
-      postJson(url, data2).then(response => {
+      postJson(url2, data2).then(response => {
         if (response.data !== null) {
-          // 临时注释
-          // this.equipmentList = response.data
-          // 临时注释
-          this.equipmentList = response.data.list
+          this.equipmentList = response.data
           if(this.create.dialogStatus == 'update'){
             if(this.equipmentList.find(obj => obj.id ==  this.create.temp.tmrid) !== undefined){
               this.create.temp.tclassname = this.equipmentList.find(obj => obj.id ==  this.create.temp.tmrid).tclassname
@@ -967,9 +954,9 @@ export default {
       //   }
       // }
       if(this.create.temp.tclassname == '固定式'){
-        if(this.equipmentList.find(obj => obj.tclassname == '任意车') !== undefined){
-          this.create.temp.tmrname = this.equipmentList.find(obj => obj.tclassname == '任意车').eqcode
-          this.create.temp.tmrid = this.equipmentList.find(obj => obj.tclassname == '任意车').id
+        if(this.equipmentList.find(obj => obj.tclassname == '任意车1') !== undefined){
+          this.create.temp.tmrname = this.equipmentList.find(obj => obj.tclassname == '任意车1').eqcode
+          this.create.temp.tmrid = this.equipmentList.find(obj => obj.tclassname == '任意车1').id
         }
       }
       var evt = this.create.temp

+ 11 - 9
src/views/formulationPlan/recipeTemplate/index.vue

@@ -250,7 +250,7 @@
             <el-table-column label="重量(KG)" prop="fweight" width="120px" align="center">
               <template slot-scope="scope">
                 <span v-if="scope.row.NoEdit">{{ scope.row.fweight }}</span>
-                <el-input v-if="scope.row.Edit" v-model="scope.row.fweight" placeholder="重量" step="0.001" type="number" style="width:95%;padding:10px 0;" />
+                <el-input v-if="scope.row.Edit" v-model="scope.row.fweight" placeholder="重量" step="0.0001" type="number" style="width:95%;padding:10px 0;" />
               </template>
             </el-table-column>
             <el-table-column label="搅拌延时(min)" min-width="80px" align="center">
@@ -340,7 +340,7 @@
             <el-table-column label="重量(KG)" prop="fweight" width="120px" align="center">
               <template slot-scope="scope">
                 <span v-if="scope.row.NoEdit">{{ scope.row.fweight }}</span>
-                <el-input v-if="scope.row.Edit" v-model="scope.row.fweight" placeholder="重量" step="0.01" type="number" style="width:95%;padding:10px 0;" />
+                <el-input v-if="scope.row.Edit" v-model="scope.row.fweight" placeholder="重量" step="0.0001" type="number" style="width:95%;padding:10px 0;" />
               </template>
             </el-table-column>
             <el-table-column label="搅拌延时(min)" min-width="80px" align="center">
@@ -1150,7 +1150,7 @@ export default {
                 return prev
               }
             }, 0)
-            sums[index] = sums[index].toFixed(3) + '(干物质量:' + this.table2.dryweight + ')'
+            sums[index] = sums[index].toFixed(4) + '(干物质量:' + this.table2.dryweight + ')'
           } else {
             sums[index] = ''
           }
@@ -2287,11 +2287,12 @@ export default {
         return false
       }
       // 检验重量>0
-      this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 3) // 根据默认参数设置小数位数
-      row.fweight = formatNum(row.fweight, 3)
+      this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 4) // 根据默认参数设置小数位数
+      row.fweight = formatNum(row.fweight, 4)
+      // return
       // var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
       if (this.table2.temp.fweight == 0) {
-        this.$message({ type: 'error', message: '重量请输入正数,最多保留位小数', duration: 2000 })
+        this.$message({ type: 'error', message: '重量请输入正数,最多保留位小数', duration: 2000 })
         return false
       }
       this.isokDisable = true
@@ -2477,14 +2478,15 @@ export default {
             this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })
             return false
           }
-          this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 3) // 根据默认参数设置小数位数
-          row.fweight = formatNum(row.fweight, 3)
+          this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 4) // 根据默认参数设置小数位数
+          row.fweight = formatNum(row.fweight, 4)
           // 检验重量>0
           // var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
           if (this.table2.temp.fweight == 0) {
-            this.$message({ type: 'error', message: '重量请输入正数,最多保留位小数', duration: 2000 })
+            this.$message({ type: 'error', message: '重量请输入正数,最多保留位小数', duration: 2000 })
             return false
           }
+          console.log(row.fweight,'row.fweight')
           this.requestParam.common = { 'returnmap': '0' }
           this.requestParam.data = []
           this.requestParam.data[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {