index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <div class="block">
  5. <el-date-picker v-model="monthDate" :clearable="false" type="monthrange" range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份" @change="changeMonth()" />
  6. <el-select v-model="type" placeholder="类型" @change="changeType">
  7. <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id"> </el-option>
  8. </el-select>
  9. </div>
  10. </div>
  11. <el-row v-if="isChart1" style="position: relative;">
  12. <p style="position: absolute;top:-12px;left:40%;color:rgb(130, 165, 252);background:rgb(230, 243, 255);border:1px solid rgb(130, 165, 252);padding:10px;border-radius:10px">
  13. 集团{{costTypeName}}:{{ total }}万元
  14. </p>
  15. <el-radio-group v-model="radio1" class="group" @change="changeGroup">
  16. <el-radio :label="'集团'">集团</el-radio>
  17. <el-radio :label="'一中心'"></el-radio>
  18. <el-radio :label="'二中心'"></el-radio>
  19. <el-radio :label="'三中心'"></el-radio>
  20. </el-radio-group>
  21. <el-col :span="24">
  22. <div id="chart1" style="width: 100%;height:400px;" />
  23. </el-col>
  24. </el-row>
  25. <el-row v-if="isChart1" style="position: relative;">
  26. <el-col :span="24">
  27. <div id="chart2" style="width: 100%;height:400px;" />
  28. </el-col>
  29. </el-row>
  30. <el-row style="position: relative;">
  31. <el-col :span="12">
  32. <div style="height: 50px;" />
  33. <div id="chart4" style="width: 100%;height:400px;" />
  34. </el-col>
  35. <el-col :span="12">
  36. <div style="height: 50px;">
  37. <el-select style="float: right;margin-right: 20px;" v-model="getChart5Parm.parammaps.deptName" placeholder="部门" @change="changeDept('5')">
  38. <el-option v-for="item in deptList" :key="item.id" :label="item.name" :value="item.name"> </el-option>
  39. </el-select>
  40. </div>
  41. <div id="chart5" style="width: 100%;height:400px;" />
  42. </el-col>
  43. </el-row>
  44. <el-row style="position: relative;">
  45. <el-col :span="12">
  46. <div style="height: 50px;">
  47. <el-select style="float: right;margin-right: 20px;" v-model="pastureName" multiple :multiple-limit="5" collapse-tags placeholder="牧场" @change="changePasture()">
  48. <el-option v-for="item in pastureList" :key="item.id" :label="item.name" :value="item.name"> </el-option>
  49. </el-select>
  50. </div>
  51. <div id="chart6" style="width: 100%;height:400px;" />
  52. </el-col>
  53. <el-col :span="12">
  54. <div style="height: 50px;">
  55. <el-select style="float: right;margin-right: 20px;" v-model="getChart7Parm.parammaps.deptName" placeholder="部门" @change="changeDept('7')">
  56. <el-option v-for="item in deptList" :key="item.id" :label="item.name" :value="item.name"> </el-option>
  57. </el-select>
  58. </div>
  59. <div id="chart7" style="width: 100%;height:400px;" />
  60. </el-col>
  61. </el-row>
  62. <el-dialog title="详情" :visible.sync="dialogFormVisibleCard" width="90%" :close-on-click-modal="false">
  63. <div class="app-contentcard">
  64. <el-form ref="rowSeeData" :model="rowSeeData" label-position="right" label-width="120px" style="width: 100%;margin:0 auto;">
  65. <div class="filter-container">
  66. <el-input v-model="getdataListParmSee.parammaps.eqName" placeholder="设备内部编号" clearable class="filter-item" style="width: 130px" />
  67. <el-input v-model="getdataListParmSee.parammaps.assetCode" placeholder="资产编号" clearable class="filter-item" style="width: 130px" />
  68. <el-date-picker ref="inputDatetime" v-model="getdataListParmSee.parammaps.inputDatetime" class="inputDatetime" type="datetimerange" style="width: 250px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="领用开始日期" end-placeholder="领用结束日期" />
  69. <el-button class="filter-item" type="primary" icon="el-icon-search" @click="form_searchDelivery">搜索</el-button>
  70. <el-button class="filter-item" style="margin-left: 10px;" type="success" icon="el-icon-edit" @click="handleDownloadDelivery">导出</el-button>
  71. </div>
  72. </el-form>
  73. <el-table
  74. :key="tableKey"
  75. v-loading="listLoadingSee"
  76. element-loading-text="给我一点时间"
  77. :data="listSee"
  78. border
  79. fit
  80. highlight-current-row
  81. style="width: 100%;"
  82. :row-style="rowStyle"
  83. :cell-style="cellStyle"
  84. class="elTable"
  85. >
  86. <el-table-column label="序号" align="center" type="index" width="50px">
  87. <template slot-scope="scope">
  88. <span>{{ scope.$index + (pageNumSee-1) * pageSizeSee + 1 }}</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="资产编号" min-width="110px" align="center" prop="assetCode" />
  92. <el-table-column label="设备名称" min-width="110px" align="center" prop="eqName" />
  93. <el-table-column label="设备内部编号" min-width="110px" align="center" prop="eqCode" />
  94. <el-table-column label="设备规格" min-width="110px" align="center" prop="eqSpecification" />
  95. <el-table-column label="领用日期" min-width="110px" align="center" prop="receiveTime" />
  96. <el-table-column label="领用部门" min-width="110px" align="center" prop="deptName" />
  97. <el-table-column label="备件编号" min-width="110px" align="center" prop="partCode" />
  98. <el-table-column label="备件名称" min-width="110px" align="center" prop="partName" />
  99. <el-table-column label="备件规格" min-width="110px" align="center" prop="specification" />
  100. <el-table-column label="备件品牌" min-width="110px" align="center" prop="brandName" />
  101. <el-table-column label="计量单位" min-width="110px" align="center" prop="unit" />
  102. <el-table-column label="出库数量" min-width="110px" align="center" prop="checkoutNumber" />
  103. <el-table-column label="退库数量" min-width="110px" align="center" prop="quitNumber" />
  104. <el-table-column label="单价" min-width="110px" align="center" prop="price" />
  105. <el-table-column label="总价" min-width="110px" align="center" prop="sumPrice" />
  106. </el-table>
  107. <pagination v-show="totalSee>=0" :total="totalSee" :page.sync="getdataListParmSee.offset" :limit.sync="getdataListParmSee.pagecount" @pagination="get_table_dataSee" />
  108. <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:10px">
  109. <el-button @click="dialogFormVisibleCard = false">关闭</el-button>
  110. </div>
  111. </div>
  112. </el-dialog>
  113. </div>
  114. </template>
  115. <script>
  116. import echarts from 'echarts'
  117. import { GetDataByName,GetDataByNames, GetReportform, checkButtons,getJson } from '@/api/common'
  118. import Cookies from 'js-cookie'
  119. import { parseTime } from '@/utils/index.js'
  120. import Pagination from '@/components/Pagination' // secondary package based on el-pagination
  121. export default {
  122. name: 'QueryRepair',
  123. components: { Pagination },
  124. data() {
  125. return {
  126. monthDate: [new Date(),new Date()],
  127. costTypeName:'所有维修费',
  128. type:'',
  129. year: new Date().getFullYear(),
  130. month: new Date().getMonth() < 9 ? '0' + (new Date().getMonth() + 1) : new Date().getMonth() + 1,
  131. pastureList:[],
  132. deptList:[{id:0,name:'挤奶处'},{id:1,name:'犊牛处'},{id:2,name:'办公室'},{id:3,name:'饲养处'},{id:4,name:'兽医处'},{id:5,name:'品控处'},{id:6,name:'设备处'}],
  133. // typeList:[{id:0,name:'全部费用'},{id:1,name:'制造费用'},{id:2,name:'直接费用'},{id:3,name:'管理费用'}],
  134. typeList: [{ id: '', name: '全部费用' }, { id: '挤奶处', name: '直接费用' }, { id: '牧场办公室', name: '管理费用' }, { id: 1, name: '制造费用' }],
  135. total: '',
  136. radio1:'集团',
  137. pastureName:'',
  138. isChart1: [],
  139. chart_data1: {},
  140. getChart1Parm: {
  141. name: 'getpSumNowWater',
  142. parammaps: {
  143. receiveTime: new Date().getFullYear(),
  144. pastureName: Cookies.get('pasturename')
  145. }
  146. },
  147. isChart2: [],
  148. chart_data2: {},
  149. getChart2Parm: {
  150. name: 'getpSumNowWater',
  151. parammaps: {
  152. receiveTime: new Date().getFullYear(),
  153. pastureName: Cookies.get('pasturename')
  154. }
  155. },
  156. isChart3: [],
  157. chart_data3: {},
  158. getChart3Parm: {
  159. name: 'getpSumNowWater',
  160. parammaps: {
  161. receiveTime: new Date().getFullYear(),
  162. pastureName: Cookies.get('pasturename')
  163. }
  164. },
  165. isChart4: [],
  166. chart_data4: {},
  167. getChart4Parm: {
  168. name: 'getpSumNowWater',
  169. parammaps: {
  170. receiveTime: new Date().getFullYear(),
  171. pastureName: ''
  172. }
  173. },
  174. isChart5: [],
  175. chart_data5: {},
  176. getChart5Parm: {
  177. name: 'getpSumNowWater',
  178. parammaps: {
  179. receiveTime: new Date().getFullYear(),
  180. pastureName: Cookies.get('pasturename'),
  181. deptName:''
  182. }
  183. },
  184. isChart6: [],
  185. chart_data6: {},
  186. getChart6Parm: {
  187. name: 'getpSumNowWater',
  188. parammaps: {
  189. receiveTime: new Date().getFullYear(),
  190. pastureName: Cookies.get('pasturename')
  191. }
  192. },
  193. isChart7: [],
  194. chart_data7: {},
  195. getChart7Parm: {
  196. name: 'getpSumNowWater',
  197. parammaps: {
  198. receiveTime: new Date().getFullYear(),
  199. pastureName: Cookies.get('pasturename'),
  200. deptName:''
  201. }
  202. },
  203. isChart8: [],
  204. chart_data8: {},
  205. getChart8Parm: {
  206. name: 'getpSumNowWater',
  207. parammaps: {
  208. receiveTime: new Date().getFullYear(),
  209. pastureName: Cookies.get('pasturename')
  210. }
  211. },
  212. tableKey: 0,
  213. list: null,
  214. total: 0,
  215. listLoading: true,
  216. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  217. cellStyle: { padding: 0 + 'px' },
  218. dialogFormVisibleCard: false,
  219. listLoadingSee: true,
  220. rowSeeData: {},
  221. listSee: [],
  222. totalSee: 0,
  223. getdataListParmSee: {
  224. name: 'geteqclassSumDay',
  225. page: 1,
  226. offset: 1,
  227. pagecount: 10,
  228. returntype: 'Map',
  229. parammaps: {
  230. receiveTime: new Date().getFullYear() + '-' + (new Date().getMonth() < 9 ? '0' + (new Date().getMonth() + 1) : new Date().getMonth() + 1),
  231. deptName: '',
  232. typeName: '',
  233. assetCode: '',
  234. eqName: '',
  235. startTime: '',
  236. stopTime: '',
  237. pastureId: Cookies.get('pastureid'),
  238. pastureName: Cookies.get('pasturename')
  239. }
  240. },
  241. }
  242. },
  243. created() {
  244. this.get_select_list()
  245. const that = this
  246. GetDataByName({ 'name': 'getUserPCButtons', 'parammaps': { 'jwt_username': Cookies.get('name') }}).then(response => {
  247. that.buttons = response.data.list
  248. that.get_auto_buttons()
  249. })
  250. },
  251. mounted() {
  252. },
  253. methods: {
  254. get_select_list() {
  255. var send_data = [
  256. { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': 18 }},
  257. ]
  258. this.pastureList = []
  259. GetDataByNames(send_data).then(response => {
  260. response.data.findAllPasture.list.forEach((item)=>{
  261. if(item.name !== '现代牧业'){
  262. this.pastureList.push(item)
  263. }
  264. })
  265. })
  266. },
  267. changeType(item){
  268. console.log(item)
  269. if (item == '挤奶处') {
  270. this.costTypeName = '直接维修费'
  271. } else if (item == '牧场办公室') {
  272. this.costTypeName = '管理维修费'
  273. } else if (item == 1) {
  274. this.costTypeName = '制造维修费'
  275. } else if (item == '') {
  276. this.costTypeName = '所有维修费'
  277. this.type = ''
  278. } else {
  279. this.costTypeName = '所有维修费'
  280. }
  281. if(this.isChart1){
  282. this.getChart1()
  283. this.getChart2()
  284. }else{
  285. this.getChart4()
  286. this.getChart6()
  287. }
  288. },
  289. changeGroup(){
  290. this.getChart1()
  291. this.getChart2()
  292. this.getChart4()
  293. },
  294. changeMonth(){
  295. if(this.isChart1){
  296. this.getChart1()
  297. this.getChart2()
  298. }else{
  299. this.pastureName = [Cookies.get('pasturename')]
  300. this.getChart4()
  301. this.getChart6()
  302. }
  303. },
  304. changePasture(){
  305. // this.getChart4()
  306. this.getChart6()
  307. },
  308. changeDept(item){
  309. if(item == 5){
  310. this.getChart5()
  311. }else if(item == 7){
  312. this.getChart7()
  313. }
  314. },
  315. get_auto_buttons() {
  316. // 图1
  317. const chart1 = 'report:queryWater:pastures'
  318. const isChart1 = checkButtons(this.$store.state.user.buttons, chart1)
  319. this.isChart1 = isChart1
  320. if(this.isChart1){
  321. this.getChart1()
  322. this.getChart2()
  323. }else{
  324. this.pastureName = [Cookies.get('pasturename')]
  325. this.getChart4()
  326. this.getChart6()
  327. }
  328. },
  329. // 各牧场维修费用对比
  330. getChart1() {
  331. let url = '/authdata/repair/nowelectricity?'
  332. let startTime = parseTime(this.monthDate[0],'{y}-{m}')
  333. let endTime = parseTime(this.monthDate[1],'{y}-{m}')
  334. let radio = ''
  335. if(this.radio1 == '集团'){
  336. radio = ''
  337. }else{
  338. radio = this.radio1
  339. }
  340. let data = 'startTime=' + startTime
  341. + '&endTime=' + endTime
  342. + '&center=' + radio
  343. + '&departmentName=' + this.type
  344. getJson(url,data).then(response => {
  345. console.log('各牧场维修费用对比==>图1', response)
  346. if(response.data){
  347. this.chart_data1.data1 = response.data.nowYear
  348. this.chart_data1.data2 = response.data.lastYear
  349. this.chart_data1.xdata = response.data.pasture
  350. this.pastureName = [response.data.pasture[0]]
  351. this.total = response.data.all
  352. }else{
  353. this.chart_data1.data1 = []
  354. this.chart_data1.data2 = []
  355. this.chart_data1.xdata = []
  356. this.total = 0
  357. }
  358. this.roadChart1(this.chart_data1)
  359. this.getChart4()
  360. this.getChart6()
  361. })
  362. },
  363. // 单头牛维修费用
  364. getChart2() {
  365. let url = '/authdata/repair/singlecow?'
  366. let startTime = parseTime(this.monthDate[0],'{y}-{m}')
  367. let endTime = parseTime(this.monthDate[1],'{y}-{m}')
  368. let radio = ''
  369. if(this.radio1 == '集团'){
  370. radio = ''
  371. }else{
  372. radio = this.radio1
  373. }
  374. let data = 'startTime=' + startTime
  375. + '&endTime=' + endTime
  376. + '&center=' + radio
  377. getJson(url,data).then(response => {
  378. console.log('单头牛维修费用==>图2', response)
  379. if(response.data){
  380. this.chart_data2.data1 = response.data.nowYear
  381. this.chart_data2.data2 = response.data.lastYear
  382. this.chart_data2.xdata = response.data.pasture
  383. this.chart_data2.line = response.data.line
  384. }else{
  385. this.chart_data2.data1 = []
  386. this.chart_data2.data2 = []
  387. this.chart_data2.xdata = []
  388. this.chart_data2.line = 0
  389. }
  390. this.roadChart2(this.chart_data2)
  391. })
  392. },
  393. // XX牧场每月维修费对比
  394. getChart4() {
  395. let startTime = parseTime(this.monthDate[0],'{y}-{m}') + '-01'
  396. let date = this.monthDate[1];
  397. let year = date.getFullYear()
  398. let month = date.getMonth() + 1
  399. let lastDay = new Date(year, month, 0).getDate();
  400. let endTime = parseTime(this.monthDate[1],'{y}-{m}') + '-' + lastDay
  401. let data = {
  402. name:"getPastureSumMonth",
  403. parammaps:{
  404. startTime:startTime,
  405. endTime:endTime,
  406. pastureName:this.pastureName.toString(),
  407. departmentName:this.type
  408. },
  409. }
  410. GetReportform(data).then(response => {
  411. console.log('XX牧场每月维修费对比==>图3', response)
  412. if(response.data){
  413. this.chart_data4 = {
  414. data1:response.data.chart_data.lastYear,
  415. data2:response.data.chart_data.nowYear,
  416. data3:response.data.chart_data.monthBudgetList,
  417. xdata:response.data.chart_data.months,
  418. data_name:['去年同期用量','今年用量','预算']
  419. }
  420. }else{
  421. this.chart_data4 = {
  422. data1:[],
  423. data2:[],
  424. data3:[],
  425. xdata:[],
  426. data_name:['去年同期用量','今年用量','预算']
  427. }
  428. }
  429. if(response.data.chart_data.months){
  430. this.getChart5Parm.parammaps.date = response.data.chart_data.months[0]
  431. }else{
  432. this.getChart5Parm.parammaps.date = ''
  433. }
  434. this.roadChart4(this.chart_data4)
  435. this.getChart5Parm.parammaps.deptName = this.deptList[0].name
  436. this.getChart5()
  437. })
  438. },
  439. // XX月部门统计
  440. getChart5() {
  441. console.log(this.getChart5Parm.parammaps.deptName,'deptName')
  442. let startTime = parseTime(this.getChart5Parm.parammaps.date,'{y}-{m}') + '-01'
  443. let date = new Date(this.getChart5Parm.parammaps.date);
  444. let year = date.getFullYear()
  445. let month = date.getMonth() + 1
  446. let lastDay = new Date(year, month, 0).getDate();
  447. let endTime = parseTime(this.getChart5Parm.parammaps.date,'{y}-{m}') + '-' + lastDay
  448. let data = {
  449. name:"geteqclassSumMonth",
  450. parammaps:{
  451. startTime:startTime,
  452. endTime:endTime,
  453. pastureName:this.pastureName.toString(),
  454. deptName:this.getChart5Parm.parammaps.deptName,
  455. },
  456. }
  457. GetReportform(data).then(response => {
  458. console.log('XX部门维修费用==>图4', response)
  459. if(response.data.chart_data){
  460. this.chart_data5 = {
  461. data1:response.data.chart_data.eqCost,
  462. xdata:response.data.chart_data.typeName
  463. }
  464. }else{
  465. this.chart_data5 = {
  466. data1:[],
  467. xdata:[]
  468. }
  469. }
  470. this.roadChart5(this.chart_data5)
  471. })
  472. },
  473. // XX牧场XX年每月用电量对比
  474. getChart6() {
  475. let url = '/authdata/repair/perhead?'
  476. let startTime = parseTime(this.monthDate[0],'{y}-{m}')
  477. let endTime = parseTime(this.monthDate[1],'{y}-{m}')
  478. let radio = ''
  479. if(this.radio1 == '集团'){
  480. radio = ''
  481. }else{
  482. radio = this.radio1
  483. }
  484. let pastureId = []
  485. this.pastureList.forEach((item)=>{
  486. if(this.pastureName){
  487. this.pastureName.forEach((item1)=>{
  488. if(item.name == item1){
  489. pastureId.push(item.id)
  490. }
  491. })
  492. }
  493. })
  494. let data = 'startTime=' + startTime
  495. + '&endTime=' + endTime
  496. + '&center=' + radio
  497. + '&pastureId=' + pastureId.toString()
  498. getJson(url,data).then(response => {
  499. console.log('牧场每月单头牛维修费对比==>图5', response)
  500. if(response.data){
  501. this.chart_data6.data1 = response.data.data3
  502. this.chart_data6.data_name = response.data.data1
  503. this.chart_data6.xdata = response.data.data2
  504. }else{
  505. this.chart_data6.data1 = []
  506. this.chart_data6.data_name = []
  507. this.chart_data6.xdata = []
  508. this.chart_data6.line =0
  509. }
  510. if(response.data.data1 == null){
  511. this.chart_data6.data_name = []
  512. }
  513. if(response.data.data2 == null ){
  514. this.chart_data6.xdata = []
  515. this.getChart7Parm.parammaps.date = ''
  516. }else{
  517. this.getChart7Parm.parammaps.date = response.data.data2[0]
  518. }
  519. if(response.data.data3 == null){
  520. this.chart_data6.data1 = []
  521. }
  522. this.roadChart6(this.chart_data6)
  523. this.getChart7Parm.parammaps.deptName = this.deptList[0].name
  524. this.getChart7()
  525. })
  526. },
  527. // XX月部门统计
  528. getChart7() {
  529. let startTime = parseTime(this.getChart7Parm.parammaps.date,'{y}-{m}') + '-01'
  530. let date = new Date(this.getChart7Parm.parammaps.date);
  531. let year = date.getFullYear()
  532. let month = date.getMonth() + 1
  533. let lastDay = new Date(year, month, 0).getDate();
  534. let endTime = parseTime(this.getChart7Parm.parammaps.date,'{y}-{m}') + '-' + lastDay
  535. let data = {
  536. name:"getdeptSumMonth",
  537. parammaps:{
  538. startTime:startTime,
  539. endTime:endTime,
  540. pastureName:this.pastureName.toString(),
  541. departmentName:this.getChart7Parm.parammaps.deptName
  542. },
  543. }
  544. GetDataByName(data).then(response => {
  545. console.log('XX月部门统计==>图6', response)
  546. // this.chart_data7 = response.data.chart_data
  547. if(response.data){
  548. var data1 = []
  549. var data2 = []
  550. var xdata = []
  551. response.data.list.forEach((item)=>{
  552. data1.push(item.value)
  553. data2.push(item.monthBudget)
  554. xdata.push(item.name)
  555. })
  556. this.chart_data7 = {
  557. data1:data1,
  558. data2:data2,
  559. xdata:xdata
  560. }
  561. }else{
  562. this.chart_data7 = {
  563. data1:[],
  564. data2:[],
  565. xdata:[]
  566. }
  567. }
  568. this.roadChart7(this.chart_data7)
  569. })
  570. },
  571. // 各牧场维修费用对比
  572. roadChart1(chart_data) {
  573. if (this.chart1 != null) {
  574. this.chart1.dispose()
  575. }
  576. this.chart1 = echarts.init(document.getElementById('chart1'))
  577. var option = {
  578. title: { text: '各牧场维修费用对比', textStyle: { color: '#769cfc' }},
  579. tooltip: { trigger: 'axis' },
  580. legend: {
  581. data: ['实际费用', '预算'],
  582. right: 40
  583. },
  584. color: ['#61A5E8', '#9933FF'],
  585. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  586. xAxis: [{ type: 'category', name: '牧场',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  587. yAxis: [{ type: 'value', name: '费用(元)', axisLabel: { formatter: '{value}万' }}],
  588. series: [
  589. {
  590. name: '实际费用',
  591. type: 'bar',
  592. data: chart_data.data1,
  593. barMaxWidth:20,
  594. emphasis: { label: { show: true, position: 'inside' }}
  595. },
  596. {
  597. name: '预算',
  598. type: 'bar',
  599. barMaxWidth:20,
  600. data: chart_data.data2,
  601. emphasis: { label: { show: true, position: 'inside' }}
  602. }
  603. ]
  604. }
  605. this.chart1.setOption(option)
  606. window.onresize = function() {
  607. this.chart1.resize()
  608. }
  609. var that = this
  610. that.chart1.on('click', function(param, i) {
  611. that.pastureName = [param.name]
  612. that.getChart4()
  613. that.getChart6()
  614. })
  615. },
  616. // 单头牛维修费用
  617. roadChart2(chart_data) {
  618. if (this.chart2 != null) {
  619. this.chart2.dispose()
  620. }
  621. this.chart2 = echarts.init(document.getElementById('chart2'))
  622. var option = {
  623. title: { text: '单头牛维修费用', left:'center',textStyle: { color: '#769cfc' }},
  624. tooltip: { trigger: 'axis' },
  625. legend: {
  626. data: ['实际费用', '预算'],
  627. right: 40
  628. },
  629. color: ['#61A5E8', '#9933FF','#FFB800'],
  630. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  631. xAxis: [{ type: 'category', name: '牧场',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  632. yAxis: [{ type: 'value', name: '费用(元)'}],
  633. series: [
  634. {
  635. name: '实际费用',
  636. type: 'bar',
  637. data: chart_data.data1,
  638. emphasis: { label: { show: true, position: 'inside' }},
  639. barMaxWidth:20,
  640. markLine:{
  641. data:[ {yAxis:chart_data.line} ],
  642. lineStyle: {
  643. color: '#FFB800'
  644. }
  645. }
  646. },
  647. {
  648. name: '预算',
  649. type: 'bar',
  650. data: chart_data.data2,
  651. emphasis: { label: { show: true, position: 'inside' }},
  652. barMaxWidth:20
  653. }
  654. ]
  655. }
  656. this.chart2.setOption(option)
  657. window.onresize = function() {
  658. this.chart2.resize()
  659. }
  660. var that = this
  661. this.chart2.on('click', function(param, i) {
  662. // console.log(param)
  663. })
  664. },
  665. // XX牧场每月维修费对比
  666. roadChart4(chart_data) {
  667. console.log(chart_data,'666')
  668. if (this.chart4 != null) {
  669. this.chart4.dispose()
  670. }
  671. this.chart4 = echarts.init(document.getElementById('chart4'))
  672. var text = this.pastureName +'每月维修费对比'
  673. var option = {
  674. title: { text: text, left:'left',textStyle: { color: '#769cfc' }},
  675. tooltip: { trigger: 'axis' },
  676. legend: {
  677. data: chart_data.data_name,
  678. left: 40,
  679. bottom:0
  680. },
  681. color: ['#eb123a','#eba612','#124feb','#15ab2e','#b20fdb'],
  682. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  683. xAxis: [{ type: 'category', name: '月份',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  684. yAxis: [{ type: 'value', name: '费用(元)'}],
  685. series: [{
  686. name: '去年同期用量',
  687. type: 'line',
  688. data: chart_data.data1[0]
  689. },
  690. {
  691. name: '今年用量',
  692. type: 'line',
  693. data: chart_data.data2[0]
  694. },{
  695. name: '预算',
  696. type: 'line',
  697. data: chart_data.data3[0]
  698. }]
  699. }
  700. this.chart4.setOption(option)
  701. window.onresize = function() {
  702. this.chart4.resize()
  703. }
  704. var that = this
  705. that.chart4.on('click', function(param, i) {
  706. // console.log(param)
  707. that.getChart5Parm.parammaps.date = param.name
  708. that.getChart5()
  709. })
  710. },
  711. // XX牧场xx部门维修费用
  712. roadChart5(chart_data) {
  713. if (this.chart5 != null) {
  714. this.chart5.dispose()
  715. }
  716. this.chart5 = echarts.init(document.getElementById('chart5'))
  717. var text = this.pastureName + this.getChart5Parm.parammaps.deptName + '维修费用'
  718. var option = {
  719. title: { text: text, left:'left',textStyle: { color: '#769cfc' }},
  720. tooltip: { trigger: 'axis' },
  721. legend: {
  722. right: 40,
  723. bottom:0
  724. },
  725. color: ['#2dc0e8', '#769cfc'],
  726. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  727. xAxis: [{ type: 'category', name: '设备',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  728. yAxis: [{ type: 'value',name: '费用(元)', axisLabel: { formatter:'{value} 万'}}],
  729. series: [
  730. {
  731. type: 'bar',
  732. data: chart_data.data1,
  733. emphasis: { label: { show: true, position: 'inside' }},
  734. barMaxWidth:20
  735. },
  736. ]
  737. }
  738. this.chart5.setOption(option)
  739. window.onresize = function() {
  740. this.chart5.resize()
  741. }
  742. var that = this
  743. this.chart5.on('click', function(param, i) {
  744. // console.log(param)
  745. that.getdataListParmSee.parammaps.typeName = param.name
  746. that.getdataListParmSee.offset = 1
  747. that.get_table_dataSee()
  748. that.dialogFormVisibleCard = true
  749. })
  750. },
  751. // 牧场每月单头牛维修费对比
  752. roadChart6(chart_data) {
  753. if (this.chart6 != null) {
  754. this.chart6.dispose()
  755. }
  756. this.chart6 = echarts.init(document.getElementById('chart6'))
  757. var text = '牧场每月单头牛维修费对比'
  758. var option = {
  759. title: { text: text, left:'left',textStyle: { color: '#769cfc' }},
  760. tooltip: { trigger: 'axis' },
  761. legend: {
  762. data: chart_data.data_name,
  763. right: 40,
  764. bottom:0
  765. },
  766. color: ['#eb123a','#eba612','#124feb','#15ab2e','#b20fdb'],
  767. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  768. xAxis: [{ type: 'category', name: '月份',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  769. yAxis: [{ type: 'value',name: '费用(元)'}],
  770. series: (function() {
  771. var serie = []
  772. if(chart_data.data1 !== null){
  773. for (var i = 0; i < chart_data.data1.length; i++) {
  774. var item = {
  775. name: chart_data.data_name[i],
  776. type: 'line',
  777. data: chart_data.data1[i]
  778. }
  779. serie.push(item)
  780. }
  781. }
  782. return serie
  783. }())
  784. }
  785. this.chart6.setOption(option)
  786. window.onresize = function() {
  787. this.chart6.resize()
  788. }
  789. var that = this
  790. this.chart6.on('click', function(param, i) {
  791. // console.log(param)
  792. that.getChart7Parm.parammaps.date = param.name
  793. that.getChart7()
  794. })
  795. },
  796. // XX月部门统计
  797. roadChart7(chart_data) {
  798. console.log(chart_data,'chart_data')
  799. if (this.chart7 != null) {
  800. this.chart7.dispose()
  801. }
  802. this.chart7 = echarts.init(document.getElementById('chart7'))
  803. var text = this.getChart7Parm.parammaps.date + '月部门统计'
  804. var option = {
  805. title: { text: text, left:'left',textStyle: { color: '#769cfc' }},
  806. tooltip: { trigger: 'axis' },
  807. legend: {
  808. data: ['实际','预算'],
  809. left: 40,
  810. bottom:0
  811. },
  812. // color: ['#2dc0e8', '#769cfc', '#FFB800'],
  813. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  814. xAxis: [{ type: 'category', name: '部门',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  815. yAxis: [{ type: 'value', name: '费用(元)'}],
  816. series: [
  817. {
  818. name: '实际',
  819. type: 'bar',
  820. data: chart_data.data1,
  821. emphasis: { label: { show: true, position: 'inside' }},
  822. barMaxWidth:20
  823. },
  824. {
  825. name: '预算',
  826. type: 'bar',
  827. data: chart_data.data2,
  828. emphasis: { label: { show: true, position: 'inside' }},
  829. barMaxWidth:20
  830. }
  831. ]
  832. }
  833. this.chart7.setOption(option)
  834. window.onresize = function() {
  835. this.chart7.resize()
  836. }
  837. var that = this
  838. this.chart7.on('click', function(param, i) {
  839. // console.log(param)
  840. })
  841. },
  842. form_searchDelivery() {
  843. if (this.getdataListParmSee.parammaps.inputDatetime == null) {
  844. this.getdataListParmSee.parammaps.startTime = ''
  845. this.getdataListParmSee.parammaps.stopTime = ''
  846. }
  847. this.getdataListParmSee.offset = 1
  848. this.get_table_dataSee()
  849. },
  850. get_table_dataSee() {
  851. if (this.getdataListParmSee.parammaps.inputDatetime !== undefined && this.getdataListParmSee.parammaps.inputDatetime !== null) {
  852. this.getdataListParmSee.parammaps.startTime = this.$refs['inputDatetime'].value[0]
  853. this.getdataListParmSee.parammaps.stopTime = this.$refs['inputDatetime'].value[1]
  854. } else {
  855. this.getdataListParmSee.parammaps.startTime = ''
  856. this.getdataListParmSee.parammaps.stopTime = ''
  857. }
  858. GetDataByName(this.getdataListParmSee).then(response => {
  859. this.listSee = response.data.list
  860. console.log('记录列表数据', response.data.list)
  861. this.pageNumSee = response.data.pageNum
  862. this.pageSizeSee = response.data.pageSize
  863. if (response.data.total) {
  864. this.totalSee = response.data.total
  865. }
  866. // Just to simulate the time of the request
  867. setTimeout(() => {
  868. this.listLoadingSee = false
  869. }, 300)
  870. })
  871. },
  872. handleDownloadDelivery() {
  873. this.$alert('正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  874. this.isPercentage = true
  875. this.percentage = 1
  876. var timer = setInterval(() => {
  877. this.percentage += 5
  878. if (this.percentage > 95) {
  879. this.percentage = 99
  880. clearInterval(timer)
  881. }
  882. this.percentage = this.percentage
  883. }, 1000)
  884. this.downLoadParm.name = 'geteqclassSumDay'
  885. this.downLoadParm.returntype = 'Map'
  886. this.downLoadParm.parammaps = this.getdataListParmSee.parammaps
  887. GetAccount(this.downLoadParm).then(response => {
  888. if (response.data.list !== '') {
  889. this.percentage = 99
  890. setTimeout(() => {
  891. this.isPercentage = false
  892. }, 2000)
  893. }
  894. this.$nextTick(() => {
  895. this.downLoadList = response.data.list
  896. console.log(this.downLoadList)
  897. const ExcelDatas = [
  898. {
  899. tHeader: ['资产编号', '设备名称', '设备内部编号', '设备规格', '领用日期', '领用部门', '备件编号', '备件名称', '备件规格', '备件品牌', '计量单位', '出库数量', '退库数量', '单价', '总价'],
  900. filterVal: ['assetCode', 'eqName', 'eqCode', 'eqSpecification', 'receiveTime', 'deptName', 'partCode', 'partName', 'specification', 'brandName', 'unit', 'checkoutNumber', 'quitNumber', 'price', 'sumPrice'],
  901. tableDatas: this.downLoadList,
  902. sheetName: '设备维修费用'
  903. }
  904. ]
  905. json2excel(ExcelDatas, '设备维修费用', true, 'xlsx')
  906. })
  907. })
  908. },
  909. }
  910. }
  911. </script>
  912. <style>
  913. .el-row {
  914. margin-bottom: 40px;
  915. &:last-child {
  916. margin-bottom: 0;
  917. }
  918. }
  919. </style>
  920. <style lang="scss" scoped>
  921. .group{
  922. float: right;margin-bottom: 20px;
  923. }
  924. </style>