list.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <el-row style="padding-top: 50px;padding-left: 40px">
  3. <el-row style="margin-top: 20px">
  4. <white-board style="margin-right: 50px;padding: 0px 0px 0px 0px;height: 714px;border-radius: 6px;">
  5. <el-row style="line-height: 40px;padding-top: 20px">
  6. <el-col :span="4">
  7. <el-select v-model="bannerData[0].value" placeholder="请选择" @change="moveDirection">
  8. <el-option
  9. v-for="item in options"
  10. :key="item.value"
  11. :label="item.label"
  12. :value="item.value">
  13. </el-option>
  14. </el-select>
  15. </el-col>
  16. <el-col :span="1" >
  17. <span style="font-weight: bold">间隔</span>
  18. </el-col>
  19. <el-col :span="1">
  20. <el-input v-model.trim="bannerData[1].value"></el-input>
  21. </el-col>
  22. <el-col :span="1">
  23. <span style="font-weight: bold">秒</span>
  24. </el-col>
  25. <el-col :span="1">
  26. <el-button type="primary" @click="changeSpace">确认</el-button>
  27. </el-col>
  28. <el-col :span="1" :offset="13">
  29. <el-button type="primary" @click="toEdit">新建</el-button>
  30. </el-col>
  31. <el-col :span="2">
  32. <el-button type="primary" @click="handleDel">删除选中</el-button>
  33. </el-col>
  34. </el-row>
  35. <el-row style="padding-top: 20px;padding-left: 3px">
  36. <el-table :data="tableData" row-key="id" ref="table" style="width: 100%;" @selection-change="handleSelectionChange" highlight-current-row stripe>
  37. <el-table-column type="selection" width="55" align="center"></el-table-column>
  38. <el-table-column prop="seqencing" label="序号" width="100" align="center"></el-table-column>
  39. <el-table-column prop="bannerTitle" width="300" label="标题" align="center" show-overflow-tooltip></el-table-column>
  40. <el-table-column label="缩略图" width="200" align="center">
  41. <template slot-scope="scope">
  42. <div style="height: 88px"><img :src="OSS_URL + scope.row.imageUrl" v-if="scope.row.imageUrl" style="height: 88px;width: 147px;"></div>
  43. </template>
  44. </el-table-column>
  45. <el-table-column prop="bannerUrl" width="230" label="网址" show-overflow-tooltip></el-table-column>
  46. <el-table-column prop="id" label="Banner顺序" width="200">
  47. <template slot-scope="scope">
  48. <el-col :span="6">
  49. <el-row><el-button type="primary" @click="forward(scope.row)">前移</el-button></el-row>
  50. <el-row style="margin-top: 3px"><el-button type="primary" @click="backward(scope.row)">后移</el-button></el-row>
  51. </el-col>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="是否启用" width="150" align="center">
  55. <template slot-scope="scope">
  56. <el-radio-group v-model="scope.row.bannerOn" style="text-align: left;">
  57. <el-row>
  58. <el-radio :label="1" @change="changeBannerOn(scope.row)">是</el-radio>
  59. </el-row>
  60. <el-row>
  61. <el-radio :label="0" style="margin-top: 15px" @change="changeBannerOn(scope.row)">否</el-radio>
  62. </el-row>
  63. </el-radio-group>
  64. </template>
  65. </el-table-column>
  66. <el-table-column prop="gmtCreated" label="创建日期" width="200" align="center"></el-table-column>
  67. <el-table-column width="150" align="center">
  68. <template slot-scope="scope">
  69. <el-button type="text" style="color: red" plain @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
  70. </template>
  71. </el-table-column>
  72. </el-table>
  73. </el-row>
  74. <el-row style="padding-top: 20px;padding-bottom: 20px">
  75. <el-pagination @size-change="changeSizeChange" @current-change="changeCurrentChange" :current-page="searchForm.page" :page-sizes="[10, 20, 50, 100]" :page-size="10" layout="sizes, prev, pager, next, jumper, total" :total="total" small></el-pagination>
  76. </el-row>
  77. </white-board>
  78. </el-row>
  79. </el-row>
  80. </template>
  81. <script>
  82. import bannerDetailApi from '@/api/bannerDetailApi'
  83. import bannerControlApi from '@/api/bannerControlApi'
  84. export default {
  85. name: 'bannerDetails',
  86. components: {
  87. },
  88. data () {
  89. return {
  90. searchForm: {
  91. searchKey: '',
  92. page: 1,
  93. size: 10
  94. },
  95. total: 0,
  96. bannerData: [{code: 'move', value: '0'}, {code: 'space', value: 3}],
  97. tableData: [],
  98. options: [{
  99. value: '0',
  100. label: '从左到右切换'
  101. }, {
  102. value: '1',
  103. label: '从上到下切换'
  104. }],
  105. temp: [],
  106. IdList: []
  107. }
  108. },
  109. mounted () {
  110. this.list()
  111. },
  112. methods: {
  113. handleDel () {
  114. this.$confirm('是否删除', '提示', {
  115. confirmButtonText: '确定',
  116. cancelButtonText: '取消',
  117. type: 'warning'
  118. }).then(() => {
  119. this.IdList = []
  120. for (let i = 0; i < this.temp.length; i++) {
  121. this.IdList.push(this.temp[i].id)
  122. }
  123. bannerDetailApi.delete({idList: this.IdList}).then(data => {
  124. this.list()
  125. })
  126. }).catch(() => {
  127. this.$message({type: 'info', message: '已取消删除'})
  128. })
  129. },
  130. toEdit () {
  131. this.$router.push({name: 'BannerEdit'})
  132. },
  133. handleEdit (index, row) {
  134. this.$router.push({name: 'BannerEdit', params: {key: 'bannerId', msgKey: row.id}})
  135. },
  136. handleSelectionChange (val) {
  137. this.temp = val
  138. },
  139. list () {
  140. this.tableData = []
  141. bannerDetailApi.page(this.searchForm).then(data => {
  142. this.total = data.totalCount
  143. this.tableData = data.list
  144. })
  145. bannerControlApi.findAll().then(data => {
  146. this.bannerData = data
  147. })
  148. },
  149. changeSizeChange (val) {
  150. this.searchForm.size = val
  151. this.list()
  152. },
  153. changeCurrentChange (val) {
  154. this.searchForm.page = val
  155. this.list()
  156. },
  157. forward (row) {
  158. bannerDetailApi.forward(row.id).then(data => {
  159. this.list()
  160. })
  161. },
  162. backward (row) {
  163. bannerDetailApi.backward(row.id).then(data => {
  164. this.list()
  165. })
  166. },
  167. changeBannerOn (row) {
  168. bannerDetailApi.changeBannerOn(row.id).then(data => {
  169. this.list()
  170. })
  171. },
  172. changeSpace () {
  173. bannerControlApi.ChangeSpace(this.bannerData[1].value).then(data => {
  174. this.list()
  175. })
  176. },
  177. moveDirection () {
  178. bannerControlApi.moveDirection().then(data => {
  179. this.list()
  180. })
  181. }
  182. }
  183. }
  184. </script>
  185. <style scoped>
  186. .el-radio {
  187. margin-right: 0px;
  188. }
  189. /deep/ .el-table th>.cell{
  190. font-family: MicrosoftYaHei-Bold;
  191. font-size: 14px;
  192. font-weight: normal;
  193. font-stretch: normal;
  194. line-height: 42px;
  195. letter-spacing: 0px;
  196. color: #333333;
  197. }
  198. /deep/ .el-table__row el-table__row--striped {
  199. font-family: MicrosoftYaHei;
  200. font-size: 14px;
  201. font-weight: normal;
  202. font-stretch: normal;
  203. line-height: 42px;
  204. letter-spacing: 0px;
  205. color: #333333;
  206. }
  207. /deep/ .el-table__row {
  208. font-family: MicrosoftYaHei;
  209. font-size: 14px;
  210. font-weight: normal;
  211. font-stretch: normal;
  212. line-height: 42px;
  213. letter-spacing: 0px;
  214. color: #333333;
  215. }
  216. /deep/ .el-pagination__total {
  217. font-family: MicrosoftYaHei;
  218. font-size: 14px;
  219. font-weight: normal;
  220. font-stretch: normal;
  221. line-height: 42px;
  222. letter-spacing: 0px;
  223. color: #333333;
  224. }
  225. /deep/ .el-pagination__jump {
  226. font-family: MicrosoftYaHei;
  227. font-size: 14px;
  228. font-weight: normal;
  229. font-stretch: normal;
  230. line-height: 42px;
  231. letter-spacing: 0px;
  232. color: #333333;
  233. }
  234. /deep/ .el-button--primary {
  235. background-color: #2493e5;
  236. border-color: #2493e5;
  237. }
  238. /deep/ .el-button--mini, .el-button--mini.is-round{
  239. padding: 9px 19px;
  240. }
  241. /deep/ .el-input--mini .el-input__inner{
  242. height: 32px;
  243. }
  244. /deep/ .el-table td, .el-table th.is-leaf{
  245. border: 0px;
  246. }
  247. /deep/ .el-pagination__total{
  248. margin-left: 17px;
  249. font-family: MicrosoftYaHei;
  250. font-size: 14px;
  251. font-weight: normal;
  252. font-stretch: normal;
  253. line-height: 42px;
  254. letter-spacing: 0px;
  255. color: #333333;
  256. }
  257. /deep/ .el-pagination__jump{
  258. margin-left: 15px;
  259. font-family: MicrosoftYaHei;
  260. font-size: 14px;
  261. font-weight: normal;
  262. font-stretch: normal;
  263. line-height: 42px;
  264. letter-spacing: 0px;
  265. color: #333333;
  266. }
  267. /deep/ .el-radio__inner{
  268. width: 16px;
  269. height: 16px;
  270. }
  271. /deep/ .el-radio__inner::after{
  272. width: 8px;
  273. height: 8px;
  274. }
  275. </style>