achievementKDetail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <template>
  2. <div class="startFrom">
  3. <el-dialog title="业绩考核系数详情" v-model="dialogVisible" :fullscreen="true" :close-on-click-modal="false">
  4. <div class="startDetail">
  5. <p class="starttitleSty">基础信息:</p>
  6. <el-row class="danjuMsg">
  7. <el-col :span="10">
  8. <div class="danjuMsg_data">
  9. <span class="data_tit">单位名称:</span>
  10. <span>{{receiptMsg.organizationName}}</span>
  11. </div>
  12. </el-col>
  13. <el-col :span="12">
  14. <div class="danjuMsg_data">
  15. <span class="data_tit">年度:</span>
  16. <span>{{receiptMsg.year}}</span>
  17. </div>
  18. </el-col>
  19. <el-col :span="24">
  20. <div class="danjuMsg_data">
  21. <span class="data_tit data_tit_1">业务简述:</span>
  22. <span>{{receiptMsg.desc}}</span>
  23. </div>
  24. </el-col>
  25. </el-row>
  26. <div class="detaTableBtns">
  27. <div class="tableBtn import" @click="handleImport">
  28. <img :src="importIcon" alt="">
  29. <span>导入</span>
  30. </div>
  31. <div class="tableBtn export" @click="handleExport">
  32. <img :src="exportIcon" alt="">
  33. <span>导出</span>
  34. </div>
  35. </div>
  36. <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
  37. <el-tab-pane label="权重分配" name="first">
  38. <!-- @select="rowClick" @select-all="rowClick" -->
  39. <el-table :data="weightAllocation" style="width: 100%" ref="report-table_day">
  40. <!-- <el-table-column type="selection" label="操作" align="center"></el-table-column> -->
  41. <el-table-column type="index" label="序号" width="80" />
  42. <el-table-column label="考评单位" prop="organizationName" width="300"/>
  43. <el-table-column label="资产管理系数" align="center">
  44. <el-table-column label="资产总额" prop="zzc" />
  45. <el-table-column label="K1" prop="k1" />
  46. </el-table-column>
  47. <el-table-column label="幅度管理系数" align="center">
  48. <el-table-column label="机组" prop="jzs" />
  49. <el-table-column label="K2" prop="k2" />
  50. </el-table-column>
  51. <el-table-column label="效益贡献系数" align="center">
  52. <el-table-column label="账面利润总额" prop="zmlrze" />
  53. <el-table-column label="发电量" prop="fdl" />
  54. <el-table-column label="度电利润" prop="ddlr" />
  55. <el-table-column label="K3" prop="k3" />
  56. </el-table-column>
  57. <el-table-column label="定员管理系数" align="center">
  58. <el-table-column label="定员" prop="dy" />
  59. <el-table-column label="K4" prop="k4" />
  60. </el-table-column>
  61. <el-table-column label="K" prop="k" />
  62. <el-table-column label="填报人" prop="createName" />
  63. <el-table-column label="填报日期" prop="createTime" width="160" />
  64. </el-table>
  65. </el-tab-pane>
  66. </el-tabs>
  67. </div>
  68. <template #footer>
  69. <span class="dialog-footer">
  70. <el-button type="primary" @click="dialogVisible = false">取 消</el-button>
  71. </span>
  72. </template>
  73. </el-dialog>
  74. <import-dailog ref="importPage" @successImport="successImport"></import-dailog>
  75. </div>
  76. </template>
  77. <script>
  78. import importDailog from '../importPage/importDailog.vue'
  79. import {apigetyeargroupcoefficientlistById} from '../../api/api'
  80. import exportIcon from '../../assets/btnIcon/export.png'
  81. import importIcon from '../../assets/btnIcon/import.png'
  82. import ExcelJS from 'exceljs'
  83. import fileSave from 'file-saver'
  84. import * as XLSX from 'xlsx'
  85. import { saveAs } from 'file-saver'
  86. import * as XLSXD from 'xlsx-js-style'
  87. export default {
  88. components: {
  89. importDailog
  90. },
  91. data() {
  92. return {
  93. dialogVisible: false,
  94. activeName: 'first',
  95. quantifiedList: [],
  96. nonQuantifiedList: [],
  97. changeDateSelect: [],
  98. receiptMsg: {
  99. organizationName: '',
  100. des: '',
  101. year: '',
  102. },
  103. exportIcon: exportIcon,
  104. importIcon: importIcon,
  105. rowMsg: {},
  106. weightAllocation: []
  107. }
  108. },
  109. created() {
  110. },
  111. methods: {
  112. init(row) {
  113. this.dialogVisible = true
  114. this.activeName = 'first'
  115. this.getDetails(row.id)
  116. this.rowMsg = row
  117. },
  118. handleClick() {
  119. this.changeDateSelect = []
  120. },
  121. rowClick(selection, row) {
  122. this.changeDateSelect = selection
  123. },
  124. //获取详情
  125. getDetails(id) {
  126. let that = this
  127. let params = {
  128. id: id
  129. }
  130. apigetyeargroupcoefficientlistById(params).then(datas =>{
  131. if (datas && datas.data) {
  132. that.receiptMsg = {
  133. organizationName: datas.data.createOrgName,
  134. year: datas.data.year,
  135. desc: datas.data.des
  136. }
  137. that.weightAllocation = datas.data.coefficientList
  138. }
  139. })
  140. },
  141. handleImport() {
  142. this.$refs.importPage.upload.title = "业绩考核系数信息导入"
  143. this.$refs.importPage.upload.open = true
  144. this.$refs.importPage.upload.url = '/year-operating-coefficient/import'
  145. },
  146. successImport(val) {
  147. this.getDetails(this.rowMsg.id)
  148. },
  149. handleExport() {
  150. let data = [] //接口返回数据
  151. data = this.weightAllocation
  152. const workbook = new ExcelJS.Workbook()
  153. const worksheet = workbook.addWorksheet('Sheet1')
  154. //根据数据自己调整
  155. worksheet.columns = [
  156. { header: 'ID', key: 'id', width: 26 },
  157. { header: '考评单位ID', key: 'organizationId', width: 26 },
  158. { header: '考评单位', key: 'organizationName', width: 26 },
  159. { header: '资产管理系数', key: 'zzc', width: 18},
  160. { header: '', key: 'k1', width: 18 },
  161. { header: '幅度管理系数', key: 'jzs', width: 18 },
  162. { header: '', key: 'k2', width: 18 },
  163. { header: '效益贡献系数', key: 'zmlrze', width: 18 },
  164. { header: '', key: 'fdl', width: 18 },
  165. { header: '', key: 'ddlr', width: 18 },
  166. { header: '', key: 'k3', width: 18 },
  167. { header: '定员管理系数', key: 'dy', width: 18 },
  168. { header: '', key: 'k4', width: 18 },
  169. { header: 'K', key: 'k', width: 26 },
  170. { header: '填报人', key: 'createName', width: 26 },
  171. { header: '填报日期', key: 'createTime', width: 26 },
  172. ]
  173. worksheet.getColumn(3).values = ['资产管理系数', '资产总额'];
  174. worksheet.getColumn(4).values = ['', 'K1'];
  175. worksheet.getColumn(5).values = ['幅度管理系数', '机组'];
  176. worksheet.getColumn(6).values = ['', 'K2'];
  177. worksheet.getColumn(7).values = ['效益贡献系数', '账面利润总额'];
  178. worksheet.getColumn(8).values = ['', '发电量'];
  179. worksheet.getColumn(9).values = ['', '度电利润'];
  180. worksheet.getColumn(10).values = ['', 'K3'];
  181. worksheet.getColumn(11).values = ['定员管理系数', '定员'];
  182. worksheet.getColumn(12).values = ['', 'K4'];
  183. //合并单元格
  184. worksheet.mergeCells('A1:A2');
  185. worksheet.mergeCells('B1:B2');
  186. worksheet.mergeCells('C1:D1');
  187. worksheet.mergeCells('E1:F1');
  188. worksheet.mergeCells('G1:H1:I1:G1');
  189. worksheet.mergeCells('K1:L1');
  190. worksheet.mergeCells('M1:M2');
  191. worksheet.mergeCells('N1:N2');
  192. worksheet.mergeCells('O1:O2');
  193. worksheet.getRow(1).font = {
  194. size: 12,
  195. bold: true
  196. }
  197. worksheet.getRow(2).font = {
  198. size: 12,
  199. bold: true
  200. }
  201. worksheet.addRows(data)
  202. workbook.xlsx.writeBuffer().then(buffer => {
  203. //这里为type
  204. const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8' })
  205. fileSave(blob, `数据导出.xlsx`)
  206. })
  207. },
  208. exportExcel() {
  209. let $e = this.$refs['report-table_day'].$el
  210. try {
  211. let $table = $e.querySelector('.el-table__fixed')
  212. if(!$table) {
  213. $table = $e
  214. }
  215. const wb = XLSX.utils.table_to_book($table, {raw:true})
  216. const wbout = XLSXD.write(wb, {bookType: 'xlsx', bookSST:true, type: 'array'})
  217. saveAs(
  218. new Blob([wbout],{type: 'application/octet-stream'}),
  219. `权重分配数据导出.xlsx`,
  220. )
  221. } catch (e) {
  222. if (typeof console !== 'undefined') console.error(e)
  223. }
  224. }
  225. }
  226. }
  227. </script>
  228. <style lang="less">
  229. .startFrom{
  230. .el-overlay{
  231. .el-dialog{
  232. // margin-top: 7vh;
  233. .el-dialog__body{
  234. padding: 0 20px !important;
  235. .startDetail{
  236. .starttitleSty{
  237. font-size: 18px;
  238. font-family: Microsoft YaHei;
  239. font-weight: bold;
  240. color: #3B7AD1;
  241. // line-height: 12px;
  242. margin: 20px 0 20px 10px;
  243. }
  244. .danjuMsg{
  245. border: 1px solid #D6DBEA;
  246. padding: 10px 20px;
  247. border-radius: 10px;
  248. .danjuMsg_data{
  249. padding: 5px 0 10px 0;
  250. .data_tit{
  251. margin-right: 10px;
  252. font-weight: bold;
  253. font-size: 14px;
  254. font-family: Microsoft YaHei;
  255. color: #8991B0;
  256. }
  257. .data_tit_wd{
  258. display: inline-block;
  259. width: 90px;
  260. }
  261. .el-form-item--small{
  262. .el-input{
  263. height: 25px;
  264. width: 160px;
  265. }
  266. margin-bottom: 0;
  267. .el-input-number{
  268. height: 25px;
  269. .el-input-number__decrease, .el-input-number__increase{
  270. right: -39px;
  271. }
  272. }
  273. }
  274. }
  275. }
  276. .el-select, .el-input{
  277. width: 100%;
  278. }
  279. .detaTableBtns{
  280. display: flex;
  281. width: 200px;
  282. position: relative;
  283. top: 32px;
  284. left: 88vw;
  285. z-index: 11111;
  286. .tableBtn {
  287. display: flex;
  288. margin-right: 30px;
  289. width: 13%;
  290. img{
  291. margin-right: 5px;
  292. margin-top: 1px;
  293. }
  294. span{
  295. font-size: 14px;
  296. font-family: Microsoft YaHei;
  297. font-weight: 400;
  298. }
  299. }
  300. .import{
  301. cursor: pointer;
  302. span{
  303. color: #ce1e78;
  304. }
  305. }
  306. .export{
  307. cursor: pointer;
  308. span{
  309. color: #2baa8a;
  310. }
  311. }
  312. }
  313. .el-tabs{
  314. .el-tabs__header{
  315. .el-tabs__nav{
  316. .el-tabs__item{
  317. font-size: 18px;
  318. font-family: Microsoft YaHei;
  319. font-weight: bold;
  320. margin: 0 10px;
  321. color: #8991B0;
  322. }
  323. .is-active{
  324. font-size: 18px;
  325. font-family: Microsoft YaHei;
  326. font-weight: bold;
  327. color: #3B7AD1;
  328. margin: 0 10px;
  329. }
  330. }
  331. }
  332. .el-table{
  333. .el-table__body-wrapper{
  334. height: 53vh;
  335. }
  336. .el-table__row{
  337. .cell{
  338. .el-input{
  339. height: 24px;
  340. .el-input__inner{
  341. height: 24px;
  342. }
  343. }
  344. }
  345. }
  346. }
  347. }
  348. }
  349. }
  350. .el-dialog__footer{
  351. .dialog-footer{
  352. display: flex;
  353. justify-content: center;
  354. .el-button{
  355. width: 180px !important;
  356. height: 40px !important;
  357. }
  358. }
  359. }
  360. }
  361. }
  362. }
  363. </style>