Commit e5499a87 by xinla

客群列表状态操作问题

1 parent e0bfacb7
...@@ -28,8 +28,7 @@ ...@@ -28,8 +28,7 @@
width="55" width="55"
align="center" align="center"
fixed="left" fixed="left"
:selectable="selectable" :selectable="selectable"></el-table-column>
></el-table-column>
<el-table-column prop="fassionName" label="任务名称" align="center" width="120" fixed="left"></el-table-column> <el-table-column prop="fassionName" label="任务名称" align="center" width="120" fixed="left"></el-table-column>
<el-table-column prop="statusType" label="任务状态" align="center" width="100"> <el-table-column prop="statusType" label="任务状态" align="center" width="100">
<template #default="{ row }"> <template #default="{ row }">
...@@ -98,14 +97,13 @@ ...@@ -98,14 +97,13 @@
</el-table-column> </el-table-column>
<el-table-column prop="createBy" label="创建人" align="center"></el-table-column> <el-table-column prop="createBy" label="创建人" align="center"></el-table-column>
<el-table-column prop="updateTime" label="最近操作时间" align="center" width="180"></el-table-column> <el-table-column prop="updateTime" label="最近操作时间" align="center" width="180"></el-table-column>
<el-table-column label="操作" align="center" width="150" fixed="right"> <el-table-column label="操作" align="center" width="180" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button text @click="$router.push({ path: './detail', query: { id: row.id } })">详情|统计</el-button> <el-button text @click="$router.push({ path: './detail', query: { id: row.id } })">详情|统计</el-button>
<el-button <el-button
text text
v-if="row.fassionState == 1" v-if="row.fassionState == 1"
@click="$router.push({ path: './add', query: { id: row.id } })" @click="$router.push({ path: './add', query: { id: row.id } })">
>
编辑 编辑
</el-button> </el-button>
<template v-if="row.fassionState == 2 || row.fassionState == 4"> <template v-if="row.fassionState == 2 || row.fassionState == 4">
...@@ -117,9 +115,9 @@ ...@@ -117,9 +115,9 @@
<template v-if="row.fassionState == 4"> <template v-if="row.fassionState == 4">
<el-button text @click="setStateChange(2, row)">启动</el-button> <el-button text @click="setStateChange(2, row)">启动</el-button>
</template> </template>
<el-button text v-if="row.fassionState !== 2 && row.fassionState !== 4" @click="deleteFn(row)" <el-button text v-if="row.fassionState !== 2 && row.fassionState !== 4" @click="deleteFn(row)">
>删除</el-button 删除
> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -128,155 +126,154 @@ ...@@ -128,155 +126,154 @@
:total="total" :total="total"
v-model:page="query.pageNum" v-model:page="query.pageNum"
v-model:limit="query.pageSize" v-model:limit="query.pageSize"
@pagination="getList" @pagination="getList" />
/>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { getList, deleteFassion, deleteMultFa } from '../taskGroup/api' import { getList, deleteFassion, deleteMultFa, updateState } from '../taskGroup/api'
export default { export default {
name: 'task-group-list', name: 'task-group-list',
data() { data() {
return { return {
statusType: [ statusType: [
{ name: '待开始', key: 1 }, { name: '待开始', key: 1 },
{ name: '进行中', key: 2 }, { name: '进行中', key: 2 },
{ name: '已结束', key: 3 }, { name: '已结束', key: 3 },
{ name: '已暂停', key: 4 } { name: '已暂停', key: 4 },
], ],
query: { query: {
fassionType: 2, //1 任务宝 2群裂变 fassionType: 2, //1 任务宝 2群裂变
pageSize: 10, pageSize: 10,
pageNum: 1, pageNum: 1,
fassionName: '', fassionName: '',
fassionState: '' fassionState: '',
}, },
total: 0, total: 0,
loading: false, loading: false,
list: [], list: [],
selectList: [] selectList: [],
}
},
methods: {
setStateChange(state, data) {
let str = ''
if (state == 3) {
str = '是否确定结束当前任务?结束后无法继续执行活动,该不可撤销,请谨慎操作。'
}
if (state == 2) {
str = '是否确定启动当前任务?启动后立即生效,请谨慎操作。'
}
if (state == 4) {
str = '是否确定暂停当前任务?暂停后需手动重启,该不可撤销,请谨慎操作。'
} }
this.$confirm(str, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return updateState({ id: data.id, fassionState: state })
})
.then(() => {
this.handleSearch()
this.msgSuccess('操作成功')
})
}, },
methods: { selectable(row, index) {
setStateChange(state, data) { if (row.fassionState !== 2) {
let str = '' return true
if (state == 3) { }
str = '是否确定结束当前任务?结束后无法继续执行活动,该不可撤销,请谨慎操作。' },
} setType(data) {
if (state == 2) { let str = ''
str = '是否确定启动当前任务?启动后立即生效,请谨慎操作。' this.infoType.forEach((dd) => {
} if (dd.key == data.type) {
if (state == 4) { str = dd.name
str = '是否确定暂停当前任务?暂停后需手动重启,该不可撤销,请谨慎操作。'
} }
this.$confirm(str, '提示', { })
confirmButtonText: '确定', return str
cancelButtonText: '取消', },
type: 'warning' setStatus(data) {
}) let str = ''
.then(() => { this.statusType.forEach((dd) => {
return updateState({ id: data.id, fassionState: state }) if (dd.key == data.fassionState) {
}) str = dd.name
.then(() => {
this.handleSearch()
this.msgSuccess('操作成功')
})
},
selectable(row, index) {
if (row.fassionState !== 2) {
return true
} }
}, })
setType(data) { return str
let str = '' },
this.infoType.forEach((dd) => { getList() {
if (dd.key == data.type) { this.loading = true
str = dd.name getList(this.query).then((res) => {
} this.total = Number(res.total)
}) this.list = res.rows
return str this.loading = false
}, })
setStatus(data) { },
let str = '' handleSearch() {
this.statusType.forEach((dd) => { this.query.pageNum = 1
if (dd.key == data.fassionState) { this.getList()
str = dd.name },
} resetQuery() {
this.query.pageNum = 1
this.$refs['queryForm'].resetFields()
this.getList()
},
handleSelectionChange(e) {
this.selectList = e.map((dd) => dd.id)
},
deleteFn(data) {
this.$confirm('是否确认删除当前裂变任务?删除后不可撤销,请谨慎操作。', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return deleteFassion(data.id)
}) })
return str .then(() => {
}, this.handleSearch()
getList() { this.msgSuccess('删除成功')
this.loading = true
getList(this.query).then((res) => {
this.total = Number(res.total)
this.list = res.rows
this.loading = false
}) })
}, },
handleSearch() { deleteMult() {
this.query.pageNum = 1 if (!this.selectList.length) {
this.getList() this.msgInfo('请选择要删除项!')
}, return
resetQuery() { }
this.query.pageNum = 1 const ids = this.selectList.join(',')
this.$refs['queryForm'].resetFields() this.$confirm('是否确认删除当前裂变任务?删除后不可撤销,请谨慎操作。', '警告', {
this.getList() confirmButtonText: '确定',
}, cancelButtonText: '取消',
handleSelectionChange(e) { type: 'warning',
this.selectList = e.map((dd) => dd.id) })
}, .then(() => {
deleteFn(data) { return deleteMultFa(ids)
this.$confirm('是否确认删除当前裂变任务?删除后不可撤销,请谨慎操作。', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}) })
.then(() => { .then(() => {
return deleteFassion(data.id) this.handleSearch()
}) this.msgSuccess('删除成功')
.then(() => {
this.handleSearch()
this.msgSuccess('删除成功')
})
},
deleteMult() {
if (!this.selectList.length) {
this.msgInfo('请选择要删除项!')
return
}
const ids = this.selectList.join(',')
this.$confirm('是否确认删除当前裂变任务?删除后不可撤销,请谨慎操作。', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}) })
.then(() => { .catch(function () {})
return deleteMultFa(ids)
})
.then(() => {
this.handleSearch()
this.msgSuccess('删除成功')
})
.catch(function () {})
}
}, },
created() { },
this.getList() created() {
this.$store.setBusininessDesc( this.getList()
` this.$store.setBusininessDesc(
<div>通过任务形式,引导老客裂变新客加群,实现客群增长</div>
` `
) <div>通过任务形式,引导老客裂变新客加群,实现客群增长</div>
} `,
} )
},
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.self_a { .self_a {
color: var(--color); color: var(--color);
text-decoration: underline; text-decoration: underline;
&:hover { &:hover {
opacity: 0.8; opacity: 0.8;
}
} }
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!