assessmentApplicationFrom.vue 25 KB

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