优化提示 增加批量发布

This commit is contained in:
yulixing 2019-07-03 13:44:17 +08:00
parent 88bf44704b
commit 11c13e5e2d
7 changed files with 130 additions and 32 deletions

View File

@ -189,13 +189,13 @@
type="success" type="success"
@click="addAC" @click="addAC"
v-if="permEdit" v-if="permEdit"
>新增成就</el-button> >新增</el-button>
<el-button <el-button
class="mgt-20" class="mgt-20"
type="primary" type="primary"
@click="saveAllAC" @click="saveAllAC"
v-if="permEdit" v-if="permEdit"
>保存全部</el-button> >保存</el-button>
<el-button <el-button
class="mgt-20" class="mgt-20"
type="warning" type="warning"

View File

@ -156,13 +156,13 @@
type="success" type="success"
@click="addIV" @click="addIV"
v-if="permEdit" v-if="permEdit"
>新增配置</el-button> >新增</el-button>
<el-button <el-button
class="mgt-20" class="mgt-20"
type="primary" type="primary"
@click="saveAllIV" @click="saveAllIV"
v-if="permEdit" v-if="permEdit"
>保存全部</el-button> >保存</el-button>
<el-button <el-button
class="mgt-20" class="mgt-20"
type="warning" type="warning"

View File

