assessmentApplicationFrom.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <template>
  2. <div class="deptstartFrom">
  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="6">
  8. <div class="danjuMsg_data">
  9. <span class="data_tit">申报编号:</span>
  10. <span>{{receiptMsg.code}}</span>
  11. </div>
  12. <div class="danjuMsg_data">
  13. <span class="data_tit">申报部门:</span>
  14. <span>{{receiptMsg.deptName}}</span>
  15. </div>
  16. </el-col>
  17. <el-col :span="6">
  18. <div class="danjuMsg_data">
  19. <span class="data_tit">申报简述:</span>
  20. <span>{{receiptMsg.des}}</span>
  21. </div>
  22. <div class="danjuMsg_data">
  23. <span class="data_tit">申报领导:</span>
  24. <span>{{receiptMsg.deptLeaderName}}</span>
  25. </div>
  26. </el-col>
  27. <el-col :span="6">
  28. <div class="danjuMsg_data">
  29. <span class="data_tit">流程状态:</span>
  30. <span>{{receiptMsg.stage}}</span>
  31. </div>
  32. <div class="danjuMsg_data">
  33. <span class="data_tit">申报年度:</span>
  34. <span>{{receiptMsg.year}}</span>
  35. </div>
  36. </el-col>
  37. <el-col :span="6">
  38. <div class="danjuMsg_data">
  39. <span class="data_tit">创建日期:</span>
  40. <span>{{receiptMsg.createDate}}</span>
  41. </div>
  42. <div class="danjuMsg_data">
  43. <span class="data_tit">申报级别:</span>
  44. <span>{{receiptMsg.declarationLevel}}级</span>
  45. </div>
  46. </el-col>
  47. </el-row>
  48. <div class="btnASeach">
  49. <div class="detaTableBtns">
  50. <div class="tableBtn add" @click="addTableDetail">
  51. <img :src="addIcon" alt="">
  52. <span>新增</span>
  53. </div>
  54. <div class="tableBtn save" @click="saveDetail">
  55. <img :src="saveIcon" alt="">
  56. <span>保存</span>
  57. </div>
  58. <div class="tableBtn import" @click="handleImport">
  59. <img :src="importIcon" alt="">
  60. <span>导入</span>
  61. </div>
  62. <div class="tableBtn export" @click="handleExport">
  63. <img :src="exportIcon" alt="">
  64. <span>导出</span>
  65. </div>
  66. </div>
  67. </div>
  68. <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
  69. <el-tab-pane label="考评指标项内容" name="first">
  70. <el-table :data="quantifiedList.slice((pageLeft.currentPage-1)*pageLeft.pagesize, pageLeft.currentPage*pageLeft.pagesize)"
  71. style="width: 100%">
  72. <el-table-column label="序号" type="index" width="80" />
  73. <el-table-column label="人员" prop="deptName">
  74. <template #default="scope">
  75. <el-select v-model="scope.row.employeeId" placeholder="请选择人员">
  76. <el-option
  77. v-for="item in deptLeaderOptionDet"
  78. :key="item.id"
  79. :label="item.name"
  80. :value="item.id">
  81. </el-option>
  82. </el-select>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="建议值">
  86. <template #default="scope">
  87. <el-input-number v-model="scope.row.suggestedValue" :precision="2" :step="0.1" :min="0" />
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="排序" >
  91. <template #default="scope">
  92. <el-input-number v-model="scope.row.serialNumber" :min="1" />
  93. </template>
  94. </el-table-column>
  95. </el-table>
  96. <el-pagination
  97. @current-change="handleCurrentChangeLeft"
  98. :current-page="pageLeft.currentPage"
  99. :page-size="pageLeft.pagesize"
  100. layout="total, prev, pager, next, jumper"
  101. :total="pageLeft.total">
  102. </el-pagination>
  103. </el-tab-pane>
  104. </el-tabs>
  105. </div>
  106. <template #footer>
  107. <span class="dialog-footer">
  108. <el-button type="primary" @click="dialogVisible = false">取 消</el-button>
  109. </span>
  110. </template>
  111. </el-dialog>
  112. <import-dailog ref="importPage" @successImport="successImport" @importLoading="importLoading"></import-dailog>
  113. </div>
  114. </template>
  115. <script>
  116. import importDailog from '../importPage/importDailog.vue'
  117. import {apiPostevaluationdeptadDetails,apiGetevaluationdeptadUpdate, apiPostevaluationdeptadDetailsHead, apiGetuserPageList} from '../../api/api'
  118. import ExcelJS from 'exceljs'
  119. import fileSave from 'file-saver'
  120. import addIcon from '../../assets/btnIcon/add.png'
  121. import saveIcon from '../../assets/btnIcon/save.png'
  122. import editIcon from '../../assets/btnIcon/edit.png'
  123. import deleteIcon from '../../assets/btnIcon/delete.png'
  124. import exportIcon from '../../assets/btnIcon/export.png'
  125. import importIcon from '../../assets/btnIcon/import.png'
  126. export default {
  127. components: {
  128. importDailog
  129. },
  130. data() {
  131. return {
  132. dialogVisible: false,
  133. activeName: 'first',
  134. quantifiedList: [],
  135. changeDateSelect: [],
  136. receiptMsg: {
  137. code: '',
  138. des: '',
  139. stage: '',
  140. createName: '',
  141. createDate: '',
  142. type: '',
  143. year: '',
  144. recStage: ''
  145. },
  146. addIcon: addIcon,
  147. saveIcon: saveIcon,
  148. editIcon: editIcon,
  149. deleteIcon: deleteIcon,
  150. exportIcon: exportIcon,
  151. importIcon: importIcon,
  152. rowMsg: {},
  153. orgruleData: [],
  154. indicItemoptions: [],
  155. sectionNameArr: [],
  156. deptNameArr: [],
  157. pageLeft:{
  158. pagesize: 15,
  159. currentPage: 1,
  160. total: 0
  161. },
  162. pageRight:{
  163. pagesize: 15,
  164. currentPage: 1,
  165. total: 0
  166. },
  167. deptLeaderOptionDet: []
  168. }
  169. },
  170. created() {
  171. },
  172. methods: {
  173. init(row) {
  174. this.dialogVisible = true
  175. this.activeName = 'first'
  176. this.getDetails(row.id)
  177. // this.getDetailsHeader(row.id)
  178. this.changeDeptLead(row.deptId)
  179. this.rowMsg = row
  180. this.$nextTick(() =>{
  181. this.receiptMsg = {
  182. code: row.orderNumber,
  183. des: row.declarationReason,
  184. stage: row.stage,
  185. deptLeaderName: row.deptLeaderName,
  186. deptName: row.deptName,
  187. createDate: row.createTime,
  188. year: row.annual,
  189. declarationLevel: row.declarationLevel
  190. }
  191. })
  192. },
  193. // 根据部门查询人员
  194. changeDeptLead(val) {
  195. let that = this
  196. let params = {
  197. current: 1,
  198. size: 500,
  199. orgId: val
  200. }
  201. apiGetuserPageList(params).then(datas =>{
  202. if (datas && datas.data) {
  203. that.deptLeaderOptionDet = datas.data.records
  204. }
  205. })
  206. },
  207. handleClick() {
  208. this.changeDateSelect = []
  209. },
  210. handleCurrentChangeLeft(val) {
  211. this.pageLeft.currentPage = val
  212. },
  213. //获取详情头数据
  214. getDetailsHeader(id) {
  215. let that = this
  216. apiPostevaluationdeptadDetailsHead(id).then(datas =>{
  217. if (datas && datas.data) {
  218. let row = datas.data
  219. that.receiptMsg = {
  220. code: row.orderNumber,
  221. des: row.des,
  222. stage: row.stage,
  223. createName: row.createName,
  224. createDate: row.createTime,
  225. type: row.checkCycle === 'YDKP'?'月度考评':row.checkCycle === 'JDKP'?'季度考评':'年度考评',
  226. year: row.appraisalYear,
  227. recStage: '有效'
  228. }
  229. }
  230. })
  231. },
  232. //获取详情
  233. getDetails(id) {
  234. let that = this
  235. that.quantifiedList = []
  236. apiPostevaluationdeptadDetails(id).then(datas =>{
  237. if (datas && datas.data) {
  238. that.quantifiedList = datas.data
  239. that.pageLeft.total = datas.data.length
  240. }
  241. })
  242. },
  243. addTableDetail() {
  244. let obj = {
  245. showInput: true,
  246. businessPlanId: this.rowMsg.id,
  247. employeeId: '',
  248. baseScore: 0,
  249. serialNumber: 0
  250. }
  251. this.quantifiedList.unshift(obj)
  252. },
  253. saveDetail() {
  254. let that = this
  255. let params = []
  256. that.quantifiedList.forEach(item =>{
  257. let emName = ''
  258. that.deptLeaderOptionDet.forEach(it =>{
  259. if (item.employeeId === it.id) {
  260. emName = it.name
  261. }
  262. })
  263. let obj = {
  264. assessmentDeclarationId: that.rowMsg.id,
  265. employeeId: item.employeeId,
  266. employeeName: emName,
  267. suggestedValue: item.suggestedValue.toString(),
  268. serialNumber: item.serialNumber.toString()
  269. }
  270. if (!item.showInput) {
  271. obj.id = item.id
  272. }
  273. params.push(obj)
  274. })
  275. apiGetevaluationdeptadUpdate(params).then(datas =>{
  276. if (datas) {
  277. if (datas.success) {
  278. that.$message({
  279. message: '保存成功',
  280. type: 'success'
  281. });
  282. that.getDetails(that.rowMsg.id)
  283. } else {
  284. that.$message({
  285. message: datas.data,
  286. type: 'error'
  287. })
  288. }
  289. }
  290. })
  291. },
  292. handleImport() {
  293. this.$refs.importPage.upload.title = "绩效结果考核申报导入"
  294. this.$refs.importPage.upload.open = true
  295. this.$refs.importPage.upload.url = '/evaluation-dept-ad/import'
  296. },
  297. successImport(val) {
  298. this.getDetails(this.rowMsg.id)
  299. },
  300. handleExport() {
  301. let data = this.quantifiedList //接口返回数据
  302. const workbook = new ExcelJS.Workbook()
  303. const worksheet = workbook.addWorksheet('Sheet1')
  304. //根据数据自己调整
  305. let colums = []
  306. colums = [
  307. { header: 'ID', key: 'id', width: 26 },
  308. { header: '申报ID', key: 'assessmentDeclarationId', width: 26 },
  309. { header: '员工ID', key: 'employeeId', width: 26 },
  310. { header: '员工名称', key: 'employeeName', width: 26 },
  311. { header: '序号', key: 'serialNumber', width: 26 },
  312. { header: '建议值', key: 'suggestedValue', width: 26 },
  313. ]
  314. worksheet.columns = colums
  315. worksheet.getRow(1).font = {
  316. size: 12,
  317. bold: true
  318. }
  319. worksheet.addRows(data)
  320. workbook.xlsx.writeBuffer().then(buffer => {
  321. //这里为type
  322. const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8' })
  323. fileSave(blob, `绩效结果考核申报数据导出.xlsx`)
  324. })
  325. },
  326. }
  327. }
  328. </script>
  329. <style lang="less">
  330. .deptstartFrom{
  331. .el-overlay{
  332. .el-dialog{
  333. // margin-top: 7vh;
  334. .el-dialog__body{
  335. padding: 0 20px !important;
  336. .startDetail{
  337. .starttitleSty{
  338. font-size: 18px;
  339. font-family: Microsoft YaHei;
  340. font-weight: bold;
  341. color: #3B7AD1;
  342. // line-height: 12px;
  343. margin: 20px 0 20px 10px;
  344. }
  345. .danjuMsg{
  346. border: 1px solid #D6DBEA;
  347. padding: 10px 20px;
  348. border-radius: 10px;
  349. margin-bottom: 20px;
  350. .danjuMsg_data{
  351. padding: 5px 0 10px 0;
  352. .data_tit{
  353. margin-right: 10px;
  354. font-weight: bold;
  355. font-size: 14px;
  356. font-family: Microsoft YaHei;
  357. color: #8991B0;
  358. }
  359. .data_tit_wd{
  360. display: inline-block;
  361. width: 90px;
  362. }
  363. .el-form-item--small{
  364. .el-input{
  365. height: 25px;
  366. width: 160px;
  367. }
  368. margin-bottom: 0;
  369. .el-input-number{
  370. height: 25px;
  371. .el-input-number__decrease, .el-input-number__increase{
  372. right: -39px;
  373. }
  374. }
  375. }
  376. }
  377. }
  378. .el-select, .el-input{
  379. width: 100%;
  380. }
  381. .btnASeach{
  382. display: flex;
  383. z-index: 11111;
  384. justify-content: end;
  385. position: relative;
  386. top: 32px;
  387. left: 50vw;
  388. width: 50%;
  389. .detaTableBtns{
  390. display: flex;
  391. width: 300px;
  392. margin-top: 5px;
  393. .tableBtn {
  394. display: flex;
  395. height: 20px;
  396. margin: 0 10px;
  397. img{
  398. margin-right: 5px;
  399. margin-top: 1px;
  400. }
  401. span{
  402. font-size: 14px;
  403. font-family: Microsoft YaHei;
  404. font-weight: 400;
  405. }
  406. }
  407. .add{
  408. cursor: pointer;
  409. span{
  410. color: #3B7AD1;
  411. }
  412. }
  413. .save{
  414. cursor: pointer;
  415. span{
  416. color: #50C14E;
  417. }
  418. }
  419. .edit{
  420. span{
  421. color: #F5A623;
  422. }
  423. }
  424. .delete{
  425. cursor: no-drop;
  426. span{
  427. color: #F65177;
  428. }
  429. }
  430. .import{
  431. cursor: pointer;
  432. span{
  433. color: #ce1e78;
  434. }
  435. }
  436. .export{
  437. cursor: pointer;
  438. span{
  439. color: #2baa8a;
  440. }
  441. }
  442. }
  443. }
  444. .el-tabs{
  445. .el-tabs__header{
  446. .el-tabs__nav{
  447. .el-tabs__item{
  448. font-size: 18px;
  449. font-family: Microsoft YaHei;
  450. font-weight: bold;
  451. margin: 0 10px;
  452. color: #8991B0;
  453. }
  454. .is-active{
  455. font-size: 18px;
  456. font-family: Microsoft YaHei;
  457. font-weight: bold;
  458. color: #3B7AD1;
  459. margin: 0 10px;
  460. }
  461. }
  462. }
  463. .el-table{
  464. margin-bottom: 10px;
  465. .el-table__body-wrapper{
  466. height: 50vh;
  467. }
  468. .el-table__row{
  469. .cell{
  470. .el-input{
  471. height: 24px;
  472. .el-input__inner{
  473. height: 24px;
  474. }
  475. }
  476. }
  477. }
  478. }
  479. }
  480. }
  481. }
  482. .el-dialog__footer{
  483. .dialog-footer{
  484. display: flex;
  485. justify-content: center;
  486. .el-button{
  487. width: 180px !important;
  488. height: 40px !important;
  489. }
  490. }
  491. }
  492. }
  493. }
  494. }
  495. </style>