mainDetails.vue 20 KB

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