monthQuarterFrom.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. <template>
  2. <div class="startFrom">
  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.creator}}</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="detaTableBtns">
  49. <div class="tableBtn add" @click="addTableDetail" v-if="activeName === 'second'">
  50. <img :src="addIcon" alt="">
  51. <span>新增</span>
  52. </div>
  53. <div class="tableBtn save" @click="saveDetail" v-if="$utils.havePurview('monthQuarter:twoLevel:save')">
  54. <img :src="saveIcon" alt="">
  55. <span>保存</span>
  56. </div>
  57. <!-- <div class="tableBtn edit">
  58. <img :src="editIcon" alt="">
  59. <span>新增</span>
  60. </div> -->
  61. <!-- <div class="tableBtn delete">
  62. <img :src="deleteIcon" alt="">
  63. <span>删除</span>
  64. </div> -->
  65. <div class="tableBtn import" @click="handleImport">
  66. <img :src="importIcon" alt="">
  67. <span>导入</span>
  68. </div>
  69. <div class="tableBtn export" @click="handleExport">
  70. <img :src="exportIcon" alt="">
  71. <span>导出</span>
  72. </div>
  73. </div>
  74. <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
  75. <el-tab-pane label="考评指标项内容" name="first">
  76. <el-table :data="quantifiedList" style="width: 100%" @select="rowClick" @select-all="rowClick">
  77. <el-table-column type="selection" label="操作" align="center"></el-table-column>
  78. <el-table-column type="index" label="序号" width="80" />
  79. <el-table-column label="业务阶段" prop="stageName" />
  80. <el-table-column label="业务属性" prop="sectionName" />
  81. <el-table-column label="单位名称" prop="organizationName" width="300" />
  82. <el-table-column label="填报部门" prop="deptName" width="260" />
  83. <el-table-column label="指标分类" prop="typeName" />
  84. <el-table-column label="指标名称" prop="childName" />
  85. <el-table-column label="指标项" prop="optionName" />
  86. <el-table-column label="值" width="150">
  87. <template #default="scope">
  88. <el-input-number v-model="scope.row.quantifiedValue"
  89. :precision="2" :step="0.1" :min="0" :disabled="!scope.row.updateMark" />
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="单位" prop="unit" />
  93. <el-table-column label="审核状态">
  94. <template #default="scope">
  95. <el-select v-model="scope.row.state" placeholder="请选择审核状态" :disabled="!scope.row.updateMark">
  96. <el-option
  97. v-for="item in statusData"
  98. :key="item.id"
  99. :label="item.name"
  100. :value="item.id">
  101. </el-option>
  102. </el-select>
  103. </template>
  104. </el-table-column>
  105. </el-table>
  106. </el-tab-pane>
  107. <el-tab-pane label="考评评价指标内容" name="second">
  108. <el-table :data="nonQuantifiedList" style="width: 100%">
  109. <el-table-column type="index" label="序号" width="80" />
  110. <el-table-column label="单位名称" prop="organizationName" width="300">
  111. <template #default="scope">
  112. <el-select v-model="scope.row.organizationName" placeholder="请选择单位名称"
  113. :disabled="!scope.row.showInput"
  114. @change="changeOrgZa">
  115. <el-option
  116. v-for="item in orgruleData"
  117. :key="item.id"
  118. :label="item.organizationName"
  119. :value="item.id">
  120. </el-option>
  121. </el-select>
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="指标分类" prop="typeName">
  125. <template #default="scope">
  126. <el-select v-model="scope.row.typeName" :disabled="!scope.row.showInput" placeholder="请选择指标分类">
  127. <el-option
  128. v-for="item in indicatorTypeData"
  129. :key="item.id"
  130. :label="item.typeName"
  131. :value="item.id">
  132. </el-option>
  133. </el-select>
  134. </template>
  135. </el-table-column>
  136. <el-table-column label="业务阶段" prop="stageName">
  137. <template #default="scope">
  138. <el-select v-model="scope.row.stageName" placeholder="请选择业务阶段"
  139. :disabled="!scope.row.showInput"
  140. @change="(val)=>changeIndic(val, scope.row)">
  141. <el-option
  142. v-for="item in stageData"
  143. :key="item.id"
  144. :label="item.stageName"
  145. :value="item.id">
  146. </el-option>
  147. </el-select>
  148. </template>
  149. </el-table-column>
  150. <el-table-column label="业务属性" prop="sectionName">
  151. <template #default="scope">
  152. <el-select v-model="scope.row.sectionName" placeholder="请选择业务阶段"
  153. :disabled="!scope.row.showInput"
  154. @change="(val)=>changeIndic(val, scope.row)">
  155. <el-option
  156. v-for="item in sectionNameArr"
  157. :key="item.id"
  158. :label="item.secName"
  159. :value="item.id">
  160. </el-option>
  161. </el-select>
  162. </template>
  163. </el-table-column>
  164. <el-table-column label="指标名称" prop="childName">
  165. <template #default="scope">
  166. <el-select v-model="scope.row.childName" placeholder="请选择指标名称"
  167. :disabled="!scope.row.showInput"
  168. @change="changeDept">
  169. <el-option
  170. v-for="item in indicItemoptions"
  171. :key="item.id"
  172. :label="item.indicatorName"
  173. :value="item.id">
  174. </el-option>
  175. </el-select>
  176. </template>
  177. </el-table-column>
  178. <el-table-column label="填报部门" prop="deptName" width="260">
  179. <template #default="scope">
  180. <el-select v-model="scope.row.deptName" placeholder="请选择填报部门" :disabled="!scope.row.showInput">
  181. <el-option
  182. v-for="item in deptNameArr"
  183. :key="item.id"
  184. :label="item.deptName"
  185. :value="item.id">
  186. </el-option>
  187. </el-select>
  188. </template>
  189. </el-table-column>
  190. <el-table-column label="指标项" prop="optionName">
  191. <template #default="scope">
  192. <el-input v-model="scope.row.optionName" disabled />
  193. </template>
  194. </el-table-column>
  195. <el-table-column label="值">
  196. <template #default="scope">
  197. <el-input v-model="scope.row.nonQuantifiedValue" :disabled="!scope.row.updateMark" />
  198. </template>
  199. </el-table-column>
  200. <el-table-column label="审核状态">
  201. <template #default="scope">
  202. <el-select v-model="scope.row.state" placeholder="请选择审核状态" :disabled="!scope.row.updateMark">
  203. <el-option
  204. v-for="item in statusData"
  205. :key="item.id"
  206. :label="item.name"
  207. :value="item.id">
  208. </el-option>
  209. </el-select>
  210. </template>
  211. </el-table-column>
  212. </el-table>
  213. </el-tab-pane>
  214. </el-tabs>
  215. </div>
  216. <template #footer>
  217. <span class="dialog-footer">
  218. <el-button type="primary" @click="dialogVisible = false">取 消</el-button>
  219. </span>
  220. </template>
  221. </el-dialog>
  222. <import-dailog ref="importPage" @successImport="successImport" @importLoading="importLoading"></import-dailog>
  223. </div>
  224. </template>
  225. <script>
  226. import importDailog from '../importPage/importDailog.vue'
  227. import {apiGetOrgEvalInfoList,apiGetOrgEvaInfoBatchDto, apiGetOrganizationRule,
  228. apiGetindicatorListAll, apiGetbinstageList, apiGetIndicatorTypeList} from '../../api/api'
  229. import ExcelJS from 'exceljs'
  230. import fileSave from 'file-saver'
  231. import addIcon from '../../assets/btnIcon/add.png'
  232. import saveIcon from '../../assets/btnIcon/save.png'
  233. import editIcon from '../../assets/btnIcon/edit.png'
  234. import deleteIcon from '../../assets/btnIcon/delete.png'
  235. import exportIcon from '../../assets/btnIcon/export.png'
  236. import importIcon from '../../assets/btnIcon/import.png'
  237. export default {
  238. components: {
  239. importDailog
  240. },
  241. data() {
  242. return {
  243. dialogVisible: false,
  244. activeName: 'first',
  245. quantifiedList: [],
  246. nonQuantifiedList: [],
  247. changeDateSelect: [],
  248. receiptMsg: {
  249. code: '',
  250. des: '',
  251. stage: '',
  252. creator: '',
  253. createDate: '',
  254. type: '',
  255. year: '',
  256. recStage: ''
  257. },
  258. addIcon: addIcon,
  259. saveIcon: saveIcon,
  260. editIcon: editIcon,
  261. deleteIcon: deleteIcon,
  262. exportIcon: exportIcon,
  263. importIcon: importIcon,
  264. rowMsg: {},
  265. statusData: []
  266. }
  267. },
  268. created() {
  269. this.statusData = [
  270. {
  271. name: '已完成',
  272. id: '1'
  273. },
  274. {
  275. name: '待审核',
  276. id: '0'
  277. },
  278. {
  279. name: '未开始',
  280. id: '-1'
  281. }
  282. ]
  283. },
  284. methods: {
  285. init(row) {
  286. this.dialogVisible = true
  287. this.activeName = 'first'
  288. this.receiptMsg = {
  289. code: row.organizationEvaluationCode,
  290. des: row.des,
  291. stage: row.stage,
  292. creator: row.createBy,
  293. createDate: row.createTime,
  294. type: row.checkCycle === 'YDKP'?'月度考评':row.checkCycle === 'JDKP'?'季度考评':'年度考评',
  295. year: row.year,
  296. recStage: '有效'
  297. }
  298. this.getDetails(row.id)
  299. this.getOrgRule(row)
  300. this.getindList()
  301. this.rowMsg = row
  302. },
  303. handleClick() {
  304. this.changeDateSelect = []
  305. },
  306. rowClick(selection, row) {
  307. this.changeDateSelect = selection
  308. },
  309. //获取详情
  310. getDetails(id) {
  311. let that = this
  312. let params = {
  313. organizationEvaluationId: id
  314. }
  315. apiGetOrgEvalInfoList(params).then(datas =>{
  316. if (datas && datas.data) {
  317. that.quantifiedList = datas.data.quantifiedList
  318. // if (datas.data.nonQuantifiedList.length>0) {
  319. // datas.data.nonQuantifiedList.forEach(it =>{
  320. // it.childName = it.indicatorId //指标id
  321. // })
  322. // }
  323. that.nonQuantifiedList = datas.data.nonQuantifiedList.length>0?datas.data.nonQuantifiedList:[]
  324. }
  325. })
  326. },
  327. // 考评评价指标内容
  328. getOrgRule(row) {
  329. let that = this
  330. let params = {
  331. id: row.id,
  332. type: 'kp'
  333. }
  334. apiGetOrganizationRule(params).then(datas =>{
  335. if (datas && datas.data) {
  336. that.orgruleData = datas.data
  337. }
  338. })
  339. },
  340. getindList() {
  341. let that = this
  342. let params = {
  343. type: 2
  344. }
  345. apiGetbinstageList(params).then(datas =>{
  346. if (datas && datas.data) {
  347. that.stageData = datas.data
  348. }
  349. })
  350. apiGetIndicatorTypeList(params).then(datas =>{
  351. if (datas && datas.data) {
  352. that.indicatorTypeData = datas.data
  353. }
  354. })
  355. },
  356. getIndListAll(row) {
  357. let that = this
  358. let params = {
  359. binSection: row.sectionName,
  360. binStage: row.stageName
  361. }
  362. apiGetindicatorListAll(params).then(datas =>{
  363. if (datas && datas.data) {
  364. that.indicItemoptions = datas.data
  365. }
  366. })
  367. },
  368. changeIndic(val, row) {
  369. if (row.stageName !== '' && row.sectionName !== '') {
  370. row.childName = ''
  371. this.getIndListAll(row)
  372. }
  373. },
  374. changeOrgZa(val) {
  375. this.sectionNameArr = []
  376. this.orgruleData.forEach(item =>{
  377. if (item.id === val) {
  378. let obj = {
  379. id: item.binSection,
  380. secName: item.binSectionName
  381. }
  382. this.sectionNameArr.push(obj)
  383. }
  384. })
  385. },
  386. changeDept(val) {
  387. this.deptNameArr = []
  388. this.indicItemoptions.forEach(item =>{
  389. if (item.id === val) {
  390. let obj = {
  391. id: item.dept,
  392. deptName: item.deptName
  393. }
  394. this.deptNameArr.push(obj)
  395. }
  396. })
  397. },
  398. addTableDetail() {
  399. let obj = {
  400. showInput: true,
  401. stageName: '',
  402. sectionName: '',
  403. organizationName: '',
  404. deptName: '',
  405. typeName: '',
  406. optionName: '',
  407. nonQuantifiedValue: ''
  408. }
  409. this.nonQuantifiedList.unshift(obj)
  410. },
  411. saveDetail() {
  412. let that = this
  413. let params = []
  414. if (that.activeName === 'first') {
  415. that.quantifiedList.forEach(item =>{
  416. let obj = {
  417. id: item.id,
  418. isQuantified: '是',
  419. quantifiedValue: item.quantifiedValue,
  420. state: item.state
  421. }
  422. params.push(obj)
  423. })
  424. } else {
  425. that.nonQuantifiedList.forEach(item =>{
  426. let obj = {
  427. isQuantified: '否',
  428. quantifiedValue: 0.0,
  429. optionCode: 'ZRMB', // 指标项
  430. nonQuantifiedValue: item.nonQuantifiedValue,
  431. state: item.state,
  432. organizationEvaluationId: that.rowMsg.id
  433. }
  434. if (item.showInput) {
  435. obj.organizationEvaluationRuleId = item.organizationName //单位id
  436. obj.indicatorId = item.childName //指标id
  437. } else {
  438. obj.id = item.id
  439. obj.organizationEvaluationRuleId = item.organizationEvaluationRuleId
  440. obj.indicatorId = item.indicatorId
  441. }
  442. params.push(obj)
  443. })
  444. }
  445. apiGetOrgEvaInfoBatchDto(params).then(datas =>{
  446. if (datas) {
  447. if (datas.success) {
  448. that.$message({
  449. message: '保存成功',
  450. type: 'success'
  451. });
  452. that.getDetails(that.rowMsg.id)
  453. } else {
  454. that.$message({
  455. message: datas.data,
  456. type: 'error'
  457. })
  458. }
  459. }
  460. })
  461. },
  462. handleImport() {
  463. this.$refs.importPage.upload.title = "月/季度单位信息导入"
  464. this.$refs.importPage.upload.open = true
  465. this.$refs.importPage.upload.url = '/predict/api/smpmc/standardPointManagementImport'
  466. this.$refs.importPage.upload.urlName = 'standardPointManagementImport'
  467. this.$refs.importPage.upload.proName = '月/季度单位信息模板.xlsx'
  468. },
  469. successImport(val) {
  470. that.getDetails(that.rowMsg.id)
  471. },
  472. importLoading(val) {
  473. },
  474. handleExport() {
  475. let data = [] //接口返回数据
  476. const workbook = new ExcelJS.Workbook()
  477. const worksheet = workbook.addWorksheet('Sheet1')
  478. //根据数据自己调整
  479. let colums = []
  480. colums = [
  481. { header: '单位名称', key: 'organizationName', width: 26 },
  482. { header: '指标分类', key: 'typeName', width: 18 },
  483. { header: '业务阶段', key: 'stageName', width: 18 },
  484. { header: '业务属性', key: 'sectionName', width: 18 },
  485. { header: '指标名称', key: 'childName', width: 18 },
  486. { header: '填报部门', key: 'deptName', width: 26 },
  487. { header: '指标项', key: 'optionName', width: 26 },
  488. ]
  489. if (this.activeName === 'first') {
  490. colums.push(
  491. { header: '目标值', key: 'quantifiedValue', width: 18 },
  492. { header: '单位', key: 'unit', width: 18 },
  493. { header: '审核状态', key: 'state', width: 18 }
  494. )
  495. this.quantifiedList.forEach(item =>{
  496. if (item.updateMark) {
  497. data.push(item)
  498. }
  499. })
  500. } else {
  501. colums.push(
  502. { header: '值', key: 'nonQuantifiedValue', width: 18 },
  503. { header: '审核状态', key: 'state', width: 18 }
  504. )
  505. this.nonQuantifiedList.forEach(item =>{
  506. if (item.updateMark) {
  507. data.push(item)
  508. }
  509. })
  510. }
  511. worksheet.columns = colums
  512. worksheet.getRow(1).font = {
  513. size: 12,
  514. bold: true
  515. }
  516. worksheet.addRows(data)
  517. workbook.xlsx.writeBuffer().then(buffer => {
  518. //这里为type
  519. const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8' })
  520. fileSave(blob, `数据导出.xlsx`)
  521. })
  522. },
  523. }
  524. }
  525. </script>
  526. <style lang="less">
  527. .startFrom{
  528. .el-overlay{
  529. .el-dialog{
  530. // margin-top: 7vh;
  531. .el-dialog__body{
  532. padding: 0 20px !important;
  533. .startDetail{
  534. .starttitleSty{
  535. font-size: 18px;
  536. font-family: Microsoft YaHei;
  537. font-weight: bold;
  538. color: #3B7AD1;
  539. // line-height: 12px;
  540. margin: 20px 0 20px 10px;
  541. }
  542. .danjuMsg{
  543. border: 1px solid #D6DBEA;
  544. padding: 10px 20px;
  545. border-radius: 10px;
  546. margin-bottom: 20px;
  547. .danjuMsg_data{
  548. padding: 5px 0 10px 0;
  549. .data_tit{
  550. margin-right: 10px;
  551. font-weight: bold;
  552. font-size: 14px;
  553. font-family: Microsoft YaHei;
  554. color: #8991B0;
  555. }
  556. .data_tit_wd{
  557. display: inline-block;
  558. width: 90px;
  559. }
  560. .el-form-item--small{
  561. .el-input{
  562. height: 25px;
  563. width: 160px;
  564. }
  565. margin-bottom: 0;
  566. .el-input-number{
  567. height: 25px;
  568. .el-input-number__decrease, .el-input-number__increase{
  569. right: -39px;
  570. }
  571. }
  572. }
  573. }
  574. }
  575. .el-select, .el-input{
  576. width: 100%;
  577. }
  578. .detaTableBtns{
  579. display: flex;
  580. width: 340px;
  581. position: relative;
  582. top: 32px;
  583. left: 80vw;
  584. z-index: 11111;
  585. .tableBtn {
  586. display: flex;
  587. margin-right: 30px;
  588. img{
  589. margin-right: 5px;
  590. margin-top: 1px;
  591. }
  592. span{
  593. font-size: 14px;
  594. font-family: Microsoft YaHei;
  595. font-weight: 400;
  596. }
  597. }
  598. .add{
  599. cursor: pointer;
  600. span{
  601. color: #3B7AD1;
  602. }
  603. }
  604. .save{
  605. cursor: pointer;
  606. span{
  607. color: #50C14E;
  608. }
  609. }
  610. .edit{
  611. span{
  612. color: #F5A623;
  613. }
  614. }
  615. .delete{
  616. cursor: no-drop;
  617. span{
  618. color: #F65177;
  619. }
  620. }
  621. .import{
  622. cursor: pointer;
  623. span{
  624. color: #ce1e78;
  625. }
  626. }
  627. .export{
  628. cursor: pointer;
  629. span{
  630. color: #2baa8a;
  631. }
  632. }
  633. }
  634. .el-tabs{
  635. .el-tabs__header{
  636. .el-tabs__nav{
  637. .el-tabs__item{
  638. font-size: 18px;
  639. font-family: Microsoft YaHei;
  640. font-weight: bold;
  641. margin: 0 10px;
  642. color: #8991B0;
  643. }
  644. .is-active{
  645. font-size: 18px;
  646. font-family: Microsoft YaHei;
  647. font-weight: bold;
  648. color: #3B7AD1;
  649. margin: 0 10px;
  650. }
  651. }
  652. }
  653. .el-table{
  654. .el-table__body-wrapper{
  655. height: 55vh;
  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. }
  668. }
  669. }
  670. }
  671. .el-dialog__footer{
  672. .dialog-footer{
  673. display: flex;
  674. justify-content: center;
  675. .el-button{
  676. width: 180px !important;
  677. height: 40px !important;
  678. }
  679. }
  680. }
  681. }
  682. }
  683. }
  684. </style>