| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036 | <template>  <div class="app-container">    <!-- <h1>牧场</h1> -->    <div class="search">      <el-date-picker v-model="table.getdataListParm.parammaps.inputDatetime" :clearable="false" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" :picker-options="pickerOptions" />      <el-button class="el-icon-arrow-left elIconArrowLeft" :disabled="Beforedisabled" @click="handleBefore" />      <el-button class="el-icon-arrow-right elIconArrowRight" :disabled="Nextdisabled" @click="handleNext" />      <el-select v-model="table.getdataListParm.parammaps.lpplantype" placeholder="计划类型" class="filter-item" style="width: 120px;" clearable>        <el-option v-for="item in planTypeList" :key="item.value" :label="item.lable" :value="item.value" />      </el-select>      <el-input v-model="table.getdataListParm.parammaps.tmrtname" placeholder="TMR名称" style="width: 180px;" class="filter-item" clearable />      <el-select v-model="table.getdataListParm.parammaps.iscompleted" placeholder="工作状态" class="filter-item" style="width: 120px;" clearable>        <el-option v-for="item in workingConditionList" :key="item.id" :label="item.name" :value="item.id" />      </el-select>      <el-button class="successBorder" @click="handleSearch">查询</el-button>      <el-button class="successBorder" @click="handleRefresh">重置</el-button>    </div>    <el-row :gutter="10">      <el-col :span="8">        <h4>TMR设备列表</h4>        <div class="table">          <el-table            :key="table.tableKey"            v-loading="table.listLoading"            element-loading-text="给我一点时间"            :data="table.list"            border            fit            highlight-current-row            style="width: 98%;"            :row-style="rowStyle"            :cell-style="cellStyle"            class="elTable table-fixed"            height="970px"            @row-click="rowClick"          >            <el-table-column label="开始时间" min-width="100px" align="center" prop="intime" />            <el-table-column label="计划类型" min-width="80px" align="center" prop="lpplantype" />            <el-table-column label="描述" min-width="90px" align="center" prop="remark" />            <el-table-column label="TMR名称" min-width="80px" align="center" prop="tmrtname" />          </el-table>        </div>        <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ table.total }}条</span>      </el-col>      <!-- 预混计划 -->      <el-col v-if="isPremixedPlan" :span="16">        <h4>{{ title }}</h4>        <div class="detail">          <div class="detail-t">            过程时间:<span v-if="table2.list.length !== 0">{{ table2.list[0].proesstime }}</span>;            工作状态:<span v-if="table2.list.length !== 0">{{ table2.list[0].iscompleted }}</span>          </div>          <div class="detail-b">            <span>混料误差值:<span v-if="table2.list.length !== 0">{{ table2.list[0].Hdif }}kg</span>;</span>            <span>混料准确率:<span v-if="table2.list.length !== 0">{{ table2.list[0].HdifRate }}</span>;</span>          </div>        </div>        <div class="Mixture">          <h4>混料详情</h4>          <el-table            :key="table3.tableKey"            v-loading="table3.listLoading"            element-loading-text="给我一点时间"            :data="table3.list"            border            fit            highlight-current-row            style="width: 98%;"            :row-style="rowStyle"            :cell-style="cellStyle"            class="elTable table-fixed"          >            <el-table-column label="操作编号" min-width="60px" align="center" prop="sort" />            <el-table-column label="饲料名称" min-width="60px" align="center" prop="fname" />            <el-table-column label="计划重量" min-width="60px" align="center" prop="lweight" />            <el-table-column label="实际重量" min-width="60px" align="center" prop="actualweightminus" />            <el-table-column label="误差值" min-width="60px" align="center" prop="diff" />            <el-table-column label="准确率" min-width="60px" align="center" prop="diffRate" />            <el-table-column label="完成时间" min-width="60px" align="center" prop="intime" />            <el-table-column label="过程时间" min-width="60px" align="center" prop="proesstime" />            <el-table-column label="跳转方式" min-width="60px" align="center" prop="buttontype" />            <el-table-column label="开始重量" min-width="60px" align="center" prop="lastactualweight" />            <el-table-column label="结束重量" min-width="60px" align="center" prop="actualweight" />          </el-table>        </div>      </el-col>      <!-- 撒料计划 -->      <el-col v-if="isSpreadingPlan" :span="16">        <h4>{{ title }}</h4>        <div class="detail">          <div class="detail-t">            过程时间:<span v-if="table2.list.length !== 0">{{ table2.list[0].proesstime }}</span>;            工作状态:<span v-if="table2.list.length !== 0">{{ table2.list[0].iscompleted }}</span>          </div>          <div class="detail-b">            <span>混料误差值:<span v-if="table2.list.length !== 0">{{ table2.list[0].Hdif }}kg</span>;</span>            <span>混料准确率:<span v-if="table2.list.length !== 0">{{ table2.list[0].HdifRate }}</span>;</span>            <span>撒料误差值:<span v-if="table2.list.length !== 0">{{ table2.list[0].Sdif }}kg</span>;</span>            <span>撒料准确率:<span v-if="table2.list.length !== 0">{{ table2.list[0].SdifRate }}</span></span>          </div>        </div>        <div class="Mixture">          <h4>混料详情</h4>          <el-table            :key="table3.tableKey"            v-loading="table3.listLoading"            element-loading-text="给我一点时间"            :data="table3.list"            border            fit            highlight-current-row            style="width: 98%;"            :row-style="rowStyle"            :cell-style="cellStyle"            class="elTable table-fixed"          >            <el-table-column label="操作编号" min-width="70px" align="center" prop="sort" />            <el-table-column label="饲料名称" min-width="70px" align="center" prop="fname" />            <el-table-column label="计划重量" min-width="50px" align="center" prop="lweight" />            <el-table-column label="实际重量" min-width="70px" align="center" prop="actualweightminus" />            <el-table-column label="误差值" min-width="70px" align="center" prop="diff" />            <el-table-column label="准确率" min-width="70px" align="center" prop="diffRate" />            <el-table-column label="完成时间" min-width="70px" align="center" prop="intime" />            <el-table-column label="过程时间" min-width="70px" align="center" prop="proesstime" />            <el-table-column label="跳转方式" min-width="70px" align="center" prop="buttontype" />            <el-table-column label="开始重量" min-width="70px" align="center" prop="lastactualweight" />            <el-table-column label="结束重量" min-width="70px" align="center" prop="actualweight" />          </el-table>        </div>        <div class="SpreadingMaterials">          <h4>撒料详情</h4>          <el-table            :key="table4.tableKey"            v-loading="table4.listLoading"            element-loading-text="给我一点时间"            :data="table4.list"            border            fit            highlight-current-row            style="width: 98%;"            :row-style="rowStyle"            :cell-style="cellStyle"            class="elTable table-fixed"            max-height="200px"          >            <el-table-column label="操作编号" min-width="70px" align="center" prop="sort" />            <el-table-column label="栏舍名称" min-width="70px" align="center" prop="fname" />            <el-table-column label="计划重量" min-width="70px" align="center" prop="lweight" />            <el-table-column label="实际重量" min-width="70px" align="center" prop="actualweightminus" />            <el-table-column label="误差值" min-width="70px" align="center" prop="diff" />            <el-table-column label="准确率" min-width="70px" align="center" prop="diffRate" />            <el-table-column label="完成时间" min-width="70px" align="center" prop="intime" />            <el-table-column label="过程时间" min-width="70px" align="center" prop="proesstime" />            <el-table-column label="跳转方式" min-width="70px" align="center" prop="buttontype" />            <el-table-column label="开始重量" min-width="70px" align="center" prop="lastactualweight" />            <el-table-column label="结束重量" min-width="70px" align="center" prop="actualweight" />          </el-table>        </div>        <div class="ControlChart">          <h4>监控图</h4>          <div id="chartLine" style="width: 100%;height:300px;" />        </div>      </el-col>      <!-- 剩料计划 -->      <el-col v-if="isResidualMaterialPlan" :span="16">        <h4>{{ title }}</h4>        <div class="detail">          <div class="detail-t">            过程时间:<span v-if="table2.list.length !== 0">{{ table2.list[0].proesstime }}</span>;            工作状态:<span v-if="table2.list.length !== 0">{{ table2.list[0].iscompleted }}</span>          </div>          <div class="detail-b" />        </div>        <div class="Mixture">          <h4>剩料收集详情</h4>          <el-table            :key="table3.tableKey"            v-loading="table3.listLoading"            element-loading-text="给我一点时间"            :data="table3.list"            border            fit            highlight-current-row            style="width: 98%;"            :row-style="rowStyle"            :cell-style="cellStyle"            class="elTable table-fixed"            max-height="200px"          >            <el-table-column label="操作编号" min-width="110px" align="center">              <template slot-scope="scope">                <span>{{ scope.row.sort }}</span>              </template>            </el-table-column>            <el-table-column label="栏舍名称" min-width="90px" align="center">              <template slot-scope="scope">                <span>{{ scope.row.fname }}</span>              </template>            </el-table-column>            <el-table-column label="剩料采集重量(kg)" min-width="110px" align="center">              <template slot-scope="scope">                <span>{{ scope.row.sweight }}</span>              </template>            </el-table-column>          </el-table>        </div>        <div class="SpreadingMaterials">          <h4>撒料详情</h4>          <el-table            :key="table4.tableKey"            v-loading="table4.listLoading"            :span-method="objectSpanMethod"            element-loading-text="给我一点时间"            :data="table4.list"            border            fit            highlight-current-row            style="width: 98%;"            :row-style="rowStyle"            :cell-style="cellStyle"            class="elTable table-fixed"            max-height="200px"          >            <el-table-column label="操作编号" min-width="110px" align="center" prop="sort" />            <el-table-column label="转投栏舍" min-width="110px" align="center" prop="fname" />            <el-table-column label="允许分配剩料量" min-width="110px" align="center" prop="lweight" />            <el-table-column label="实际分配重量(kg)" min-width="110px" align="center" prop="actualweightminus" />            <el-table-column label="废弃剩料重量" min-width="110px" align="center" prop="aweight" />          </el-table>        </div>      </el-col>      <!-- 撒料计划-混料 -->      <el-col v-if="isSpreadingPlanSH" :span="16">        <h4>{{ title }}</h4>        <div class="detail">          <div class="detail-t">            过程时间:<span v-if="table2.list.length !== 0">{{ table2.list[0].proesstime }}</span>;            工作状态:<span v-if="table2.list.length !== 0">{{ table2.list[0].iscompleted }}</span>          </div>          <div class="detail-b">            <span>混料误差值:<span v-if="table2.list.length !== 0">{{ table2.list[0].Hdif }}kg</span>;</span>            <span>混料准确率:<span v-if="table2.list.length !== 0">{{ table2.list[0].HdifRate }}</span>;</span>            <span>撒料误差值:<span v-if="table2.list.length !== 0">{{ table2.list[0].Sdif }}kg</span>;</span>            <span>撒料准确率:<span v-if="table2.list.length !== 0">{{ table2.list[0].SdifRate }}</span></span>          </div>        </div>        <div class="Mixture">          <h4>混料详情</h4>          <el-table            :key="table3.tableKey"            v-loading="table3.listLoading"            element-loading-text="给我一点时间"            :data="table3.list"            border            fit            highlight-current-row            style="width: 98%;"            :row-style="rowStyle"            :cell-style="cellStyle"            class="elTable table-fixed"          >            <el-table-column label="操作编号" min-width="60px" align="center" prop="sort" />            <el-table-column label="饲料名称" min-width="60px" align="center" prop="fname" />            <el-table-column label="计划重量" min-width="60px" align="center" prop="lweight" />            <el-table-column label="实际重量" min-width="60px" align="center" prop="actualweightminus" />            <el-table-column label="误差值" min-width="60px" align="center" prop="diff" />            <el-table-column label="准确率" min-width="60px" align="center" prop="diffRate" />            <el-table-column label="完成时间" min-width="60px" align="center" prop="intime" />            <el-table-column label="过程时间" min-width="60px" align="center" prop="proesstime" />            <el-table-column label="跳转方式" min-width="60px" align="center" prop="buttontype" />            <el-table-column label="开始重量" min-width="60px" align="center" prop="lastactualweight" />            <el-table-column label="结束重量" min-width="60px" align="center" prop="actualweight" />          </el-table>        </div>        <div class="SpreadingMaterials">          <h4>撒料详情</h4>          <el-table            :key="table4.tableKey"            v-loading="table4.listLoading"            element-loading-text="给我一点时间"            :data="table4.list"            border            fit            highlight-current-row            style="width: 98%;"            :row-style="rowStyle"            :cell-style="cellStyle"            class="elTable table-fixed"            max-height="200px"          >            <el-table-column label="操作编号" min-width="60px" align="center" prop="sort" />            <el-table-column label="撒料车辆" min-width="60px" align="center" prop="fname" />            <el-table-column label="计划重量" min-width="60px" align="center" prop="lweight" />            <el-table-column label="实际重量" min-width="60px" align="center" prop="actualweightminus" />            <el-table-column label="误差值" min-width="60px" align="center" prop="diff" />            <el-table-column label="准确率" min-width="60px" align="center" prop="diffRate" />            <el-table-column label="完成时间" min-width="60px" align="center" prop="intime" />            <el-table-column label="过程时间" min-width="60px" align="center" prop="proesstime" />            <el-table-column label="跳转方式" min-width="60px" align="center" prop="buttontype" />            <el-table-column label="开始重量" min-width="60px" align="center" prop="lastactualweight" />            <el-table-column label="结束重量" min-width="60px" align="center" prop="actualweight" />          </el-table>        </div>        <div class="ControlChart">          <h4>监控图</h4>          <div id="chartLine" style="width: 100%;height:300px;" />        </div>      </el-col>      <!-- 撒料计划-撒料 -->      <el-col v-if="isSpreadingPlanSS" :span="16">        <h4>{{ title }}</h4>        <div class="detail">          <div class="detail-t">            过程时间:<span v-if="table2.list.length !== 0">{{ table2.list[0].proesstime }}</span>;            工作状态:<span v-if="table2.list.length !== 0">{{ table2.list[0].iscompleted }}</span>          </div>          <div class="detail-b">            <span>混料误差值:<span v-if="table2.list.length !== 0">{{ table2.list[0].Hdif }}kg</span>;</span>            <span>混料准确率:<span v-if="table2.list.length !== 0">{{ table2.list[0].HdifRate }}</span>;</span>            <span>撒料误差值:<span v-if="table2.list.length !== 0">{{ table2.list[0].Sdif }}kg</span>;</span>            <span>撒料准确率:<span v-if="table2.list.length !== 0">{{ table2.list[0].SdifRate }}</span></span>          </div>        </div>        <div class="Mixture">          <h4>混料详情</h4>          <el-table            :key="table3.tableKey"            v-loading="table3.listLoading"            element-loading-text="给我一点时间"            :data="table3.list"            border            fit            highlight-current-row            style="width: 98%;"            :row-style="rowStyle"            :cell-style="cellStyle"            class="elTable table-fixed"          >            <el-table-column label="操作编号" min-width="60px" align="center" prop="sort" />            <el-table-column label="撒料车辆" min-width="60px" align="center" prop="fname" />            <el-table-column label="计划重量" min-width="60px" align="center" prop="lweight" />            <el-table-column label="实际重量" min-width="60px" align="center" prop="actualweightminus" />            <el-table-column label="误差值" min-width="60px" align="center" prop="diff" />            <el-table-column label="准确率" min-width="60px" align="center" prop="diffRate" />            <el-table-column label="完成时间" min-width="60px" align="center" prop="intime" />            <el-table-column label="过程时间" min-width="60px" align="center" prop="proesstime" />            <el-table-column label="跳转方式" min-width="60px" align="center" prop="buttontype" />            <el-table-column label="开始重量" min-width="60px" align="center" prop="lastactualweight" />            <el-table-column label="结束重量" min-width="60px" align="center" prop="actualweight" />          </el-table>        </div>        <div class="SpreadingMaterials">          <h4>撒料详情</h4>          <el-table            :key="table4.tableKey"            v-loading="table4.listLoading"            element-loading-text="给我一点时间"            :data="table4.list"            border            fit            highlight-current-row            style="width: 98%;"            :row-style="rowStyle"            :cell-style="cellStyle"            class="elTable table-fixed"            max-height="200px"          >            <el-table-column label="操作编号" min-width="70px" align="center" prop="sort" />            <el-table-column label="撒料车辆" min-width="70px" align="center" prop="fname" />            <el-table-column label="计划重量" min-width="70px" align="center" prop="lweight" />            <el-table-column label="实际重量" min-width="70px" align="center" prop="actualweightminus" />            <el-table-column label="误差值" min-width="70px" align="center" prop="diff" />            <el-table-column label="准确率" min-width="70px" align="center" prop="diffRate" />            <el-table-column label="完成时间" min-width="70px" align="center" prop="intime" />            <el-table-column label="过程时间" min-width="70px" align="center" prop="proesstime" />            <el-table-column label="跳转方式" min-width="70px" align="center" prop="buttontype" />            <el-table-column label="开始重量" min-width="70px" align="center" prop="lastactualweight" />            <el-table-column label="结束重量" min-width="70px" align="center" prop="actualweight" />          </el-table>        </div>        <div class="ControlChart">          <h4>监控图</h4>          <div id="chartLine" style="width: 100%;height:300px;" />        </div>      </el-col>    </el-row>  </div></template><script>import echarts from 'echarts'require('echarts/theme/macarons')import { GetDataByName, GetReportform, formatNum } from '@/api/common'import Cookies from 'js-cookie'import { parseTime } from '@/utils/index.js'export default {  name: 'PastureProcessAnalysis',  data() {    return {      title: '',      isPremixedPlan: '', // 预混计划      isSpreadingPlan: '', // 撒料计划      isResidualMaterialPlan: '', // 剩料计划,      isSpreadingPlanSH: '', // 撒料计划-混料      isSpreadingPlanSS: '', // 撒料计划-撒料      pickerMinDate: '',      Beforedisabled: false,      Nextdisabled: false,      pickerOptions: {        onPick: ({ maxDate, minDate }) => {          this.pickerMinDate = minDate.getTime()          if (maxDate) {            this.pickerMinDate = ''          }        },        // 限制不能选择明天之后的日期        disabledDate: (time) => {          if (this.pickerMinDate !== '') {            const one = 31 * 24 * 3600 * 1000            const minTime = this.pickerMinDate - one            let maxTime = this.pickerMinDate + one            console.log(minTime, 'minTime')            console.log(maxTime, 'maxTime')            console.log(new Date(), 'new Date()')            console.log(Date.now(), 'Date.now()')            console.log(time.getTime(), 'time.getTime()')            if (maxTime > new Date()) {              maxTime = Date.now() + 8.64e7            }            return time.getTime() < minTime || time.getTime() > maxTime          }          return time.getTime() > Date.now() + 8.64e7        }      },      requestParams: [        { name: 'getBarListEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }},        { name: 'getCowclassListEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }}      ],      planTypeList: [{ lable: '预混计划', value: '4' }, { lable: '撒料计划', value: '0' }, { lable: '剩料计划', value: '3' }, { lable: '撒料计划-混料', value: '1' }, { lable: '撒料计划-撒料', value: '2' }, { lable: '预称重计划', value: '5' }], // 计划类型      workingConditionList: [{ id: '0', name: '进行中' }, { id: '1', name: '已完成' }], // 工作状态      // TMR设备列表      table: {        getdataListParm: {          name: 'getprocessAnalysis',          page: 1,          offset: 1,          pagecount: '',          returntype: 'Map',          parammaps: {            pastureid: Cookies.get('pastureid'),            startTime: parseTime(new Date(), '{y}-{m}-{d}'),            stopTime: parseTime(new Date(), '{y}-{m}-{d}'),            inputDatetime: [new Date(), new Date()],            iscompleted: '',            tmrtname: '',            lpplantype: ''          }        },        tableKey: 0,        list: [],        total: 0,        listLoading: true      },      // 过程详情      table2: {        getdataListParm: {          name: 'getprocessAnalysisStr',          page: 1,          offset: 1,          pagecount: 1,          returntype: 'Map',          parammaps: {            pastureid: Cookies.get('pastureid'),            id: ''          }        },        tableKey: 0,        list: [],        total: 0,        listLoading: true      },      // 混料详情      table3: {        getdataListParm: {          name: 'getprocessAnalysisHL',          page: 1,          offset: 1,          pagecount: '',          returntype: 'Map',          parammaps: {            pastureid: Cookies.get('pastureid'),            id: ''          }        },        tableKey: 0,        list: [],        total: 0,        listLoading: true      },      // 撒料详情      table4: {        getdataListParm: {          name: 'getprocessAnalysisSL',          page: 1,          offset: 1,          pagecount: '',          returntype: 'Map',          parammaps: {            pastureid: Cookies.get('pastureid'),            id: ''          }        },        tableKey: 0,        list: [],        total: 0,        listLoading: true      },      chart1: {        getdataListParm: {          name: 'getprocessAnalysisTB',          page: 1,          offset: 1,          pagecount: '',          returntype: 'Map',          parammaps: {            pastureid: Cookies.get('pastureid'),            id: ''          }        },        tableKey: 0,        list: [],        total: 0,        listLoading: false,        chartLine_data: []      },      chartLine: null,      chartLine_data: {},      chartName: '',      rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },      cellStyle: { padding: 0 + 'px' }    }  },  created() {    this.getList()  },  methods: {    // TMR设备列表    getList() {      this.table.listLoading = true      GetDataByName(this.table.getdataListParm).then(response => {        console.log('TMR设备列表table数据', response.data.list)        if (response.data.list !== null) {          this.table.list = response.data.list          this.table.total = response.data.total          if (response.data.list[0].lpplantype == '预混计划') {            this.isPremixedPlan = true            this.isSpreadingPlan = false            this.isResidualMaterialPlan = false            this.isSpreadingPlanSH = false            this.isSpreadingPlanSS = false            this.table2.getdataListParm.parammaps.id = response.data.list[0].id            this.table3.getdataListParm.parammaps.pid = response.data.list[0].id            this.getList2()            this.getList3()          } else if (response.data.list[0].lpplantype == '剩料计划') {            this.isResidualMaterialPlan = true            this.isPremixedPlan = false            this.isSpreadingPlan = false            this.isSpreadingPlanSH = false            this.isSpreadingPlanSS = false            this.table2.getdataListParm.name = 'getprocessAnalysisStrSH'            this.table3.getdataListParm.name = 'getprocessAnalysisHLSH'            this.table4.getdataListParm.name = 'getprocessAnalysisSLSH'            this.table2.getdataListParm.parammaps.id = response.data.list[0].id            this.table3.getdataListParm.parammaps.pid = response.data.list[0].id            this.table4.getdataListParm.parammaps.pid = response.data.list[0].id            this.getList2()            this.getList3()            this.getList4()          } else if (response.data.list[0].lpplantype == '撒料计划-混料') {            // 撒料计划-混料            this.isSpreadingPlan = false            this.isResidualMaterialPlan = false            this.isPremixedPlan = false            this.isSpreadingPlanSH = true            this.isSpreadingPlanSS = false            this.table2.getdataListParm.parammaps.id = response.data.list[0].id            this.table3.getdataListParm.parammaps.pid = response.data.list[0].id            this.table4.getdataListParm.parammaps.pid = response.data.list[0].id            this.getList2()            this.getList3()            this.getList4()            this.chart1.getdataListParm.parammaps.pid = response.data.list[0].id            this.getChart1()          } else if (response.data.list[0].lpplantype == '撒料计划-撒料') {            // 撒料计划-撒料            this.isSpreadingPlan = false            this.isResidualMaterialPlan = false            this.isPremixedPlan = false            this.isSpreadingPlanSH = false            this.isSpreadingPlanSS = true            this.table2.getdataListParm.parammaps.id = response.data.list[0].id            this.table3.getdataListParm.parammaps.pid = response.data.list[0].id            this.table4.getdataListParm.parammaps.pid = response.data.list[0].id            this.getList2()            this.getList3()            this.getList4()            this.chart1.getdataListParm.parammaps.pid = response.data.list[0].id            this.getChart1()          } else if (response.data.list[0].lpplantype == '预称重计划') {            // 撒料计划-混料            this.isSpreadingPlan = false            this.isResidualMaterialPlan = false            this.isPremixedPlan = false            this.isSpreadingPlanSH = true            this.isSpreadingPlanSS = false            this.table2.getdataListParm.parammaps.id = response.data.list[0].id            this.table3.getdataListParm.parammaps.pid = response.data.list[0].id            this.table4.getdataListParm.parammaps.pid = response.data.list[0].id            this.getList2()            this.getList3()            this.getList4()            this.chart1.getdataListParm.parammaps.pid = response.data.list[0].id            this.getChart1()          } else {            // 撒料            this.isSpreadingPlan = true            this.isResidualMaterialPlan = false            this.isPremixedPlan = false            this.isSpreadingPlanSH = false            this.isSpreadingPlanSS = false            this.table2.getdataListParm.parammaps.id = response.data.list[0].id            this.table3.getdataListParm.parammaps.pid = response.data.list[0].id            this.table4.getdataListParm.parammaps.pid = response.data.list[0].id            this.getList2()            this.getList3()            this.getList4()            this.chart1.getdataListParm.parammaps.pid = response.data.list[0].id            this.getChart1()          }          this.title = '过程详情-' + response.data.list[0].lpplantype        } else {          this.table.list = []          this.table2.list = []          this.table3.list = []          this.table2.listLoading = false          this.table3.listLoading = false          this.table4.listLoading = false          this.chart1.listLoading = false        }        setTimeout(() => {          this.table.listLoading = false        }, 100)      })    },    handleSearch() {      console.log('点击了查询')      if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {        this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')        this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')      } else {        this.table.getdataListParm.parammaps.inputDatetime = ''        this.table.getdataListParm.parammaps.startTime = ''        this.table.getdataListParm.parammaps.stopTime = ''      }      this.table.getdataListParm.offset = 1      this.getList()    },    handleRefresh() {      console.log('点击了重置')      this.table.getdataListParm.parammaps.tmrtname = ''      this.table.getdataListParm.parammaps.iscompleted = ''      this.table.getdataListParm.parammaps.lpplantype = ''      this.table.getdataListParm.parammaps.startTime = parseTime(new Date(), '{y}-{m}-{d}')      this.table.getdataListParm.parammaps.stopTime = parseTime(new Date(), '{y}-{m}-{d}')      this.table.getdataListParm.parammaps.inputDatetime = [new Date(), new Date()]      this.table.getdataListParm.offset = 1      this.getList()    },    handleBefore() {      if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {        var start = new Date(this.table.getdataListParm.parammaps.inputDatetime[0].setDate(this.table.getdataListParm.parammaps.inputDatetime[0].getDate() - 1))        var stop = new Date(this.table.getdataListParm.parammaps.inputDatetime[1].setDate(this.table.getdataListParm.parammaps.inputDatetime[1].getDate() - 1))        if (stop > Date.now()) {          this.Nextdisabled = true          this.Beforedisabled = false        } else {          this.Nextdisabled = false          this.Beforedisabled = false        }        this.table.getdataListParm.parammaps.inputDatetime.length = 0        this.table.getdataListParm.parammaps.inputDatetime.push(start, stop)        this.$forceUpdate()      }      this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')      this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')      this.getList()    },    handleNext() {      if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {        var start2 = new Date(this.table.getdataListParm.parammaps.inputDatetime[0].setDate(this.table.getdataListParm.parammaps.inputDatetime[0].getDate() + 1))        var stop2 = new Date(this.table.getdataListParm.parammaps.inputDatetime[1].setDate(this.table.getdataListParm.parammaps.inputDatetime[1].getDate() + 1))        // console.log(stop2)        // console.log(Date.now() + 8.64e7)        // console.log(stop2 > Date.now() + 8.64e7)        if (stop2 > Date.now()) {          this.Nextdisabled = true          this.Beforedisabled = false        } else {          this.Nextdisabled = false          this.Beforedisabled = false        }        this.table.getdataListParm.parammaps.inputDatetime.length = 0        this.table.getdataListParm.parammaps.inputDatetime.push(start2, stop2)        this.$forceUpdate()      }      this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')      this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')      this.getList()    },    rowClick(row, column, event) {      this.table2.getdataListParm.parammaps.id = row.id      this.table3.getdataListParm.parammaps.pid = row.id      this.table4.getdataListParm.parammaps.pid = row.id      this.chart1.getdataListParm.parammaps.pid = row.id      this.chartName = row.tmrtname      if (row.lpplantype == '预混计划') {        this.isPremixedPlan = true        this.isResidualMaterialPlan = false        this.isSpreadingPlan = false        this.isSpreadingPlanSH = false        this.isSpreadingPlanSS = false        this.table2.getdataListParm.name = 'getprocessAnalysisStr'        this.table3.getdataListParm.name = 'getprocessAnalysisHL'        this.getList2()        this.getList3()      } else if (row.lpplantype == '剩料计划') {        this.isResidualMaterialPlan = true        this.isPremixedPlan = false        this.isSpreadingPlan = false        this.isSpreadingPlanSH = false        this.isSpreadingPlanSS = false        this.table2.getdataListParm.name = 'getprocessAnalysisStrSH'        this.table3.getdataListParm.name = 'getprocessAnalysisHLSH'        this.table4.getdataListParm.name = 'getprocessAnalysisSLSH'        this.getList2()        this.getList3()        this.getList4()      } else if (row.lpplantype == '撒料计划-混料') {        this.isSpreadingPlan = false        this.isPremixedPlan = false        this.isResidualMaterialPlan = false        this.isSpreadingPlanSH = true        this.isSpreadingPlanSS = false        this.table2.getdataListParm.name = 'getprocessAnalysisStr'        this.table3.getdataListParm.name = 'getprocessAnalysisHL'        this.table4.getdataListParm.name = 'getprocessAnalysisSL'        this.getList2()        this.getList3()        this.getList4()        this.getChart1()      } else if (row.lpplantype == '撒料计划-撒料') {        this.isSpreadingPlan = false        this.isPremixedPlan = false        this.isResidualMaterialPlan = false        this.isSpreadingPlanSH = false        this.isSpreadingPlanSS = true        this.table2.getdataListParm.name = 'getprocessAnalysisStr'        this.table3.getdataListParm.name = 'getprocessAnalysisHL'        this.table4.getdataListParm.name = 'getprocessAnalysisSL'        this.getList2()        this.getList3()        this.getList4()        this.getChart1()      } else if (row.lpplantype == '预称重计划') {        this.isSpreadingPlan = false        this.isPremixedPlan = false        this.isResidualMaterialPlan = false        this.isSpreadingPlanSH = true        this.isSpreadingPlanSS = false        this.table2.getdataListParm.name = 'getprocessAnalysisStr'        this.table3.getdataListParm.name = 'getprocessAnalysisHL'        this.table4.getdataListParm.name = 'getprocessAnalysisSL'        this.getList2()        this.getList3()        this.getList4()        this.getChart1()      } else {        this.isSpreadingPlan = true        this.isPremixedPlan = false        this.isResidualMaterialPlan = false        this.isSpreadingPlanSH = false        this.isSpreadingPlanSS = false        this.table2.getdataListParm.name = 'getprocessAnalysisStr'        this.table3.getdataListParm.name = 'getprocessAnalysisHL'        this.table4.getdataListParm.name = 'getprocessAnalysisSL'        this.getList2()        this.getList3()        this.getList4()        this.getChart1()      }      this.title = '过程详情-' + row.lpplantype    },    // 过程详情    getList2() {      this.table2.listLoading = false      GetDataByName(this.table2.getdataListParm).then(response => {        console.log('过程详情table数据', response.data.list)        if (response.data.list !== null) {          this.table2.list = response.data.list        } else {          this.table2.list = []        }        setTimeout(() => {          this.table2.listLoading = false        }, 100)      })    },    // 混料详情    getList3() {      this.table3.listLoading = false      GetDataByName(this.table3.getdataListParm).then(response => {        console.log('混料详情table数据', response.data.list)        if (response.data.list !== null) {          this.table3.list = response.data.list          var sumlweight = 0          var sumactualweightminus = 0          var sumsweight = 0          var sumproesstime = ''          for (let i = 0; i < response.data.list.length; i++) {            if (response.data.list[i].lweight == undefined) { response.data.list[i].lweight = 0 }            if (response.data.list[i].actualweightminus == undefined) { response.data.list[i].actualweightminus = 0 }            if (response.data.list[i].sweight == undefined) { response.data.list[i].sweight = 0 }            sumlweight += parseFloat(response.data.list[i].lweight)            sumactualweightminus += parseFloat(response.data.list[i].actualweightminus)            sumsweight += parseFloat(response.data.list[i].sweight)            sumproesstime = response.data.list[0].sumproesstime          }          sumlweight = formatNum(sumlweight, 2)          sumactualweightminus = formatNum(sumactualweightminus, 2)          sumsweight = formatNum(sumsweight, 2)          this.table3.list.push({ 'sort': '合计', 'lweight': sumlweight, 'actualweightminus': sumactualweightminus, 'sweight': sumsweight, 'proesstime': sumproesstime })        } else {          this.table3.list = []        }        setTimeout(() => {          this.table3.listLoading = false        }, 100)      })    },    // 撒料详情    getList4() {      this.table4.listLoading = false      GetDataByName(this.table4.getdataListParm).then(response => {        console.log('撒料详情table数据', response.data.list)        if (response.data.list !== null) {          this.table4.list = response.data.list          var sumlweight = 0          var sumactualweightminus = 0          var sumsweight = 0          var sumproesstime = ''          for (let i = 0; i < response.data.list.length; i++) {            if (response.data.list[i].lweight == undefined) { response.data.list[i].lweight = 0 }            if (response.data.list[i].actualweightminus == undefined) { response.data.list[i].actualweightminus = 0 }            if (response.data.list[i].sweight == undefined) { response.data.list[i].sweight = 0 }            sumlweight += parseFloat(response.data.list[i].lweight)            sumactualweightminus += parseFloat(response.data.list[i].actualweightminus)            sumsweight += parseFloat(response.data.list[i].sweight)            sumproesstime = response.data.list[0].sumproesstime          }          sumlweight = formatNum(sumlweight, 2)          sumactualweightminus = formatNum(sumactualweightminus, 2)          sumsweight = formatNum(sumsweight, 2)          this.table4.list.push({ 'sort': '合计', 'lweight': sumlweight, 'actualweightminus': sumactualweightminus, 'sweight': sumsweight, 'proesstime': sumproesstime })          this.rowspan()        } else {          this.table4.list = []        }        setTimeout(() => {          this.table4.listLoading = false        }, 100)      })    },    rowspan() {      this.spanArr = []      this.table4.list.forEach((item, index) => {        if (index == 0) {          this.spanArr.push(1)          this.position = 0        } else {          console.log(item, index, '======')          if (this.table4.list[index].aweight == this.table4.list[index - 1].aweight) {            this.spanArr[this.position] += 1            this.spanArr.push(0)          } else {            this.spanArr.push(1)            this.position = index          }        }      })    },    objectSpanMethod({ row, column, rowIndex, columnIndex }) {      if (columnIndex == 4) {        const _row = this.spanArr[rowIndex]        const _col = _row > 0 ? 1 : 0        return {          rowspan: _row,          colspan: _col        }      }    },    getChart1() {      this.chart1.listLoading = true      GetReportform(this.chart1.getdataListParm).then(response => {        if (response.data.list !== null) {          // response.data.list = {          //   'data1': ['09:34:32', '09:34:46', '09:34:46', '09:34:50'],          //   'data2': [['09:34:32', '1724.80', '栏舍:', '12,777,99'], ['09:34:46', '1724.81', '饲料', '22'], ['09:34:46', '-50.51', '栏舍:', '32'], ['09:34:50', '-50.51', '饲料:', '42']],          //   'data3': [['09:34:32', '0', '栏舍:', '12'], ['09:34:46', '1724', '饲料', '22'], ['09:34:46', '1724', '栏舍:', '32'], ['09:34:50', '1', '饲料:', '42']],          //   'data4': [          //     ['09:34:32', '0.00', '栏舍:', '12'],          //     ['09:34:46', '1725.00', '栏舍:', '12'],          //     ['09:34:46', '1725.00', '栏舍:', '12'],          //     ['09:34:50', '1.00', '栏舍:', '12']          //   ],          //   'data5': []          // }          this.chart1.list = response.data.data          // console.log('实时监控', response.data.list.data4)          console.log('实时监控', response.data.list)          var evenNumbers = []// 偶数          var oddNumbers = []// 奇数          for (let i = 0; i < response.data.list.data4.length; i++) {            console.log(response.data.list.data4[i])            if (i == 0) {              oddNumbers.push(response.data.list.data4[i])            } else {              if (i % 2 == 0) {                evenNumbers.push(response.data.list.data4[i])              } else {                oddNumbers.push(response.data.list.data4[i])              }            }          }          response.data.list.data4 = oddNumbers          response.data.list.data5 = evenNumbers          this.chart1.chartLine_data = response.data.list          this.chart1.total = response.data.total          this.roadChartLine1(this.chart1.chartLine_data)        } else {          this.chart1.list = []        }        setTimeout(() => {          this.chart1.listLoading = false        }, 100)      })    },    roadChartLine1(chartLine_data) {      console.log(chartLine_data, 'chartLine_data')      if (this.chartLine != null) {        this.chartLine.dispose()      }      this.chartLine = echarts.init(document.getElementById('chartLine'))      var option = {        title: { text: '', subtext: '' },        color: ['#38c193', '#5199e5', '#fdb06a', '#fb8b73'], // 关键加上这句话,legend的颜色和折线的自定义颜色就一致了        legend: [{          itemWidth: 15, itemHeight: 7, right: '25%', textStyle: { fontSize: 12 },          data: [{ name: '设计重量' }, { name: '实际重量' }]        }, {          itemWidth: 15, itemHeight: 15, right: '0', textStyle: { fontSize: 12 },          data: [{ name: '开始重量', icon: 'image://https://kptyun.cn:8081/file/pic/3.png' }, { name: '结束重量', icon: 'image://https://kptyun.cn:8081/file/pic/4.png' }]        }],        tooltip: {          trigger: 'axis',          formatter: function(params) {            // console.log(params, 'params')            var tip = params[0].name            for (let i = 0; i < params.length; i++) {              tip += '<br>' + params[i].seriesName + ': '              if (params[i].value[0] == params[0].name) {                tip += params[i].value[1]              } else {                tip += params[i].value              }            }            tip += '<br>' + params[0].data[2] + params[0].data[3]            console.log(tip, 'tip')            return tip          }        },        calculable: true,        xAxis: [          { type: 'category', splitLine: { show: false }, name: '时间', data: chartLine_data.data1, axisLabel: { show: true, textStyle: { color: '#666' }}}        ],        yAxis: [{ type: 'value' }],        series: [          { symbol: 'none', name: '实际重量', type: 'line', data: chartLine_data.data3, smooth: true, barWidth: '37', itemStyle: { normal: { lineStyle: { color: '#38c193' }}}},          { symbol: 'none', name: '设计重量', type: 'line', step: 'middle', data: chartLine_data.data2 },          { name: '开始重量', symbol: 'image://https://kptyun.cn:8081/file/pic/3.png', symbolSize: 10, type: 'scatter', data: chartLine_data.data4 },          { name: '结束重量', symbol: 'image://https://kptyun.cn:8081/file/pic/4.png', symbolSize: 10, type: 'scatter', data: chartLine_data.data5 }        ]      }      this.chartLine.setOption(option)      window.onresize = function() {        this.chartLine.resize()      }    }  }}</script><style lang="scss" scoped>  .search{padding-top:10px;clear: both;}  .table{margin-top:10px;}  .detail{    height:84px;border: 1px solid #EBEEF5;padding-left:10px;font:16px/32px '';color:#333;    .detail-t{margin-top: 10px;}    .detail-b{margin-bottom: 10px;}  }</style>
 |