taskCenterDeptStartFrom.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  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">
  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%" @select="rowClick" @select-all="rowClick">
  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. :disabled="scope.row.dataPermission === '-1' && scope.row.deptName !== ''">
  82. </el-option>
  83. </el-select>
  84. <span v-else>{{scope.row.deptName}}</span>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="排序" width="100" >
  88. <template #default="scope">
  89. <el-input-number v-model="scope.row.serialNumber"
  90. :disabled="scope.row.dataPermission === '-1' && scope.row.serialNumber !== ''" :min="1" />
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="指标名称" >
  94. <template #default="scope">
  95. <el-input v-model="scope.row.targetName"
  96. :disabled="scope.row.dataPermission === '-1'"
  97. placeholder="请输入指标名称"></el-input>
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="目标值" width="500">
  101. <template #default="scope">
  102. <el-input v-model="scope.row.targetValue"
  103. :disabled="scope.row.dataPermission === '-1'"
  104. type="textarea" :rows="2" placeholder="请输入目标值"></el-input>
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="基础分" width="150">
  108. <template #default="scope">
  109. <el-input-number v-model="scope.row.baseScore"
  110. :precision="2" :step="0.1" :min="0" />
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="评价标准" >
  114. <template #default="scope">
  115. <el-input v-model="scope.row.evaluationCriteria"
  116. type="textarea" :rows="2" placeholder="请输入评价标准"></el-input>
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="审核状态" width="200" >
  120. <template #default="scope">
  121. <el-select v-model="scope.row.auditStatus" placeholder="请选择审核状态">
  122. <el-option
  123. v-for="item in statusData"
  124. :key="item.id"
  125. :label="item.name"
  126. :value="item.id"
  127. :disabled="(scope.row.dataPermission === '-1' && scope.row.auditStatus !== '') || userMes.deptId === '23031009'">
  128. </el-option>
  129. </el-select>
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="操作" width="80" align="center">
  133. <template #default="scope">
  134. <p class="indicitem" v-if="scope.row.dataPermission !== '-1'" @click="handleDelete(scope.row)">删除</p>
  135. </template>
  136. </el-table-column>
  137. </el-table>
  138. <el-pagination
  139. @current-change="handleCurrentChangeLeft"
  140. :current-page="pageLeft.currentPage"
  141. :page-size="pageLeft.pagesize"
  142. layout="total, prev, pager, next, jumper"
  143. :total="pageLeft.total">
  144. </el-pagination>
  145. </el-tab-pane>
  146. </el-tabs>
  147. <div>
  148. <p class="starttitleSty">审批意见:</p>
  149. <el-input v-model="descMsg" :rows="3" type="textarea" placeholder="请输入审批意见"></el-input>
  150. </div>
  151. </div>
  152. <template #footer>
  153. <span class="dialog-footer">
  154. <el-button type="primary" @click="examineAndApprove('agree')">同 意</el-button>
  155. <el-button @click="examineAndApprove('reject')">拒 绝</el-button>
  156. </span>
  157. </template>
  158. </el-dialog>
  159. <import-dailog ref="importPage" @successImport="successImport" @importLoading="importLoading"></import-dailog>
  160. </div>
  161. </template>
  162. <script>
  163. import importDailog from '../importPage/importDailog.vue'
  164. import {apiGetevaluationdeptplanDetail,apiGetevaluationdeptplanUpdate, apiGetdatadictionaryList,apiGetcheckAuditStatus,apiGetevaluationdetailDeptData,
  165. apiPostIsdoAction, apiGetevaluationdeptplanDetailHeader, apiGetevaluationdeptplandelete} from '../../api/api'
  166. import ExcelJS from 'exceljs'
  167. import fileSave from 'file-saver'
  168. import addIcon from '../../assets/btnIcon/add.png'
  169. import saveIcon from '../../assets/btnIcon/save.png'
  170. import editIcon from '../../assets/btnIcon/edit.png'
  171. import deleteIcon from '../../assets/btnIcon/delete.png'
  172. import exportIcon from '../../assets/btnIcon/export.png'
  173. import importIcon from '../../assets/btnIcon/import.png'
  174. export default {
  175. components: {
  176. importDailog
  177. },
  178. data() {
  179. return {
  180. descMsg: '',
  181. dialogVisible: false,
  182. activeName: 'first',
  183. quantifiedList: [],
  184. changeDateSelect: [],
  185. receiptMsg: {
  186. code: '',
  187. des: '',
  188. stage: '',
  189. createName: '',
  190. createDate: '',
  191. type: '',
  192. year: '',
  193. recStage: ''
  194. },
  195. addIcon: addIcon,
  196. saveIcon: saveIcon,
  197. editIcon: editIcon,
  198. deleteIcon: deleteIcon,
  199. exportIcon: exportIcon,
  200. importIcon: importIcon,
  201. rowMsg: {},
  202. orgruleData: [],
  203. indicItemoptions: [],
  204. sectionNameArr: [],
  205. deptNameArr: [],
  206. statusData: [],
  207. pageLeft:{
  208. pagesize: 15,
  209. currentPage: 1,
  210. total: 0
  211. },
  212. pageRight:{
  213. pagesize: 15,
  214. currentPage: 1,
  215. total: 0
  216. },
  217. departData: [],
  218. instanceChild: {},
  219. importId: '',
  220. userMes: {}
  221. }
  222. },
  223. created() {
  224. this.statusData = [
  225. {
  226. name: '已通过',
  227. id: '0'
  228. },
  229. {
  230. name: '待审核',
  231. id: '-1'
  232. },
  233. {
  234. name: '未通过',
  235. id: '-2'
  236. }
  237. ]
  238. },
  239. methods: {
  240. init(row, id, datas) {
  241. this.dialogVisible = true
  242. this.instanceChild = datas
  243. this.activeName = 'first'
  244. this.importId = id
  245. this.userMes = JSON.parse(window.sessionStorage.getItem('user'))
  246. this.getDetails(id)
  247. this.getDepartmentFromTreeData(datas)
  248. this.rowMsg = row
  249. },
  250. // 查询部门
  251. getDepartmentFromTreeData(datas) {
  252. let that = this
  253. // let params = {
  254. // superKey: 'BM0001'
  255. // }
  256. // apiGetdatadictionaryList(params).then(datas =>{
  257. // if (datas && datas.data) {
  258. // let departData = datas.data
  259. // that.getshowDepartDataFn(row, departData)
  260. // }
  261. // })
  262. let params = {
  263. // id: datas.bizKey,
  264. deptId: that.userMes.deptId
  265. }
  266. // 获取部门数据
  267. apiGetevaluationdetailDeptData(params).then(datas =>{
  268. if (datas && datas.data) {
  269. for(let i in datas.data) {
  270. let obj = {
  271. id: i,
  272. name: datas.data[i]
  273. }
  274. that.departData.push(obj)
  275. }
  276. }
  277. })
  278. },
  279. // 整合部门数据
  280. // getshowDepartDataFn(row, deptData) {
  281. // let deptIdArr = row.deptId.split(',')
  282. // deptIdArr.forEach(it =>{
  283. // deptData.forEach(itv =>{
  284. // if (itv.id === it) {
  285. // that.departData.push(itv)
  286. // }
  287. // })
  288. // })
  289. // },
  290. handleDelete(row) {
  291. this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  292. confirmButtonText: '确定',
  293. cancelButtonText: '取消',
  294. type: 'warning'
  295. }).then(() => {
  296. let that = this
  297. let params = {
  298. id: row.id,
  299. deptId: that.userMes.deptId
  300. }
  301. apiGetevaluationdeptplandelete(params).then(datas =>{
  302. that.$message({
  303. type: 'success',
  304. message: '删除成功!'
  305. });
  306. that.getevaluStartList()
  307. that.changeDateSelect = []
  308. })
  309. })
  310. },
  311. handleClick() {
  312. this.changeDateSelect = []
  313. },
  314. rowClick(selection, row) {
  315. this.changeDateSelect = selection
  316. },
  317. handleCurrentChangeLeft(val) {
  318. this.pageLeft.currentPage = val
  319. },
  320. handleCurrentChangeRight(val) {
  321. this.pageRight.currentPage = val
  322. },
  323. //获取详情
  324. getDetails(id) {
  325. let that = this
  326. that.quantifiedList = []
  327. let userMes = JSON.parse(window.sessionStorage.getItem('user'))
  328. let params = {
  329. id: id,
  330. deptId: userMes.deptId
  331. }
  332. apiGetevaluationdeptplanDetailHeader(id).then(datas =>{
  333. if (datas && datas.data) {
  334. let item = datas.data
  335. this.receiptMsg = {
  336. code: item.responsibilityCode,
  337. des: item.des,
  338. stage: item.stage,
  339. createName: item.createName,
  340. createDate: item.createTime,
  341. type: item.checkCycle === 'YDKP'?'月度考评':item.checkCycle === 'JDKP'?'季度考评':'年度考评',
  342. year: item.appraisalYear,
  343. recStage: '有效'
  344. }
  345. }
  346. })
  347. apiGetevaluationdeptplanDetail(params).then(datas =>{
  348. if (datas && datas.data) {
  349. that.quantifiedList = datas.data
  350. that.pageLeft.total = datas.data.length
  351. }
  352. })
  353. },
  354. addTableDetail() {
  355. let obj = {
  356. showInput: true,
  357. businessPlanId: this.rowMsg.id,
  358. serialNumber: '1',
  359. deptName: '',
  360. targetName: '',
  361. targetValue: '',
  362. baseScore: 0,
  363. evaluationCriteria: '',
  364. auditStatus: '-1'
  365. }
  366. this.quantifiedList.unshift(obj)
  367. },
  368. saveDetail() {
  369. let that = this
  370. let params = []
  371. let userMes = JSON.parse(window.sessionStorage.getItem('user'))
  372. that.quantifiedList.forEach(item =>{
  373. let obj = {
  374. targetName: item.targetName,
  375. targetValue: item.targetValue,
  376. baseScore: item.baseScore.toString(),
  377. evaluationCriteria: item.evaluationCriteria,
  378. auditStatus: item.auditStatus,
  379. serialNumber: item.serialNumber,
  380. createDept: userMes.deptId
  381. }
  382. if (item.showInput) {
  383. obj.deptId = item.deptName
  384. obj.businessPlanId = item.businessPlanId
  385. } else {
  386. obj.id = item.id
  387. }
  388. params.push(obj)
  389. })
  390. apiGetevaluationdeptplanUpdate(params).then(datas =>{
  391. if (datas) {
  392. if (datas.success) {
  393. that.$message({
  394. message: '保存成功',
  395. type: 'success'
  396. });
  397. that.getDetails(that.rowMsg.id)
  398. } else {
  399. that.$message({
  400. message: datas.data,
  401. type: 'error'
  402. })
  403. }
  404. }
  405. })
  406. },
  407. examineAndApprove(type) {
  408. let that = this
  409. let actionCS = ''
  410. if (type === 'agree') {
  411. if (that.rowMsg.taskType === 'SIGN') {
  412. actionCS = 'signAgree'
  413. } else if (that.rowMsg.taskType === 'NORMAL') {
  414. actionCS = 'agree'
  415. }
  416. } else {
  417. if (that.rowMsg.taskType === 'SIGN') {
  418. actionCS = 'signReject'
  419. } else if (that.rowMsg.taskType === 'NORMAL') {
  420. actionCS = 'reject'
  421. }
  422. }
  423. let params = {
  424. taskId: that.rowMsg.id, //任务ID
  425. nodeId: that.rowMsg.nodeId, //节点ID
  426. action: actionCS, //固定值
  427. instanceId: that.rowMsg.instId, //流程实例ID
  428. opinion: that.descMsg, //审批意见
  429. iamCode: window.localStorage.getItem('code'), //认证后code值
  430. taskName: that.rowMsg.name,
  431. defKey: that.instanceChild.defKey,
  432. bizKey: that.instanceChild.bizKey
  433. }
  434. if (type === 'agree') {
  435. let userMes = JSON.parse(window.sessionStorage.getItem('user'))
  436. let paramsob = {
  437. id: that.rowMsg.id,
  438. deptId: userMes.deptId
  439. }
  440. apiGetcheckAuditStatus(paramsob).then(datas =>{
  441. if (datas) {
  442. if (datas.success) {
  443. that.IsdoActionFn(params)
  444. } else {
  445. that.$message({
  446. message: datas.data,
  447. type: 'error'
  448. })
  449. }
  450. }
  451. })
  452. } else {
  453. that.IsdoActionFn(params)
  454. }
  455. },
  456. IsdoActionFn(params) {
  457. let that = this
  458. apiPostIsdoAction(params).then(datas =>{
  459. if (datas && datas.data) {
  460. if (datas.data.isOk) {
  461. that.$message({
  462. message: datas.data.data,
  463. type: 'success'
  464. })
  465. that.dialogVisible = false
  466. that.$emit('approveMsg', datas.data.isOk)
  467. } else {
  468. that.$message({
  469. message: datas.data.msg,
  470. type: 'error'
  471. })
  472. }
  473. }
  474. })
  475. },
  476. handleImport() {
  477. this.$refs.importPage.upload.title = "本部部门业绩指标计划信息导入"
  478. this.$refs.importPage.upload.data = {id: this.importId}
  479. this.$refs.importPage.upload.open = true
  480. this.$refs.importPage.upload.url = '/evaluation-dept-plan/import'
  481. },
  482. successImport(val) {
  483. this.getDetails(this.rowMsg.id)
  484. },
  485. handleExport() {
  486. let data = this.quantifiedList //接口返回数据
  487. const workbook = new ExcelJS.Workbook()
  488. const worksheet = workbook.addWorksheet('Sheet1')
  489. //根据数据自己调整
  490. let colums = []
  491. colums = [
  492. // { header: 'ID', key: 'id', width: 26 },
  493. // { header: '业务ID', key: 'businessPlanId', width: 26 },
  494. { header: '部门编码', key: 'deptId', width: 26 },
  495. { header: '部门名称', key: 'deptName', width: 26 },
  496. // { header: '部门编码', key: 'deptCode', width: 26 },
  497. { header: '排序', key: 'serialNumber', width: 26 },
  498. { header: '指标名称', key: 'targetName', width: 18 },
  499. { header: '目标值', key: 'targetValue', width: 18 },
  500. { header: '评价标准', key: 'evaluationCriteria', width: 18 },
  501. { header: '基础分', key: 'baseScore', width: 18 },
  502. ]
  503. worksheet.columns = colums
  504. worksheet.getRow(1).font = {
  505. size: 12,
  506. bold: true
  507. }
  508. worksheet.addRows(data)
  509. workbook.xlsx.writeBuffer().then(buffer => {
  510. //这里为type
  511. const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8' })
  512. fileSave(blob, `本部部门业绩指标计划数据导出.xlsx`)
  513. })
  514. },
  515. }
  516. }
  517. </script>
  518. <style lang="less">
  519. .deptstartFrom{
  520. .el-overlay{
  521. .el-dialog{
  522. // margin-top: 7vh;
  523. .el-dialog__body{
  524. padding: 0 20px !important;
  525. .startDetail{
  526. .starttitleSty{
  527. font-size: 18px;
  528. font-family: Microsoft YaHei;
  529. font-weight: bold;
  530. color: #3B7AD1;
  531. // line-height: 12px;
  532. margin: 20px 0 20px 10px;
  533. }
  534. .danjuMsg{
  535. border: 1px solid #D6DBEA;
  536. padding: 10px 20px;
  537. border-radius: 10px;
  538. margin-bottom: 20px;
  539. .danjuMsg_data{
  540. padding: 5px 0 10px 0;
  541. .data_tit{
  542. margin-right: 10px;
  543. font-weight: bold;
  544. font-size: 14px;
  545. font-family: Microsoft YaHei;
  546. color: #8991B0;
  547. }
  548. .data_tit_wd{
  549. display: inline-block;
  550. width: 90px;
  551. }
  552. .el-form-item--small{
  553. .el-input{
  554. height: 25px;
  555. width: 160px;
  556. }
  557. margin-bottom: 0;
  558. .el-input-number{
  559. height: 25px;
  560. .el-input-number__decrease, .el-input-number__increase{
  561. right: -39px;
  562. }
  563. }
  564. }
  565. }
  566. }
  567. .el-select, .el-input{
  568. width: 100%;
  569. }
  570. .btnASeach{
  571. display: flex;
  572. z-index: 11111;
  573. justify-content: end;
  574. position: relative;
  575. top: 32px;
  576. left: 50vw;
  577. width: 50%;
  578. .detaTableBtns{
  579. display: flex;
  580. width: 300px;
  581. margin-top: 5px;
  582. .tableBtn {
  583. display: flex;
  584. height: 20px;
  585. margin: 0 10px;
  586. img{
  587. margin-right: 5px;
  588. margin-top: 1px;
  589. }
  590. span{
  591. font-size: 14px;
  592. font-family: Microsoft YaHei;
  593. font-weight: 400;
  594. }
  595. }
  596. .add{
  597. cursor: pointer;
  598. span{
  599. color: #3B7AD1;
  600. }
  601. }
  602. .save{
  603. cursor: pointer;
  604. span{
  605. color: #50C14E;
  606. }
  607. }
  608. .edit{
  609. span{
  610. color: #F5A623;
  611. }
  612. }
  613. .delete{
  614. cursor: no-drop;
  615. span{
  616. color: #F65177;
  617. }
  618. }
  619. .import{
  620. cursor: pointer;
  621. span{
  622. color: #ce1e78;
  623. }
  624. }
  625. .export{
  626. cursor: pointer;
  627. span{
  628. color: #2baa8a;
  629. }
  630. }
  631. }
  632. }
  633. .el-tabs{
  634. .el-tabs__header{
  635. .el-tabs__nav{
  636. .el-tabs__item{
  637. font-size: 18px;
  638. font-family: Microsoft YaHei;
  639. font-weight: bold;
  640. margin: 0 10px;
  641. color: #8991B0;
  642. }
  643. .is-active{
  644. font-size: 18px;
  645. font-family: Microsoft YaHei;
  646. font-weight: bold;
  647. color: #3B7AD1;
  648. margin: 0 10px;
  649. }
  650. }
  651. }
  652. .el-table{
  653. margin-bottom: 10px;
  654. .el-table__body-wrapper{
  655. height: 38vh;
  656. }
  657. .el-table__row{
  658. .cell{
  659. .el-input{
  660. height: 24px;
  661. .el-input__inner{
  662. height: 24px;
  663. }
  664. }
  665. }
  666. }
  667. .indicitem{
  668. color: #409EFF;
  669. font-size: 12px;
  670. margin-right: 20px;
  671. cursor:pointer;
  672. &:hover{
  673. text-decoration: underline;
  674. }
  675. }
  676. }
  677. }
  678. }
  679. }
  680. .el-dialog__footer{
  681. .dialog-footer{
  682. display: flex;
  683. justify-content: center;
  684. .el-button{
  685. width: 180px !important;
  686. height: 40px !important;
  687. }
  688. }
  689. }
  690. }
  691. }
  692. }
  693. </style>