index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  1. <template>
  2. <div class="app-container">
  3. <div v-if="isPercentage" class="percentage" style="width: 210px;height: 90px;background: #fff;position: fixed;bottom: 0;left: 0;z-index: 9999999999999;">
  4. <h4 style="padding-left: 10px;line-height: 0;">导出进度:</h4>
  5. <el-progress style="padding-left: 10px;" :text-inside="true" :stroke-width="26" :percentage="percentage" />
  6. </div>
  7. <div class="filter-container">
  8. <el-date-picker v-model="table.getListParm.parammaps.year" style="width:100px;" :clearable="false" class="filter-item" type="year" placeholder="选择年" format="yyyy" value-format="yyyy" @change="changeYear" />
  9. <el-date-picker v-model="month" class="filter-item" type="month" style="width:90px;" placeholder="选择月" format="MM" value-format="MM" />
  10. <el-select v-model="table.getListParm.parammaps.eqClassName" clearable filterable placeholder="设备类别" class="filter-item" @change="changeEqClassName">
  11. <el-option v-for="item in equipmentCategoryList" :key="item.id" :label="item.typeName" :value="item.typeName" />
  12. </el-select>
  13. <el-select v-model="table.getListParm.PastureName" :disabled="table.isChart && checkDepartment== '2'" multiple clearable filterable placeholder="牧场" class="filter-item" @change="changeEqClassName">
  14. <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.name" />
  15. </el-select>
  16. <el-select v-model="table.getListParm.DepartmentName" :disabled="table.isChart && checkPasture== '1'" multiple clearable filterable placeholder="部门" class="filter-item" @change="changeEqClassName">
  17. <el-option v-for="item in findAllDepart" :key="item.id" :label="item.name" :value="item.name" />
  18. </el-select>
  19. <el-radio v-if="table.isChart" v-model="checkPasture" label="1" @change="changeRadio">牧场</el-radio>
  20. <el-radio v-if="table.isChart" v-model="checkDepartment" label="2" @change="changeRadio">部门</el-radio>
  21. <el-button class="filter-item" type="success" icon="el-icon-download" style="float: right;margin-right: 5px;" @click="handleExport('table')">导出</el-button>
  22. </div>
  23. <div v-if="table.isTable" class="table">
  24. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleSwitchChart('table')">切换图表</el-button>
  25. <h4>维修费用(元)</h4>
  26. <el-table
  27. :key="table.tableKey"
  28. v-loading="table.listLoading"
  29. element-loading-text="给我一点时间"
  30. :data="table.list"
  31. border
  32. fit
  33. highlight-current-row
  34. style="width: 100%;"
  35. :row-style="rowStyle"
  36. :cell-style="tableCellStyle"
  37. class="elTable table-fixed"
  38. @sort-change="tableSort1"
  39. >
  40. <el-table-column label="序号" align="center" type="index" width="50px">
  41. <template slot-scope="scope">
  42. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="牧场" min-width="110px" align="center" prop="pastureName" />
  46. <el-table-column label="部门" min-width="110px" align="center" prop="departmentName" />
  47. <el-table-column label="设备类别" min-width="130px" align="center">
  48. <template slot-scope="{row}">
  49. <a @click="handleEquipment(row)">{{ row.eqClassName }}</a>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="维修费用(元)" min-width="110px" align="center" sortable prop="psum" />
  53. <el-table-column label="维修设备数量" min-width="110px" align="center" sortable prop="eqcodes" />
  54. <el-table-column label="平均维修费(元)" min-width="110px" align="center" sortable prop="avgsum" />
  55. </el-table>
  56. <pagination v-show="table.total>0" :total="table.total" :page.sync="table.getListParm.offset" :limit.sync="table.getListParm.pagecount" @pagination="getList" />
  57. </div>
  58. <div v-if="table.isChart" class="chart">
  59. <el-row>
  60. <el-col :span="24">
  61. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleSwitchTable('table')">切换表格</el-button>
  62. </el-col>
  63. </el-row>
  64. <el-row>
  65. <el-col :span="24">
  66. <div id="barChart1" style="width: 100%;height:400px;" />
  67. </el-col>
  68. </el-row>
  69. </div>
  70. <!-- 设备类别 -->
  71. <el-dialog :title="textMap[dialogStatus]" :visible.sync="equipment.dialogFormVisible" :close-on-click-modal="false" width="90%">
  72. <div v-if="equipment.isTable" class="table">
  73. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('equipment')">导出</el-button>
  74. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleSwitchChart('equipment')">切换图表</el-button>
  75. <el-table
  76. :key="equipment.tableKey"
  77. v-loading="equipment.listLoading"
  78. element-loading-text="给我一点时间"
  79. :data="equipment.list"
  80. border
  81. fit
  82. highlight-current-row
  83. style="width: 100%;"
  84. :row-style="rowStyle"
  85. :cell-style="tableCellStyle2"
  86. class="elTable table-fixed"
  87. @sort-change="tableSort2"
  88. >
  89. <el-table-column label="序号" align="center" type="index" width="50px" />
  90. <el-table-column label="牧场" min-width="130px" align="center">
  91. <template slot-scope="{row}">
  92. <a @click="handlePasture(row)">{{ row.pastureName }}</a>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="维修费用(元)" min-width="110px" align="center" sortable prop="psum" />
  96. <el-table-column label="维修设备数量" min-width="110px" align="center" sortable prop="eqcodes" />
  97. <el-table-column label="平均维修费(元)" min-width="110px" align="center" sortable prop="avgsum" />
  98. </el-table>
  99. </div>
  100. <div v-if="equipment.isChart" class="chart">
  101. <el-row>
  102. <el-col :span="24">
  103. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleSwitchTable('equipment')">切换表格</el-button>
  104. </el-col>
  105. </el-row>
  106. <el-row>
  107. <el-col :span="24">
  108. <div id="equipmentBarChart1" style="width: 100%;height:400px;" />
  109. </el-col>
  110. </el-row>
  111. </div>
  112. </el-dialog>
  113. <el-dialog :title="textMap[dialogStatus]" :visible.sync="pasture.dialogFormVisible" :close-on-click-modal="false" width="90%">
  114. <div class="filter-container">
  115. <el-input v-model="pasture.getListParm.parammaps.eqName" placeholder="设备名称" style="width: 130px;" class="filter-item" />
  116. <el-input v-model="pasture.getListParm.parammaps.assetCode" placeholder="资产编号" clearable class="filter-item" style="width: 130px" />
  117. <el-date-picker ref="inputDatetime1" v-model="pasture.getListParm.parammaps.inputDatetime" class="inputDatetime" type="datetimerange" style="width: 300px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="领用开始日期" end-placeholder="领用结束日期" />
  118. <el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
  119. <el-button class="filter-item" type="success" icon="el-icon-download" style="float: right;margin-right: 5px;" @click="handleExport('pasture')">导出</el-button>
  120. </div>
  121. <div class="table">
  122. <el-table
  123. :key="pasture.tableKey"
  124. v-loading="pasture.listLoading"
  125. element-loading-text="给我一点时间"
  126. :data="pasture.list"
  127. border
  128. fit
  129. highlight-current-row
  130. style="width: 100%;"
  131. :row-style="rowStyle"
  132. :cell-style="cellStyle"
  133. class="elTable table-fixed"
  134. @sort-change="tableSort3"
  135. >
  136. <el-table-column label="序号" align="center" type="index" width="50px">
  137. <template slot-scope="scope">
  138. <span>{{ scope.$index + (pasture.pageNum-1) * pasture.pageSize + 1 }}</span>
  139. </template>
  140. </el-table-column>
  141. <el-table-column label="资产编号" min-width="110px" align="center" prop="assetCode" />
  142. <el-table-column label="设备名称" min-width="110px" align="center" prop="eqName" />
  143. <el-table-column label="设备内部编号" min-width="110px" align="center" prop="eqCode" />
  144. <el-table-column label="设备规格" min-width="110px" align="center" prop="eqSpecification" />
  145. <el-table-column label="领用日期" min-width="110px" align="center" prop="receiveTime" />
  146. <el-table-column label="领用部门" min-width="110px" align="center" prop="deptName" />
  147. <el-table-column label="备件编号" min-width="110px" align="center" prop="partCode" />
  148. <el-table-column label="备件名称" min-width="110px" align="center" prop="partName" />
  149. <el-table-column label="备件规格" min-width="110px" align="center" prop="specification" />
  150. <el-table-column label="备件品牌" min-width="110px" align="center" prop="brandName" />
  151. <el-table-column label="计量单位" min-width="110px" align="center" prop="unit" />
  152. <el-table-column label="出库数量" min-width="110px" align="center" sortable prop="checkoutNumber" />
  153. <el-table-column label="退库数量" min-width="110px" align="center" sortable prop="quitNumber" />
  154. <el-table-column label="单价" min-width="110px" align="center" sortable prop="price" />
  155. <el-table-column label="总价" min-width="110px" align="center" sortable prop="sumPrice" />
  156. </el-table>
  157. <pagination v-show="pasture.total>0" :total="pasture.total" :page.sync="pasture.getListParm.offset" :limit.sync="pasture.getListParm.pagecount" @pagination="getPastureList" />
  158. </div>
  159. </el-dialog>
  160. </div>
  161. </template>
  162. <script>
  163. import echarts from 'echarts'
  164. require('echarts/theme/macarons')
  165. import Pagination from '@/components/Pagination' // secondary package based on el-pagination
  166. import { GetDataByName, GetDataByNames, GetReportform } from '@/api/common'
  167. import { parseTime, json2excel, sortChange } from '@/utils/index.js'
  168. import Cookies from 'js-cookie'
  169. export default {
  170. name: 'MaintenanceCategoryAnalysis',
  171. components: { Pagination },
  172. data() {
  173. return {
  174. requestParams: [
  175. { name: 'geteqclasslistSection', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'section': '3' }},
  176. { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
  177. { name: 'findAllDepart1', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid'), 'eId': Cookies.get('employeid') }}
  178. ],
  179. equipmentCategoryList: [],
  180. findAllPasture: [],
  181. findAllDepart: [],
  182. month: new Date(),
  183. table: {
  184. tableKey: 0,
  185. listLoading: true,
  186. list: [],
  187. total: 0,
  188. getListParm: {
  189. name: 'geteqclassFeeSum',
  190. page: 1,
  191. offset: 1,
  192. pagecount: 10,
  193. returntype: 'Map',
  194. PastureName: [],
  195. DepartmentName: [],
  196. parammaps: {
  197. year: parseTime(new Date(), '{y}'),
  198. month: parseTime(new Date(), '{m}'),
  199. eqClassName: ''
  200. }
  201. },
  202. getBarChartParm: {
  203. name: 'geteqclassSumMonthWater',
  204. parammaps: {
  205. receiveTime: '2021-03',
  206. pastureName: Cookies.get('pasturename'),
  207. deptName: '牧场办公室'
  208. }
  209. },
  210. barChart: null,
  211. isTable: true,
  212. isChart: false
  213. },
  214. deptment: '维修处',
  215. dialogStatus: '',
  216. equipment: {
  217. dialogFormVisible: false,
  218. tableKey: 1,
  219. listLoading: true,
  220. list: [],
  221. total: 0,
  222. getListParm: {
  223. name: 'geteqclassFeeSumPasture',
  224. page: 1,
  225. offset: 1,
  226. pagecount: 0,
  227. returntype: 'Map',
  228. parammaps: {
  229. year: '',
  230. month: '',
  231. eqClassName: ''
  232. }
  233. },
  234. getBarChartParm: {
  235. name: 'geteqclassSumMonthWater',
  236. parammaps: {
  237. receiveTime: '2021-03',
  238. pastureName: Cookies.get('pasturename'),
  239. deptName: '牧场办公室'
  240. }
  241. },
  242. barChart: null,
  243. isTable: true,
  244. isChart: false
  245. },
  246. pasture: {
  247. dialogFormVisible: false,
  248. tableKey: 2,
  249. listLoading: true,
  250. list: [],
  251. total: 0,
  252. getListParm: {
  253. name: 'geteqclassFeeSumPastureDetail',
  254. page: 1,
  255. offset: 1,
  256. pagecount: 10,
  257. returntype: 'Map',
  258. parammaps: {
  259. year: '',
  260. month: '',
  261. pastureName: '',
  262. assetCode: '',
  263. eqName: '',
  264. eqClassName: '',
  265. inputDatetime: '',
  266. startTime: '',
  267. stopTime: ''
  268. }
  269. }
  270. },
  271. textMap: {
  272. equipment: '牧场维修费',
  273. pasture: '牧场'
  274. },
  275. downLoadParm: {},
  276. downLoadList: [],
  277. isPercentage: false,
  278. percentage: 1,
  279. checkPasture: '',
  280. checkDepartment: '',
  281. getPastureidParm: { name: 'getPastureid' },
  282. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  283. cellStyle: { padding: 0 + 'px' }
  284. }
  285. },
  286. watch: {
  287. 'month': {
  288. deep: true,
  289. handler: function(newVal, oldVal) {
  290. if (newVal == null) {
  291. this.month = ''
  292. } else {
  293. this.month = newVal
  294. }
  295. this.table.getListParm.offset = 1
  296. this.table.getListParm.parammaps.month = this.month
  297. this.getList()
  298. }
  299. }
  300. },
  301. created() {
  302. this.getPastureid()
  303. this.getList()
  304. },
  305. mounted() {
  306. },
  307. methods: {
  308. tableSort1(column) {
  309. sortChange(column, this.table.list)
  310. },
  311. tableSort2(column) {
  312. sortChange(column, this.equipment.list)
  313. },
  314. tableSort3(column) {
  315. sortChange(column, this.pasture.list)
  316. },
  317. getPastureid() {
  318. GetDataByName(this.getPastureidParm).then(response => {
  319. if (response.data.list !== null) {
  320. this.requestParams[2].parammaps.pastureId = response.data.list[0].id
  321. this.get_select_list()
  322. }
  323. })
  324. },
  325. get_select_list() {
  326. GetDataByNames(this.requestParams).then(response => {
  327. this.equipmentCategoryList = response.data.geteqclasslistSection.list
  328. this.findAllPasture = response.data.findAllPasture.list
  329. this.findAllDepart = response.data.findAllDepart1.list
  330. })
  331. },
  332. tableCellStyle({ row, column, rowIndex, columnIndex }) {
  333. if (row.eqClassName !== null && columnIndex == 3 || row.pastureName !== null && columnIndex == 3) {
  334. return {
  335. textDecoration: 'underline'
  336. }
  337. }
  338. },
  339. tableCellStyle2({ row, column, rowIndex, columnIndex }) {
  340. if (row.eqClassName !== null && columnIndex == 1 || row.pastureName !== null && columnIndex == 1) {
  341. return {
  342. textDecoration: 'underline'
  343. }
  344. }
  345. },
  346. handleSwitchChart(item) {
  347. if (item == 'table') {
  348. this.table.isChart = true
  349. this.table.isTable = false
  350. if (this.table.getListParm.PastureName.length > 0 && this.table.getListParm.DepartmentName.length > 0) {
  351. console.log(this.table.getListParm.PastureName)
  352. this.table.getListParm.DepartmentName = []
  353. this.checkPasture = '1'
  354. this.checkDepartment = ''
  355. } else if (this.table.getListParm.PastureName.length > 0 && this.table.getListParm.DepartmentName.length == 0) {
  356. this.checkPasture = '1'
  357. this.checkDepartment = ''
  358. } else if (this.table.getListParm.PastureName.length == 0 && this.table.getListParm.DepartmentName.length > 0) {
  359. this.checkPasture = ''
  360. this.checkDepartment = '2'
  361. } else {
  362. this.checkPasture = '1'
  363. this.checkDepartment = ''
  364. }
  365. this.getTableBarChart()
  366. } else if (item == 'equipment') {
  367. this.equipment.isChart = true
  368. this.equipment.isTable = false
  369. this.getEquipmentBarChart()
  370. }
  371. },
  372. changeRadio(item) {
  373. console.log('item==>', item)
  374. if (item == 1) {
  375. this.checkPasture = '1'
  376. this.checkDepartment = ''
  377. this.table.getListParm.DepartmentName = []
  378. } else {
  379. this.checkPasture = ''
  380. this.checkDepartment = '2'
  381. this.table.getListParm.PastureName = []
  382. }
  383. this.getTableBarChart()
  384. },
  385. handleSwitchTable(item) {
  386. if (item == 'table') {
  387. this.table.isChart = false
  388. this.table.isTable = true
  389. this.getList()
  390. } else if (item == 'equipment') {
  391. this.equipment.isChart = false
  392. this.equipment.isTable = true
  393. this.getEquipmentList()
  394. }
  395. },
  396. handleExport(item) {
  397. if (item == 'table') {
  398. this.$alert('正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  399. this.isPercentage = true
  400. this.percentage = 1
  401. var timer = setInterval(() => {
  402. this.percentage += 5
  403. if (this.percentage > 95) {
  404. this.percentage = 99
  405. clearInterval(timer)
  406. }
  407. this.percentage = this.percentage
  408. }, 1000)
  409. this.downLoadParm = this.table.getListParm
  410. this.downLoadParm.pagecount = 0
  411. GetDataByName(this.downLoadParm).then(response => {
  412. this.table.getListParm.pagecount = 10
  413. this.downLoadList = response.data.list
  414. if (response.data.list !== '') {
  415. this.percentage = 99
  416. setTimeout(() => {
  417. this.isPercentage = false
  418. }, 2000)
  419. }
  420. var elecExcelDatas = []
  421. if (this.table.getListParm.DepartmentName.length > 0) {
  422. console.log(1111)
  423. elecExcelDatas = [{
  424. tHeader: ['牧场', '部门', '设备类别', '维修费用(元)', '维修设备数量', '平均维修费(元)'],
  425. filterVal: ['pastureName', 'departmentName', 'eqClassName', 'psum', 'eqcodes', 'avgsum'],
  426. tableDatas: this.downLoadList,
  427. sheetName: 'sheet'
  428. }]
  429. } else {
  430. console.log(222)
  431. elecExcelDatas = [{
  432. tHeader: ['牧场', '设备类别', '维修费用(元)', '维修设备数量', '平均维修费(元)'],
  433. filterVal: ['pastureName', 'eqClassName', 'psum', 'eqcodes', 'avgsum'],
  434. tableDatas: this.downLoadList,
  435. sheetName: 'sheet'
  436. }]
  437. }
  438. json2excel(elecExcelDatas, '维修费用', true, 'xlsx')
  439. })
  440. } else if (item == 'equipment') {
  441. this.$alert('正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  442. this.isPercentage = true
  443. this.percentage = 1
  444. var timer = setInterval(() => {
  445. this.percentage += 5
  446. if (this.percentage > 95) {
  447. this.percentage = 99
  448. clearInterval(timer)
  449. }
  450. this.percentage = this.percentage
  451. }, 1000)
  452. this.downLoadParm = this.equipment.getListParm
  453. this.downLoadParm.pagecount = 0
  454. GetDataByName(this.downLoadParm).then(response => {
  455. this.equipment.getListParm.pagecount = 10
  456. this.downLoadList = response.data.list
  457. if (response.data.list !== '') {
  458. this.percentage = 99
  459. setTimeout(() => {
  460. this.isPercentage = false
  461. }, 2000)
  462. }
  463. const elecExcelDatas = [{
  464. tHeader: ['牧场', '维修费用(元)', '维修设备数量', '平均维修费(元)'],
  465. filterVal: ['pastureName', 'psum', 'eqcodes', 'avgsum'],
  466. tableDatas: this.downLoadList,
  467. sheetName: 'sheet'
  468. }]
  469. json2excel(elecExcelDatas, this.textMap.equipment, true, 'xlsx')
  470. })
  471. } else if (item == 'pasture') {
  472. this.$alert('正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  473. this.isPercentage = true
  474. this.percentage = 1
  475. var timer = setInterval(() => {
  476. this.percentage += 5
  477. if (this.percentage > 95) {
  478. this.percentage = 99
  479. clearInterval(timer)
  480. }
  481. this.percentage = this.percentage
  482. }, 1000)
  483. this.downLoadParm = this.pasture.getListParm
  484. this.downLoadParm.pagecount = 0
  485. GetDataByName(this.downLoadParm).then(response => {
  486. this.pasture.getListParm.pagecount = 10
  487. this.downLoadList = response.data.list
  488. if (response.data.list !== '') {
  489. this.percentage = 99
  490. setTimeout(() => {
  491. this.isPercentage = false
  492. }, 2000)
  493. }
  494. const elecExcelDatas = [{
  495. tHeader: ['资产编号', '设备名称', '设备内部编号', '设备规格', '领用日期', '领用部门', '备件编号', '备件名称', '备件规格', '备件品牌', '计量单位', '出库数量', '退库数量', '单价', '总价'],
  496. filterVal: ['assetCode', 'eqName', 'eqCode', 'eqSpecification', 'receiveTime', 'deptName', 'partCode', 'partName', 'specification', 'brandName', 'unit', 'checkoutNumber', 'quitNumber', 'price', 'sumPrice'],
  497. tableDatas: this.downLoadList,
  498. sheetName: 'sheet'
  499. }]
  500. json2excel(elecExcelDatas, this.textMap.pasture, true, 'xlsx')
  501. })
  502. }
  503. },
  504. // table
  505. changeYear() {
  506. this.table.getListParm.offset = 1
  507. this.getList()
  508. this.getTableBarChart()
  509. },
  510. changeEqClassName() {
  511. this.table.getListParm.offset = 1
  512. this.getList()
  513. this.getTableBarChart()
  514. },
  515. getList() {
  516. this.table.listLoading = true
  517. GetDataByName(this.table.getListParm).then(response => {
  518. if (response.data.list !== null) {
  519. this.table.list = response.data.list
  520. this.table.pageNum = response.data.pageNum
  521. this.table.pageSize = response.data.pageSize
  522. } else {
  523. this.table.list = []
  524. this.table.pageNum = 0
  525. this.table.pageSize = 0
  526. }
  527. this.table.total = response.data.total
  528. setTimeout(() => {
  529. this.table.listLoading = false
  530. }, 100)
  531. })
  532. },
  533. getTableBarChart() {
  534. this.table.getBarChartParm = this.table.getListParm
  535. this.table.getBarChartParm = {}
  536. this.table.getBarChartParm.name = this.table.getListParm.name
  537. this.table.getBarChartParm.page = this.table.getListParm.page
  538. this.table.getBarChartParm.offset = this.table.getListParm.offset
  539. this.table.getBarChartParm.pagecount = this.table.getListParm.pagecount
  540. this.table.getBarChartParm.returntype = this.table.getListParm.returntype
  541. this.table.getBarChartParm.parammaps = {}
  542. this.table.getBarChartParm.parammaps.year = this.table.getListParm.parammaps.year
  543. this.table.getBarChartParm.parammaps.month = this.table.getListParm.parammaps.month
  544. this.table.getBarChartParm.parammaps.eqClassName = this.table.getListParm.parammaps.eqClassName
  545. this.table.getBarChartParm.parammaps.PastureName = this.table.getListParm.PastureName
  546. this.table.getBarChartParm.parammaps.DepartmentName = this.table.getListParm.DepartmentName
  547. GetReportform(this.table.getBarChartParm).then(response => {
  548. if (response.data !== null) {
  549. this.table.chart_data = response.data.chart_data
  550. } else {
  551. this.table.chart_data = []
  552. }
  553. this.roadTableBarChart(this.table.chart_data, this.deptment)
  554. })
  555. },
  556. roadTableBarChart(chart_data, deptment) {
  557. if (this.table.barChart != null) {
  558. this.table.barChart.dispose()
  559. }
  560. this.table.barChart = echarts.init(document.getElementById('barChart1'))
  561. var option = {
  562. title: { text: '集团设备类别维修费用', textStyle: { color: '#769cfc' }},
  563. tooltip: { trigger: 'axis' },
  564. legend: {
  565. data: [''],
  566. x: 'right'
  567. },
  568. color: ['#42b983', '#769cfc', '#FFB800'],
  569. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  570. xAxis: [{ type: 'category', data: chart_data.data2, name: '设备类别' }],
  571. yAxis: [{ type: 'value', name: '维修费用(元)', axisLabel: { formatter: '{value}' }}],
  572. series: [
  573. {
  574. name: '维修费用',
  575. type: 'bar',
  576. data: chart_data.data1,
  577. barWidth: 14,
  578. emphasis: { label: { show: true, position: 'inside' }}
  579. }
  580. ]
  581. }
  582. this.table.barChart.setOption(option)
  583. window.onresize = function() {
  584. this.table.barChart.resize()
  585. }
  586. },
  587. // 设备类别点点击
  588. handleEquipment(row) {
  589. this.equipment.dialogFormVisible = true
  590. this.equipment.isChart = false
  591. this.equipment.isTable = true
  592. this.textMap.equipment = '牧场维修费 ' + row.eqClassName
  593. this.dialogStatus = 'equipment'
  594. this.equipment.getListParm.parammaps.year = this.table.getListParm.parammaps.year
  595. this.equipment.getListParm.parammaps.month = this.table.getListParm.parammaps.month
  596. this.equipment.getListParm.parammaps.eqClassName = row.eqClassName
  597. this.getEquipmentList()
  598. },
  599. getEquipmentList() {
  600. this.equipment.listLoading = true
  601. GetDataByName(this.equipment.getListParm).then(response => {
  602. if (response.data.list !== null) {
  603. this.equipment.list = response.data.list
  604. if (response.data.total) {
  605. this.equipment.total = response.data.total
  606. }
  607. } else {
  608. this.equipment.list = []
  609. }
  610. setTimeout(() => {
  611. this.equipment.listLoading = false
  612. }, 100)
  613. })
  614. },
  615. getEquipmentBarChart() {
  616. this.equipment.getBarChartParm = this.equipment.getListParm
  617. GetReportform(this.equipment.getBarChartParm).then(response => {
  618. this.equipment.chart_data = response.data.chart_data
  619. this.roadEquipmentBarChart(this.equipment.chart_data, this.equipment.getBarChartParm.parammaps.eqClassName)
  620. })
  621. },
  622. roadEquipmentBarChart(chart_data, deptment) {
  623. if (this.equipment.barChart != null) {
  624. this.equipment.barChart.dispose()
  625. }
  626. this.equipment.barChart = echarts.init(document.getElementById('equipmentBarChart1'))
  627. var option = {
  628. title: { text: deptment + '各牧场维修费用', textStyle: { color: '#769cfc' }},
  629. tooltip: { trigger: 'axis' },
  630. legend: {
  631. data: [''],
  632. x: 'right'
  633. },
  634. color: ['#769cfc'],
  635. grid: { left: '3%', right: '10%', bottom: '4%', containLabel: true },
  636. xAxis: [{ type: 'category', data: chart_data.data2, name: '牧场' }],
  637. yAxis: [{ type: 'value', name: '维修费用(元)', axisLabel: { formatter: '{value}' }}],
  638. series: [
  639. {
  640. name: '维修费用',
  641. type: 'bar',
  642. barWidth: 14,
  643. data: chart_data.data1,
  644. emphasis: { label: { show: true, position: 'inside' }}
  645. }
  646. ]
  647. }
  648. this.equipment.barChart.setOption(option)
  649. window.onresize = function() {
  650. this.equipment.barChart.resize()
  651. }
  652. },
  653. handlePasture(row) {
  654. this.pasture.dialogFormVisible = true
  655. this.textMap.pasture = row.pastureName + '——' + row.eqClassName + '维修明细'
  656. this.dialogStatus = 'pasture'
  657. this.pasture.getListParm.offset = 1
  658. this.pasture.getListParm.parammaps.year = this.equipment.getListParm.parammaps.year
  659. this.pasture.getListParm.parammaps.month = this.equipment.getListParm.parammaps.month
  660. this.pasture.getListParm.parammaps.pastureName = row.pastureName
  661. this.pasture.getListParm.parammaps.eqClassName = row.eqClassName
  662. this.pasture.getListParm.parammaps.inputDatetime = ''
  663. this.pasture.getListParm.parammaps.startTime = ''
  664. this.pasture.getListParm.parammaps.stopTime = ''
  665. this.pasture.getListParm.parammaps.assetCode = ''
  666. this.pasture.getListParm.parammaps.eqName = ''
  667. this.getPastureList()
  668. },
  669. getPastureList() {
  670. this.pasture.listLoading = true
  671. if (this.pasture.getListParm.parammaps.inputDatetime == null) {
  672. this.pasture.getListParm.parammaps.inputDatetime = ''
  673. } else {
  674. this.pasture.getListParm.parammaps.startTime = this.pasture.getListParm.parammaps.inputDatetime[0]
  675. this.pasture.getListParm.parammaps.stopTime = this.pasture.getListParm.parammaps.inputDatetime[1]
  676. }
  677. GetDataByName(this.pasture.getListParm).then(response => {
  678. if (response.data.list !== null) {
  679. this.pasture.list = response.data.list
  680. this.pasture.pageNum = response.data.pageNum
  681. this.pasture.pageSize = response.data.pageSize
  682. if (response.data.total) {
  683. this.pasture.total = response.data.total
  684. }
  685. } else {
  686. this.pasture.list = []
  687. }
  688. setTimeout(() => {
  689. this.pasture.listLoading = false
  690. }, 100)
  691. })
  692. },
  693. handleSearch() {
  694. this.pasture.listLoading = true
  695. if (this.pasture.getListParm.parammaps.inputDatetime == null) {
  696. this.pasture.getListParm.parammaps.inputDatetime = ''
  697. } else {
  698. this.pasture.getListParm.parammaps.startTime = this.pasture.getListParm.parammaps.inputDatetime[0]
  699. this.pasture.getListParm.parammaps.stopTime = this.pasture.getListParm.parammaps.inputDatetime[1]
  700. }
  701. this.pasture.getListParm.offset = 1
  702. this.getPastureList()
  703. }
  704. }
  705. }
  706. </script>
  707. <style>
  708. .el-row {
  709. margin-bottom: 40px;
  710. &:last-child {
  711. margin-bottom: 0;
  712. }
  713. }
  714. </style>
  715. <style lang="scss" scoped>
  716. .dashboard-editor-container {
  717. padding: 20px;
  718. background-color: rgb(240, 242, 245);
  719. position: relative;
  720. .github-corner {
  721. position: absolute;
  722. top: 0px;
  723. border: 0;
  724. right: 0;
  725. }
  726. .chart-wrapper {
  727. background: #fff;
  728. padding: 16px 16px 0;
  729. }
  730. }
  731. @media (max-width:1024px) {
  732. .chart-wrapper {
  733. padding: 8px;
  734. }
  735. }
  736. </style>