修改状态流程

This commit is contained in:
yulixing 2019-08-05 15:09:28 +08:00
parent f6fde6c070
commit dd8e50744f
3 changed files with 64 additions and 4 deletions

View File

@ -209,8 +209,9 @@
<el-button
type="primary"
@click="submit('adForm')"
v-if="writeable"
>提交</el-button>
<el-button @click="resetForm('adForm')">重置</el-button>
<el-button @click="resetForm('adForm')" v-if="writeable">重置</el-button>
<el-button @click="goBack">返回</el-button>
</el-form-item>
</el-form>
@ -237,7 +238,7 @@ export default {
return {
//common
writeable: true,
writeable: false,
companyid: 0,
allGame: [],
gameList: [],
@ -295,6 +296,10 @@ export default {
this.modeList = modeList
this.typeList = typeList
const areaListRes = await this.getAdAreaList()
areaListRes.adAreaList.map(item => {
this.areaList[item.area_id] = item.name
@ -349,6 +354,11 @@ export default {
this.adForm.gameid = this.gameList[0] ? this.gameList[0].game_id : ''
this.changeGame()
}
// 广
this.writeable = (this.adForm.status === 2 || !hasAd) ? true : false
},
methods: {
// common

View File

@ -36,6 +36,10 @@
label="暂停"
:value="3"
/>
<el-option
label="已删除"
:value="4"
/>
</el-select>
</el-form-item>
<el-form-item>
@ -151,6 +155,11 @@
type="info"
v-if="scope.row.status === 3"
>暂停</el-tag>
<el-tag
type="info"
effect="plain"
v-if="scope.row.status === 4"
>已删除</el-tag>
</template>
</el-table-column>
<el-table-column
@ -167,6 +176,13 @@
<el-button
type="text"
size="small"
@click.stop="stop(scope.row)"
v-if="scope.row.status === 1"
>暂停</el-button>
<el-button
type="text"
size="small"
v-if="scope.row.status !== 4"
@click.stop="del(scope.row)"
>删除</el-button>
</template>
@ -336,6 +352,7 @@ export default {
})
})
},
resetForm(formName) {
this.$refs[formName].resetFields()
},
@ -436,6 +453,29 @@ export default {
this.$message.info('操作已取消!')
})
},
stop(row) {
this.$confirm(`是否暂停广告:【${row.name}】?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async () => {
const data = JSON.parse(JSON.stringify(row))
data.status = 3
data.begin_time = this.formDate(null, null, data.begin_time)
data.end_time = this.formDate(null, null, data.end_time)
try {
const result = await this.updateAd(data)
this.$message.success('状态修改成功!')
this.refreshData()
} catch (err) {
console.log(err)
}
})
.catch(() => {
this.$message.info('操作已取消!')
})
},
// pagination
sizeChange(val) {
this.pageSize = val

View File

@ -35,6 +35,10 @@
label="暂停"
:value="3"
/>
<el-option
label="已删除"
:value="4"
/>
</el-select>
</el-form-item>
<el-form-item>
@ -162,6 +166,11 @@
type="info"
v-if="scope.row.status === 3"
>暂停</el-tag>
<el-tag
type="info"
effect="plain"
v-if="scope.row.status === 4"
>已删除</el-tag>
</template>
</el-table-column>
<el-table-column
@ -185,18 +194,19 @@
<el-button
type="text"
size="small"
v-if="scope.row.status === 0 || scope.row.status === 3"
v-if="scope.row.status === 0"
@click.stop="refuse(scope.row)"
>拒绝</el-button>
<el-button
type="text"
size="small"
@click.stop="stop(scope.row)"
v-if="scope.row.status === 0 || scope.row.status === 1"
v-if="scope.row.status === 1"
>暂停</el-button>
<el-button
type="text"
size="small"
v-if="scope.row.status !== 4"
@click.stop="del(scope.row)"
>删除</el-button>
</template>