Prechádzať zdrojové kódy

Merge branch 'hotfix/bugs2' of duanxiaoduan/tmr-group-admin into develop

duanxiaoduan 1 rok pred
rodič
commit
1241b4141c

+ 2 - 2
src/layout/components/Navbar.vue

@@ -32,7 +32,7 @@
       <el-dropdown class="avatar-container" trigger="click">
         <div class="avatar-wrapper">
           <!-- <img src="@/assets/cow.jpg" class="user-avatar"> -->
-          <span style="font-size:12px;color: #fff;">欢迎您,{{ employename }}</span>
+          <span style="font-size:12px;color: #fff;">欢迎您,{{ name }}</span>
           <i class="el-icon-caret-bottom" style="color: #fff;" />
         </div>
         <el-dropdown-menu slot="dropdown" class="user-dropdown">
@@ -77,7 +77,7 @@ export default {
     ...mapGetters([
       'sidebar',
       'avatar',
-      'employename',
+      'name',
       'employeid',
       'pastureid',
       'departmentid',

+ 2 - 1
src/store/modules/user.js

@@ -31,6 +31,7 @@ const mutations = {
     state.username = username
     Cookies.set('pageCount', 50)
     Cookies.set('username', username)
+    Cookies.set('employename', username)
   },
   SET_AVATAR: (state, avatar) => {
     state.avatar = avatar
@@ -94,7 +95,7 @@ const actions = {
           commit('ST_DOWNLIST', response.data)
         })
         commit('SET_ROLES', roles)
-        commit('SET_NAME', username)
+        commit('SET_USERNAME', username)
         commit('SET_AVATAR', avatar)
         resolve(data)
       }).catch(error => {

+ 23 - 18
src/views/statisticalAnalysis/errorAnalysis/index.vue

@@ -699,7 +699,7 @@
             <u-table-column sortable label="TMR名称" min-width="70px" align="center" prop="TMR名称" />
             <u-table-column sortable label="车次" min-width="50px" align="center" prop="车次" />
             <u-table-column sortable label="班次" min-width="50px" align="center" prop="班次" />
-           <u-table-column sortable label="配方名称" min-width="70px" align="center" prop="配方名称">
+           <!-- <u-table-column sortable label="配方名称" min-width="70px" align="center" prop="配方名称">
               <template slot-scope="{row}">
                 <a @click="clickRecipeName2(row)" style="text-decoration: underline;color: #0000FF;">{{ row.配方名称 }}</a>
               </template>
@@ -708,7 +708,9 @@
               <template slot-scope="{row}">
                 <a @click="clickFeed2(row)" style="text-decoration: underline;color: #0000FF;">{{ row.饲料 }}</a>
               </template>
-            </u-table-column>
+            </u-table-column> -->
+            <u-table-column sortable label="配方名称" min-width="55px" align="center" prop="配方名称" />
+            <u-table-column sortable label="饲料" min-width="55px" align="center" prop="饲料" />
             <u-table-column sortable label="理论重量" min-width="55px" align="center" prop="理论重量" />
             <u-table-column sortable label="实际重量" min-width="55px" align="center" prop="实际重量" />
             <u-table-column sortable label="误差值" min-width="45px" align="center" prop="误差值" />
@@ -784,16 +786,8 @@
             <u-table-column sortable label="TMR名称" min-width="70px" align="center" prop="TMR名称" />
             <u-table-column sortable label="车次" min-width="45px" align="center" prop="车次" />
             <u-table-column sortable label="班次" min-width="45px" align="center" prop="班次" />
-            <u-table-column sortable label="配方名称" min-width="70px" align="center" prop="配方名称">
-              <template slot-scope="{row}">
-                <a @click="clickRecipeName3(row)" style="text-decoration: underline;color: #0000FF;">{{ row.配方名称 }}</a>
-              </template>
-            </u-table-column>
-            <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>
-              </template>
-            </u-table-column>
+            <u-table-column sortable label="配方名称" min-width="45px" align="center" prop="配方名称" />
+            <u-table-column sortable label="栏舍" min-width="45px" align="center" prop="栏舍" />
             <u-table-column sortable label="理论重量" min-width="55px" align="center" prop="理论重量" />
             <u-table-column sortable label="实际重量" min-width="55px" align="center" prop="实际重量" />
             <u-table-column sortable label="误差值" min-width="45px" align="center" prop="误差值" />
@@ -821,7 +815,7 @@
     </div>
     </el-dialog>
     <!-- 查看 -->
-    <See :show.sync="isShowDialog"  :row-pid="rowPid" :start-time="startTime" :stop-time="stopTime"  :optdevice="optdevice" :title-fname="titlefname" :method-name="methodName" :error="error" />
+    <See :show.sync="isShowDialog"  :row-pid="rowPid" :start-time="startTime" :stop-time="stopTime"  :optdevice="optdevice" :title-fname="titlefname" :method-name="methodName" :method-pastureid="methodPastureid" :error="error" />
 
     <!-- 配方名称弹窗 -->
     <el-dialog :title="textMap[recipeNameTemp2.dialogStatus]" :visible.sync="recipeNameTemp2.dialogFormVisible" :close-on-click-modal="false" width="90%">
@@ -1722,6 +1716,7 @@ export default {
       },
       titlefname: '',
       methodName:'',
+      methodPastureid:'',
       rowPid: '',
       optdevice:'',
       startTime:'',
@@ -4100,7 +4095,7 @@ export default {
         data.status = this.tab.chart7.getdataListParm.parammaps.status
       }
       postJson(url, data).then(response => {
-        if (response.data !== null && response.data.list !== null && response.data.data !== null) {
+        if (response.data !== null && response.data.list !== null && response.data.data !== null && response.data.data.length>0) {
           for (let i = 0; i < response.data.data.length; i++) {
             // 撒料时间
             var b = []
@@ -4697,34 +4692,42 @@ export default {
           this.methodName = 'getDownloadedplanByJsyHL'
           this.optdevice = row.驾驶员
           this.titlefname = '准确性详情——驾驶员:' + row.驾驶员
+          this.methodPastureid = this.tab.table.getdataListParm.parammaps.pastureId
         }else if (this.tab.radio == 1) {
           this.methodName = 'getDownloadedplanByTemHL'
           this.optdevice = row.配方名称
           this.titlefname = '准确性详情——配方名称:' + row.配方名称
+          this.methodPastureid = this.tab.table.getdataListParm.parammaps.pastureId
         } else if (this.tab.radio == 2) {
           this.methodName = 'getDownloadedplanByBarHL'
           this.optdevice = row.栏舍名称
           this.titlefname = '准确性详情——栏舍名称:' + row.栏舍名称
+          this.methodPastureid = this.tab.table.getdataListParm.parammaps.pastureId
         } else if (this.tab.radio == 3) {
           this.methodName = 'getDownloadedplanBySCHL'
           this.optdevice = row.牲畜类别
           this.titlefname = '准确性详情——牲畜类别:' + row.牲畜类别
+          this.methodPastureid = this.tab.table.getdataListParm.parammaps.pastureId
         } else if (this.tab.radio == 4) {
           this.methodName = 'getDownloadedplanByTrainsHL'
           this.optdevice = row.车次
           this.titlefname = '准确性详情——车次:' + row.车次
+          this.methodPastureid = this.tab.table.getdataListParm.parammaps.pastureId
         } else if (this.tab.radio == 5) {
           this.methodName = 'getDownloadedplanByTmrHL'
           this.optdevice = row.TMR名称
           this.titlefname = '准确性详情——TMR名称:' + row.TMR名称
+          this.methodPastureid = this.tab.table.getdataListParm.parammaps.pastureId
         } else if (this.tab.radio == 6) {
           this.methodName = 'getDownloadedplanByFeedHL'
           this.optdevice = row.fname
           this.titlefname = '准确性详情——饲料:' + row.fname
+          this.methodPastureid = this.tab.table.getdataListParm.parammaps.pastureId
         } else if (this.tab.radio == 7) {
           this.methodName = 'getDownloadedplanByWflHL'
           this.optdevice = row.fname
           this.titlefname = '准确性详情'
+          this.methodPastureid = this.tab.table.getdataListParm.parammaps.pastureId
         }
       }else{
         // 撒料
@@ -4773,7 +4776,7 @@ export default {
       data.start_time = this.tab.table.getdataListParm.parammaps.startTime
       data.end_time = this.tab.table.getdataListParm.parammaps.stopTime
       postJson(url,data).then(response => {
-        if(response.data.list !== null){
+        if(response.data !== null && response.data.list !== null){
           this.tab.TMRNameList = response.data.list
         }else{
           this.tab.TMRNameList =  []
@@ -4788,6 +4791,7 @@ export default {
       data.start_time = this.tab2.table.getdataListParm.parammaps.startTime
       data.end_time = this.tab2.table.getdataListParm.parammaps.stopTime
       postJson(url,data).then(response => {
+        this.tab2.table.listLoading = false
         if(response.data !== null){
           this.tab2.TMRNameList = response.data.list
         }else{
@@ -4803,6 +4807,7 @@ export default {
       data.start_time = this.tab3.table.getdataListParm.parammaps.startTime
       data.end_time = this.tab3.table.getdataListParm.parammaps.stopTime
       postJson(url,data).then(response => {
+        this.tab3.table.listLoading = false
         if(response.data.list !== null){
           this.tab3.TMRNameList = response.data.list
         }else{
@@ -4907,7 +4912,7 @@ export default {
         parammaps:  this.feedTemp.getdataListParm.parammaps
       }
       postJson(url, data).then(response => {
-        if (response.data.list !== null && response.data.list !== '') {
+        if (response.data.list !== null && response.data.list !== '' && response.data.list.length > 0) {
           for (let i = 0; i < response.data.list.length; i++) {
             if (response.data.list[i].arrList == null) {
               this.$set(response.data.list[i], 'arrList', [])
@@ -4966,7 +4971,7 @@ export default {
         parammaps:this.recipeNameTemp3.getdataListParm.parammaps
       }
       postJson(url, data).then(response => {
-        if (response.data.list !== null && response.data.list !=='') {
+        if (response.data.list !== null && response.data.list !=='' && response.data.list.length > 0) {
           for (let i = 0; i < response.data.list.length; i++) {
             if (response.data.list[i].arrList == null) {
               this.$set(response.data.list[i], 'arrList', [])
@@ -5025,7 +5030,7 @@ export default {
       }
       postJson(url, data).then(response => {
         this.fenceTemp.tab1.listLoading = false
-        if (response.data !== null && response.data !== '') {
+        if (response.data !== null && response.data !== '' && response.data.length>0) {
           for (let i = 0; i < response.data.length; i++) {
             if (response.data[i].ptid == undefined || response.data[i].ptname == '') {
               this.$set(response.data[i], 'ptid', '')

+ 62 - 9
src/views/statisticalAnalysis/errorAnalysis/see.vue

@@ -88,6 +88,7 @@
                   :row-style="rowStyle"
                   :cell-style="cellStyle"
                   class="elTable table-fixed"
+                  max-height="300"
                 >
                   <el-table-column label="操作编号" min-width="50px" align="center" prop="sort" />
                   <el-table-column label="栏舍名称" min-width="50px" align="center" prop="fname" />
@@ -121,13 +122,15 @@
 import * as echarts from 'echarts';
 require('echarts/theme/macarons')
 import Cookies from 'js-cookie'
-import { GetDataByName, GetReportform, formatNum } from '@/api/common'
+import { GetDataByName,postJson, GetReportform, formatNum } from '@/api/common'
+import { parseTime } from '@/utils/index.js'
 export default {
   name: 'See',
   props: {
     show: { type: Boolean, default: false }, // 弹框可见标志
     titleFname: { type: String, defalut: '准确性详情' },
     methodName:{ type: String, defalut: '' },
+    methodPastureid:{ type: String, defalut: '' },
     rowPid: { type: String, defalut: '0' },
     optdevice: { type: String, defalut: '' },
     startTime:{ type: String, defalut: '' },
@@ -141,6 +144,7 @@ export default {
       title: '',
       pid: '',
       methodname:'',
+      methodpastureid:'',
       optdevice1:'',
       startTime1:'',
       stopTime1:'',
@@ -216,6 +220,14 @@ export default {
         this.methodname = newVal
       }
     },
+    methodPastureid: {
+      immediate: true,
+      handler(newVal, oldVal) {
+        console.log(newVal, 'methodPastureid')
+        this.methodpastureid = newVal
+      }
+    },
+
     optdevice: {
       immediate: true,
       handler(newVal, oldVal) {
@@ -258,6 +270,7 @@ export default {
     },
     // TMR设备列表
     getList1() {
+      console.log(this.seepastureid,'this.seepastureid')
       this.table1.listLoading = true
       this.table1.getdataListParm.name = this.methodname
       this.table1.getdataListParm.parammaps.optdevice = this.optdevice1
@@ -265,8 +278,17 @@ export default {
       this.table1.getdataListParm.parammaps.stopTime = this.stopTime1
       this.table1.getdataListParm.parammaps.pid = this.pid
       this.table1.getdataListParm.parammaps.error = this.error1
-      this.table1.getdataListParm.parammaps.pastureid = Cookies.get('pastureid')
-      GetDataByName(this.table1.getdataListParm).then(response => {
+      this.table1.getdataListParm.parammaps.pastureid = this.methodpastureid
+      let url = 'api/v1/ops/accuracy/data_by_name'
+      let data = {}
+      data.api_name = this.table1.getdataListParm.name
+      data.optdevice = this.table1.getdataListParm.parammaps.optdevice
+      data.start_time = this.table1.getdataListParm.parammaps.startTime
+      data.end_time = this.table1.getdataListParm.parammaps.stopTime
+      data.pid = this.table1.getdataListParm.parammaps.pid
+      data.error = this.table1.getdataListParm.parammaps.error
+      data.pasture_id = this.table1.getdataListParm.parammaps.pastureid
+      postJson(url,data).then(response => {
         console.log('车次信息数据', response.data.list)
         if (response.data !== null && response.data.list !== null) {
           this.table1.list = response.data.list
@@ -276,6 +298,9 @@ export default {
           this.table3.getdataListParm.parammaps.pastureid = response.data.list[0].pastureid
           this.chart1.getdataListParm.parammaps.pid = response.data.list[0].pid
           this.chart1.getdataListParm.parammaps.pastureid = response.data.list[0].pastureid
+          this.getList2()
+          this.getList3()
+          this.getChart1()
         } else {
           this.table1.list = []
           this.table2.getdataListParm.parammaps.pid = ''
@@ -285,9 +310,6 @@ export default {
           this.chart1.getdataListParm.parammaps.pid = ''
           this.chart1.getdataListParm.parammaps.pastureid = ''
         }
-        this.getList2()
-        this.getList3()
-        this.getChart1()
         setTimeout(() => {
           this.table1.listLoading = false
         }, 100)
@@ -296,7 +318,16 @@ export default {
     getList2() {
       this.table2.listLoading = true
       this.table2.getdataListParm.parammaps.error = this.error
-      GetDataByName(this.table2.getdataListParm).then(response => {
+      let url = 'api/v1/ops/accuracy/data_by_name'
+      let data = {}
+      data.api_name = this.table2.getdataListParm.name
+      data.error = this.table2.getdataListParm.parammaps.error
+      data.pasture_id = this.methodpastureid
+      data.pid = this.table2.getdataListParm.parammaps.pid
+      data.start_time = parseTime(new Date(), '{y}-{m}-{d}')
+      data.end_time = parseTime(new Date(), '{y}-{m}-{d}')
+      postJson(url,data).then(response => {
+      // GetDataByName(this.table2.getdataListParm).then(response => {
         console.log('混料信息数据', response.data.list)
         if (response.data !== null && response.data.list !== null) {
           this.table2.list = response.data.list
@@ -328,7 +359,17 @@ export default {
     getList3() {
       this.table3.listLoading = true
       this.table3.getdataListParm.parammaps.error = this.error
-      GetDataByName(this.table3.getdataListParm).then(response => {
+      console.log(this.table3.getdataListParm,'table2')
+      let url = 'api/v1/ops/accuracy/data_by_name'
+      let data = {}
+      data.api_name = this.table3.getdataListParm.name
+      data.error = this.table3.getdataListParm.parammaps.error
+      data.pasture_id = this.methodpastureid
+      data.pid = this.table3.getdataListParm.parammaps.pid
+      data.start_time = parseTime(new Date(), '{y}-{m}-{d}')
+      data.end_time = parseTime(new Date(), '{y}-{m}-{d}')
+      postJson(url,data).then(response => {
+      // GetDataByName(this.table3.getdataListParm).then(response => {
         if (response.data !== null && response.data.list !== null) {
           console.log('撒料信息数据', response.data.list)
           this.table3.list = response.data.list
@@ -360,7 +401,19 @@ export default {
     getChart1() {
       this.chart1.listLoading = true
       this.chart1.getdataListParm.parammaps.error = this.error
-      GetReportform(this.chart1.getdataListParm).then(response => {
+      let page = 0
+      let page_size = 0
+      let url = '/api/v1/ops/process/analysis/mixed_sprinkle_detail' + '?page=' + page + '&page_size=' + page_size
+      let data = {
+        'pasture_id':this.methodpastureid,
+        'api_name':this.chart1.getdataListParm.name,
+        'start_time':this.chart1.getdataListParm.parammaps.startTime,
+        'end_time':this.chart1.getdataListParm.parammaps.stopTime
+      }
+      if(this.chart1.getdataListParm.parammaps.pid){
+        data.pid = this.chart1.getdataListParm.parammaps.pid
+      }
+      postJson(url, data).then(response => {
         if (response.data !== null && response.data.list !== null) {
           this.chart1.list = response.data.data
           console.log('监控图', response.data.list)

+ 3 - 3
src/views/statisticalAnalysis/feedingEfficiency/index.vue

@@ -39,7 +39,7 @@
             class="elTable table-fixed"
             :max-height="myHeight"
           >
-            <el-table-column v-if="tab.isFormulaName" sortable label="配方模板" min-width="70px" align="center" prop="feed_formula_name"" />
+            <el-table-column v-if="tab.isFormulaName" sortable label="配方模板" min-width="70px" align="center" prop="feed_formula_name" />
             <el-table-column v-if="tab.isHouseName" sortable label="栏舍" min-width="70px" align="center" prop="bar_name" />
             <el-table-column v-if="tab.isHouseName" sortable label="配方模板" min-width="70px" align="center" prop="feed_formula_name" />
             <el-table-column v-if="tab.isLivestockType" sortable label="牲畜类别" min-width="70px" align="center" prop="牲畜类别" />
@@ -1862,7 +1862,7 @@ export default {
       }
       let url = '/api/v1/ops/feed_efficiency/chart_statistics'
       postJson(url, data).then(response => {
-        if (response.data !== null && response.data.list !== null && response.data.data !== null) {
+        if (response.data !== null && response.data.list !== null && response.data.data !== null && response.data.data.length > 0) {
           console.log('泌乳牛干物质采食量图表数据', response.data.list)
           for (let i = 0; i < response.data.data.length; i++) {
             if (response.data.data[i].field1 !== '' && response.data.data[i].field1 !== undefined) {
@@ -1954,7 +1954,7 @@ export default {
       }
 
       postJson(url, data).then(response => {
-        if (response.data !== null && response.data.list !== null && response.data.data !== null) {
+        if (response.data !== null && response.data.list !== null && response.data.data !== null && response.data.data.length > 0) {
           console.log('牛栏剩料率图表数据', response.data.list)
           for (let i = 0; i < response.data.data.length; i++) {
             if (response.data.data[i].剩料量 !== '' && response.data.data[i].剩料量 !== undefined) {

+ 2 - 2
src/views/statisticalAnalysis/inventoryManagement/index.vue

@@ -52,10 +52,10 @@
       </el-tab-pane>
       <el-tab-pane label="用料分析" name="second">
         <div class="search">
-          <el-select v-model="tab2.table.getdataListParm.parammaps.pastureId" placeholder="牧场" class="filter-item" style="width: 120px;float:left;margin-right: 10px;">
+          <el-select v-model="tab2.table.getdataListParm.parammaps.pastureId" placeholder="牧场" class="filter-item filter-item1" style="width: 120px;float:left;margin-right: 10px;">
             <el-option v-for="item in pastureList" :key="item.id" :label="item.name" :value="item.id" />
           </el-select>
-          <el-date-picker v-model="tab2.table.getdataListParm.parammaps.inputDatetime" :clearable="false" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="float: left;width: 245px;" :picker-options="pickerOptions" />
+          <el-date-picker v-model="tab2.table.getdataListParm.parammaps.inputDatetime" :clearable="false" class="inputDatetime filter-item1" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="float: left;width: 245px;margin-right: 10px;" :picker-options="pickerOptions" />
           <el-button class="el-icon-arrow-left elIconArrowLeft" :disabled="Beforedisabled2" @click="handleBefore2" />
           <el-button class="el-icon-arrow-right elIconArrowRight" :disabled="Nextdisabled2" @click="handleNext2" />
           <span style="margin-left: 10px;">统计类型:</span>

+ 5 - 5
src/views/statisticalAnalysis/processAnalysis/index.vue

@@ -783,7 +783,7 @@ export default {
       }
       console.log(data,'===999')
       postJson(url, data).then(response => {
-        if (response.data.list !== null) {
+        if (response.data.list !== null && response.data.list.length > 0) {
           this.table.list = response.data.list
           this.table.total = response.data.total
           if (response.data.list[0].lpplantype == '预混计划') {
@@ -1237,7 +1237,7 @@ export default {
       }
       postJson(url, data).then(response => {
         console.log('过程详情table数据', response.data.list)
-        if (response.data.list !== null) {
+        if (response.data.list !== null && response.data.list.length > 0) {
           this.table2.list = response.data.list
         } else {
           this.table2.list = []
@@ -1310,7 +1310,7 @@ export default {
         }
         postJson(url, data).then(response => {
         console.log('混料详情table数据', response.data.list)
-        if (response.data.list !== null) {
+        if (response.data.list !== null && response.data.list.length > 0) {
           this.table3.list = response.data.list
           var sumlweight = 0
           var sumactualweightminus = 0
@@ -1400,7 +1400,7 @@ export default {
       }
       postJson(url, data).then(response => {
         console.log('撒料详情table数据', response.data.list)
-        if (response.data.list !== null) {
+        if (response.data.list !== null && response.data.list.length > 0) {
           this.table4.list = response.data.list
           var sumlweight = 0
           var sumactualweightminus = 0
@@ -1518,7 +1518,7 @@ export default {
       }
       postJson(url, data).then(response => {
       // GetReportform(this.chart1.getdataListParm).then(response => {
-        if (response.data.list !== null) {
+        if (response.data.list !== null && response.data.list.length > 0) {
           this.chart1.list = response.data.data
           console.log('实时监控', response.data.list)
           this.chart1.chartLine_data = response.data.list