mainDetails.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. <template>
  2. <div class="details-container">
  3. <el-drawer
  4. :visible.sync="drawerVisible"
  5. :title="dialogTitle"
  6. size="90%"
  7. @close="handleClose"
  8. >
  9. <!-- 操作按钮区域 -->
  10. <div class="btn-group">
  11. <div class="process-actions">
  12. <el-button type="primary" @click="handleNextStep">
  13. 流转下一步
  14. </el-button>
  15. <el-button type="primary" @click="handlePrevStep">
  16. 退回上一步
  17. </el-button>
  18. <el-button
  19. v-if="currentNode === 'cjbg'"
  20. type="primary"
  21. @click="handleAddTask"
  22. >
  23. 办结任务
  24. </el-button>
  25. <el-button type="primary" @click="handleAssign">返回</el-button>
  26. <el-tooltip
  27. v-if="
  28. (currentNode !== 'clcs' && currentNode !== 'sdsh') ||
  29. currentNode === 'yjfk'
  30. "
  31. class="item"
  32. effect="dark"
  33. content="点击此按钮整体阶段将退回到实体审核,重新复核"
  34. placement="top-start"
  35. >
  36. <el-button type="primary" icon="el-icon-s-flag" @click="handleFh">
  37. 复核
  38. </el-button>
  39. </el-tooltip>
  40. </div>
  41. </div>
  42. <!-- 标签页面 -->
  43. <el-tabs v-model="activeTab" type="card" class="audit-tabs">
  44. <el-tab-pane label="监审文书" name="submitData">
  45. <auditDocumentsMain
  46. :id="id"
  47. :project="project"
  48. :current-node="currentNode"
  49. :current-status="currentStatus"
  50. />
  51. </el-tab-pane>
  52. <el-tab-pane
  53. v-if="
  54. currentNode === 'jtsy' ||
  55. currentNode === 'cjbg' ||
  56. currentNode === 'gd'
  57. "
  58. label="集体审议"
  59. name="costSurvey"
  60. >
  61. <collectiveMain
  62. :id="id"
  63. :current-node="currentNode"
  64. :current-status="currentStatus"
  65. :project-name="projectName"
  66. :audit-object="auditObject"
  67. :is-editable="currentNode === 'jtsy'"
  68. />
  69. </el-tab-pane>
  70. <el-tab-pane
  71. v-if="currentNode === 'cjbg' || currentNode === 'gd'"
  72. label="出具结论"
  73. name="costAudit"
  74. >
  75. <conclusionMain
  76. :id="id"
  77. :active="activeTab === 'costAudit'"
  78. :current-node="currentNode"
  79. :current-status="currentStatus"
  80. :is-editable="currentNode === 'cjbg'"
  81. @saved="handleConclusionSaved"
  82. />
  83. </el-tab-pane>
  84. </el-tabs>
  85. </el-drawer>
  86. <!-- 流转下一步/退回上一步弹窗 -->
  87. <el-dialog
  88. :visible.sync="showProcessDialog"
  89. :title="processDialogTitle"
  90. width="600px"
  91. :modal="false"
  92. custom-class="process-dialog"
  93. >
  94. <div class="dialog-content">
  95. <div class="form-item process-form-item">
  96. <label class="form-label">意见:</label>
  97. <div class="form-content">
  98. <el-input
  99. v-model="processParams.content"
  100. type="textarea"
  101. :rows="6"
  102. placeholder="请输入意见"
  103. maxlength="500"
  104. show-word-limit
  105. />
  106. </div>
  107. </div>
  108. <!-- <div class="form-item process-form-item">
  109. <label class="form-label">发送方式:</label>
  110. <div class="form-content">
  111. <el-checkbox-group v-model="processParams.sendType">
  112. <el-checkbox label="1">站内消息</el-checkbox>
  113. <el-checkbox label="2">短信通知</el-checkbox>
  114. </el-checkbox-group>
  115. </div>
  116. </div> -->
  117. </div>
  118. <div slot="footer" class="dialog-footer">
  119. <el-button @click="showProcessDialog = false">取消</el-button>
  120. <el-button type="primary" @click="submitProcess">确定</el-button>
  121. </div>
  122. </el-dialog>
  123. <el-dialog
  124. :visible.sync="showFhDialog"
  125. title="任务复核"
  126. width="600px"
  127. :modal="false"
  128. custom-class="process-dialog"
  129. >
  130. <div class="dialog-content">
  131. <div class="form-item process-form-item">
  132. <label class="form-label">意见:</label>
  133. <div class="form-content">
  134. <el-input
  135. v-model="processParams.content"
  136. type="textarea"
  137. :rows="6"
  138. placeholder="请输入意见"
  139. maxlength="500"
  140. show-word-limit
  141. />
  142. </div>
  143. </div>
  144. <!-- <div class="form-item">
  145. <label class="form-label">发送方式:</label>
  146. <el-checkbox-group v-model="additionalParams.sendType">
  147. <el-checkbox label="site">站内消息</el-checkbox>
  148. <el-checkbox label="sms">短信通知</el-checkbox>
  149. </el-checkbox-group>
  150. </div> -->
  151. </div>
  152. <div slot="footer" class="dialog-footer">
  153. <el-button @click="showFhDialog = false">取消</el-button>
  154. <el-button type="primary" @click="submitFh">发送</el-button>
  155. </div>
  156. </el-dialog>
  157. </div>
  158. </template>
  159. <script>
  160. import auditDocumentsMain from './auditDocumentsMain'
  161. import collectiveMain from './collectiveMain'
  162. import conclusionMain from './conclusionMain'
  163. import {
  164. getDataPreliminaryReviewButton,
  165. doProcessBtn,
  166. } from '@/api/dataPreliminaryReview'
  167. import { getReviewTask } from '@/api/audit/reviewTask'
  168. export default {
  169. name: 'Details',
  170. components: {
  171. auditDocumentsMain,
  172. collectiveMain,
  173. conclusionMain,
  174. },
  175. props: {
  176. visible: {
  177. type: Boolean,
  178. default: true,
  179. },
  180. project: {
  181. type: Object,
  182. default: () => {},
  183. },
  184. id: {
  185. type: [String, Number],
  186. default: null,
  187. },
  188. currentNode: {
  189. type: String,
  190. default: '',
  191. },
  192. currentStatus: {
  193. type: String,
  194. default: '',
  195. },
  196. projectName: {
  197. type: String,
  198. default: '',
  199. },
  200. auditObject: {
  201. type: String,
  202. default: '',
  203. },
  204. },
  205. data() {
  206. return {
  207. buttonData: [], //资料初审按钮数据
  208. activeTab: 'submitData', // 默认选中报送资料标签页
  209. drawerVisible: this.visible, // 本地变量控制drawer显示状态
  210. // 弹窗显示状态
  211. showSupplementDialog: false,
  212. showAbortDialog: false,
  213. showRejectDialog: false,
  214. showProcessDialog: false, // 流转下一步/退回上一步弹窗
  215. showFhDialog: false,
  216. // 弹窗数据
  217. additionalParams: {},
  218. // 当前操作按钮信息
  219. currentButton: null,
  220. // 流转/退回操作参数
  221. processParams: {
  222. content: '', // 意见
  223. // sendType: [], // 发送方式
  224. },
  225. // 当前操作类型:'next' 流转下一步, 'prev' 退回上一步
  226. currentProcessType: '',
  227. }
  228. },
  229. computed: {
  230. dialogTitle() {
  231. // 基础标题
  232. let baseTitle = ''
  233. // 根据节点类型设置标题
  234. if (
  235. this.currentNode === 'sdshenhe' &&
  236. this.currentStatus === '审核中'
  237. ) {
  238. baseTitle = '审核详情'
  239. } else if (this.currentNode === 'clcs') {
  240. baseTitle = '成本调查详情'
  241. } else if (
  242. this.currentNode === 'yjgaozhi' ||
  243. this.currentNode === 'yjfk'
  244. ) {
  245. baseTitle = '意见告知'
  246. } else {
  247. baseTitle = '成本审核详情'
  248. }
  249. // 添加项目名称和监审对象
  250. let titleParts = [baseTitle]
  251. if (this.projectName) {
  252. titleParts.push(` - ${this.projectName}`)
  253. }
  254. if (this.auditObject) {
  255. titleParts.push(` (${this.auditObject})`)
  256. }
  257. return titleParts.join('')
  258. },
  259. // 流转/退回/办结弹窗标题
  260. processDialogTitle() {
  261. if (this.currentProcessType === 'next') {
  262. return '流转下一步'
  263. } else if (this.currentProcessType === 'prev') {
  264. return '退回上一步'
  265. } else if (this.currentProcessType === 'complete') {
  266. return '办结任务'
  267. }
  268. return '操作'
  269. },
  270. },
  271. watch: {
  272. visible(newVal) {
  273. // 监听visible prop变化,更新本地drawerVisible变量
  274. this.drawerVisible = newVal
  275. // 弹窗打开时设置标签页并获取按钮数据
  276. if (newVal && this.id) {
  277. // 使用 $nextTick 确保 props 已更新
  278. this.$nextTick(() => {
  279. // 设置标签页
  280. this.setActiveTab()
  281. // 弹窗打开时,无论什么情况都要获取资料初审按钮数据
  282. this.getPreliminaryReviewButton()
  283. })
  284. }
  285. },
  286. // 监听currentNode变化,如果弹窗已打开,更新标签页并重新获取按钮数据
  287. currentNode(newVal, oldVal) {
  288. if (this.drawerVisible && this.id && newVal && newVal !== oldVal) {
  289. this.$nextTick(() => {
  290. // 设置标签页
  291. this.setActiveTab()
  292. // 重新获取按钮数据
  293. this.getPreliminaryReviewButton()
  294. })
  295. }
  296. },
  297. // 监听currentStatus变化,如果弹窗已打开,更新标签页并重新获取按钮数据
  298. currentStatus(newVal, oldVal) {
  299. if (this.drawerVisible && this.id && newVal && newVal !== oldVal) {
  300. this.$nextTick(() => {
  301. // 设置标签页
  302. this.setActiveTab()
  303. // 重新获取按钮数据
  304. this.getPreliminaryReviewButton()
  305. })
  306. }
  307. },
  308. // 监听id变化,如果弹窗已打开,重新获取按钮数据
  309. id(newVal) {
  310. if (this.drawerVisible && newVal) {
  311. this.$nextTick(() => {
  312. // 设置标签页
  313. this.setActiveTab()
  314. // 获取按钮数据
  315. this.getPreliminaryReviewButton()
  316. })
  317. }
  318. },
  319. },
  320. mounted() {
  321. // 设置标签页
  322. this.setActiveTab()
  323. // 如果组件挂载时弹窗已打开且有id,也要获取按钮数据
  324. if (this.drawerVisible && this.id) {
  325. this.$nextTick(() => {
  326. // 弹窗打开时,无论什么情况都要获取资料初审按钮数据
  327. this.getPreliminaryReviewButton()
  328. })
  329. }
  330. },
  331. methods: {
  332. // 根据 currentNode 和 currentStatus 设置活动标签页
  333. setActiveTab() {},
  334. // 获取资料初审按钮
  335. async getPreliminaryReviewButton() {
  336. // 直接从 props 获取 currentNode,确保是最新的值
  337. const currentNode = this.currentNode
  338. // 构建参数对象
  339. const params = {
  340. taskId: this.id,
  341. }
  342. // 只有当 currentNode 有值时才添加 processNodeKey
  343. if (currentNode && currentNode.trim() !== '') {
  344. params.processNodeKey = currentNode === 'ccls' ? 'clcs' : currentNode
  345. }
  346. try {
  347. const response = await getDataPreliminaryReviewButton(params)
  348. this.buttonData = response.value || []
  349. } catch (error) {
  350. this.buttonData = []
  351. }
  352. },
  353. handleClose() {
  354. // 关闭弹窗时更新本地状态并触发事件
  355. this.drawerVisible = false
  356. this.$emit('update:visible', false)
  357. this.$emit('close')
  358. },
  359. // 处理审核意见保存成功后的刷新
  360. handleAuditOpinionRefresh() {
  361. // 触发父组件刷新列表
  362. this.$emit('refresh')
  363. },
  364. open() {
  365. // 打开弹窗方法,供父组件通过ref调用
  366. this.drawerVisible = true
  367. this.$emit('update:visible', true)
  368. },
  369. // 处理结论保存成功
  370. handleConclusionSaved() {
  371. // 关闭弹窗
  372. this.handleClose()
  373. // 触发父组件刷新列表
  374. this.$emit('refresh')
  375. },
  376. // 处理返回按钮点击
  377. handleAssign() {
  378. // 关闭弹窗
  379. this.handleClose()
  380. // 触发父组件刷新列表
  381. this.$emit('refresh')
  382. },
  383. // 处理审核操作按钮点击
  384. handleAuditPass(item) {},
  385. // 流转下一步
  386. handleNextStep() {
  387. this.currentProcessType = 'next'
  388. this.processParams = {
  389. content: '',
  390. // sendType: [],
  391. }
  392. this.showProcessDialog = true
  393. },
  394. // 退回上一步
  395. handlePrevStep() {
  396. this.currentProcessType = 'prev'
  397. this.processParams = {
  398. content: '',
  399. // sendType: [],
  400. }
  401. this.showProcessDialog = true
  402. },
  403. // 办结任务
  404. handleAddTask() {
  405. this.currentProcessType = 'complete'
  406. this.processParams = {
  407. content: '',
  408. // sendType: [],
  409. }
  410. this.showProcessDialog = true
  411. },
  412. // 提交流转/退回操作
  413. async submitProcess() {
  414. if (!this.id) {
  415. this.$message.error('缺少任务ID')
  416. return
  417. }
  418. // 验证发送方式
  419. // if (
  420. // !this.processParams.sendType ||
  421. // this.processParams.sendType.length === 0
  422. // ) {
  423. // this.$message.warning('请选择至少一种发送方式')
  424. // return
  425. // }
  426. try {
  427. // 根据操作类型确定key值
  428. let keyValue
  429. if (this.currentProcessType === 'next') {
  430. keyValue = 7 // 流转下一步
  431. } else if (this.currentProcessType === 'prev') {
  432. keyValue = 6 // 退回上一步
  433. } else if (this.currentProcessType === 'complete') {
  434. keyValue = 3 // 办结任务
  435. }
  436. const params = {
  437. taskId: this.id,
  438. processNodeKey: this.currentNode,
  439. key: keyValue,
  440. // sendType: this.processParams.sendType.join(','), // 发送方式用","分割
  441. content: this.processParams.content || '', // 意见
  442. }
  443. const response = await getReviewTask(params)
  444. if (response && response.code === 200) {
  445. // 根据操作类型显示成功消息
  446. let actionText
  447. if (this.currentProcessType === 'next') {
  448. actionText = '流转下一步'
  449. } else if (this.currentProcessType === 'prev') {
  450. actionText = '退回上一步'
  451. } else if (this.currentProcessType === 'complete') {
  452. actionText = '办结任务'
  453. }
  454. this.$message.success(response.message)
  455. // 关闭弹窗
  456. this.showProcessDialog = false
  457. // 重置参数
  458. this.processParams = {
  459. content: '',
  460. // sendType: [],
  461. }
  462. this.currentProcessType = ''
  463. // 关闭主弹窗
  464. this.handleClose()
  465. // 触发父组件刷新列表
  466. this.$emit('refresh')
  467. }
  468. } catch (error) {
  469. // 根据操作类型显示失败消息
  470. let actionText
  471. if (this.currentProcessType === 'next') {
  472. actionText = '流转下一步'
  473. } else if (this.currentProcessType === 'prev') {
  474. actionText = '退回上一步'
  475. } else if (this.currentProcessType === 'complete') {
  476. actionText = '办结任务'
  477. }
  478. // this.$message.error(actionText + '操作失败')
  479. console.error(actionText + '操作失败:', error)
  480. }
  481. },
  482. // 执行审核操作
  483. async executeAuditOperation() {
  484. if (!this.id) {
  485. this.$message.error('缺少任务ID')
  486. return
  487. }
  488. if (!this.currentButton) {
  489. this.$message.error('操作失败:缺少按钮信息')
  490. return
  491. }
  492. try {
  493. const params = {
  494. taskId: this.id,
  495. processNodeKey: this.currentNode,
  496. key: this.currentButton.key,
  497. // sendType: this.additionalParams.sendType?.join(','),
  498. content: this.additionalParams.content,
  499. }
  500. const response = await doProcessBtn(params)
  501. this.handleOperationResponse(response)
  502. } catch (error) {
  503. // this.$message.error(this.currentButton.value + '操作失败')
  504. console.error(this.currentButton.value + '操作失败')
  505. }
  506. },
  507. // 处理操作响应
  508. handleOperationResponse(response) {
  509. if (response && response.code === 200) {
  510. this.$message.success(this.currentButton.value + '操作成功')
  511. // 关闭所有弹窗
  512. this.showSupplementDialog = false
  513. this.showAbortDialog = false
  514. this.showRejectDialog = false
  515. this.showProcessDialog = false
  516. // 关闭主弹窗
  517. this.handleClose()
  518. // 触发父组件刷新列表
  519. this.$emit('refresh')
  520. } else {
  521. this.$message.error(
  522. response?.message || this.currentButton.value + '操作失败'
  523. )
  524. }
  525. },
  526. handleFh() {
  527. this.showFhDialog = true
  528. },
  529. async submitFh() {
  530. if (!this.processParams.content || !this.processParams.content.trim()) {
  531. this.$message.error('请输入退回意见')
  532. return
  533. }
  534. const params = {
  535. taskId: this.id,
  536. processNodeKey: this.currentNode,
  537. key: 8,
  538. content: this.processParams.content,
  539. }
  540. const response = await doProcessBtn(params)
  541. if (response && response.code === 200) {
  542. this.$message.success('操作成功')
  543. // 关闭所有弹窗
  544. this.showFhDialog = false
  545. this.showSupplementDialog = false
  546. this.showAbortDialog = false
  547. this.showRejectDialog = false
  548. this.showProcessDialog = false
  549. // 关闭主弹窗
  550. this.handleClose()
  551. // 触发父组件刷新列表
  552. this.$emit('refresh')
  553. } else {
  554. this.$message.error(response?.message || '操作失败')
  555. }
  556. },
  557. },
  558. }
  559. </script>
  560. <style scoped>
  561. .btn-group {
  562. margin-bottom: 20px;
  563. margin-left: 20px;
  564. }
  565. .btn-group .el-button {
  566. margin-right: 10px;
  567. }
  568. .details-container {
  569. width: 100%;
  570. height: 100%;
  571. }
  572. .audit-tabs {
  573. height: calc(100vh - 150px);
  574. }
  575. .audit-tabs .el-tabs__header {
  576. margin-bottom: 0;
  577. padding: 15px 15px 0;
  578. background: #f5f7fa;
  579. border-bottom: 1px solid #ebeef5;
  580. }
  581. .audit-tabs .el-tabs__nav-wrap {
  582. padding-bottom: 10px;
  583. }
  584. .audit-tabs .el-tabs__content {
  585. height: calc(100% - 60px);
  586. padding: 15px;
  587. overflow-y: auto;
  588. }
  589. .audit-tabs .el-tab-pane {
  590. height: 100%;
  591. }
  592. /* 弹窗样式 */
  593. .dialog-content {
  594. padding: 10px 0;
  595. }
  596. .form-item {
  597. margin-bottom: 20px;
  598. }
  599. .form-label {
  600. display: inline-block;
  601. width: 100px;
  602. text-align: right;
  603. margin-right: 0;
  604. color: #606266;
  605. vertical-align: middle;
  606. }
  607. .form-item .el-checkbox-group {
  608. display: inline-block;
  609. margin-left: 10px;
  610. }
  611. .form-item .el-checkbox {
  612. margin-right: 20px;
  613. vertical-align: middle;
  614. }
  615. .form-item .el-input__inner {
  616. width: calc(100% - 115px);
  617. margin-left: 115px;
  618. }
  619. /* 流转/退回弹窗样式优化 */
  620. .process-dialog .dialog-content {
  621. padding: 20px 0;
  622. }
  623. .process-dialog .process-form-item {
  624. display: flex;
  625. align-items: flex-start;
  626. margin-bottom: 24px;
  627. }
  628. .process-dialog .process-form-item:last-child {
  629. margin-bottom: 0;
  630. }
  631. .process-dialog .form-label {
  632. width: 80px;
  633. text-align: left;
  634. margin-right: 8px;
  635. color: #303133;
  636. font-size: 14px;
  637. line-height: 32px;
  638. flex-shrink: 0;
  639. }
  640. .process-dialog .form-content {
  641. flex: 1;
  642. }
  643. .process-dialog .form-content .el-textarea {
  644. width: 100%;
  645. }
  646. .process-dialog .form-content .el-checkbox-group {
  647. display: flex;
  648. /* flex-direction: column; */
  649. }
  650. .process-dialog .form-content .el-checkbox {
  651. margin-right: 0;
  652. margin-left: 12px;
  653. }
  654. .process-dialog .form-content .el-checkbox:last-child {
  655. margin-bottom: 0;
  656. }
  657. .process-dialog .dialog-footer {
  658. text-align: right;
  659. padding-top: 10px;
  660. }
  661. </style>