Commit 3926e46a by 前端

发布任务添加loading

1 parent f1768cbb
<template> <template>
<div class="task-contentbox"> <div class='task-contentbox'>
<div> <div>
<el-form :inline="true" :model="searchForm"> <el-form :inline='true' :model='searchForm'>
<el-form-item label="业务场景:"> <el-form-item label='业务场景:'>
<el-select v-model="searchForm.businessScene" size="small"> <el-select v-model='searchForm.businessScene' size='small'>
<el-option <el-option
v-for="(item, index) in sceneOption" v-for='(item, index) in sceneOption'
:key="index" :key='index'
:label="item.label" :label='item.label'
:value="item.value" :value='item.value'
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="商户:"> <el-form-item label='商户:'>
<el-input <el-input
v-model="searchForm.merchantName" v-model='searchForm.merchantName'
size="small" size='small'
placeholder="请输入商户名称" placeholder='请输入商户名称'
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="活动/产品:"> <el-form-item label='活动/产品:'>
<el-input <el-input
v-model="searchForm.activityName" v-model='searchForm.activityName'
size="small" size='small'
placeholder="请输入活动/产品名称" placeholder='请输入活动/产品名称'
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="状态:"> <el-form-item label='状态:'>
<el-select v-model="searchForm.activityStatus" size="small"> <el-select v-model='searchForm.activityStatus' size='small'>
<el-option <el-option
v-for="(item, index) in taskStatus" v-for='(item, index) in taskStatus'
:key="index" :key='index'
:label="item.label" :label='item.label'
:value="item.value" :value='item.value'
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" size="small" @click="handleSearch" <el-button type='primary' size='small' @click='handleSearch'
>查询 >查询
</el-button> </el-button>
<el-button plain size="small" @click="handleReset">重置</el-button> <el-button plain size='small' @click='handleReset'>重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class="table-top"> <div class='table-top'>
<div class="table-title">订单列表</div> <div class='table-title'>订单列表</div>
<el-button type="primary" size="small" @click="handleEdit()" <el-button type='primary' size='small' @click='handleEdit()'
>添加任务</el-button >添加任务
</el-button
> >
</div> </div>
<el-tabs v-model="activeName" @tab-click="handleTabClick"> <el-tabs v-model='activeName' @tab-click='handleTabClick'>
<el-tab-pane <el-tab-pane
:label="'全部' + '(' + listCount.totalCount + ')'" :label="'全部' + '(' + listCount.totalCount + ')'"
name="first" name='first'
></el-tab-pane> ></el-tab-pane>
<el-tab-pane <el-tab-pane
:label="'未发布' + '(' + listCount.draftCount + ')'" :label="'未发布' + '(' + listCount.draftCount + ')'"
:name="statusNum.UNPUBLISH" :name='statusNum.UNPUBLISH'
></el-tab-pane> ></el-tab-pane>
<el-tab-pane <el-tab-pane
:label="'已发布' + '(' + listCount.upCount + ')'" :label="'已发布' + '(' + listCount.upCount + ')'"
:name="statusNum.PUBLISHED" :name='statusNum.PUBLISHED'
></el-tab-pane> ></el-tab-pane>
<el-tab-pane <el-tab-pane
:label="'已结束' + '(' + listCount.downCount + ')'" :label="'已结束' + '(' + listCount.downCount + ')'"
:name="statusNum.FINISHIED" :name='statusNum.FINISHIED'
></el-tab-pane> ></el-tab-pane>
</el-tabs> </el-tabs>
<div> <div>
<d2-table <d2-table
ref="taskTable" v-loading='loading'
:searchForm="searchForm" ref='taskTable'
:getListApi="getListApi" :searchForm='searchForm'
:tableParams="tableParams" :getListApi='getListApi'
:pageConf="pageConf" :tableParams='tableParams'
:pageConf='pageConf'
> >
<div slot="businessScene" slot-scope="scope"> <div slot='businessScene' slot-scope='scope'>
<span v-if="scope.scope.businessScene == 0">1.0车损升级</span> <span v-if='scope.scope.businessScene == 0'>1.0车损升级</span>
<span v-if="scope.scope.businessScene == 1">1.1精品升级</span> <span v-if='scope.scope.businessScene == 1'>1.1精品升级</span>
<span v-if="scope.scope.businessScene == 2">1.2膨胀金活动</span> <span v-if='scope.scope.businessScene == 2'>1.2膨胀金活动</span>
<span v-if="scope.scope.businessScene == 3">1.3众筹活动</span> <span v-if='scope.scope.businessScene == 3'>1.3众筹活动</span>
<span v-if="scope.scope.businessScene == 4">5.2私域用户代运营</span> <span v-if='scope.scope.businessScene == 4'>5.2私域用户代运营</span>
</div> </div>
<div slot="activityStatus" slot-scope="scope"> <div slot='activityStatus' slot-scope='scope'>
<span v-if="scope.scope.activityStatus == statusNum.UNPUBLISH" <span v-if='scope.scope.activityStatus == statusNum.UNPUBLISH'
>未发布</span >未发布</span
> >
<span v-if="scope.scope.activityStatus == statusNum.PUBLISHED" <span v-if='scope.scope.activityStatus == statusNum.PUBLISHED'
>已发布</span >已发布</span
> >
<span v-if="scope.scope.activityStatus == statusNum.FINISHIED" <span v-if='scope.scope.activityStatus == statusNum.FINISHIED'
>已结束</span >已结束</span
> >
</div> </div>
<template slot="auth-button" slot-scope="scope"> <template slot='auth-button' slot-scope='scope'>
<el-button <el-button
type="text" type='text'
v-if="scope.scope.activityStatus != statusNum.FINISHIED" v-if='scope.scope.activityStatus != statusNum.FINISHIED'
@click="handleEdit(scope.scope, 1)" @click='handleEdit(scope.scope, 1)'
>编辑</el-button >编辑
</el-button
> >
<el-button <el-button
type="text" type='text'
v-if="scope.scope.activityStatus != statusNum.UNPUBLISH" v-if='scope.scope.activityStatus != statusNum.UNPUBLISH'
@click="handleAnalyze(scope.scope)" @click='handleAnalyze(scope.scope)'
>任务分析</el-button >任务分析
</el-button
> >
<el-button <el-button
type="text" type='text'
v-if="scope.scope.activityStatus == statusNum.UNPUBLISH" v-if='scope.scope.activityStatus == statusNum.UNPUBLISH'
@click="handleDelete(scope.scope)" @click='handleDelete(scope.scope)'
style="color: red" style='color: red'
>删除</el-button >删除
</el-button
> >
<el-button <el-button
type="text" type='text'
v-if="scope.scope.activityStatus == statusNum.UNPUBLISH" v-if='scope.scope.activityStatus == statusNum.UNPUBLISH'
@click="handleActive(scope.scope)" @click='handleActive(scope.scope)'
>发布</el-button >发布
</el-button
> >
<el-button <el-button
type="text" type='text'
v-if="scope.scope.activityStatus == statusNum.PUBLISHED" v-if='scope.scope.activityStatus == statusNum.PUBLISHED'
@click="handleInactive(scope.scope)" @click='handleInactive(scope.scope)'
>结束</el-button >结束
</el-button
> >
<el-button <el-button
type="text" type='text'
@click="handleClone(scope.scope)" @click='handleClone(scope.scope)'
v-if="scope.scope.businessScene != 4" v-if='scope.scope.businessScene != 4'
>复制</el-button >复制
</el-button
> >
<el-button <el-button
type="text" type='text'
v-if="scope.scope.activityStatus != statusNum.UNPUBLISH" v-if='scope.scope.activityStatus != statusNum.UNPUBLISH'
@click="handleViewDetail(scope.scope)" @click='handleViewDetail(scope.scope)'
>查看</el-button >查看
</el-button
> >
</template> </template>
</d2-table> </d2-table>
...@@ -147,52 +156,52 @@ ...@@ -147,52 +156,52 @@
const sceneOption = [ const sceneOption = [
{ {
label: '全部', label: '全部',
value: '', value: ''
}, },
{ {
label: '1.0车损升级', label: '1.0车损升级',
value: '0', value: '0'
}, },
{ {
label: '1.1精品升级', label: '1.1精品升级',
value: '1', value: '1'
}, },
{ {
label: '1.2膨胀金活动', label: '1.2膨胀金活动',
value: '2', value: '2'
}, },
{ {
label: '1.3众筹活动', label: '1.3众筹活动',
value: '3', value: '3'
}, },
{ {
label: '5.2私域用户代运营', label: '5.2私域用户代运营',
value: '4', value: '4'
}, }
] ]
const statusNum = { const statusNum = {
ALL: '', ALL: '',
UNPUBLISH: '1', UNPUBLISH: '1',
PUBLISHED: '2', PUBLISHED: '2',
FINISHIED: '3', FINISHIED: '3'
} }
const taskStatus = [ const taskStatus = [
{ {
label: '全部', label: '全部',
value: '', value: ''
}, },
{ {
label: '未发布', label: '未发布',
value: statusNum.UNPUBLISH, value: statusNum.UNPUBLISH
}, },
{ {
label: '已发布', label: '已发布',
value: statusNum.PUBLISHED, value: statusNum.PUBLISHED
}, },
{ {
label: '已结束', label: '已结束',
value: statusNum.FINISHIED, value: statusNum.FINISHIED
}, }
] ]
import { taskApi } from '../../../api/task' import { taskApi } from '../../../api/task'
...@@ -208,7 +217,7 @@ export default { ...@@ -208,7 +217,7 @@ export default {
businessScene: '', businessScene: '',
merchantName: '', merchantName: '',
activityName: '', activityName: '',
activityStatus: '', activityStatus: ''
}, },
listCount: {}, listCount: {},
// 表格参数 // 表格参数
...@@ -221,42 +230,42 @@ export default { ...@@ -221,42 +230,42 @@ export default {
label: '业务场景', label: '业务场景',
prop: 'businessScene', prop: 'businessScene',
addHtml: 'businessScene', addHtml: 'businessScene',
width: 150, width: 150
}, },
{ {
label: '商户', label: '商户',
prop: 'merchantName', prop: 'merchantName',
width: 150, width: 150
}, },
{ {
label: '活动/产品', label: '活动/产品',
prop: 'activityName', prop: 'activityName',
width: 200, width: 200
}, },
{ {
label: '任务数', label: '任务数',
prop: 'missionCount', prop: 'missionCount'
}, },
{ {
label: '创建人', label: '创建人',
prop: 'createdBy', prop: 'createdBy'
}, },
{ {
label: '创建时间', label: '创建时间',
prop: 'createdTime', prop: 'createdTime',
width: 150, width: 150
}, },
{ {
label: '状态', label: '状态',
prop: 'activityStatus', prop: 'activityStatus',
addHtml: 'activityStatus', addHtml: 'activityStatus'
}, }
], ]
}, },
pageConf: { pageConf: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageNum: 'pageNum', pageNum: 'pageNum',
totalCount: 'data.count', totalCount: 'data.count'
}, },
// 活动开始/结束时间 // 活动开始/结束时间
startTime: '', startTime: '',
...@@ -265,6 +274,7 @@ export default { ...@@ -265,6 +274,7 @@ export default {
getListApi: taskApi.findMissionList, getListApi: taskApi.findMissionList,
status: false, status: false,
activeName: 'first', activeName: 'first',
loading: false
} }
}, },
mounted() { mounted() {
...@@ -289,7 +299,7 @@ export default { ...@@ -289,7 +299,7 @@ export default {
businessScene: '', businessScene: '',
merchantName: '', merchantName: '',
activityName: '', activityName: '',
activityStatus: '', activityStatus: ''
} }
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.taskTable.refreshTable() this.$refs.taskTable.refreshTable()
...@@ -308,7 +318,7 @@ export default { ...@@ -308,7 +318,7 @@ export default {
this.status = true this.status = true
const para = { const para = {
task: item, task: item,
type, type
} }
this.$root.to( this.$root.to(
['任务中心', '任务平台', '任务管理', '任务模板管理', '*添加任务模板'], ['任务中心', '任务平台', '任务管理', '任务模板管理', '*添加任务模板'],
...@@ -367,6 +377,7 @@ export default { ...@@ -367,6 +377,7 @@ export default {
}, },
// 二次确认 // 二次确认
secondConfirm(title, txt, apiParams, apiId, fn) { secondConfirm(title, txt, apiParams, apiId, fn) {
var params = { id: apiId, activityStatus: apiParams } var params = { id: apiId, activityStatus: apiParams }
this.$confirm(txt, title, { this.$confirm(txt, title, {
confirmButtonText: '确定', confirmButtonText: '确定',
...@@ -374,11 +385,12 @@ export default { ...@@ -374,11 +385,12 @@ export default {
type: 'warning', type: 'warning',
callback: (action) => { callback: (action) => {
if (action == 'confirm') { if (action == 'confirm') {
this.loading = true
taskApi.updateStatusMission(params).then((res) => { taskApi.updateStatusMission(params).then((res) => {
console.log(res) this.loading = false
this.$message({ this.$message({
message: res.code == '0' ? '操作成功' : '操作失败', message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error', type: res.code == '0' ? 'success' : 'error'
}) })
if (res.code == '0') { if (res.code == '0') {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -387,28 +399,31 @@ export default { ...@@ -387,28 +399,31 @@ export default {
} }
}) })
} }
}, }
}) })
}, }
}, }
} }
</script> </script>
<style lang="scss" scoped> <style lang='scss' scoped>
.task-contentbox { .task-contentbox {
padding: 20px; padding: 20px;
} }
.table-top { .table-top {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 10px; margin-bottom: 10px;
} }
.table-title { .table-title {
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
color: rgb(51, 51, 51); color: rgb(51, 51, 51);
line-height: 16px; line-height: 16px;
} }
/deep/ .el-table .cell { /deep/ .el-table .cell {
line-height: 20px; line-height: 20px;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!