see.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  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. <template slot-scope="scope">
  69. <span v-if="scope.row.lweight == scope.row.actualweightminus">{{ scope.row.actualweightminus }}</span>
  70. <span v-else style="color: red;">{{ scope.row.actualweightminus }}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="误差值" min-width="50px" align="center" prop="diff" />
  74. <el-table-column label="准确率" min-width="50px" align="center" prop="diffRate" />
  75. <el-table-column label="完成时间" min-width="50px" align="center" prop="intime" />
  76. <el-table-column label="过程时间" min-width="50px" align="center" prop="proesstime" />
  77. <el-table-column label="开始读取重量" min-width="50px" align="center" prop="lastactualweight" />
  78. <el-table-column label="最后读取重量" min-width="50px" align="center" prop="actualweight" />
  79. <el-table-column label="取料方式" min-width="50px" align="center" prop="buttontype" />
  80. </el-table>
  81. </div>
  82. </div>
  83. <div class="spreading">
  84. <h4>撒料信息</h4>
  85. <div class="table">
  86. <el-table
  87. :key="table3.tableKey"
  88. v-loading="table3.listLoading"
  89. element-loading-text="给我一点时间"
  90. :data="table3.list"
  91. border
  92. fit
  93. highlight-current-row
  94. style="width: 98%;"
  95. :row-style="rowStyle"
  96. :cell-style="cellStyle"
  97. class="elTable table-fixed"
  98. height="150"
  99. >
  100. <el-table-column label="操作编号" min-width="50px" align="center" prop="sort" />
  101. <el-table-column label="饲料名称" min-width="50px" align="center" prop="fname" />
  102. <el-table-column label="计划重量" min-width="50px" align="center" prop="lweight" />
  103. <el-table-column label="实际重量" min-width="50px" align="center" prop="actualweightminus">
  104. <template slot-scope="scope">
  105. <span v-if="scope.row.lweight == scope.row.actualweightminus">{{ scope.row.actualweightminus }}</span>
  106. <span v-else style="color: red;">{{ scope.row.actualweightminus }}</span>
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="误差值" min-width="50px" align="center" prop="diff" />
  110. <el-table-column label="准确率" min-width="50px" align="center" prop="diffRate" />
  111. <el-table-column label="完成时间" min-width="50px" align="center" prop="intime" />
  112. <el-table-column label="过程时间" min-width="50px" align="center" prop="proesstime" />
  113. <el-table-column label="开始读取重量" min-width="50px" align="center" prop="lastactualweight" />
  114. <el-table-column label="最后读取重量" min-width="50px" align="center" prop="actualweight" />
  115. <el-table-column label="取料方式" min-width="50px" align="center" prop="buttontype" />
  116. </el-table>
  117. </div>
  118. </div>
  119. <div class="controlChart">
  120. <h4>监控图</h4>
  121. <div id="chartLine" style="width: 100%;height:300px;" />
  122. </div>
  123. </el-col>
  124. </el-row>
  125. <div slot="footer" class="dialog-footer">
  126. <el-button class="cancelClose cancelClose1" @click="closeDialog()">关闭</el-button>
  127. </div>
  128. </div>
  129. </el-dialog>
  130. </div>
  131. </template>
  132. <script>
  133. import echarts from 'echarts'
  134. require('echarts/theme/macarons')
  135. import { GetDataByName, GetReportform, formatNum } from '@/api/common'
  136. export default {
  137. name: 'See',
  138. props: {
  139. show: { type: Boolean, default: false }, // 弹框可见标志
  140. titleFname: { type: String, defalut: '准确性详情' },
  141. rowPid: { type: String, defalut: '0' }
  142. },
  143. data() {
  144. return {
  145. dialogFull: false,
  146. visible: this.show,
  147. title: '',
  148. pid: '',
  149. table1: {
  150. getdataListParm: {
  151. name: 'getDownloadedplanHLCK', page: 1, offset: 1, pagecount: '', returntype: 'Map',
  152. parammaps: { pid: '' }
  153. },
  154. tableKey: 0, list: [], total: 0, listLoading: false
  155. },
  156. table2: {
  157. getdataListParm: {
  158. name: 'getprocessAnalysisHL', page: 1, offset: 1, pagecount: '', returntype: 'Map',
  159. parammaps: { pid: '', pastureid: '' }
  160. },
  161. tableKey: 0, list: [], total: 0, listLoading: false
  162. },
  163. table3: {
  164. getdataListParm: {
  165. name: 'getprocessAnalysisSL', page: 1, offset: 1, pagecount: '', returntype: 'Map',
  166. parammaps: { pid: '', pastureid: '' }
  167. },
  168. tableKey: 0, list: [], total: 0, listLoading: false
  169. },
  170. chart1: {
  171. getdataListParm: {
  172. name: 'getprocessAnalysisTB', page: 1, offset: 1, pagecount: '', returntype: 'Map',
  173. parammaps: {
  174. pid: '', pastureid: ''
  175. }
  176. },
  177. tableKey: 0, list: [], total: 0, listLoading: false, chartLine_data: []
  178. },
  179. chartLine: null, chartLine_data: {}, chartName: '',
  180. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  181. cellStyle: { padding: 0 + 'px' },
  182. myHeight: document.documentElement.clientHeight - 85 - 200
  183. }
  184. },
  185. watch: {
  186. // 监听show,visible 随着show变化而变化
  187. show: {
  188. immediate: true,
  189. handler(show) {
  190. console.log(show, 'show')
  191. this.visible = show
  192. setTimeout(() => {
  193. this.getList1()
  194. }, 500)
  195. }
  196. },
  197. titleFname: {
  198. immediate: true,
  199. handler(newVal, oldVal) {
  200. console.log(newVal, 'titleFname')
  201. this.title = newVal
  202. }
  203. },
  204. rowPid: {
  205. immediate: true,
  206. handler(newVal, oldVal) {
  207. console.log(newVal, 'rowPid')
  208. this.pid = newVal
  209. }
  210. }
  211. },
  212. created() {
  213. },
  214. mounted() {
  215. },
  216. methods: {
  217. closeDialog() {
  218. this.dialogFull = false
  219. this.$emit('update:show', false)
  220. },
  221. // TMR设备列表
  222. getList1() {
  223. this.table1.listLoading = true
  224. this.table1.getdataListParm.parammaps.pid = this.pid
  225. GetDataByName(this.table1.getdataListParm).then(response => {
  226. console.log('车次信息数据', response.data.list)
  227. if (response.data !== null && response.data.list !== null) {
  228. this.table1.list = response.data.list
  229. this.table2.getdataListParm.parammaps.pid = response.data.list[0].pid
  230. this.table2.getdataListParm.parammaps.pastureid = response.data.list[0].pastureid
  231. this.table3.getdataListParm.parammaps.pid = response.data.list[0].pid
  232. this.table3.getdataListParm.parammaps.pastureid = response.data.list[0].pastureid
  233. this.chart1.getdataListParm.parammaps.pid = response.data.list[0].pid
  234. this.chart1.getdataListParm.parammaps.pastureid = response.data.list[0].pastureid
  235. } else {
  236. this.table1.list = []
  237. this.table2.getdataListParm.parammaps.pid = ''
  238. this.table2.getdataListParm.parammaps.pastureid = ''
  239. this.table3.getdataListParm.parammaps.pid = ''
  240. this.table3.getdataListParm.parammaps.pastureid = ''
  241. this.chart1.getdataListParm.parammaps.pid = ''
  242. this.chart1.getdataListParm.parammaps.pastureid = ''
  243. }
  244. this.getList2()
  245. this.getList3()
  246. this.getChart1()
  247. setTimeout(() => {
  248. this.table1.listLoading = false
  249. }, 100)
  250. })
  251. },
  252. getList2() {
  253. this.table2.listLoading = true
  254. GetDataByName(this.table2.getdataListParm).then(response => {
  255. console.log('混料信息数据', response.data.list)
  256. if (response.data !== null && response.data.list !== null) {
  257. this.table2.list = response.data.list
  258. var sumlweight = 0
  259. var sumactualweightminus = 0
  260. var sumsweight = 0
  261. var sumproesstime = ''
  262. for (let i = 0; i < response.data.list.length; i++) {
  263. if (response.data.list[i].lweight == undefined) { response.data.list[i].lweight = 0 }
  264. if (response.data.list[i].actualweightminus == undefined) { response.data.list[i].actualweightminus = 0 }
  265. if (response.data.list[i].sweight == undefined) { response.data.list[i].sweight = 0 }
  266. sumlweight += parseFloat(response.data.list[i].lweight)
  267. sumactualweightminus += parseFloat(response.data.list[i].actualweightminus)
  268. sumsweight += parseFloat(response.data.list[i].sweight)
  269. sumproesstime = response.data.list[0].sumproesstime
  270. }
  271. sumlweight = formatNum(sumlweight, 2)
  272. sumactualweightminus = formatNum(sumactualweightminus, 2)
  273. sumsweight = formatNum(sumsweight, 2)
  274. this.table2.list.push({ 'sort': '合计', 'lweight': sumlweight, 'actualweightminus': sumactualweightminus, 'sweight': sumsweight, 'proesstime': sumproesstime })
  275. } else {
  276. this.table2.list = []
  277. }
  278. setTimeout(() => {
  279. this.table2.listLoading = false
  280. }, 100)
  281. })
  282. },
  283. getList3() {
  284. this.table3.listLoading = true
  285. GetDataByName(this.table3.getdataListParm).then(response => {
  286. if (response.data !== null && response.data.list !== null) {
  287. console.log('撒料信息数据', response.data.list)
  288. this.table3.list = response.data.list
  289. var sumlweight = 0
  290. var sumactualweightminus = 0
  291. var sumsweight = 0
  292. var sumproesstime = ''
  293. for (let i = 0; i < response.data.list.length; i++) {
  294. if (response.data.list[i].lweight == undefined) { response.data.list[i].lweight = 0 }
  295. if (response.data.list[i].actualweightminus == undefined) { response.data.list[i].actualweightminus = 0 }
  296. if (response.data.list[i].sweight == undefined) { response.data.list[i].sweight = 0 }
  297. sumlweight += parseFloat(response.data.list[i].lweight)
  298. sumactualweightminus += parseFloat(response.data.list[i].actualweightminus)
  299. sumsweight += parseFloat(response.data.list[i].sweight)
  300. sumproesstime = response.data.list[0].sumproesstime
  301. }
  302. sumlweight = formatNum(sumlweight, 2)
  303. sumactualweightminus = formatNum(sumactualweightminus, 2)
  304. sumsweight = formatNum(sumsweight, 2)
  305. this.table3.list.push({ 'sort': '合计', 'lweight': sumlweight, 'actualweightminus': sumactualweightminus, 'sweight': sumsweight, 'proesstime': sumproesstime })
  306. } else {
  307. this.table3.list = []
  308. }
  309. setTimeout(() => {
  310. this.table3.listLoading = false
  311. }, 100)
  312. })
  313. },
  314. getChart1() {
  315. this.chart1.listLoading = true
  316. GetReportform(this.chart1.getdataListParm).then(response => {
  317. if (response.data !== null && response.data.list !== null) {
  318. this.chart1.list = response.data.data
  319. console.log('监控图', response.data.list)
  320. this.chart1.chartLine_data = response.data.list
  321. this.chart1.total = response.data.total
  322. this.roadChartLine1(this.chart1.chartLine_data)
  323. } else {
  324. this.chart1.list = []
  325. }
  326. setTimeout(() => {
  327. this.chart1.listLoading = false
  328. }, 100)
  329. })
  330. },
  331. roadChartLine1(chartLine_data) {
  332. console.log(chartLine_data.data5, 'chartLine_data')
  333. if (this.chartLine != null) {
  334. this.chartLine.dispose()
  335. }
  336. this.chartLine = echarts.init(document.getElementById('chartLine'))
  337. var option = {
  338. title: { text: '', subtext: '' },
  339. color: ['#38c193', '#5199e5', '#fdb06a', '#fb8b73'], // 关键加上这句话,legend的颜色和折线的自定义颜色就一致了
  340. legend: [{
  341. itemWidth: 15, itemHeight: 7, right: '25%', textStyle: { fontSize: 12 },
  342. data: [{ name: '设计重量' }, { name: '实际重量' }]
  343. }, {
  344. itemWidth: 15, itemHeight: 15, right: '0', textStyle: { fontSize: 12 },
  345. data: [
  346. { name: '开始重量' },
  347. { name: '结束重量' }
  348. ]
  349. }],
  350. tooltip: {
  351. trigger: 'axis',
  352. formatter: function(params) {
  353. console.log(params, 'params')
  354. var tip = params[0].name
  355. for (let i = 0; i < params.length; i++) {
  356. if (params[i].seriesName == '设计重量') {
  357. tip += '<br>' + params[i].seriesName + ':' + params[i].value[1]
  358. }
  359. if (params[i].seriesName == '实际重量') {
  360. tip += '<br>' + params[i].seriesName + ':' + params[i].value[1]
  361. }
  362. if (params[i].seriesName == '开始重量') {
  363. tip += '<br>' + params[i].seriesName + ':' + params[i].value[1]
  364. }
  365. if (params[i].seriesName == '结束重量') {
  366. tip += '<br>' + params[i].seriesName + ':' + params[i].value[1] + '<br>' + params[i].value[2] + params[i].value[3]
  367. }
  368. }
  369. return tip
  370. }
  371. },
  372. calculable: true,
  373. xAxis: [
  374. { type: 'category' }
  375. ],
  376. yAxis: [{ type: 'value' }],
  377. series: [
  378. { symbol: 'none', name: '实际重量', type: 'line', data: chartLine_data.data3, itemStyle: { normal: { lineStyle: { color: '#38c193' }}}},
  379. { symbol: 'none', name: '设计重量', type: 'line', step: 'middle', data: chartLine_data.data2 },
  380. { name: '开始重量', symbolSize: 10, type: 'scatter', data: chartLine_data.data4 },
  381. { name: '结束重量', symbolSize: 10, type: 'scatter', data: chartLine_data.data5 }
  382. ]
  383. }
  384. this.chartLine.setOption(option)
  385. window.onresize = function() {
  386. this.chartLine.resize()
  387. }
  388. },
  389. rowClick(row, column, event) {
  390. }
  391. }
  392. }
  393. </script>
  394. <style lang="scss" scoped>
  395. /deep/ .el-table th>.cell{
  396. padding-left: 0 !important;;
  397. padding-right: 0 !important;;
  398. }
  399. /deep/ .el-table td>.cell{
  400. padding-left: 0 !important;;
  401. padding-right: 0 !important;;
  402. }
  403. </style>