evaluationDeptBusinessFrom.vue 22 KB

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