audit-risk-detail.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <audit-form-top-banner>
  3. <template slot="afterbtn">
  4. <div :class="$style.delete">
  5. <a-button v-if="detailStatus" type="primary" @click="ondetailDelete">删除</a-button>
  6. </div>
  7. </template>
  8. <div :class="$style.detail">
  9. <div :class="$style.modelDetail">
  10. <span>模型编码:{{ modelDetail.batchCode }}</span>
  11. <span>模型名称:{{ modelDetail.batchName }}</span>
  12. <span>业务领域:{{ modelDetail.modelDomainName }}</span>
  13. <span>风险描述:{{ modelDetail.riskData }}</span>
  14. </div>
  15. <sd-table
  16. :columns="columnsDetail"
  17. :data-source="dataDetail"
  18. :row-key="(_, index) => index"
  19. :loading="loading"
  20. :scroll="{ x: 1150 }"
  21. :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  22. >
  23. </sd-table>
  24. </div>
  25. </audit-form-top-banner>
  26. </template>
  27. <script>
  28. import components from './_import-components/audit-risk-detail-import'
  29. import AuditRiskbraryService from './riskLibrary'
  30. import auditFormTopBanner from './audit-top-banner'
  31. import { Modal, message } from 'ant-design-vue'
  32. export default {
  33. name: 'AuditRiskDetail',
  34. metaInfo: {
  35. title: '详情',
  36. },
  37. components: {
  38. ...components,
  39. auditFormTopBanner,
  40. },
  41. props: {
  42. // searchData
  43. searchData: {
  44. type: Object,
  45. default: () => ({}),
  46. },
  47. // searchType
  48. searchType: {
  49. type: String,
  50. default: '', // 组件模式 component
  51. },
  52. },
  53. data() {
  54. return {
  55. modelDetail: {},
  56. columnsDetail: [],
  57. dataDetail: [],
  58. detailStatus: false,
  59. selectedRowKeys: [],
  60. loading: false,
  61. }
  62. },
  63. created() {
  64. // 阻止页面刷新
  65. console.log(this.$route.query)
  66. let queryData = this.$route.query
  67. if (this.searchType === 'component') {
  68. queryData = this.searchData
  69. }
  70. this.showModal(queryData)
  71. },
  72. methods: {
  73. showModal(searchParams) {
  74. // 审核状态
  75. this.loading = true
  76. if (searchParams.detailStatus || searchParams.detailStatus) {
  77. this.detailStatus = true
  78. }
  79. const params = JSON.parse(searchParams.queryJson || '{}')
  80. const formData = new FormData()
  81. Object.keys(params).forEach((key) => {
  82. formData.append(key, params[key])
  83. })
  84. const status = params.status
  85. if (status === 1 || status === '1') {
  86. this.detailStatus = false
  87. } else {
  88. this.detailStatus = true
  89. }
  90. this.modelDetail = JSON.parse(searchParams.modelDetail || '{}')
  91. const type = searchParams.type
  92. if (type !== 'sh') {
  93. this.detailStatus = false
  94. }
  95. // 下发状态
  96. if (type === 'sh') {
  97. AuditRiskbraryService.getQuestionExamineDetail(params)
  98. .then((res) => {
  99. const allField = []
  100. this.columnsDetail = res.data[0].detailArr.map((item) => {
  101. allField.push(item.commit)
  102. return {
  103. title: item.commit,
  104. dataIndex: item.commit,
  105. width: item.value === 'null' ? '100px' : '240px',
  106. ellipsis: true,
  107. }
  108. })
  109. this.columnsDetail = this.columnsDetail.filter((item) => {
  110. return (
  111. item.title !== '事件标签' && item.title !== '业务主键' && item.title !== '业务时间'
  112. )
  113. })
  114. this.dataDetail = res.data.map((item) => {
  115. const obj = {}
  116. allField.forEach((field) => {
  117. const onfield = item.detailArr.find((i) => i.commit === field).value
  118. obj[field] = onfield !== 'null' ? onfield : ''
  119. })
  120. obj.id = item.questionId
  121. return obj
  122. })
  123. })
  124. .finally(() => {
  125. this.loading = false
  126. })
  127. } else {
  128. AuditRiskbraryService.getDetailInfo(params)
  129. .then((res) => {
  130. const allField = []
  131. this.columnsDetail = res.data[0].detailArr.map((item) => {
  132. allField.push(item.commit)
  133. return {
  134. title: item.commit,
  135. dataIndex: item.commit,
  136. width: item.value === 'null' ? '100px' : '240px',
  137. ellipsis: true,
  138. }
  139. })
  140. // 过滤事件标签 业务主键 业务时间 buss_key event_type buss_time
  141. this.columnsDetail = this.columnsDetail.filter((item) => {
  142. return (
  143. item.title !== 'buss_key' &&
  144. item.title !== 'event_type' &&
  145. item.title !== 'buss_time' &&
  146. item.title !== '事件标签' &&
  147. item.title !== '业务主键' &&
  148. item.title !== '业务时间'
  149. )
  150. })
  151. this.dataDetail = res.data.map((item) => {
  152. const obj = {}
  153. allField.forEach((field) => {
  154. const onfield = item.detailArr.find((i) => i.commit === field).value
  155. obj[field] = onfield !== 'null' ? onfield : ''
  156. })
  157. obj.id = item.questionId
  158. return obj
  159. })
  160. })
  161. .finally(() => {
  162. this.loading = false
  163. })
  164. }
  165. },
  166. ondetailDelete() {
  167. Modal.confirm({
  168. title: '提示',
  169. content: '是否确认删除?',
  170. onOk: () => {
  171. const ids = this.selectedRows.map((item) => item.id).join(',')
  172. AuditRiskbraryService.deleteDetailInfo(ids).then((res) => {
  173. message.success('删除成功')
  174. this.selectedRowKeys = []
  175. this.selectedRows = []
  176. this.dataDetail = []
  177. this.columnsDetail = []
  178. this.showModal()
  179. })
  180. },
  181. })
  182. },
  183. onSelectChange(selectedRowKeys, selectedRows) {
  184. this.selectedRowKeys = selectedRowKeys
  185. this.selectedRows = selectedRows
  186. },
  187. },
  188. }
  189. </script>
  190. <style module lang="scss">
  191. @use '@/common/design' as *;
  192. .wrap-height {
  193. height: 100%;
  194. .row-height {
  195. display: flex;
  196. flex: auto;
  197. height: 100%;
  198. .rightcard {
  199. flex: 1;
  200. width: calc(100% - 20%);
  201. height: 100%;
  202. }
  203. }
  204. }
  205. .button-content {
  206. button {
  207. margin: 0 4px;
  208. }
  209. }
  210. .no-action {
  211. padding: 0 15px;
  212. color: $text-color-secondary;
  213. }
  214. .detail {
  215. width: 100%;
  216. overflow-x: auto;
  217. }
  218. .detail-delete {
  219. display: flex;
  220. justify-content: flex-end;
  221. margin-bottom: 10px;
  222. }
  223. .model-detail {
  224. display: flex;
  225. margin-bottom: 10px;
  226. span {
  227. margin-right: 20px;
  228. }
  229. }
  230. .delete {
  231. display: flex;
  232. justify-content: flex-end;
  233. padding: 9px 15px 0 0;
  234. }
  235. </style>