evaluationDeptStartFrom.vue 27 KB

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