taskApplicationFrom.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  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-column label="操作" width="120">
  101. <template #default="scope">
  102. <p class="indicitem" @click="deleteRowFn(scope.row)">删除</p>
  103. </template>
  104. </el-table-column>
  105. </el-table>
  106. <el-pagination
  107. @current-change="handleCurrentChangeLeft"
  108. :current-page="pageLeft.currentPage"
  109. :page-size="pageLeft.pagesize"
  110. layout="total, prev, pager, next, jumper"
  111. :total="pageLeft.total">
  112. </el-pagination>
  113. </el-tab-pane>
  114. </el-tabs>
  115. <div>
  116. <p class="starttitleSty">审批意见:</p>
  117. <el-input v-model="descMsg" :rows="3" type="textarea" placeholder="请输入审批意见"></el-input>
  118. </div>
  119. </div>
  120. <template #footer>
  121. <span class="dialog-footer">
  122. <el-button type="primary" @click="examineAndApprove('agree')">同 意</el-button>
  123. <el-button @click="examineAndApprove('reject')">拒 绝</el-button>
  124. </span>
  125. </template>
  126. </el-dialog>
  127. <import-dailog ref="importPage" @successImport="successImport" @importLoading="importLoading"></import-dailog>
  128. </div>
  129. </template>
  130. <script>
  131. import importDailog from '../importPage/importDailog.vue'
  132. import {apiPostevaluationdeptadDetails,apiGetevaluationdeptadUpdate, apiGetevaluationdeptadDelete,apiPostIsdoAction,
  133. apiPostevaluationdeptadDetailsHead, apiGetuserPageList} from '../../api/api'
  134. import ExcelJS from 'exceljs'
  135. import fileSave from 'file-saver'
  136. import addIcon from '../../assets/btnIcon/add.png'
  137. import saveIcon from '../../assets/btnIcon/save.png'
  138. import editIcon from '../../assets/btnIcon/edit.png'
  139. import deleteIcon from '../../assets/btnIcon/delete.png'
  140. import exportIcon from '../../assets/btnIcon/export.png'
  141. import importIcon from '../../assets/btnIcon/import.png'
  142. export default {
  143. components: {
  144. importDailog
  145. },
  146. data() {
  147. return {
  148. dialogVisible: false,
  149. activeName: 'first',
  150. quantifiedList: [],
  151. changeDateSelect: [],
  152. descMsg: '',
  153. receiptMsg: {
  154. code: '',
  155. des: '',
  156. stage: '',
  157. createName: '',
  158. createDate: '',
  159. type: '',
  160. year: '',
  161. recStage: ''
  162. },
  163. addIcon: addIcon,
  164. saveIcon: saveIcon,
  165. editIcon: editIcon,
  166. deleteIcon: deleteIcon,
  167. exportIcon: exportIcon,
  168. importIcon: importIcon,
  169. rowMsg: {},
  170. orgruleData: [],
  171. indicItemoptions: [],
  172. sectionNameArr: [],
  173. deptNameArr: [],
  174. pageLeft:{
  175. pagesize: 15,
  176. currentPage: 1,
  177. total: 0
  178. },
  179. pageRight:{
  180. pagesize: 15,
  181. currentPage: 1,
  182. total: 0
  183. },
  184. deptLeaderOptionDet: []
  185. }
  186. },
  187. created() {
  188. },
  189. methods: {
  190. init(row, id) {
  191. this.dialogVisible = true
  192. this.activeName = 'first'
  193. this.getDetails(id)
  194. this.getDetailsHeader(id)
  195. this.changeDeptLead(row.deptId)
  196. this.rowMsg = row
  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. deleteRowFn(row) {
  313. let that = this
  314. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  315. confirmButtonText: '确定',
  316. cancelButtonText: '取消',
  317. type: 'warning'
  318. }).then(() => {
  319. apiGetevaluationdeptadDelete(row.id).then(datas =>{
  320. if (datas) {
  321. that.$message({
  322. type: 'success',
  323. message: '删除成功!'
  324. });
  325. that.getDetails(that.rowMsg.id)
  326. }
  327. })
  328. })
  329. },
  330. handleImport() {
  331. this.$refs.importPage.upload.title = "绩效结果考核申报导入"
  332. this.$refs.importPage.upload.open = true
  333. this.$refs.importPage.upload.url = '/evaluation-dept-ad/import'
  334. },
  335. successImport(val) {
  336. this.getDetails(this.rowMsg.id)
  337. },
  338. handleExport() {
  339. let data = this.quantifiedList //接口返回数据
  340. const workbook = new ExcelJS.Workbook()
  341. const worksheet = workbook.addWorksheet('Sheet1')
  342. //根据数据自己调整
  343. let colums = []
  344. colums = [
  345. // { header: 'ID', key: 'id', width: 26, hidden: true },
  346. { header: '申报ID', key: 'assessmentDeclarationId', width: 26, hidden: true },
  347. { header: '人员编号', key: 'employeeNo', width: 26 },
  348. // { header: '员工ID', key: 'employeeId', width: 26 },
  349. { header: '员工名称', key: 'employeeName', width: 26 },
  350. { header: '建议值', key: 'suggestedValue', width: 26 },
  351. { header: '排序', key: 'serialNumber', width: 26 },
  352. ]
  353. worksheet.columns = colums
  354. worksheet.getRow(1).font = {
  355. size: 12,
  356. bold: true
  357. }
  358. worksheet.addRows(data)
  359. workbook.xlsx.writeBuffer().then(buffer => {
  360. //这里为type
  361. const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8' })
  362. fileSave(blob, `绩效结果考核申报数据导出.xlsx`)
  363. })
  364. },
  365. examineAndApprove(type) {
  366. let that = this
  367. let actionCS = ''
  368. if (type === 'agree') {
  369. if (that.rowMsg.taskType === 'SIGN') {
  370. actionCS = 'signAgree'
  371. } else if (that.rowMsg.taskType === 'NORMAL') {
  372. actionCS = 'agree'
  373. }
  374. } else {
  375. if (that.rowMsg.taskType === 'SIGN') {
  376. actionCS = 'signReject'
  377. } else if (that.rowMsg.taskType === 'NORMAL') {
  378. actionCS = 'reject'
  379. }
  380. }
  381. let params = {
  382. taskId: that.rowMsg.id, //任务ID
  383. nodeId: that.rowMsg.nodeId, //节点ID
  384. action: actionCS, //固定值
  385. instanceId: that.rowMsg.instId, //流程实例ID
  386. opinion: that.descMsg, //审批意见
  387. iamCode: window.localStorage.getItem('code'), //认证后code值
  388. taskName: that.rowMsg.name,
  389. defKey: that.instanceChild.defKey,
  390. bizKey: that.instanceChild.bizKey
  391. }
  392. apiPostIsdoAction(params).then(datas =>{
  393. if (datas && datas.data) {
  394. if (datas.data.isOk) {
  395. that.$message({
  396. message: datas.data.data,
  397. type: 'success'
  398. })
  399. that.dialogVisible = false
  400. that.$emit('approveMsg', datas.data.isOk)
  401. } else {
  402. that.$message({
  403. message: datas.data.msg,
  404. type: 'error'
  405. })
  406. }
  407. }
  408. })
  409. },
  410. }
  411. }
  412. </script>
  413. <style lang="less">
  414. .deptstartFrom{
  415. .el-overlay{
  416. .el-dialog{
  417. // margin-top: 7vh;
  418. .el-dialog__body{
  419. padding: 0 20px !important;
  420. .startDetail{
  421. .starttitleSty{
  422. font-size: 18px;
  423. font-family: Microsoft YaHei;
  424. font-weight: bold;
  425. color: #3B7AD1;
  426. // line-height: 12px;
  427. margin: 20px 0 20px 10px;
  428. }
  429. .danjuMsg{
  430. border: 1px solid #D6DBEA;
  431. padding: 10px 20px;
  432. border-radius: 10px;
  433. margin-bottom: 20px;
  434. .danjuMsg_data{
  435. padding: 5px 0 10px 0;
  436. .data_tit{
  437. margin-right: 10px;
  438. font-weight: bold;
  439. font-size: 14px;
  440. font-family: Microsoft YaHei;
  441. color: #8991B0;
  442. }
  443. .data_tit_wd{
  444. display: inline-block;
  445. width: 90px;
  446. }
  447. .el-form-item--small{
  448. .el-input{
  449. height: 25px;
  450. width: 160px;
  451. }
  452. margin-bottom: 0;
  453. .el-input-number{
  454. height: 25px;
  455. .el-input-number__decrease, .el-input-number__increase{
  456. right: -39px;
  457. }
  458. }
  459. }
  460. }
  461. }
  462. .el-select, .el-input{
  463. width: 100%;
  464. }
  465. .btnASeach{
  466. display: flex;
  467. z-index: 11111;
  468. justify-content: end;
  469. position: relative;
  470. top: 32px;
  471. left: 50vw;
  472. width: 50%;
  473. .detaTableBtns{
  474. display: flex;
  475. width: 300px;
  476. margin-top: 5px;
  477. .tableBtn {
  478. display: flex;
  479. height: 20px;
  480. margin: 0 10px;
  481. width: 13%;
  482. img{
  483. margin-right: 5px;
  484. margin-top: 1px;
  485. }
  486. span{
  487. font-size: 14px;
  488. font-family: Microsoft YaHei;
  489. font-weight: 400;
  490. }
  491. }
  492. .add{
  493. cursor: pointer;
  494. span{
  495. color: #3B7AD1;
  496. }
  497. }
  498. .save{
  499. cursor: pointer;
  500. span{
  501. color: #50C14E;
  502. }
  503. }
  504. .edit{
  505. span{
  506. color: #F5A623;
  507. }
  508. }
  509. .delete{
  510. cursor: no-drop;
  511. span{
  512. color: #F65177;
  513. }
  514. }
  515. .import{
  516. cursor: pointer;
  517. span{
  518. color: #ce1e78;
  519. }
  520. }
  521. .export{
  522. cursor: pointer;
  523. span{
  524. color: #2baa8a;
  525. }
  526. }
  527. }
  528. }
  529. .el-tabs{
  530. .el-tabs__header{
  531. .el-tabs__nav{
  532. .el-tabs__item{
  533. font-size: 18px;
  534. font-family: Microsoft YaHei;
  535. font-weight: bold;
  536. margin: 0 10px;
  537. color: #8991B0;
  538. }
  539. .is-active{
  540. font-size: 18px;
  541. font-family: Microsoft YaHei;
  542. font-weight: bold;
  543. color: #3B7AD1;
  544. margin: 0 10px;
  545. }
  546. }
  547. }
  548. .el-table{
  549. margin-bottom: 10px;
  550. .el-table__body-wrapper{
  551. height: 38vh;
  552. }
  553. .el-table__row{
  554. .cell{
  555. .el-input{
  556. height: 24px;
  557. .el-input__inner{
  558. height: 24px;
  559. }
  560. }
  561. }
  562. }
  563. .indicitem{
  564. color: #F65177;
  565. font-size: 12px;
  566. margin-right: 20px;
  567. cursor:pointer;
  568. &:hover{
  569. text-decoration: underline;
  570. }
  571. }
  572. }
  573. }
  574. }
  575. }
  576. .el-dialog__footer{
  577. .dialog-footer{
  578. display: flex;
  579. justify-content: center;
  580. .el-button{
  581. width: 180px !important;
  582. height: 40px !important;
  583. }
  584. }
  585. }
  586. }
  587. }
  588. }
  589. </style>