f84e4e2c807db134d4c176a00fe29a313fff0b25.svn-base 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :md="6" :sm="8">
  8. <a-form-item label="数据源名称">
  9. <a-input placeholder="请输入数据源名称" v-model="queryParam.name"/>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="8">
  13. <a-form-item label="数据库类型">
  14. <j-dict-select-tag v-model="queryParam.dbType" placeholder="请选择数据库类型" dict-code="database_type"/>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="8">
  18. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  19. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  20. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  21. </span>
  22. </a-col>
  23. </a-row>
  24. </a-form>
  25. </div>
  26. <!-- 操作按钮区域 -->
  27. <div class="table-operator">
  28. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  29. <a-button type="primary" icon="download" @click="handleExportXls('多数据源管理')">导出</a-button>
  30. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  31. <a-button type="primary" icon="import">导入</a-button>
  32. </a-upload>
  33. <a-dropdown v-if="selectedRowKeys.length > 0">
  34. <a-menu slot="overlay">
  35. <a-menu-item key="1" @click="batchDel">
  36. <a-icon type="delete"/>
  37. 删除
  38. </a-menu-item>
  39. </a-menu>
  40. <a-button style="margin-left: 8px"> 批量操作
  41. <a-icon type="down"/>
  42. </a-button>
  43. </a-dropdown>
  44. </div>
  45. <!-- table区域-begin -->
  46. <div>
  47. <a-alert type="info" showIcon style="margin-bottom: 16px;">
  48. <template slot="message">
  49. <span>已选择</span>
  50. <a style="font-weight: 600;padding: 0 4px;">{{ selectedRowKeys.length }}</a>
  51. <span>项</span>
  52. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  53. </template>
  54. </a-alert>
  55. <a-table
  56. ref="table"
  57. size="middle"
  58. bordered
  59. rowKey="id"
  60. :columns="columns"
  61. :dataSource="dataSource"
  62. :pagination="ipagination"
  63. :loading="loading"
  64. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  65. @change="handleTableChange">
  66. <span slot="action" slot-scope="text, record">
  67. <a @click="handleEdit(record)">编辑</a>
  68. <a-divider type="vertical"/>
  69. <a-dropdown>
  70. <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
  71. <a-menu slot="overlay">
  72. <a-menu-item>
  73. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  74. <a>删除</a>
  75. </a-popconfirm>
  76. </a-menu-item>
  77. </a-menu>
  78. </a-dropdown>
  79. </span>
  80. </a-table>
  81. </div>
  82. <!-- table区域-end -->
  83. <!-- 表单区域 -->
  84. <sys-data-source-modal ref="modalForm" @ok="modalFormOk"/>
  85. </a-card>
  86. </template>
  87. <script>
  88. import JEllipsis from '@/components/jeecg/JEllipsis'
  89. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  90. import SysDataSourceModal from './modules/SysDataSourceModal'
  91. export default {
  92. name: 'SysDataSourceList',
  93. mixins: [JeecgListMixin],
  94. components: { JEllipsis, SysDataSourceModal },
  95. data() {
  96. let ellipsis = (v, l = 20) => (<j-ellipsis value={v} length={l}/>)
  97. return {
  98. description: '多数据源管理管理页面',
  99. // 表头
  100. columns: [
  101. {
  102. title: '#',
  103. dataIndex: '',
  104. key: 'rowIndex',
  105. width: 60,
  106. align: 'center',
  107. customRender: (t, r, index) => index + 1
  108. },
  109. {
  110. title: '数据源名称',
  111. align: 'center',
  112. dataIndex: 'name'
  113. },
  114. {
  115. title: '数据库类型',
  116. align: 'center',
  117. dataIndex: 'dbType_dictText'
  118. },
  119. {
  120. title: '驱动类',
  121. align: 'center',
  122. dataIndex: 'dbDriver',
  123. customRender: (t) => ellipsis(t)
  124. },
  125. {
  126. title: '数据源地址',
  127. align: 'center',
  128. dataIndex: 'dbUrl',
  129. customRender: (t) => ellipsis(t)
  130. },
  131. {
  132. title: '用户名',
  133. align: 'center',
  134. dataIndex: 'dbUsername'
  135. },
  136. {
  137. title: '操作',
  138. dataIndex: 'action',
  139. align: 'center',
  140. scopedSlots: { customRender: 'action' },
  141. }
  142. ],
  143. url: {
  144. list: '/sys/dataSource/list',
  145. delete: '/sys/dataSource/delete',
  146. deleteBatch: '/sys/dataSource/deleteBatch',
  147. exportXlsUrl: 'sys/dataSource/exportXls',
  148. importExcelUrl: 'sys/dataSource/importExcel',
  149. },
  150. }
  151. },
  152. computed: {
  153. importExcelUrl() {
  154. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
  155. }
  156. },
  157. methods: {}
  158. }
  159. </script>
  160. <style scoped>
  161. @import '~@assets/less/common.less';
  162. </style>