浏览代码

Merge branch 'release/v1.0.2' into feature/running_trajectory

# Conflicts:
#	.env.development
#	src/utils/request.js
duanxiaoduan 1 年之前
父节点
当前提交
999bae6414

+ 1 - 1
.env.development

@@ -6,7 +6,7 @@ ENV = 'development'
 # VUE_APP_BASE_API = 'http://192.168.1.70:8082/'
 VUE_APP_BASE_API = 'http://kpttest.kptyun.com/'
 # 白少后台本地
-# VUE_APP_BASE_API = 'http://192.168.1.77:8081/'
+VUE_APP_BASE_API = 'http://192.168.1.56:8081/'
 # VUE_APP_BASE_API = 'http://192.168.1.93/'
 # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
 # to control whether the babel-plugin-dynamic-import-node plugin is enabled.

+ 3 - 3
src/utils/request.js

@@ -14,9 +14,9 @@ if (DoMainString) {
 var reg =  /(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)/;
 var browserUrl = window.location.hostname
 console.log("========url===",reg.test(browserUrl))
-// if (reg.test(browserUrl)){
-//   URL = window.location.protocol +"//"+ browserUrl + ":8082/"
-// }
+if (reg.test(browserUrl)){
+  URL = window.location.protocol +"//"+ browserUrl + ":80/"
+}
 
 Cookies.set('url',URL)
 console.log(process.env.VUE_APP_BASE_API,'===========URL1111')

+ 151 - 2
src/views/basicData/sapLog/index.vue

@@ -26,7 +26,12 @@
         class="elTable table-fixed"
       >
         <el-table-column label="牧场" min-width="90px" align="center" prop="pastureName" />
-        <el-table-column label="数据类型" min-width="90px" align="center"  prop="msgtypeName" />
+        <el-table-column label="数据类型" min-width="90px" align="center"  prop="msgtypeName">
+          <template slot-scope="scope">
+            <span >{{scope.row.msgtypeName}}</span>
+            <!-- <span @click="clickType(scope.row)">{{scope.row.msgtypeName}}</span> -->
+          </template>
+        </el-table-column>
         <el-table-column label="请求参数" min-width="120px" align="center">
           <template slot-scope="scope">
               <el-tooltip placement="top" :open-delay="1000">
@@ -52,7 +57,131 @@
         <el-table-column label="请求地址" min-width="90px" align="center" prop="url" />
         <el-table-column label="创建时间" min-width="90px" align="center" prop="createTime" />
       </el-table>
-    </div>
+    </div>
+
+    <!-- 数据类型 -->
+    <el-dialog :title="textMap[type.dialogStatus]"  :visible.sync="type.dialogFormVisible" :close-on-click-modal="false" width="50%">
+      <div class="app-type">
+        <div class="table" v-if="type.temp.msgtypeName == '搅拌'">
+          <el-table
+            :key="type.table.tableKey"
+            v-loading="type.table.listLoading"
+            element-loading-text="给我一点时间"
+            :data="type.table.list"
+            border
+            fit
+            highlight-current-row
+            style="width: 100%;"
+            :row-style="rowStyle"
+            :cell-style="cellStyle"
+            class="elTable table-fixed"
+          >
+            <el-table-column label="序号" min-width="90px" align="center" prop="pastureName" />
+            <el-table-column label="日期" min-width="90px" align="center" prop="status" />
+            <el-table-column label="班次" min-width="90px" align="center" prop="msgtext" />
+            <el-table-column label="车次" min-width="90px" align="center" prop="url" />
+            <el-table-column label="配方" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="原料" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="原料顺序" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="理论重量" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="实际重量" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="开始时间" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="结束时间" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="驾驶员" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="自拌料-饲料顺序" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="自拌料-饲料名称" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="自拌料-饲料重量" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="实际重量修改记录" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="修改时间" min-width="90px" align="center" prop="createTime" />
+          </el-table>
+        </div>
+        <div class="table" v-else-if="type.temp.msgtypeName == '配方'">
+          <el-table
+            :key="type.table.tableKey"
+            v-loading="type.table.listLoading"
+            element-loading-text="给我一点时间"
+            :data="type.table.list"
+            border
+            fit
+            highlight-current-row
+            style="width: 100%;"
+            :row-style="rowStyle"
+            :cell-style="cellStyle"
+            class="elTable table-fixed"
+          >
+            <el-table-column label="序号" min-width="90px" align="center" prop="pastureName" />
+            <el-table-column label="配方名称" min-width="90px" align="center" prop="status" />
+            <el-table-column label="原料编码" min-width="90px" align="center" prop="msgtext" />
+            <el-table-column label="原料名称" min-width="90px" align="center" prop="url" />
+            <el-table-column label="原料类型" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="重量" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="顺序" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="允许误差" min-width="90px" align="center" prop="createTime" />
+          </el-table>
+        </div>
+        <div class="table" v-else-if="type.temp.msgtypeName == '发料'">
+          <el-table
+            :key="type.table.tableKey"
+            v-loading="type.table.listLoading"
+            element-loading-text="给我一点时间"
+            :data="type.table.list"
+            border
+            fit
+            highlight-current-row
+            style="width: 100%;"
+            :row-style="rowStyle"
+            :cell-style="cellStyle"
+            class="elTable table-fixed"
+          >
+            <el-table-column label="序号" min-width="90px" align="center" prop="pastureName" />
+            <el-table-column label="日期" min-width="90px" align="center" prop="status" />
+            <el-table-column label="班次" min-width="90px" align="center" prop="msgtext" />
+            <el-table-column label="车次" min-width="90px" align="center" prop="url" />
+            <el-table-column label="栏舍" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="存栏" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="发料顺序" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="理论重量" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="实际重量" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="开始时间" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="结束时间" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="驾驶员" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="配方名称" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="饲料顺序" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="饲料名称" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="饲料重量" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="自拌料-饲料顺序" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="自拌料-饲料名称" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="自拌料-饲料重量" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="实际重量修改记录" min-width="90px" align="center" prop="createTime" />
+            <el-table-column label="修改时间" min-width="90px" align="center" prop="createTime" />
+          </el-table>
+        </div>
+        <div class="table" v-else>
+          <el-table
+            :key="type.table.tableKey"
+            v-loading="type.table.listLoading"
+            element-loading-text="给我一点时间"
+            :data="type.table.list"
+            border
+            fit
+            highlight-current-row
+            style="width: 100%;"
+            :row-style="rowStyle"
+            :cell-style="cellStyle"
+            class="elTable table-fixed"
+          >
+            <el-table-column label="序号" min-width="90px" align="center" prop="pastureName" />
+            <el-table-column label="日期" min-width="90px" align="center" prop="status" />
+            <el-table-column label="栏舍" min-width="90px" align="center" prop="msgtext" />
+            <el-table-column label="重量" min-width="90px" align="center" prop="url" />
+          </el-table>
+        </div>
+        <span v-if="type.table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ type.table.total }}条</span>
+        <div slot="footer" class="dialog-footer">
+          <el-button class="cancelClose1" @click="type.dialogFormVisible = false;getList()">关闭</el-button>
+        </div>
+      </div>
+    </el-dialog>
   </div>
 
 </template>
@@ -90,6 +219,20 @@ export default {
         { name: 'getPastureList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
       ],
       dataTypeList:[],pastureList:[],
+      textMap: {
+        type: '搅拌数据类型详情',
+      },
+      type:{
+        dialogFormVisible: false,
+        dialogStatus: '',
+        table:{
+          tableKey: 0,
+          list: [],
+          total: 0,
+          listLoading: false,
+        },
+        temp:{}
+      },
       rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
       cellStyle: { padding: 0 + 'px' },
     }
@@ -137,6 +280,12 @@ export default {
     },
     handleRefresh(){
 
+    },
+    clickType(row){
+      this.type.temp = Object.assign({},row)
+      this.type.temp.msgtypeName = '搅拌'
+      this.type.dialogStatus = 'type'
+      this.type.dialogFormVisible = true
     }
   }
 }

