assessmentApplicationFrom.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. <template>
  2. <div class="applicationFrom">
  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.declarationLevel}}</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.month}}</span>
  45. </div>
  46. </el-col>
  47. <el-col :span="6">
  48. <div class="danjuMsg_data">
  49. <span class="data_tit">评定等级:</span>
  50. <span>{{receiptMsg.ratingGrade}}</span>
  51. </div>
  52. </el-col>
  53. <el-col :span="18">
  54. <div class="danjuMsg_data">
  55. <span class="data_tit">申报理由:</span>
  56. <span>{{receiptMsg.des}}</span>
  57. </div>
  58. </el-col>
  59. </el-row>
  60. <div class="btnASeach">
  61. <div class="detaTableBtns">
  62. <div class="tableBtn add" @click="addTableDetail" v-if="isShowFn(receiptMsg.stage)">
  63. <img :src="addIcon" alt="">
  64. <span>新增</span>
  65. </div>
  66. <div class="tableBtn save" @click="saveDetail" v-if="isShowFn(receiptMsg.stage)">
  67. <img :src="saveIcon" alt="">
  68. <span>保存</span>
  69. </div>
  70. <div class="tableBtn delete" @click="handleDelete" v-if="isShowFn(receiptMsg.stage)">
  71. <img :src="deleteIcon" alt="">
  72. <span>删除</span>
  73. </div>
  74. <div class="tableBtn import" @click="handleImport" v-if="isShowFn(receiptMsg.stage)">
  75. <img :src="importIcon" alt="">
  76. <span>导入</span>
  77. </div>
  78. <div class="tableBtn export" @click="handleExport">
  79. <img :src="exportIcon" alt="">
  80. <span>导出</span>
  81. </div>
  82. </div>
  83. </div>
  84. <el-tabs v-model="activeName" class="demo-tabs">
  85. <el-tab-pane label="考评指标项内容" name="first">
  86. <el-table :data="quantifiedList.slice((pageLeft.currentPage-1)*pageLeft.pagesize, pageLeft.currentPage*pageLeft.pagesize)"
  87. style="width: 100%" @select="rowClick" @select-all="rowClick">
  88. <el-table-column type="selection" label="操作" align="center"></el-table-column>
  89. <el-table-column label="序号" type="index" width="80" />
  90. <el-table-column label="人员编号">
  91. <template #default="scope">
  92. <el-input v-model="scope.row.employeeNo" @blur="employeeNoInputBlur(scope.row.employeeNo, scope.row)" />
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="人员">
  96. <template #default="scope">
  97. <!-- <el-select v-model="scope.row.employeeId" placeholder="请选择人员">
  98. <el-option
  99. v-for="item in deptLeaderOptionDet"
  100. :key="item.id"
  101. :label="item.name"
  102. :value="item.id">
  103. <span style="float: left;display:inline-block;width:100px">{{ item.name }}</span>
  104. <span style="float: right;color: #909399;font-size: 13px;" >{{ item.no }}</span>
  105. </el-option>
  106. </el-select> -->
  107. <span>{{scope.row.employeeName}}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="建议值">
  111. <template #default="scope">
  112. <el-input-number v-model="scope.row.suggestedValue" :precision="2" :step="0.1" :min="0" />
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="排序" >
  116. <template #default="scope">
  117. <el-input-number v-model="scope.row.serialNumber" :min="1" />
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="操作" width="120">
  121. <template #default="scope">
  122. <p class="indicitem" v-if="receiptMsg.stage !== '流程已结束'" @click="deleteRowFn(scope.row, scope.$index)">删除</p>
  123. </template>
  124. </el-table-column>
  125. </el-table>
  126. <el-pagination
  127. @current-change="handleCurrentChangeLeft"
  128. :current-page="pageLeft.currentPage"
  129. :page-size="pageLeft.pagesize"
  130. layout="total, prev, pager, next, jumper"
  131. :total="pageLeft.total">
  132. </el-pagination>
  133. </el-tab-pane>
  134. </el-tabs>
  135. </div>
  136. <template #footer>
  137. <span class="dialog-footer">
  138. <el-button type="primary" @click="dialogVisible = false">取 消</el-button>
  139. </span>
  140. </template>
  141. </el-dialog>
  142. <import-dailog ref="importPage" @successImport="successImport" @importLoading="importLoading"></import-dailog>
  143. </div>
  144. </template>
  145. <script>
  146. import importDailog from '../importPage/importDailog.vue'
  147. import {apiPostevaluationdeptadDetails,apiGetevaluationdeptadUpdate, apiGetevaluationdeptadDelete,
  148. apiPostevaluationdeptadDetailsHead, apiGetuserPageList} from '../../api/api'
  149. import ExcelJS from 'exceljs'
  150. import fileSave from 'file-saver'
  151. import addIcon from '../../assets/btnIcon/add.png'
  152. import saveIcon from '../../assets/btnIcon/save.png'
  153. import editIcon from '../../assets/btnIcon/edit.png'
  154. import deleteIcon from '../../assets/btnIcon/delete.png'
  155. import exportIcon from '../../assets/btnIcon/export.png'
  156. import importIcon from '../../assets/btnIcon/import.png'
  157. export default {
  158. components: {
  159. importDailog
  160. },
  161. data() {
  162. return {
  163. dialogVisible: false,
  164. activeName: 'first',
  165. quantifiedList: [],
  166. changeDateSelect: [],
  167. receiptMsg: {
  168. code: '',
  169. des: '',
  170. stage: '',
  171. createName: '',
  172. createDate: '',
  173. type: '',
  174. year: '',
  175. month: '',
  176. recStage: ''
  177. },
  178. addIcon: addIcon,
  179. saveIcon: saveIcon,
  180. editIcon: editIcon,
  181. deleteIcon: deleteIcon,
  182. exportIcon: exportIcon,
  183. importIcon: importIcon,
  184. rowMsg: {},
  185. orgruleData: [],
  186. indicItemoptions: [],
  187. sectionNameArr: [],
  188. deptNameArr: [],
  189. pageLeft:{
  190. pagesize: 15,
  191. currentPage: 1,
  192. total: 0
  193. },
  194. pageRight:{
  195. pagesize: 15,
  196. currentPage: 1,
  197. total: 0
  198. },
  199. deptLeaderOptionDet: [],
  200. userMes: {}
  201. }
  202. },
  203. created() {
  204. },
  205. methods: {
  206. init(row) {
  207. this.dialogVisible = true
  208. this.activeName = 'first'
  209. this.getDetails(row.id)
  210. this.userMes = JSON.parse(window.sessionStorage.getItem('user'))
  211. // this.getDetailsHeader(row.id)
  212. // this.changeDeptLead(row.deptId)
  213. this.rowMsg = row
  214. this.$nextTick(() =>{
  215. this.receiptMsg = {
  216. code: row.orderNumber,
  217. des: row.declarationReason,
  218. stage: row.stage,
  219. ratingGrade: row.ratingGrade,
  220. deptLeaderName: row.deptLeaderName,
  221. deptName: row.deptName,
  222. createDate: row.createTime,
  223. year: row.annual,
  224. month: row.declarationMonth,
  225. declarationLevel: row.declarationLevel
  226. }
  227. })
  228. },
  229. // 判断保存 导入按钮展示权限
  230. isShowFn(val) {
  231. let show = true
  232. if (val === '流程已结束') {
  233. show = false
  234. } else {
  235. if (this.userMes.deptId !== '23031009') {
  236. show = false
  237. }
  238. }
  239. return show
  240. },
  241. rowClick(selection, row) {
  242. this.changeDateSelect = selection
  243. },
  244. //删除指标数据
  245. handleDelete() {
  246. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  247. confirmButtonText: '确定',
  248. cancelButtonText: '取消',
  249. type: 'warning'
  250. }).then(() => {
  251. let that = this
  252. let paramsArr = []
  253. that.changeDateSelect.forEach(it =>{
  254. paramsArr.push(it.id)
  255. })
  256. apiGetevaluationdeptadDelete(paramsArr.join(',')).then(datas =>{
  257. if (datas) {
  258. that.$message({
  259. type: 'success',
  260. message: '删除成功!'
  261. });
  262. that.changeDateSelect = []
  263. that.getDetails(that.rowMsg.id)
  264. }
  265. })
  266. })
  267. },
  268. handleCurrentChangeLeft(val) {
  269. this.pageLeft.currentPage = val
  270. },
  271. //获取详情头数据
  272. getDetailsHeader(id) {
  273. let that = this
  274. apiPostevaluationdeptadDetailsHead(id).then(datas =>{
  275. if (datas && datas.data) {
  276. let row = datas.data
  277. that.receiptMsg = {
  278. code: row.orderNumber,
  279. des: row.des,
  280. stage: row.stage,
  281. createName: row.createName,
  282. createDate: row.createTime,
  283. type: row.checkCycle === 'YDKP'?'月度考评':row.checkCycle === 'JDKP'?'季度考评':'年度考评',
  284. year: row.appraisalYear,
  285. month: row.declarationMonth,
  286. recStage: '有效'
  287. }
  288. }
  289. })
  290. },
  291. //获取详情
  292. getDetails(id) {
  293. let that = this
  294. that.quantifiedList = []
  295. apiPostevaluationdeptadDetails(id).then(datas =>{
  296. if (datas && datas.data) {
  297. datas.data.forEach(it =>{
  298. it.serialNumber = it.serialNumber.toString()
  299. })
  300. that.quantifiedList = datas.data
  301. that.pageLeft.total = datas.data.length
  302. }
  303. })
  304. },
  305. employeeNoInputBlur(val, row) {
  306. row.employeeId = ''
  307. // this.deptLeaderOptionDet.forEach(it =>{
  308. // if (val === it.no) {
  309. // row.employeeId = it.id
  310. // }
  311. // })
  312. this.changeDeptLead(val, row)
  313. },
  314. // 根据部门查询人员
  315. changeDeptLead(val, row) {
  316. let that = this
  317. let params = {
  318. current: 1,
  319. size: 500,
  320. no: val
  321. }
  322. apiGetuserPageList(params).then(datas =>{
  323. if (datas && datas.data) {
  324. // that.deptLeaderOptionDet = datas.data.records
  325. row.employeeName = datas.data.records[0].name
  326. row.employeeId = datas.data.records[0].id
  327. }
  328. })
  329. },
  330. addTableDetail() {
  331. this.pageLeft.currentPage = 1
  332. let obj = {
  333. showInput: true,
  334. businessPlanId: this.rowMsg.id,
  335. employeeId: '',
  336. employeeNo: '',
  337. suggestedValue: 1.00,
  338. serialNumber: 0
  339. }
  340. this.quantifiedList.unshift(obj)
  341. },
  342. saveDetail() {
  343. let that = this
  344. let params = []
  345. that.quantifiedList.forEach(item =>{
  346. // let emName = ''
  347. // let emNo = ''
  348. // that.deptLeaderOptionDet.forEach(it =>{
  349. // if (item.employeeId === it.id) {
  350. // emName = it.name
  351. // emNo = it.no
  352. // }
  353. // })
  354. let obj = {
  355. assessmentDeclarationId: that.rowMsg.id,
  356. employeeId: item.employeeId,
  357. employeeName: item.employeeName,
  358. employeeNo: item.employeeNo ? item.employeeNo : emNo,
  359. suggestedValue: Number(item.suggestedValue).toFixed(2),
  360. serialNumber: item.serialNumber
  361. }
  362. if (!item.showInput) {
  363. obj.id = item.id
  364. }
  365. params.push(obj)
  366. })
  367. apiGetevaluationdeptadUpdate(params).then(datas =>{
  368. if (datas) {
  369. if (datas.success) {
  370. that.$message({
  371. message: '保存成功',
  372. type: 'success'
  373. });
  374. that.getDetails(that.rowMsg.id)
  375. } else {
  376. that.$message({
  377. message: datas.message,
  378. type: 'error'
  379. })
  380. }
  381. }
  382. })
  383. },
  384. deleteRowFn(row, index) {
  385. let that = this
  386. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  387. confirmButtonText: '确定',
  388. cancelButtonText: '取消',
  389. type: 'warning'
  390. }).then(() => {
  391. if (!row.id) {
  392. that.quantifiedList.splice(index, 1)
  393. } else {
  394. apiGetevaluationdeptadDelete(row.id).then(datas =>{
  395. if (datas) {
  396. that.$message({
  397. type: 'success',
  398. message: '删除成功!'
  399. });
  400. that.getDetails(that.rowMsg.id)
  401. }
  402. })
  403. }
  404. })
  405. },
  406. handleImport() {
  407. this.$refs.importPage.upload.title = "绩效结果考核申报导入"
  408. this.$refs.importPage.upload.data = {id: this.rowMsg.id}
  409. this.$refs.importPage.upload.open = true
  410. this.$refs.importPage.upload.url = '/evaluation-dept-ad/import'
  411. },
  412. successImport(val) {
  413. this.$message({
  414. type: 'success',
  415. message: val.message
  416. });
  417. this.getDetails(this.rowMsg.id)
  418. },
  419. handleExport() {
  420. let data = this.quantifiedList //接口返回数据
  421. const workbook = new ExcelJS.Workbook()
  422. const worksheet = workbook.addWorksheet('Sheet1')
  423. //根据数据自己调整
  424. let colums = []
  425. colums = [
  426. // { header: 'ID', key: 'id', width: 26, hidden: true },
  427. // { header: '申报ID', key: 'assessmentDeclarationId', width: 26, hidden: true },
  428. { header: '人员编号', key: 'employeeNo', width: 26 },
  429. // { header: '员工ID', key: 'employeeId', width: 26 },
  430. { header: '员工名称', key: 'employeeName', width: 26 },
  431. { header: '建议值', key: 'suggestedValue', width: 26 },
  432. { header: '排序', key: 'serialNumber', width: 26 },
  433. ]
  434. worksheet.columns = colums
  435. worksheet.getRow(1).font = {
  436. size: 12,
  437. bold: true
  438. }
  439. worksheet.addRows(data)
  440. workbook.xlsx.writeBuffer().then(buffer => {
  441. //这里为type
  442. const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8' })
  443. fileSave(blob, `绩效结果考核申报数据导出.xlsx`)
  444. })
  445. },
  446. }
  447. }
  448. </script>
  449. <style lang="less">
  450. .applicationFrom{
  451. .el-overlay{
  452. .el-dialog{
  453. // margin-top: 7vh;
  454. .el-dialog__body{
  455. padding: 0 20px !important;
  456. .startDetail{
  457. .starttitleSty{
  458. font-size: 18px;
  459. font-family: Microsoft YaHei;
  460. font-weight: bold;
  461. color: #3B7AD1;
  462. // line-height: 12px;
  463. margin: 20px 0 20px 10px;
  464. }
  465. .danjuMsg{
  466. border: 1px solid #D6DBEA;
  467. padding: 10px 20px;
  468. border-radius: 10px;
  469. margin-bottom: 10px;
  470. .danjuMsg_data{
  471. padding: 5px 0 10px 0;
  472. .data_tit{
  473. margin-right: 10px;
  474. font-weight: bold;
  475. font-size: 14px;
  476. font-family: Microsoft YaHei;
  477. color: #8991B0;
  478. }
  479. .data_tit_wd{
  480. display: inline-block;
  481. width: 90px;
  482. }
  483. .el-form-item--small{
  484. .el-input{
  485. height: 25px;
  486. width: 160px;
  487. }
  488. margin-bottom: 0;
  489. .el-input-number{
  490. height: 25px;
  491. .el-input-number__decrease, .el-input-number__increase{
  492. right: -39px;
  493. }
  494. }
  495. }
  496. }
  497. }
  498. .el-select, .el-input{
  499. width: 100%;
  500. }
  501. .btnASeach{
  502. display: flex;
  503. z-index: 11111;
  504. justify-content: flex-end;
  505. position: relative;
  506. top: 32px;
  507. // left: 48vw;
  508. width: 100%;
  509. .detaTableBtns{
  510. display: flex;
  511. justify-content: flex-end;
  512. width: 410px;
  513. margin-top: 5px;
  514. .tableBtn {
  515. display: flex;
  516. height: 20px;
  517. margin: 0 10px;
  518. // width: 20%;
  519. width: fit-content;
  520. img{
  521. margin-right: 5px;
  522. margin-top: 1px;
  523. }
  524. span{
  525. width: 35px;
  526. display: inline-block;
  527. font-size: 14px;
  528. font-family: Microsoft YaHei;
  529. font-weight: 400;
  530. }
  531. }
  532. .add{
  533. cursor: pointer;
  534. span{
  535. color: #3B7AD1;
  536. }
  537. }
  538. .save{
  539. cursor: pointer;
  540. span{
  541. color: #50C14E;
  542. }
  543. }
  544. .edit{
  545. span{
  546. color: #F5A623;
  547. }
  548. }
  549. .delete{
  550. cursor: pointer;
  551. span{
  552. color: #F65177;
  553. }
  554. }
  555. .import{
  556. cursor: pointer;
  557. span{
  558. color: #ce1e78;
  559. }
  560. }
  561. .export{
  562. cursor: pointer;
  563. span{
  564. color: #2baa8a;
  565. }
  566. }
  567. }
  568. }
  569. .el-tabs{
  570. .el-tabs__header{
  571. .el-tabs__nav{
  572. .el-tabs__item{
  573. font-size: 18px;
  574. font-family: Microsoft YaHei;
  575. font-weight: bold;
  576. margin: 0 10px;
  577. color: #8991B0;
  578. }
  579. .is-active{
  580. font-size: 18px;
  581. font-family: Microsoft YaHei;
  582. font-weight: bold;
  583. color: #3B7AD1;
  584. margin: 0 10px;
  585. }
  586. }
  587. }
  588. .el-table{
  589. margin-bottom: 10px;
  590. .el-table__body-wrapper{
  591. height: 50vh;
  592. }
  593. .el-table__row{
  594. .cell{
  595. .el-input{
  596. height: 24px;
  597. .el-input__inner{
  598. height: 24px;
  599. }
  600. }
  601. }
  602. }
  603. .indicitem{
  604. color: #F65177;
  605. font-size: 12px;
  606. margin-right: 20px;
  607. cursor:pointer;
  608. &:hover{
  609. text-decoration: underline;
  610. }
  611. }
  612. }
  613. }
  614. }
  615. }
  616. .el-dialog__footer{
  617. .dialog-footer{
  618. display: flex;
  619. justify-content: center;
  620. .el-button{
  621. width: 180px !important;
  622. height: 40px !important;
  623. }
  624. }
  625. }
  626. }
  627. }
  628. }
  629. </style>