audit-class-index-table.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. <!-- 列表 -->
  14. <SdTable
  15. ref="SJMXDataTable"
  16. :row-key="(record, index) => index"
  17. :columns="columns"
  18. :data-source="dataList"
  19. :pagination="false"
  20. :row-selection="{
  21. getCheckboxProps() {
  22. return {}
  23. },
  24. selectedRowKeys: selectedRowKeys,
  25. onChange: onSelectChange,
  26. }"
  27. >
  28. <template slot="type" slot-scope="text, record">
  29. <span v-if="record.type === 0 || record.type === '0'">非结构化</span>
  30. <span v-else>结构化</span>
  31. </template>
  32. </SdTable>
  33. </a-modal>
  34. </div>
  35. </template>
  36. <script>
  37. import SdTable from '@/common/components/sd-table.vue'
  38. import { message } from 'ant-design-vue'
  39. import DataService from './data-config'
  40. export default {
  41. name: 'AuditClassIndexTable',
  42. metaInfo: {
  43. title: '数据索引选择器',
  44. },
  45. components: {
  46. SdTable,
  47. },
  48. props: {
  49. // 弹出窗标题
  50. title: {
  51. type: String,
  52. default: '审搜索引选择器',
  53. },
  54. // 弹出窗宽度
  55. modalWidth: {
  56. type: String,
  57. default: '1200px',
  58. },
  59. // 弹出窗显示参数
  60. visible: {
  61. type: Boolean,
  62. default: false,
  63. },
  64. classData: {
  65. type: Array,
  66. default: () => [],
  67. },
  68. },
  69. data() {
  70. return {
  71. selectedRowKeys: [],
  72. selectedRows: [],
  73. dataUrl: 'api/xcoa-mobile/v1/iamsearchindex/getByCategoryIds',
  74. dataList: [],
  75. bodyStyle: {
  76. minHeight: '700px',
  77. },
  78. // 列表展示用
  79. columns: [
  80. {
  81. title: '业务编号',
  82. dataIndex: 'id',
  83. },
  84. {
  85. title: '索引名',
  86. dataIndex: 'indexName',
  87. },
  88. {
  89. title: '索引说明',
  90. dataIndex: 'indexRemark',
  91. },
  92. {
  93. title: '系统名称',
  94. dataIndex: 'systemName',
  95. },
  96. {
  97. title: '系统来源名称',
  98. dataIndex: 'indexSource',
  99. },
  100. {
  101. title: '索引类型',
  102. dataIndex: 'type',
  103. scopedSlots: { customRender: 'type' },
  104. },
  105. {
  106. title: '归属分类名称',
  107. dataIndex: 'categoryName',
  108. },
  109. // 分类id
  110. {
  111. dataIndex: 'categoryId',
  112. sdHidden: true,
  113. },
  114. ],
  115. // 高级搜索
  116. searchform: 'searchform',
  117. expand: false,
  118. period: [],
  119. allClassCodes: '',
  120. }
  121. },
  122. watch: {
  123. classData: {
  124. handler(val) {
  125. this.allClassCodes = val.map((item) => item.categoryId).join(',')
  126. this.getList()
  127. },
  128. deep: true,
  129. },
  130. },
  131. methods: {
  132. onSelectChange(selectedRowKeys, selectedRows) {
  133. this.selectedRowKeys = selectedRowKeys
  134. this.selectedRows = selectedRows
  135. },
  136. processRes(data) {
  137. let index = 0
  138. data.data.forEach((item) => {
  139. item.id = this.$refs.SJMXDataTable.localPagination.current + '-' + index
  140. index++
  141. })
  142. return data
  143. },
  144. getList() {
  145. DataService.findIndexListDatas(this.allClassCodes).then((res) => {
  146. this.dataList = res.data
  147. })
  148. },
  149. handleOk(e) {
  150. this.$parent.visible = !this.$parent.visible
  151. this.$parent.indexTableShow = !this.$parent.indexTableShow
  152. // 列表选择事件,返回选择的数据
  153. this.$emit('listMxSelected', this.selectedRowKeys, this.selectedRows)
  154. },
  155. handleCancel(e) {
  156. this.$parent.visible = !this.$parent.visible
  157. this.$parent.indexTableShow = !this.$parent.indexTableShow
  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. if (this.formData.categoryId) {
  176. this.filterExpressions.push({
  177. dataType: 'str',
  178. name: 'categoryId',
  179. op: 'like',
  180. stringValue: `${this.formData.categoryId}`,
  181. })
  182. }
  183. }
  184. },
  185. },
  186. }
  187. </script>
  188. <style module lang="scss">
  189. @use '@/common/design' as *;
  190. :global(.modalselectmaintain) {
  191. :global(.ant-modal-body) {
  192. overflow-x: hidden;
  193. }
  194. }
  195. </style>