44a594cc3e17c916a2987f626e29fdb2ba3420a6.svn-base 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. <template>
  2. <div class="app-container">
  3. <div class="search">
  4. <el-date-picker v-model="table.getdataListParm.parammaps.inputDatetime" :clearable="false" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
  5. <el-select v-model="table.getdataListParm.parammaps.pid" 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.tmrtname" placeholder="TMR名称" style="width: 180px;" class="filter-item" clearable />
  9. <el-select v-model="table.getdataListParm.parammaps.iscompleted" 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="970px"
  32. @row-click="rowClick"
  33. >
  34. <el-table-column label="开始时间" min-width="100px" align="center">
  35. <template slot-scope="scope">
  36. <span>{{ scope.row.intime }}</span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column label="计划类型" min-width="90px" align="center">
  40. <template slot-scope="scope">
  41. <span>{{ scope.row.lpplantype }}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="描述" min-width="90px" align="center">
  45. <template slot-scope="scope">
  46. <span>{{ scope.row.remark }}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="TMR名称" min-width="110px" align="center">
  50. <template slot-scope="scope">
  51. <span>{{ scope.row.tmrtname }}</span>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. </div>
  56. </el-col>
  57. <el-col :span="16">
  58. <h4>过程详情</h4>
  59. <div class="detail">
  60. <div class="detail-t">
  61. 过程时间:<span v-if="table2.list.length !== 0">{{ table2.list[0].proesstime }}</span>;
  62. 工作状态:<span v-if="table2.list.length !== 0">{{ table2.list[0].iscompleted }}</span>
  63. </div>
  64. <div class="detail-b">
  65. 混料误差值:<span v-if="table2.list.length !== 0">{{ table2.list[0].Hdif }}kg</span>;
  66. 混料准确率:<span v-if="table2.list.length !== 0">{{ table2.list[0].HdifRate }}</span>;
  67. 撒料误差值:<span v-if="table2.list.length !== 0">{{ table2.list[0].Sdif }}kg</span>;
  68. 撒料准确率:<span v-if="table2.list.length !== 0">{{ table2.list[0].SdifRate }}</span>
  69. </div>
  70. </div>
  71. <div class="Mixture">
  72. <h4>混料详情</h4>
  73. <el-table
  74. :key="table3.tableKey"
  75. v-loading="table3.listLoading"
  76. element-loading-text="给我一点时间"
  77. :data="table3.list"
  78. border
  79. fit
  80. highlight-current-row
  81. style="width: 100%;"
  82. :row-style="rowStyle"
  83. :cell-style="cellStyle"
  84. class="elTable table-fixed"
  85. height="200px"
  86. >
  87. <el-table-column label="操作编号" min-width="110px" align="center">
  88. <template slot-scope="scope">
  89. <span>{{ scope.row.sort }}</span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="饲料名称" min-width="90px" align="center">
  93. <template slot-scope="scope">
  94. <span>{{ scope.row.fname }}</span>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="计划重量" min-width="110px" align="center">
  98. <template slot-scope="scope">
  99. <span>{{ scope.row.lweight }}</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="实际重量" min-width="110px" align="center">
  103. <template slot-scope="scope">
  104. <span>{{ scope.row.actualweightminus }}</span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="误差值" min-width="110px" align="center">
  108. <template slot-scope="scope">
  109. <span>{{ scope.row.diff }}</span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="准确率" min-width="90px" align="center">
  113. <template slot-scope="scope">
  114. <span>{{ scope.row.diffRate }}</span>
  115. </template>
  116. </el-table-column>
  117. <el-table-column label="完成时间" min-width="110px" align="center">
  118. <template slot-scope="scope">
  119. <span>{{ scope.row.intime }}</span>
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="过程时间" min-width="110px" align="center">
  123. <template slot-scope="scope">
  124. <span>{{ scope.row.proesstime }}</span>
  125. </template>
  126. </el-table-column>
  127. <el-table-column label="跳转方式" min-width="110px" align="center">
  128. <template slot-scope="scope">
  129. <span>{{ scope.row.buttontype }}</span>
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="开始重量" min-width="110px" align="center">
  133. <template slot-scope="scope">
  134. <span>{{ scope.row.lastactualweight }}</span>
  135. </template>
  136. </el-table-column>
  137. <el-table-column label="结束重量" min-width="110px" align="center">
  138. <template slot-scope="scope">
  139. <span>{{ scope.row.actualweight }}</span>
  140. </template>
  141. </el-table-column>
  142. </el-table>
  143. </div>
  144. <div class="SpreadingMaterials">
  145. <h4>撒料详情</h4>
  146. <el-table
  147. :key="table4.tableKey"
  148. v-loading="table4.listLoading"
  149. element-loading-text="给我一点时间"
  150. :data="table4.list"
  151. border
  152. fit
  153. highlight-current-row
  154. style="width: 100%;"
  155. :row-style="rowStyle"
  156. :cell-style="cellStyle"
  157. class="elTable table-fixed"
  158. height="200px"
  159. >
  160. <el-table-column label="操作编号" min-width="110px" align="center">
  161. <template slot-scope="scope">
  162. <span>{{ scope.row.sort }}</span>
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="栏舍名称" min-width="90px" align="center">
  166. <template slot-scope="scope">
  167. <span>{{ scope.row.fname }}</span>
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="计划重量" min-width="110px" align="center">
  171. <template slot-scope="scope">
  172. <span>{{ scope.row.lweight }}</span>
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="实际重量" min-width="110px" align="center">
  176. <template slot-scope="scope">
  177. <span>{{ scope.row.actualweightminus }}</span>
  178. </template>
  179. </el-table-column>
  180. <el-table-column label="误差值" min-width="110px" align="center">
  181. <template slot-scope="scope">
  182. <span>{{ scope.row.diff }}</span>
  183. </template>
  184. </el-table-column>
  185. <el-table-column label="准确率" min-width="90px" align="center">
  186. <template slot-scope="scope">
  187. <span>{{ scope.row.diffRate }}</span>
  188. </template>
  189. </el-table-column>
  190. <el-table-column label="完成时间" min-width="110px" align="center">
  191. <template slot-scope="scope">
  192. <span>{{ scope.row.intime }}</span>
  193. </template>
  194. </el-table-column>
  195. <el-table-column label="过程时间" min-width="110px" align="center">
  196. <template slot-scope="scope">
  197. <span>{{ scope.row.proesstime }}</span>
  198. </template>
  199. </el-table-column>
  200. <el-table-column label="跳转方式" min-width="110px" align="center">
  201. <template slot-scope="scope">
  202. <span>{{ scope.row.buttontype }}</span>
  203. </template>
  204. </el-table-column>
  205. <el-table-column label="开始重量" min-width="110px" align="center">
  206. <template slot-scope="scope">
  207. <span>{{ scope.row.lastactualweight }}</span>
  208. </template>
  209. </el-table-column>
  210. <el-table-column label="结束重量" min-width="110px" align="center">
  211. <template slot-scope="scope">
  212. <span>{{ scope.row.actualweight }}</span>
  213. </template>
  214. </el-table-column>
  215. </el-table>
  216. </div>
  217. <div class="ControlChart">
  218. <h4>监控图</h4>
  219. <div id="chartLine" style="width: 100%;height:300px;" /></div>
  220. </el-col>
  221. </el-row>
  222. </div>
  223. </template>
  224. <script>
  225. import echarts from 'echarts'
  226. require('echarts/theme/macarons')
  227. import { GetDataByName, GetReportform } from '@/api/common'
  228. import Cookies from 'js-cookie'
  229. import { parseTime } from '@/utils/index.js'
  230. export default {
  231. name: 'ProcessAnalysis',
  232. data() {
  233. return {
  234. requestParams: [
  235. { name: 'getBarListEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }},
  236. { name: 'getCowclassListEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }}
  237. ],
  238. planTypeList: [{ id: '3', name: '预混计划' }, { id: '2', name: '撒料计划' }, { id: '4', name: '剩料计划' }], // 计划类型
  239. workingConditionList: [{ id: '0', name: '运行中' }, { id: '1', name: '已完成' }], // 工作状态
  240. // TMR设备列表
  241. table: {
  242. getdataListParm: {
  243. name: 'getprocessAnalysis',
  244. page: 1,
  245. offset: 1,
  246. pagecount: '',
  247. returntype: 'Map',
  248. parammaps: {
  249. pastureid: Cookies.get('pastureid'),
  250. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  251. stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
  252. // startTime: '2020-09-15',
  253. // stopTime: '2020-09-16',
  254. inputDatetime: [new Date(), new Date()],
  255. iscompleted: '',
  256. tmrtname: ''
  257. }
  258. },
  259. tableKey: 0,
  260. list: [],
  261. total: 0,
  262. listLoading: true
  263. },
  264. // 过程详情
  265. table2: {
  266. getdataListParm: {
  267. name: 'getprocessAnalysisStr',
  268. page: 1,
  269. offset: 1,
  270. pagecount: 1,
  271. returntype: 'Map',
  272. parammaps: {
  273. pastureid: Cookies.get('pastureid'),
  274. id: ''
  275. }
  276. },
  277. tableKey: 0,
  278. list: [],
  279. total: 0,
  280. listLoading: true
  281. },
  282. // 混料详情
  283. table3: {
  284. getdataListParm: {
  285. name: 'getprocessAnalysisHL',
  286. page: 1,
  287. offset: 1,
  288. pagecount: '',
  289. returntype: 'Map',
  290. parammaps: {
  291. pastureid: Cookies.get('pastureid'),
  292. pid: ''
  293. }
  294. },
  295. tableKey: 0,
  296. list: [],
  297. total: 0,
  298. listLoading: true
  299. },
  300. // 撒料详情
  301. table4: {
  302. getdataListParm: {
  303. name: 'getprocessAnalysisSL',
  304. page: 1,
  305. offset: 1,
  306. pagecount: '',
  307. returntype: 'Map',
  308. parammaps: {
  309. pastureid: Cookies.get('pastureid'),
  310. pid: ''
  311. }
  312. },
  313. tableKey: 0,
  314. list: [],
  315. total: 0,
  316. listLoading: true
  317. },
  318. chart1: {
  319. getdataListParm: {
  320. name: 'getprocessAnalysisTB',
  321. page: 1,
  322. offset: 1,
  323. pagecount: '',
  324. returntype: 'Map',
  325. parammaps: {
  326. pastureid: Cookies.get('pastureid'),
  327. pid: ''
  328. }
  329. },
  330. tableKey: 0,
  331. list: [],
  332. total: 0,
  333. listLoading: false,
  334. chartLine_data: []
  335. },
  336. chartLine: null,
  337. chartLine_data: {},
  338. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  339. cellStyle: { padding: 0 + 'px' }
  340. }
  341. },
  342. created() {
  343. this.getList()
  344. },
  345. mounted() {
  346. // this.roadChartLine1(this.chartLine_data1)
  347. },
  348. methods: {
  349. // TMR设备列表
  350. getList() {
  351. this.table.listLoading = true
  352. GetDataByName(this.table.getdataListParm).then(response => {
  353. console.log('TMR设备列表table数据', response.data.list)
  354. if (response.data.list !== null) {
  355. this.table.list = response.data.list
  356. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  357. this.table3.getdataListParm.parammaps.pid = response.data.list[0].pid
  358. this.table4.getdataListParm.parammaps.pid = response.data.list[0].pid
  359. this.chart1.getdataListParm.parammaps.pid = response.data.list[0].pid
  360. this.getList2()
  361. this.getList3()
  362. this.getList4()
  363. this.getChart1()
  364. } else {
  365. this.table.list = []
  366. this.table2.list = []
  367. this.table3.list = []
  368. this.table2.listLoading = false
  369. this.table3.listLoading = false
  370. this.table4.listLoading = false
  371. this.chart1.listLoading = false
  372. }
  373. setTimeout(() => {
  374. this.table.listLoading = false
  375. }, 100)
  376. })
  377. },
  378. handleSearch() {
  379. console.log('点击了查询')
  380. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  381. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  382. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  383. } else {
  384. this.table.getdataListParm.parammaps.inputDatetime = ''
  385. this.table.getdataListParm.parammaps.startTime = ''
  386. this.table.getdataListParm.parammaps.stopTime = ''
  387. }
  388. this.table.getdataListParm.offset = 1
  389. this.getList()
  390. },
  391. handleRefresh() {
  392. console.log('点击了重置')
  393. this.table.getdataListParm.parammaps.barid = ''
  394. this.table.getdataListParm.parammaps.cowclass = ''
  395. this.table.getdataListParm.parammaps.startTime = ''
  396. this.table.getdataListParm.parammaps.stopTime = ''
  397. this.table.getdataListParm.parammaps.inputDatetime = ''
  398. this.table.getdataListParm.offset = 1
  399. this.getList()
  400. },
  401. rowClick(row, column, event) {
  402. this.table2.getdataListParm.parammaps.id = row.id
  403. this.table3.getdataListParm.parammaps.pid = row.pid
  404. this.table4.getdataListParm.parammaps.pid = row.pid
  405. this.chart1.getdataListParm.parammaps.pid = row.pid
  406. this.getList2()
  407. this.getList3()
  408. this.getList4()
  409. this.getChart1()
  410. },
  411. // 过程详情
  412. getList2() {
  413. this.table2.listLoading = true
  414. GetDataByName(this.table2.getdataListParm).then(response => {
  415. console.log('过程详情table数据', response.data.list)
  416. if (response.data.list !== null) {
  417. this.table2.list = response.data.list
  418. } else {
  419. this.table2.list = []
  420. }
  421. setTimeout(() => {
  422. this.table2.listLoading = false
  423. }, 100)
  424. })
  425. },
  426. // 混料详情
  427. getList3() {
  428. this.table3.listLoading = true
  429. GetDataByName(this.table3.getdataListParm).then(response => {
  430. console.log('混料详情table数据', response.data.list)
  431. if (response.data.list !== null) {
  432. this.table3.list = response.data.list
  433. } else {
  434. this.table3.list = []
  435. }
  436. setTimeout(() => {
  437. this.table3.listLoading = false
  438. }, 100)
  439. })
  440. },
  441. // 撒料详情
  442. getList4() {
  443. this.table4.listLoading = true
  444. GetDataByName(this.table4.getdataListParm).then(response => {
  445. console.log('撒料详情table数据', response.data.list)
  446. if (response.data.list !== null) {
  447. this.table4.list = response.data.list
  448. } else {
  449. this.table4.list = []
  450. }
  451. setTimeout(() => {
  452. this.table4.listLoading = false
  453. }, 100)
  454. })
  455. },
  456. getChart1() {
  457. this.chart1.listLoading = true
  458. GetReportform(this.chart1.getdataListParm).then(response => {
  459. if (response.data.list !== null) {
  460. this.chart1.list = response.data.data
  461. // console.log('实时监控', response.data.list)
  462. // console.log('实时监控', response.data.list.data4)
  463. var evenNumbers = []// 偶数
  464. var oddNumbers = []// 奇数
  465. for (let i = 0; i < response.data.list.data4.length; i++) {
  466. console.log(response.data.list.data4[i])
  467. if (i == 0) {
  468. oddNumbers.push(response.data.list.data4[i])
  469. } else {
  470. if (i % 2 == 0) {
  471. evenNumbers.push(response.data.list.data4[i])
  472. } else {
  473. oddNumbers.push(response.data.list.data4[i])
  474. }
  475. }
  476. }
  477. response.data.list.data4 = oddNumbers
  478. response.data.list.data5 = evenNumbers
  479. this.chart1.chartLine_data = response.data.list
  480. this.chart1.total = response.data.total
  481. this.roadChartLine1(this.chart1.chartLine_data)
  482. } else {
  483. this.chart1.list = []
  484. }
  485. setTimeout(() => {
  486. this.chart1.listLoading = false
  487. }, 100)
  488. })
  489. },
  490. roadChartLine1(chartLine_data) {
  491. if (this.chartLine != null) {
  492. this.chartLine.dispose()
  493. }
  494. this.chartLine = echarts.init(document.getElementById('chartLine'))
  495. var option = {
  496. title: {
  497. text: '',
  498. subtext: ''
  499. },
  500. color: ['#ff3131', '#61a5e8', '#ff3131', '#61a5e8'], // 关键加上这句话,legend的颜色和折线的自定义颜色就一致了
  501. legend: {
  502. data: [
  503. { name: '设计重量', icon: 'rectangle' },
  504. { name: '实际重量', icon: 'rectangle' },
  505. { name: '开始重量', icon: 'triangle' },
  506. { name: '结束重量', icon: 'triangle' }
  507. ],
  508. right: '20%',
  509. textStyle: {
  510. fontSize: 12,
  511. color: '#666'
  512. }
  513. },
  514. /* grid:{y:15},*/
  515. tooltip: {
  516. trigger: 'axis'
  517. },
  518. calculable: true,
  519. yAxis: [
  520. {
  521. type: 'value',
  522. name: '重量(kg)',
  523. splitLine: { show: false }, // 去除网格线
  524. axisLabel: {
  525. show: true,
  526. textStyle: {
  527. color: '#666' // 这里用参数代替了
  528. }
  529. }
  530. }
  531. ],
  532. xAxis: [
  533. {
  534. type: 'category',
  535. splitLine: { show: false }, // 去除网格线
  536. name: '时间',
  537. data: chartLine_data.data1,
  538. axisLabel: {
  539. show: true,
  540. textStyle: {
  541. color: '#666' // 这里用参数代替了
  542. }
  543. }
  544. }
  545. ],
  546. series: [{
  547. symbol: 'none',
  548. name: '实际重量',
  549. type: 'line',
  550. // step: 'end',
  551. data: chartLine_data.data3,
  552. smooth: true,
  553. barWidth: '37',
  554. itemStyle: {
  555. normal: {
  556. lineStyle: { color: '#ff3131' }
  557. }
  558. }
  559. }, {
  560. symbol: 'none',
  561. name: '设计重量',
  562. type: 'line',
  563. barWidth: '37',
  564. data: chartLine_data.data2,
  565. itemStyle: {
  566. normal: {
  567. lineStyle: { color: '#61a5e8' }
  568. }
  569. }
  570. }, {
  571. name: '开始重量',
  572. symbol: 'triangle',
  573. symbolSize: 10,
  574. type: 'scatter',
  575. data: chartLine_data.data4
  576. }, {
  577. name: '结束重量',
  578. symbol: 'triangle',
  579. symbolSize: 10,
  580. type: 'scatter',
  581. data: chartLine_data.data5
  582. }]
  583. }
  584. this.chartLine.setOption(option)
  585. window.onresize = function() {
  586. this.chartLine.resize()
  587. }
  588. }
  589. }
  590. }
  591. </script>
  592. <style lang="scss" scoped>
  593. .search{padding-top:10px;clear: both;}
  594. .table{margin-top:10px;}
  595. .detail{
  596. height:84px;border: 1px solid #EBEEF5;padding-left:10px;font:16px/32px '';color:#333;
  597. .detail-t{margin-top: 10px;}
  598. .detail-b{margin-bottom: 10px;}
  599. }
  600. </style>