|
@@ -13,6 +13,21 @@
|
|
|
bordered>
|
|
|
<!-- 广告图位置 -->
|
|
|
<span slot="position" slot-scope="text">{{ $refs.position.getNameByCode(text) }}</span>
|
|
|
+ <!-- 操作 -->
|
|
|
+ <template slot="sort" slot-scope="text, record, index">
|
|
|
+ <a-icon
|
|
|
+ title="下移"
|
|
|
+ v-if="index != list.length-1"
|
|
|
+ :style="{ fontSize: '18px', color: '#e29b29', cursor: 'pointer',padding:'0 10px' }"
|
|
|
+ @click="changeSort(index,record,0)"
|
|
|
+ type="arrow-down" />
|
|
|
+ <a-icon
|
|
|
+ title="上移"
|
|
|
+ v-if="index != 0"
|
|
|
+ :style="{ fontSize: '18px', color: '#e29b29',cursor: 'pointer', padding:'0 10px' }"
|
|
|
+ @click="changeSort(index,record,1)"
|
|
|
+ type="arrow-up" />
|
|
|
+ </template>
|
|
|
<span slot="action" slot-scope="text, record">
|
|
|
<a-icon
|
|
|
type="eye"
|
|
@@ -92,17 +107,6 @@
|
|
|
allowClear
|
|
|
/>
|
|
|
</a-form-item>
|
|
|
- <a-form-item label="排序" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
|
|
|
- <a-input
|
|
|
- type="number"
|
|
|
- oninput="if(value.length>6)value=value.slice(0,6);if(value<0)value=0"
|
|
|
- v-decorator="['formData.sort', { initialValue: formData.sort,getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入(0~999999)之间的序号值!' }] }]"
|
|
|
- :disabled="disabled"
|
|
|
- id="bannerSetting-sort"
|
|
|
- placeholder="请输入(0~999999)之间的序号值"
|
|
|
- allowClear
|
|
|
- />
|
|
|
- </a-form-item>
|
|
|
<a-form-item label="状态" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
|
|
|
<a-radio-group
|
|
|
:disabled="disabled"
|
|
@@ -144,7 +148,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { Upload, STable, VSelect } from '@/components'
|
|
|
-import { getBannerSettingList, changeStatus, deleteItem, saveItem } from '@/api/bannerSetting.js'
|
|
|
+import { getadvertSettingList, changeStatus, changeSort, deleteItem, saveItem } from '@/api/bannerSetting.js'
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
@@ -181,7 +185,10 @@ export default {
|
|
|
title: '排序',
|
|
|
width: 100,
|
|
|
dataIndex: 'sort',
|
|
|
- align: 'center'
|
|
|
+ align: 'center',
|
|
|
+ scopedSlots: {
|
|
|
+ customRender: 'sort'
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '跳转链接',
|
|
@@ -212,13 +219,13 @@ export default {
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
- return getBannerSettingList().then(res => {
|
|
|
- console.log(res, '1111')
|
|
|
+ return getadvertSettingList(parameter).then(res => {
|
|
|
const no = 0
|
|
|
for (let i = 0; i < res.data.length; i++) {
|
|
|
const _item = res.data[i]
|
|
|
_item.no = no + i + 1
|
|
|
}
|
|
|
+ this.list = res.data
|
|
|
return res.data
|
|
|
})
|
|
|
},
|
|
@@ -240,7 +247,6 @@ export default {
|
|
|
formData: {
|
|
|
title: '', // 标题
|
|
|
status: '', // 状态
|
|
|
- sort: '', // 排序
|
|
|
type: '', // 广告图位置
|
|
|
image: '', // banner地址
|
|
|
createDate: ''
|
|
@@ -249,7 +255,8 @@ export default {
|
|
|
disabled: false,
|
|
|
value: '',
|
|
|
id: '',
|
|
|
- isShow: true
|
|
|
+ isShow: true,
|
|
|
+ list: []
|
|
|
}
|
|
|
},
|
|
|
beforeCreate () {
|
|
@@ -294,7 +301,6 @@ export default {
|
|
|
this.formData.title = ''
|
|
|
this.formData.jumpUrl = ''
|
|
|
this.formData.state = ''
|
|
|
- this.formData.sort = ''
|
|
|
this.formData.type = ''
|
|
|
this.formData.image = ''
|
|
|
this.title = '新增'
|
|
@@ -308,7 +314,6 @@ export default {
|
|
|
this.formData.image = row.image
|
|
|
this.formData.jumpUrl = row.jumpUrl
|
|
|
this.formData.state = row.state
|
|
|
- this.formData.sort = row.sort
|
|
|
this.formData.type = row.type
|
|
|
this.formData.createDate = row.createDate
|
|
|
},
|
|
@@ -365,6 +370,21 @@ export default {
|
|
|
record.status = !record.status
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ // 上移 下移 排序 index:下标 item:数据 type:类型 0 下移 1 上移
|
|
|
+ changeSort (index, item, type) {
|
|
|
+ const indexThat = type === 0 ? index + 1 : index - 1
|
|
|
+ const params = {
|
|
|
+ id: item.id,
|
|
|
+ sortId: this.list[indexThat].id
|
|
|
+ }
|
|
|
+ changeSort(params).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$refs.table.refresh()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|