c17a7e6b156831098555a00d73d291486345e383.svn-base 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. <template>
  2. <div class="app-container">
  3. <div class="search">
  4. <el-date-picker v-model="table.getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
  5. <el-select v-model="table.getdataListParm.parammaps.barid" placeholder="计划类型" class="filter-item" style="width: 120px;" clearable>
  6. <el-option v-for="item in planTypeList" :key="item.id" :label="item.name" :value="item.id" />
  7. </el-select>
  8. <el-input v-model="table.getdataListParm.parammaps.drivername" placeholder="TMR名称" style="width: 180px;" class="filter-item" clearable />
  9. <el-select v-model="table.getdataListParm.parammaps.barid" placeholder="工作状态" class="filter-item" style="width: 120px;" clearable>
  10. <el-option v-for="item in workingConditionList" :key="item.id" :label="item.name" :value="item.id" />
  11. </el-select>
  12. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  13. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  14. </div>
  15. <el-row :gutter="20">
  16. <el-col :span="8">
  17. <h4>TMR设备列表</h4>
  18. <div class="table">
  19. <el-table
  20. :key="table.tableKey"
  21. v-loading="table.listLoading"
  22. element-loading-text="给我一点时间"
  23. :data="table.list"
  24. border
  25. fit
  26. highlight-current-row
  27. style="width: 100%;"
  28. :row-style="rowStyle"
  29. :cell-style="cellStyle"
  30. class="elTable table-fixed"
  31. height="870px"
  32. >
  33. <el-table-column label="开始时间" min-width="110px" align="center">
  34. <template slot-scope="scope">
  35. <span>{{ scope.row.drivercode }}</span>
  36. </template>
  37. </el-table-column>
  38. <el-table-column label="计划类型" min-width="90px" align="center">
  39. <template slot-scope="scope">
  40. <span>{{ scope.row.drivercode }}</span>
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="描述" min-width="100px" align="center">
  44. <template slot-scope="scope">
  45. <span>{{ scope.row.drivercode }}</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="TMR名称" min-width="110px" align="center">
  49. <template slot-scope="scope">
  50. <span>{{ scope.row.drivercode }}</span>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. </div>
  55. </el-col>
  56. <el-col :span="16">
  57. <h4>过程详情</h4>
  58. <div class="detail">
  59. <div class="detail-t">
  60. 过程时间:<span>20min</span>;
  61. 工作状态:<span>运行中/已完成</span>
  62. </div>
  63. <div class="detail-b">
  64. 混料误差值:<span>1kg</span>;
  65. 混料误差率:<span>5%</span>;
  66. 撒料误差值:<span>0.86kg</span>;
  67. 撒料误差率:<span>6%</span>
  68. </div>
  69. </div>
  70. <div class="Mixture">
  71. <h4>混料详情</h4>
  72. <el-table
  73. :key="table2.tableKey"
  74. v-loading="table2.listLoading"
  75. element-loading-text="给我一点时间"
  76. :data="table2.list"
  77. border
  78. fit
  79. highlight-current-row
  80. style="width: 100%;"
  81. :row-style="rowStyle"
  82. :cell-style="cellStyle"
  83. class="elTable table-fixed"
  84. height="200px"
  85. >
  86. <el-table-column label="操作编号" min-width="110px" align="center">
  87. <template slot-scope="scope">
  88. <span>{{ scope.row.drivercode }}</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="饲料名称" min-width="90px" align="center">
  92. <template slot-scope="scope">
  93. <span>{{ scope.row.drivercode }}</span>
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="计划重量" min-width="110px" align="center">
  97. <template slot-scope="scope">
  98. <span>{{ scope.row.drivercode }}</span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="实际重量" min-width="110px" align="center">
  102. <template slot-scope="scope">
  103. <span>{{ scope.row.drivercode }}</span>
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="误差值" min-width="110px" align="center">
  107. <template slot-scope="scope">
  108. <span>{{ scope.row.drivercode }}</span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="误差率" min-width="90px" align="center">
  112. <template slot-scope="scope">
  113. <span>{{ scope.row.drivercode }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="完成时间" min-width="110px" align="center">
  117. <template slot-scope="scope">
  118. <span>{{ scope.row.drivercode }}</span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="过程时间" min-width="110px" align="center">
  122. <template slot-scope="scope">
  123. <span>{{ scope.row.drivercode }}</span>
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="跳转方式" min-width="110px" align="center">
  127. <template slot-scope="scope">
  128. <span>{{ scope.row.drivercode }}</span>
  129. </template>
  130. </el-table-column>
  131. <el-table-column label="开始重量" min-width="110px" align="center">
  132. <template slot-scope="scope">
  133. <span>{{ scope.row.drivercode }}</span>
  134. </template>
  135. </el-table-column>
  136. <el-table-column label="结束重量" min-width="110px" align="center">
  137. <template slot-scope="scope">
  138. <span>{{ scope.row.drivercode }}</span>
  139. </template>
  140. </el-table-column>
  141. </el-table>
  142. </div>
  143. <div class="SpreadingMaterials">
  144. <h4>撒料详情</h4>
  145. <el-table
  146. :key="table3.tableKey"
  147. v-loading="table3.listLoading"
  148. element-loading-text="给我一点时间"
  149. :data="table3.list"
  150. border
  151. fit
  152. highlight-current-row
  153. style="width: 100%;"
  154. :row-style="rowStyle"
  155. :cell-style="cellStyle"
  156. class="elTable table-fixed"
  157. height="200px"
  158. >
  159. <el-table-column label="操作编号" min-width="110px" align="center">
  160. <template slot-scope="scope">
  161. <span>{{ scope.row.drivercode }}</span>
  162. </template>
  163. </el-table-column>
  164. <el-table-column label="饲料名称" min-width="90px" align="center">
  165. <template slot-scope="scope">
  166. <span>{{ scope.row.drivercode }}</span>
  167. </template>
  168. </el-table-column>
  169. <el-table-column label="计划重量" min-width="110px" align="center">
  170. <template slot-scope="scope">
  171. <span>{{ scope.row.drivercode }}</span>
  172. </template>
  173. </el-table-column>
  174. <el-table-column label="实际重量" min-width="110px" align="center">
  175. <template slot-scope="scope">
  176. <span>{{ scope.row.drivercode }}</span>
  177. </template>
  178. </el-table-column>
  179. <el-table-column label="误差值" min-width="110px" align="center">
  180. <template slot-scope="scope">
  181. <span>{{ scope.row.drivercode }}</span>
  182. </template>
  183. </el-table-column>
  184. <el-table-column label="误差率" min-width="90px" align="center">
  185. <template slot-scope="scope">
  186. <span>{{ scope.row.drivercode }}</span>
  187. </template>
  188. </el-table-column>
  189. <el-table-column label="完成时间" min-width="110px" align="center">
  190. <template slot-scope="scope">
  191. <span>{{ scope.row.drivercode }}</span>
  192. </template>
  193. </el-table-column>
  194. <el-table-column label="过程时间" min-width="110px" align="center">
  195. <template slot-scope="scope">
  196. <span>{{ scope.row.drivercode }}</span>
  197. </template>
  198. </el-table-column>
  199. <el-table-column label="跳转方式" min-width="110px" align="center">
  200. <template slot-scope="scope">
  201. <span>{{ scope.row.drivercode }}</span>
  202. </template>
  203. </el-table-column>
  204. <el-table-column label="开始重量" min-width="110px" align="center">
  205. <template slot-scope="scope">
  206. <span>{{ scope.row.drivercode }}</span>
  207. </template>
  208. </el-table-column>
  209. <el-table-column label="结束重量" min-width="110px" align="center">
  210. <template slot-scope="scope">
  211. <span>{{ scope.row.drivercode }}</span>
  212. </template>
  213. </el-table-column>
  214. </el-table>
  215. </div>
  216. <div class="ControlChart">
  217. <h4>监控图</h4>
  218. <div style="font-size:14px;color:#666;margin:0 auto;position: relative;">
  219. <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>
  220. <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>
  221. </div>
  222. <div id="chartLine" style="width: 100%;height:200px;" /></div>
  223. </el-col>
  224. </el-row>
  225. </div>
  226. </template>
  227. <script>
  228. import echarts from 'echarts'
  229. require('echarts/theme/macarons')
  230. import { GetDataByName } from '@/api/common'
  231. import Cookies from 'js-cookie'
  232. import { parseTime } from '@/utils/index.js'
  233. export default {
  234. name: 'ProcessAnalysis',
  235. data() {
  236. return {
  237. requestParams: [
  238. { name: 'getBarListEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }},
  239. { name: 'getCowclassListEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }}
  240. ],
  241. planTypeList: [{ id: '0', name: '预混计划' }, { id: '1', name: '撒料计划' }, { id: '2', name: '剩料计划' }], // 计划类型
  242. workingConditionList: [{ id: '0', name: '运行中' }, { id: '1', name: '已完成' }], // 工作状态
  243. table: {
  244. getdataListParm: {
  245. name: 'getBarmilkList',
  246. page: 1,
  247. offset: 1,
  248. pagecount: 10,
  249. returntype: 'Map',
  250. parammaps: {
  251. pastureid: Cookies.get('pastureid'),
  252. barid: '',
  253. cowclass: '',
  254. startTime: '',
  255. stopTime: '',
  256. inputDatetime: ''
  257. }
  258. },
  259. tableKey: 0,
  260. list: [],
  261. total: 0,
  262. listLoading: true
  263. },
  264. // 混料详情
  265. table2: {
  266. getdataListParm: {
  267. name: 'getBarmilkList',
  268. page: 1,
  269. offset: 1,
  270. pagecount: 10,
  271. returntype: 'Map',
  272. parammaps: {
  273. pastureid: Cookies.get('pastureid'),
  274. barid: '',
  275. cowclass: '',
  276. startTime: '',
  277. stopTime: '',
  278. inputDatetime: ''
  279. }
  280. },
  281. tableKey: 0,
  282. list: [],
  283. total: 0,
  284. listLoading: true
  285. },
  286. // 撒料详情
  287. table3: {
  288. getdataListParm: {
  289. name: 'getBarmilkList',
  290. page: 1,
  291. offset: 1,
  292. pagecount: 10,
  293. returntype: 'Map',
  294. parammaps: {
  295. pastureid: Cookies.get('pastureid'),
  296. barid: '',
  297. cowclass: '',
  298. startTime: '',
  299. stopTime: '',
  300. inputDatetime: ''
  301. }
  302. },
  303. tableKey: 0,
  304. list: [],
  305. total: 0,
  306. listLoading: true
  307. },
  308. chartLine: null,
  309. chartLine_data1: {
  310. data1: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
  311. data2: [220, 250, 201, 234, 290, 430, 410],
  312. data3: [120, 130, 101, 134, 90, 430, 210]
  313. },
  314. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  315. cellStyle: { padding: 0 + 'px' }
  316. }
  317. },
  318. created() {
  319. this.getList()
  320. },
  321. mounted() {
  322. this.roadChartLine1(this.chartLine_data1)
  323. },
  324. methods: {
  325. getList() {
  326. this.table.listLoading = true
  327. GetDataByName(this.table.getdataListParm).then(response => {
  328. console.log('table数据', response.data.list)
  329. if (response.data.list !== null) {
  330. this.table.list = response.data.list
  331. this.getList2()
  332. this.getList3()
  333. } else {
  334. this.table.list = []
  335. }
  336. setTimeout(() => {
  337. this.table.listLoading = false
  338. }, 100)
  339. })
  340. },
  341. handleSearch() {
  342. console.log('点击了查询')
  343. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  344. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  345. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  346. } else {
  347. this.table.getdataListParm.parammaps.inputDatetime = ''
  348. this.table.getdataListParm.parammaps.startTime = ''
  349. this.table.getdataListParm.parammaps.stopTime = ''
  350. }
  351. this.table.getdataListParm.offset = 1
  352. this.getList()
  353. },
  354. handleRefresh() {
  355. console.log('点击了重置')
  356. this.table.getdataListParm.parammaps.barid = ''
  357. this.table.getdataListParm.parammaps.cowclass = ''
  358. this.table.getdataListParm.parammaps.startTime = ''
  359. this.table.getdataListParm.parammaps.stopTime = ''
  360. this.table.getdataListParm.parammaps.inputDatetime = ''
  361. this.table.getdataListParm.offset = 1
  362. this.getList()
  363. },
  364. getList2() {
  365. this.table2.listLoading = true
  366. GetDataByName(this.table2.getdataListParm).then(response => {
  367. console.log('table数据', response.data.list)
  368. if (response.data.list !== null) {
  369. this.table2.list = response.data.list
  370. } else {
  371. this.table2.list = []
  372. }
  373. setTimeout(() => {
  374. this.table2.listLoading = false
  375. }, 100)
  376. })
  377. },
  378. getList3() {
  379. this.table3.listLoading = true
  380. GetDataByName(this.table3.getdataListParm).then(response => {
  381. console.log('table数据', response.data.list)
  382. if (response.data.list !== null) {
  383. this.table3.list = response.data.list
  384. } else {
  385. this.table3.list = []
  386. }
  387. setTimeout(() => {
  388. this.table3.listLoading = false
  389. }, 100)
  390. })
  391. },
  392. roadChartLine1(chartLine_data1) {
  393. if (this.chartLine != null) {
  394. this.chartLine.dispose()
  395. }
  396. this.chartLine = echarts.init(document.getElementById('chartLine'))
  397. var option = {
  398. title: {
  399. text: '',
  400. subtext: ''
  401. },
  402. color: ['#c23531', '#2f4554'], // 关键加上这句话,legend的颜色和折线的自定义颜色就一致了
  403. legend: {
  404. icon: 'rectangle',
  405. data: ['设计重量', '实际重量'],
  406. // right: '20%',
  407. textStyle: {
  408. fontSize: 12,
  409. color: '#666'
  410. }
  411. },
  412. /* grid:{y:15},*/
  413. tooltip: {
  414. trigger: 'axis'
  415. },
  416. calculable: true,
  417. yAxis: [
  418. {
  419. type: 'value',
  420. splitLine: { show: false }, // 去除网格线
  421. axisLabel: {
  422. show: true,
  423. textStyle: {
  424. color: '#666' // 这里用参数代替了
  425. }
  426. }
  427. }
  428. ],
  429. xAxis: [
  430. {
  431. type: 'category',
  432. splitLine: { show: false }, // 去除网格线
  433. data: chartLine_data1.data1,
  434. axisLabel: {
  435. show: true,
  436. textStyle: {
  437. color: '#666' // 这里用参数代替了
  438. }
  439. }
  440. }
  441. ],
  442. series: [
  443. {
  444. name: '设计重量',
  445. type: 'line',
  446. barWidth: '37',
  447. data: chartLine_data1.data2,
  448. symbol: 'triangle', symbolSize: 10,
  449. itemStyle: {
  450. normal: {
  451. lineStyle: { color: '#c23531' },
  452. color: function(param) {
  453. const colorList = ['#2f4554', '#c23531']
  454. let x = ''
  455. param.dataIndex % 2 == 0 ? x = 1 : x = 2
  456. if (x == '1') {
  457. return colorList[0]
  458. } else {
  459. return colorList[1]
  460. }
  461. }
  462. }
  463. }
  464. },
  465. {
  466. name: '实际重量',
  467. type: 'line',
  468. step: 'end',
  469. data: chartLine_data1.data3,
  470. barWidth: '37',
  471. itemStyle: {
  472. normal: {
  473. lineStyle: { color: '#2f4554' }
  474. }
  475. }
  476. }
  477. ]
  478. }
  479. this.chartLine.setOption(option)
  480. window.onresize = function() {
  481. this.chartLine.resize()
  482. }
  483. }
  484. }
  485. }
  486. </script>
  487. <style lang="scss" scoped>
  488. .search{padding-top:10px;clear: both;}
  489. .table{margin-top:10px;}
  490. .detail{
  491. height:84px;border: 1px solid #EBEEF5;padding-left:10px;font:16px/32px '';color:#333;
  492. .detail-t{margin-top: 10px;}
  493. .detail-b{margin-bottom: 10px;}
  494. }
  495. </style>