evaluationDeptBusinessFrom.vue 23 KB

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