assessmentApplicationFrom.vue 21 KB

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