audit-select-maintain.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <div>
  3. <a-modal
  4. class="modalselectmaintain"
  5. :body-style="bodyStyle"
  6. :title="title"
  7. :destroy-on-close="true"
  8. :visible="visible"
  9. :width="modalWidth"
  10. @ok="handleOk"
  11. @cancel="handleCancel"
  12. >
  13. <audit-advanced-query
  14. :expand="expand"
  15. :search-data="formData"
  16. :ref-name="searchform"
  17. :search-style="{ height: 'auto', left: '21px', top: '105px' }"
  18. :search-fun="handleSearch"
  19. @searchedClick="searchedClick"
  20. >
  21. <template>
  22. <a-col :span="12">
  23. <a-form-model-item :label="'模型编号'" prop="modelCode">
  24. <a-input v-model="formData.modelCode" allow-clear />
  25. </a-form-model-item>
  26. </a-col>
  27. <a-col :span="12">
  28. <a-form-model-item :label="'模型名称'" prop="modelName">
  29. <a-input v-model="formData.modelName" allow-clear />
  30. </a-form-model-item>
  31. </a-col>
  32. </template>
  33. </audit-advanced-query>
  34. <!-- 列表 -->
  35. <sd-data-table-ex
  36. ref="SJMXDataTable"
  37. :show-advance-btn="true"
  38. form-id="iamModelMaintain"
  39. page-id="audit/maintain/iamModelMaintain"
  40. :pagination="{ pageSize: 10 }"
  41. :filter-expressions="filterExpressions"
  42. :check-type="'checkbox'"
  43. :columns="columns"
  44. :show-advance-query="true"
  45. :search-fields="['modelCode', 'modelName']"
  46. show-selection
  47. :process-res="processRes"
  48. @searchbtnClick="searchbtnClick"
  49. @onChange="onChange"
  50. >
  51. </sd-data-table-ex>
  52. </a-modal>
  53. </div>
  54. </template>
  55. <script>
  56. import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
  57. import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
  58. import components from './_import-components/audit-select-maintain-import'
  59. import { message } from 'ant-design-vue'
  60. const columns = [
  61. {
  62. title: '序号',
  63. dataIndex: 'sortNumber',
  64. customRender: (text, record, index) => `${index + 1}`,
  65. width: '80px',
  66. },
  67. {
  68. title: '模型编号',
  69. dataIndex: 'modelCode',
  70. },
  71. {
  72. title: '模型名称',
  73. dataIndex: 'modelName',
  74. scopedSlots: { customRender: 'islink' },
  75. },
  76. {
  77. title: '风险描述',
  78. dataIndex: 'rick',
  79. },
  80. {
  81. title: 'id',
  82. dataIndex: 'id',
  83. sdHidden: true,
  84. },
  85. ]
  86. export default {
  87. name: 'AuditSelectMaintain',
  88. metaInfo: {
  89. title: '审计模型选择器',
  90. },
  91. components: {
  92. ...components,
  93. auditAdvancedQuery,
  94. },
  95. mixins: [auditAdvancedQueryMixins],
  96. props: {
  97. // 弹出窗标题
  98. title: {
  99. type: String,
  100. default: '审计模型选择器',
  101. },
  102. // 弹出窗宽度
  103. modalWidth: {
  104. type: String,
  105. default: '1200px',
  106. },
  107. // 弹出窗显示参数
  108. visible: {
  109. type: Boolean,
  110. default: false,
  111. },
  112. },
  113. data() {
  114. return {
  115. bodyStyle: {
  116. minHeight: '700px',
  117. },
  118. // 列表展示用
  119. columns,
  120. // 高级搜索
  121. searchform: 'searchform',
  122. expand: false,
  123. // 列表展示过滤条件
  124. filterExpressions: [],
  125. formData: {
  126. modelCode: '',
  127. modelName: '',
  128. },
  129. period: [],
  130. }
  131. },
  132. methods: {
  133. processRes(data) {
  134. let index = 0
  135. data.data.forEach((item) => {
  136. item.id = this.$refs.SJMXDataTable.localPagination.current + '-' + index
  137. index++
  138. })
  139. return data
  140. },
  141. handleOk(e) {
  142. const rowKeys = this.$refs.SJMXDataTable.getSelectedRowKeys()
  143. if (rowKeys.length > 1) {
  144. return message.warning('最多可选一个模型')
  145. }
  146. this.$parent.visible = !this.$parent.visible
  147. this.$parent.visibleY = !this.$parent.visibleY
  148. // 列表选择事件,返回选择的数据
  149. this.$emit(
  150. 'listMxSelected',
  151. this.$refs.SJMXDataTable.getSelectedRowKeys(),
  152. this.$refs.SJMXDataTable.getSelectedRows()
  153. )
  154. },
  155. handleCancel(e) {
  156. this.$parent.visible = !this.$parent.visible
  157. this.$parent.visibleY = !this.$parent.visibleY
  158. },
  159. // 翻页操作
  160. onChange(pagination, filters, sorter) {
  161. this.pageSize = pagination.pageSize
  162. this.startPosition = (pagination.current - 1) * pagination.pageSize
  163. },
  164. // 开启关闭
  165. searchedClick() {
  166. this.expand = false
  167. },
  168. handleSearch() {
  169. const formData = this.formData
  170. // 获取当前表格过滤条件
  171. this.filterExpressions = []
  172. // 获取高级搜索的数据
  173. // 开始修改
  174. if (formData !== null) {
  175. // 模型编号
  176. if (this.formData.modelCode) {
  177. this.filterExpressions.push({
  178. dataType: 'str',
  179. name: 'modelCode',
  180. op: 'like',
  181. stringValue: `${this.formData.modelCode}`,
  182. })
  183. }
  184. // 模型名称
  185. if (this.formData.modelName) {
  186. this.filterExpressions.push({
  187. dataType: 'str',
  188. name: 'modelName',
  189. op: 'like',
  190. stringValue: `${this.formData.modelName}`,
  191. })
  192. }
  193. }
  194. },
  195. },
  196. }
  197. </script>
  198. <style module lang="scss">
  199. @use '@/common/design' as *;
  200. :global(.modalselectmaintain) {
  201. :global(.ant-modal-body) {
  202. overflow-x: hidden;
  203. }
  204. }
  205. </style>