evaluationDeptStartFrom.vue 22 KB

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