d9f4d41d7c4e5294e52160ec1b6ae8336a51c4ed.svn-base 41 KB

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