audit-select-maintain.vue 5.0 KB

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