123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638 |
- <template>
- <div ref="dashboardEditor" class="dashboard-editor-container">
- <h1>牧场</h1>
- <div style="background: #F4F4F4;height: 10px;" />
- <div v-if="news==1" style="display:none;" class="news"><b>消息提醒:</b>撒料计划未分配完善,请及时进行计划分配</div>
- <div v-if="news==2" style="display:none;" class="news"><b>消息提醒:</b>预混计划未分配完善,请及时进行计划分配</div>
- <div v-if="news==3" style="display:none;" class="news"><b>消息提醒:</b>剩料计划未分配完善,请及时进行计划分配</div>
- <div class="bottom">
- <!-- <h4>{{ date }}</h4> -->
- <el-row :gutter="20" style="margin-top: 10px;">
- <el-col :span="6">
- <div class="grid-content one">
- <div class="Left">
- <i class="iconfont icon-shuaxin" />
- </div>
- <div class="Right">
- <span>昨日混料准确率:</span>{{ row1.list.yesRateHL }}<br>
- <span>近30天混料准确率:</span>{{ row1.list.monRateHL }}
- </div>
- </div>
- </el-col>
- <el-col :span="6">
- <div class="grid-content two">
- <div class="Left">
- <i class="iconfont icon-zhunqueshuai2" />
- </div>
- <div class="Right">
- <span>昨日撒料准确率:</span>{{ row1.list.yesRateSL }}<br>
- <span>近30天撒料准确率:</span>{{ row1.list.monRateSL }}
- </div>
- </div>
- </el-col>
- <el-col :span="6">
- <div class="grid-content three">
- <div class="Left">
- <i class="iconfont icon-zhinengsiwei" style="font-size: 40px;" />
- </div>
- <div class="Right">
- <span>昨日撒料正确率:</span>{{ row1.list.yesRateSLR }}<br>
- <span>近30天撒料正确率:</span>{{ row1.list.monRateSLR }}
- </div>
- </div>
- </el-col>
- <el-col :span="6">
- <div class="grid-content four">
- <div class="Left">
- <i class="iconfont icon-siliaotoufangjilu" style="font-size: 50px;" />
- </div>
- <div class="Right">
- <span style="width:116px;">昨日撒料偏差:</span>{{ row1.list.temtime }} min<br>
- <span style="width:116px;">近30天撒料偏差:</span>{{ row1.list.montime }} min
- </div>
- </div>
- </el-col>
- </el-row>
- <el-row :gutter="20" style="margin-top: 20px;">
- <el-col :span="6">
- <div class="grid-content" style="height:500px;background: #fff;">
- <div style="height: 250px; border-bottom: 1px solid #000;">
- <!-- <div class="Title">今日计划统计</div> -->
- <b style="padding-left: 10px;line-height: 50px;font-size: 20px;">今日计划统计</b><br>
- <div style="text-align: center;">
- <b style="padding-right: 10px;font-size: 14px;">完成车次:{{ row2.chart1.chartLine_data.data1 }}</b>
- <b style="padding-right: 10px;font-size: 14px;">计划车次:{{ row2.chart1.chartLine_data.data2 }}</b>
- </div>
- <div id="row2chartLine1" style="height: 150px;" />
- </div>
- <div style="height: 250px;">
- <div style="text-align: center;padding-top:50px;">
- <b style="padding-right: 5px;font-size: 14px;">完成重量:{{ row2.chart2.chartLine_data.data1 }}kg</b>
- <b style="padding-right: 5px;font-size: 14px;">计划重量:{{ row2.chart2.chartLine_data.data2 }}kg</b>
- </div>
- <div id="row2chartLine2" style="height: 150px;" />
- </div>
- </div>
- </el-col>
- <el-col :span="18" style="margin-top:-20px;">
- <div class="grid-content" style="height:500px;">
- <div style="height:350px;">
- <!-- <div style="font-size:14px;color:#666;margin:0 auto;position: relative;">
- <span style="line-height:30px;position:absolute;right:190px;top:30px;"><i class="el-icon-caret-top" style="color:#ff3131;line-height:30px;font-size:30px;" /><b style="line-height:32px;">开始重量</b></span>
- <span style="line-height:30px;position:absolute;right:100px;top:30px;"><i class="el-icon-caret-top" style="color:#61a5e8;line-height:30px;font-size:30px;" /><b style="line-height:32px;">结束重量</b></span>
- </div> -->
- <div class="Title">实时监控</div>
- <div id="row2chartLine3" rfef="row2chartLine3" style="height: 90%;" />
- </div>
- <div id="car" ref="car" class="car" style="position: relative;">
- <p style="position: absolute;left:50px;top:-50px;">当前车辆数:{{ carLength }}</p>
- <i ref="left" class="el-icon-arrow-left" @click="handleLeft" />
- <el-row id="carList" ref="carList" :gutter="20" class="carList">
- <el-col v-for="(item,index) in list" id="list" :key="index" :span="8">
- <div ref="list" class="list" :style="{'background': item.background,'color':item.color}" @click="handleList(index,item)">
- <el-row :gutter="20" class="li">
- <el-col :span="12" class="list-l">
- <!-- 车辆/描述 -->
- <p><span>车辆:</span>{{ item.tname }}</p>
- <el-tooltip placement="top">
- <p slot="content">
- <span v-if="item.inorout == 0">饲料:{{ item.fname }}</span>
- <span v-if="item.inorout == 1">栏舍:{{ item.fname }}</span>
- </p>
- <p>
- <span v-if="item.inorout == 0">饲料:{{ item.fname }}</span>
- <span v-if="item.inorout == 1">栏舍:{{ item.fname }}</span>
- </p>
- </el-tooltip>
- <p><span>完成重量:</span>{{ item.doneweight }}</p>
- <p><span>完成度:</span>{{ item.donerate }}</p>
- </el-col>
- <el-col :span="12" class="list-r">
- <!-- 栏舍/饲料 -->
- <el-tooltip placement="top">
- <p slot="content"> <span>描述:</span> {{ item.remark }} </p>
- <p> <span>描述:</span> {{ item.remark }} </p>
- </el-tooltip>
- <p><span>计划重量:</span>{{ item.lweight }}</p>
- <p><span>剩余重量:</span>{{ item.leftweight }}</p>
- <p><span>车辆当前载重:</span>{{ item.nowweight }}</p>
- </el-col>
- </el-row>
- </div>
- </el-col>
- </el-row>
- <i ref="right" class="el-icon-arrow-right" @click="handleRight" />
- </div>
- </div>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <!-- 计划统计 -->
- <el-col :span="12" style="position: relative;">
- <div class="Title">计划统计</div>
- <div style="background: #fff;height:50px;">
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row3chartLine1')">导出</el-button>
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('row3chartLine1')">切换表格</el-button>
- </div>
- <div id="row3chartLine1" style="background: #fff;height:350px;" />
- <div v-if="row3.chart1.isTable" class="table" style="position: absolute;width:97%;top:19px;">
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row3chartLine1')">导出</el-button>
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('row3chartLine1')">切换图表</el-button>
- <el-table
- :key="row3.chart1.table.tableKey"
- v-loading="row3.chart1.table.listLoading"
- element-loading-text="给我一点时间"
- :data="row3.chart1.table.list"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- height="400"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="日期" sortable min-width="110px" align="center" prop="日期" />
- <el-table-column label="计划执行重量(kg)" sortable min-width="110px" align="center" prop="实际量" />
- <el-table-column label="配方理论重量(kg)" sortable min-width="110px" align="center" prop="理论量" />
- <el-table-column label="计划准确率" sortable min-width="110px" align="center" prop="field1" />
- <el-table-column label="计划取消重量(kg)" sortable min-width="110px" align="center" prop="计划取消重量" />
- <el-table-column label="计划准确率(去除取消重量)" sortable min-width="110px" align="center" prop="field3" />
- <el-table-column label="计划正确数" sortable min-width="110px" align="center" prop="正确数" />
- <el-table-column label="计划数" sortable min-width="110px" align="center" prop="计划数" />
- <el-table-column label="计划正确率" sortable min-width="110px" align="center" prop="field2" />
- </el-table>
- </div>
- </el-col>
- <!-- 泌乳牛干物质采食量 -->
- <el-col :span="12" style="position: relative;">
- <div class="Title">泌乳牛干物质采食量</div>
- <div style="background: #fff;height:50px;">
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row3chartLine2')">导出</el-button>
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('row3chartLine2')">切换表格</el-button>
- </div>
- <div id="row3chartLine2" style="background: #fff;height:350px;" />
- <div v-if="row3.chart2.isTable" class="table" style="position: absolute;width:97%;top:19px;">
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row3chartLine2')">导出</el-button>
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('row3chartLine2')">切换图表</el-button>
- <el-table
- :key="row3.chart2.table.tableKey"
- v-loading="row3.chart2.table.listLoading"
- element-loading-text="给我一点时间"
- :data="row3.chart2.table.list"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- height="400"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="日期" sortable min-width="110px" align="center" prop="日期" />
- <el-table-column label="泌乳牛采食量(kg)" sortable min-width="110px" align="center" prop="field1" />
- <el-table-column label="泌乳牛产奶量(kg)" sortable min-width="110px" align="center" prop="field2" />
- </el-table>
- </div>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <!-- 成本统计 -->
- <el-col :span="8" style="position: relative;">
- <div class="Title">成本统计</div>
- <div style="background: #fff;height:50px;">
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row4chartLine1')">导出</el-button>
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('row4chartLine1')">切换表格</el-button>
- </div>
- <div id="row4chartLine1" style="background: #fff;height:350px;" />
- <div v-if="row4.chart1.isTable" class="table" style="position: absolute;width:97%;top:19px;">
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row4chartLine1')">导出</el-button>
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('row4chartLine1')">切换图表</el-button>
- <el-table
- :key="row4.chart1.table.tableKey"
- v-loading="row4.chart1.table.listLoading"
- element-loading-text="给我一点时间"
- :data="row4.chart1.table.list"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- height="400"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="日期" sortable min-width="110px" align="center" prop="日期" />
- <el-table-column label="单头牛饲料成本" sortable min-width="110px" align="center" prop="名称" />
- <el-table-column label="公斤奶饲料成本(元)" sortable min-width="110px" align="center" prop="准确" />
- </el-table>
- </div>
- </el-col>
- <!-- 混料实际重量统计 -->
- <el-col :span="8" style="position: relative;">
- <div class="Title">混料实际重量统计</div>
- <div style="background: #fff;height:50px;">
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row4chartLine2')">导出</el-button>
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('row4chartLine2')">切换表格</el-button>
- </div>
- <div id="row4chartLine2" style="background: #fff;height:350px;" />
- <div v-if="row4.chart2.isTable" class="table" style="position: absolute;width:97%;top:19px;">
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row4chartLine2')">导出</el-button>
- <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('row4chartLine2')">切换图表</el-button>
- <el-table
- :key="row4.chart2.table.tableKey"
- v-loading="row4.chart2.table.listLoading"
- element-loading-text="给我一点时间"
- :data="row4.chart2.table.list"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- height="400"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="日期" sortable min-width="110px" align="center" prop="日期" />
- <el-table-column label="重量" sortable min-width="110px" align="center" prop="实际量" />
- </el-table>
- </div>
- </el-col>
- <el-col :span="8">
- <div class="Title">库存预警</div>
- <div id="table" style="height: 400px;background: #fff;">
- <el-table
- :key="row4.table.tableKey"
- v-loading="row4.table.listLoading"
- element-loading-text="给我一点时间"
- :data="row4.table.list"
- border
- fit
- highlight-current-row
- style="width: 100%;background: #fff;"
- height="400"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="序号" type="index" min-width="80px" align="center" />
- <el-table-column label="饲料名称" min-width="80px" align="center" prop="feedname" />
- <el-table-column label="库存量(kg)" min-width="70px" align="center" prop="stockweight" />
- <el-table-column label="剩余使用天数" min-width="80px" align="center" prop="ldays" />
- </el-table>
- <!-- <span style="line-height: 50px;color:#82CBB3;text-align: center;width: 100%;display: inline-block;cursor:pointer;" @click="handleMore">查看更多</span> -->
- </div>
- </el-col>
- </el-row>
- </div>
- </div>
- </template>
- <script>
- import { GetDataByName, GetReportform } from '@/api/common'
- import Cookies from 'js-cookie'
- import { parseTime } from '@/utils/index.js'
- import echarts from 'echarts'
- import { json2excel } from '@/utils/index.js'
- require('echarts/theme/macarons')
- // var myKey = 0
- var that = this
- var carIndex = 0 // 判断是否大于当前车辆数
- var index = 0 // 判断当前跳到第几个车辆
- var timer = null
- export default {
- name: 'PastureDashboard',
- inject: ['reload'],
- data() {
- return {
- val: '这是值1',
- date: parseTime(new Date(), '{y}-{m}-{d}'),
- list: [],
- news: 1,
- carLength: 0, // 车辆
- myKey: 0, // 轮播Key值
- row1: {
- getdataListParm: {
- name: 'getHomepageStr',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid')
- }
- },
- listLoading: true,
- list: ''
- },
- row2: {
- chart1: {
- chartLine: null,
- chartLine_data: {}
- },
- chart2: {
- chartLine: null,
- chartLine_data: {}
- },
- chart3: {
- chartLine: null,
- chartLine_data: {},
- getdataListParm: {
- name: 'getHomeprocessAnalysis',
- page: 1,
- offset: 1,
- pagecount: 3,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- id: '',
- pid: ''
- }
- },
- list: [],
- total: 0,
- listLoading: true,
- pageNum: '',
- pages: '',
- getdataListParmList: {
- name: 'getHomepageLBList',
- page: 1,
- offset: 1,
- pagecount: 3,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid')
- }
- },
- list2: [],
- total2: 0,
- listLoading2: true,
- pageNum2: '',
- pages2: ''
- }
- },
- row3: {
- chartDate: [],
- chart1: {
- chartLine: null,
- chartLine_data: {},
- getdataListParm: {
- name: 'getAccuracyAllJH',
- page: 1,
- offset: 1,
- pagecount: 10,
- 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()]
- }
- },
- list: [],
- total: 0,
- listLoading: true,
- isChart: true,
- isTable: false,
- table: {
- tableKey: 1,
- list: [],
- total: 0,
- listLoading: false
- }
- },
- chart2: {
- chartLine: null,
- chartLine_data: {},
- getdataListParm: {
- name: 'getFeedEffMR',
- page: 1,
- offset: 1,
- pagecount: 10,
- 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()]
- }
- },
- list: [],
- total: 0,
- listLoading: true,
- isChart: true,
- isTable: false,
- table: {
- tableKey: 1,
- list: [],
- total: 0,
- listLoading: false
- }
- }
- },
- row4: {
- chartDate: [],
- chart1: {
- chartLine: null,
- chartLine_data: {},
- getdataListParm: {
- name: 'getHomepageCB',
- page: 1,
- offset: 1,
- pagecount: 10,
- 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()]
- }
- },
- list: [],
- total: 0,
- listLoading: true,
- isChart: true,
- isTable: false,
- table: {
- tableKey: 1,
- list: [],
- total: 0,
- listLoading: false
- }
- },
- chart2: {
- chartLine: null,
- chartLine_data: {},
- getdataListParm: {
- name: 'getAccuraaActHL',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- pastureid: Cookies.get('pastureid'),
- startTime: parseTime(new Date(), '{y}-{m}-{d}'),
- stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
- inputDatetime: [new Date(), new Date()]
- }
- },
- list: [],
- total: 0,
- listLoading: true,
- isChart: true,
- isTable: false,
- table: {
- tableKey: 1,
- list: [],
- total: 0,
- listLoading: false
- }
- },
- table: {
- getdataListParm: {
- name: 'getFsWarnList',
- page: 1,
- offset: 1,
- pagecount: 5,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid')
- }
- },
- tableKey: 1,
- list: [],
- total: 0,
- listLoading: true,
- temp: {}
- }
- },
- rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
- cellStyle: { padding: 0 + 'px' },
- timer: null
- }
- },
- created() {
- // this.reload()
- this.getCarLength()
- this.getChart3List()
- this.getTimeFn()
- this.getList()
- this.getChart4()
- this.getChart5()
- this.getChart6()
- this.getChart7()
- this.getTable8()
- },
- mounted() {
- this.timer = null
- this.timer = setInterval(this.autoPlay, 15000)
- },
- destroyed() {
- clearInterval(this.timer)
- },
- methods: {
- autoPlay() {
- // that.carLength 当前车辆数
- if (this.carLength > 3) {
- // 车辆数量大于3
- index = 0
- this.row2.chart3.getdataListParmList.offset = this.row2.chart3.getdataListParmList.offset + 1
- this.getChart3List()
- console.log('this.list.length', this.list.length)
- if (this.list.length < 0) {
- this.row2.chart3.getdataListParmList.offset = 1
- this.getChart3List()
- }
- this.$refs.list[2].style.color = '#fff'
- this.$refs.list[2].style.background = '#7ac3ec'
- } else {
- // 车辆数量小于3
- var myIndex = ++index
- console.log('index < this.carLength')
- if (myIndex == 3) {
- index = 0
- for (let i = 0; i < this.$refs.list.length; i++) {
- if (index == i) {
- this.$refs.list[i].style.background = '#7ac3ec'
- this.$refs.list[i].style.color = '#f7f941'
- this.row2.chart3.getdataListParm.parammaps.pid = this.list[i].pid
- this.row2.chart3.getdataListParm.parammaps.id = this.list[i].id
- this.getChart3()
- } else {
- this.$refs.list[i].style.color = '#fff'
- this.$refs.list[i].style.background = '#7ac3ec'
- }
- }
- } else if (myIndex == 2) {
- for (let j = 0; j < this.$refs.list.length; j++) {
- if (myIndex == j) {
- this.$refs.list[j].style.background = '#7ac3ec'
- this.$refs.list[j].style.color = '#f7f941'
- this.row2.chart3.getdataListParm.parammaps.pid = this.list[j].pid
- this.row2.chart3.getdataListParm.parammaps.id = this.list[j].id
- this.getChart3()
- } else {
- this.$refs.list[j].style.color = '#fff'
- this.$refs.list[j].style.background = '#7ac3ec'
- }
- }
- } else if (myIndex == 1) {
- for (let j = 0; j < this.$refs.list.length; j++) {
- if (myIndex == j) {
- this.$refs.list[j].style.background = '#7ac3ec'
- this.$refs.list[j].style.color = '#f7f941'
- this.row2.chart3.getdataListParm.parammaps.pid = this.list[j].pid
- this.row2.chart3.getdataListParm.parammaps.id = this.list[j].id
- this.getChart3()
- } else {
- this.$refs.list[j].style.color = '#fff'
- this.$refs.list[j].style.background = '#7ac3ec'
- }
- }
- }
- }
- // console.log(index, 'index')
- },
- getTimeFn() {
- // this.reload()
- const that = this
- const end = new Date()
- const start = new Date()
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 20)
- that.row3.chartDate[0] = parseTime(start, '{y}-{m}-{d}')
- that.row3.chartDate[1] = parseTime(end, '{y}-{m}-{d}')
- that.row3.chart1.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
- that.row3.chart1.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
- that.row3.chart1.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
- that.row3.chart1.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
- that.row3.chart2.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
- that.row3.chart2.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
- that.row3.chart2.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
- that.row3.chart2.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
- that.row4.chartDate[0] = parseTime(start, '{y}-{m}-{d}')
- that.row4.chartDate[1] = parseTime(end, '{y}-{m}-{d}')
- that.row4.chart1.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
- that.row4.chart1.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
- that.row4.chart1.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
- that.row4.chart1.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
- that.row4.chart2.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
- that.row4.chart2.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
- that.row4.chart2.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
- that.row4.chart2.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
- },
- getList() {
- this.row1.listLoading = true
- GetDataByName(this.row1.getdataListParm).then(response => {
- console.log('row1数据', response.data.list)
- if (response.data.list !== null) {
- if (response.data.list[0].monRateHL == undefined) { response.data.list[0].monRateHL = '' }
- if (response.data.list[0].monRateSL == undefined) { response.data.list[0].monRateSL = '' }
- if (response.data.list[0].monRateSLR == undefined) { response.data.list[0].monRateSLR = '' }
- if (response.data.list[0].yesRateHL == undefined) { response.data.list[0].yesRateHL = '' }
- if (response.data.list[0].yesRateHL == undefined) { response.data.list[0].yesRateHL = '' }
- if (response.data.list[0].yesRateSL == undefined) { response.data.list[0].yesRateSL = '' }
- if (response.data.list[0].yesRateSLR == undefined) { response.data.list[0].yesRateSLR = '' }
- if (response.data.list[0].temtime == undefined) { response.data.list[0].temtime = '' }
- if (response.data.list[0].montime == undefined) { response.data.list[0].montime = '' }
- this.row1.list = response.data.list[0]
- this.row2.chart1.chartLine_data.data1 = parseFloat(response.data.list[0].doneTimes)
- 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 {
- this.row1.list.data1.monRateHL = ''
- this.row1.list.data1.monRateSL = ''
- this.row1.list.data1.monRateSLR = ''
- this.row1.list.data1.yesRateHL = ''
- this.row1.list.data1.yesRateSL = ''
- this.row1.list.data1.yesRateSLR = ''
- this.row1.list.data1.temtime = ''
- this.row1.list.data1.montime = ''
- this.row2.chart1.chartLine_data.data1 = ''
- this.row2.chart1.chartLine_data.data2 = ''
- this.row2.chart2.chartLine_data.data1 = ''
- this.row2.chart2.chartLine_data.data2 = ''
- }
- setTimeout(() => {
- this.row1.listLoading = false
- }, 100)
- })
- },
- // 今日计划统计-完成车次
- roadChartLine1(chartLine_data) {
- if (this.row2.chart1.chartLine != null) {
- this.row2.chart1.chartLine.dispose()
- }
- this.row2.chart1.chartLine = echarts.init(document.getElementById('row2chartLine1'))
- var option = {
- // 标题组件,包含主标题和副标题
- title: {
- show: true,
- x: 'center',
- textStyle: {
- fontSize: '15',
- color: 'green',
- fontWeight: 'bold'
- }
- },
- // 提示框组件
- tooltip: {
- // 是否显示提示框组件,包括提示框浮层和 axisPointe
- show: false,
- // 触发类型: item:数据项触发,axis:坐标轴触发
- trigger: 'item',
- formatter: '{a} <br/>{b}: {c} ({d}%)'
- },
- // 系列列表。每个系列通过 type 决定自己的图表类型
- series: [{
- // 系列名称,用于tooltip的显示,legend 的图例筛选,在 setOption 更新数据和配置项时用于指定对应的系列。
- name: '任务进度',
- type: 'pie',
- // 饼图的半径,数组的第一项是内半径,第二项是外半径
- radius: ['80%', '70%'],
- // 是否启用防止标签重叠策略,默认开启
- avoidLabelOverlap: false,
- hoverAnimation: false,
- // 标签的视觉引导线样式,在 label 位置 设置为'outside'的时候会显示视觉引导线
- labelLine: {
- normal: {
- show: false
- }
- },
- data: [{
- value: chartLine_data.data1, // 数据值
- name: '完成率', // 数据项名称
- selected: false, // 该数据项是否被选中
- // 单个扇区的标签配置
- label: {
- normal: {
- show: true, // 是显示标签
- position: 'center',
- fontSize: 20,
- // 标签内容格式器,支持字符串模板和回调函数两种形式,字符串模板与回调函数返回的字符串均支持用 \n 换行
- formatter: '{b}\n{d}%'
- }
- }
- }, {
- value: chartLine_data.data2 - chartLine_data.data1,
- label: {
- normal: {
- show: false
- }
- }
- }]
- }],
- color: ['#409EFF', '#B7DBFF']
- }
- this.row2.chart1.chartLine.setOption(option)
- window.onresize = function() {
- this.row2.chart1.chartLine.resize()
- }
- },
- // 今日计划统计-完成重量
- roadChartLine2(chartLine_data) {
- if (this.row2.chart2.chartLine != null) {
- this.row2.chart2.chartLine.dispose()
- }
- this.row2.chart2.chartLine = echarts.init(document.getElementById('row2chartLine2'))
- var option = {
- // 标题组件,包含主标题和副标题
- title: {
- show: true,
- x: 'center',
- textStyle: {
- fontSize: '15',
- color: 'green',
- fontWeight: 'bold'
- }
- },
- // 提示框组件
- tooltip: {
- // 是否显示提示框组件,包括提示框浮层和 axisPointe
- show: false,
- // 触发类型: item:数据项触发,axis:坐标轴触发
- trigger: 'item',
- formatter: '{a} <br/>{b}: {c} ({d}%)'
- },
- // 系列列表。每个系列通过 type 决定自己的图表类型
- series: [{
- // 系列名称,用于tooltip的显示,legend 的图例筛选,在 setOption 更新数据和配置项时用于指定对应的系列。
- name: '任务进度',
- type: 'pie',
- // 饼图的半径,数组的第一项是内半径,第二项是外半径
- radius: ['80%', '70%'],
- // 是否启用防止标签重叠策略,默认开启
- avoidLabelOverlap: false,
- hoverAnimation: false,
- // 标签的视觉引导线样式,在 label 位置 设置为'outside'的时候会显示视觉引导线
- labelLine: {
- normal: {
- show: false
- }
- },
- data: [{
- value: chartLine_data.data1, // 数据值
- name: '完成率', // 数据项名称
- selected: false, // 该数据项是否被选中
- // 单个扇区的标签配置
- label: {
- normal: {
- show: true, // 是显示标签
- position: 'center',
- fontSize: 20,
- // 标签内容格式器,支持字符串模板和回调函数两种形式,字符串模板与回调函数返回的字符串均支持用 \n 换行
- formatter: '{b}\n{d}%'
- }
- }
- }, {
- value: chartLine_data.data2 - chartLine_data.data1,
- label: {
- normal: {
- show: false
- }
- }
- }]
- }],
- color: ['#409EFF', '#B7DBFF']
- }
- this.row2.chart2.chartLine.setOption(option)
- window.onresize = function() {
- this.row2.chart2.chartLine.resize()
- }
- },
- // 实时监控
- getChart3() {
- this.row2.chart3.listLoading = true
- GetReportform(this.row2.chart3.getdataListParm).then(response => {
- console.log('实时监控数据', response.data.list)
- if (response.data.list !== null) {
- var evenNumbers = []// 偶数
- var oddNumbers = []// 奇数
- for (let i = 0; i < response.data.list.data4.length; 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.row2.chart3.chartLine_data = response.data.list
- this.row2.chart3.total = response.data.total
- this.row2.chart3.pageNum = response.data.pageNum
- this.row2.chart3.pages = response.data.pages
- this.roadChartLine3(this.row2.chart3.chartLine_data)
- } else {
- this.row2.chart3.list = []
- }
- setTimeout(() => {
- this.row2.chart3.listLoading = false
- }, 100)
- })
- },
- roadChartLine3(chartLine_data) {
- if (this.row2.chart3.chartLine != null) {
- this.row2.chart3.chartLine.dispose()
- }
- this.row2.chart3.chartLine = echarts.init(document.getElementById('row2chartLine3'))
- var option = {
- title: {
- text: '',
- subtext: ''
- },
- color: ['#ff3131', '#61a5e8', '#ff3131', '#61a5e8'], // 关键加上这句话,legend的颜色和折线的自定义颜色就一致了
- legend: {
- data: [
- { name: '设计重量', icon: 'rectangle' },
- { name: '实际重量', icon: 'rectangle' },
- { name: '开始重量', icon: 'triangle' },
- { name: '结束重量', icon: 'triangle' }
- ],
- right: '20%',
- textStyle: {
- fontSize: 12,
- color: '#666'
- }
- },
- /* grid:{y:15},*/
- tooltip: {
- trigger: 'axis'
- },
- calculable: true,
- yAxis: [
- {
- type: 'value',
- name: '重量(kg)',
- splitLine: { show: false }, // 去除网格线
- axisLabel: {
- show: true,
- textStyle: {
- color: '#666' // 这里用参数代替了
- }
- }
- }
- ],
- xAxis: [
- {
- type: 'category',
- splitLine: { show: false }, // 去除网格线
- name: '时间',
- data: chartLine_data.data1,
- axisLabel: {
- show: true,
- textStyle: {
- color: '#666' // 这里用参数代替了
- }
- }
- }
- ],
- series: [{
- symbol: 'none',
- name: '实际重量',
- type: 'line',
- // step: 'end',
- data: chartLine_data.data3,
- smooth: true,
- barWidth: '37',
- itemStyle: {
- normal: {
- lineStyle: { color: '#ff3131' }
- }
- }
- }, {
- symbol: 'none',
- name: '设计重量',
- type: 'line',
- barWidth: '37',
- data: chartLine_data.data2,
- itemStyle: {
- normal: {
- lineStyle: { color: '#61a5e8' }
- }
- }
- }, {
- name: '开始重量',
- symbol: 'triangle',
- symbolSize: 10,
- type: 'scatter',
- data: chartLine_data.data4
- }, {
- name: '结束重量',
- symbol: 'triangle',
- symbolSize: 10,
- type: 'scatter',
- data: chartLine_data.data5
- }]
- }
- this.row2.chart3.chartLine.setOption(option)
- window.onresize = function() {
- this.row2.chart3.chartLine.resize()
- }
- },
- getCarLength() {
- this.row2.chart3.listLoading2 = true
- this.row2.chart3.getdataListParmList.pagecount = 0
- GetDataByName(this.row2.chart3.getdataListParmList).then(response => {
- if (response.data.list !== null) {
- this.carLength = response.data.total
- } else {
- this.carLength = 0
- }
- setTimeout(() => {
- this.row2.chart3.listLoading2 = false
- }, 100)
- })
- },
- // 图三轮询列表
- getChart3List() {
- this.row2.chart3.listLoading2 = true
- this.row2.chart3.getdataListParmList.pagecount = 3
- GetDataByName(this.row2.chart3.getdataListParmList).then(response => {
- if (response.data.list !== null) {
- for (let i = 0; i < response.data.list.length; i++) {
- this.$set(response.data.list[i], 'color', '#fff')
- this.$set(response.data.list[i], 'background', '#7ac3ec')
- }
- this.list = response.data.list
- console.log('实时监控轮播数据', this.list)
- this.myKey = 0
- this.$nextTick(() => {
- console.log(this.$refs.list)
- this.$refs.list[this.myKey].style.background = '#7ac3ec'
- this.$refs.list[this.myKey].style.color = '#f7f941'
- })
- this.row2.chart3.getdataListParm.parammaps.pid = this.list[this.myKey].pid
- this.row2.chart3.getdataListParm.parammaps.id = this.list[this.myKey].id
- this.getChart3()
- this.row2.chart3.pageNum2 = response.data.pageNum
- this.row2.chart3.pages2 = response.data.pages
- if (this.row2.chart3.getdataListParmList.offset == 1) {
- this.$refs.left.style.color = '#ccc'
- } else {
- this.$refs.left.style.color = '#000'
- }
- if (this.row2.chart3.getdataListParmList.offset < this.row2.chart3.pages2) {
- this.$refs.right.style.color = '#000'
- } else {
- this.$refs.right.style.color = '#ccc'
- }
- } else {
- this.row2.chart3.list2 = []
- }
- setTimeout(() => {
- this.row2.chart3.listLoading2 = false
- }, 100)
- })
- },
- // 向左切换
- handleLeft() {
- console.log('左')
- if (this.row2.chart3.getdataListParmList.offset > 1) {
- this.$refs.left.style.color = '#000'
- this.row2.chart3.getdataListParmList.offset = this.row2.chart3.pageNum2 - 1
- this.getChart3List()
- if (this.$refs.list[0] !== undefined) {
- this.$refs.list[0].style.background = '#7ac3ec'
- this.$refs.list[0].style.color = '#f7f941'
- this.row2.chart3.getdataListParm.parammaps.pid = this.list[0].pid
- this.row2.chart3.getdataListParm.parammaps.id = this.list[0].id
- this.getChart3()
- }
- if (this.$refs.list[1] !== undefined) {
- this.$refs.list[1].style.color = '#fff'
- this.$refs.list[1].style.background = '#7ac3ec'
- }
- if (this.$refs.list[2] !== undefined) {
- this.$refs.list[2].style.color = '#fff'
- this.$refs.list[2].style.background = '#7ac3ec'
- }
- } else {
- this.$refs.left.style.color = '#ccc'
- }
- },
- // 向右切换
- handleRight() {
- if (this.row2.chart3.getdataListParmList.offset < this.row2.chart3.pages2) {
- this.$refs.left.style.color = '#000'
- this.$refs.right.style.color = '#000'
- this.row2.chart3.getdataListParmList.offset = this.row2.chart3.getdataListParmList.offset + 1
- this.getChart3List()
- if (this.$refs.list[0] !== undefined) {
- this.$refs.list[0].style.background = '#7ac3ec'
- this.$refs.list[0].style.color = '#f7f941'
- this.row2.chart3.getdataListParm.parammaps.pid = this.list[0].pid
- this.row2.chart3.getdataListParm.parammaps.id = this.list[0].id
- this.getChart3()
- }
- if (this.$refs.list[1] !== undefined) {
- this.$refs.list[1].style.color = '#fff'
- this.$refs.list[1].style.background = '#7ac3ec'
- }
- if (this.$refs.list[2] !== undefined) {
- this.$refs.list[2].style.color = '#fff'
- this.$refs.list[2].style.background = '#7ac3ec'
- }
- }
- },
- // 点击
- handleList(key, item) {
- console.log(item)
- clearInterval(this.timer)
- for (var i in this.$refs.list) {
- if (i == key) {
- this.$refs.list[i].style.background = '#7ac3ec'
- this.$refs.list[i].style.color = '#f7f941'
- this.row2.chart3.getdataListParm.parammaps.pid = item.pid
- this.row2.chart3.getdataListParm.parammaps.id = item.id
- this.getChart3()
- } else {
- this.$refs.list[i].style.background = '#7ac3ec'
- this.$refs.list[i].style.color = '#fff'
- }
- }
- setTimeout(() => {
- this.timer = setInterval(this.autoPlay, 15000)
- }, 20000)
- },
- // 计划统计
- getChart4() {
- this.row3.chart1.listLoading = true
- GetReportform(this.row3.chart1.getdataListParm).then(response => {
- console.log('计划统计数据', response.data.list)
- if (response.data.list !== null) {
- this.row3.chart1.table.list = response.data.data
- this.row3.chart1.chartLine_data = response.data.list
- this.row3.chart1.total = response.data.total
- this.roadChartLine4(this.row3.chart1.chartLine_data)
- } else {
- this.row3.chart1.list = []
- }
- setTimeout(() => {
- this.row3.chart1.listLoading = false
- }, 100)
- })
- },
- roadChartLine4(chartLine_data) {
- if (this.row3.chart1.chartLine != null) {
- this.row3.chart1.chartLine.dispose()
- }
- this.row3.chart1.chartLine = echarts.init(document.getElementById('row3chartLine1'))
- var option = {
- title: {
- text: ''
- },
- tooltip: {
- trigger: 'axis'
- },
- legend: {
- data: ['计划准确率', '计划正确率', '计划准确率(去除取消重量)'],
- top: 10
- },
- grid: {
- top: '20%',
- left: '0%',
- right: '8%',
- containLabel: true
- },
- toolbox: {
- show: true,
- right: '2%',
- feature: {}
- },
- xAxis: { type: 'category', boundaryGap: false, data: chartLine_data.data1, name: '日期' },
- yAxis: {
- type: 'value', name: '百分比', axisLabel: { formatter: '{value} %' }
- },
- series: [
- { name: '计划准确率', type: 'line', data: chartLine_data.data2 },
- { name: '计划正确率', type: 'line', data: chartLine_data.data3 },
- { name: '计划准确率(去除取消重量)', type: 'line', data: chartLine_data.data4 }
- ]
- }
- this.row3.chart1.chartLine.setOption(option)
- window.onresize = function() {
- this.row3.chart1.chartLine.resize()
- }
- },
- // 泌乳牛干物质采食量
- getChart5() {
- this.row3.chart2.listLoading = true
- GetReportform(this.row3.chart2.getdataListParm).then(response => {
- console.log('泌乳牛干物质采食量数据', response.data.list)
- if (response.data.list !== null) {
- this.row3.chart2.table.list = response.data.data
- this.row3.chart2.chartLine_data = response.data.list
- this.row3.chart2.total = response.data.total
- this.roadChartLine5(this.row3.chart2.chartLine_data)
- } else {
- this.row3.chart2.list = []
- }
- setTimeout(() => {
- this.row3.chart2.listLoading = false
- }, 100)
- })
- },
- roadChartLine5(chartLine_data) {
- if (this.row3.chart2.chartLine != null) {
- this.row3.chart2.chartLine.dispose()
- }
- this.row3.chart2.chartLine = echarts.init(document.getElementById('row3chartLine2'))
- var option = {
- tooltip: {
- trigger: 'axis'
- },
- legend: {
- data: ['泌乳牛干物质采食量', '泌乳牛产奶量'],
- right: 10
- },
- xAxis: [
- {
- type: 'category',
- data: chartLine_data.data1
- }
- ],
- yAxis: [
- {
- type: 'value',
- name: '泌乳牛干物质采食量',
- axisLabel: {
- formatter: '{value} '
- }
- }, {
- type: 'value',
- name: '泌乳牛产奶量',
- axisLabel: {
- formatter: '{value} '
- }
- }
- ],
- series: [{
- name: '泌乳牛干物质采食量',
- type: 'bar',
- itemStyle: { /* 设置柱状颜色*/
- normal: {
- color: '#61a5e8'
- }
- },
- data: chartLine_data.data2
- }, {
- name: '泌乳牛产奶量',
- type: 'line',
- itemStyle: { /* 设置折线颜色*/
- normal: {
- color: '#ff2d2d'
- }
- },
- yAxisIndex: 1,
- data: chartLine_data.data3
- }]
- }
- this.row3.chart2.chartLine.setOption(option)
- window.onresize = function() {
- this.row3.chart2.chartLine.resize()
- }
- },
- // 成本统计
- getChart6() {
- this.row4.chart1.listLoading = true
- GetReportform(this.row4.chart1.getdataListParm).then(response => {
- console.log('成本统计数据', response.data.data)
- console.log('成本统计数据', response.data.list)
- if (response.data.list !== null) {
- this.row4.chart1.table.list = response.data.data
- this.row4.chart1.chartLine_data = response.data.list
- this.row4.chart1.total = response.data.total
- this.roadChartLine6(this.row4.chart1.chartLine_data)
- } else {
- this.row4.chart1.list = []
- }
- setTimeout(() => {
- this.row4.chart1.listLoading = false
- }, 100)
- })
- },
- roadChartLine6(chartLine_data) {
- if (this.row4.chart1.chartLine != null) {
- this.row4.chart1.chartLine.dispose()
- }
- console.log(chartLine_data)
- this.row4.chart1.chartLine = echarts.init(document.getElementById('row4chartLine1'))
- var option = {
- title: {
- text: ''
- },
- grid: {
- left: '8%',
- right: '8%',
- bottom: '3%',
- containLabel: true
- },
- tooltip: {
- trigger: 'axis'
- },
- legend: {
- data: ['泌乳牛采食量', '泌乳牛产奶量']
- },
- xAxis: [
- {
- type: 'category',
- data: chartLine_data.data1,
- axisPointer: {
- type: 'shadow'
- },
- name: '日期'
- }
- ],
- yAxis: [
- {
- type: 'value',
- name: '公斤奶\n饲料成本(元)',
- axisLabel: {
- formatter: '{value}'
- }
- }, {
- type: 'value',
- name: '单头牛\n饲料成本(元)',
- axisLabel: {
- formatter: '{value}'
- }
- }
- ],
- series: [
- {
- name: '泌乳牛采食量',
- type: 'bar',
- itemStyle: { /* 设置柱状颜色*/
- normal: {
- color: '#61a5e8'
- }
- },
- data: chartLine_data.data2
- }, {
- name: '泌乳牛产奶量',
- type: 'line',
- yAxisIndex: 1,
- itemStyle: { /* 设置柱状颜色*/
- normal: {
- color: '#ff3131'
- }
- },
- data: chartLine_data.data3
- }
- ]
- }
- this.row4.chart1.chartLine.setOption(option)
- window.onresize = function() {
- this.row4.chart1.chartLine.resize()
- }
- },
- getChart7() {
- this.row4.chart2.listLoading = true
- GetReportform(this.row4.chart2.getdataListParm).then(response => {
- console.log('出库统计数据', response.data.list)
- if (response.data.list !== null) {
- this.row4.chart2.table.list = response.data.data
- this.row4.chart2.chartLine_data = response.data.list
- console.log(this.row4.chart2.chartLine_data)
- this.row4.chart2.total = response.data.total
- this.roadChartLine7(this.row4.chart2.chartLine_data)
- } else {
- this.row4.chart2.list = []
- }
- setTimeout(() => {
- this.row4.chart2.listLoading = false
- }, 100)
- })
- },
- roadChartLine7(chartLine_data) {
- if (this.row4.chart2.chartLine != null) {
- this.row4.chart2.chartLine.dispose()
- }
- this.row4.chart2.chartLine = echarts.init(document.getElementById('row4chartLine2'))
- var option = {
- title: {
- text: ''
- },
- grid: {
- left: '3%',
- right: '10%',
- bottom: '3%',
- containLabel: true
- },
- tooltip: {
- trigger: 'axis'
- },
- legend: {
- data: ['']
- },
- xAxis: [
- {
- type: 'category',
- data: chartLine_data.data1,
- name: '日期'
- }
- ],
- yAxis: [
- { type: 'value', name: '重量(kg)', axisLabel: { formatter: '{value}' }}
- ],
- series: [
- {
- name: '重量',
- type: 'bar',
- stack: '广告',
- itemStyle: { /* 设置柱状颜色*/
- normal: {
- color: '#61a5e8'
- }
- },
- data: chartLine_data.data2
- }
- ]
- }
- this.row4.chart2.chartLine.setOption(option)
- window.onresize = function() {
- this.row4.chart2.chartLine.resize()
- }
- },
- getTable8() {
- this.row4.table.listLoading = true
- GetDataByName(this.row4.table.getdataListParm).then(response => {
- console.log('库存预警table数据', response.data.list)
- if (response.data.list !== null) {
- this.row4.table.list = response.data.list
- this.row4.table.total = response.data.total
- } else {
- this.row4.table.list = []
- }
- setTimeout(() => {
- this.row4.table.listLoading = false
- }, 100)
- })
- },
- // 更多
- handleMore() {
- this.$router.push({ path: '/inventoryManagement/Warning' })
- },
- // 导出
- handleExport(item) {
- console.log(item)
- // 计划统计
- if (item == 'row3chartLine1') {
- console.log(this.row3.chart1.table.list)
- var excelDatasTabChart1 = [
- {
- tHeader: ['日期', '计划执行重量(kg)', '配方理论重量(kg)', '计划准确率', '计划取消重量(kg)', '计划准确率(去除取消重量)', '计划正确数', '计划数', '计划正确率'],
- filterVal: ['日期', '实际量', '理论量', 'field1', '计划取消重量', 'field3', '正确数', '计划数', 'field2'],
- tableDatas: this.row3.chart1.table.list,
- sheetName: '计划统计'
- }
- ]
- json2excel(excelDatasTabChart1, '计划统计', true, 'xlsx')
- } else if (item == 'row3chartLine2') {
- // 泌乳牛采食量
- var excelDatasTabChart2 = [
- {
- tHeader: ['日期', '泌乳牛采食量(kg)', '泌乳牛产奶量(kg)'],
- filterVal: ['日期', 'field1', 'field2'],
- tableDatas: this.row3.chart2.table.list,
- sheetName: '泌乳牛采食量'
- }
- ]
- json2excel(excelDatasTabChart2, '泌乳牛采食量', true, 'xlsx')
- } else if (item == 'row4chartLine1') {
- // 成本统计
- console.log('成本统计')
- // var excelDatasTabChart2 = [
- // {
- // tHeader: ['日期', '泌乳牛采食量(kg)', '泌乳牛产奶量(kg)'],
- // filterVal: ['日期', 'field1', 'field2'],
- // tableDatas: this.row3.chart2.table.list,
- // sheetName: '泌乳牛采食量'
- // }
- // ]
- // json2excel(excelDatasTabChart2, '泌乳牛采食量', true, 'xlsx')
- }
- },
- handleTable(item) {
- console.log(item)
- if (item == 'row3chartLine1') {
- console.log('计划统计表格')
- this.row3.chart1.isTable = true
- this.row3.chart1.isChart = false
- } else if (item == 'row3chartLine2') {
- console.log('泌乳牛采食量表格')
- this.row3.chart2.isTable = true
- this.row3.chart2.isChart = false
- } else if (item == 'row4chartLine1') {
- console.log('成本统计表格')
- this.row4.chart1.isTable = true
- this.row4.chart1.isChart = false
- } else if (item == 'row4chartLine2') {
- console.log('混料实际重量统计表格')
- this.row4.chart2.isTable = true
- this.row4.chart2.isChart = false
- }
- },
- handleChart(item) {
- console.log(item)
- // 显示切换图表
- if (item == 'row3chartLine1') {
- console.log('计划统计图表')
- this.row3.chart1.isTable = false
- this.row3.chart1.isChart = true
- } else if (item == 'row3chartLine2') {
- console.log('泌乳牛采食量图表')
- this.row3.chart2.isTable = false
- this.row3.chart2.isChart = true
- } else if (item == 'row4chartLine1') {
- console.log('成本统计图表')
- this.row4.chart1.isTable = false
- this.row4.chart1.isChart = true
- } else if (item == 'row4chartLine2') {
- console.log('混料实际重量统计图表')
- this.row4.chart2.isTable = false
- this.row4.chart2.isChart = true
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .Title{
- padding-left: 10px;border-radius: 10px;margin-top: 20px;background: #fff;height:40px;font-size:20px;line-height:40px;text-align: left;font-weight: 600;
- }
- .dashboard-editor-container {
- background-color: #F4F4F4;
- min-height: 100vh;
- .news{
- width: 70%;
- height: 30px;
- background: #fff;
- margin: 0 auto;
- border-radius: 10px;
- text-align: center;
- line-height: 30px;
- color: red;
- b{color: #000;}
- }
- .bottom{
- padding:0 30px;
- h4{text-align: right;}
- .grid-content{
- background: #fff;height: 90px;
- border-radius: 10px;
- }
- .one{
- border: 1px solid #82CBB3;height: 90px;
- .Left{
- float: left;
- width: 65px;
- text-align: center;
- i{font-size: 36px;color:#82CBB3;line-height: 90px;}
- }
- .Right{
- float: left;
- margin-top:15px;
- height: 60px;
- font-weight: 600;
- font-size: 14px;
- line-height: 30px;
- span{
- display: inline-block;
- width: 130px;
- text-align: right;
- }
- }
- }
- .two{
- border: 1px solid #FF9900;
- .Left{
- float: left;
- width: 65px;
- text-align: center;
- i{font-size: 36px;color:#FF9900;line-height: 90px;}
- }
- .Right{
- float: left;
- margin-top:15px;
- height: 60px;
- font-weight: 600;
- font-size: 14px;
- line-height: 30px;
- span{
- display: inline-block;
- width: 130px;
- text-align: right;
- }
- }
- }
- .three{
- border: 1px solid #0099FF;
- .Left{
- float: left;
- width: 65px;
- text-align: center;
- i{font-size: 36px;color:#0099FF;line-height: 90px;}
- }
- .Right{
- float: left;
- height: 60px;
- font-weight: 600;
- font-size: 14px;
- line-height: 30px;
- margin-top:15px;
- span{
- display: inline-block;
- width: 130px;
- text-align: right;
- }
- }
- }
- .four{
- border: 1px solid #FF5C5C;
- .Left{
- float: left;
- width: 55px;
- text-align: center;
- i{font-size: 36px;color:#FF5C5C;line-height: 90px;}
- }
- .Right{
- float: left;
- flex: 1;
- height: 60px;
- font-weight: 600;
- font-size: 14px;
- line-height: 30px;
- margin-top:15px;
- span{
- display: inline-block;
- width: 150px;
- text-align: right;
- }
- }
- }
- .car{
- width:100%;height:150px;
- display:flex;
- display: -webkit-flex;
- -webkit-flex-direction:row;
- i{font-size: 50px;width:50px;display: block;line-height: 150px;}
- .carList{
- flex:1;height: 130px;
- .list{
- height: 130px;color: #fff;
- // box-shadow: #000 0px 0px 10px;
- // border-radius: 10px;
- .list-l{
- p{
- padding-left:10px;font-size:13px;line-height: 16px; text-overflow: ellipsis;white-space:nowrap; overflow:hidden;
- }
- }
- .list-r{
- p{
- font-size:13px;line-height: 16px;text-overflow: ellipsis;white-space:nowrap; overflow:hidden;
- }
- }
- }
- }
- }
- }
- }
- </style>
|