cd0148b7c4cae66723a778a4c9f44a6310dea679.svn-base 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  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. id: ''
  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. id: ''
  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. id: ''
  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. methods: {
  346. // TMR设备列表
  347. getList() {
  348. this.table.listLoading = true
  349. GetDataByName(this.table.getdataListParm).then(response => {
  350. console.log('TMR设备列表table数据', response.data.list)
  351. if (response.data.list !== null) {
  352. this.table.list = response.data.list
  353. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  354. this.table3.getdataListParm.parammaps.pid = response.data.list[0].id
  355. this.table4.getdataListParm.parammaps.pid = response.data.list[0].id
  356. this.chart1.getdataListParm.parammaps.pid = response.data.list[0].id
  357. this.getList2()
  358. this.getList3()
  359. this.getList4()
  360. this.getChart1()
  361. } else {
  362. this.table.list = []
  363. this.table2.list = []
  364. this.table3.list = []
  365. this.table2.listLoading = false
  366. this.table3.listLoading = false
  367. this.table4.listLoading = false
  368. this.chart1.listLoading = false
  369. }
  370. setTimeout(() => {
  371. this.table.listLoading = false
  372. }, 100)
  373. })
  374. },
  375. handleSearch() {
  376. console.log('点击了查询')
  377. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  378. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  379. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  380. } else {
  381. this.table.getdataListParm.parammaps.inputDatetime = ''
  382. this.table.getdataListParm.parammaps.startTime = ''
  383. this.table.getdataListParm.parammaps.stopTime = ''
  384. }
  385. this.table.getdataListParm.offset = 1
  386. this.getList()
  387. },
  388. handleRefresh() {
  389. console.log('点击了重置')
  390. this.table.getdataListParm.parammaps.tmrtname = ''
  391. this.table.getdataListParm.parammaps.iscompleted = ''
  392. this.table.getdataListParm.parammaps.pid = ''
  393. this.table.getdataListParm.parammaps.startTime = ''
  394. this.table.getdataListParm.parammaps.stopTime = ''
  395. this.table.getdataListParm.parammaps.inputDatetime = ''
  396. this.table.getdataListParm.offset = 1
  397. this.getList()
  398. },
  399. rowClick(row, column, event) {
  400. this.table2.getdataListParm.parammaps.id = row.id
  401. this.table3.getdataListParm.parammaps.pid = row.id
  402. this.table4.getdataListParm.parammaps.pid = row.id
  403. this.chart1.getdataListParm.parammaps.pid = row.id
  404. this.getList2()
  405. this.getList3()
  406. this.getList4()
  407. this.getChart1()
  408. },
  409. // 过程详情
  410. getList2() {
  411. this.table2.listLoading = true
  412. GetDataByName(this.table2.getdataListParm).then(response => {
  413. console.log('过程详情table数据', response.data.list)
  414. if (response.data.list !== null) {
  415. this.table2.list = response.data.list
  416. } else {
  417. this.table2.list = []
  418. }
  419. setTimeout(() => {
  420. this.table2.listLoading = false
  421. }, 100)
  422. })
  423. },
  424. // 混料详情
  425. getList3() {
  426. this.table3.listLoading = true
  427. GetDataByName(this.table3.getdataListParm).then(response => {
  428. console.log('混料详情table数据', response.data.list)
  429. if (response.data.list !== null) {
  430. this.table3.list = response.data.list
  431. } else {
  432. this.table3.list = []
  433. }
  434. setTimeout(() => {
  435. this.table3.listLoading = false
  436. }, 100)
  437. })
  438. },
  439. // 撒料详情
  440. getList4() {
  441. this.table4.listLoading = true
  442. GetDataByName(this.table4.getdataListParm).then(response => {
  443. console.log('撒料详情table数据', response.data.list)
  444. if (response.data.list !== null) {
  445. this.table4.list = response.data.list
  446. } else {
  447. this.table4.list = []
  448. }
  449. setTimeout(() => {
  450. this.table4.listLoading = false
  451. }, 100)
  452. })
  453. },
  454. getChart1() {
  455. this.chart1.listLoading = true
  456. GetReportform(this.chart1.getdataListParm).then(response => {
  457. if (response.data.list !== null) {
  458. this.chart1.list = response.data.data
  459. // console.log('实时监控', response.data.list)
  460. // console.log('实时监控', response.data.list.data4)
  461. var evenNumbers = []// 偶数
  462. var oddNumbers = []// 奇数
  463. for (let i = 0; i < response.data.list.data4.length; i++) {
  464. console.log(response.data.list.data4[i])
  465. if (i == 0) {
  466. oddNumbers.push(response.data.list.data4[i])
  467. } else {
  468. if (i % 2 == 0) {
  469. evenNumbers.push(response.data.list.data4[i])
  470. } else {
  471. oddNumbers.push(response.data.list.data4[i])
  472. }
  473. }
  474. }
  475. response.data.list.data4 = oddNumbers
  476. response.data.list.data5 = evenNumbers
  477. this.chart1.chartLine_data = response.data.list
  478. this.chart1.total = response.data.total
  479. this.roadChartLine1(this.chart1.chartLine_data)
  480. } else {
  481. this.chart1.list = []
  482. }
  483. setTimeout(() => {
  484. this.chart1.listLoading = false
  485. }, 100)
  486. })
  487. },
  488. roadChartLine1(chartLine_data) {
  489. if (this.chartLine != null) {
  490. this.chartLine.dispose()
  491. }
  492. this.chartLine = echarts.init(document.getElementById('chartLine'))
  493. var option = {
  494. title: {
  495. text: '',
  496. subtext: ''
  497. },
  498. color: ['#ff3131', '#61a5e8', '#ff3131', '#61a5e8'], // 关键加上这句话,legend的颜色和折线的自定义颜色就一致了
  499. legend: {
  500. data: [
  501. { name: '设计重量', icon: 'rectangle' },
  502. { name: '实际重量', icon: 'rectangle' },
  503. { name: '开始重量', icon: 'triangle' },
  504. { name: '结束重量', icon: 'triangle' }
  505. ],
  506. right: '20%',
  507. textStyle: {
  508. fontSize: 12,
  509. color: '#666'
  510. }
  511. },
  512. /* grid:{y:15},*/
  513. tooltip: {
  514. trigger: 'axis'
  515. },
  516. calculable: true,
  517. yAxis: [
  518. {
  519. type: 'value',
  520. name: '重量(kg)',
  521. splitLine: { show: false }, // 去除网格线
  522. axisLabel: {
  523. show: true,
  524. textStyle: {
  525. color: '#666' // 这里用参数代替了
  526. }
  527. }
  528. }
  529. ],
  530. xAxis: [
  531. {
  532. type: 'category',
  533. splitLine: { show: false }, // 去除网格线
  534. name: '时间',
  535. data: chartLine_data.data1,
  536. axisLabel: {
  537. show: true,
  538. textStyle: {
  539. color: '#666' // 这里用参数代替了
  540. }
  541. }
  542. }
  543. ],
  544. series: [{
  545. symbol: 'none',
  546. name: '实际重量',
  547. type: 'line',
  548. // step: 'end',
  549. data: chartLine_data.data3,
  550. smooth: true,
  551. barWidth: '37',
  552. itemStyle: {
  553. normal: {
  554. lineStyle: { color: '#ff3131' }
  555. }
  556. }
  557. }, {
  558. symbol: 'none',
  559. name: '设计重量',
  560. type: 'line',
  561. barWidth: '37',
  562. data: chartLine_data.data2,
  563. itemStyle: {
  564. normal: {
  565. lineStyle: { color: '#61a5e8' }
  566. }
  567. }
  568. }, {
  569. name: '开始重量',
  570. symbol: 'triangle',
  571. symbolSize: 10,
  572. type: 'scatter',
  573. data: chartLine_data.data4
  574. }, {
  575. name: '结束重量',
  576. symbol: 'triangle',
  577. symbolSize: 10,
  578. type: 'scatter',
  579. data: chartLine_data.data5
  580. }]
  581. }
  582. this.chartLine.setOption(option)
  583. window.onresize = function() {
  584. this.chartLine.resize()
  585. }
  586. }
  587. }
  588. }
  589. </script>
  590. <style lang="scss" scoped>
  591. .search{padding-top:10px;clear: both;}
  592. .table{margin-top:10px;}
  593. .detail{
  594. height:84px;border: 1px solid #EBEEF5;padding-left:10px;font:16px/32px '';color:#333;
  595. .detail-t{margin-top: 10px;}
  596. .detail-b{margin-bottom: 10px;}
  597. }
  598. </style>