advertList.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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-row>
  8. </a-form>
  9. </div>
  10. <!-- 查询区域-END -->
  11. <!-- 操作按钮区域 -->
  12. <div class="table-operator">
  13. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  14. <a-dropdown v-if="selectedRowKeys.length > 0">
  15. <!-- <a-menu slot="overlay">-->
  16. <!-- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
  17. <!-- </a-menu>-->
  18. <!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>-->
  19. <a-button @click="batchDel" type="danger" icon="delete">批量删除</a-button>
  20. </a-dropdown>
  21. </div>
  22. <!-- table区域-begin -->
  23. <div>
  24. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  25. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  26. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  27. </div>
  28. <a-table
  29. ref="table"
  30. size="middle"
  31. :scroll="{x:true}"
  32. bordered
  33. rowKey="id"
  34. :columns="columns"
  35. :dataSource="dataSource"
  36. :pagination="ipagination"
  37. :loading="loading"
  38. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  39. class="j-table-force-nowrap"
  40. @change="handleTableChange">
  41. <template slot="htmlSlot" slot-scope="text">
  42. <div v-html="text"></div>
  43. </template>
  44. <template slot="logoSlot" slot-scope="text,record">
  45. <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  46. <img v-else :src="getImgView(text)" :preview="record.id" height="50px" alt="" style="max-width:100px;font-size: 12px;font-style: italic;"/>
  47. </template>
  48. <span slot="status" slot-scope="text,record">
  49. <a-tag v-if="text == 1" color="green">启用</a-tag>
  50. <a-tag v-else color="red">禁用</a-tag>
  51. </span>
  52. <span slot="type" slot-scope="text,record">
  53. <a-tag v-if="record.type > 0" color="green">{{text}}</a-tag>
  54. <!-- <a-tag v-if="text == 1" color="green">小程序首页</a-tag>-->
  55. <!-- <a-tag v-else-if="text == 2" color="green">后台登录</a-tag>-->
  56. <!-- <a-tag v-else-if="text == 3" color="green">商城首页</a-tag>-->
  57. </span>
  58. <span slot="action" slot-scope="text, record">
  59. <a-popconfirm
  60. placement="top"
  61. :title="record.status===1? '确定禁用?':'确定启用?'"
  62. @confirm="() => handleStatus(record)">
  63. <a>{{record.status == 1 ? "禁用":"启用"}}</a>
  64. </a-popconfirm>
  65. <a-divider type="vertical" />
  66. <a-dropdown>
  67. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  68. <a-menu slot="overlay">
  69. <a-menu-item>
  70. <a @click="handleEdit(record)">修改</a>
  71. </a-menu-item>
  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. <advert-modal ref="modalForm" @ok="modalFormOk"></advert-modal>
  83. </a-card>
  84. </template>
  85. <script>
  86. import '@/assets/less/TableExpand.less'
  87. import { mixinDevice } from '@/utils/mixin'
  88. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  89. import advertModal from './modules/advertModal'
  90. export default {
  91. name: 'BusAdvertList',
  92. mixins:[JeecgListMixin, mixinDevice],
  93. components: {
  94. advertModal
  95. },
  96. data () {
  97. return {
  98. description: '广告管理管理页面',
  99. // 表头
  100. columns: [
  101. {
  102. title:'轮播图标题',
  103. align:"center",
  104. dataIndex: 'title'
  105. },
  106. {
  107. title:'图片',
  108. align:"center",
  109. dataIndex: 'logo',
  110. scopedSlots: { customRender: 'logoSlot' },
  111. },
  112. {
  113. title:'状态',
  114. align:"center",
  115. dataIndex: 'status',
  116. scopedSlots: { customRender: 'status' },
  117. },
  118. {
  119. title:'广告位置',
  120. align:"center",
  121. dataIndex: 'type_dictText',
  122. // dataIndex: 'type',
  123. scopedSlots: { customRender: 'type' },
  124. },
  125. {
  126. title:'链接',
  127. align:"center",
  128. dataIndex: 'src'
  129. },
  130. {
  131. title:'排序',
  132. align:"center",
  133. dataIndex: 'orderBy'
  134. },
  135. {
  136. title: '操作',
  137. dataIndex: 'action',
  138. align:"center",
  139. fixed:"right",
  140. width:147,
  141. scopedSlots: { customRender: 'action' }
  142. }
  143. ],
  144. url: {
  145. list: "/business/busAdvert/list",
  146. delete: "/business/busAdvert/delete",
  147. deleteBatch: "/business/busAdvert/deleteBatch",
  148. exportXlsUrl: "/business/busAdvert/exportXls",
  149. importExcelUrl: "business/busAdvert/importExcel",
  150. },
  151. dictOptions:{},
  152. superFieldList:[],
  153. }
  154. },
  155. created() {
  156. this.getSuperFieldList();
  157. },
  158. computed: {
  159. importExcelUrl: function(){
  160. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  161. },
  162. },
  163. methods: {
  164. initDictConfig(){
  165. },
  166. getSuperFieldList(){
  167. let fieldList=[];
  168. fieldList.push({type:'string',value:'tenantId',text:'关联租户'})
  169. fieldList.push({type:'string',value:'hotelId',text:'关联酒店'})
  170. fieldList.push({type:'string',value:'title',text:'广告标题'})
  171. fieldList.push({type:'int',value:'type',text:'投放类型'})
  172. fieldList.push({type:'string',value:'logo',text:'广告图片'})
  173. fieldList.push({type:'string',value:'src',text:'链接'})
  174. fieldList.push({type:'int',value:'orderBy',text:'排序'})
  175. fieldList.push({type:'int',value:'status',text:'状态(0-禁用;1-启用)'})
  176. fieldList.push({type:'int',value:'delFlag',text:'删除状态(0-正常,1-已删除)'})
  177. this.superFieldList = fieldList
  178. }
  179. }
  180. }
  181. </script>
  182. <style scoped>
  183. @import '~@assets/less/common.less';
  184. </style>