mainDetails.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <div class="details-container">
  3. <el-drawer
  4. :visible.sync="visible"
  5. :title="dialogTitle"
  6. size="90%"
  7. @close="handleClose"
  8. >
  9. <!-- 操作按钮区域 -->
  10. <div class="btn-group">
  11. <el-button
  12. v-for="item in buttonData"
  13. :key="item.id"
  14. type="primary"
  15. @click="handleAuditPass(item)"
  16. >
  17. {{ item.value }}
  18. </el-button>
  19. </div>
  20. <!-- 标签页面 -->
  21. <el-tabs v-model="activeTab" type="card" class="audit-tabs">
  22. <el-tab-pane label="监审文书" name="submitData"></el-tab-pane>
  23. <el-tab-pane label="集体审议" name="costSurvey"></el-tab-pane>
  24. <el-tab-pane
  25. v-if="currentNode !== 'clcs'"
  26. label="出具结论"
  27. name="costAudit"
  28. ></el-tab-pane>
  29. </el-tabs>
  30. </el-drawer>
  31. </div>
  32. </template>
  33. <script>
  34. import {
  35. getDataPreliminaryReviewButton,
  36. doProcessBtn,
  37. } from '@/api/dataPreliminaryReview'
  38. export default {
  39. name: 'Details',
  40. components: {},
  41. props: {
  42. visible: {
  43. type: Boolean,
  44. default: true,
  45. },
  46. id: {
  47. type: [String, Number],
  48. default: null,
  49. },
  50. currentNode: {
  51. type: String,
  52. default: '',
  53. },
  54. currentStatus: {
  55. type: String,
  56. default: '',
  57. },
  58. },
  59. data() {
  60. return {
  61. buttonData: [], //资料初审按钮数据
  62. activeTab: 'submitData', // 默认选中报送资料标签页
  63. // 弹窗显示状态
  64. showSupplementDialog: false,
  65. showAbortDialog: false,
  66. showRejectDialog: false,
  67. // 弹窗数据
  68. additionalParams: {},
  69. // 当前操作按钮信息
  70. currentButton: null,
  71. }
  72. },
  73. computed: {
  74. dialogTitle() {
  75. // 根据节点类型设置标题
  76. if (
  77. this.currentNode === 'sdshenhe' &&
  78. this.currentStatus === '审核中'
  79. ) {
  80. return '审核详情'
  81. } else if (this.currentNode === 'clcs') {
  82. return '成本调查详情'
  83. } else if (
  84. this.currentNode === 'yjgaozhi' ||
  85. this.currentNode === 'yjfk'
  86. ) {
  87. return '意见告知'
  88. }
  89. return '成本审核详情'
  90. },
  91. },
  92. watch: {
  93. visible(newVal) {
  94. // 监听visible变化,弹窗打开时设置标签页并获取按钮数据
  95. if (newVal && this.id) {
  96. // 使用 $nextTick 确保 props 已更新
  97. this.$nextTick(() => {
  98. // 设置标签页
  99. this.setActiveTab()
  100. // 弹窗打开时,无论什么情况都要获取资料初审按钮数据
  101. this.getPreliminaryReviewButton()
  102. })
  103. }
  104. },
  105. // 监听currentNode变化,如果弹窗已打开,更新标签页并重新获取按钮数据
  106. currentNode(newVal, oldVal) {
  107. if (this.visible && this.id && newVal && newVal !== oldVal) {
  108. this.$nextTick(() => {
  109. // 设置标签页
  110. this.setActiveTab()
  111. // 重新获取按钮数据
  112. this.getPreliminaryReviewButton()
  113. })
  114. }
  115. },
  116. // 监听currentStatus变化,如果弹窗已打开,更新标签页并重新获取按钮数据
  117. currentStatus(newVal, oldVal) {
  118. if (this.visible && this.id && newVal && newVal !== oldVal) {
  119. this.$nextTick(() => {
  120. // 设置标签页
  121. this.setActiveTab()
  122. // 重新获取按钮数据
  123. this.getPreliminaryReviewButton()
  124. })
  125. }
  126. },
  127. // 监听id变化,如果弹窗已打开,重新获取按钮数据
  128. id(newVal) {
  129. if (this.visible && newVal) {
  130. this.$nextTick(() => {
  131. // 设置标签页
  132. this.setActiveTab()
  133. // 获取按钮数据
  134. this.getPreliminaryReviewButton()
  135. })
  136. }
  137. },
  138. },
  139. mounted() {
  140. // 设置标签页
  141. this.setActiveTab()
  142. // 如果组件挂载时弹窗已打开且有id,也要获取按钮数据
  143. if (this.visible && this.id) {
  144. this.$nextTick(() => {
  145. // 弹窗打开时,无论什么情况都要获取资料初审按钮数据
  146. this.getPreliminaryReviewButton()
  147. })
  148. }
  149. },
  150. methods: {
  151. // 根据 currentNode 和 currentStatus 设置活动标签页
  152. setActiveTab() {},
  153. // 获取资料初审按钮
  154. async getPreliminaryReviewButton() {
  155. // 直接从 props 获取 currentNode,确保是最新的值
  156. const currentNode = this.currentNode
  157. // 构建参数对象
  158. const params = {
  159. taskId: this.id,
  160. }
  161. // 只有当 currentNode 有值时才添加 processNodeKey
  162. if (currentNode && currentNode.trim() !== '') {
  163. params.processNodeKey = currentNode === 'ccls' ? 'clcs' : currentNode
  164. }
  165. try {
  166. const response = await getDataPreliminaryReviewButton(params)
  167. this.buttonData = response.value || []
  168. } catch (error) {
  169. this.buttonData = []
  170. }
  171. },
  172. handleClose() {
  173. // 关闭弹窗时触发事件
  174. this.$emit('update:visible', false)
  175. this.$emit('close')
  176. },
  177. // 处理审核意见保存成功后的刷新
  178. handleAuditOpinionRefresh() {
  179. // 触发父组件刷新列表
  180. this.$emit('refresh')
  181. },
  182. open() {
  183. // 打开弹窗方法,供父组件通过ref调用
  184. this.$emit('update:visible', true)
  185. },
  186. // 处理审核操作按钮点击
  187. handleAuditPass(item) {},
  188. // 执行审核操作
  189. async executeAuditOperation() {
  190. if (!this.id) {
  191. this.$message.error('缺少任务ID')
  192. return
  193. }
  194. if (!this.currentButton) {
  195. this.$message.error('操作失败:缺少按钮信息')
  196. return
  197. }
  198. try {
  199. const params = {
  200. taskId: this.id,
  201. processNodeKey: this.currentNode,
  202. key: this.currentButton.key,
  203. sendType: this.additionalParams.sendType?.join(','),
  204. content: this.additionalParams.content,
  205. }
  206. const response = await doProcessBtn(params)
  207. if (response && response.code === 200) {
  208. this.$message.success(this.currentButton.value + '操作成功')
  209. // 关闭所有弹窗
  210. this.showSupplementDialog = false
  211. this.showAbortDialog = false
  212. this.showRejectDialog = false
  213. // 关闭主弹窗
  214. this.handleClose()
  215. // 触发父组件刷新列表
  216. this.$emit('refresh')
  217. } else {
  218. this.$message.error(
  219. response?.message || this.currentButton.value + '操作失败'
  220. )
  221. }
  222. } catch (error) {
  223. this.$message.error(this.currentButton.value + '操作失败')
  224. }
  225. },
  226. },
  227. }
  228. </script>
  229. <style scoped>
  230. .btn-group {
  231. margin-bottom: 20px;
  232. margin-left: 20px;
  233. }
  234. .btn-group .el-button {
  235. margin-right: 10px;
  236. }
  237. .details-container {
  238. width: 100%;
  239. height: 100%;
  240. }
  241. .audit-tabs {
  242. height: calc(100vh - 150px);
  243. }
  244. .audit-tabs .el-tabs__header {
  245. margin-bottom: 0;
  246. padding: 15px 15px 0;
  247. background: #f5f7fa;
  248. border-bottom: 1px solid #ebeef5;
  249. }
  250. .audit-tabs .el-tabs__nav-wrap {
  251. padding-bottom: 10px;
  252. }
  253. .audit-tabs .el-tabs__content {
  254. height: calc(100% - 60px);
  255. padding: 15px;
  256. overflow-y: auto;
  257. }
  258. .audit-tabs .el-tab-pane {
  259. height: 100%;
  260. }
  261. /* 弹窗样式 */
  262. .dialog-content {
  263. padding: 10px 0;
  264. }
  265. .form-item {
  266. margin-bottom: 20px;
  267. }
  268. .form-label {
  269. display: inline-block;
  270. width: 100px;
  271. text-align: right;
  272. margin-right: 0;
  273. color: #606266;
  274. vertical-align: middle;
  275. }
  276. .form-item .el-checkbox-group {
  277. display: inline-block;
  278. margin-left: 10px;
  279. }
  280. .form-item .el-checkbox {
  281. margin-right: 20px;
  282. vertical-align: middle;
  283. }
  284. .form-item .el-input__inner {
  285. width: calc(100% - 115px);
  286. margin-left: 115px;
  287. }
  288. </style>