audit-risk-detail.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. let queryData = this.$route.query
  66. if (this.searchType === 'component') {
  67. queryData = this.searchData
  68. }
  69. this.showModal(queryData)
  70. },
  71. methods: {
  72. showModal(searchParams) {
  73. // 审核状态
  74. this.loading = true
  75. if (searchParams.detailStatus || searchParams.detailStatus) {
  76. this.detailStatus = true
  77. }
  78. const params = JSON.parse(searchParams.queryJson || '{}')
  79. const formData = new FormData()
  80. Object.keys(params).forEach((key) => {
  81. formData.append(key, params[key])
  82. })
  83. const status = params.status
  84. if (status === 1 || status === '1') {
  85. this.detailStatus = false
  86. } else {
  87. this.detailStatus = true
  88. }
  89. this.modelDetail = JSON.parse(searchParams.modelDetail || '{}')
  90. const type = searchParams.type
  91. if (type !== 'sh') {
  92. this.detailStatus = false
  93. }
  94. // 下发状态
  95. if (type === 'sh') {
  96. AuditRiskbraryService.getQuestionExamineDetail(params)
  97. .then((res) => {
  98. const allField = []
  99. this.columnsDetail = res.data[0].detailArr.map((item) => {
  100. allField.push(item.commit)
  101. return {
  102. title: item.commit,
  103. dataIndex: item.commit,
  104. width: item.value === 'null' ? '100px' : '240px',
  105. ellipsis: true,
  106. }
  107. })
  108. this.columnsDetail = this.columnsDetail.filter((item) => {
  109. return (
  110. item.title !== '事件标签' && item.title !== '业务主键' && item.title !== '业务时间'
  111. )
  112. })
  113. this.dataDetail = res.data.map((item) => {
  114. const obj = {}
  115. allField.forEach((field) => {
  116. const onfield = item.detailArr.find((i) => i.commit === field).value
  117. obj[field] = onfield !== 'null' ? onfield : ''
  118. })
  119. obj.id = item.questionId
  120. return obj
  121. })
  122. })
  123. .finally(() => {
  124. this.loading = false
  125. })
  126. } else {
  127. AuditRiskbraryService.getDetailInfo(params)
  128. .then((res) => {
  129. const allField = []
  130. this.columnsDetail = res.data[0].detailArr.map((item) => {
  131. allField.push(item.commit)
  132. return {
  133. title: item.commit,
  134. dataIndex: item.commit,
  135. width: item.value === 'null' ? '100px' : '240px',
  136. ellipsis: true,
  137. }
  138. })
  139. // 过滤事件标签 业务主键 业务时间 buss_key event_type buss_time
  140. this.columnsDetail = this.columnsDetail.filter((item) => {
  141. return (
  142. item.title !== 'buss_key' &&
  143. item.title !== 'event_type' &&
  144. item.title !== 'buss_time' &&
  145. item.title !== '事件标签' &&
  146. item.title !== '业务主键' &&
  147. item.title !== '业务时间'
  148. )
  149. })
  150. this.dataDetail = res.data.map((item) => {
  151. const obj = {}
  152. allField.forEach((field) => {
  153. const onfield = item.detailArr.find((i) => i.commit === field).value
  154. obj[field] = onfield !== 'null' ? onfield : ''
  155. })
  156. obj.id = item.questionId
  157. return obj
  158. })
  159. })
  160. .finally(() => {
  161. this.loading = false
  162. })
  163. }
  164. },
  165. ondetailDelete() {
  166. Modal.confirm({
  167. title: '提示',
  168. content: '是否确认删除?',
  169. onOk: () => {
  170. const ids = this.selectedRows.map((item) => item.id).join(',')
  171. AuditRiskbraryService.deleteDetailInfo(ids).then((res) => {
  172. message.success('删除成功')
  173. this.selectedRowKeys = []
  174. this.selectedRows = []
  175. this.dataDetail = []
  176. this.columnsDetail = []
  177. this.showModal()
  178. })
  179. },
  180. })
  181. },
  182. onSelectChange(selectedRowKeys, selectedRows) {
  183. this.selectedRowKeys = selectedRowKeys
  184. this.selectedRows = selectedRows
  185. },
  186. },
  187. }
  188. </script>
  189. <style module lang="scss">
  190. @use '@/common/design' as *;
  191. .wrap-height {
  192. height: 100%;
  193. .row-height {
  194. display: flex;
  195. flex: auto;
  196. height: 100%;
  197. .rightcard {
  198. flex: 1;
  199. width: calc(100% - 20%);
  200. height: 100%;
  201. }
  202. }
  203. }
  204. .button-content {
  205. button {
  206. margin: 0 4px;
  207. }
  208. }
  209. .no-action {
  210. padding: 0 15px;
  211. color: $text-color-secondary;
  212. }
  213. .detail {
  214. width: 100%;
  215. overflow-x: auto;
  216. }
  217. .detail-delete {
  218. display: flex;
  219. justify-content: flex-end;
  220. margin-bottom: 10px;
  221. }
  222. .model-detail {
  223. display: flex;
  224. margin-bottom: 10px;
  225. span {
  226. margin-right: 20px;
  227. }
  228. }
  229. .delete {
  230. display: flex;
  231. justify-content: flex-end;
  232. padding: 9px 15px 0 0;
  233. }
  234. </style>