251277cedffeac861ac8ce3f593d4661694cd23c.svn-base 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  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;" :picker-options="pickerOptions" />
  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. pickerMinDate: '',
  235. pickerOptions: {
  236. onPick: ({ maxDate, minDate }) => {
  237. this.pickerMinDate = minDate.getTime()
  238. if (maxDate) {
  239. this.pickerMinDate = ''
  240. }
  241. },
  242. // 限制不能选择今天之后的日期
  243. disabledDate: (time) => {
  244. if (this.pickerMinDate !== '') {
  245. const one = 31 * 24 * 3600 * 1000
  246. const minTime = this.pickerMinDate - one
  247. let maxTime = this.pickerMinDate + one
  248. if (maxTime > new Date()) {
  249. maxTime = new Date()
  250. }
  251. return time.getTime() < minTime || time.getTime() > maxTime
  252. }
  253. return time.getTime() > Date.now()
  254. }
  255. },
  256. requestParams: [
  257. { name: 'getBarListEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }},
  258. { name: 'getCowclassListEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }}
  259. ],
  260. planTypeList: [{ id: '3', name: '预混计划' }, { id: '2', name: '撒料计划' }, { id: '4', name: '剩料计划' }], // 计划类型
  261. workingConditionList: [{ id: '0', name: '进行中' }, { id: '1', name: '已完成' }], // 工作状态
  262. // TMR设备列表
  263. table: {
  264. getdataListParm: {
  265. name: 'getprocessAnalysis',
  266. page: 1,
  267. offset: 1,
  268. pagecount: '',
  269. returntype: 'Map',
  270. parammaps: {
  271. pastureid: Cookies.get('pastureid'),
  272. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  273. stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
  274. // startTime: '2020-09-15',
  275. // stopTime: '2020-09-16',
  276. inputDatetime: [new Date(), new Date()],
  277. iscompleted: '',
  278. tmrtname: ''
  279. }
  280. },
  281. tableKey: 0,
  282. list: [],
  283. total: 0,
  284. listLoading: true
  285. },
  286. // 过程详情
  287. table2: {
  288. getdataListParm: {
  289. name: 'getprocessAnalysisStr',
  290. page: 1,
  291. offset: 1,
  292. pagecount: 1,
  293. returntype: 'Map',
  294. parammaps: {
  295. pastureid: Cookies.get('pastureid'),
  296. id: ''
  297. }
  298. },
  299. tableKey: 0,
  300. list: [],
  301. total: 0,
  302. listLoading: true
  303. },
  304. // 混料详情
  305. table3: {
  306. getdataListParm: {
  307. name: 'getprocessAnalysisHL',
  308. page: 1,
  309. offset: 1,
  310. pagecount: '',
  311. returntype: 'Map',
  312. parammaps: {
  313. pastureid: Cookies.get('pastureid'),
  314. id: ''
  315. }
  316. },
  317. tableKey: 0,
  318. list: [],
  319. total: 0,
  320. listLoading: true
  321. },
  322. // 撒料详情
  323. table4: {
  324. getdataListParm: {
  325. name: 'getprocessAnalysisSL',
  326. page: 1,
  327. offset: 1,
  328. pagecount: '',
  329. returntype: 'Map',
  330. parammaps: {
  331. pastureid: Cookies.get('pastureid'),
  332. id: ''
  333. }
  334. },
  335. tableKey: 0,
  336. list: [],
  337. total: 0,
  338. listLoading: true
  339. },
  340. chart1: {
  341. getdataListParm: {
  342. name: 'getprocessAnalysisTB',
  343. page: 1,
  344. offset: 1,
  345. pagecount: '',
  346. returntype: 'Map',
  347. parammaps: {
  348. pastureid: Cookies.get('pastureid'),
  349. id: ''
  350. }
  351. },
  352. tableKey: 0,
  353. list: [],
  354. total: 0,
  355. listLoading: false,
  356. chartLine_data: []
  357. },
  358. chartLine: null,
  359. chartLine_data: {},
  360. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  361. cellStyle: { padding: 0 + 'px' }
  362. }
  363. },
  364. created() {
  365. this.getList()
  366. // this.getTimeFn()
  367. },
  368. methods: {
  369. // getTimeFn() {
  370. // const that = this
  371. // const start2 = new Date()
  372. // const end2 = new Date()
  373. // start2.setTime(start2.getTime() - 3600 * 1000 * 24 * 1)
  374. // end2.setTime(end2.getTime() - 3600 * 1000 * 24 * 1)
  375. // that.table.getdataListParm.parammaps.inputDatetime[0] = parseTime(start2, '{y}-{m}-{d}')
  376. // that.table.getdataListParm.parammaps.inputDatetime[1] = parseTime(end2, '{y}-{m}-{d}')
  377. // that.table.getdataListParm.parammaps.startTime = parseTime(start2, '{y}-{m}-{d}')
  378. // that.table.getdataListParm.parammaps.stopTime = parseTime(end2, '{y}-{m}-{d}')
  379. // },
  380. // TMR设备列表
  381. getList() {
  382. this.table.listLoading = true
  383. GetDataByName(this.table.getdataListParm).then(response => {
  384. console.log('TMR设备列表table数据', response.data.list)
  385. if (response.data.list !== null) {
  386. this.table.list = response.data.list
  387. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  388. this.table3.getdataListParm.parammaps.pid = response.data.list[0].id
  389. this.table4.getdataListParm.parammaps.pid = response.data.list[0].id
  390. this.chart1.getdataListParm.parammaps.pid = response.data.list[0].id
  391. this.getList2()
  392. this.getList3()
  393. this.getList4()
  394. this.getChart1()
  395. } else {
  396. this.table.list = []
  397. this.table2.list = []
  398. this.table3.list = []
  399. this.table2.listLoading = false
  400. this.table3.listLoading = false
  401. this.table4.listLoading = false
  402. this.chart1.listLoading = false
  403. }
  404. setTimeout(() => {
  405. this.table.listLoading = false
  406. }, 100)
  407. })
  408. },
  409. handleSearch() {
  410. console.log('点击了查询')
  411. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  412. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  413. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  414. } else {
  415. this.table.getdataListParm.parammaps.inputDatetime = ''
  416. this.table.getdataListParm.parammaps.startTime = ''
  417. this.table.getdataListParm.parammaps.stopTime = ''
  418. }
  419. this.table.getdataListParm.offset = 1
  420. this.getList()
  421. },
  422. handleRefresh() {
  423. console.log('点击了重置')
  424. this.table.getdataListParm.parammaps.tmrtname = ''
  425. this.table.getdataListParm.parammaps.iscompleted = ''
  426. this.table.getdataListParm.parammaps.pid = ''
  427. this.table.getdataListParm.parammaps.startTime = ''
  428. this.table.getdataListParm.parammaps.stopTime = ''
  429. this.table.getdataListParm.parammaps.inputDatetime = ''
  430. this.table.getdataListParm.offset = 1
  431. this.getList()
  432. },
  433. rowClick(row, column, event) {
  434. this.table2.getdataListParm.parammaps.id = row.id
  435. this.table3.getdataListParm.parammaps.pid = row.id
  436. this.table4.getdataListParm.parammaps.pid = row.id
  437. this.chart1.getdataListParm.parammaps.pid = row.id
  438. this.getList2()
  439. this.getList3()
  440. this.getList4()
  441. this.getChart1()
  442. },
  443. // 过程详情
  444. getList2() {
  445. this.table2.listLoading = true
  446. GetDataByName(this.table2.getdataListParm).then(response => {
  447. console.log('过程详情table数据', response.data.list)
  448. if (response.data.list !== null) {
  449. this.table2.list = response.data.list
  450. } else {
  451. this.table2.list = []
  452. }
  453. setTimeout(() => {
  454. this.table2.listLoading = false
  455. }, 100)
  456. })
  457. },
  458. // 混料详情
  459. getList3() {
  460. this.table3.listLoading = true
  461. GetDataByName(this.table3.getdataListParm).then(response => {
  462. console.log('混料详情table数据', response.data.list)
  463. if (response.data.list !== null) {
  464. this.table3.list = response.data.list
  465. } else {
  466. this.table3.list = []
  467. }
  468. setTimeout(() => {
  469. this.table3.listLoading = false
  470. }, 100)
  471. })
  472. },
  473. // 撒料详情
  474. getList4() {
  475. this.table4.listLoading = true
  476. GetDataByName(this.table4.getdataListParm).then(response => {
  477. console.log('撒料详情table数据', response.data.list)
  478. if (response.data.list !== null) {
  479. this.table4.list = response.data.list
  480. } else {
  481. this.table4.list = []
  482. }
  483. setTimeout(() => {
  484. this.table4.listLoading = false
  485. }, 100)
  486. })
  487. },
  488. getChart1() {
  489. this.chart1.listLoading = true
  490. GetReportform(this.chart1.getdataListParm).then(response => {
  491. if (response.data.list !== null) {
  492. this.chart1.list = response.data.data
  493. console.log('实时监控', response.data.list)
  494. // console.log('实时监控', response.data.list.data4)
  495. var evenNumbers = []// 偶数
  496. var oddNumbers = []// 奇数
  497. for (let i = 0; i < response.data.list.data4.length; i++) {
  498. console.log(response.data.list.data4[i])
  499. if (i == 0) {
  500. oddNumbers.push(response.data.list.data4[i])
  501. } else {
  502. if (i % 2 == 0) {
  503. evenNumbers.push(response.data.list.data4[i])
  504. } else {
  505. oddNumbers.push(response.data.list.data4[i])
  506. }
  507. }
  508. }
  509. response.data.list.data4 = oddNumbers
  510. response.data.list.data5 = evenNumbers
  511. // 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'],
  512. // response.data.list.data2 = [
  513. // { 'value': '141.6', 'myname': 'A1' },
  514. // { 'value': '141.6', 'myname': 'A1' },
  515. // { 'value': '141.6', 'myname': 'A1' },
  516. // { 'value': '141.6', 'myname': 'A1' },
  517. // { 'value': '141.6', 'myname': 'A1' },
  518. // { 'value': '141.6', 'myname': 'A1' },
  519. // { 'value': '141.6', 'myname': 'A1' },
  520. // { 'value': '141.6', 'myname': 'A1' },
  521. // { 'value': '141.6', 'myname': 'A1' },
  522. // { 'value': '141.6', 'myname': 'A1' },
  523. // { 'value': '141.6', 'myname': 'A1' },
  524. // { 'value': '141.6', 'myname': 'A1' },
  525. // { 'value': '141.6', 'myname': 'A1' },
  526. // { 'value': '141.6', 'myname': 'A1' },
  527. // { 'value': '141.6', 'myname': 'A1' },
  528. // { 'value': '141.6', 'myname': 'A1' },
  529. // { 'value': '141.6', 'myname': 'A1' },
  530. // { 'value': '141.6', 'myname': 'A1' },
  531. // { 'value': '141.6', 'myname': 'A1' },
  532. // { 'value': '141.6', 'myname': 'A1' },
  533. // { 'value': '141.6', 'myname': 'A1' },
  534. // { 'value': '141.6', 'myname': 'A1' },
  535. // { 'value': '141.6', 'myname': 'A1' },
  536. // { 'value': '141.6', 'myname': 'A1' },
  537. // { 'value': '141.6', 'myname': 'A1' },
  538. // { 'value': '141.6', 'myname': 'A1' },
  539. // { 'value': '141.6', 'myname': 'A1' },
  540. // { 'value': '141.6', 'myname': 'A1' },
  541. // { 'value': '341.46', 'myname': 'B1' },
  542. // { 'value': '341.46', 'myname': 'B1' },
  543. // { 'value': '341.46', 'myname': 'B1' },
  544. // { 'value': '341.46', 'myname': 'B1' },
  545. // { 'value': '341.46', 'myname': 'B1' },
  546. // { 'value': '341.46', 'myname': 'B1' },
  547. // { 'value': '341.46', 'myname': 'B1' },
  548. // { 'value': '437.73', 'myname': 'C1' },
  549. // { 'value': '437.73', 'myname': 'C1' },
  550. // { 'value': '437.73', 'myname': 'C1' },
  551. // { 'value': '437.73', 'myname': 'C1' },
  552. // { 'value': '437.73', 'myname': 'C1' },
  553. // { 'value': '437.73', 'myname': 'C1' },
  554. // { 'value': '437.73', 'myname': 'C1' },
  555. // { 'value': '687.33', 'myname': 'C1' },
  556. // { 'value': '687.33', 'myname': 'C1' },
  557. // { 'value': '687.33', 'myname': 'C1' },
  558. // { 'value': '687.33', 'myname': 'C1' },
  559. // { 'value': '687.33', 'myname': 'C1' },
  560. // { 'value': '687.33', 'myname': 'C1' },
  561. // { 'value': '687.33', 'myname': 'C1' },
  562. // { 'value': '959.24', 'myname': 'D1' },
  563. // { 'value': '959.24', 'myname': 'D1' },
  564. // { 'value': '959.24', 'myname': 'D1' },
  565. // { 'value': '959.24', 'myname': 'D1' },
  566. // { 'value': '959.24', 'myname': 'D1' },
  567. // { 'value': '959.24', 'myname': 'D1' },
  568. // { 'value': '959.24', 'myname': 'D1' },
  569. // { 'value': '959.24', 'myname': 'D1' },
  570. // { 'value': '1107.6', 'myname': 'D1' },
  571. // { 'value': '1107.6', 'myname': 'D1' },
  572. // { 'value': '1107.6', 'myname': 'D1' },
  573. // { 'value': '1107.6', 'myname': 'D1' },
  574. // { 'value': '1107.6', 'myname': 'D1' },
  575. // { 'value': '1107.6', 'myname': 'D1' },
  576. // { 'value': '1107.6', 'myname': 'D1' },
  577. // { 'value': '1107.6', 'myname': 'D1' }
  578. // ]
  579. // 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],
  580. this.chart1.chartLine_data = response.data.list
  581. this.chart1.total = response.data.total
  582. this.roadChartLine1(this.chart1.chartLine_data)
  583. } else {
  584. this.chart1.list = []
  585. }
  586. setTimeout(() => {
  587. this.chart1.listLoading = false
  588. }, 100)
  589. })
  590. },
  591. roadChartLine1(chartLine_data) {
  592. if (this.chartLine != null) {
  593. this.chartLine.dispose()
  594. }
  595. this.chartLine = echarts.init(document.getElementById('chartLine'))
  596. var option = {
  597. title: {
  598. text: '',
  599. subtext: ''
  600. },
  601. color: ['#ff3131', '#61a5e8', '#ff3131', '#61a5e8'], // 关键加上这句话,legend的颜色和折线的自定义颜色就一致了
  602. legend: {
  603. data: [
  604. { name: '设计重量', icon: 'rectangle' },
  605. { name: '实际重量', icon: 'rectangle' },
  606. // { name: '饲料名称', icon: 'rectangle' },
  607. { name: '开始重量', icon: 'triangle' },
  608. { name: '结束重量', icon: 'triangle' }
  609. ],
  610. right: '20%',
  611. textStyle: {
  612. fontSize: 12,
  613. color: '#666'
  614. }
  615. },
  616. /* grid:{y:15},*/
  617. tooltip: {
  618. trigger: 'axis'
  619. // formatter: function(params) {
  620. // if (params.length > 0) {
  621. // console.log(params)
  622. // for (let i = 0; i < params.length; i++) {
  623. // if (params.length == 1 && params[0].seriesName == '设计重量') {
  624. // return params[0].name + '<br>' + params[i].seriesName + ':' + params[i].value + '<br>饲料名称:' + params[0].data.myname
  625. // } else if (params.length > 1 && params[1].seriesName == '设计重量') {
  626. // return params[0].name + '<br>' + params[i].seriesName + ':' + params[i].value + '<br>饲料名称:' + params[1].data.myname
  627. // } else {
  628. // return params[0].name + '<br>' + params[i].seriesName + ':' + params[i].value
  629. // }
  630. // }
  631. // }
  632. // }
  633. },
  634. calculable: true,
  635. yAxis: [
  636. {
  637. type: 'value',
  638. name: '重量(kg)',
  639. splitLine: { show: false }, // 去除网格线
  640. axisLabel: {
  641. show: true,
  642. textStyle: {
  643. color: '#666' // 这里用参数代替了
  644. }
  645. }
  646. }
  647. ],
  648. xAxis: [
  649. {
  650. type: 'category',
  651. splitLine: { show: false }, // 去除网格线
  652. name: '时间',
  653. data: chartLine_data.data1,
  654. axisLabel: {
  655. show: true,
  656. textStyle: {
  657. color: '#666' // 这里用参数代替了
  658. }
  659. }
  660. }
  661. ],
  662. series: [{
  663. symbol: 'none',
  664. name: '实际重量',
  665. type: 'line',
  666. // step: 'end',
  667. data: chartLine_data.data3,
  668. smooth: true,
  669. barWidth: '37',
  670. itemStyle: {
  671. normal: {
  672. lineStyle: { color: '#ff3131' }
  673. }
  674. }
  675. }, {
  676. symbol: 'none',
  677. name: '设计重量',
  678. type: 'line',
  679. barWidth: '37',
  680. data: chartLine_data.data2,
  681. itemStyle: {
  682. normal: {
  683. lineStyle: { color: '#61a5e8' }
  684. }
  685. }
  686. }, {
  687. name: '开始重量',
  688. symbol: 'triangle',
  689. symbolSize: 10,
  690. type: 'scatter',
  691. data: chartLine_data.data4
  692. }, {
  693. name: '结束重量',
  694. symbol: 'triangle',
  695. symbolSize: 10,
  696. type: 'scatter',
  697. data: chartLine_data.data5
  698. }]
  699. }
  700. this.chartLine.setOption(option)
  701. window.onresize = function() {
  702. this.chartLine.resize()
  703. }
  704. }
  705. }
  706. }
  707. </script>
  708. <style lang="scss" scoped>
  709. .search{padding-top:10px;clear: both;}
  710. .table{margin-top:10px;}
  711. .detail{
  712. height:84px;border: 1px solid #EBEEF5;padding-left:10px;font:16px/32px '';color:#333;
  713. .detail-t{margin-top: 10px;}
  714. .detail-b{margin-bottom: 10px;}
  715. }
  716. </style>