IndustryList.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline">
  6. <a-row :gutter="24">
  7. <a-col :md="6" :sm="8">
  8. <a-form-item label="父ID">
  9. <a-input placeholder="请输入父ID" v-model="queryParam.parentId"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="8">
  13. <a-form-item label="行业名称">
  14. <a-input placeholder="请输入行业名称" v-model="queryParam.name"></a-input>
  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. <a @click="handleToggleSearch" style="margin-left: 8px">
  22. {{ toggleSearchStatus ? '收起' : '展开' }}
  23. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  24. </a>
  25. </span>
  26. </a-col>
  27. </a-row>
  28. </a-form>
  29. </div>
  30. <!-- 操作按钮区域 -->
  31. <div class="table-operator">
  32. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  33. <a-button type="primary" icon="download" @click="handleExportXls('行业表')">导出</a-button>
  34. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
  35. @change="handleImportExcel">
  36. <a-button type="primary" icon="import">导入</a-button>
  37. </a-upload>
  38. <a-dropdown v-if="selectedRowKeys.length > 0">
  39. <a-menu slot="overlay">
  40. <a-menu-item key="1" @click="batchDel">
  41. <a-icon type="delete"/>
  42. 删除
  43. </a-menu-item>
  44. </a-menu>
  45. <a-button style="margin-left: 8px"> 批量操作
  46. <a-icon type="down"/>
  47. </a-button>
  48. </a-dropdown>
  49. </div>
  50. <!-- table区域-begin -->
  51. <div>
  52. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  53. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
  54. selectedRowKeys.length }}</a>项
  55. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  56. </div>
  57. <a-table
  58. size="middle"
  59. :columns="columns"
  60. :dataSource="dataSource"
  61. :pagination="false"
  62. :loading="loading"
  63. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}">
  64. <span slot="action" slot-scope="text, record">
  65. <a @click="handleEdit(record)">编辑</a>
  66. <a-divider type="vertical"/>
  67. <a-dropdown>
  68. <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
  69. <a-menu slot="overlay">
  70. <a-menu-item>
  71. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  72. <a>删除</a>
  73. </a-popconfirm>
  74. </a-menu-item>
  75. </a-menu>
  76. </a-dropdown>
  77. </span>
  78. </a-table>
  79. </div>
  80. <!-- table区域-end -->
  81. <!-- 表单区域 -->
  82. <industry-modal ref="modalForm" @ok="modalFormOk"></industry-modal>
  83. </a-card>
  84. </template>
  85. <script>
  86. import IndustryModal from './modules/IndustryModal'
  87. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  88. import {getIndustryList} from '@/api/api'
  89. import JEllipsis from '@/components/jeecg/JEllipsis'
  90. export default {
  91. name: "IndustryList",
  92. mixins: [JeecgListMixin],
  93. components: {
  94. IndustryModal,
  95. JEllipsis
  96. },
  97. data() {
  98. return {
  99. description: '行业表管理页面',
  100. // 表头
  101. columns: [
  102. {
  103. title: '行业名称',
  104. align: "center",
  105. dataIndex: 'name',
  106. key: 'name'
  107. },
  108. {
  109. title: '操作',
  110. dataIndex: 'action',
  111. align: "center",
  112. scopedSlots: {customRender: 'action'},
  113. }
  114. ],
  115. url: {
  116. list: "/industry/industry/list",
  117. delete: "/industry/industry/delete",
  118. deleteBatch: "/industry/industry/deleteBatch",
  119. exportXlsUrl: "industry/industry/exportXls",
  120. importExcelUrl: "industry/industry/importExcel",
  121. },
  122. }
  123. },
  124. computed: {
  125. importExcelUrl: function () {
  126. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  127. }
  128. },
  129. methods: {
  130. loadData() {
  131. this.dataSource = []
  132. getIndustryList().then((res) => {
  133. if (res.success) {
  134. console.log(res.result)
  135. //this.dataSource = res.result
  136. for (let a = 0; a < res.result.length; a++) {
  137. let temp = res.result[a];
  138. this.dataSource.push(temp);
  139. }
  140. }
  141. })
  142. }
  143. }
  144. }
  145. </script>
  146. <style scoped>
  147. @import '~@assets/less/common.less'
  148. </style>