evaluationDeptStartFrom.vue 23 KB

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