e4b24777aac62348d1dae2ebb7a2094b2636e135.svn-base 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262
  1. <template>
  2. <div class="dashboard-editor-container">
  3. <div style="background: #F4F4F4;height: 10px;" />
  4. <div v-if="news==1" class="news"><b>消息提醒:</b>撒料计划未分配完善,请及时进行计划分配</div>
  5. <div v-if="news==2" class="news"><b>消息提醒:</b>预混计划未分配完善,请及时进行计划分配</div>
  6. <div v-if="news==3" class="news"><b>消息提醒:</b>剩料计划未分配完善,请及时进行计划分配</div>
  7. <div class="bottom">
  8. <h4>2020-07-10</h4>
  9. <el-row :gutter="20">
  10. <el-col :span="6">
  11. <div class="grid-content one">
  12. <div class="Left">
  13. <i class="iconfont icon-shuaxin" />
  14. </div>
  15. <div class="Right">
  16. <span>昨日混料准确率:</span>80%<br>
  17. <span>近30天混料准确率:</span>90%
  18. </div>
  19. </div>
  20. </el-col>
  21. <el-col :span="6">
  22. <div class="grid-content two">
  23. <div class="Left">
  24. <i class="iconfont icon-zhunqueshuai2" />
  25. </div>
  26. <div class="Right">
  27. <span>昨日撒料准确率:</span>80%<br>
  28. <span>近30天撒料准确率:</span>90%
  29. </div>
  30. </div>
  31. </el-col>
  32. <el-col :span="6">
  33. <div class="grid-content three">
  34. <div class="Left">
  35. <i class="iconfont icon-zhinengsiwei" style="font-size: 40px;" />
  36. </div>
  37. <div class="Right">
  38. <span>昨日撒料正确率:</span>80%<br>
  39. <span>近30天撒料正确率:</span>90%
  40. </div>
  41. </div>
  42. </el-col>
  43. <el-col :span="6">
  44. <div class="grid-content four">
  45. <div class="Left">
  46. <i class="iconfont icon-siliaotoufangjilu" style="font-size: 50px;" />
  47. </div>
  48. <div class="Right">
  49. <span>昨日撒料偏差:</span>80 min<br>
  50. <span>近30天撒料偏差:</span>90 min
  51. </div>
  52. </div>
  53. </el-col>
  54. </el-row>
  55. <el-row :gutter="20" style="margin-top: 20px;">
  56. <el-col :span="6">
  57. <div class="grid-content" style="height:500px;background: #fff;">
  58. <div style="height: 250px; border-bottom: 1px solid #000;">
  59. <b style="padding-left: 10px;line-height: 50px">今日计划统计</b><br>
  60. <div style="text-align: center;">
  61. <b style="padding-right: 10px;">完成车次:15</b>
  62. <b>计划车次:20</b>
  63. </div>
  64. <div id="row2chartLine1" style="height: 150px;" />
  65. </div>
  66. <div style="height: 250px;">
  67. <div style="text-align: center;padding-top:50px;">
  68. <b style="padding-right: 10px;">完成重量:15</b>
  69. <b>计划重量:20</b>
  70. </div>
  71. <div id="row2chartLine2" style="height: 150px;" />
  72. </div>
  73. </div>
  74. </el-col>
  75. <el-col :span="18">
  76. <div class="grid-content" style="height:500px;">
  77. <div style="height:350px;">
  78. <div style="font-size:14px;color:#666;margin:0 auto;position: relative;">
  79. <span style="line-height:30px;position:absolute;right:190px"><i class="el-icon-caret-top" style="color:#c23531;line-height:30px;font-size:30px;" /><b style="line-height:32px;">开始重量</b></span>
  80. <span style="line-height:30px;position:absolute;right:100px"><i class="el-icon-caret-top" style="color:#2f4554;line-height:30px;font-size:30px;" /><b style="line-height:32px;">结束重量</b></span>
  81. </div>
  82. <div id="row2chartLine3" style="height: 100%;" />
  83. </div>
  84. <div class="car" style="position: relative;">
  85. <p style="position: absolute;left:50px;top:-50px;">当前车辆数:5</p>
  86. <i ref="left" class="el-icon-arrow-left" @click="handleLeft" />
  87. <el-row :gutter="20" class="carList">
  88. <el-col v-for="(item,index) in list" :key="index" :span="8">
  89. <div ref="list" class="list" @click="handleList(index)">
  90. <el-row :gutter="20">
  91. <el-col :span="12" class="list-l">
  92. <p><span>车辆:</span>{{ item.avgdim }}</p>
  93. <el-tooltip placement="top">
  94. <p slot="content"><span>饲料:</span>{{ item.avgmonthage }}</p>
  95. <p><span>饲料:</span>{{ item.avgmonthage }}</p>
  96. </el-tooltip>
  97. <p><span>计划重量:</span>{{ item.barname }}</p>
  98. <p><span>剩余重量:</span>{{ item.bigcowclass }}</p>
  99. <p><span>车辆应载重:</span>{{ item.bigcowclass }}</p>
  100. </el-col>
  101. <el-col :span="12" class="list-r">
  102. <el-tooltip placement="top">
  103. <p slot="content"><span>描述:</span>{{ item.bw }}</p>
  104. <p><span>描述:</span>{{ item.bw }}</p>
  105. </el-tooltip>
  106. <p><span>栏舍:</span>{{ item.cowclass }}</p>
  107. <p><span>完成重量:</span>{{ item.cowclassid }}</p>
  108. <p><span>完成度:</span>{{ item.cowsum }}</p>
  109. <p><span>车辆已载重:</span>{{ item.dayspre }}</p>
  110. </el-col>
  111. </el-row>
  112. </div>
  113. </el-col>
  114. </el-row>
  115. <i ref="right" class="el-icon-arrow-right" @click="handleRight" />
  116. </div>
  117. </div>
  118. </el-col>
  119. </el-row>
  120. <el-row :gutter="20">
  121. <!-- 计划统计 -->
  122. <el-col :span="12" style="margin-top: 20px;background: #fff;">
  123. <div id="row3chartLine1" style="height:400px;" />
  124. </el-col>
  125. <!-- 泌乳牛采食量 -->
  126. <el-col :span="12" style="margin-top: 20px;background: #fff;">
  127. <div id="row3chartLine2" style="height:400px;" />
  128. </el-col>
  129. </el-row>
  130. <el-row :gutter="20">
  131. <!-- 成本统计 -->
  132. <el-col :span="8" style="margin-top: 20px;background: #fff;">
  133. <div id="row4chartLine1" style="height:400px;" />
  134. </el-col>
  135. <!-- 出库统计 -->
  136. <el-col :span="8" style="margin-top: 20px;background: #fff;">
  137. <div id="row4chartLine2" style="height:400px;" />
  138. </el-col>
  139. <el-col :span="8" style="margin-top: 20px;background: #fff;">
  140. <el-table
  141. :key="row4.table.tableKey"
  142. v-loading="row4.table.listLoading"
  143. element-loading-text="给我一点时间"
  144. :data="row4.table.list"
  145. border
  146. fit
  147. highlight-current-row
  148. style="width: 100%;"
  149. height="350"
  150. :row-style="rowStyle"
  151. :cell-style="cellStyle"
  152. class="elTable table-fixed"
  153. >
  154. <el-table-column label="序号" min-width="90px" align="center" prop="barname" />
  155. <el-table-column label="饲料名称" min-width="90px" align="center" prop="barname" />
  156. <el-table-column label="库存量(kg)" min-width="90px" align="center" prop="barname" />
  157. <el-table-column label="剩余使用天数" min-width="90px" align="center" prop="barname" />
  158. </el-table>
  159. <span style="line-height: 50px;color:#82CBB3;text-align: center;width: 100%;display: inline-block;cursor:pointer;" @click="handleMore">查看更多</span>
  160. </el-col>
  161. </el-row>
  162. </div>
  163. </div>
  164. </template>
  165. <script>
  166. import { GetDataByName } from '@/api/common'
  167. import Cookies from 'js-cookie'
  168. import { parseTime } from '@/utils/index.js'
  169. import echarts from 'echarts'
  170. require('echarts/theme/macarons')
  171. var myKey = 0
  172. export default {
  173. name: 'DashboardEditor',
  174. data() {
  175. return {
  176. 'list': [],
  177. news: 1,
  178. row: {},
  179. row2: {
  180. chart1: {
  181. chartLine: null,
  182. chartLine_data: {},
  183. getdataListParm: {
  184. name: 'getBarmilkList',
  185. page: 1,
  186. offset: 1,
  187. pagecount: 10,
  188. returntype: 'Map',
  189. parammaps: {
  190. pastureid: Cookies.get('pastureid'),
  191. enable: ''
  192. }
  193. },
  194. list: [],
  195. total: 0,
  196. listLoading: true
  197. },
  198. chart2: {
  199. chartLine: null,
  200. chartLine_data: {},
  201. getdataListParm: {
  202. name: 'getBarmilkList',
  203. page: 1,
  204. offset: 1,
  205. pagecount: 10,
  206. returntype: 'Map',
  207. parammaps: {
  208. pastureid: Cookies.get('pastureid'),
  209. enable: ''
  210. }
  211. },
  212. list: [],
  213. total: 0,
  214. listLoading: true
  215. },
  216. chart3: {
  217. chartLine: null,
  218. chartLine_data: {},
  219. getdataListParm: {
  220. name: 'getBarmilkList',
  221. page: 1,
  222. offset: 1,
  223. pagecount: 3,
  224. returntype: 'Map',
  225. parammaps: {
  226. pastureid: Cookies.get('pastureid'),
  227. enable: ''
  228. }
  229. },
  230. list: [],
  231. total: 0,
  232. listLoading: true,
  233. pageNum: '',
  234. pages: '',
  235. getdataListParmList: {
  236. name: 'getBarmilkList',
  237. page: 1,
  238. offset: 1,
  239. pagecount: 3,
  240. returntype: 'Map',
  241. parammaps: {
  242. pastureid: Cookies.get('pastureid'),
  243. enable: ''
  244. }
  245. },
  246. list2: [],
  247. total2: 0,
  248. listLoading2: true,
  249. pageNum2: '',
  250. pages2: ''
  251. }
  252. },
  253. row3: {
  254. chart1: {
  255. chartLine: null,
  256. chartLine_data: {},
  257. getdataListParm: {
  258. name: 'getBarmilkList',
  259. page: 1,
  260. offset: 1,
  261. pagecount: 10,
  262. returntype: 'Map',
  263. parammaps: {
  264. pastureid: Cookies.get('pastureid'),
  265. enable: ''
  266. }
  267. },
  268. list: [],
  269. total: 0,
  270. listLoading: true
  271. },
  272. chart2: {
  273. chartLine: null,
  274. chartLine_data: {},
  275. getdataListParm: {
  276. name: 'getBarmilkList',
  277. page: 1,
  278. offset: 1,
  279. pagecount: 10,
  280. returntype: 'Map',
  281. parammaps: {
  282. pastureid: Cookies.get('pastureid'),
  283. enable: ''
  284. }
  285. },
  286. list: [],
  287. total: 0,
  288. listLoading: true
  289. }
  290. },
  291. row4: {
  292. chart1: {
  293. chartLine: null,
  294. chartLine_data: {},
  295. getdataListParm: {
  296. name: 'getBarmilkList',
  297. page: 1,
  298. offset: 1,
  299. pagecount: 10,
  300. returntype: 'Map',
  301. parammaps: {
  302. pastureid: Cookies.get('pastureid'),
  303. enable: ''
  304. }
  305. },
  306. list: [],
  307. total: 0,
  308. listLoading: true
  309. },
  310. chart2: {
  311. chartLine: null,
  312. chartLine_data: {},
  313. getdataListParm: {
  314. name: 'getBarmilkList',
  315. page: 1,
  316. offset: 1,
  317. pagecount: 10,
  318. returntype: 'Map',
  319. parammaps: {
  320. pastureid: Cookies.get('pastureid'),
  321. enable: ''
  322. }
  323. },
  324. list: [],
  325. total: 0,
  326. listLoading: true
  327. },
  328. table: {
  329. getdataListParm: {
  330. name: 'getBarmilkList',
  331. page: 1,
  332. offset: 1,
  333. pagecount: 5,
  334. returntype: 'Map',
  335. parammaps: {
  336. pastureid: Cookies.get('pastureid')
  337. }
  338. },
  339. tableKey: 1,
  340. list: [],
  341. total: 0,
  342. listLoading: true,
  343. temp: {}
  344. }
  345. },
  346. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  347. cellStyle: { padding: 0 + 'px' }
  348. }
  349. },
  350. created() {
  351. this.getChart1()
  352. this.getChart2()
  353. this.getChart3List()
  354. window.setInterval(() => {
  355. setTimeout(() => {
  356. this.$refs.list[myKey].style.background = '#409EFF'
  357. this.$refs.list[myKey + 1].style.background = '#66B1FF'
  358. this.getChart3()
  359. myKey = myKey + 1
  360. if (myKey == 2) {
  361. setTimeout(() => {
  362. if (this.row2.chart3.pageNum2 == this.row2.chart3.pages2) {
  363. this.$refs.left.style.color = '#000'
  364. this.$refs.right.style.color = '#ccc'
  365. this.row2.chart3.getdataListParmList.offset = 1
  366. this.getChart3()
  367. this.getChart3List()
  368. } else {
  369. this.getChart3()
  370. this.row2.chart3.getdataListParmList.offset = this.row2.chart3.getdataListParmList.offset + 1
  371. this.$refs.left.style.color = '#ccc'
  372. this.$refs.right.style.color = '#000'
  373. this.getChart3List()
  374. }
  375. myKey = 0
  376. this.getChart3()
  377. this.$refs.list[myKey].style.background = '#409EFF'
  378. }, 1000000)
  379. }
  380. console.log(myKey)
  381. }, 0)
  382. }, 1000000)
  383. this.getChart4()
  384. this.getChart5()
  385. this.getChart6()
  386. this.getChart7()
  387. this.getTable8()
  388. },
  389. methods: {
  390. getChart1() {
  391. this.row2.chart1.listLoading = true
  392. GetDataByName(this.row2.chart1.getdataListParm).then(response => {
  393. console.log('完成车次数据', response.data.list)
  394. if (response.data.list !== null) {
  395. this.row2.chart1.chartLine_data = {
  396. data1: 15,
  397. data2: 20
  398. }
  399. this.row2.chart1.total = response.data.total
  400. this.roadChartLine1(this.row2.chart1.chartLine_data)
  401. } else {
  402. this.row2.chart1.list = []
  403. }
  404. setTimeout(() => {
  405. this.row2.chart1.listLoading = false
  406. }, 100)
  407. })
  408. },
  409. roadChartLine1(chartLine_data) {
  410. if (this.row2.chart1.chartLine != null) {
  411. this.row2.chart1.chartLine.dispose()
  412. }
  413. this.row2.chart1.chartLine = echarts.init(document.getElementById('row2chartLine1'))
  414. var option = {
  415. // 标题组件,包含主标题和副标题
  416. title: {
  417. show: true,
  418. x: 'center',
  419. textStyle: {
  420. fontSize: '15',
  421. color: 'green',
  422. fontWeight: 'bold'
  423. }
  424. },
  425. // 提示框组件
  426. tooltip: {
  427. // 是否显示提示框组件,包括提示框浮层和 axisPointe
  428. show: false,
  429. // 触发类型: item:数据项触发,axis:坐标轴触发
  430. trigger: 'item',
  431. formatter: '{a} <br/>{b}: {c} ({d}%)'
  432. },
  433. // 系列列表。每个系列通过 type 决定自己的图表类型
  434. series: [{
  435. // 系列名称,用于tooltip的显示,legend 的图例筛选,在 setOption 更新数据和配置项时用于指定对应的系列。
  436. name: '任务进度',
  437. type: 'pie',
  438. // 饼图的半径,数组的第一项是内半径,第二项是外半径
  439. radius: ['80%', '70%'],
  440. // 是否启用防止标签重叠策略,默认开启
  441. avoidLabelOverlap: false,
  442. hoverAnimation: false,
  443. // 标签的视觉引导线样式,在 label 位置 设置为'outside'的时候会显示视觉引导线
  444. labelLine: {
  445. normal: {
  446. show: false
  447. }
  448. },
  449. data: [{
  450. value: chartLine_data.data1, // 数据值
  451. name: '完成率', // 数据项名称
  452. selected: false, // 该数据项是否被选中
  453. // 单个扇区的标签配置
  454. label: {
  455. normal: {
  456. show: true, // 是显示标签
  457. position: 'center',
  458. fontSize: 20,
  459. // 标签内容格式器,支持字符串模板和回调函数两种形式,字符串模板与回调函数返回的字符串均支持用 \n 换行
  460. formatter: '{b}\n{d}%'
  461. }
  462. }
  463. }, {
  464. value: chartLine_data.data2 - chartLine_data.data1,
  465. label: {
  466. normal: {
  467. show: false
  468. }
  469. }
  470. }]
  471. }],
  472. color: ['#409EFF', '#b8eedc']
  473. }
  474. this.row2.chart1.chartLine.setOption(option)
  475. window.onresize = function() {
  476. this.row2.chart1.chartLine.resize()
  477. }
  478. },
  479. getChart2() {
  480. this.row2.chart2.listLoading = true
  481. GetDataByName(this.row2.chart2.getdataListParm).then(response => {
  482. console.log('完成重量数据', response.data.list)
  483. if (response.data.list !== null) {
  484. this.row2.chart2.chartLine_data = {
  485. data1: 15,
  486. data2: 20
  487. }
  488. this.row2.chart2.total = response.data.total
  489. this.roadChartLine2(this.row2.chart2.chartLine_data)
  490. } else {
  491. this.row2.chart2.list = []
  492. }
  493. setTimeout(() => {
  494. this.row2.chart2.listLoading = false
  495. }, 100)
  496. })
  497. },
  498. roadChartLine2(chartLine_data) {
  499. if (this.row2.chart2.chartLine != null) {
  500. this.row2.chart2.chartLine.dispose()
  501. }
  502. this.row2.chart2.chartLine = echarts.init(document.getElementById('row2chartLine2'))
  503. var option = {
  504. // 标题组件,包含主标题和副标题
  505. title: {
  506. show: true,
  507. x: 'center',
  508. textStyle: {
  509. fontSize: '15',
  510. color: 'green',
  511. fontWeight: 'bold'
  512. }
  513. },
  514. // 提示框组件
  515. tooltip: {
  516. // 是否显示提示框组件,包括提示框浮层和 axisPointe
  517. show: false,
  518. // 触发类型: item:数据项触发,axis:坐标轴触发
  519. trigger: 'item',
  520. formatter: '{a} <br/>{b}: {c} ({d}%)'
  521. },
  522. // 系列列表。每个系列通过 type 决定自己的图表类型
  523. series: [{
  524. // 系列名称,用于tooltip的显示,legend 的图例筛选,在 setOption 更新数据和配置项时用于指定对应的系列。
  525. name: '任务进度',
  526. type: 'pie',
  527. // 饼图的半径,数组的第一项是内半径,第二项是外半径
  528. radius: ['80%', '70%'],
  529. // 是否启用防止标签重叠策略,默认开启
  530. avoidLabelOverlap: false,
  531. hoverAnimation: false,
  532. // 标签的视觉引导线样式,在 label 位置 设置为'outside'的时候会显示视觉引导线
  533. labelLine: {
  534. normal: {
  535. show: false
  536. }
  537. },
  538. data: [{
  539. value: chartLine_data.data1, // 数据值
  540. name: '完成率', // 数据项名称
  541. selected: false, // 该数据项是否被选中
  542. // 单个扇区的标签配置
  543. label: {
  544. normal: {
  545. show: true, // 是显示标签
  546. position: 'center',
  547. fontSize: 20,
  548. // 标签内容格式器,支持字符串模板和回调函数两种形式,字符串模板与回调函数返回的字符串均支持用 \n 换行
  549. formatter: '{b}\n{d}%'
  550. }
  551. }
  552. }, {
  553. value: chartLine_data.data2 - chartLine_data.data1,
  554. label: {
  555. normal: {
  556. show: false
  557. }
  558. }
  559. }]
  560. }],
  561. color: ['#409EFF', '#b8eedc']
  562. }
  563. this.row2.chart2.chartLine.setOption(option)
  564. window.onresize = function() {
  565. this.row2.chart2.chartLine.resize()
  566. }
  567. },
  568. getChart3() {
  569. this.row2.chart3.listLoading = true
  570. GetDataByName(this.row2.chart3.getdataListParm).then(response => {
  571. console.log('实时监控数据', response.data.list)
  572. if (response.data.list !== null) {
  573. console.log(this.$refs.list)
  574. this.$refs.list[myKey].style.background = '#66B1FF'
  575. console.log(this.$refs)
  576. this.row2.chart3.chartLine_data = {
  577. data1: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
  578. data2: [220, 250, 201, 234, 290, 430, 410],
  579. data3: [120, 130, 101, 134, 90, 430, 210]
  580. }
  581. this.row2.chart3.total = response.data.total
  582. this.row2.chart3.pageNum = response.data.pageNum
  583. this.row2.chart3.pages = response.data.pages
  584. this.roadChartLine3(this.row2.chart3.chartLine_data)
  585. } else {
  586. this.row2.chart3.list = []
  587. }
  588. setTimeout(() => {
  589. this.row2.chart3.listLoading = false
  590. }, 100)
  591. })
  592. },
  593. roadChartLine3(chartLine_data) {
  594. if (this.row2.chart3.chartLine != null) {
  595. this.row2.chart3.chartLine.dispose()
  596. }
  597. this.row2.chart3.chartLine = echarts.init(document.getElementById('row2chartLine3'))
  598. var option = {
  599. title: {
  600. text: '实时监控',
  601. subtext: ''
  602. },
  603. color: ['#c23531', '#2f4554'], // 关键加上这句话,legend的颜色和折线的自定义颜色就一致了
  604. legend: {
  605. icon: 'rectangle',
  606. data: ['设计重量', '实际重量'],
  607. // right: '20%',
  608. textStyle: {
  609. fontSize: 12,
  610. color: '#666'
  611. }
  612. },
  613. /* grid:{y:15},*/
  614. tooltip: {
  615. trigger: 'axis'
  616. },
  617. calculable: true,
  618. yAxis: [
  619. {
  620. type: 'value',
  621. splitLine: { show: false }, // 去除网格线
  622. axisLabel: {
  623. show: true,
  624. textStyle: {
  625. color: '#666' // 这里用参数代替了
  626. }
  627. }
  628. }
  629. ],
  630. xAxis: [
  631. {
  632. type: 'category',
  633. splitLine: { show: false }, // 去除网格线
  634. data: chartLine_data.data1,
  635. axisLabel: {
  636. show: true,
  637. textStyle: {
  638. color: '#666' // 这里用参数代替了
  639. }
  640. }
  641. }
  642. ],
  643. series: [
  644. {
  645. name: '设计重量',
  646. type: 'line',
  647. barWidth: '37',
  648. data: chartLine_data.data2,
  649. symbol: 'triangle', symbolSize: 10,
  650. itemStyle: {
  651. normal: {
  652. lineStyle: { color: '#c23531' },
  653. color: function(param) {
  654. const colorList = ['#2f4554', '#c23531']
  655. let x = ''
  656. param.dataIndex % 2 == 0 ? x = 1 : x = 2
  657. if (x == '1') {
  658. return colorList[0]
  659. } else {
  660. return colorList[1]
  661. }
  662. }
  663. }
  664. }
  665. },
  666. {
  667. name: '实际重量',
  668. type: 'line',
  669. step: 'end',
  670. data: chartLine_data.data3,
  671. barWidth: '37',
  672. itemStyle: {
  673. normal: {
  674. lineStyle: { color: '#2f4554' }
  675. }
  676. }
  677. }
  678. ]
  679. }
  680. this.row2.chart3.chartLine.setOption(option)
  681. window.onresize = function() {
  682. this.row2.chart3.chartLine.resize()
  683. }
  684. },
  685. // 图三轮询列表
  686. getChart3List() {
  687. this.row2.chart3.listLoading2 = true
  688. GetDataByName(this.row2.chart3.getdataListParmList).then(response => {
  689. console.log('实时监控数据', response.data.list)
  690. if (response.data.list !== null) {
  691. this.list = response.data.list
  692. console.log(this.$refs.list)
  693. console.log(this.$refs)
  694. this.row2.chart3.total2 = response.data.total
  695. this.row2.chart3.pageNum2 = response.data.pageNum
  696. this.row2.chart3.pages2 = response.data.pages
  697. this.getChart3()
  698. if (this.row2.chart3.getdataListParmList.offset == 1) {
  699. this.$refs.left.style.color = '#ccc'
  700. } else {
  701. this.$refs.left.style.color = '#000'
  702. }
  703. if (response.data.pageNum == response.data.pages) {
  704. this.$refs.right.style.color = '#ccc'
  705. } else {
  706. this.$refs.right.style.color = '#000'
  707. }
  708. } else {
  709. this.row2.chart3.list2 = []
  710. }
  711. setTimeout(() => {
  712. this.row2.chart3.listLoading2 = false
  713. }, 100)
  714. })
  715. },
  716. // 向左切换
  717. handleLeft() {
  718. console.log('左')
  719. if (this.row2.chart3.getdataListParmList.offset > 1) {
  720. this.row2.chart3.getdataListParmList.offset = this.row2.chart3.getdataListParmList.offset - 1
  721. this.getChart3List()
  722. }
  723. },
  724. // 向右切换
  725. handleRight() {
  726. if (this.row2.chart3.pageNum2 !== this.row2.chart3.pages2) {
  727. this.row2.chart3.getdataListParmList.offset = this.row2.chart3.getdataListParmList.offset + 1
  728. this.getChart3List()
  729. }
  730. },
  731. // 点击
  732. handleList(key) {
  733. console.log(this.$refs.list)
  734. for (var i in this.$refs.list) {
  735. if (i == key) {
  736. this.$refs.list[i].style.background = '#66B1FF'
  737. this.getChart3()
  738. } else {
  739. this.$refs.list[i].style.background = '#409EFF'
  740. }
  741. }
  742. },
  743. getChart4() {
  744. this.row3.chart1.listLoading = true
  745. GetDataByName(this.row3.chart1.getdataListParm).then(response => {
  746. console.log('计划统计数据', response.data.list)
  747. if (response.data.list !== null) {
  748. this.row3.chart1.chartLine_data = {
  749. data1: ['计划准确率', '计划正确率', '计划准确率(去除取消重量)'],
  750. data2: ['08/12', '08/13', '08/14', '08/15', '08/16', '08/17', '08/18'],
  751. data3: [220, 182, 191, 234, 290, 330, 310],
  752. data4: [150, 232, 201, 154, 190, 330, 410],
  753. data5: [120, 132, 101, 134, 90, 230, 210]
  754. }
  755. this.row3.chart1.total = response.data.total
  756. this.roadChartLine4(this.row3.chart1.chartLine_data)
  757. } else {
  758. this.row3.chart1.list = []
  759. }
  760. setTimeout(() => {
  761. this.row3.chart1.listLoading = false
  762. }, 100)
  763. })
  764. },
  765. roadChartLine4(chartLine_data) {
  766. if (this.row3.chart1.chartLine != null) {
  767. this.row3.chart1.chartLine.dispose()
  768. }
  769. this.row3.chart1.chartLine = echarts.init(document.getElementById('row3chartLine1'))
  770. var option = {
  771. title: {
  772. text: '计划统计'
  773. },
  774. tooltip: {
  775. trigger: 'axis'
  776. },
  777. legend: {
  778. data: chartLine_data.data1,
  779. top: 10,
  780. right: 10
  781. },
  782. grid: {
  783. left: '3%',
  784. right: '8%',
  785. bottom: '3%',
  786. containLabel: true
  787. },
  788. toolbox: {
  789. show: true,
  790. right: '2%',
  791. feature: {}
  792. },
  793. xAxis: { type: 'category', boundaryGap: false, data: chartLine_data.data2, name: '时间' },
  794. yAxis: {
  795. type: 'value', name: '百分比'
  796. },
  797. series: [
  798. {
  799. name: chartLine_data.data1[0],
  800. type: 'line',
  801. stack: '总量',
  802. data: chartLine_data.data3
  803. },
  804. {
  805. name: chartLine_data.data1[1],
  806. type: 'line',
  807. stack: '总量',
  808. data: chartLine_data.data4
  809. },
  810. {
  811. name: chartLine_data.data1[2],
  812. type: 'line',
  813. stack: '总量',
  814. data: chartLine_data.data5
  815. }
  816. ]
  817. }
  818. this.row3.chart1.chartLine.setOption(option)
  819. window.onresize = function() {
  820. this.row3.chart1.chartLine.resize()
  821. }
  822. },
  823. getChart5() {
  824. this.row3.chart2.listLoading = true
  825. GetDataByName(this.row3.chart2.getdataListParm).then(response => {
  826. console.log('泌乳牛采食量数据', response.data.list)
  827. if (response.data.list !== null) {
  828. this.row3.chart2.chartLine_data = {
  829. data1: ['08/10', '08/11', '08/12', '08/13', '08/14'],
  830. data2: [50, 75, 100, 150, 200],
  831. data3: [30, 75, 100, 150, 200]
  832. }
  833. this.row3.chart2.total = response.data.total
  834. this.roadChartLine5(this.row3.chart2.chartLine_data)
  835. } else {
  836. this.row3.chart2.list = []
  837. }
  838. setTimeout(() => {
  839. this.row3.chart2.listLoading = false
  840. }, 100)
  841. })
  842. },
  843. roadChartLine5(chartLine_data) {
  844. if (this.row3.chart2.chartLine != null) {
  845. this.row3.chart2.chartLine.dispose()
  846. }
  847. this.row3.chart2.chartLine = echarts.init(document.getElementById('row3chartLine2'))
  848. var option = {
  849. title: {
  850. text: '泌乳牛采食量'
  851. },
  852. tooltip: {
  853. trigger: 'axis'
  854. },
  855. legend: {
  856. data: ['泌乳牛产奶量', '泌乳牛采食量']
  857. },
  858. xAxis: [
  859. {
  860. type: 'category',
  861. data: chartLine_data.data1,
  862. name: '日期'
  863. }
  864. ],
  865. yAxis: [
  866. {
  867. type: 'value',
  868. name: '泌乳牛采食量(kg)',
  869. axisLabel: {
  870. formatter: '{value} '
  871. }
  872. }, {
  873. type: 'value',
  874. name: '产奶量(kg)',
  875. axisLabel: {
  876. formatter: '{value} '
  877. }
  878. }
  879. ],
  880. series: [{
  881. name: '泌乳牛采食量',
  882. type: 'bar',
  883. itemStyle: { /* 设置柱状颜色*/
  884. normal: {
  885. color: '#61a5e8'
  886. }
  887. },
  888. data: chartLine_data.data2
  889. }, {
  890. name: '泌乳牛产奶量',
  891. type: 'line',
  892. itemStyle: { /* 设置折线颜色*/
  893. normal: {
  894. color: '#ff2d2d'
  895. }
  896. },
  897. data: chartLine_data.data3
  898. }]
  899. }
  900. this.row3.chart2.chartLine.setOption(option)
  901. window.onresize = function() {
  902. this.row3.chart2.chartLine.resize()
  903. }
  904. },
  905. getChart6() {
  906. this.row4.chart1.listLoading = true
  907. GetDataByName(this.row4.chart1.getdataListParm).then(response => {
  908. console.log('成本统计数据', response.data.list)
  909. if (response.data.list !== null) {
  910. this.row4.chart1.chartLine_data = {
  911. data1: ['08/10', '08/11', '08/12', '08/13', '08/14'],
  912. data2: [50, 75, 100, 150, 200],
  913. data3: [30, 75, 100, 150, 200]
  914. }
  915. this.row4.chart1.total = response.data.total
  916. this.roadChartLine6(this.row4.chart1.chartLine_data)
  917. } else {
  918. this.row4.chart1.list = []
  919. }
  920. setTimeout(() => {
  921. this.row4.chart1.listLoading = false
  922. }, 100)
  923. })
  924. },
  925. roadChartLine6(chartLine_data) {
  926. if (this.row4.chart1.chartLine != null) {
  927. this.row4.chart1.chartLine.dispose()
  928. }
  929. this.row4.chart1.chartLine = echarts.init(document.getElementById('row4chartLine1'))
  930. var option = {
  931. title: {
  932. text: '成本统计'
  933. },
  934. tooltip: {
  935. trigger: 'axis'
  936. },
  937. legend: {
  938. data: ['泌乳牛采食量', '泌乳牛产奶量']
  939. },
  940. grid: {
  941. left: '5%',
  942. right: '10%',
  943. bottom: '3%',
  944. containLabel: true
  945. },
  946. xAxis: [
  947. {
  948. type: 'category',
  949. data: chartLine_data.data1,
  950. name: '日期'
  951. }
  952. ],
  953. yAxis: [
  954. {
  955. type: 'value',
  956. name: '公斤奶\n饲料成本(元)',
  957. axisLabel: {
  958. formatter: '{value} '
  959. }
  960. }, {
  961. type: 'value',
  962. name: '单头牛\n饲料成本(元)',
  963. axisLabel: {
  964. formatter: '{value} '
  965. }
  966. }
  967. ],
  968. series: [{
  969. name: '泌乳牛采食量',
  970. type: 'bar',
  971. itemStyle: { /* 设置柱状颜色*/
  972. normal: {
  973. color: '#61a5e8'
  974. }
  975. },
  976. data: chartLine_data.data2
  977. }, {
  978. name: '泌乳牛产奶量',
  979. type: 'line',
  980. itemStyle: { /* 设置折线颜色*/
  981. normal: {
  982. color: '#ff2d2d'
  983. }
  984. },
  985. data: chartLine_data.data3
  986. }]
  987. }
  988. this.row4.chart1.chartLine.setOption(option)
  989. window.onresize = function() {
  990. this.row4.chart1.chartLine.resize()
  991. }
  992. },
  993. getChart7() {
  994. this.row4.chart2.listLoading = true
  995. GetDataByName(this.row4.chart2.getdataListParm).then(response => {
  996. console.log('出库统计数据', response.data.list)
  997. if (response.data.list !== null) {
  998. this.row4.chart2.chartLine_data = {
  999. data1: ['08/10', '08/11', '08/12', '08/13', '08/14'],
  1000. data2: [50, 75, 100, 150, 200],
  1001. data3: [30, 75, 100, 150, 200],
  1002. data4: [30, 75, 100, 150, 200]
  1003. }
  1004. this.row4.chart2.total = response.data.total
  1005. this.roadChartLine7(this.row4.chart2.chartLine_data)
  1006. } else {
  1007. this.row4.chart2.list = []
  1008. }
  1009. setTimeout(() => {
  1010. this.row4.chart2.listLoading = false
  1011. }, 100)
  1012. })
  1013. },
  1014. roadChartLine7(chartLine_data) {
  1015. if (this.row4.chart2.chartLine != null) {
  1016. this.row4.chart2.chartLine.dispose()
  1017. }
  1018. this.row4.chart2.chartLine = echarts.init(document.getElementById('row4chartLine2'))
  1019. var option = {
  1020. title: {
  1021. text: '出库统计'
  1022. },
  1023. tooltip: {
  1024. trigger: 'axis'
  1025. },
  1026. legend: {
  1027. data: ['系统用量', '人工用量', '金额']
  1028. },
  1029. grid: {
  1030. left: '5%',
  1031. right: '10%',
  1032. bottom: '3%',
  1033. containLabel: true
  1034. },
  1035. xAxis: [
  1036. {
  1037. type: 'category',
  1038. data: chartLine_data.data1,
  1039. name: '日期'
  1040. }
  1041. ],
  1042. yAxis: [
  1043. {
  1044. type: 'value',
  1045. name: '重量(kg)',
  1046. axisLabel: {
  1047. formatter: '{value} '
  1048. }
  1049. }, {
  1050. type: 'value',
  1051. name: '金额(元)',
  1052. axisLabel: {
  1053. formatter: '{value} '
  1054. }
  1055. }
  1056. ],
  1057. series: [{
  1058. name: '系统用量',
  1059. type: 'bar',
  1060. stack: '广告',
  1061. itemStyle: { /* 设置柱状颜色*/
  1062. normal: {
  1063. color: '#61a5e8'
  1064. }
  1065. },
  1066. data: chartLine_data.data2
  1067. }, {
  1068. name: '人工用量',
  1069. type: 'bar',
  1070. stack: '广告',
  1071. itemStyle: { /* 设置柱状颜色*/
  1072. normal: {
  1073. color: 'orange'
  1074. }
  1075. },
  1076. data: chartLine_data.data3
  1077. }, {
  1078. name: '金额',
  1079. type: 'line',
  1080. itemStyle: { /* 设置折线颜色*/
  1081. normal: {
  1082. color: '#ff2d2d'
  1083. }
  1084. },
  1085. data: chartLine_data.data4
  1086. }]
  1087. }
  1088. this.row4.chart2.chartLine.setOption(option)
  1089. window.onresize = function() {
  1090. this.row4.chart2.chartLine.resize()
  1091. }
  1092. },
  1093. getTable8() {
  1094. this.row4.table.listLoading = true
  1095. GetDataByName(this.row4.table.getdataListParm).then(response => {
  1096. console.log('库存预警table数据', response.data.list)
  1097. if (response.data.list !== null) {
  1098. this.row4.table.list = response.data.list
  1099. this.row4.table.total = response.data.total
  1100. } else {
  1101. this.row4.table.list = []
  1102. }
  1103. setTimeout(() => {
  1104. this.row4.table.listLoading = false
  1105. }, 100)
  1106. })
  1107. },
  1108. handleMore() {
  1109. this.$router.push({ path: '/inventoryManagement/Warning' })
  1110. }
  1111. }
  1112. }
  1113. </script>
  1114. <style lang="scss" scoped>
  1115. .dashboard-editor-container {
  1116. background-color: #F4F4F4;
  1117. min-height: 100vh;
  1118. .news{
  1119. width: 70%;
  1120. height: 30px;
  1121. background: #fff;
  1122. margin: 0 auto;
  1123. border-radius: 10px;
  1124. text-align: center;
  1125. line-height: 30px;
  1126. color: red;
  1127. b{color: #000;}
  1128. }
  1129. .bottom{
  1130. padding:0 30px;
  1131. h4{text-align: right;}
  1132. .grid-content{
  1133. background: #fff;height: 90px;
  1134. border-radius: 10px;
  1135. }
  1136. .one{
  1137. border: 1px solid #82CBB3;
  1138. .Left{
  1139. float: left;
  1140. width: 90px;
  1141. text-align: center;
  1142. i{font-size: 36px;color:#82CBB3;line-height: 90px;}
  1143. }
  1144. .Right{
  1145. float: left;
  1146. font:600 14px/32px '';
  1147. margin-top:15px;
  1148. span{
  1149. display: inline-block;
  1150. width: 150px;
  1151. text-align: right;
  1152. }
  1153. }
  1154. }
  1155. .two{
  1156. border: 1px solid #FF9900;
  1157. .Left{
  1158. float: left;
  1159. width: 90px;
  1160. text-align: center;
  1161. i{font-size: 36px;color:#FF9900;line-height: 90px;}
  1162. }
  1163. .Right{
  1164. float: left;
  1165. font:600 14px/32px '';
  1166. margin-top:15px;
  1167. span{
  1168. display: inline-block;
  1169. width: 150px;
  1170. text-align: right;
  1171. }
  1172. }
  1173. }
  1174. .three{
  1175. border: 1px solid #0099FF;
  1176. .Left{
  1177. float: left;
  1178. width: 90px;
  1179. text-align: center;
  1180. i{font-size: 36px;color:#0099FF;line-height: 90px;}
  1181. }
  1182. .Right{
  1183. float: left;
  1184. font:600 14px/32px '';
  1185. margin-top:15px;
  1186. span{
  1187. display: inline-block;
  1188. width: 150px;
  1189. text-align: right;
  1190. }
  1191. }
  1192. }
  1193. .four{
  1194. border: 1px solid #FF5C5C;
  1195. .Left{
  1196. float: left;
  1197. width: 90px;
  1198. text-align: center;
  1199. i{font-size: 36px;color:#FF5C5C;line-height: 90px;}
  1200. }
  1201. .Right{
  1202. float: left;
  1203. font:600 14px/32px '';
  1204. margin-top:15px;
  1205. span{
  1206. display: inline-block;
  1207. width: 150px;
  1208. text-align: right;
  1209. }
  1210. }
  1211. }
  1212. .car{
  1213. width:100%;height:150px;; display:flex; display: -webkit-flex; -webkit-flex-direction:row;
  1214. i{font-size: 50px;width:50px;display: block;line-height: 150px;}
  1215. .carList{
  1216. flex:1;height: 130px;
  1217. .list{
  1218. height: 130px;background: #409EFF;color: #fff; box-shadow: #000 0px 0px 10px;
  1219. border-radius: 10px;
  1220. .list-l{
  1221. p{
  1222. font: 12px/12px '';text-overflow: ellipsis;white-space:nowrap; overflow:hidden;
  1223. }
  1224. }
  1225. .list-r{
  1226. p{
  1227. font: 12px/12px '';text-overflow: ellipsis;white-space:nowrap; overflow:hidden;
  1228. }
  1229. }
  1230. }
  1231. }
  1232. }
  1233. }
  1234. }
  1235. </style>