+ 15 - 6
src/views/dashboard/pasture/index.vue

@@ -88,10 +88,14 @@
           <div class="title">
             <div class="img-title" />
             <span class="content">今日计划统计</span>
-          </div>
+          </div>
+          <b style="margin-left: 20px;">统计类型:</b>
+          <el-select v-model="row2.value" size="mini" placeholder="请选择" style="width: 100px;" @change="changeType">
+            <el-option v-for="item in row2.typeList" :key="item.id" :label="item.name" :value="item.id" />
+          </el-select>
           <div class="todayPlan">
             <div>
-              <div id="row2chartLine1" style="height: 185px;" />
+              <div id="row2chartLine1" style="height: 185px;" v-loading="row1.listLoading" />
               <div class="bottom">
                 <div class="bottom-l">
                   <div class="bottom-l-t">
@@ -112,7 +116,7 @@
               </div>
             </div>
             <div>
-              <div id="row2chartLine2" style="height: 185px;" />
+              <div id="row2chartLine2" style="height: 185px;" v-loading="row1.listLoading"  />
               <div class="bottom">
                 <div class="bottom-l">
                   <div class="bottom-l-t">
@@ -446,7 +450,9 @@ export default {
         listLoading: true,
         list: ''
       },
-      row2: {
+      row2: {
+        value:0,
+        typeList:[{id:0,name:'全部'},{id:1,name:'固定式'},{id:2,name:'抛料车'}],
         chart1: {
           chartLine: null,
           chartLine_data: {}
@@ -700,7 +706,8 @@ export default {
       that.row4.chart2.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
     },
     getList() {
-      this.row1.listLoading = true
+      this.row1.listLoading = true
+      this.row1.getdataListParm.parammaps.lpplantype = this.row2.value
       GetDataByName(this.row1.getdataListParm).then(response => {
         if (response.data !== null && response.data.list !== null) {
           console.log('row1数据', response.data.list)
@@ -718,7 +725,6 @@ export default {
           this.row2.chart1.chartLine_data.data2 = parseFloat(response.data.list[0].planTimes)
           this.row2.chart2.chartLine_data.data1 = parseFloat(response.data.list[0].doneWeight)
           this.row2.chart2.chartLine_data.data2 = parseFloat(response.data.list[0].planWeight)
-
           this.roadChartLine1(this.row2.chart1.chartLine_data)
           this.roadChartLine2(this.row2.chart2.chartLine_data)
         } else {
@@ -739,6 +745,9 @@ export default {
           this.row1.listLoading = false
         }, 100)
       })
+    },
+    changeType(){
+      this.getList()
     },
     // 今日计划统计-完成车次
     roadChartLine1(chartLine_data) {

+ 86 - 8
src/views/formulationPlan/dailyExecutionPlan/index.vue

@@ -54,6 +54,7 @@
         <el-button v-if="isRoleEdit && ispalyUd" class="success" icon="el-icon-plus" @click="handleGetUd1">搅拌数据上传</el-button>
         <el-button v-if="isRoleEdit && ispalyUd" class="success" icon="el-icon-plus" @click="handleGetUd2">剩料上传</el-button>
         <el-button v-if="isRoleEdit && ispalyUd" class="success" icon="el-icon-plus" @click="handleGetUd3">撒料上传</el-button>
+        <el-button v-if="isRoleEdit" class="success" icon="el-icon-circle-check" @click="handleQuickcompletion">快速完成</el-button>
       </div>
       <!-- 日执行计划 -->
       <div class="table">
@@ -73,7 +74,7 @@
           :cell-style="cellStyle"
           class="elTable table-fixed"
           :row-class-name="tableRowClassName"
-          :height="370"
+          :height="myheight"
           @row-click="tableRowClick"
           @selection-change="handleSelect"
         >
@@ -101,7 +102,7 @@
           <el-table-column label="已执行" min-width="70px" align="center">
             <template slot-scope="scope">
               <div v-if="scope.row.havebutton == 0" style="background: #009A69;color:#fff;line-height:30px;">否</div>
-              <div v-else style="background: #c7c7ca ;line-height:30px;">是</div>
+              <div v-else style="background: #FC2323;color:#000 ;line-height:30px;">是</div>
             </template>
           </el-table-column>
           <el-table-column label="班次" min-width="80px" align="center">
@@ -127,7 +128,7 @@
           </el-table-column>
           <el-table-column label="配方名称" min-width="100px" align="center">
             <template slot-scope="scope">
-              <b style="font-size: 28px;line-height: 30px;">{{ scope.row.ftname }}</b>
+              <b style="font-size: 26px;line-height: 30px;">{{ scope.row.ftname }}</b>
             </template>
           </el-table-column>
           <el-table-column label="牛头数" min-width="80px" align="center">
@@ -148,13 +149,16 @@
           <el-table-column align="center" width="100" label="操作" class-name="small-padding fixed-width" fixed="right">
             <template slot-scope="{row}">
               <el-button class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
+              <el-button class="miniDanger" icon="el-icon-sort" @click="handleRowSort(row)" />
             </template>
           </el-table-column>
         </el-table>
         <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ table.total }}条</span>
       </div>
     </div>
-
+<!-- maxHeight="enlargeHeight -->
+  <div v-if="isDetail" style="position: relative;">
+    <el-button class="hide" @click="handleCloseTable2" style="position: absolute;right: 0;top: -20px;">隐藏</el-button>
     <!-- 预混料 -->
     <div v-if="table3.getdataListParm.parammaps.lpplantype == 4" class="content">
       <el-row :gutter="20">
@@ -219,7 +223,6 @@
         </el-col>
       </el-row>
     </div>
-
     <!-- 撒料 -->
     <div v-if="table3.getdataListParm.parammaps.lpplantype == 0" class="content">
       <el-row :gutter="20">
@@ -650,7 +653,7 @@
         </el-col>
       </el-row>
     </div>
-
+  </div>
     <!-- 新生成 -->
     <el-dialog :title="textMap[newGeneration.dialogStatus]" :destroy-on-close="true" :visible.sync="newGeneration.dialogFormVisible" :close-on-click-modal="false" width="30%">
       <div class="newGeneration" v-loading="newGenerationLoading" >
@@ -907,7 +910,11 @@ export default {
     RevisePlan
   },
   data() {
-    return {
+    return {
+      myheight: document.documentElement.clientHeight - 280,
+      // myheight: 500,
+      enlargeHeight: document.documentElement.clientHeight - 85 - 165 + 50,
+      isDetail:false,
       newGenerationLoading:false,
       dialogFull: false,
       isRoleEdit: [],
@@ -1582,6 +1589,14 @@ export default {
     tableRowClick(row, column, event) {
       console.log(row, column, event)
       console.log('点击计划类型', row.lpplantype)
+      if (this.isOrder == false) {
+        this.$message({ type: 'error', message: '请保存或取消当前更改顺序操作', duration: 2000 })
+      } else {
+        if (column.label !== '操作') {
+          this.isDetail = true // 点击行显示详情
+          this.myheight = document.documentElement.clientHeight - 85 - 265 - 230
+        }
+      }
       this.table2.getdataListParm.parammaps.havebutton = row.havebutton
       this.table3.getdataListParm.parammaps.havebutton = row.havebutton
       // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4/预称重计划5
@@ -1663,7 +1678,10 @@ export default {
       }
       this.$forceUpdate()
     },
-
+    handleCloseTable2() {
+      this.isDetail = false
+      this.myheight = document.documentElement.clientHeight - 280
+    },
     // 计划内容操作详情
     getList2() {
       this.table2.listLoading = true
@@ -2489,6 +2507,35 @@ export default {
       }).catch(() => {
         this.$message({ type: 'info', message: '已取消删除' })
       })
+    },
+    handleRowSort(row){
+      this.$prompt('由于混料车和撒料车是一体的,插入顺序不能隔开', '排序', {
+        inputPlaceholder:'请输入您要插入的位置',
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        inputPattern: /^\d+$/ ,
+        inputErrorMessage: '请检查插入位置序号是否正确'
+      }).then(({ value }) => {
+        const url = 'authdata/plan/sort/edit'
+        const data = {
+          planId:row.id,
+          mydate:row.mydate,
+          sort:value
+        }
+        postJson(url, data).then(response => {
+          if (response.msg === 'fail') {
+            this.$notify({ title: '失败', message: response.data, type: 'error', duration: 2000 })
+          } else {
+            this.$notify({ title: '成功', message: '成功', type: 'success', duration: 2000 })
+            this.getList()
+          }
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '取消排序'
+        });
+      });
     },
     handleSpan() {
       this.mergekeys.forEach(key => {
@@ -3087,6 +3134,34 @@ export default {
           }
         })
       })
+    },
+    handleQuickcompletion(){
+      if (this.selectList.length == 0) {
+        this.$message({ type: 'error', message: '请先选择计划', duration: 2000 })
+      } else {
+        MessageBox.confirm('您是否确定勾选的状态改为已执行的计划?', {
+          confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
+        }).then(() => {
+          console.log(this.selectList)
+          let arr = []
+          for(let i=0;i<this.selectList.length;i++){
+            arr.push(this.selectList[i].id)
+          }
+          const url = '/authdata/plan/artificial/edit'
+          const data = {
+            planId:arr.join()
+          }
+          postJson(url,data).then(response => {
+            console.log('快速完成保存发送参数', this.requestParam)
+            if (response.msg === 'fail') {
+              this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
+            } else {
+              this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
+              this.getList()
+            }
+          })
+        })
+      }
     }
   }
 }
@@ -3134,5 +3209,8 @@ export default {
     position: relative;
     .content-table{margin-top: 20px;}
     .contentOperation{right: -50px;z-index: 1;}
+  }
+  /deep/.el-input.is-disabled .el-input__inner{
+    color:#000
   }
  </style>

+ 77 - 3
src/views/formulationPlan/dhedFormula/index.vue

@@ -318,12 +318,17 @@
             <u-table-column :key="15" label="饲喂干物质量" prop="swdryw" min-width="70px" align="center" />
             <u-table-column :key="16" label="采样干物质量" prop="cydryw" min-width="70px" align="center" />
             <u-table-column :key="17" label="日投喂量" prop="sumweight" min-width="70px" align="center" />
+            <u-table-column :key="18" label="操作"  prop="sumweight" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
+              <template slot-scope="scope">
+                <span style="color: blue;" @click="handleRestore(scope.row)">恢复</span>
+              </template>
+            </u-table-column>
           </u-table>
           <!-- <pagination2 v-show="history.total>0" :total="history.total" :page.sync="history.getdataListParm.offset" :limit.sync="history.getdataListParm.pagecount" @pagination="getHistoryList" /> -->
         </div>
       </div>
       <div slot="footer" class="dialog-footer" style="bottom: 10px;">
-        <el-button class="cancelClose cancelClose1" @click="history.dialogFormVisible = false; ">关闭</el-button>
+        <el-button class="cancelClose cancelClose1" @click="history.dialogFormVisible = false;getList() ">关闭</el-button>
       </div>
     </el-dialog>
 
@@ -1725,11 +1730,11 @@ export default {
       if (row.w4 == '' || row.w4 == undefined || isNaN(row.w4)) { row.w4 = 0 }
       if (row.w5 == '' || row.w5 == undefined || isNaN(row.w5)) { row.w5 = 0 }
       if (row.w6 == '' || row.w6 == undefined || isNaN(row.w6)) { row.w6 = 0 }
-      // 配方重量=实际牛头数*系数*配方模板取Sfweight
-      row.ftweight = (row.ccount * row.ratio / 100 * row.Sfweight).toFixed(this.decimal)
       // 实际牛头数不变
       // 系数=系数头数/实际牛头数*100
       row.ratio = (parseFloat(row.ccountratio) / parseFloat(row.ccount) * 100).toFixed(this.decimal)
+      // 配方重量=实际牛头数*系数*配方模板取Sfweight
+      row.ftweight = (row.ccount * row.ratio / 100 * row.Sfweight).toFixed(this.decimal)
       this.public(row)
       this.placeholder(row)
     },
@@ -3414,6 +3419,75 @@ export default {
       this.getList()
       this.isproportion = false
     },
+    handleRestore(row){
+      // 恢复
+      MessageBox.confirm('是否进行恢复?', {
+        confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
+      }).then(() => {
+      const dataList = this.history.list
+      const result = dataList.filter(obj => obj.barname === row.barname);
+      console.log(result,'result')
+       const barList = []
+       result.forEach((item)=>{
+         console.log(item,'item')
+         let obj = {}
+         obj.barname = item.barname
+         obj.ccount = item.ccount
+         obj.ratio = item.ratio
+         obj.ftname = item.ptname
+         // obj.ptsfname = item.ptsfname
+         if(item.timesin == '1'){ obj.times1 = item.tratio }else{ obj.times1 = 0 }
+         if(item.timesin == '2'){ obj.times2 = item.tratio }else{ obj.times2 = 0 }
+         if(item.timesin == '3'){ obj.times3 = item.tratio }else{ obj.times3 = 0 }
+         if(item.timesin == '4'){ obj.times4 = item.tratio }else{ obj.times4 = 0 }
+         if(item.timesin == '5'){ obj.times5 = item.tratio }else{ obj.times5 = 0 }
+         if(item.timesin == '6'){ obj.times6 = item.tratio }else{ obj.times6 = 0 }
+         barList.push(obj)
+       })
+       // 根据 "barname" 属性进行分组
+       const groupedData = barList.reduce((acc, obj) => {
+           const key = obj.barname;
+           if (!acc[key]) {
+               acc[key] = [obj];
+           } else {
+               acc[key].push(obj);
+           }
+           return acc;
+       }, {});
+       console.log(groupedData,'groupedData')
+       console.log(Object.keys(groupedData),'groupedData')
+       // 合并相同 "barname" 值的对象
+       const consolidatedData = groupedData[Object.keys(groupedData)[0]].reduce((acc, item) => {
+           for (const key in item) {
+               if (key.startsWith('times')) {
+                   acc[key] = (acc[key] || 0) + parseFloat(item[key]);
+               } else {
+                   acc[key] = item[key];
+               }
+           }
+           return acc;
+       }, {});
+
+       console.log(consolidatedData);
+       const url = 'authdata/fpdetail/batch/edit'
+       let data = {
+         pastureId:Cookies.get('pastureid'),
+         barList:[consolidatedData]
+       }
+       postJson(url, data).then(response => {
+         if(response.msg !== 'fail'){
+           this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
+           this.getDateList()
+         }else{
+           this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
+         }
+         this.isproportion = false
+       })
+      }).catch(() => {
+        this.$message({ type: 'info', message: '已取消恢复' })
+      })
+    }
+
   }
 }
 </script>