@ -7,11 +7,13 @@
description="进行【平台切换】、【删除推荐】、【调整排序】等操作时,请注意保存!" description="进行【平台切换】、【删除推荐】、【调整排序】等操作时,请注意保存!"
class="mgb-20" class="mgb-20"
show-icon show-icon
effect="dark"
/> />
<el-alert <el-alert
:title="alertText" title="当前数据为【正式】数据!"
class="mgt-20 mgb-20"
type="warning" type="warning"
class="mgt-20 mgb-20"
effect="dark"
/> />
<el-select <el-select
v-model="platform_id" v-model="platform_id"
@ -147,19 +149,19 @@
type="success" type="success"
@click="addRC" @click="addRC"
v-if="permEdit" v-if="permEdit"
>新增推荐</el-button> >新增</el-button>
<el-button <el-button
class="mgt-20" class="mgt-20"
type="primary" type="primary"
v-if="permEdit" v-if="permEdit"
@click="saveRCList" @click="saveRCList"
>保存全部</el-button> >保存</el-button>
<el-button <el-button
class="mgt-20" class="mgt-20"
type="warning" type="warning"
v-if="permEdit" v-if="permEdit"
@click="publishRCList" @click="publishRCList"
>发布推荐</el-button> >发布</el-button>
<el-button <el-button
class="mgt-20" class="mgt-20"
v-if="permEdit" v-if="permEdit"
@ -216,7 +218,9 @@ export default {
watch: { watch: {
isDev: { isDev: {
handler: function(nVal) { handler: function(nVal) {
this.alertText = nVal ? '当前数据为【测试】数据!' : '当前数据为【正式】数据!' this.alertText = nVal
? '当前数据为【测试】数据!'
: '当前数据为【正式】数据!'
}, },
immediate: true immediate: true
} }
@ -490,7 +494,6 @@ export default {
}, },
getProData() { getProData() {
this.isDev = !this.isDev this.isDev = !this.isDev
this.switchText = this.isDev ? '获取正式数据' : '获取测试数据' this.switchText = this.isDev ? '获取正式数据' : '获取测试数据'
this.getGameInfo() this.getGameInfo()

View File

@ -12,8 +12,13 @@
>新增</el-button> >新增</el-button>
<el-button <el-button
@click="switchData" @click="switchData"
type="warning" type="success"
>{{ switchText }}</el-button> >{{ switchText }}</el-button>
<el-button
v-if="batch.show && ((isDev && permEdit) || (!isDev && permPublish))"
type="warning"
@click="batchPublish"
>批量发布</el-button>
<el-button <el-button
v-if="batch.show && ((isDev && permEdit) || (!isDev && permPublish))" v-if="batch.show && ((isDev && permEdit) || (!isDev && permPublish))"
type="success" type="success"
@ -30,7 +35,6 @@
@click="batchDel" @click="batchDel"
>批量删除</el-button> >批量删除</el-button>
<el-button @click="batchOpt"> {{ batch.txt }} </el-button> <el-button @click="batchOpt"> {{ batch.txt }} </el-button>
</div> </div>
<div class="r fr"> <div class="r fr">
<el-button <el-button
@ -41,9 +45,11 @@
</div> </div>
<!-- table --> <!-- table -->
<el-alert <el-alert
:title="alertText" title="当前数据为【正式】数据!"
type="warning" type="warning"
class="mgt-20 mgb-20" class="mgt-20 mgb-20"
effect="dark"
v-if="!isDev"
/> />
<el-table <el-table
:data="tableData" :data="tableData"
@ -299,7 +305,6 @@ export default {
isNew: false, isNew: false,
isNewItem: false, isNewItem: false,
isDev: true, isDev: true,
alertText: '当前显示【测试】数据!',
// toolbar // toolbar
batch: { batch: {
show: false, show: false,
@ -446,9 +451,6 @@ export default {
this.isDev this.isDev
? (this.switchText = '获取正式数据') ? (this.switchText = '获取正式数据')
: (this.switchText = '获取测试数据') : (this.switchText = '获取测试数据')
this.isDev
? (this.alertText = '当前展示数据为【测试】数据!')
: (this.alertText = '当前展示数据为【正式】数据!')
this.currentPage = 1 this.currentPage = 1
this.getRewards() this.getRewards()
}, },
@ -472,7 +474,8 @@ export default {
this.saveReward(this.modalForm) this.saveReward(this.modalForm)
.then(data => { .then(data => {
this.$message.success('保存成功!') this.$message.success('保存成功!')
this.switchData() this.isDev = true
this.getRewards()
this.closeModal() this.closeModal()
}) })
.catch(err => { .catch(err => {
@ -698,6 +701,46 @@ export default {
this.$message.info('已取消删除!') this.$message.info('已取消删除!')
}) })
}, },
batchPublish() {
this.$confirm(
`是否发布所选${this.multipleSelection.length}条奖励?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
)
.then(() => {
const submitArr = []
this.multipleSelection.map(row => {
const devData = JSON.parse(JSON.stringify(row))
const proData = JSON.parse(JSON.stringify(row))
devData.isDev = true
devData.published = true
proData.isDev = false
proData.published = true
submitArr.push(this.saveReward(devData))
submitArr.push(this.saveReward(proData))
})
Promise.all(submitArr)
.then(() => {
this.$message.success('发布成功!')
this.getRewards()
})
.catch(err => {
console.log(err)
})
})
.catch(() => {
this.$notify.info({
title: '消息',
message: '已取消发布'
})
})
},
formKeys(row, column, cellValue, index) { formKeys(row, column, cellValue, index) {
return cellValue.join('') return cellValue.join('')
}, },

View File

@ -79,17 +79,17 @@
<el-form-item> <el-form-item>
<el-button <el-button
v-if="permEdit && this.platform_id" v-if="permEdit && this.platform_id"
type="warning" type="primary"
@click="save" @click="save"
>保存</el-button >保存</el-button
> >
<el-button <el-button
v-if="permPublish && this.platform_id" v-if="permPublish && this.platform_id"
type="primary" type="warning"
@click="publish" @click="publish"
>发布</el-button >发布</el-button
> >
<el-button v-if="permEdit && this.platform_id" @click="reset" <el-button v-if="permEdit && this.platform_id" @click="reset" type="success"
>重置</el-button >重置</el-button
> >
</el-form-item> </el-form-item>

View File

@ -1,12 +1,13 @@
<template> <template>
<div class="main-content p-game-share-add"> <div class="main-content p-game-share-add">
<el-alert <el-alert
:title="alertText" title="当前数据为【正式】数据!"
type="warning" type="warning"
style="width: 60%"
class="mgb-20" class="mgb-20"
> effect="dark"
</el-alert> style="width: 60%"
v-if="!isDev"
/>
<el-form <el-form
ref="shareForm" ref="shareForm"
:model="shareForm" :model="shareForm"
@ -208,11 +209,11 @@
v-if="permEdit" v-if="permEdit"
type="success" type="success"
@click="restore" @click="restore"
>还原</el-button> >重置</el-button>
<el-button <el-button
v-if="permEdit" v-if="permEdit"
@click="resetForm('shareForm')" @click="resetForm('shareForm')"
>重置</el-button> >清空</el-button>
<el-button @click="goBack">返回</el-button> <el-button @click="goBack">返回</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -502,7 +503,6 @@ export default {
onlyAd: false, onlyAd: false,
curShareType: '', curShareType: '',
selectedShareType: [], selectedShareType: [],
alertText: '先保存后发布!',
// main // main
shareForm: { shareForm: {
default_share: false, default_share: false,
@ -615,7 +615,6 @@ export default {
this.getAreas() this.getAreas()
this.token = getToken() this.token = getToken()
} }
this.alertText = this.isDev ? '当前数据为【测试】数据!' : '当前数据为【正式】数据!'
this.permEdit = this.permEdit =
this.userInfo.permissions.includes(`${this.uid}-edit`) || this.userInfo.permissions.includes(`${this.uid}-edit`) ||
this.userInfo.permissions.includes(`${this.uid}-publish`) || this.userInfo.permissions.includes(`${this.uid}-publish`) ||

View File

@ -67,8 +67,13 @@
>新增</el-button> >新增</el-button>
<el-button <el-button
@click="switchData" @click="switchData"
type="warning" type="success"
>{{ switchText }}</el-button> >{{ switchText }}</el-button>
<el-button
v-if="batch.show && permPublish"
type="warning"
@click="batchPublish"
>批量发布</el-button>
<el-button <el-button
v-if="batch.show && permEdit" v-if="batch.show && permEdit"
type="danger" type="danger"
@ -88,6 +93,13 @@
</div> </div>
</div> </div>
<!-- table --> <!-- table -->
<el-alert
title="当前数据为【正式】数据!"
v-if="!isDev"
type="warning"
class="mgt-20 mgb-20 w100"
effect="dark"
/>
<el-table <el-table
v-loading="isLoaded" v-loading="isLoaded"
:data="tableData" :data="tableData"
@ -358,6 +370,46 @@ export default {
}) })
}) })
}, },
batchPublish() {
this.$confirm(
`是否发布所选${this.multipleSelection.length}条分享图?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
)
.then(() => {
const submitArr = []
this.multipleSelection.map(row => {
const devData = JSON.parse(JSON.stringify(row))
const proData = JSON.parse(JSON.stringify(row))
devData.isDev = true
devData.published = true
proData.isDev = false
proData.published = true
submitArr.push(this.saveShare(devData))
submitArr.push(this.saveShare(proData))
})
Promise.all(submitArr)
.then(() => {
this.$message.success('分享图发布成功!')
this.getData()
})
.catch(err => {
console.log(err)
})
})
.catch(() => {
this.$notify.info({
title: '消息',
message: '已取消发布'
})
})
},
batchOpt() { batchOpt() {
this.batch.show = !this.batch.show this.batch.show = !this.batch.show
this.batch.txt = this.batch.show ? '关闭' : '批量操作' this.batch.txt = this.batch.show ? '关闭' : '批量操作'
@ -482,6 +534,7 @@ export default {
Promise.all(submitArr) Promise.all(submitArr)
.then(() => { .then(() => {
this.$message.success('分享图发布成功!') this.$message.success('分享图发布成功!')
this.getData()
}) })
.catch(err => { .catch(err => {
console.log(err) console.log(err)