evaluationDeptBusinessFrom.vue 26 KB

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