+ 37 - 3
src/views/formulationPlan/materialIssuancePlan/index.vue

@@ -4,7 +4,8 @@
       <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" style="float:left;" @click="handleCreate">新增车次
       </el-button>
       <el-button v-if="isRoleEdit" class="danger" icon="el-icon-delete" style="float:left;" @click="handleReduceTrains">减少车次</el-button>
-      <el-button v-if="isRoleEdit" class="success" style="float: left;" @click="handleCheck">校验</el-button>
+      <el-button v-if="isRoleEdit && ischeck" class="danger" style="float: left;" @click="handleCheck">校验</el-button>
+      <el-button v-else-if="isRoleEdit && !ischeck" class="success" style="float: left;" @click="handleCheck">校验</el-button>
       <el-button v-if="isRoleEdit" class="success" icon="el-icon-download" style="float:left;" @click="handleAutomaticGeneration">自动生成</el-button>
       <el-button v-if="isOrder && isRoleEdit" icon="el-icon-sort" style="float: left;" class="success" @click="handleChangeOrder">更改顺序</el-button>
       <div v-else style="float: left;margin-left: 10px;">
@@ -424,7 +425,7 @@
           <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
           <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
             <span v-for="(item2,index2) in item.arrList" :key="index2">
-              {{item2.barname}}
+              {{item2.barname}}({{item2.weight}}kg)
             </span>
           </span>
         </div>
