80c8cdeacbe7f2849f342237e9106afab570689c.svn-base 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685
  1. <template>
  2. <div ref="dashboardEditor" class="dashboard-editor-container">
  3. <!-- <h1>牧场</h1> -->
  4. <div style="background: #F4F4F4;height: 10px;" />
  5. <div v-if="news==1" style="display:none;" class="news"><b>消息提醒:</b>撒料计划未分配完善,请及时进行计划分配</div>
  6. <div v-if="news==2" style="display:none;" class="news"><b>消息提醒:</b>预混计划未分配完善,请及时进行计划分配</div>
  7. <div v-if="news==3" style="display:none;" class="news"><b>消息提醒:</b>剩料计划未分配完善,请及时进行计划分配</div>
  8. <div class="bottom">
  9. <!-- <h4>{{ date }}</h4> -->
  10. <el-row :gutter="20" style="margin-top: 10px;">
  11. <el-col :span="6">
  12. <div class="grid-content one">
  13. <div class="Left">
  14. <i class="iconfont icon-shuaxin" />
  15. </div>
  16. <div class="Right">
  17. <span>昨日混料准确率:</span>{{ row1.list.yesRateHL }}<br>
  18. <span>近30天混料准确率:</span>{{ row1.list.monRateHL }}
  19. </div>
  20. </div>
  21. </el-col>
  22. <el-col :span="6">
  23. <div class="grid-content two">
  24. <div class="Left">
  25. <i class="iconfont icon-zhunqueshuai2" />
  26. </div>
  27. <div class="Right">
  28. <span>昨日撒料准确率:</span>{{ row1.list.yesRateSL }}<br>
  29. <span>近30天撒料准确率:</span>{{ row1.list.monRateSL }}
  30. </div>
  31. </div>
  32. </el-col>
  33. <el-col :span="6">
  34. <div class="grid-content three">
  35. <div class="Left">
  36. <i class="iconfont icon-zhinengsiwei" style="font-size: 40px;" />
  37. </div>
  38. <div class="Right">
  39. <span>昨日撒料正确率:</span>{{ row1.list.yesRateSLR }}<br>
  40. <span>近30天撒料正确率:</span>{{ row1.list.monRateSLR }}
  41. </div>
  42. </div>
  43. </el-col>
  44. <el-col :span="6">
  45. <div class="grid-content four">
  46. <div class="Left">
  47. <i class="iconfont icon-siliaotoufangjilu" style="font-size: 50px;" />
  48. </div>
  49. <div class="Right">
  50. <span style="width:116px;">昨日撒料偏差:</span>{{ row1.list.temtime }} min<br>
  51. <span style="width:116px;">近30天撒料偏差:</span>{{ row1.list.montime }} min
  52. </div>
  53. </div>
  54. </el-col>
  55. </el-row>
  56. <el-row :gutter="20" style="margin-top: 20px;">
  57. <el-col :span="6">
  58. <div class="grid-content" style="height:500px;background: #fff;">
  59. <div style="height: 250px; border-bottom: 1px solid #000;">
  60. <!-- <div class="Title">今日计划统计</div> -->
  61. <b style="padding-left: 10px;line-height: 50px;font-size: 20px;">今日计划统计</b><br>
  62. <div style="text-align: center;">
  63. <b style="padding-right: 10px;font-size: 14px;">完成车次:{{ row2.chart1.chartLine_data.data1 }}</b>
  64. <b style="padding-right: 10px;font-size: 14px;">计划车次:{{ row2.chart1.chartLine_data.data2 }}</b>
  65. </div>
  66. <div id="row2chartLine1" style="height: 150px;" />
  67. </div>
  68. <div style="height: 250px;">
  69. <div style="text-align: center;padding-top:50px;">
  70. <b style="padding-right: 5px;font-size: 14px;">完成重量:{{ row2.chart2.chartLine_data.data1 }}kg</b>
  71. <b style="padding-right: 5px;font-size: 14px;">计划重量:{{ row2.chart2.chartLine_data.data2 }}kg</b>
  72. </div>
  73. <div id="row2chartLine2" style="height: 150px;" />
  74. </div>
  75. </div>
  76. </el-col>
  77. <el-col :span="18" style="margin-top:-20px;">
  78. <div class="grid-content" style="height:500px;">
  79. <div style="height:350px;">
  80. <!-- <div style="font-size:14px;color:#666;margin:0 auto;position: relative;">
  81. <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>
  82. <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>
  83. </div> -->
  84. <div class="Title">实时监控</div>
  85. <div id="row2chartLine3" rfef="row2chartLine3" style="height: 90%;" />
  86. </div>
  87. <div id="car" ref="car" class="car" style="position: relative;">
  88. <p style="position: absolute;left:50px;top:-50px;">当前车辆数:{{ carLength }}</p>
  89. <i ref="left" class="el-icon-arrow-left" @click="handleLeft" />
  90. <el-row id="carList" ref="carList" :gutter="20" class="carList">
  91. <el-col v-for="(item,index) in list" id="list" :key="index" :span="8">
  92. <div ref="list" class="list" :style="{'background': item.background,'color':item.color}" @click="handleList(index,item)">
  93. <el-row :gutter="20" class="li">
  94. <el-col :span="12" class="list-l">
  95. <!-- 车辆/描述 -->
  96. <p><span>车辆:</span>{{ item.tname }}</p>
  97. <el-tooltip placement="top">
  98. <p slot="content">
  99. <span v-if="item.inorout == 0">饲料:{{ item.fname }}</span>
  100. <span v-if="item.inorout == 1">栏舍:{{ item.fname }}</span>
  101. </p>
  102. <p>
  103. <span v-if="item.inorout == 0">饲料:{{ item.fname }}</span>
  104. <span v-if="item.inorout == 1">栏舍:{{ item.fname }}</span>
  105. </p>
  106. </el-tooltip>
  107. <p><span>完成重量:</span>{{ item.doneweight }}</p>
  108. <p><span>完成度:</span>{{ item.donerate }}</p>
  109. </el-col>
  110. <el-col :span="12" class="list-r">
  111. <!-- 栏舍/饲料 -->
  112. <el-tooltip placement="top">
  113. <p slot="content"> <span>描述:</span> {{ item.remark }} </p>
  114. <p> <span>描述:</span> {{ item.remark }} </p>
  115. </el-tooltip>
  116. <p><span>计划重量:</span>{{ item.lweight }}</p>
  117. <p><span>剩余重量:</span>{{ item.leftweight }}</p>
  118. <p><span>车辆当前载重:</span>{{ item.nowweight }}</p>
  119. </el-col>
  120. </el-row>
  121. </div>
  122. </el-col>
  123. </el-row>
  124. <i ref="right" class="el-icon-arrow-right" @click="handleRight" />
  125. </div>
  126. </div>
  127. </el-col>
  128. </el-row>
  129. <el-row :gutter="20">
  130. <!-- 计划统计 -->
  131. <el-col :span="12" style="position: relative;">
  132. <div class="Title">计划统计</div>
  133. <div style="background: #fff;height:50px;">
  134. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row3chartLine1')">导出</el-button>
  135. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('row3chartLine1')">切换表格</el-button>
  136. </div>
  137. <div id="row3chartLine1" style="background: #fff;height:350px;" />
  138. <div v-if="row3.chart1.isTable" class="table" style="position: absolute;width:97%;top:19px;">
  139. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row3chartLine1')">导出</el-button>
  140. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('row3chartLine1')">切换图表</el-button>
  141. <el-table
  142. :key="row3.chart1.table.tableKey"
  143. v-loading="row3.chart1.table.listLoading"
  144. element-loading-text="给我一点时间"
  145. :data="row3.chart1.table.list"
  146. border
  147. fit
  148. highlight-current-row
  149. style="width: 100%;"
  150. height="400"
  151. :row-style="rowStyle"
  152. :cell-style="cellStyle"
  153. class="elTable table-fixed"
  154. >
  155. <el-table-column label="日期" sortable min-width="110px" align="center" prop="日期" />
  156. <el-table-column label="计划执行重量(kg)" sortable min-width="110px" align="center" prop="实际量" />
  157. <el-table-column label="配方理论重量(kg)" sortable min-width="110px" align="center" prop="理论量" />
  158. <el-table-column label="计划准确率" sortable min-width="110px" align="center" prop="field1" />
  159. <el-table-column label="计划取消重量(kg)" sortable min-width="110px" align="center" prop="计划取消重量" />
  160. <el-table-column label="计划准确率(去除取消重量)" sortable min-width="110px" align="center" prop="field3" />
  161. <el-table-column label="计划正确数" sortable min-width="110px" align="center" prop="正确数" />
  162. <el-table-column label="计划数" sortable min-width="110px" align="center" prop="计划数" />
  163. <el-table-column label="计划正确率" sortable min-width="110px" align="center" prop="field2" />
  164. </el-table>
  165. </div>
  166. </el-col>
  167. <!-- 泌乳牛干物质采食量 -->
  168. <el-col :span="12" style="position: relative;">
  169. <div class="Title">泌乳牛干物质采食量</div>
  170. <div style="background: #fff;height:50px;">
  171. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row3chartLine2')">导出</el-button>
  172. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('row3chartLine2')">切换表格</el-button>
  173. </div>
  174. <div id="row3chartLine2" style="background: #fff;height:350px;" />
  175. <div v-if="row3.chart2.isTable" class="table" style="position: absolute;width:97%;top:19px;">
  176. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row3chartLine2')">导出</el-button>
  177. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('row3chartLine2')">切换图表</el-button>
  178. <el-table
  179. :key="row3.chart2.table.tableKey"
  180. v-loading="row3.chart2.table.listLoading"
  181. element-loading-text="给我一点时间"
  182. :data="row3.chart2.table.list"
  183. border
  184. fit
  185. highlight-current-row
  186. style="width: 100%;"
  187. height="400"
  188. :row-style="rowStyle"
  189. :cell-style="cellStyle"
  190. class="elTable table-fixed"
  191. >
  192. <el-table-column label="日期" sortable min-width="110px" align="center" prop="日期" />
  193. <el-table-column label="泌乳牛采食量(kg)" sortable min-width="110px" align="center" prop="field1" />
  194. <el-table-column label="泌乳牛产奶量(kg)" sortable min-width="110px" align="center" prop="field2" />
  195. </el-table>
  196. </div>
  197. </el-col>
  198. </el-row>
  199. <el-row :gutter="20">
  200. <!-- 成本统计 -->
  201. <el-col :span="8" style="position: relative;">
  202. <div class="Title">成本统计</div>
  203. <div style="background: #fff;height:50px;">
  204. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row4chartLine1')">导出</el-button>
  205. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('row4chartLine1')">切换表格</el-button>
  206. </div>
  207. <div id="row4chartLine1" style="background: #fff;height:350px;" />
  208. <div v-if="row4.chart1.isTable" class="table" style="position: absolute;width:97%;top:19px;">
  209. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row4chartLine1')">导出</el-button>
  210. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('row4chartLine1')">切换图表</el-button>
  211. <el-table
  212. :key="row4.chart1.table.tableKey"
  213. v-loading="row4.chart1.table.listLoading"
  214. element-loading-text="给我一点时间"
  215. :data="row4.chart1.table.list"
  216. border
  217. fit
  218. highlight-current-row
  219. style="width: 100%;"
  220. height="400"
  221. :row-style="rowStyle"
  222. :cell-style="cellStyle"
  223. class="elTable table-fixed"
  224. >
  225. <el-table-column label="日期" sortable min-width="110px" align="center" prop="日期" />
  226. <el-table-column label="单头牛饲料成本" sortable min-width="110px" align="center" prop="field2" />
  227. <el-table-column label="公斤奶饲料成本(元)" sortable min-width="110px" align="center" prop="field1" />
  228. </el-table>
  229. </div>
  230. </el-col>
  231. <!-- 混料实际重量统计 -->
  232. <el-col :span="8" style="position: relative;">
  233. <div class="Title">混料实际重量统计</div>
  234. <div style="background: #fff;height:50px;">
  235. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row4chartLine2')">导出</el-button>
  236. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('row4chartLine2')">切换表格</el-button>
  237. </div>
  238. <div id="row4chartLine2" style="background: #fff;height:350px;" />
  239. <div v-if="row4.chart2.isTable" class="table" style="position: absolute;width:97%;top:19px;">
  240. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('row4chartLine2')">导出</el-button>
  241. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('row4chartLine2')">切换图表</el-button>
  242. <el-table
  243. :key="row4.chart2.table.tableKey"
  244. v-loading="row4.chart2.table.listLoading"
  245. element-loading-text="给我一点时间"
  246. :data="row4.chart2.table.list"
  247. border
  248. fit
  249. highlight-current-row
  250. style="width: 100%;"
  251. height="400"
  252. :row-style="rowStyle"
  253. :cell-style="cellStyle"
  254. class="elTable table-fixed"
  255. >
  256. <el-table-column label="日期" sortable min-width="110px" align="center" prop="日期" />
  257. <el-table-column label="重量" sortable min-width="110px" align="center" prop="field1" />
  258. </el-table>
  259. </div>
  260. </el-col>
  261. <el-col :span="8">
  262. <div class="Title">库存预警</div>
  263. <div id="table" style="height: 400px;background: #fff;">
  264. <el-table
  265. :key="row4.table.tableKey"
  266. v-loading="row4.table.listLoading"
  267. element-loading-text="给我一点时间"
  268. :data="row4.table.list"
  269. border
  270. fit
  271. highlight-current-row
  272. style="width: 100%;background: #fff;"
  273. height="400"
  274. :row-style="rowStyle"
  275. :cell-style="cellStyle"
  276. class="elTable table-fixed"
  277. >
  278. <el-table-column label="序号" type="index" min-width="80px" align="center" />
  279. <el-table-column label="饲料名称" min-width="80px" align="center" prop="feedname" />
  280. <el-table-column label="库存量(kg)" min-width="70px" align="center" prop="stockweight" />
  281. <el-table-column label="剩余使用天数" min-width="80px" align="center" prop="ldays" />
  282. </el-table>
  283. <!-- <span style="line-height: 50px;color:#82CBB3;text-align: center;width: 100%;display: inline-block;cursor:pointer;" @click="handleMore">查看更多</span> -->
  284. </div>
  285. </el-col>
  286. </el-row>
  287. </div>
  288. </div>
  289. </template>
  290. <script>
  291. import { GetDataByName, GetReportform } from '@/api/common'
  292. import Cookies from 'js-cookie'
  293. import { parseTime } from '@/utils/index.js'
  294. import echarts from 'echarts'
  295. import { json2excel } from '@/utils/index.js'
  296. require('echarts/theme/macarons')
  297. // var myKey = 0
  298. var that = this
  299. var carIndex = 0 // 判断是否大于当前车辆数
  300. var index = 0 // 判断当前跳到第几个车辆
  301. var timer = null
  302. export default {
  303. name: 'PastureDashboard',
  304. inject: ['reload'],
  305. data() {
  306. return {
  307. val: '这是值1',
  308. date: parseTime(new Date(), '{y}-{m}-{d}'),
  309. list: [],
  310. news: 1,
  311. carLength: 0, // 车辆
  312. myKey: 0, // 轮播Key值
  313. row1: {
  314. getdataListParm: {
  315. name: 'getHomepageStr',
  316. page: 1,
  317. offset: 1,
  318. pagecount: 10,
  319. returntype: 'Map',
  320. parammaps: {
  321. pastureid: Cookies.get('pastureid')
  322. }
  323. },
  324. listLoading: true,
  325. list: ''
  326. },
  327. row2: {
  328. chart1: {
  329. chartLine: null,
  330. chartLine_data: {}
  331. },
  332. chart2: {
  333. chartLine: null,
  334. chartLine_data: {}
  335. },
  336. chart3: {
  337. chartLine: null,
  338. chartLine_data: {},
  339. getdataListParm: {
  340. name: 'getHomeprocessAnalysis',
  341. page: 1,
  342. offset: 1,
  343. pagecount: 3,
  344. returntype: 'Map',
  345. parammaps: {
  346. pastureid: Cookies.get('pastureid'),
  347. id: '',
  348. pid: ''
  349. }
  350. },
  351. list: [],
  352. total: 0,
  353. listLoading: true,
  354. pageNum: '',
  355. pages: '',
  356. getdataListParmList: {
  357. name: 'getHomepageLBList',
  358. page: 1,
  359. offset: 1,
  360. pagecount: 3,
  361. returntype: 'Map',
  362. parammaps: {
  363. pastureid: Cookies.get('pastureid')
  364. }
  365. },
  366. list2: [],
  367. total2: 0,
  368. listLoading2: true,
  369. pageNum2: '',
  370. pages2: ''
  371. }
  372. },
  373. row3: {
  374. chartDate: [],
  375. chart1: {
  376. chartLine: null,
  377. chartLine_data: {},
  378. getdataListParm: {
  379. name: 'getAccuracyAllJH',
  380. page: 1,
  381. offset: 1,
  382. pagecount: 10,
  383. returntype: 'Map',
  384. parammaps: {
  385. pastureid: Cookies.get('pastureid'),
  386. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  387. stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
  388. inputDatetime: [new Date(), new Date()]
  389. }
  390. },
  391. list: [],
  392. total: 0,
  393. listLoading: true,
  394. isChart: true,
  395. isTable: false,
  396. table: {
  397. tableKey: 1,
  398. list: [],
  399. total: 0,
  400. listLoading: false
  401. }
  402. },
  403. chart2: {
  404. chartLine: null,
  405. chartLine_data: {},
  406. getdataListParm: {
  407. name: 'getFeedEffMR',
  408. page: 1,
  409. offset: 1,
  410. pagecount: 10,
  411. returntype: 'Map',
  412. parammaps: {
  413. pastureid: Cookies.get('pastureid'),
  414. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  415. stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
  416. inputDatetime: [new Date(), new Date()]
  417. }
  418. },
  419. list: [],
  420. total: 0,
  421. listLoading: true,
  422. isChart: true,
  423. isTable: false,
  424. table: {
  425. tableKey: 1,
  426. list: [],
  427. total: 0,
  428. listLoading: false
  429. }
  430. }
  431. },
  432. row4: {
  433. chartDate: [],
  434. chart1: {
  435. chartLine: null,
  436. chartLine_data: {},
  437. getdataListParm: {
  438. name: 'getHomepageCB',
  439. page: 1,
  440. offset: 1,
  441. pagecount: 10,
  442. returntype: 'Map',
  443. parammaps: {
  444. pastureid: Cookies.get('pastureid'),
  445. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  446. stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
  447. inputDatetime: [new Date(), new Date()]
  448. }
  449. },
  450. list: [],
  451. total: 0,
  452. listLoading: true,
  453. isChart: true,
  454. isTable: false,
  455. table: {
  456. tableKey: 1,
  457. list: [],
  458. total: 0,
  459. listLoading: false
  460. }
  461. },
  462. chart2: {
  463. chartLine: null,
  464. chartLine_data: {},
  465. getdataListParm: {
  466. name: 'getAccuraaActHL',
  467. page: 1,
  468. offset: 1,
  469. pagecount: 10,
  470. returntype: 'Map',
  471. parammaps: {
  472. pastureid: Cookies.get('pastureid'),
  473. pastureid: Cookies.get('pastureid'),
  474. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  475. stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
  476. inputDatetime: [new Date(), new Date()]
  477. }
  478. },
  479. list: [],
  480. total: 0,
  481. listLoading: true,
  482. isChart: true,
  483. isTable: false,
  484. table: {
  485. tableKey: 1,
  486. list: [],
  487. total: 0,
  488. listLoading: false
  489. }
  490. },
  491. table: {
  492. getdataListParm: {
  493. name: 'getFsWarnList',
  494. page: 1,
  495. offset: 1,
  496. pagecount: 5,
  497. returntype: 'Map',
  498. parammaps: {
  499. pastureid: Cookies.get('pastureid')
  500. }
  501. },
  502. tableKey: 1,
  503. list: [],
  504. total: 0,
  505. listLoading: true,
  506. temp: {}
  507. }
  508. },
  509. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  510. cellStyle: { padding: 0 + 'px' },
  511. timer: null
  512. }
  513. },
  514. created() {
  515. // this.reload()
  516. this.getCarLength()
  517. this.getChart3List()
  518. this.getTimeFn()
  519. this.getList()
  520. this.getChart4()
  521. this.getChart5()
  522. this.getChart6()
  523. this.getChart7()
  524. this.getTable8()
  525. },
  526. mounted() {
  527. this.timer = null
  528. this.timer = setInterval(this.autoPlay, 15000)
  529. },
  530. destroyed() {
  531. clearInterval(this.timer)
  532. },
  533. methods: {
  534. autoPlay() {
  535. // that.carLength 当前车辆数
  536. // console.log(this.carLength, 'this.carLength')
  537. if (this.carLength > 3) {
  538. var myIndex = ++index
  539. console.log(myIndex, 'myIndex')
  540. if (myIndex == 3) {
  541. for (let i = 0; i < this.$refs.list.length; i++) {
  542. if (index == i) {
  543. this.$refs.list[i].style.background = '#7ac3ec'
  544. this.$refs.list[i].style.color = '#f7f941'
  545. this.row2.chart3.getdataListParm.parammaps.pid = this.list[i].pid
  546. this.row2.chart3.getdataListParm.parammaps.id = this.list[i].id
  547. this.getChart3()
  548. } else {
  549. this.$refs.list[i].style.color = '#fff'
  550. this.$refs.list[i].style.background = '#7ac3ec'
  551. }
  552. }
  553. if (this.list.length < 3) {
  554. this.row2.chart3.getdataListParmList.offset = 1
  555. this.getChart3List()
  556. } else {
  557. this.row2.chart3.getdataListParmList.offset = this.row2.chart3.getdataListParmList.offset + 1
  558. this.getChart3List()
  559. }
  560. index = 0
  561. } else if (myIndex == 2) {
  562. for (let j = 0; j < this.$refs.list.length; j++) {
  563. if (myIndex == j) {
  564. this.$refs.list[j].style.background = '#7ac3ec'
  565. this.$refs.list[j].style.color = '#f7f941'
  566. this.row2.chart3.getdataListParm.parammaps.pid = this.list[j].pid
  567. this.row2.chart3.getdataListParm.parammaps.id = this.list[j].id
  568. this.getChart3()
  569. } else {
  570. this.$refs.list[j].style.color = '#fff'
  571. this.$refs.list[j].style.background = '#7ac3ec'
  572. }
  573. }
  574. } else if (myIndex == 1) {
  575. if (this.list.length < 3) {
  576. this.row2.chart3.getdataListParmList.offset = 1
  577. this.getChart3List()
  578. index = 0
  579. }
  580. for (let j = 0; j < this.$refs.list.length; j++) {
  581. if (myIndex == j) {
  582. this.$refs.list[j].style.background = '#7ac3ec'
  583. this.$refs.list[j].style.color = '#f7f941'
  584. this.row2.chart3.getdataListParm.parammaps.pid = this.list[j].pid
  585. this.row2.chart3.getdataListParm.parammaps.id = this.list[j].id
  586. this.getChart3()
  587. } else {
  588. this.$refs.list[j].style.color = '#fff'
  589. this.$refs.list[j].style.background = '#7ac3ec'
  590. }
  591. }
  592. }
  593. console.log(this.list.length, '============', myIndex)
  594. } else {
  595. // 车辆数量小于3
  596. var myIndex = ++index
  597. console.log('index < this.carLength')
  598. if (myIndex == 3) {
  599. index = 0
  600. for (let i = 0; i < this.$refs.list.length; i++) {
  601. if (index == i) {
  602. this.$refs.list[i].style.background = '#7ac3ec'
  603. this.$refs.list[i].style.color = '#f7f941'
  604. this.row2.chart3.getdataListParm.parammaps.pid = this.list[i].pid
  605. this.row2.chart3.getdataListParm.parammaps.id = this.list[i].id
  606. this.getChart3()
  607. } else {
  608. this.$refs.list[i].style.color = '#fff'
  609. this.$refs.list[i].style.background = '#7ac3ec'
  610. }
  611. }
  612. } else if (myIndex == 2) {
  613. for (let j = 0; j < this.$refs.list.length; j++) {
  614. if (myIndex == j) {
  615. this.$refs.list[j].style.background = '#7ac3ec'
  616. this.$refs.list[j].style.color = '#f7f941'
  617. this.row2.chart3.getdataListParm.parammaps.pid = this.list[j].pid
  618. this.row2.chart3.getdataListParm.parammaps.id = this.list[j].id
  619. this.getChart3()
  620. } else {
  621. this.$refs.list[j].style.color = '#fff'
  622. this.$refs.list[j].style.background = '#7ac3ec'
  623. }
  624. }
  625. } else if (myIndex == 1) {
  626. for (let j = 0; j < this.$refs.list.length; j++) {
  627. if (myIndex == j) {
  628. this.$refs.list[j].style.background = '#7ac3ec'
  629. this.$refs.list[j].style.color = '#f7f941'
  630. this.row2.chart3.getdataListParm.parammaps.pid = this.list[j].pid
  631. this.row2.chart3.getdataListParm.parammaps.id = this.list[j].id
  632. this.getChart3()
  633. } else {
  634. this.$refs.list[j].style.color = '#fff'
  635. this.$refs.list[j].style.background = '#7ac3ec'
  636. }
  637. }
  638. }
  639. }
  640. // console.log(index, 'index')
  641. },
  642. getTimeFn() {
  643. // this.reload()
  644. const that = this
  645. const end = new Date()
  646. const start = new Date()
  647. start.setTime(start.getTime() - 3600 * 1000 * 24 * 20)
  648. that.row3.chartDate[0] = parseTime(start, '{y}-{m}-{d}')
  649. that.row3.chartDate[1] = parseTime(end, '{y}-{m}-{d}')
  650. that.row3.chart1.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
  651. that.row3.chart1.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
  652. that.row3.chart1.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
  653. that.row3.chart1.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
  654. that.row3.chart2.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
  655. that.row3.chart2.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
  656. that.row3.chart2.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
  657. that.row3.chart2.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
  658. that.row4.chartDate[0] = parseTime(start, '{y}-{m}-{d}')
  659. that.row4.chartDate[1] = parseTime(end, '{y}-{m}-{d}')
  660. that.row4.chart1.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
  661. that.row4.chart1.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
  662. that.row4.chart1.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
  663. that.row4.chart1.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
  664. that.row4.chart2.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
  665. that.row4.chart2.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
  666. that.row4.chart2.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
  667. that.row4.chart2.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
  668. },
  669. getList() {
  670. this.row1.listLoading = true
  671. GetDataByName(this.row1.getdataListParm).then(response => {
  672. console.log('row1数据', response.data.list)
  673. if (response.data.list !== null) {
  674. if (response.data.list[0].monRateHL == undefined) { response.data.list[0].monRateHL = '' }
  675. if (response.data.list[0].monRateSL == undefined) { response.data.list[0].monRateSL = '' }
  676. if (response.data.list[0].monRateSLR == undefined) { response.data.list[0].monRateSLR = '' }
  677. if (response.data.list[0].yesRateHL == undefined) { response.data.list[0].yesRateHL = '' }
  678. if (response.data.list[0].yesRateHL == undefined) { response.data.list[0].yesRateHL = '' }
  679. if (response.data.list[0].yesRateSL == undefined) { response.data.list[0].yesRateSL = '' }
  680. if (response.data.list[0].yesRateSLR == undefined) { response.data.list[0].yesRateSLR = '' }
  681. if (response.data.list[0].temtime == undefined) { response.data.list[0].temtime = '' }
  682. if (response.data.list[0].montime == undefined) { response.data.list[0].montime = '' }
  683. this.row1.list = response.data.list[0]
  684. this.row2.chart1.chartLine_data.data1 = parseFloat(response.data.list[0].doneTimes)
  685. this.row2.chart1.chartLine_data.data2 = parseFloat(response.data.list[0].planTimes)
  686. this.row2.chart2.chartLine_data.data1 = parseFloat(response.data.list[0].doneWeight)
  687. this.row2.chart2.chartLine_data.data2 = parseFloat(response.data.list[0].planWeight)
  688. this.roadChartLine1(this.row2.chart1.chartLine_data)
  689. this.roadChartLine2(this.row2.chart2.chartLine_data)
  690. } else {
  691. this.row1.list.data1.monRateHL = ''
  692. this.row1.list.data1.monRateSL = ''
  693. this.row1.list.data1.monRateSLR = ''
  694. this.row1.list.data1.yesRateHL = ''
  695. this.row1.list.data1.yesRateSL = ''
  696. this.row1.list.data1.yesRateSLR = ''
  697. this.row1.list.data1.temtime = ''
  698. this.row1.list.data1.montime = ''
  699. this.row2.chart1.chartLine_data.data1 = ''
  700. this.row2.chart1.chartLine_data.data2 = ''
  701. this.row2.chart2.chartLine_data.data1 = ''
  702. this.row2.chart2.chartLine_data.data2 = ''
  703. }
  704. setTimeout(() => {
  705. this.row1.listLoading = false
  706. }, 100)
  707. })
  708. },
  709. // 今日计划统计-完成车次
  710. roadChartLine1(chartLine_data) {
  711. if (this.row2.chart1.chartLine != null) {
  712. this.row2.chart1.chartLine.dispose()
  713. }
  714. this.row2.chart1.chartLine = echarts.init(document.getElementById('row2chartLine1'))
  715. var option = {
  716. // 标题组件,包含主标题和副标题
  717. title: {
  718. show: true,
  719. x: 'center',
  720. textStyle: {
  721. fontSize: '15',
  722. color: 'green',
  723. fontWeight: 'bold'
  724. }
  725. },
  726. // 提示框组件
  727. tooltip: {
  728. // 是否显示提示框组件,包括提示框浮层和 axisPointe
  729. show: false,
  730. // 触发类型: item:数据项触发,axis:坐标轴触发
  731. trigger: 'item',
  732. formatter: '{a} <br/>{b}: {c} ({d}%)'
  733. },
  734. // 系列列表。每个系列通过 type 决定自己的图表类型
  735. series: [{
  736. // 系列名称,用于tooltip的显示,legend 的图例筛选,在 setOption 更新数据和配置项时用于指定对应的系列。
  737. name: '任务进度',
  738. type: 'pie',
  739. // 饼图的半径,数组的第一项是内半径,第二项是外半径
  740. radius: ['80%', '70%'],
  741. // 是否启用防止标签重叠策略,默认开启
  742. avoidLabelOverlap: false,
  743. hoverAnimation: false,
  744. // 标签的视觉引导线样式,在 label 位置 设置为'outside'的时候会显示视觉引导线
  745. labelLine: {
  746. normal: {
  747. show: false
  748. }
  749. },
  750. data: [{
  751. value: chartLine_data.data1, // 数据值
  752. name: '完成率', // 数据项名称
  753. selected: false, // 该数据项是否被选中
  754. // 单个扇区的标签配置
  755. label: {
  756. normal: {
  757. show: true, // 是显示标签
  758. position: 'center',
  759. fontSize: 20,
  760. // 标签内容格式器,支持字符串模板和回调函数两种形式,字符串模板与回调函数返回的字符串均支持用 \n 换行
  761. formatter: '{b}\n{d}%'
  762. }
  763. }
  764. }, {
  765. value: chartLine_data.data2 - chartLine_data.data1,
  766. label: {
  767. normal: {
  768. show: false
  769. }
  770. }
  771. }]
  772. }],
  773. color: ['#409EFF', '#B7DBFF']
  774. }
  775. this.row2.chart1.chartLine.setOption(option)
  776. window.onresize = function() {
  777. this.row2.chart1.chartLine.resize()
  778. }
  779. },
  780. // 今日计划统计-完成重量
  781. roadChartLine2(chartLine_data) {
  782. if (this.row2.chart2.chartLine != null) {
  783. this.row2.chart2.chartLine.dispose()
  784. }
  785. this.row2.chart2.chartLine = echarts.init(document.getElementById('row2chartLine2'))
  786. var option = {
  787. // 标题组件,包含主标题和副标题
  788. title: {
  789. show: true,
  790. x: 'center',
  791. textStyle: {
  792. fontSize: '15',
  793. color: 'green',
  794. fontWeight: 'bold'
  795. }
  796. },
  797. // 提示框组件
  798. tooltip: {
  799. // 是否显示提示框组件,包括提示框浮层和 axisPointe
  800. show: false,
  801. // 触发类型: item:数据项触发,axis:坐标轴触发
  802. trigger: 'item',
  803. formatter: '{a} <br/>{b}: {c} ({d}%)'
  804. },
  805. // 系列列表。每个系列通过 type 决定自己的图表类型
  806. series: [{
  807. // 系列名称,用于tooltip的显示,legend 的图例筛选,在 setOption 更新数据和配置项时用于指定对应的系列。
  808. name: '任务进度',
  809. type: 'pie',
  810. // 饼图的半径,数组的第一项是内半径,第二项是外半径
  811. radius: ['80%', '70%'],
  812. // 是否启用防止标签重叠策略,默认开启
  813. avoidLabelOverlap: false,
  814. hoverAnimation: false,
  815. // 标签的视觉引导线样式,在 label 位置 设置为'outside'的时候会显示视觉引导线
  816. labelLine: {
  817. normal: {
  818. show: false
  819. }
  820. },
  821. data: [{
  822. value: chartLine_data.data1, // 数据值
  823. name: '完成率', // 数据项名称
  824. selected: false, // 该数据项是否被选中
  825. // 单个扇区的标签配置
  826. label: {
  827. normal: {
  828. show: true, // 是显示标签
  829. position: 'center',
  830. fontSize: 20,
  831. // 标签内容格式器,支持字符串模板和回调函数两种形式,字符串模板与回调函数返回的字符串均支持用 \n 换行
  832. formatter: '{b}\n{d}%'
  833. }
  834. }
  835. }, {
  836. value: chartLine_data.data2 - chartLine_data.data1,
  837. label: {
  838. normal: {
  839. show: false
  840. }
  841. }
  842. }]
  843. }],
  844. color: ['#409EFF', '#B7DBFF']
  845. }
  846. this.row2.chart2.chartLine.setOption(option)
  847. window.onresize = function() {
  848. this.row2.chart2.chartLine.resize()
  849. }
  850. },
  851. // 实时监控
  852. getChart3() {
  853. this.row2.chart3.listLoading = true
  854. GetReportform(this.row2.chart3.getdataListParm).then(response => {
  855. console.log('实时监控数据', response.data.list)
  856. if (response.data.list !== null) {
  857. var evenNumbers = []// 偶数
  858. var oddNumbers = []// 奇数
  859. for (let i = 0; i < response.data.list.data4.length; i++) {
  860. if (i == 0) {
  861. oddNumbers.push(response.data.list.data4[i])
  862. } else {
  863. if (i % 2 == 0) {
  864. evenNumbers.push(response.data.list.data4[i])
  865. } else {
  866. oddNumbers.push(response.data.list.data4[i])
  867. }
  868. }
  869. }
  870. response.data.list.data4 = oddNumbers
  871. response.data.list.data5 = evenNumbers
  872. this.row2.chart3.chartLine_data = response.data.list
  873. this.row2.chart3.total = response.data.total
  874. this.row2.chart3.pageNum = response.data.pageNum
  875. this.row2.chart3.pages = response.data.pages
  876. this.roadChartLine3(this.row2.chart3.chartLine_data)
  877. } else {
  878. this.row2.chart3.list = []
  879. }
  880. setTimeout(() => {
  881. this.row2.chart3.listLoading = false
  882. }, 100)
  883. })
  884. },
  885. roadChartLine3(chartLine_data) {
  886. if (this.row2.chart3.chartLine != null) {
  887. this.row2.chart3.chartLine.dispose()
  888. }
  889. this.row2.chart3.chartLine = echarts.init(document.getElementById('row2chartLine3'))
  890. var option = {
  891. title: {
  892. text: '',
  893. subtext: ''
  894. },
  895. color: ['#ff3131', '#61a5e8', '#ff3131', '#61a5e8'], // 关键加上这句话,legend的颜色和折线的自定义颜色就一致了
  896. legend: {
  897. data: [
  898. { name: '设计重量', icon: 'rectangle' },
  899. { name: '实际重量', icon: 'rectangle' },
  900. { name: '开始重量', icon: 'triangle' },
  901. { name: '结束重量', icon: 'triangle' }
  902. ],
  903. right: '20%',
  904. textStyle: {
  905. fontSize: 12,
  906. color: '#666'
  907. }
  908. },
  909. /* grid:{y:15},*/
  910. tooltip: {
  911. trigger: 'axis'
  912. },
  913. calculable: true,
  914. yAxis: [
  915. {
  916. type: 'value',
  917. name: '重量(kg)',
  918. splitLine: { show: false }, // 去除网格线
  919. axisLabel: {
  920. show: true,
  921. textStyle: {
  922. color: '#666' // 这里用参数代替了
  923. }
  924. }
  925. }
  926. ],
  927. xAxis: [
  928. {
  929. type: 'category',
  930. splitLine: { show: false }, // 去除网格线
  931. name: '时间',
  932. data: chartLine_data.data1,
  933. axisLabel: {
  934. show: true,
  935. textStyle: {
  936. color: '#666' // 这里用参数代替了
  937. }
  938. }
  939. }
  940. ],
  941. series: [{
  942. symbol: 'none',
  943. name: '实际重量',
  944. type: 'line',
  945. // step: 'end',
  946. data: chartLine_data.data3,
  947. smooth: true,
  948. barWidth: '37',
  949. itemStyle: {
  950. normal: {
  951. lineStyle: { color: '#ff3131' }
  952. }
  953. }
  954. }, {
  955. symbol: 'none',
  956. name: '设计重量',
  957. type: 'line',
  958. barWidth: '37',
  959. data: chartLine_data.data2,
  960. itemStyle: {
  961. normal: {
  962. lineStyle: { color: '#61a5e8' }
  963. }
  964. }
  965. }, {
  966. name: '开始重量',
  967. symbol: 'triangle',
  968. symbolSize: 10,
  969. type: 'scatter',
  970. data: chartLine_data.data4
  971. }, {
  972. name: '结束重量',
  973. symbol: 'triangle',
  974. symbolSize: 10,
  975. type: 'scatter',
  976. data: chartLine_data.data5
  977. }]
  978. }
  979. this.row2.chart3.chartLine.setOption(option)
  980. window.onresize = function() {
  981. this.row2.chart3.chartLine.resize()
  982. }
  983. },
  984. getCarLength() {
  985. this.row2.chart3.listLoading2 = true
  986. this.row2.chart3.getdataListParmList.pagecount = 0
  987. GetDataByName(this.row2.chart3.getdataListParmList).then(response => {
  988. if (response.data.list !== null) {
  989. this.carLength = response.data.total
  990. } else {
  991. this.carLength = 0
  992. }
  993. setTimeout(() => {
  994. this.row2.chart3.listLoading2 = false
  995. }, 100)
  996. })
  997. },
  998. // 图三轮询列表
  999. getChart3List() {
  1000. this.row2.chart3.listLoading2 = true
  1001. this.row2.chart3.getdataListParmList.pagecount = 3
  1002. GetDataByName(this.row2.chart3.getdataListParmList).then(response => {
  1003. if (response.data.list !== null) {
  1004. for (let i = 0; i < response.data.list.length; i++) {
  1005. this.$set(response.data.list[i], 'color', '#fff')
  1006. this.$set(response.data.list[i], 'background', '#7ac3ec')
  1007. }
  1008. this.list = response.data.list
  1009. console.log('实时监控轮播数据', this.list)
  1010. this.myKey = 0
  1011. this.$nextTick(() => {
  1012. console.log(this.$refs.list)
  1013. this.$refs.list[this.myKey].style.background = '#7ac3ec'
  1014. this.$refs.list[this.myKey].style.color = '#f7f941'
  1015. })
  1016. this.row2.chart3.getdataListParm.parammaps.pid = this.list[this.myKey].pid
  1017. this.row2.chart3.getdataListParm.parammaps.id = this.list[this.myKey].id
  1018. this.getChart3()
  1019. this.row2.chart3.pageNum2 = response.data.pageNum
  1020. this.row2.chart3.pages2 = response.data.pages
  1021. if (this.row2.chart3.getdataListParmList.offset == 1) {
  1022. this.$refs.left.style.color = '#ccc'
  1023. } else {
  1024. this.$refs.left.style.color = '#000'
  1025. }
  1026. if (this.row2.chart3.getdataListParmList.offset < this.row2.chart3.pages2) {
  1027. this.$refs.right.style.color = '#000'
  1028. } else {
  1029. this.$refs.right.style.color = '#ccc'
  1030. }
  1031. } else {
  1032. this.row2.chart3.list2 = []
  1033. }
  1034. setTimeout(() => {
  1035. this.row2.chart3.listLoading2 = false
  1036. }, 100)
  1037. })
  1038. },
  1039. // 向左切换
  1040. handleLeft() {
  1041. console.log('左')
  1042. if (this.row2.chart3.getdataListParmList.offset > 1) {
  1043. this.$refs.left.style.color = '#000'
  1044. this.row2.chart3.getdataListParmList.offset = this.row2.chart3.pageNum2 - 1
  1045. this.getChart3List()
  1046. if (this.$refs.list[0] !== undefined) {
  1047. this.$refs.list[0].style.background = '#7ac3ec'
  1048. this.$refs.list[0].style.color = '#f7f941'
  1049. this.row2.chart3.getdataListParm.parammaps.pid = this.list[0].pid
  1050. this.row2.chart3.getdataListParm.parammaps.id = this.list[0].id
  1051. this.getChart3()
  1052. }
  1053. if (this.$refs.list[1] !== undefined) {
  1054. this.$refs.list[1].style.color = '#fff'
  1055. this.$refs.list[1].style.background = '#7ac3ec'
  1056. }
  1057. if (this.$refs.list[2] !== undefined) {
  1058. this.$refs.list[2].style.color = '#fff'
  1059. this.$refs.list[2].style.background = '#7ac3ec'
  1060. }
  1061. } else {
  1062. this.$refs.left.style.color = '#ccc'
  1063. }
  1064. },
  1065. // 向右切换
  1066. handleRight() {
  1067. if (this.row2.chart3.getdataListParmList.offset < this.row2.chart3.pages2) {
  1068. this.$refs.left.style.color = '#000'
  1069. this.$refs.right.style.color = '#000'
  1070. this.row2.chart3.getdataListParmList.offset = this.row2.chart3.getdataListParmList.offset + 1
  1071. this.getChart3List()
  1072. if (this.$refs.list[0] !== undefined) {
  1073. this.$refs.list[0].style.background = '#7ac3ec'
  1074. this.$refs.list[0].style.color = '#f7f941'
  1075. this.row2.chart3.getdataListParm.parammaps.pid = this.list[0].pid
  1076. this.row2.chart3.getdataListParm.parammaps.id = this.list[0].id
  1077. this.getChart3()
  1078. }
  1079. if (this.$refs.list[1] !== undefined) {
  1080. this.$refs.list[1].style.color = '#fff'
  1081. this.$refs.list[1].style.background = '#7ac3ec'
  1082. }
  1083. if (this.$refs.list[2] !== undefined) {
  1084. this.$refs.list[2].style.color = '#fff'
  1085. this.$refs.list[2].style.background = '#7ac3ec'
  1086. }
  1087. }
  1088. },
  1089. // 点击
  1090. handleList(key, item) {
  1091. console.log(item)
  1092. clearInterval(this.timer)
  1093. for (var i in this.$refs.list) {
  1094. if (i == key) {
  1095. this.$refs.list[i].style.background = '#7ac3ec'
  1096. this.$refs.list[i].style.color = '#f7f941'
  1097. this.row2.chart3.getdataListParm.parammaps.pid = item.pid
  1098. this.row2.chart3.getdataListParm.parammaps.id = item.id
  1099. this.getChart3()
  1100. } else {
  1101. this.$refs.list[i].style.background = '#7ac3ec'
  1102. this.$refs.list[i].style.color = '#fff'
  1103. }
  1104. }
  1105. setTimeout(() => {
  1106. this.timer = setInterval(this.autoPlay, 15000)
  1107. }, 20000)
  1108. },
  1109. // 计划统计
  1110. getChart4() {
  1111. this.row3.chart1.listLoading = true
  1112. GetReportform(this.row3.chart1.getdataListParm).then(response => {
  1113. console.log('计划统计数据', response.data.list)
  1114. if (response.data.list !== null) {
  1115. this.row3.chart1.table.list = response.data.data
  1116. this.row3.chart1.chartLine_data = response.data.list
  1117. this.row3.chart1.total = response.data.total
  1118. this.roadChartLine4(this.row3.chart1.chartLine_data)
  1119. } else {
  1120. this.row3.chart1.list = []
  1121. }
  1122. setTimeout(() => {
  1123. this.row3.chart1.listLoading = false
  1124. }, 100)
  1125. })
  1126. },
  1127. roadChartLine4(chartLine_data) {
  1128. if (this.row3.chart1.chartLine != null) {
  1129. this.row3.chart1.chartLine.dispose()
  1130. }
  1131. this.row3.chart1.chartLine = echarts.init(document.getElementById('row3chartLine1'))
  1132. var option = {
  1133. title: {
  1134. text: ''
  1135. },
  1136. tooltip: {
  1137. trigger: 'axis'
  1138. },
  1139. legend: {
  1140. data: ['计划准确率', '计划正确率', '计划准确率(去除取消重量)'],
  1141. top: 10
  1142. },
  1143. grid: {
  1144. top: '20%',
  1145. left: '0%',
  1146. right: '8%',
  1147. containLabel: true
  1148. },
  1149. toolbox: {
  1150. show: true,
  1151. right: '2%',
  1152. feature: {}
  1153. },
  1154. xAxis: { type: 'category', boundaryGap: false, data: chartLine_data.data1, name: '日期' },
  1155. yAxis: {
  1156. type: 'value', name: '百分比', axisLabel: { formatter: '{value} %' }
  1157. },
  1158. series: [
  1159. { name: '计划准确率', type: 'line', data: chartLine_data.data2 },
  1160. { name: '计划正确率', type: 'line', data: chartLine_data.data3 },
  1161. { name: '计划准确率(去除取消重量)', type: 'line', data: chartLine_data.data4 }
  1162. ]
  1163. }
  1164. this.row3.chart1.chartLine.setOption(option)
  1165. window.onresize = function() {
  1166. this.row3.chart1.chartLine.resize()
  1167. }
  1168. },
  1169. // 泌乳牛干物质采食量
  1170. getChart5() {
  1171. this.row3.chart2.listLoading = true
  1172. GetReportform(this.row3.chart2.getdataListParm).then(response => {
  1173. console.log('泌乳牛干物质采食量数据', response.data.list)
  1174. if (response.data.list !== null) {
  1175. this.row3.chart2.table.list = response.data.data
  1176. this.row3.chart2.chartLine_data = response.data.list
  1177. this.row3.chart2.total = response.data.total
  1178. this.roadChartLine5(this.row3.chart2.chartLine_data)
  1179. } else {
  1180. this.row3.chart2.list = []
  1181. }
  1182. setTimeout(() => {
  1183. this.row3.chart2.listLoading = false
  1184. }, 100)
  1185. })
  1186. },
  1187. roadChartLine5(chartLine_data) {
  1188. if (this.row3.chart2.chartLine != null) {
  1189. this.row3.chart2.chartLine.dispose()
  1190. }
  1191. this.row3.chart2.chartLine = echarts.init(document.getElementById('row3chartLine2'))
  1192. var option = {
  1193. tooltip: {
  1194. trigger: 'axis'
  1195. },
  1196. legend: {
  1197. data: ['泌乳牛干物质采食量', '泌乳牛产奶量'],
  1198. right: 10
  1199. },
  1200. xAxis: [
  1201. {
  1202. type: 'category',
  1203. data: chartLine_data.data1
  1204. }
  1205. ],
  1206. yAxis: [
  1207. {
  1208. splitLine: { show: false }, type: 'value',
  1209. name: '泌乳牛干物质采食量',
  1210. axisLabel: {
  1211. formatter: '{value} '
  1212. }
  1213. }, {
  1214. splitLine: { show: false }, type: 'value',
  1215. name: '泌乳牛产奶量',
  1216. axisLabel: {
  1217. formatter: '{value} '
  1218. }
  1219. }
  1220. ],
  1221. series: [{
  1222. name: '泌乳牛干物质采食量',
  1223. type: 'bar',
  1224. itemStyle: { /* 设置柱状颜色*/
  1225. normal: {
  1226. color: '#61a5e8'
  1227. }
  1228. },
  1229. data: chartLine_data.data2
  1230. }, {
  1231. name: '泌乳牛产奶量',
  1232. type: 'line',
  1233. itemStyle: { /* 设置折线颜色*/
  1234. normal: {
  1235. color: '#ff2d2d'
  1236. }
  1237. },
  1238. yAxisIndex: 1,
  1239. data: chartLine_data.data3
  1240. }]
  1241. }
  1242. this.row3.chart2.chartLine.setOption(option)
  1243. window.onresize = function() {
  1244. this.row3.chart2.chartLine.resize()
  1245. }
  1246. },
  1247. // 成本统计
  1248. getChart6() {
  1249. this.row4.chart1.listLoading = true
  1250. GetReportform(this.row4.chart1.getdataListParm).then(response => {
  1251. console.log('成本统计数据', response.data.data)
  1252. console.log('成本统计数据', response.data.list)
  1253. if (response.data.list !== null) {
  1254. this.row4.chart1.table.list = response.data.data
  1255. this.row4.chart1.chartLine_data = response.data.list
  1256. this.row4.chart1.total = response.data.total
  1257. this.roadChartLine6(this.row4.chart1.chartLine_data)
  1258. } else {
  1259. this.row4.chart1.list = []
  1260. }
  1261. setTimeout(() => {
  1262. this.row4.chart1.listLoading = false
  1263. }, 100)
  1264. })
  1265. },
  1266. roadChartLine6(chartLine_data) {
  1267. if (this.row4.chart1.chartLine != null) {
  1268. this.row4.chart1.chartLine.dispose()
  1269. }
  1270. console.log(chartLine_data)
  1271. this.row4.chart1.chartLine = echarts.init(document.getElementById('row4chartLine1'))
  1272. var option = {
  1273. title: {
  1274. text: ''
  1275. },
  1276. grid: {
  1277. left: '8%',
  1278. right: '8%',
  1279. bottom: '3%',
  1280. containLabel: true
  1281. },
  1282. tooltip: {
  1283. trigger: 'axis'
  1284. },
  1285. legend: {
  1286. data: ['公斤奶饲料成本', '单头牛饲料成本']
  1287. },
  1288. xAxis: [
  1289. {
  1290. type: 'category',
  1291. data: chartLine_data.data1,
  1292. axisPointer: {
  1293. type: 'shadow'
  1294. },
  1295. name: '日期'
  1296. }
  1297. ],
  1298. yAxis: [
  1299. {
  1300. splitLine: { show: false }, type: 'value',
  1301. name: '公斤奶\n饲料成本(元)',
  1302. axisLabel: {
  1303. formatter: '{value}'
  1304. }
  1305. }, {
  1306. splitLine: { show: false }, type: 'value',
  1307. name: '单头牛\n饲料成本(元)',
  1308. axisLabel: {
  1309. formatter: '{value}'
  1310. }
  1311. }
  1312. ],
  1313. series: [
  1314. {
  1315. name: '公斤奶饲料成本',
  1316. type: 'bar',
  1317. itemStyle: { /* 设置柱状颜色*/
  1318. normal: {
  1319. color: '#61a5e8'
  1320. }
  1321. },
  1322. data: chartLine_data.data2
  1323. }, {
  1324. name: '单头牛饲料成本',
  1325. type: 'line',
  1326. yAxisIndex: 1,
  1327. itemStyle: { /* 设置柱状颜色*/
  1328. normal: {
  1329. color: '#ff3131'
  1330. }
  1331. },
  1332. data: chartLine_data.data3
  1333. }
  1334. ]
  1335. }
  1336. this.row4.chart1.chartLine.setOption(option)
  1337. window.onresize = function() {
  1338. this.row4.chart1.chartLine.resize()
  1339. }
  1340. },
  1341. getChart7() {
  1342. this.row4.chart2.listLoading = true
  1343. GetReportform(this.row4.chart2.getdataListParm).then(response => {
  1344. console.log('出库统计数据', response.data.list)
  1345. if (response.data.list !== null) {
  1346. this.row4.chart2.table.list = response.data.data
  1347. this.row4.chart2.chartLine_data = response.data.list
  1348. console.log(this.row4.chart2.chartLine_data)
  1349. this.row4.chart2.total = response.data.total
  1350. this.roadChartLine7(this.row4.chart2.chartLine_data)
  1351. } else {
  1352. this.row4.chart2.list = []
  1353. }
  1354. setTimeout(() => {
  1355. this.row4.chart2.listLoading = false
  1356. }, 100)
  1357. })
  1358. },
  1359. roadChartLine7(chartLine_data) {
  1360. if (this.row4.chart2.chartLine != null) {
  1361. this.row4.chart2.chartLine.dispose()
  1362. }
  1363. this.row4.chart2.chartLine = echarts.init(document.getElementById('row4chartLine2'))
  1364. var option = {
  1365. title: {
  1366. text: ''
  1367. },
  1368. grid: {
  1369. left: '3%',
  1370. right: '10%',
  1371. bottom: '3%',
  1372. containLabel: true
  1373. },
  1374. tooltip: {
  1375. trigger: 'axis'
  1376. },
  1377. legend: {
  1378. data: ['']
  1379. },
  1380. xAxis: [
  1381. {
  1382. type: 'category',
  1383. data: chartLine_data.data1,
  1384. name: '日期'
  1385. }
  1386. ],
  1387. yAxis: [
  1388. { type: 'value', name: '重量(kg)', axisLabel: { formatter: '{value}' }}
  1389. ],
  1390. series: [
  1391. {
  1392. name: '重量',
  1393. type: 'bar',
  1394. stack: '广告',
  1395. itemStyle: { /* 设置柱状颜色*/
  1396. normal: {
  1397. color: '#61a5e8'
  1398. }
  1399. },
  1400. data: chartLine_data.data2
  1401. }
  1402. ]
  1403. }
  1404. this.row4.chart2.chartLine.setOption(option)
  1405. window.onresize = function() {
  1406. this.row4.chart2.chartLine.resize()
  1407. }
  1408. },
  1409. getTable8() {
  1410. this.row4.table.listLoading = true
  1411. GetDataByName(this.row4.table.getdataListParm).then(response => {
  1412. console.log('库存预警table数据', response.data.list)
  1413. if (response.data.list !== null) {
  1414. this.row4.table.list = response.data.list
  1415. this.row4.table.total = response.data.total
  1416. } else {
  1417. this.row4.table.list = []
  1418. }
  1419. setTimeout(() => {
  1420. this.row4.table.listLoading = false
  1421. }, 100)
  1422. })
  1423. },
  1424. // 更多
  1425. handleMore() {
  1426. this.$router.push({ path: '/inventoryManagement/Warning' })
  1427. },
  1428. // 导出
  1429. handleExport(item) {
  1430. console.log(item)
  1431. // 计划统计
  1432. if (item == 'row3chartLine1') {
  1433. console.log(this.row3.chart1.table.list)
  1434. var excelDatasTabChart1 = [
  1435. {
  1436. tHeader: ['日期', '计划执行重量(kg)', '配方理论重量(kg)', '计划准确率', '计划取消重量(kg)', '计划准确率(去除取消重量)', '计划正确数', '计划数', '计划正确率'],
  1437. filterVal: ['日期', '实际量', '理论量', 'field1', '计划取消重量', 'field3', '正确数', '计划数', 'field2'],
  1438. tableDatas: this.row3.chart1.table.list,
  1439. sheetName: '计划统计'
  1440. }
  1441. ]
  1442. json2excel(excelDatasTabChart1, '计划统计', true, 'xlsx')
  1443. } else if (item == 'row3chartLine2') {
  1444. // 泌乳牛采食量
  1445. var excelDatasTabChart2 = [
  1446. {
  1447. tHeader: ['日期', '泌乳牛采食量(kg)', '泌乳牛产奶量(kg)'],
  1448. filterVal: ['日期', 'field1', 'field2'],
  1449. tableDatas: this.row3.chart2.table.list,
  1450. sheetName: '泌乳牛采食量'
  1451. }
  1452. ]
  1453. json2excel(excelDatasTabChart2, '泌乳牛采食量', true, 'xlsx')
  1454. } else if (item == 'row4chartLine1') {
  1455. // 成本统计
  1456. console.log('成本统计')
  1457. // var excelDatasTabChart2 = [
  1458. // {
  1459. // tHeader: ['日期', '泌乳牛采食量(kg)', '泌乳牛产奶量(kg)'],
  1460. // filterVal: ['日期', 'field1', 'field2'],
  1461. // tableDatas: this.row3.chart2.table.list,
  1462. // sheetName: '泌乳牛采食量'
  1463. // }
  1464. // ]
  1465. // json2excel(excelDatasTabChart2, '泌乳牛采食量', true, 'xlsx')
  1466. }
  1467. },
  1468. handleTable(item) {
  1469. console.log(item)
  1470. if (item == 'row3chartLine1') {
  1471. console.log('计划统计表格')
  1472. this.row3.chart1.isTable = true
  1473. this.row3.chart1.isChart = false
  1474. } else if (item == 'row3chartLine2') {
  1475. console.log('泌乳牛采食量表格')
  1476. this.row3.chart2.isTable = true
  1477. this.row3.chart2.isChart = false
  1478. } else if (item == 'row4chartLine1') {
  1479. console.log('成本统计表格')
  1480. this.row4.chart1.isTable = true
  1481. this.row4.chart1.isChart = false
  1482. } else if (item == 'row4chartLine2') {
  1483. console.log('混料实际重量统计表格')
  1484. this.row4.chart2.isTable = true
  1485. this.row4.chart2.isChart = false
  1486. }
  1487. },
  1488. handleChart(item) {
  1489. console.log(item)
  1490. // 显示切换图表
  1491. if (item == 'row3chartLine1') {
  1492. console.log('计划统计图表')
  1493. this.row3.chart1.isTable = false
  1494. this.row3.chart1.isChart = true
  1495. } else if (item == 'row3chartLine2') {
  1496. console.log('泌乳牛采食量图表')
  1497. this.row3.chart2.isTable = false
  1498. this.row3.chart2.isChart = true
  1499. } else if (item == 'row4chartLine1') {
  1500. console.log('成本统计图表')
  1501. this.row4.chart1.isTable = false
  1502. this.row4.chart1.isChart = true
  1503. } else if (item == 'row4chartLine2') {
  1504. console.log('混料实际重量统计图表')
  1505. this.row4.chart2.isTable = false
  1506. this.row4.chart2.isChart = true
  1507. }
  1508. }
  1509. }
  1510. }
  1511. </script>
  1512. <style lang="scss" scoped>
  1513. .Title{
  1514. 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;
  1515. }
  1516. .dashboard-editor-container {
  1517. background-color: #F4F4F4;
  1518. min-height: 100vh;
  1519. .news{
  1520. width: 70%;
  1521. height: 30px;
  1522. background: #fff;
  1523. margin: 0 auto;
  1524. border-radius: 10px;
  1525. text-align: center;
  1526. line-height: 30px;
  1527. color: red;
  1528. b{color: #000;}
  1529. }
  1530. .bottom{
  1531. padding:0 30px;
  1532. h4{text-align: right;}
  1533. .grid-content{
  1534. background: #fff;height: 90px;
  1535. border-radius: 10px;
  1536. }
  1537. .one{
  1538. border: 1px solid #82CBB3;height: 90px;
  1539. .Left{
  1540. float: left;
  1541. width: 65px;
  1542. text-align: center;
  1543. i{font-size: 36px;color:#82CBB3;line-height: 90px;}
  1544. }
  1545. .Right{
  1546. float: left;
  1547. margin-top:15px;
  1548. height: 60px;
  1549. font-weight: 600;
  1550. font-size: 14px;
  1551. line-height: 30px;
  1552. span{
  1553. display: inline-block;
  1554. width: 130px;
  1555. text-align: right;
  1556. }
  1557. }
  1558. }
  1559. .two{
  1560. border: 1px solid #FF9900;
  1561. .Left{
  1562. float: left;
  1563. width: 65px;
  1564. text-align: center;
  1565. i{font-size: 36px;color:#FF9900;line-height: 90px;}
  1566. }
  1567. .Right{
  1568. float: left;
  1569. margin-top:15px;
  1570. height: 60px;
  1571. font-weight: 600;
  1572. font-size: 14px;
  1573. line-height: 30px;
  1574. span{
  1575. display: inline-block;
  1576. width: 130px;
  1577. text-align: right;
  1578. }
  1579. }
  1580. }
  1581. .three{
  1582. border: 1px solid #0099FF;
  1583. .Left{
  1584. float: left;
  1585. width: 65px;
  1586. text-align: center;
  1587. i{font-size: 36px;color:#0099FF;line-height: 90px;}
  1588. }
  1589. .Right{
  1590. float: left;
  1591. height: 60px;
  1592. font-weight: 600;
  1593. font-size: 14px;
  1594. line-height: 30px;
  1595. margin-top:15px;
  1596. span{
  1597. display: inline-block;
  1598. width: 130px;
  1599. text-align: right;
  1600. }
  1601. }
  1602. }
  1603. .four{
  1604. border: 1px solid #FF5C5C;
  1605. .Left{
  1606. float: left;
  1607. width: 55px;
  1608. text-align: center;
  1609. i{font-size: 36px;color:#FF5C5C;line-height: 90px;}
  1610. }
  1611. .Right{
  1612. float: left;
  1613. flex: 1;
  1614. height: 60px;
  1615. font-weight: 600;
  1616. font-size: 14px;
  1617. line-height: 30px;
  1618. margin-top:15px;
  1619. span{
  1620. display: inline-block;
  1621. width: 150px;
  1622. text-align: right;
  1623. }
  1624. }
  1625. }
  1626. .car{
  1627. width:100%;height:150px;
  1628. display:flex;
  1629. display: -webkit-flex;
  1630. -webkit-flex-direction:row;
  1631. i{font-size: 50px;width:50px;display: block;line-height: 150px;}
  1632. .carList{
  1633. flex:1;height: 130px;
  1634. .list{
  1635. height: 130px;color: #fff;
  1636. // box-shadow: #000 0px 0px 10px;
  1637. // border-radius: 10px;
  1638. .list-l{
  1639. p{
  1640. padding-left:10px;font-size:13px;line-height: 16px; text-overflow: ellipsis;white-space:nowrap; overflow:hidden;
  1641. }
  1642. }
  1643. .list-r{
  1644. p{
  1645. font-size:13px;line-height: 16px;text-overflow: ellipsis;white-space:nowrap; overflow:hidden;
  1646. }
  1647. }
  1648. }
  1649. }
  1650. }
  1651. }
  1652. }
  1653. </style>