index.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972
  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. getBarChart1() {
  359. GetReportform(this.getBarChart1Parm).then(response => {
  360. console.log('图1', response)
  361. let pasture = response.data.chart_data.pasture
  362. let keys = []
  363. pasture.forEach((item,key)=>{
  364. if(item.includes("公司")){
  365. keys.push(key)
  366. }
  367. })
  368. let lastYear = response.data.chart_data.lastYear
  369. let new_pasture = pasture.splice(keys[0],keys.length)
  370. let new_lastYear = lastYear.splice(keys[0],keys.length)
  371. let NowYear = response.data.chart_data.nowYear
  372. let new_NowYear = NowYear.splice(keys[0],keys.length)
  373. this.chart_data1.pasture = pasture
  374. this.chart_data1.lastYear = lastYear
  375. this.chart_data1.nowYear = NowYear
  376. // this.chart_data1 = response.data.chart_data
  377. this.roadBarChart1(this.chart_data1)
  378. var nowYear = response.data.chart_data.nowYear
  379. var totaltitle = 0
  380. if (nowYear !== null || nowYear !== undefined) {
  381. nowYear.forEach(function(item, index) {
  382. // console.log(parseFloat(item))
  383. totaltitle = totaltitle + parseFloat(item)
  384. })
  385. }
  386. this.roadChart1(this.chart_data1)
  387. this.getChart4()
  388. this.getChart6()
  389. })
  390. },
  391. // 单头牛维修费用
  392. getChart2() {
  393. let url = '/authdata/repair/singlecow?'
  394. let startTime = parseTime(this.monthDate[0],'{y}-{m}')
  395. let endTime = parseTime(this.monthDate[1],'{y}-{m}')
  396. let radio = ''
  397. if(this.radio1 == '集团'){
  398. radio = ''
  399. }else{
  400. radio = this.radio1
  401. }
  402. let data = 'startTime=' + startTime
  403. + '&endTime=' + endTime
  404. + '&center=' + radio
  405. getJson(url,data).then(response => {
  406. console.log('单头牛维修费用==>图2', response)
  407. if(response.data){
  408. this.chart_data2.data1 = response.data.nowYear
  409. this.chart_data2.data2 = response.data.lastYear
  410. this.chart_data2.xdata = response.data.pasture
  411. this.chart_data2.line = response.data.line
  412. }else{
  413. this.chart_data2.data1 = []
  414. this.chart_data2.data2 = []
  415. this.chart_data2.xdata = []
  416. this.chart_data2.line = 0
  417. }
  418. this.roadChart2(this.chart_data2)
  419. })
  420. },
  421. // XX牧场每月维修费对比
  422. getChart4() {
  423. let startTime = parseTime(this.monthDate[0],'{y}-{m}') + '-01'
  424. let date = this.monthDate[1];
  425. let year = date.getFullYear()
  426. let month = date.getMonth() + 1
  427. let lastDay = new Date(year, month, 0).getDate();
  428. let endTime = parseTime(this.monthDate[1],'{y}-{m}') + '-' + lastDay
  429. let data = {
  430. name:"getPastureSumMonth",
  431. parammaps:{
  432. startTime:startTime,
  433. endTime:endTime,
  434. pastureName:this.pastureName.toString(),
  435. departmentName:this.type
  436. },
  437. }
  438. GetReportform(data).then(response => {
  439. console.log('XX牧场每月维修费对比==>图3', response)
  440. if(response.data){
  441. this.chart_data4 = {
  442. data1:response.data.chart_data.lastYear,
  443. data2:response.data.chart_data.nowYear,
  444. data3:response.data.chart_data.monthBudgetList,
  445. xdata:response.data.chart_data.months,
  446. data_name:['去年同期用量','今年用量','预算']
  447. }
  448. }else{
  449. this.chart_data4 = {
  450. data1:[],
  451. data2:[],
  452. data3:[],
  453. xdata:[],
  454. data_name:['去年同期用量','今年用量','预算']
  455. }
  456. }
  457. if(response.data.chart_data.months){
  458. this.getChart5Parm.parammaps.date = response.data.chart_data.months[0]
  459. }else{
  460. this.getChart5Parm.parammaps.date = ''
  461. }
  462. this.roadChart4(this.chart_data4)
  463. this.getChart5Parm.parammaps.deptName = this.deptList[0].name
  464. this.getChart5()
  465. })
  466. },
  467. // XX月部门统计
  468. getChart5() {
  469. console.log(this.getChart5Parm.parammaps.deptName,'deptName')
  470. let startTime = parseTime(this.getChart5Parm.parammaps.date,'{y}-{m}')
  471. let date = new Date(this.getChart5Parm.parammaps.date);
  472. let year = date.getFullYear()
  473. let month = date.getMonth() + 1
  474. let lastDay = new Date(year, month, 0).getDate();
  475. let endTime = parseTime(this.getChart5Parm.parammaps.date,'{y}-{m}')
  476. let data = {
  477. name:"geteqclassSumMonth",
  478. parammaps:{
  479. startTime:startTime,
  480. endTime:endTime,
  481. pastureName:this.pastureName.toString(),
  482. deptName:this.getChart5Parm.parammaps.deptName,
  483. },
  484. }
  485. GetReportform(data).then(response => {
  486. console.log('XX部门维修费用==>图4', response)
  487. if(response.data.chart_data){
  488. this.chart_data5 = {
  489. data1:response.data.chart_data.eqCost,
  490. xdata:response.data.chart_data.typeName
  491. }
  492. }else{
  493. this.chart_data5 = {
  494. data1:[],
  495. xdata:[]
  496. }
  497. }
  498. this.roadChart5(this.chart_data5)
  499. })
  500. },
  501. // XX牧场XX年每月用电量对比
  502. getChart6() {
  503. let url = '/authdata/repair/perhead?'
  504. let startTime = parseTime(this.monthDate[0],'{y}-{m}')
  505. let endTime = parseTime(this.monthDate[1],'{y}-{m}')
  506. let radio = ''
  507. if(this.radio1 == '集团'){
  508. radio = ''
  509. }else{
  510. radio = this.radio1
  511. }
  512. let pastureId = []
  513. this.pastureList.forEach((item)=>{
  514. if(this.pastureName){
  515. this.pastureName.forEach((item1)=>{
  516. if(item.name == item1){
  517. pastureId.push(item.id)
  518. }
  519. })
  520. }
  521. })
  522. let data = 'startTime=' + startTime
  523. + '&endTime=' + endTime
  524. + '&center=' + radio
  525. + '&pastureId=' + pastureId.toString()
  526. getJson(url,data).then(response => {
  527. console.log('牧场每月单头牛维修费对比==>图5', response)
  528. if(response.data){
  529. this.chart_data6.data1 = response.data.data3
  530. this.chart_data6.data_name = response.data.data1
  531. this.chart_data6.xdata = response.data.data2
  532. }else{
  533. this.chart_data6.data1 = []
  534. this.chart_data6.data_name = []
  535. this.chart_data6.xdata = []
  536. this.chart_data6.line =0
  537. }
  538. if(response.data.data1 == null){
  539. this.chart_data6.data_name = []
  540. }
  541. if(response.data.data2 == null ){
  542. this.chart_data6.xdata = []
  543. this.getChart7Parm.parammaps.date = ''
  544. }else{
  545. this.getChart7Parm.parammaps.date = response.data.data2[0]
  546. }
  547. if(response.data.data3 == null){
  548. this.chart_data6.data1 = []
  549. }
  550. this.roadChart6(this.chart_data6)
  551. this.getChart7Parm.parammaps.deptName = this.deptList[0].name
  552. this.getChart7()
  553. })
  554. },
  555. // XX月部门统计
  556. getChart7() {
  557. let startTime = parseTime(this.getChart7Parm.parammaps.date,'{y}-{m}') + '-01'
  558. let date = new Date(this.getChart7Parm.parammaps.date);
  559. let year = date.getFullYear()
  560. let month = date.getMonth() + 1
  561. let lastDay = new Date(year, month, 0).getDate();
  562. let endTime = parseTime(this.getChart7Parm.parammaps.date,'{y}-{m}') + '-' + lastDay
  563. let data = {
  564. name:"getdeptSumMonth",
  565. parammaps:{
  566. startTime:startTime,
  567. endTime:endTime,
  568. pastureName:this.pastureName.toString(),
  569. departmentName:this.getChart7Parm.parammaps.deptName
  570. },
  571. }
  572. GetDataByName(data).then(response => {
  573. console.log('XX月部门统计==>图6', response)
  574. // this.chart_data7 = response.data.chart_data
  575. if(response.data){
  576. var data1 = []
  577. var data2 = []
  578. var xdata = []
  579. response.data.list.forEach((item)=>{
  580. data1.push(item.value)
  581. data2.push(item.monthBudget)
  582. xdata.push(item.name)
  583. })
  584. this.chart_data7 = {
  585. data1:data1,
  586. data2:data2,
  587. xdata:xdata
  588. }
  589. }else{
  590. this.chart_data7 = {
  591. data1:[],
  592. data2:[],
  593. xdata:[]
  594. }
  595. }
  596. this.roadChart7(this.chart_data7)
  597. })
  598. },
  599. // 各牧场维修费用对比
  600. roadChart1(chart_data) {
  601. if (this.chart1 != null) {
  602. this.chart1.dispose()
  603. }
  604. this.chart1 = echarts.init(document.getElementById('chart1'))
  605. var option = {
  606. title: { text: '各牧场维修费用对比', textStyle: { color: '#769cfc' }},
  607. tooltip: { trigger: 'axis' },
  608. legend: {
  609. data: ['实际费用', '预算'],
  610. right: 40
  611. },
  612. color: ['#61A5E8', '#9933FF'],
  613. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  614. xAxis: [{ type: 'category', name: '牧场',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  615. yAxis: [{ type: 'value', name: '费用(元)', axisLabel: { formatter: '{value}万' }}],
  616. series: [
  617. {
  618. name: '实际费用',
  619. type: 'bar',
  620. data: chart_data.data1,
  621. barMaxWidth:20,
  622. emphasis: { label: { show: true, position: 'inside' }}
  623. },
  624. {
  625. name: '预算',
  626. type: 'bar',
  627. barMaxWidth:20,
  628. data: chart_data.data2,
  629. emphasis: { label: { show: true, position: 'inside' }}
  630. }
  631. ]
  632. }
  633. this.chart1.setOption(option)
  634. window.onresize = function() {
  635. this.chart1.resize()
  636. }
  637. var that = this
  638. that.chart1.on('click', function(param, i) {
  639. that.pastureName = [param.name]
  640. that.getChart4()
  641. that.getChart6()
  642. })
  643. },
  644. // 单头牛维修费用
  645. roadChart2(chart_data) {
  646. if (this.chart2 != null) {
  647. this.chart2.dispose()
  648. }
  649. this.chart2 = echarts.init(document.getElementById('chart2'))
  650. var option = {
  651. title: { text: '单头牛维修费用', left:'center',textStyle: { color: '#769cfc' }},
  652. tooltip: { trigger: 'axis' },
  653. legend: {
  654. data: ['实际费用', '预算'],
  655. right: 40
  656. },
  657. color: ['#61A5E8', '#9933FF','#FFB800'],
  658. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  659. xAxis: [{ type: 'category', name: '牧场',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  660. yAxis: [{ type: 'value', name: '费用(元)'}],
  661. series: [
  662. {
  663. name: '实际费用',
  664. type: 'bar',
  665. data: chart_data.data1,
  666. emphasis: { label: { show: true, position: 'inside' }},
  667. barMaxWidth:20,
  668. markLine:{
  669. data:[ {yAxis:chart_data.line} ],
  670. lineStyle: {
  671. color: '#FFB800'
  672. }
  673. }
  674. },
  675. {
  676. name: '预算',
  677. type: 'bar',
  678. data: chart_data.data2,
  679. emphasis: { label: { show: true, position: 'inside' }},
  680. barMaxWidth:20
  681. }
  682. ]
  683. }
  684. this.chart2.setOption(option)
  685. window.onresize = function() {
  686. this.chart2.resize()
  687. }
  688. var that = this
  689. this.chart2.on('click', function(param, i) {
  690. // console.log(param)
  691. })
  692. },
  693. // XX牧场每月维修费对比
  694. roadChart4(chart_data) {
  695. console.log(chart_data,'666')
  696. if (this.chart4 != null) {
  697. this.chart4.dispose()
  698. }
  699. this.chart4 = echarts.init(document.getElementById('chart4'))
  700. var text = this.pastureName +'每月维修费对比'
  701. var option = {
  702. title: { text: text, left:'left',textStyle: { color: '#769cfc' }},
  703. tooltip: { trigger: 'axis' },
  704. legend: {
  705. data: chart_data.data_name,
  706. left: 40,
  707. bottom:0
  708. },
  709. color: ['#eb123a','#eba612','#124feb','#15ab2e','#b20fdb'],
  710. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  711. xAxis: [{ type: 'category', name: '月份',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  712. yAxis: [{ type: 'value', name: '费用(元)'}],
  713. series: [{
  714. name: '去年同期用量',
  715. type: 'line',
  716. data: chart_data.data1[0]
  717. },
  718. {
  719. name: '今年用量',
  720. type: 'line',
  721. data: chart_data.data2[0]
  722. },{
  723. name: '预算',
  724. type: 'line',
  725. data: chart_data.data3[0]
  726. }]
  727. }
  728. this.chart4.setOption(option)
  729. window.onresize = function() {
  730. this.chart4.resize()
  731. }
  732. var that = this
  733. that.chart4.on('click', function(param, i) {
  734. // console.log(param)
  735. that.getChart5Parm.parammaps.date = param.name
  736. that.getChart5()
  737. })
  738. },
  739. // XX牧场xx部门维修费用
  740. roadChart5(chart_data) {
  741. if (this.chart5 != null) {
  742. this.chart5.dispose()
  743. }
  744. this.chart5 = echarts.init(document.getElementById('chart5'))
  745. var text = this.pastureName + this.getChart5Parm.parammaps.deptName + '维修费用'
  746. var option = {
  747. title: { text: text, left:'left',textStyle: { color: '#769cfc' }},
  748. tooltip: { trigger: 'axis' },
  749. legend: {
  750. right: 40,
  751. bottom:0
  752. },
  753. color: ['#2dc0e8', '#769cfc'],
  754. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  755. xAxis: [{ type: 'category', name: '设备',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  756. yAxis: [{ type: 'value',name: '费用(元)', axisLabel: { formatter:'{value} 万'}}],
  757. series: [
  758. {
  759. type: 'bar',
  760. data: chart_data.data1,
  761. emphasis: { label: { show: true, position: 'inside' }},
  762. barMaxWidth:20
  763. },
  764. ]
  765. }
  766. this.chart5.setOption(option)
  767. window.onresize = function() {
  768. this.chart5.resize()
  769. }
  770. var that = this
  771. this.chart5.on('click', function(param, i) {
  772. // console.log(param)
  773. that.getdataListParmSee.parammaps.typeName = param.name
  774. that.getdataListParmSee.offset = 1
  775. that.get_table_dataSee()
  776. that.dialogFormVisibleCard = true
  777. })
  778. },
  779. // 牧场每月单头牛维修费对比
  780. roadChart6(chart_data) {
  781. if (this.chart6 != null) {
  782. this.chart6.dispose()
  783. }
  784. this.chart6 = echarts.init(document.getElementById('chart6'))
  785. var text = '牧场每月单头牛维修费对比'
  786. var option = {
  787. title: { text: text, left:'left',textStyle: { color: '#769cfc' }},
  788. tooltip: { trigger: 'axis' },
  789. legend: {
  790. data: chart_data.data_name,
  791. right: 40,
  792. bottom:0
  793. },
  794. color: ['#eb123a','#eba612','#124feb','#15ab2e','#b20fdb'],
  795. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  796. xAxis: [{ type: 'category', name: '月份',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  797. yAxis: [{ type: 'value',name: '费用(元)'}],
  798. series: (function() {
  799. var serie = []
  800. if(chart_data.data1 !== null){
  801. for (var i = 0; i < chart_data.data1.length; i++) {
  802. var item = {
  803. name: chart_data.data_name[i],
  804. type: 'line',
  805. data: chart_data.data1[i]
  806. }
  807. serie.push(item)
  808. }
  809. }
  810. return serie
  811. }())
  812. }
  813. this.chart6.setOption(option)
  814. window.onresize = function() {
  815. this.chart6.resize()
  816. }
  817. var that = this
  818. this.chart6.on('click', function(param, i) {
  819. // console.log(param)
  820. that.getChart7Parm.parammaps.date = param.name
  821. that.getChart7()
  822. })
  823. },
  824. // XX月部门统计
  825. roadChart7(chart_data) {
  826. console.log(chart_data,'chart_data')
  827. if (this.chart7 != null) {
  828. this.chart7.dispose()
  829. }
  830. this.chart7 = echarts.init(document.getElementById('chart7'))
  831. var text = this.getChart7Parm.parammaps.date + '月部门统计'
  832. var option = {
  833. title: { text: text, left:'left',textStyle: { color: '#769cfc' }},
  834. tooltip: { trigger: 'axis' },
  835. legend: {
  836. data: ['实际','预算'],
  837. left: 40,
  838. bottom:0
  839. },
  840. color: ['#61A5E8', '#9933FF'],
  841. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  842. xAxis: [{ type: 'category', name: '部门',data: chart_data.xdata, axisLabel: { interval: 0, rotate: 30 }}],
  843. yAxis: [{ type: 'value', name: '费用(元)'}],
  844. series: [
  845. {
  846. name: '实际',
  847. type: 'bar',
  848. data: chart_data.data1,
  849. emphasis: { label: { show: true, position: 'inside' }},
  850. barMaxWidth:20
  851. },
  852. {
  853. name: '预算',
  854. type: 'bar',
  855. data: chart_data.data2,
  856. emphasis: { label: { show: true, position: 'inside' }},
  857. barMaxWidth:20
  858. }
  859. ]
  860. }
  861. this.chart7.setOption(option)
  862. window.onresize = function() {
  863. this.chart7.resize()
  864. }
  865. var that = this
  866. this.chart7.on('click', function(param, i) {
  867. // console.log(param)
  868. })
  869. },
  870. form_searchDelivery() {
  871. if (this.getdataListParmSee.parammaps.inputDatetime == null) {
  872. this.getdataListParmSee.parammaps.startTime = ''
  873. this.getdataListParmSee.parammaps.stopTime = ''
  874. }
  875. this.getdataListParmSee.offset = 1
  876. this.get_table_dataSee()
  877. },
  878. get_table_dataSee() {
  879. if (this.getdataListParmSee.parammaps.inputDatetime !== undefined && this.getdataListParmSee.parammaps.inputDatetime !== null) {
  880. this.getdataListParmSee.parammaps.startTime = this.$refs['inputDatetime'].value[0]
  881. this.getdataListParmSee.parammaps.stopTime = this.$refs['inputDatetime'].value[1]
  882. } else {
  883. this.getdataListParmSee.parammaps.startTime = ''
  884. this.getdataListParmSee.parammaps.stopTime = ''
  885. }
  886. GetDataByName(this.getdataListParmSee).then(response => {
  887. this.listSee = response.data.list
  888. console.log('记录列表数据', response.data.list)
  889. this.pageNumSee = response.data.pageNum
  890. this.pageSizeSee = response.data.pageSize
  891. if (response.data.total) {
  892. this.totalSee = response.data.total
  893. }
  894. // Just to simulate the time of the request
  895. setTimeout(() => {
  896. this.listLoadingSee = false
  897. }, 300)
  898. })
  899. },
  900. handleDownloadDelivery() {
  901. this.$alert('正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  902. this.isPercentage = true
  903. this.percentage = 1
  904. var timer = setInterval(() => {
  905. this.percentage += 5
  906. if (this.percentage > 95) {
  907. this.percentage = 99
  908. clearInterval(timer)
  909. }
  910. this.percentage = this.percentage
  911. }, 1000)
  912. var downLoadParm = {}
  913. downLoadParm.name = 'geteqclassSumDay'
  914. downLoadParm.returntype = 'Map'
  915. downLoadParm.parammaps = this.getdataListParmSee.parammaps
  916. GetAccount(downLoadParm).then(response => {
  917. if (response.data.list !== '') {
  918. this.percentage = 99
  919. setTimeout(() => {
  920. this.isPercentage = false
  921. }, 2000)
  922. }
  923. this.$nextTick(() => {
  924. this.downLoadList = response.data.list
  925. console.log(this.downLoadList)
  926. const ExcelDatas = [
  927. {
  928. tHeader: ['资产编号', '设备名称', '设备内部编号', '设备规格', '领用日期', '领用部门', '备件编号', '备件名称', '备件规格', '备件品牌', '计量单位', '出库数量', '退库数量', '单价', '总价'],
  929. filterVal: ['assetCode', 'eqName', 'eqCode', 'eqSpecification', 'receiveTime', 'deptName', 'partCode', 'partName', 'specification', 'brandName', 'unit', 'checkoutNumber', 'quitNumber', 'price', 'sumPrice'],
  930. tableDatas: this.downLoadList,
  931. sheetName: '设备维修费用'
  932. }
  933. ]
  934. json2excel(ExcelDatas, '设备维修费用', true, 'xlsx')
  935. })
  936. })
  937. },
  938. }
  939. }
  940. </script>
  941. <style>
  942. .el-row {
  943. margin-bottom: 40px;
  944. &:last-child {
  945. margin-bottom: 0;
  946. }
  947. }
  948. </style>
  949. <style lang="scss" scoped>
  950. .group{
  951. float: right;margin-bottom: 20px;
  952. }
  953. </style>