@@ -613,15 +614,47 @@ export default {
           listLoading: false,
         }
       },
-      allEmptySelect:[]
+      allEmptySelect:[],
+      ischeck:false
     }
   },
   created() {
     this.getButtons()
     this.getIsDisplay()
     this.getList()
+    this.getIsCheck()
   },
   methods: {
+    getIsCheck(){
+      const url = 'authdata/GetDataByName'
+      const data = {
+        name:'getSpillageCount',
+        page: 1,
+        offset: 1,
+        pagecount: 0,
+        returntype: 'Map',
+        parammaps: {
+          pastureid: Cookies.get('pastureid'),
+          times: this.table.getdataListParm.parammaps.times,
+          // refresh: 2
+        }
+      }
+      postJson(url, data).then(response => {
+        if (response.data.list !== null) {
+          if(response.data.list[0].count){
+            if(parseFloat(response.data.list[0].count) > 0){
+              this.ischeck = true
+            }else{
+              this.ischeck = false
+            }
+          }else{
+            this.ischeck = false
+          }
+        } else {
+          this.ischeck = false
+        }
+      })
+    },
     getButtons() {
       const Edit = 'MaterialIssuancePlan'
       const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
@@ -794,6 +827,7 @@ export default {
           }
         }
         this.table.listLoading = false
+        this.getIsCheck()
       })
     },
     changeFrequency(val) {

+ 43 - 25
src/views/statisticalAnalysis/errorAnalysis/pasture/index.vue

@@ -55,6 +55,12 @@
             <span>-</span>
             <el-input-number :controls="false" :precision="2" v-model="tab.table.getdataListParm.parammaps.slzql2" placeholder="撒料正确率" :min="0" :max="100" style="width: 120px;" class="filter-item" clearable />
           </div>
+          <el-input v-if="tab.isTrainNumber" v-model="tab.table.getdataListParm.parammaps.templetname" class="filter-item" style="width: 140px;" placeholder="配方名称" />
+          <div style="display: inline-block;" class="filter-item1">
+            <el-input-number :controls="false" :precision="0" v-model="tab.table.getdataListParm.parammaps.startdate" placeholder="混料开始时间" :min="0" :max="100" style="width: 120px;"  class="filter-item" clearable />
+            <span>-</span>
+            <el-input-number :controls="false" :precision="0" v-model="tab.table.getdataListParm.parammaps.enddate" placeholder="混料结束时间" :min="0" :max="100" style="width: 120px;" class="filter-item" clearable />
+          </div>
           <el-checkbox v-model="tab.table.getdataListParm.parammaps.error" style="margin-right: 10px;" @change="changeccysChecked">只看超出预设值数据</el-checkbox>
           <el-button class="successBorder" @click="form_search">查询</el-button>
           <el-button class="successBorder" @click="handleRefresh1">重置</el-button>
@@ -114,12 +120,13 @@
             <u-table-column :key="28" sortable label="混料正确率" min-width="70px" align="center" prop="混料正确率" />
             <u-table-column :key="29" sortable label="去除取消正确率" min-width="60px" align="center" prop="去除取消正确率" />
             <u-table-column :key="30" sortable label="标准差" min-width="60px" align="center" prop="方差" />
-            <u-table-column v-if="activeName=='first' && tab.table.list !== null" :key="31" align="center" width="70" label="操作" class-name="small-padding fixed-width" fixed="right">
+            <u-table-column :key="31" v-if="tab.isTrainNumber" sortable label="区域" min-width="60px" align="center" prop="barname" />
+            <u-table-column v-if="activeName=='first' && tab.table.list !== null" :key="33" align="center" width="70" label="操作" class-name="small-padding fixed-width" fixed="right">
               <template slot-scope="{row}">
                 <el-button class="miniSuccess" icon="el-icon-search" @click="handleSee('1',row)" />
               </template>
             </u-table-column>
-            <u-table-column v-else :key="31" align="center" width="70" label="操作" class-name="small-padding fixed-width">
+            <u-table-column v-else :key="33" align="center" width="70" label="操作" class-name="small-padding fixed-width">
               <template slot-scope="{row}">
                   <el-button class="miniSuccess" icon="el-icon-search" @click="handleSee('1',row)" />
               </template>
@@ -171,15 +178,16 @@
               <u-table-column :key="20" sortable label="撒料准确率" min-width="60px" align="center" prop="撒料准确率" />
               <u-table-column v-if="tab.isTrainNumber" :key="21" sortable label="撒料时间" min-width="70px" align="center" prop="撒料时间" />
               <u-table-column v-if="tab.isTrainNumber" :key="22" sortable label="发料开始时间" min-width="70px" align="center" prop="startMaterialTime" />
-              <u-table-column v-if="tab.isTrainNumber" :key="22" sortable label="等待时间" min-width="70px" align="center" prop="等待时间" />
-              <u-table-column :key="23" sortable label="撒料自动跳转次数" width="65px" align="center" prop="撒料自动跳转次数" />
-              <u-table-column :key="24" sortable label="撒料手动跳转次数" width="65px" align="center" prop="撒料手动跳转次数" />
-              <u-table-column :key="25" sortable label="取消次数" min-width="70px" align="center" prop="取消次数" />
-              <u-table-column :key="26" sortable label="撒料正确数" min-width="70px" align="center" prop="撒料正确数" />
-              <u-table-column :key="27" sortable label="撒料正确率" min-width="70px" align="center" prop="撒料正确率" />
-              <u-table-column :key="28" sortable label="去除取消正确率" min-width="65px" align="center" prop="去除取消正确率" />
-              <u-table-column :key="29" sortable label="标准差" min-width="60px" align="center" prop="方差" />
-              <u-table-column v-if="activeName=='first' && tab.table2.list !== null" :key="30" align="center" width="70" label="操作" class-name="small-padding fixed-width" fixed="right">
+              <u-table-column v-if="tab.isTrainNumber" :key="23" sortable label="等待时间" min-width="70px" align="center" prop="等待时间" />
+              <u-table-column :key="24" sortable label="撒料自动跳转次数" width="65px" align="center" prop="撒料自动跳转次数" />
+              <u-table-column :key="25" sortable label="撒料手动跳转次数" width="65px" align="center" prop="撒料手动跳转次数" />
+              <u-table-column :key="26" sortable label="取消次数" min-width="70px" align="center" prop="取消次数" />
+              <u-table-column :key="27" sortable label="撒料正确数" min-width="70px" align="center" prop="撒料正确数" />
+              <u-table-column :key="28" sortable label="撒料正确率" min-width="70px" align="center" prop="撒料正确率" />
+              <u-table-column :key="29" sortable label="去除取消正确率" min-width="65px" align="center" prop="去除取消正确率" />
+              <u-table-column :key="30" sortable label="标准差" min-width="60px" align="center" prop="方差" />
+              <u-table-column :key="31" v-if="tab.isTrainNumber" sortable label="区域" min-width="60px" align="center" prop="barname" />
+              <u-table-column v-if="activeName=='first' && tab.table2.list !== null" :key="32" align="center" width="70" label="操作" class-name="small-padding fixed-width" fixed="right">
                 <template slot-scope="{row}">
                   <el-button class="miniSuccess" icon="el-icon-search" @click="handleSee('2',row)" />
                 </template>
@@ -727,6 +735,7 @@
                 <a @click="clickRecipeName2(row)" style="text-decoration: underline;color: #0000FF;">{{ row.配方名称 }}</a>
               </template>
             </u-table-column>
+            <u-table-column sortable label="驾驶员" min-width="50px" align="center" prop="驾驶员" />
             <u-table-column sortable label="饲料" min-width="70px" align="center" prop="饲料">
               <template slot-scope="{row}">
                 <a @click="clickFeed2(row)" style="text-decoration: underline;color: #0000FF;">{{ row.饲料 }}</a>
@@ -745,6 +754,7 @@
             <u-table-column sortable label="结束重量" min-width="55px" align="center" prop="结束重量" />
             <u-table-column sortable label="车次描述" min-width="55px" align="center" prop="remark" />
             <u-table-column sortable label="是否达标" min-width="70px" align="center" prop="standard" />
+            <u-table-column sortable label="区域" min-width="70px" align="center" prop="barname" />
           </u-table>
           <span v-if="tab2.table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ tab2.table.total }}条</span>
         </div>
@@ -813,6 +823,7 @@
                 <a @click="clickRecipeName3(row)" style="text-decoration: underline;color: #0000FF;">{{ row.配方名称 }}</a>
               </template>
             </u-table-column>
+            <u-table-column sortable label="驾驶员" min-width="50px" align="center" prop="驾驶员" />
             <u-table-column sortable label="栏舍" min-width="70px" align="center" prop="栏舍">
               <template slot-scope="{row}">
                 <a @click="clickFence3(row)" style="text-decoration: underline;color: #0000FF;">{{ row.栏舍 }}</a>
@@ -1409,6 +1420,7 @@ export default {
               startTime: parseTime(new Date(), '{y}-{m}-{d}'),
               stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
               inputDatetime: [new Date(), new Date()],
+              inputDate:null,
               fname: '',
               sort: '',
               times: ''
@@ -2653,14 +2665,14 @@ export default {
         } else if (this.tab.radio == '4') {
           var excelDatas4 = [
             {
-              tHeader: ['日期','配方名称','车辆名称','开始加料时间','结束加料时间', 'TMR名称', '车次', '班次', '驾驶员', '理论重量', '实际重量', '计划混料操作数', '已混料操作数', '混料操作率', '混料误差值', '混料准确率', '混料时间','发料开始时间','等待时间','混料自动跳转次数', '混料手动跳转次数', '取消次数','混料正确数','混料正确率','去除取消正确率',  '标准差'],
-              filterVal: ['计划时间1','templetname','TMR名称','startTime','endTime','TMR名称',  '车次', '班次', '驾驶员', '理论重量', '实际重量', '计划混料操作数', '已混料操作数', '混料操作率', '混料误差值', '混料准确率', '混料时间','startMaterialTime','等待时间','混料自动跳转次数', '混料手动跳转次数', '取消次数', '混料正确数','混料正确率','去除取消正确率', '方差'],
+              tHeader: ['日期','配方名称','车辆名称','开始加料时间','结束加料时间', 'TMR名称', '车次', '班次', '驾驶员', '理论重量', '实际重量', '计划混料操作数', '已混料操作数', '混料操作率', '混料误差值', '混料准确率', '混料时间','发料开始时间','等待时间','混料自动跳转次数', '混料手动跳转次数', '取消次数','混料正确数','混料正确率','去除取消正确率',  '标准差','区域'],
+              filterVal: ['计划时间1','templetname','TMR名称','startTime','endTime','TMR名称',  '车次', '班次', '驾驶员', '理论重量', '实际重量', '计划混料操作数', '已混料操作数', '混料操作率', '混料误差值', '混料准确率', '混料时间','startMaterialTime','等待时间','混料自动跳转次数', '混料手动跳转次数', '取消次数', '混料正确数','混料正确率','去除取消正确率', '方差','barname'],
               tableDatas: this.tab.table.list,
               sheetName: '混料'
             },
             {
-              tHeader: ['日期','配方名称','车辆名称','开始加料时间','结束加料时间', 'TMR名称', '车次','班次', '驾驶员','理论重量', '实际重量', '计划撒料操作数', '已撒料操作数', '撒料操作率', '撒料误差值', '撒料准确率', '撒料时间','发料开始时间','等待时间','撒料自动跳转次数', '撒料手动跳转次数', '取消次数','撒料正确数','撒料正确率','去除取消正确率',  '标准差'],
-              filterVal: ['计划时间1','templetname','TMR名称','startTime','endTime', 'TMR名称', '车次','班次', '驾驶员', '理论重量', '实际重量', '计划撒料操作数', '已撒料操作数', '撒料操作率', '撒料误差值', '撒料准确率','撒料时间','startMaterialTime','等待时间', '撒料自动跳转次数', '撒料手动跳转次数', '取消次数','撒料正确数','撒料正确率','去除取消正确率',  '方差'],
+              tHeader: ['日期','配方名称','车辆名称','开始加料时间','结束加料时间', 'TMR名称', '车次','班次', '驾驶员','理论重量', '实际重量', '计划撒料操作数', '已撒料操作数', '撒料操作率', '撒料误差值', '撒料准确率', '撒料时间','发料开始时间','等待时间','撒料自动跳转次数', '撒料手动跳转次数', '取消次数','撒料正确数','撒料正确率','去除取消正确率',  '标准差','区域'],
+              filterVal: ['计划时间1','templetname','TMR名称','startTime','endTime', 'TMR名称', '车次','班次', '驾驶员', '理论重量', '实际重量', '计划撒料操作数', '已撒料操作数', '撒料操作率', '撒料误差值', '撒料准确率','撒料时间','startMaterialTime','等待时间', '撒料自动跳转次数', '撒料手动跳转次数', '取消次数','撒料正确数','撒料正确率','去除取消正确率',  '方差','barname'],
               tableDatas: this.tab.table2.list,
               sheetName: '撒料'
             }
@@ -2777,14 +2789,14 @@ export default {
         } else if (this.tab.radio == '4') {
           var excelDatas4 = [
             {
-              tHeader: ['日期','配方名称','车辆名称','开始加料时间','结束加料时间','TMR名称', '车次', '班次', '驾驶员', '理论重量', '实际重量', '计划混料操作数', '已混料操作数', '混料操作率', '混料误差值', '混料准确率', '混料时间','发料开始时间','等待时间','混料自动跳转次数', '混料手动跳转次数', '取消次数','混料正确数','混料正确率','去除取消正确率',  '标准差'],
-              filterVal: ['计划时间1','templetname','TMR名称','startTime','endTime','TMR名称',  '车次', '班次', '驾驶员', '理论重量', '实际重量', '计划混料操作数', '已混料操作数', '混料操作率', '混料误差值', '混料准确率', '混料时间','startMaterialTime','等待时间','混料自动跳转次数', '混料手动跳转次数', '取消次数', '混料正确数','混料正确率','去除取消正确率', '方差'],
+              tHeader: ['日期','配方名称','车辆名称','开始加料时间','结束加料时间','TMR名称', '车次', '班次', '驾驶员', '理论重量', '实际重量', '计划混料操作数', '已混料操作数', '混料操作率', '混料误差值', '混料准确率', '混料时间','发料开始时间','等待时间','混料自动跳转次数', '混料手动跳转次数', '取消次数','混料正确数','混料正确率','去除取消正确率',  '标准差','区域'],
+              filterVal: ['计划时间1','templetname','TMR名称','startTime','endTime','TMR名称',  '车次', '班次', '驾驶员', '理论重量', '实际重量', '计划混料操作数', '已混料操作数', '混料操作率', '混料误差值', '混料准确率', '混料时间','startMaterialTime','等待时间','混料自动跳转次数', '混料手动跳转次数', '取消次数', '混料正确数','混料正确率','去除取消正确率', '方差','barname'],
               tableDatas: this.tab.table.list,
               sheetName: '混料'
             },
             {
-              tHeader: ['日期','配方名称','车辆名称','开始加料时间','结束加料时间','TMR名称', '车次','班次', '驾驶员','理论重量', '实际重量', '计划撒料操作数', '已撒料操作数', '撒料操作率', '撒料误差值', '撒料准确率', '撒料时间','发料开始时间','等待时间','撒料自动跳转次数', '撒料手动跳转次数', '取消次数','撒料正确数','撒料正确率','去除取消正确率',  '标准差'],
-              filterVal: ['计划时间1','templetname','TMR名称','startTime','endTime','TMR名称', '车次','班次', '驾驶员', '理论重量', '实际重量', '计划撒料操作数', '已撒料操作数', '撒料操作率', '撒料误差值', '撒料准确率','撒料时间','startMaterialTime','等待时间', '撒料自动跳转次数', '撒料手动跳转次数', '取消次数','撒料正确数','撒料正确率','去除取消正确率',  '方差'],
+              tHeader: ['日期','配方名称','车辆名称','开始加料时间','结束加料时间','TMR名称', '车次','班次', '驾驶员','理论重量', '实际重量', '计划撒料操作数', '已撒料操作数', '撒料操作率', '撒料误差值', '撒料准确率', '撒料时间','发料开始时间','等待时间','撒料自动跳转次数', '撒料手动跳转次数', '取消次数','撒料正确数','撒料正确率','去除取消正确率',  '标准差','区域'],
+              filterVal: ['计划时间1','templetname','TMR名称','startTime','endTime','TMR名称', '车次','班次', '驾驶员', '理论重量', '实际重量', '计划撒料操作数', '已撒料操作数', '撒料操作率', '撒料误差值', '撒料准确率','撒料时间','startMaterialTime','等待时间', '撒料自动跳转次数', '撒料手动跳转次数', '取消次数','撒料正确数','撒料正确率','去除取消正确率',  '方差','barname'],
               tableDatas: this.tab.table2.list,
               sheetName: '撒料'
             }
@@ -3050,7 +3062,7 @@ export default {
       }
       data.parammaps = this.tab.table.getdataListParm.parammaps
       postJson(url, data).then(response => {
-        if (response.data !== null) {
+        if (response.data !== null && response.data.list !== null) {
           console.log('汇总统计/混料table数据', response.data.list)
           this.$refs.plTable1.reloadData(response.data.list)
           this.tab.table.list = response.data.list
@@ -3085,6 +3097,9 @@ export default {
       this.tab.table2.getdataListParm.parammaps.slzq2 = this.tab.table.getdataListParm.parammaps.slzq2
       this.tab.table2.getdataListParm.parammaps.slzql1 = this.tab.table.getdataListParm.parammaps.slzql1
       this.tab.table2.getdataListParm.parammaps.slzql2 = this.tab.table.getdataListParm.parammaps.slzql2
+      this.tab.table2.getdataListParm.parammaps.templetname = this.tab.table.getdataListParm.parammaps.templetname
+      this.tab.table2.getdataListParm.parammaps.startdate = this.tab.table.getdataListParm.parammaps.startdate
+      this.tab.table2.getdataListParm.parammaps.enddate = this.tab.table.getdataListParm.parammaps.enddate
       this.tab.table2.getdataListParm.parammaps.error = this.tab.table.getdataListParm.parammaps.error
       let url = 'authdata/summary'
       let data = {}
@@ -3095,7 +3110,7 @@ export default {
       }
       data.parammaps = this.tab.table2.getdataListParm.parammaps
       postJson(url, data).then(response => {
-        if (response.data !== null) {
+        if (response.data !== null && response.data.list !== null) {
           console.log('汇总统计/撒料table数据', response.data.list)
           this.$refs.plTable22.reloadData(response.data.list)
           this.tab.table2.list = response.data.list
@@ -3232,6 +3247,9 @@ export default {
       this.tab.table.getdataListParm.parammaps.slzq2 = undefined
       this.tab.table.getdataListParm.parammaps.slzql1 = undefined
       this.tab.table.getdataListParm.parammaps.slzql2 = undefined
+      this.tab.table.getdataListParm.parammaps.templetname = ''
+      this.tab.table.getdataListParm.parammaps.startdate = undefined
+      this.tab.table.getdataListParm.parammaps.enddate = undefined
       this.tab.table.getdataListParm.parammaps.error = false
       this.form_search()
     },
@@ -4649,8 +4667,8 @@ export default {
         }
         var excelDatasTab2 = [
           {
-            tHeader: ['日期', 'TMR名称', '操作编号','车次', '班次', '配方名称', '饲料', '理论重量', '实际重量', '误差值', '准确率', '计划时间', '开始时间', '结束时间', ' 跳转方式', '开始重量', '结束重量', '搅拌时间','是否达标',],
-            filterVal: ['日期', 'TMR名称','sort', '车次', '班次', '配方名称', '饲料', '理论重量', '实际重量', '误差值', '准确率', '计划时间', '开始时间', '结束时间', '跳转方式', '开始重量', '结束重量', '搅拌时间','standard'],
+            tHeader: ['日期', 'TMR名称', '操作编号','车次', '班次', '配方名称','驾驶员',  '饲料', '理论重量', '实际重量', '误差值', '准确率', '计划时间', '开始时间', '结束时间', ' 跳转方式', '开始重量', '结束重量', '搅拌时间','是否达标','区域'],
+            filterVal: ['日期', 'TMR名称','sort', '车次', '班次', '配方名称','驾驶员',  '饲料', '理论重量', '实际重量', '误差值', '准确率', '计划时间', '开始时间', '结束时间', '跳转方式', '开始重量', '结束重量', '搅拌时间','standard','barname'],
             tableDatas: exportList,
             sheetName: '混料统计'
           }
@@ -4750,8 +4768,8 @@ export default {
         }
         var excelDatasTab3 = [
           {
-            tHeader: ['日期', 'TMR名称','操作编号', '车次', '班次', '配方名称', '栏舍', '理论重量', '实际重量', '误差值', '准确率', '开始时间', '结束时间', '跳转方式', '开始重量', '结束重量', '搅拌时间','是否达标',],
-            filterVal: ['日期', 'TMR名称','sort', '车次', '班次', '配方名称', '栏舍', '理论重量', '实际重量', '误差值', '准确率', '开始时间', '结束时间', '跳转方式', '开始重量', '结束重量', '搅拌时间','standard'],
+            tHeader: ['日期', 'TMR名称','操作编号', '车次', '班次', '配方名称','驾驶员', '栏舍', '理论重量', '实际重量', '误差值', '准确率', '开始时间', '结束时间', '跳转方式', '开始重量', '结束重量', '搅拌时间','是否达标',],
+            filterVal: ['日期', 'TMR名称','sort', '车次', '班次', '配方名称','驾驶员', '栏舍', '理论重量', '实际重量', '误差值', '准确率', '开始时间', '结束时间', '跳转方式', '开始重量', '结束重量', '搅拌时间','standard'],
             tableDatas: exportList,
             sheetName: '撒料统计'
           }

+ 2 - 2
src/views/statisticalAnalysis/feedingEfficiency/pasture/index.vue

@@ -271,7 +271,7 @@
                   >
                     <el-table-column sortable label="日期" min-width="110px" align="center" prop="日期" />
                     <el-table-column sortable label="配方名称" min-width="110px" align="center" prop="名称" />
-                    <el-table-column sortable label="准确率" min-width="110px" align="center" prop="准确率" />
+                    <el-table-column sortable label="时间(分钟)" min-width="110px" align="center" prop="准确率" />
                   </el-table>
                 </div>
               </div>
@@ -2659,7 +2659,7 @@ export default {
         console.log('混料时间统计导出')
         var excelDatasTabChart3 = [
           {
-            tHeader: ['日期', '配方名称','准确率'],
+            tHeader: ['日期', '配方名称','时间(分钟)'],
             filterVal: ['日期', '名称','准确率'],
             tableDatas: this.tab.chart3.table.list,
             sheetName: '混料时间统计'

+ 79 - 14
src/views/statisticalAnalysis/inventoryManagement/pasture/index.vue

@@ -75,23 +75,45 @@
           <el-button class="successBorder" @click="form_search('second')">查询</el-button>
           <el-button class="export" style="float: right;margin-right: 5px;margin-top:10px;" icon="el-icon-upload2" @click="handleExport('tab2')">导出</el-button>
         </div>
-        <div v-if="tab2.table.tableConfig.length > 8">
-          <u-table v-if="isDispayTable2" ref="plTable2" v-loading="tab2.table.listLoading" :row-style="rowStyle" :cell-style="cellStyle" :max-height="myHeight2" use-virtual :row-height="rowHeight" border class="elTable table-fixed plTable2">
+        <div v-if="tab2.table.tableConfig.length > 8">
+          <u-table v-if="isDispayTable2" ref="plTable2" v-loading="tab2.table.listLoading" :row-style="rowStyle" :cell-style="cellStyle" :max-height="myHeight2" use-virtual :row-height="rowHeight" border class="elTable table-fixed plTable2">
+            <!-- 第一个表头 -->
+            <u-table-column v-for="(header1, index1) in tab2.table.tableConfig" :key="'header1-' + index1" :label="header1.label" align="center" :fixed="index1==0" :show-overflow-tooltip="header1.showOverflow" >
+              <!-- 第二个表头 -->
+              <u-table-column v-for="(header2, index2) in header1.children" :key="'header2-' + index2" :label="header2.label" align="center" :fixed="index2==0" :show-overflow-tooltip="header2.showOverflow">
+                <!-- 第三个表头 -->
+                <u-table-column v-for="(header3, index3) in header2.children" :key="'header3-' + index3" :label="header3.label" :prop="header3.prop" align="center">
+                </u-table-column>
+              </u-table-column>
+            </u-table-column>
+          </u-table>
+          <!-- <u-table v-if="isDispayTable2" ref="plTable2" v-loading="tab2.table.listLoading" :row-style="rowStyle" :cell-style="cellStyle" :max-height="myHeight2" use-virtual :row-height="rowHeight" border class="elTable table-fixed plTable2">
             <u-table-column v-for="(item,index) in tab2.table.tableConfig" :key="index" :label="item.label" :show-overflow-tooltip="item.showOverflow"  :prop="item.prop" align="center" :fixed="index==0">
               <u-table-column v-for="(item1,key1) in item.children" v-if="item.children || item.children.length>0" :key="key1" :label="item1.label" :prop="item1.prop" align="center">
                 <u-table-column v-for="(item2,key2) in item1.children" v-if="item1.children || item1.children.length>0" :key="key2" :label="item2.label" :prop="item2.prop" />
               </u-table-column>
             </u-table-column>
-          </u-table>
+          </u-table> -->
         </div>
-        <div v-else>
-          <u-table v-if="isDispayTable2" ref="plTable2" v-loading="tab2.table.listLoading" :row-style="rowStyle" :cell-style="cellStyle" :max-height="myHeight2" use-virtual :row-height="rowHeight" border class="elTable table-fixed plTable2">
+        <div v-else>
+          <u-table v-if="isDispayTable2" ref="plTable2" v-loading="tab2.table.listLoading" :row-style="rowStyle" :cell-style="cellStyle" :max-height="myHeight2" use-virtual :row-height="rowHeight" border class="elTable table-fixed plTable2">
+            <!-- 第一个表头 -->
+            <u-table-column v-for="(header1, index1) in tab2.table.tableConfig" :key="'header1-' + index1" :label="header1.label" align="center" :fixed="index1==0" :show-overflow-tooltip="header1.showOverflow">
+              <!-- 第二个表头 -->
+              <u-table-column v-for="(header2, index2) in header1.children" :key="'header2-' + index2" :label="header2.label" align="center" :fixed="index2==0" :show-overflow-tooltip="header2.showOverflow">
+                <!-- 第三个表头 -->
+                <u-table-column v-for="(header3, index3) in header2.children" :key="'header3-' + index3" :label="header3.label" :prop="header3.prop" align="center">
+                </u-table-column>
+              </u-table-column>
+            </u-table-column>
+          </u-table>
+          <!-- <u-table v-if="isDispayTable2" ref="plTable2" v-loading="tab2.table.listLoading" :row-style="rowStyle" :cell-style="cellStyle" :max-height="myHeight2" use-virtual :row-height="rowHeight" border class="elTable table-fixed plTable2">
             <u-table-column v-for="(item,index) in tab2.table.tableConfig" :key="index" :label="item.label" :show-overflow-tooltip="item.showOverflow"  :prop="item.prop" align="center">
               <u-table-column v-for="(item1,key1) in item.children" v-if="item.children || item.children.length>0" :key="key1" :label="item1.label" :prop="item1.prop" align="center">
                 <u-table-column v-for="(item2,key2) in item1.children" v-if="item1.children || item1.children.length>0" :key="key2" :label="item2.label" :prop="item2.prop" />
               </u-table-column>
             </u-table-column>
-          </u-table>
+          </u-table> -->
         </div>
 
         <span v-if="tab2.table.listLoading == false && tab2.table.list.length>0" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ tab2.table.total }}条</span>
@@ -441,8 +463,11 @@ export default {
           let myList = []
           GetReportform(this.tab2.table.getdataListParm).then(response => {
             if (response.data !== null && response.data.data !== null && response.data.data1 !== null) {
-              this.tab2.table.data = response.data.data
-              for (let i = 0; i < response.data.list.data2.length; i++) {
+              this.tab2.table.data = response.data.data
+              response.data.feedcode.push('')
+              response.data.feedcode.unshift('饲料编码')
+              for (let i = 0; i < response.data.list.data2.length; i++) {
+                console.log(response.data.list.data2[i],'===label')
                 for (let j = 0; j < response.data.list.data1.length; j++) {
                   for (let a = 0; a < response.data.list.data2[i].children.length; a++) {
                     if (response.data.list.data1[j][response.data.list.data2[i].children[a].prop] == undefined || response.data.list.data1[j][response.data.list.data2[i].children[a].prop] == null || response.data.list.data1[j][response.data.list.data2[i].children[a].prop] == '') {
@@ -461,12 +486,29 @@ export default {
                 } else {
                   this.$set(response.data.list.data2[i].children[0], 'width', '80px')
                 }
+              }
+              let list = response.data.list.data2
+              let code = response.data.feedcode
+              const headers = []
+              for(let i=0;i<list.length;i++){
+                for(let j=0;j<code.length;j++){
+                  if(i== j){
+                    let obj = {
+                      label:code[j],
+                      children:[
+                        list[i]
+                      ]
+                    }
+                    headers.push(obj)
+                  }
+                }
               }
               myList = response.data.list.data1
               this.tab2.table.list = response.data.list.data1
-              this.tab2.table.tableConfig = response.data.list.data2
+              this.tab2.table.tableConfig = headers
               this.tab2.table.total = response.data.list.data1.length
               console.log('库存统计-用料分析this.tab2.table.data', response.data.data)
+              console.log('库存统计-用料分析this.tab2.table.feedcode', response.data.feedcode)
               console.log('库存统计-用料分析this.tab2.table.list', response.data.list.data1)
               console.log('库存统计-用料分析this.tab2.table.tableConfig',response.data.list.data2)
             } else {
@@ -804,24 +846,36 @@ export default {
         var exportData = []
         var exportTitle1 = [] // 一级标题
         var exportTitle2 = [] // 二级标题
+        var exportTitle3 = [] // 一级标题
         var filterValArr = []
         for (let i = 0; i < this.tab2.table.tableConfig.length; i++) {
           exportTitle1.push(this.tab2.table.tableConfig[i].label)
           for (let j = 0; j < this.tab2.table.tableConfig[i].children.length; j++) {
-            exportTitle2.push(this.tab2.table.tableConfig[i].children[j].label)
-            filterValArr.push(this.tab2.table.tableConfig[i].children[j].prop)
+            exportTitle2.push(this.tab2.table.tableConfig[i].children[j].label)
+            for(let a = 0;a<this.tab2.table.tableConfig[i].children[j].children.length;a++){
+              exportTitle3.push(this.tab2.table.tableConfig[i].children[j].children[a].label)
+              filterValArr.push(this.tab2.table.tableConfig[i].children[j].children[a].prop)
+            }
+            // filterValArr.push(this.tab2.table.tableConfig[i].children[j].prop)
           }
         }
         console.log('一级标题exportTitle1', exportTitle1)
         console.log('二级标题exportTitle2', exportTitle2)
+        console.log('三级标题exportTitle3', exportTitle3)
         console.log('对应字段filterValArr', filterValArr)
         var headerArr = []// 处理一级标题
+        var headerArr2 = []// 处理一级标题
         if (this.tab2.table.getdataListParm.checked == 1) {
           for (let i = 0; i < exportTitle1.length; i++) {
             if (i > 0) {
               headerArr.push(exportTitle1[i], '', '', '')
             } else {
               headerArr.push(exportTitle1[i])
+            }
+            if (i > 0) {
+              headerArr2.push(exportTitle2[i], '', '', '')
+            } else {
+              headerArr2.push(exportTitle2[i])
             }
           }
         } else {
@@ -831,10 +885,16 @@ export default {
                 headerArr.push(exportTitle1[i], '')
               } else {
                 headerArr.push(exportTitle1[i])
+              }
+              if (i > 0) {
+                headerArr2.push(exportTitle2[i], '')
+              } else {
+                headerArr2.push(exportTitle2[i])
               }
             }
           }else{
             headerArr = exportTitle1
+            headerArr2 = exportTitle2
           }
         }
         console.log('headerArr', headerArr)
@@ -845,8 +905,10 @@ export default {
             const multiHeader = [
               headerArr
             ]
-            const multiHeader2 = []
-            const tHeader = exportTitle2
+            const multiHeader2 = [
+              headerArr2
+            ]
+            const tHeader = exportTitle3
             const filterVal = filterValArr
             const data = this.tab2.table.list.map(v => filterVal.map(j => v[j]))
             // const data = []
@@ -955,11 +1017,14 @@ export default {
   }
   // .el-radio{margin-right: 20px;}
 </style>
-<style lang="css">
+<style lang="scss">
   .el-tooltip__popper{
   max-width: 60% !important;
   }
   .plTableBox .el-table td.is-hidden>*, .plTableBox .el-table th.is-hidden>*{
     visibility:inherit;
+  }
+  .plTableBox .el-table th>.cell{
+    white-space: pre-wrap;
   }
 </style>