see.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. <template>
  2. <div v-if="visible">
  3. <el-dialog id="reviseplanDialog" :title="title" :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="visible" :close-on-click-modal="false" append-to-body :before-close="closeDialog" width="90%">
  4. <template slot="title">
  5. <div class="avue-crud__dialog__header">
  6. <span class="el-dialog__title">
  7. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  8. {{ title }}
  9. </span>
  10. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  11. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  12. <svg-icon v-else icon-class="fullscreen" />
  13. </div>
  14. </div>
  15. </template>
  16. <div class="see">
  17. <el-row :gutter="10">
  18. <el-col :span="10">
  19. <div class="train">
  20. <h4>车次信息</h4>
  21. <div class="table">
  22. <el-table
  23. :key="table1.tableKey"
  24. v-loading="table1.listLoading"
  25. element-loading-text="给我一点时间"
  26. :data="table1.list"
  27. border
  28. fit
  29. highlight-current-row
  30. style="width: 98%;"
  31. :row-style="rowStyle"
  32. :cell-style="cellStyle"
  33. class="elTable table-fixed"
  34. height="700"
  35. @row-click="rowClick"
  36. >
  37. <el-table-column label="序号" align="center" type="index" width="50" />
  38. <el-table-column label="计划名称" min-width="60px" align="center" prop="projname" />
  39. <el-table-column label="TMR名称" min-width="60px" align="center" prop="tmrtname" />
  40. <el-table-column sortable label="制定日期" min-width="70px" align="center" prop="mydate" />
  41. <el-table-column sortable label="开始时间" min-width="70px" align="center" prop="intime" />
  42. </el-table>
  43. </div>
  44. </div>
  45. </el-col>
  46. <el-col :span="14">
  47. <div class="mixture">
  48. <h4>混料信息</h4>
  49. <div class="table">
  50. <el-table
  51. :key="table2.tableKey"
  52. v-loading="table2.listLoading"
  53. element-loading-text="给我一点时间"
  54. :data="table2.list"
  55. border
  56. fit
  57. highlight-current-row
  58. style="width: 98%;"
  59. :row-style="rowStyle"
  60. :cell-style="cellStyle"
  61. class="elTable table-fixed"
  62. height="150"
  63. >
  64. <el-table-column label="操作编号" min-width="50px" align="center" prop="sort" />
  65. <el-table-column label="饲料名称" min-width="50px" align="center" prop="fname" />
  66. <el-table-column label="计划重量" min-width="50px" align="center" prop="lweight" />
  67. <el-table-column label="实际重量" min-width="50px" align="center" prop="actualweightminus" />
  68. <el-table-column label="误差值" min-width="50px" align="center" prop="diff" />
  69. <el-table-column label="准确率" min-width="50px" align="center" prop="diffRate" />
  70. <el-table-column label="完成时间" min-width="50px" align="center" prop="intime" />
  71. <el-table-column label="过程时间" min-width="50px" align="center" prop="proesstime" />
  72. <el-table-column label="开始读取重量" min-width="50px" align="center" prop="lastactualweight" />
  73. <el-table-column label="最后读取重量" min-width="50px" align="center" prop="actualweight" />
  74. <el-table-column label="取料方式" min-width="50px" align="center" prop="buttontype" />
  75. </el-table>
  76. </div>
  77. </div>
  78. <div class="spreading">
  79. <h4>撒料信息</h4>
  80. <div class="table">
  81. <el-table
  82. :key="table3.tableKey"
  83. v-loading="table3.listLoading"
  84. element-loading-text="给我一点时间"
  85. :data="table3.list"
  86. border
  87. fit
  88. highlight-current-row
  89. style="width: 98%;"
  90. :row-style="rowStyle"
  91. :cell-style="cellStyle"
  92. class="elTable table-fixed"
  93. height="150"
  94. >
  95. <el-table-column label="操作编号" min-width="50px" align="center" prop="sort" />
  96. <el-table-column label="饲料名称" min-width="50px" align="center" prop="fname" />
  97. <el-table-column label="计划重量" min-width="50px" align="center" prop="lweight" />
  98. <el-table-column label="实际重量" min-width="50px" align="center" prop="actualweightminus" />
  99. <el-table-column label="误差值" min-width="50px" align="center" prop="diff" />
  100. <el-table-column label="准确率" min-width="50px" align="center" prop="diffRate" />
  101. <el-table-column label="完成时间" min-width="50px" align="center" prop="intime" />
  102. <el-table-column label="过程时间" min-width="50px" align="center" prop="proesstime" />
  103. <el-table-column label="开始读取重量" min-width="50px" align="center" prop="lastactualweight" />
  104. <el-table-column label="最后读取重量" min-width="50px" align="center" prop="actualweight" />
  105. <el-table-column label="取料方式" min-width="50px" align="center" prop="buttontype" />
  106. </el-table>
  107. </div>
  108. </div>
  109. <div class="controlChart">
  110. <h4>监控图</h4>
  111. <div id="chartLine" style="width: 100%;height:300px;" />
  112. </div>
  113. </el-col>
  114. </el-row>
  115. <div slot="footer" class="dialog-footer">
  116. <el-button class="cancelClose cancelClose1" @click="closeDialog()">关闭</el-button>
  117. </div>
  118. </div>
  119. </el-dialog>
  120. </div>
  121. </template>
  122. <script>
  123. import echarts from 'echarts'
  124. require('echarts/theme/macarons')
  125. import Cookies from 'js-cookie'
  126. import { GetDataByName, GetReportform, formatNum } from '@/api/common'
  127. export default {
  128. name: 'See',
  129. props: {
  130. show: { type: Boolean, default: false }, // 弹框可见标志
  131. titleFname: { type: String, defalut: '准确性详情' },
  132. methodName:{ type: String, defalut: '' },
  133. rowPid: { type: String, defalut: '0' },
  134. optdevice: { type: String, defalut: '' },
  135. startTime:{ type: String, defalut: '' },
  136. stopTime:{ type: String, defalut: '' }
  137. },
  138. data() {
  139. return {
  140. dialogFull: false,
  141. visible: this.show,
  142. title: '',
  143. pid: '',
  144. methodname:'',
  145. optdevice:'',
  146. startTime:'',
  147. stopTime:'',
  148. table1: {
  149. getdataListParm: {
  150. name: '', page: 1, offset: 1, pagecount: '', returntype: 'Map',
  151. parammaps: { pid: '', optdevice:'', startTime:'', stopTime:'',pastureid: '' }
  152. },
  153. tableKey: 0, list: [], total: 0, listLoading: false
  154. },
  155. table2: {
  156. getdataListParm: {
  157. name: 'getprocessAnalysisHL', page: 1, offset: 1, pagecount: '', returntype: 'Map',
  158. parammaps: { pid: '', pastureid: '' }
  159. },
  160. tableKey: 0, list: [], total: 0, listLoading: false
  161. },
  162. table3: {
  163. getdataListParm: {
  164. name: 'getprocessAnalysisSL', page: 1, offset: 1, pagecount: '', returntype: 'Map',
  165. parammaps: { pid: '', pastureid: '' }
  166. },
  167. tableKey: 0, list: [], total: 0, listLoading: false
  168. },
  169. chart1: {
  170. getdataListParm: {
  171. name: 'getprocessAnalysisTB', page: 1, offset: 1, pagecount: '', returntype: 'Map',
  172. parammaps: {
  173. pid: '', pastureid: ''
  174. }
  175. },
  176. tableKey: 0, list: [], total: 0, listLoading: false, chartLine_data: []
  177. },
  178. chartLine: null, chartLine_data: {}, chartName: '',
  179. // rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  180. cellStyle: { padding: 0 + 'px' },
  181. myHeight: document.documentElement.clientHeight - 85 - 200
  182. }
  183. },
  184. watch: {
  185. // 监听show,visible 随着show变化而变化
  186. show: {
  187. immediate: true,
  188. handler(show) {
  189. console.log(show, 'show')
  190. this.visible = show
  191. if(show == true){
  192. setTimeout(() => {
  193. this.getList1()
  194. }, 500)
  195. }
  196. }
  197. },
  198. titleFname: {
  199. immediate: true,
  200. handler(newVal, oldVal) {
  201. console.log(newVal, 'titleFname')
  202. this.title = newVal
  203. }
  204. },
  205. rowPid: {
  206. immediate: true,
  207. handler(newVal, oldVal) {
  208. console.log(newVal, 'rowPid')
  209. this.pid = newVal
  210. }
  211. },
  212. methodName: {
  213. immediate: true,
  214. handler(newVal, oldVal) {
  215. console.log(newVal, 'methodname')
  216. this.methodname = newVal
  217. }
  218. },
  219. optdevice: {
  220. immediate: true,
  221. handler(newVal, oldVal) {
  222. console.log(newVal, 'optdevice')
  223. this.optdevice = newVal
  224. }
  225. },
  226. startTime: {
  227. immediate: true,
  228. handler(newVal, oldVal) {
  229. console.log(newVal, 'startTime')
  230. this.startTime = newVal
  231. }
  232. },
  233. stopTime: {
  234. immediate: true,
  235. handler(newVal, oldVal) {
  236. console.log(newVal, 'stopTime')
  237. this.stopTime = newVal
  238. }
  239. }
  240. },
  241. created() {
  242. },
  243. mounted() {
  244. },
  245. methods: {
  246. closeDialog() {
  247. this.dialogFull = false
  248. this.$emit('update:show', false)
  249. },
  250. // TMR设备列表
  251. getList1() {
  252. this.table1.listLoading = true
  253. this.table1.getdataListParm.name = this.methodname
  254. this.table1.getdataListParm.parammaps.optdevice = this.optdevice
  255. this.table1.getdataListParm.parammaps.startTime = this.startTime
  256. this.table1.getdataListParm.parammaps.stopTime = this.stopTime
  257. this.table1.getdataListParm.parammaps.pid = this.pid
  258. this.table1.getdataListParm.parammaps.pastureid = Cookies.get('pastureid')
  259. GetDataByName(this.table1.getdataListParm).then(response => {
  260. console.log('车次信息数据', response.data.list)
  261. if (response.data !== null && response.data.list !== null) {
  262. this.table1.list = response.data.list
  263. this.table2.getdataListParm.parammaps.pid = response.data.list[0].pid
  264. this.table2.getdataListParm.parammaps.pastureid = response.data.list[0].pastureid
  265. this.table3.getdataListParm.parammaps.pid = response.data.list[0].pid
  266. this.table3.getdataListParm.parammaps.pastureid = response.data.list[0].pastureid
  267. this.chart1.getdataListParm.parammaps.pid = response.data.list[0].pid
  268. this.chart1.getdataListParm.parammaps.pastureid = response.data.list[0].pastureid
  269. } else {
  270. this.table1.list = []
  271. this.table2.getdataListParm.parammaps.pid = ''
  272. this.table2.getdataListParm.parammaps.pastureid = ''
  273. this.table3.getdataListParm.parammaps.pid = ''
  274. this.table3.getdataListParm.parammaps.pastureid = ''
  275. this.chart1.getdataListParm.parammaps.pid = ''
  276. this.chart1.getdataListParm.parammaps.pastureid = ''
  277. }
  278. this.getList2()
  279. this.getList3()
  280. this.getChart1()
  281. setTimeout(() => {
  282. this.table1.listLoading = false
  283. }, 100)
  284. })
  285. },
  286. getList2() {
  287. this.table2.listLoading = true
  288. GetDataByName(this.table2.getdataListParm).then(response => {
  289. console.log('混料信息数据', response.data.list)
  290. if (response.data !== null && response.data.list !== null) {
  291. this.table2.list = response.data.list
  292. var sumlweight = 0
  293. var sumactualweightminus = 0
  294. var sumsweight = 0
  295. var sumproesstime = ''
  296. for (let i = 0; i < response.data.list.length; i++) {
  297. if (response.data.list[i].lweight == undefined) { response.data.list[i].lweight = 0 }
  298. if (response.data.list[i].actualweightminus == undefined) { response.data.list[i].actualweightminus = 0 }
  299. if (response.data.list[i].sweight == undefined) { response.data.list[i].sweight = 0 }
  300. sumlweight += parseFloat(response.data.list[i].lweight)
  301. sumactualweightminus += parseFloat(response.data.list[i].actualweightminus)
  302. sumsweight += parseFloat(response.data.list[i].sweight)
  303. sumproesstime = response.data.list[0].sumproesstime
  304. }
  305. sumlweight = formatNum(sumlweight, 2)
  306. sumactualweightminus = formatNum(sumactualweightminus, 2)
  307. sumsweight = formatNum(sumsweight, 2)
  308. this.table2.list.push({ 'sort': '合计', 'lweight': sumlweight, 'actualweightminus': sumactualweightminus, 'sweight': sumsweight, 'proesstime': sumproesstime })
  309. } else {
  310. this.table2.list = []
  311. }
  312. setTimeout(() => {
  313. this.table2.listLoading = false
  314. }, 100)
  315. })
  316. },
  317. getList3() {
  318. this.table3.listLoading = true
  319. GetDataByName(this.table3.getdataListParm).then(response => {
  320. if (response.data !== null && response.data.list !== null) {
  321. console.log('撒料信息数据', response.data.list)
  322. this.table3.list = response.data.list
  323. var sumlweight = 0
  324. var sumactualweightminus = 0
  325. var sumsweight = 0
  326. var sumproesstime = ''
  327. for (let i = 0; i < response.data.list.length; i++) {
  328. if (response.data.list[i].lweight == undefined) { response.data.list[i].lweight = 0 }
  329. if (response.data.list[i].actualweightminus == undefined) { response.data.list[i].actualweightminus = 0 }
  330. if (response.data.list[i].sweight == undefined) { response.data.list[i].sweight = 0 }
  331. sumlweight += parseFloat(response.data.list[i].lweight)
  332. sumactualweightminus += parseFloat(response.data.list[i].actualweightminus)
  333. sumsweight += parseFloat(response.data.list[i].sweight)
  334. sumproesstime = response.data.list[0].sumproesstime
  335. }
  336. sumlweight = formatNum(sumlweight, 2)
  337. sumactualweightminus = formatNum(sumactualweightminus, 2)
  338. sumsweight = formatNum(sumsweight, 2)
  339. this.table3.list.push({ 'sort': '合计', 'lweight': sumlweight, 'actualweightminus': sumactualweightminus, 'sweight': sumsweight, 'proesstime': sumproesstime })
  340. } else {
  341. this.table3.list = []
  342. }
  343. setTimeout(() => {
  344. this.table3.listLoading = false
  345. }, 100)
  346. })
  347. },
  348. getChart1() {
  349. this.chart1.listLoading = true
  350. GetReportform(this.chart1.getdataListParm).then(response => {
  351. if (response.data !== null && response.data.list !== null) {
  352. this.chart1.list = response.data.data
  353. console.log('监控图', response.data.list)
  354. this.chart1.chartLine_data = response.data.list
  355. this.chart1.total = response.data.total
  356. this.roadChartLine1(this.chart1.chartLine_data)
  357. } else {
  358. this.chart1.list = []
  359. }
  360. setTimeout(() => {
  361. this.chart1.listLoading = false
  362. }, 100)
  363. })
  364. },
  365. roadChartLine1(chartLine_data) {
  366. console.log(chartLine_data.data5, 'chartLine_data')
  367. if (this.chartLine != null) {
  368. this.chartLine.dispose()
  369. }
  370. this.chartLine = echarts.init(document.getElementById('chartLine'))
  371. var option = {
  372. title: { text: '', subtext: '' },
  373. color: ['#38c193', '#5199e5', '#fdb06a', '#fb8b73'], // 关键加上这句话,legend的颜色和折线的自定义颜色就一致了
  374. legend: [{
  375. itemWidth: 15, itemHeight: 7, right: '25%', textStyle: { fontSize: 12 },
  376. data: [{ name: '设计重量' }, { name: '实际重量' }]
  377. }, {
  378. itemWidth: 15, itemHeight: 15, right: '0', textStyle: { fontSize: 12 },
  379. data: [
  380. { name: '开始重量' },
  381. { name: '结束重量' }
  382. ]
  383. }],
  384. tooltip: {
  385. trigger: 'axis',
  386. formatter: function(params) {
  387. console.log(params, 'params')
  388. var tip = params[0].name
  389. for (let i = 0; i < params.length; i++) {
  390. if (params[i].seriesName == '设计重量') {
  391. tip += '<br>' + params[i].seriesName + ':' + params[i].value[1]
  392. }
  393. if (params[i].seriesName == '实际重量') {
  394. tip += '<br>' + params[i].seriesName + ':' + params[i].value[1]
  395. }
  396. if (params[i].seriesName == '开始重量') {
  397. tip += '<br>' + params[i].seriesName + ':' + params[i].value[1]
  398. }
  399. if (params[i].seriesName == '结束重量') {
  400. tip += '<br>' + params[i].seriesName + ':' + params[i].value[1] + '<br>' + params[i].value[2] + params[i].value[3]
  401. }
  402. }
  403. return tip
  404. }
  405. },
  406. calculable: true,
  407. xAxis: [
  408. { type: 'category' }
  409. ],
  410. yAxis: [{ type: 'value' }],
  411. toolbox: {
  412. show: false,
  413. feature: {
  414. dataZoom: { realtime: false, yAxisIndex: 'none', },
  415. restore: {},
  416. }
  417. },
  418. dataZoom: [
  419. {type: 'inside'}, //用于添加滚轮缩放
  420. {type:'slider' }, //用于添加滑动条缩放,
  421. ],
  422. series: [
  423. { symbol: 'none', name: '实际重量', type: 'line', data: chartLine_data.data3, itemStyle: { normal: { lineStyle: { color: '#38c193' }}}},
  424. { symbol: 'none', name: '设计重量', type: 'line', step: 'middle', data: chartLine_data.data2 },
  425. { name: '开始重量', symbolSize: 10, type: 'scatter', data: chartLine_data.data4 },
  426. { name: '结束重量', symbolSize: 10, type: 'scatter', data: chartLine_data.data5 }
  427. ]
  428. }
  429. this.chartLine.setOption(option)
  430. if (this.chartLine != null) {
  431. window.onresize = function() {
  432. this.chartLine.resize()
  433. }
  434. }
  435. },
  436. rowClick(row, column, event) {
  437. this.table2.getdataListParm.parammaps.pid = row.pid
  438. this.table3.getdataListParm.parammaps.pid = row.pid
  439. this.chart1.getdataListParm.parammaps.pid = row.pid
  440. this.getList2()
  441. this.getList3()
  442. this.getChart1()
  443. },
  444. rowStyle({ row, rowIndex }) {
  445. let stylejson = {};
  446. if (row.labnormal == 1) {
  447. stylejson.background = "#fb8072";// 背景颜色
  448. stylejson.maxHeight = '30px';// 背景颜色
  449. stylejson.height = '30px';// 背景颜色
  450. // 也可以修改文字颜色
  451. return stylejson;
  452. } else {
  453. return "";
  454. }
  455. },
  456. }
  457. }
  458. </script>
  459. <style lang="scss" scoped>
  460. /deep/ .el-table th>.cell{
  461. padding-left: 0 !important;;
  462. padding-right: 0 !important;;
  463. }
  464. /deep/ .el-table td>.cell{
  465. padding-left: 0 !important;;
  466. padding-right: 0 !important;;
  467. }
  468. </style>