evaluationDeptStartFrom.vue 26 KB

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