fd5ff3b2c1a428cee144d619cf5ac871dec93108.svn-base 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. <template>
  2. <div class="app-container">
  3. <!-- <h1>集团</h1> -->
  4. <div class="search">
  5. <el-select v-model="table.getdataListParm.parammaps.pastureid" placeholder="牧场" class="filter-item" style="width: 120px;">
  6. <el-option v-for="item in pastureList" :key="item.pastureid" :label="item.pasturename" :value="item.pastureid" />
  7. </el-select>
  8. <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;" :picker-options="pickerOptions" />
  9. <el-button class="el-icon-arrow-left elIconArrowLeft" :disabled="Beforedisabled" @click="handleBefore" />
  10. <el-button class="el-icon-arrow-right elIconArrowRight" :disabled="Nextdisabled" @click="handleNext" />
  11. <el-select v-model="table.getdataListParm.parammaps.lpplantype" placeholder="计划类型" class="filter-item" style="width: 120px;" clearable>
  12. <el-option v-for="item in planTypeList" :key="item.value" :label="item.lable" :value="item.value" />
  13. </el-select>
  14. <el-input v-model="table.getdataListParm.parammaps.tmrtname" placeholder="TMR名称" style="width: 180px;" class="filter-item" clearable />
  15. <el-select v-model="table.getdataListParm.parammaps.iscompleted" placeholder="工作状态" class="filter-item" style="width: 120px;" clearable>
  16. <el-option v-for="item in workingConditionList" :key="item.id" :label="item.name" :value="item.id" />
  17. </el-select>
  18. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  19. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  20. </div>
  21. <el-row :gutter="20">
  22. <el-col :span="8">
  23. <h4>TMR设备列表</h4>
  24. <div class="table">
  25. <el-table
  26. :key="table.tableKey"
  27. v-loading="table.listLoading"
  28. element-loading-text="给我一点时间"
  29. :data="table.list"
  30. border
  31. fit
  32. highlight-current-row
  33. style="width: 100%;"
  34. :row-style="rowStyle"
  35. :cell-style="cellStyle"
  36. class="elTable table-fixed"
  37. height="970px"
  38. @row-click="rowClick"
  39. >
  40. <el-table-column label="牧场" min-width="80px" align="center" prop="pastureName" />
  41. <el-table-column label="开始时间" min-width="100px" align="center" prop="intime" />
  42. <el-table-column label="计划类型" min-width="80px" align="center" prop="lpplantype" />
  43. <el-table-column label="描述" min-width="90px" align="center" prop="remark" />
  44. <el-table-column label="TMR名称" min-width="80px" align="center" prop="tmrtname" />
  45. </el-table>
  46. </div>
  47. </el-col>
  48. <!-- 预混计划 -->
  49. <el-col v-if="isPremixedPlan" :span="16">
  50. <h4>过程详情-预混计划</h4>
  51. <div class="detail">
  52. <div class="detail-t">
  53. 过程时间:<span v-if="table2.list.length !== 0">{{ table2.list[0].proesstime }}</span>;
  54. 工作状态:<span v-if="table2.list.length !== 0">{{ table2.list[0].iscompleted }}</span>
  55. </div>
  56. <div class="detail-b">
  57. <span>混料误差值:<span v-if="table2.list.length !== 0">{{ table2.list[0].Hdif }}kg</span>;</span>
  58. <span>混料准确率:<span v-if="table2.list.length !== 0">{{ table2.list[0].HdifRate }}</span>;</span>
  59. </div>
  60. </div>
  61. <div class="Mixture">
  62. <h4>混料详情</h4>
  63. <el-table
  64. :key="table3.tableKey"
  65. v-loading="table3.listLoading"
  66. element-loading-text="给我一点时间"
  67. :data="table3.list"
  68. border
  69. fit
  70. highlight-current-row
  71. style="width: 100%;"
  72. :row-style="rowStyle"
  73. :cell-style="cellStyle"
  74. class="elTable table-fixed"
  75. >
  76. <el-table-column label="操作编号" min-width="70px" align="center" prop="sort" />
  77. <el-table-column label="饲料名称" min-width="70px" align="center" prop="fname" />
  78. <el-table-column label="计划重量" min-width="50px" align="center" prop="lweight" />
  79. <el-table-column label="实际重量" min-width="70px" align="center" prop="actualweightminus" />
  80. <el-table-column label="误差值" min-width="70px" align="center" prop="diff" />
  81. <el-table-column label="准确率" min-width="70px" align="center" prop="diffRate" />
  82. <el-table-column label="完成时间" min-width="70px" align="center" prop="intime" />
  83. <el-table-column label="过程时间" min-width="70px" align="center" prop="proesstime" />
  84. <el-table-column label="跳转方式" min-width="70px" align="center" prop="buttontype" />
  85. <el-table-column label="开始重量" min-width="70px" align="center" prop="lastactualweight" />
  86. <el-table-column label="结束重量" min-width="70px" align="center" prop="actualweight" />
  87. </el-table>
  88. </div>
  89. </el-col>
  90. <!-- 撒料计划 -->
  91. <el-col v-if="isSpreadingPlan" :span="16">
  92. <h4>过程详情-撒料计划</h4>
  93. <div class="detail">
  94. <div class="detail-t">
  95. 过程时间:<span v-if="table2.list.length !== 0">{{ table2.list[0].proesstime }}</span>;
  96. 工作状态:<span v-if="table2.list.length !== 0">{{ table2.list[0].iscompleted }}</span>
  97. </div>
  98. <div class="detail-b">
  99. <span>混料误差值:<span v-if="table2.list.length !== 0">{{ table2.list[0].Hdif }}kg</span>;</span>
  100. <span>混料准确率:<span v-if="table2.list.length !== 0">{{ table2.list[0].HdifRate }}</span>;</span>
  101. <span>撒料误差值:<span v-if="table2.list.length !== 0">{{ table2.list[0].Sdif }}kg</span>;</span>
  102. <span>撒料准确率:<span v-if="table2.list.length !== 0">{{ table2.list[0].SdifRate }}</span></span>
  103. </div>
  104. </div>
  105. <div class="Mixture">
  106. <h4>混料详情</h4>
  107. <el-table
  108. :key="table3.tableKey"
  109. v-loading="table3.listLoading"
  110. element-loading-text="给我一点时间"
  111. :data="table3.list"
  112. border
  113. fit
  114. highlight-current-row
  115. style="width: 100%;"
  116. :row-style="rowStyle"
  117. :cell-style="cellStyle"
  118. class="elTable table-fixed"
  119. >
  120. <el-table-column label="操作编号" min-width="110px" align="center" prop="sort" />
  121. <el-table-column label="饲料名称" min-width="110px" align="center" prop="fname" />
  122. <el-table-column label="计划重量" min-width="110px" align="center" prop="lweight" />
  123. <el-table-column label="实际重量" min-width="110px" align="center" prop="actualweightminus" />
  124. <el-table-column label="误差值" min-width="110px" align="center" prop="diff" />
  125. <el-table-column label="准确率" min-width="110px" align="center" prop="diffRate" />
  126. <el-table-column label="完成时间" min-width="110px" align="center" prop="intime" />
  127. <el-table-column label="过程时间" min-width="110px" align="center" prop="proesstime" />
  128. <el-table-column label="跳转方式" min-width="110px" align="center" prop="buttontype" />
  129. <el-table-column label="开始重量" min-width="110px" align="center" prop="lastactualweight" />
  130. <el-table-column label="结束重量" min-width="110px" align="center" prop="actualweight" />
  131. </el-table>
  132. </div>
  133. <div class="SpreadingMaterials">
  134. <h4>撒料详情</h4>
  135. <el-table
  136. :key="table4.tableKey"
  137. v-loading="table4.listLoading"
  138. element-loading-text="给我一点时间"
  139. :data="table4.list"
  140. border
  141. fit
  142. highlight-current-row
  143. style="width: 100%;"
  144. :row-style="rowStyle"
  145. :cell-style="cellStyle"
  146. class="elTable table-fixed"
  147. height="200px"
  148. >
  149. <el-table-column label="操作编号" min-width="70px" align="center" prop="sort" />
  150. <el-table-column label="栏舍名称" min-width="70px" align="center" prop="fname" />
  151. <el-table-column label="计划重量" min-width="70px" align="center" prop="lweight" />
  152. <el-table-column label="实际重量" min-width="70px" align="center" prop="actualweightminus" />
  153. <el-table-column label="误差值" min-width="70px" align="center" prop="diff" />
  154. <el-table-column label="准确率" min-width="70px" align="center" prop="diffRate" />
  155. <el-table-column label="完成时间" min-width="70px" align="center" prop="intime" />
  156. <el-table-column label="过程时间" min-width="70px" align="center" prop="proesstime" />
  157. <el-table-column label="跳转方式" min-width="70px" align="center" prop="buttontype" />
  158. <el-table-column label="开始重量" min-width="70px" align="center" prop="lastactualweight" />
  159. <el-table-column label="结束重量" min-width="70px" align="center" prop="actualweight" />
  160. </el-table>
  161. </div>
  162. <div class="ControlChart">
  163. <h4>监控图</h4>
  164. <div id="chartLine" style="width: 100%;height:300px;" />
  165. </div>
  166. </el-col>
  167. <!-- 剩料计划 -->
  168. <el-col v-if="isResidualMaterialPlan" :span="16">
  169. <h4>过程详情-剩料计划</h4>
  170. <div class="detail">
  171. <div class="detail-t">
  172. 过程时间:<span v-if="table2.list.length !== 0">{{ table2.list[0].proesstime }}</span>;
  173. 工作状态:<span v-if="table2.list.length !== 0">{{ table2.list[0].iscompleted }}</span>
  174. </div>
  175. <div class="detail-b" />
  176. </div>
  177. <div class="Mixture">
  178. <h4>剩料收集详情</h4>
  179. <el-table
  180. :key="table3.tableKey"
  181. v-loading="table3.listLoading"
  182. element-loading-text="给我一点时间"
  183. :data="table3.list"
  184. border
  185. fit
  186. highlight-current-row
  187. style="width: 100%;"
  188. :row-style="rowStyle"
  189. :cell-style="cellStyle"
  190. class="elTable table-fixed"
  191. height="200px"
  192. >
  193. <el-table-column label="操作编号" min-width="110px" align="center" prop="sort" />
  194. <el-table-column label="栏舍名称" min-width="110px" align="center" prop="fname" />
  195. <el-table-column label="剩料采集重量(kg)" min-width="110px" align="center" prop="sweight" />
  196. </el-table>
  197. </div>
  198. <div class="SpreadingMaterials">
  199. <h4>撒料详情</h4>
  200. <el-table
  201. :key="table4.tableKey"
  202. v-loading="table4.listLoading"
  203. :span-method="objectSpanMethod"
  204. element-loading-text="给我一点时间"
  205. :data="table4.list"
  206. border
  207. fit
  208. highlight-current-row
  209. style="width: 100%;"
  210. :row-style="rowStyle"
  211. :cell-style="cellStyle"
  212. class="elTable table-fixed"
  213. height="200px"
  214. >
  215. <el-table-column label="操作编号" min-width="110px" align="center" prop="sort" />
  216. <el-table-column label="转投栏舍" min-width="110px" align="center" prop="fname" />
  217. <el-table-column label="允许分配剩料量" min-width="110px" align="center" prop="lweight" />
  218. <el-table-column label="实际分配重量(kg)" min-width="110px" align="center" prop="actualweightminus" />
  219. <el-table-column label="废弃剩料重量" min-width="110px" align="center" prop="aweight" />
  220. </el-table>
  221. </div>
  222. </el-col>
  223. </el-row>
  224. </div>
  225. </template>
  226. <script>
  227. import echarts from 'echarts'
  228. require('echarts/theme/macarons')
  229. import { GetDataByName, GetReportform, GetDataByNames } from '@/api/common'
  230. import Cookies from 'js-cookie'
  231. import { parseTime } from '@/utils/index.js'
  232. export default {
  233. name: 'GroupProcessAnalysis',
  234. data() {
  235. return {
  236. isPremixedPlan: '', // 预混计划
  237. isSpreadingPlan: '', // 撒料计划
  238. isResidualMaterialPlan: '', // 剩料计划
  239. pickerMinDate: '',
  240. Beforedisabled: false,
  241. Nextdisabled: false,
  242. pickerOptions: {
  243. onPick: ({ maxDate, minDate }) => {
  244. this.pickerMinDate = minDate.getTime()
  245. if (maxDate) {
  246. this.pickerMinDate = ''
  247. }
  248. },
  249. // 限制不能选择今天之后的日期
  250. disabledDate: (time) => {
  251. if (this.pickerMinDate !== '') {
  252. const one = 31 * 24 * 3600 * 1000
  253. const minTime = this.pickerMinDate - one
  254. let maxTime = this.pickerMinDate + one
  255. if (maxTime > new Date()) {
  256. maxTime = new Date()
  257. }
  258. return time.getTime() < minTime || time.getTime() > maxTime
  259. }
  260. return time.getTime() > Date.now()
  261. }
  262. },
  263. requestParams: [
  264. { name: 'getPastureListJT', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid'), pasturename: '' }}
  265. ],
  266. pastureList: [], // 牧场
  267. planTypeList: [{ lable: '预混计划', value: '4' }, { lable: '撒料计划', value: '0' }, { lable: '剩料计划', value: '3' }, { lable: '撒料计划-混料', value: '1' }, { lable: '撒料计划-撒料', value: '2' }, { lable: '预称重计划', value: '5' }], // 计划类型
  268. workingConditionList: [{ id: '0', name: '进行中' }, { id: '1', name: '已完成' }], // 工作状态
  269. // TMR设备列表
  270. table: {
  271. getdataListParm: {
  272. name: 'getprocessAnalysis',
  273. page: 1,
  274. offset: 1,
  275. pagecount: '',
  276. returntype: 'Map',
  277. parammaps: {
  278. pastureid: '',
  279. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  280. stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
  281. // startTime: '2020-09-15',
  282. // stopTime: '2020-09-16',
  283. inputDatetime: [new Date(), new Date()],
  284. iscompleted: '',
  285. tmrtname: '',
  286. lpplantype: ''
  287. }
  288. },
  289. tableKey: 0,
  290. list: [],
  291. total: 0,
  292. listLoading: false
  293. },
  294. // 过程详情
  295. table2: {
  296. getdataListParm: {
  297. name: 'getprocessAnalysisStr',
  298. page: 1,
  299. offset: 1,
  300. pagecount: 1,
  301. returntype: 'Map',
  302. parammaps: {
  303. pastureid: Cookies.get('pastureid'),
  304. id: ''
  305. }
  306. },
  307. tableKey: 0,
  308. list: [],
  309. total: 0,
  310. listLoading: true
  311. },
  312. // 混料详情
  313. table3: {
  314. getdataListParm: {
  315. name: 'getprocessAnalysisHL',
  316. page: 1,
  317. offset: 1,
  318. pagecount: '',
  319. returntype: 'Map',
  320. parammaps: {
  321. pastureid: Cookies.get('pastureid'),
  322. id: ''
  323. }
  324. },
  325. tableKey: 0,
  326. list: [],
  327. total: 0,
  328. listLoading: true
  329. },
  330. // 撒料详情
  331. table4: {
  332. getdataListParm: {
  333. name: 'getprocessAnalysisSL',
  334. page: 1,
  335. offset: 1,
  336. pagecount: '',
  337. returntype: 'Map',
  338. parammaps: {
  339. pastureid: Cookies.get('pastureid'),
  340. id: ''
  341. }
  342. },
  343. tableKey: 0,
  344. list: [],
  345. total: 0,
  346. listLoading: true
  347. },
  348. chart1: {
  349. getdataListParm: {
  350. name: 'getprocessAnalysisTB',
  351. page: 1,
  352. offset: 1,
  353. pagecount: '',
  354. returntype: 'Map',
  355. parammaps: {
  356. pastureid: Cookies.get('pastureid'),
  357. id: ''
  358. }
  359. },
  360. tableKey: 0,
  361. list: [],
  362. total: 0,
  363. listLoading: false,
  364. chartLine_data: []
  365. },
  366. chartLine: null,
  367. chartLine_data: {},
  368. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  369. cellStyle: { padding: 0 + 'px' }
  370. }
  371. },
  372. created() {
  373. this.getDownList()
  374. // this.getTimeFn()
  375. },
  376. methods: {
  377. getDownList() {
  378. GetDataByNames(this.requestParams).then(response => {
  379. this.pastureList = response.data.getPastureListJT.list
  380. this.table.getdataListParm.parammaps.pastureid = response.data.getPastureListJT.list[0].pastureid
  381. this.getList()
  382. })
  383. },
  384. // TMR设备列表
  385. getList() {
  386. this.table.listLoading = true
  387. GetDataByName(this.table.getdataListParm).then(response => {
  388. console.log('TMR设备列表table数据', response.data.list)
  389. if (response.data.list !== null) {
  390. this.table.list = response.data.list
  391. if (response.data.list[0].lpplantype == '预混计划') {
  392. this.isPremixedPlan = true
  393. this.isSpreadingPlan = false
  394. this.isResidualMaterialPlan = false
  395. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  396. this.table3.getdataListParm.parammaps.pid = response.data.list[0].id
  397. this.getList2()
  398. this.getList3()
  399. } else if (response.data.list[0].lpplantype == '剩料计划') {
  400. this.isResidualMaterialPlan = true
  401. this.isPremixedPlan = false
  402. this.isSpreadingPlan = false
  403. this.table2.getdataListParm.name = 'getprocessAnalysisStrSH'
  404. this.table3.getdataListParm.name = 'getprocessAnalysisHLSH'
  405. this.table4.getdataListParm.name = 'getprocessAnalysisSLSH'
  406. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  407. this.table3.getdataListParm.parammaps.pid = response.data.list[0].id
  408. this.table4.getdataListParm.parammaps.pid = response.data.list[0].id
  409. this.getList2()
  410. this.getList3()
  411. this.getList4()
  412. } else {
  413. // 撒料
  414. this.isSpreadingPlan = true
  415. this.isResidualMaterialPlan = false
  416. this.isPremixedPlan = false
  417. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  418. this.table3.getdataListParm.parammaps.pid = response.data.list[0].id
  419. this.table4.getdataListParm.parammaps.pid = response.data.list[0].id
  420. this.getList2()
  421. this.getList3()
  422. this.getList4()
  423. this.chart1.getdataListParm.parammaps.pid = response.data.list[0].id
  424. this.getChart1()
  425. }
  426. } else {
  427. this.table.list = []
  428. this.table2.list = []
  429. this.table3.list = []
  430. this.table2.listLoading = false
  431. this.table3.listLoading = false
  432. this.table4.listLoading = false
  433. this.chart1.listLoading = false
  434. }
  435. setTimeout(() => {
  436. this.table.listLoading = false
  437. }, 100)
  438. })
  439. },
  440. handleSearch() {
  441. console.log('点击了查询')
  442. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  443. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  444. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  445. } else {
  446. this.table.getdataListParm.parammaps.inputDatetime = ''
  447. this.table.getdataListParm.parammaps.startTime = ''
  448. this.table.getdataListParm.parammaps.stopTime = ''
  449. }
  450. this.table.getdataListParm.offset = 1
  451. this.getList()
  452. },
  453. handleRefresh() {
  454. console.log('点击了重置')
  455. this.table.getdataListParm.parammaps.tmrtname = ''
  456. this.table.getdataListParm.parammaps.iscompleted = ''
  457. this.table.getdataListParm.parammaps.lpplantype = ''
  458. this.table.getdataListParm.parammaps.startTime = ''
  459. this.table.getdataListParm.parammaps.stopTime = ''
  460. this.table.getdataListParm.parammaps.inputDatetime = ''
  461. this.table.getdataListParm.offset = 1
  462. this.getList()
  463. },
  464. handleBefore() {
  465. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  466. var start = new Date(this.table.getdataListParm.parammaps.inputDatetime[0].setDate(this.table.getdataListParm.parammaps.inputDatetime[0].getDate() - 1))
  467. var stop = new Date(this.table.getdataListParm.parammaps.inputDatetime[1].setDate(this.table.getdataListParm.parammaps.inputDatetime[1].getDate() - 1))
  468. if (stop > Date.now()) {
  469. this.Nextdisabled = true
  470. this.Beforedisabled = false
  471. } else {
  472. this.Nextdisabled = false
  473. this.Beforedisabled = false
  474. }
  475. this.table.getdataListParm.parammaps.inputDatetime.length = 0
  476. this.table.getdataListParm.parammaps.inputDatetime.push(start, stop)
  477. this.$forceUpdate()
  478. }
  479. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  480. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  481. this.getList()
  482. },
  483. handleNext() {
  484. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  485. var start2 = new Date(this.table.getdataListParm.parammaps.inputDatetime[0].setDate(this.table.getdataListParm.parammaps.inputDatetime[0].getDate() + 1))
  486. var stop2 = new Date(this.table.getdataListParm.parammaps.inputDatetime[1].setDate(this.table.getdataListParm.parammaps.inputDatetime[1].getDate() + 1))
  487. if (stop2 > Date.now()) {
  488. this.Nextdisabled = true
  489. this.Beforedisabled = false
  490. } else {
  491. this.Nextdisabled = false
  492. this.Beforedisabled = false
  493. }
  494. this.table.getdataListParm.parammaps.inputDatetime.length = 0
  495. this.table.getdataListParm.parammaps.inputDatetime.push(start2, stop2)
  496. this.$forceUpdate()
  497. }
  498. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  499. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  500. this.getList()
  501. },
  502. rowClick(row, column, event) {
  503. this.table2.getdataListParm.parammaps.id = row.id
  504. this.table3.getdataListParm.parammaps.pid = row.id
  505. this.table4.getdataListParm.parammaps.pid = row.id
  506. this.chart1.getdataListParm.parammaps.pid = row.id
  507. if (row.lpplantype == '预混计划') {
  508. this.isPremixedPlan = true
  509. this.isResidualMaterialPlan = false
  510. this.isSpreadingPlan = false
  511. this.table2.getdataListParm.name = 'getprocessAnalysisStr'
  512. this.table3.getdataListParm.name = 'getprocessAnalysisHL'
  513. this.getList2()
  514. this.getList3()
  515. } else if (row.lpplantype == '剩料计划') {
  516. this.isResidualMaterialPlan = true
  517. this.isPremixedPlan = false
  518. this.isSpreadingPlan = false
  519. this.table2.getdataListParm.name = 'getprocessAnalysisStrSH'
  520. this.table3.getdataListParm.name = 'getprocessAnalysisHLSH'
  521. this.table4.getdataListParm.name = 'getprocessAnalysisSLSH'
  522. this.getList2()
  523. this.getList3()
  524. this.getList4()
  525. } else {
  526. this.isSpreadingPlan = true
  527. this.isPremixedPlan = false
  528. this.isResidualMaterialPlan = false
  529. this.table2.getdataListParm.name = 'getprocessAnalysisStr'
  530. this.table3.getdataListParm.name = 'getprocessAnalysisHL'
  531. this.table4.getdataListParm.name = 'getprocessAnalysisSL'
  532. this.getList2()
  533. this.getList3()
  534. this.getList4()
  535. this.getChart1()
  536. }
  537. },
  538. // 过程详情
  539. getList2() {
  540. this.table2.listLoading = false
  541. GetDataByName(this.table2.getdataListParm).then(response => {
  542. console.log('过程详情table数据', response.data.list)
  543. if (response.data.list !== null) {
  544. this.table2.list = response.data.list
  545. } else {
  546. this.table2.list = []
  547. }
  548. setTimeout(() => {
  549. this.table2.listLoading = false
  550. }, 100)
  551. })
  552. },
  553. // 混料详情
  554. getList3() {
  555. this.table3.listLoading = false
  556. GetDataByName(this.table3.getdataListParm).then(response => {
  557. console.log('混料详情table数据', response.data.list)
  558. if (response.data.list !== null) {
  559. this.table3.list = response.data.list
  560. } else {
  561. this.table3.list = []
  562. }
  563. setTimeout(() => {
  564. this.table3.listLoading = false
  565. }, 100)
  566. })
  567. },
  568. // 撒料详情
  569. getList4() {
  570. this.table4.listLoading = false
  571. GetDataByName(this.table4.getdataListParm).then(response => {
  572. console.log('撒料详情table数据', response.data.list)
  573. if (response.data.list !== null) {
  574. this.table4.list = response.data.list
  575. this.rowspan()
  576. } else {
  577. this.table4.list = []
  578. }
  579. setTimeout(() => {
  580. this.table4.listLoading = false
  581. }, 100)
  582. })
  583. },
  584. rowspan() {
  585. this.spanArr = []
  586. this.table4.list.forEach((item, index) => {
  587. if (index == 0) {
  588. this.spanArr.push(1)
  589. this.position = 0
  590. } else {
  591. console.log(item, index, '======')
  592. if (this.table4.list[index].aweight == this.table4.list[index - 1].aweight) {
  593. this.spanArr[this.position] += 1
  594. this.spanArr.push(0)
  595. } else {
  596. this.spanArr.push(1)
  597. this.position = index
  598. }
  599. }
  600. })
  601. },
  602. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  603. if (columnIndex == 4) {
  604. const _row = this.spanArr[rowIndex]
  605. const _col = _row > 0 ? 1 : 0
  606. return {
  607. rowspan: _row,
  608. colspan: _col
  609. }
  610. }
  611. },
  612. getChart1() {
  613. this.chart1.listLoading = true
  614. GetReportform(this.chart1.getdataListParm).then(response => {
  615. if (response.data.list !== null) {
  616. this.chart1.list = response.data.data
  617. console.log('实时监控', response.data.list)
  618. // console.log('实时监控', response.data.list.data4)
  619. var evenNumbers = []// 偶数
  620. var oddNumbers = []// 奇数
  621. for (let i = 0; i < response.data.list.data4.length; i++) {
  622. console.log(response.data.list.data4[i])
  623. if (i == 0) {
  624. oddNumbers.push(response.data.list.data4[i])
  625. } else {
  626. if (i % 2 == 0) {
  627. evenNumbers.push(response.data.list.data4[i])
  628. } else {
  629. oddNumbers.push(response.data.list.data4[i])
  630. }
  631. }
  632. }
  633. response.data.list.data4 = oddNumbers
  634. response.data.list.data5 = evenNumbers
  635. // response.data.list.data1 = ['06:34:10', '06:34:11', '06:34:12', '06:34:13', '06:34:14', '06:34:14', '06:34:15', '06:34:16', '06:34:17', '06:34:18', '06:34:19', '06:34:20', '06:34:21', '06:34:22', '06:34:23', '06:34:29', '06:34:44', '06:34:59', '06:35:14', '06:35:29', '06:35:44', '06:35:59', '06:36:14', '06:36:29', '06:36:44', '06:36:59', '06:37:14', '06:37:28', '06:37:29', '06:37:44', '06:37:59', '06:38:14', '06:38:29', '06:38:44', '06:38:59', '06:38:59', '06:39:14', '06:39:29', '06:39:44', '06:39:59', '06:40:08', '06:40:14', '06:40:29', '06:40:44', '06:40:59', '06:41:14', '06:41:29', '06:41:40', '06:41:44', '06:41:59', '06:42:14', '06:42:29', '06:42:44', '06:42:59', '06:43:09', '06:43:14', '06:43:29', '06:43:44', '06:43:59', '06:44:14', '06:44:29', '06:44:44'],
  636. // response.data.list.data2 = [
  637. // { 'value': '141.6', 'myname': 'A1' },
  638. // { 'value': '141.6', 'myname': 'A1' },
  639. // { 'value': '141.6', 'myname': 'A1' },
  640. // { 'value': '141.6', 'myname': 'A1' },
  641. // { 'value': '141.6', 'myname': 'A1' },
  642. // { 'value': '141.6', 'myname': 'A1' },
  643. // { 'value': '141.6', 'myname': 'A1' },
  644. // { 'value': '141.6', 'myname': 'A1' },
  645. // { 'value': '141.6', 'myname': 'A1' },
  646. // { 'value': '141.6', 'myname': 'A1' },
  647. // { 'value': '141.6', 'myname': 'A1' },
  648. // { 'value': '141.6', 'myname': 'A1' },
  649. // { 'value': '141.6', 'myname': 'A1' },
  650. // { 'value': '141.6', 'myname': 'A1' },
  651. // { 'value': '141.6', 'myname': 'A1' },
  652. // { 'value': '141.6', 'myname': 'A1' },
  653. // { 'value': '141.6', 'myname': 'A1' },
  654. // { 'value': '141.6', 'myname': 'A1' },
  655. // { 'value': '141.6', 'myname': 'A1' },
  656. // { 'value': '141.6', 'myname': 'A1' },
  657. // { 'value': '141.6', 'myname': 'A1' },
  658. // { 'value': '141.6', 'myname': 'A1' },
  659. // { 'value': '141.6', 'myname': 'A1' },
  660. // { 'value': '141.6', 'myname': 'A1' },
  661. // { 'value': '141.6', 'myname': 'A1' },
  662. // { 'value': '141.6', 'myname': 'A1' },
  663. // { 'value': '141.6', 'myname': 'A1' },
  664. // { 'value': '141.6', 'myname': 'A1' },
  665. // { 'value': '341.46', 'myname': 'B1' },
  666. // { 'value': '341.46', 'myname': 'B1' },
  667. // { 'value': '341.46', 'myname': 'B1' },
  668. // { 'value': '341.46', 'myname': 'B1' },
  669. // { 'value': '341.46', 'myname': 'B1' },
  670. // { 'value': '341.46', 'myname': 'B1' },
  671. // { 'value': '341.46', 'myname': 'B1' },
  672. // { 'value': '437.73', 'myname': 'C1' },
  673. // { 'value': '437.73', 'myname': 'C1' },
  674. // { 'value': '437.73', 'myname': 'C1' },
  675. // { 'value': '437.73', 'myname': 'C1' },
  676. // { 'value': '437.73', 'myname': 'C1' },
  677. // { 'value': '437.73', 'myname': 'C1' },
  678. // { 'value': '437.73', 'myname': 'C1' },
  679. // { 'value': '687.33', 'myname': 'C1' },
  680. // { 'value': '687.33', 'myname': 'C1' },
  681. // { 'value': '687.33', 'myname': 'C1' },
  682. // { 'value': '687.33', 'myname': 'C1' },
  683. // { 'value': '687.33', 'myname': 'C1' },
  684. // { 'value': '687.33', 'myname': 'C1' },
  685. // { 'value': '687.33', 'myname': 'C1' },
  686. // { 'value': '959.24', 'myname': 'D1' },
  687. // { 'value': '959.24', 'myname': 'D1' },
  688. // { 'value': '959.24', 'myname': 'D1' },
  689. // { 'value': '959.24', 'myname': 'D1' },
  690. // { 'value': '959.24', 'myname': 'D1' },
  691. // { 'value': '959.24', 'myname': 'D1' },
  692. // { 'value': '959.24', 'myname': 'D1' },
  693. // { 'value': '959.24', 'myname': 'D1' },
  694. // { 'value': '1107.6', 'myname': 'D1' },
  695. // { 'value': '1107.6', 'myname': 'D1' },
  696. // { 'value': '1107.6', 'myname': 'D1' },
  697. // { 'value': '1107.6', 'myname': 'D1' },
  698. // { 'value': '1107.6', 'myname': 'D1' },
  699. // { 'value': '1107.6', 'myname': 'D1' },
  700. // { 'value': '1107.6', 'myname': 'D1' },
  701. // { 'value': '1107.6', 'myname': 'D1' }
  702. // ]
  703. // response.data.list.data3 = [-8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -11, -9, -4, -8, -10, -8, -8, 0, -1, 32, 88, 142, 143, 141, 154, 215, 250, 256, 338, 337, 329, 325, 409, 420, 438, 434, 432, 447, 439, 496, 655, 680, 678, 670, 669, 741, 752, 924],
  704. this.chart1.chartLine_data = response.data.list
  705. this.chart1.total = response.data.total
  706. this.roadChartLine1(this.chart1.chartLine_data)
  707. } else {
  708. this.chart1.list = []
  709. }
  710. setTimeout(() => {
  711. this.chart1.listLoading = false
  712. }, 100)
  713. })
  714. },
  715. roadChartLine1(chartLine_data) {
  716. console.log(chartLine_data, 'chartLine_data')
  717. if (this.chartLine != null) {
  718. this.chartLine.dispose()
  719. }
  720. this.chartLine = echarts.init(document.getElementById('chartLine'))
  721. var option = {
  722. title: { text: '', subtext: '' },
  723. color: ['#38c193', '#5199e5', '#fdb06a', '#fb8b73'], // 关键加上这句话,legend的颜色和折线的自定义颜色就一致了
  724. legend: [{
  725. itemWidth: 15, itemHeight: 7, right: '25%', textStyle: { fontSize: 12 },
  726. data: [{ name: '设计重量' }, { name: '实际重量' }]
  727. }, {
  728. itemWidth: 15, itemHeight: 15, right: '0', textStyle: { fontSize: 12 },
  729. data: [{ name: '开始重量', icon: 'image://https://kptyun.cn:8081/file/pic/3.png' }, { name: '结束重量', icon: 'image://https://kptyun.cn:8081/file/pic/4.png' }]
  730. }],
  731. tooltip: {
  732. trigger: 'axis',
  733. formatter: function(params) {
  734. // console.log(params, 'params')
  735. var tip = params[0].name
  736. for (let i = 0; i < params.length; i++) {
  737. tip += '<br>' + params[i].seriesName + ': '
  738. if (params[i].value[0] == params[0].name) {
  739. tip += params[i].value[1]
  740. } else {
  741. tip += params[i].value
  742. }
  743. }
  744. tip += '<br>' + params[0].data[2] + params[0].data[3]
  745. console.log(tip, 'tip')
  746. return tip
  747. }
  748. },
  749. calculable: true,
  750. xAxis: [
  751. { type: 'category', splitLine: { show: false }, name: '时间', data: chartLine_data.data1, axisLabel: { show: true, textStyle: { color: '#666' }}}
  752. ],
  753. yAxis: [{ type: 'value' }],
  754. series: [
  755. { symbol: 'none', name: '实际重量', type: 'line', data: chartLine_data.data3, smooth: true, barWidth: '37', itemStyle: { normal: { lineStyle: { color: '#38c193' }}}},
  756. { symbol: 'none', name: '设计重量', type: 'line', step: 'middle', data: chartLine_data.data2 },
  757. { name: '开始重量', symbol: 'image://https://kptyun.cn:8081/file/pic/3.png', symbolSize: 10, type: 'scatter', data: chartLine_data.data4 },
  758. { name: '结束重量', symbol: 'image://https://kptyun.cn:8081/file/pic/4.png', symbolSize: 10, type: 'scatter', data: chartLine_data.data5 }
  759. ]
  760. }
  761. this.chartLine.setOption(option)
  762. window.onresize = function() {
  763. this.chartLine.resize()
  764. }
  765. }
  766. }
  767. }
  768. </script>
  769. <style lang="scss" scoped>
  770. .search{padding-top:10px;clear: both;}
  771. .table{margin-top:10px;}
  772. .detail{
  773. height:84px;border: 1px solid #EBEEF5;padding-left:10px;font:16px/32px '';color:#333;
  774. .detail-t{margin-top: 10px;}
  775. .detail-b{margin-bottom: 10px;}
  776. }
  777. </style>