assessmentApplicationFrom.vue 25 KB

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