Files
dvcp_v2_wxcp_app/src/project/saas/AppCooperationPropaganda/cooperationDetail.vue

434 lines
11 KiB
Vue
Raw Normal View History

2022-07-12 18:10:42 +08:00
<template>
2022-07-15 16:43:41 +08:00
<div class="cooperationDetail">
2022-07-13 16:59:58 +08:00
<AiTopFixed>
<div class="tab-select">
2022-07-18 10:55:29 +08:00
<div
class="item"
:class="tabIndex == index ? 'active' : ''"
v-for="(item, index) in tabs"
:key="index"
@click="tabClick(index)"
>
{{ item }}<span></span>
2022-07-13 16:59:58 +08:00
</div>
</div>
</AiTopFixed>
2022-07-18 10:55:29 +08:00
<div class="content">
2022-07-13 16:59:58 +08:00
<div class="header">
<div class="header_left">
2022-07-27 11:16:59 +08:00
<div>{{ detail.taskTitle }}</div>
2022-07-18 10:55:29 +08:00
<div>
创建时间: <span>{{ createTime }}</span>
</div>
2022-07-13 16:59:58 +08:00
</div>
<div class="header_right" @click="toDetail">查看详情</div>
</div>
<div class="pieEcharts">
<div class="pie_info">
2022-07-28 08:51:57 +08:00
<div class="tips" v-if="detail.status">
2022-07-18 10:55:29 +08:00
数据更新于<span>{{ info.remindTime }}</span>
</div>
2022-07-13 16:59:58 +08:00
<div class="pie_card">
2022-07-28 08:51:57 +08:00
<div id="pieEcharts"></div>
2022-07-13 16:59:58 +08:00
<div class="pie_right">
2022-07-18 10:55:29 +08:00
<div>
2022-07-28 08:51:57 +08:00
<span>{{
tabIndex == 0 ? "计划送达居民:" : "计划送达居民群:"
}}</span>
2022-07-22 13:54:18 +08:00
<span>{{ info.planCount || 0 }}</span>
2022-07-18 10:55:29 +08:00
</div>
<div>
2022-07-28 08:51:57 +08:00
<span>{{
tabIndex == 0 ? "未送达居民:" : "未送达居民群:"
}}</span>
2022-07-22 13:54:18 +08:00
<span>{{ info.unExecutedCount || 0 }}</span>
2022-07-18 10:55:29 +08:00
</div>
<div>
2022-07-28 08:51:57 +08:00
<span>{{
tabIndex == 0 ? "已送达居民:" : "已送达居民群:"
}}</span>
2022-07-22 13:54:18 +08:00
<span>{{ info.executedCount || 0 }}</span>
2022-07-18 10:55:29 +08:00
</div>
<div>
2022-07-28 08:51:57 +08:00
<span>{{
tabIndex == 0 ? "无法送达居民:" : "无法送达居民群:"
}}</span>
2022-07-22 13:54:18 +08:00
<span>{{ info.cannotExecuteCount || 0 }}</span>
2022-07-18 10:55:29 +08:00
</div>
2022-07-13 16:59:58 +08:00
</div>
</div>
2022-07-27 15:39:14 +08:00
<!-- v-if="detail.status == 4" -->
2022-07-28 08:51:57 +08:00
<div class="btn" @click="remindSend">提醒成员发送</div>
2022-07-13 16:59:58 +08:00
</div>
</div>
<div class="list_content">
<div class="list_card">
<div class="tab">
2022-07-28 08:51:57 +08:00
<u-subsection
2022-07-28 13:59:11 +08:00
:list="tabIndex == 0 ? subsection0 : subsection1"
2022-07-28 08:51:57 +08:00
:current="subIndex"
@change="changeSub"
></u-subsection>
2022-07-13 16:59:58 +08:00
</div>
2022-07-25 10:46:48 +08:00
2022-07-18 10:55:29 +08:00
<AiTable
:data="tableData"
2022-07-28 08:51:57 +08:00
:colConfigs="tabIndex == 0 ? colConfigs0 : colConfigs1"
v-if="tableData.length"
>
<u-td slot="groupOwnerId" slot-scope="{ row }">
<AiOpenData
v-if="row.groupOwnerId"
type="userName"
:openid="row.groupOwnerId"
/>
2022-07-22 13:54:18 +08:00
</u-td>
</AiTable>
<AiEmpty v-if="!tableData.length" description="暂无数据"></AiEmpty>
2022-07-13 16:59:58 +08:00
</div>
</div>
</div>
</div>
2022-07-12 18:10:42 +08:00
</template>
<script>
2022-07-18 10:55:29 +08:00
import echarts from "echarts";
2022-07-12 18:10:42 +08:00
export default {
data() {
2022-07-13 16:59:58 +08:00
return {
2022-07-18 10:55:29 +08:00
tabs: ["成员统计", "居民群统计"],
2022-07-13 16:59:58 +08:00
tabIndex: 0,
pieEcharts: null,
2022-07-28 13:59:11 +08:00
subsection0: [
{ name: "未执行" },
{ name: "已执行" },
{ name: "无法执行" },
],
subsection1: [
2022-07-18 10:55:29 +08:00
{ name: "未送达" },
{ name: "已送达" },
{ name: "无法送达" },
2022-07-13 16:59:58 +08:00
],
subIndex: 0,
2022-07-15 14:48:27 +08:00
tableData: [],
2022-07-18 10:55:29 +08:00
createTime: "",
id: "",
2022-07-15 14:48:27 +08:00
info: {},
current: 1,
2022-07-18 10:55:29 +08:00
firstClickTime: "",
currentClickTime: "",
flag: true,
2022-07-28 08:51:57 +08:00
detail: {},
2022-07-18 10:55:29 +08:00
};
2022-07-13 16:59:58 +08:00
},
computed: {
colConfigs0() {
return [
2022-07-28 08:51:57 +08:00
{ slot: "groupOwnerId", label: "成员" },
{ label: "预计送达居民群", prop: "groupCount" },
2022-07-18 10:55:29 +08:00
];
2022-07-13 16:59:58 +08:00
},
colConfigs1() {
return [
2022-07-28 08:51:57 +08:00
{ label: "居民群", prop: "groupName" },
{ label: "群人数", prop: "memberCount" },
{ slot: "groupOwnerId", label: "群主" },
2022-07-18 10:55:29 +08:00
];
2022-07-13 16:59:58 +08:00
},
},
2022-07-15 14:48:27 +08:00
onLoad(o) {
2022-07-18 10:55:29 +08:00
this.id = o.id;
this.createTime = o.time;
2022-07-15 14:48:27 +08:00
},
2022-07-13 16:59:58 +08:00
methods: {
tabClick(index) {
2022-07-18 10:55:29 +08:00
this.tabIndex = index;
2022-07-28 08:51:57 +08:00
this.getStatistics();
2022-07-13 16:59:58 +08:00
},
2022-07-22 17:40:34 +08:00
getDetail() {
2022-07-28 08:51:57 +08:00
this.$http
.post(`/app/appmasssendingtask/queryDetailById?id=${this.id}`)
.then((res) => {
if (res?.data) {
this.detail = res.data;
}
});
2022-07-22 17:40:34 +08:00
},
2022-07-13 16:59:58 +08:00
toDetail() {
2022-07-18 10:55:29 +08:00
uni.navigateTo({ url: `./detail?id=${this.id}` });
2022-07-13 16:59:58 +08:00
},
2022-07-15 14:48:27 +08:00
// 提醒发送
remindSend() {
2022-07-28 08:51:57 +08:00
this.firstClickTime = new Date(this.detail.remindTime).getTime() || "";
console.log(this.firstClickTime);
2022-07-18 10:55:29 +08:00
this.currentClickTime = +new Date();
2022-07-28 08:51:57 +08:00
console.log(this.currentClickTime);
2022-07-18 10:55:29 +08:00
let time = this.currentClickTime - this.firstClickTime;
2022-07-28 08:51:57 +08:00
console.log(time);
2022-07-27 15:39:14 +08:00
if (time >= 60 * 60 * 1000 || this.flag) {
2022-07-18 10:55:29 +08:00
this.$http
.post("/app/appmasssendingtask/remindSend", null, {
params: {
id: this.id,
},
})
.then((res) => {
if (res?.code == 0) {
this.$u.toast("已提醒成员发送");
this.flag = false;
2022-07-15 16:43:41 +08:00
}
2022-07-18 10:55:29 +08:00
})
2022-07-28 08:51:57 +08:00
.catch(() => {});
2022-07-18 10:55:29 +08:00
} else {
2022-07-27 15:39:14 +08:00
console.log(111);
2022-07-18 10:55:29 +08:00
time = 60 * 60 * 1000 - time;
const min = Math.floor(time / 1000 / 60); // 分钟
2022-07-28 08:51:57 +08:00
let second = Math.floor(time / 1000); // 秒
2022-07-18 10:55:29 +08:00
second %= 60;
let msg = ``;
if (min > 0 && second > 0) {
msg = `${min}分钟${second}秒后可以再次点击`;
} else if (min > 0 && second <= 0) {
msg = `${min}分钟后可以再次点击`;
} else if (min <= 0 && second > 0) {
msg = `${second}秒后可以再次点击`;
2022-07-15 16:43:41 +08:00
}
2022-07-18 10:55:29 +08:00
this.$u.toast(msg);
}
2022-07-15 14:48:27 +08:00
},
2022-07-22 13:54:18 +08:00
// 切换分段器
2022-07-21 09:33:17 +08:00
changeSub(index) {
this.subIndex = index;
2022-07-28 08:51:57 +08:00
this.getStatistics();
2022-07-21 09:33:17 +08:00
},
2022-07-22 13:54:18 +08:00
// 获取数据
2022-07-15 14:48:27 +08:00
getStatistics() {
2022-07-18 10:55:29 +08:00
this.$http
.post(`/app/appmasssendingtask/detailStatistics`, null, {
params: {
type: this.tabIndex,
sendStatus: this.subIndex,
taskId: this.id,
current: this.current,
},
})
.then((res) => {
if (res?.data) {
2022-07-28 08:51:57 +08:00
this.info = res.data;
this.tableData = res.data.executedList.records;
2022-07-18 10:55:29 +08:00
}
2022-07-28 08:51:57 +08:00
this.getPieEcharts();
2022-07-18 10:55:29 +08:00
});
2022-07-15 14:48:27 +08:00
},
2022-07-13 16:59:58 +08:00
2022-07-22 13:54:18 +08:00
// 饼图
2022-07-13 16:59:58 +08:00
getPieEcharts() {
2022-07-18 10:55:29 +08:00
this.pieEcharts = echarts.init(document.getElementById("pieEcharts"));
this.pieEcharts.setOption({
2022-07-13 16:59:58 +08:00
tooltip: {
2022-07-18 10:55:29 +08:00
trigger: "item",
2022-07-13 16:59:58 +08:00
},
2022-07-18 10:55:29 +08:00
color: ["#1684fc", "#ccc"],
2022-07-13 16:59:58 +08:00
series: [
{
2022-07-28 08:51:57 +08:00
name: this.tabIndex == 0 ? "任务完成率" : "群发送达率",
2022-07-18 10:55:29 +08:00
type: "pie",
2022-07-22 13:54:18 +08:00
radius: ["50%", "70%"],
2022-07-13 16:59:58 +08:00
avoidLabelOverlap: false,
label: {
normal: {
show: false,
2022-07-18 10:55:29 +08:00
position: "center",
2022-07-13 16:59:58 +08:00
},
},
labelLine: {
2022-07-18 10:55:29 +08:00
show: false,
2022-07-13 16:59:58 +08:00
},
data: [
2022-07-18 10:55:29 +08:00
{
2022-07-22 13:54:18 +08:00
value: this.info.executedCount,
2022-07-18 10:55:29 +08:00
name: "群发送达率",
label: {
normal: {
show: true,
2022-07-28 08:51:57 +08:00
formatter: ({ name, value }) => {
if (this.tabIndex == 0) {
2022-07-28 09:44:56 +08:00
return `{name|任务达成率\n\n}{value|${value / this.info.planCount }%}`;
2022-07-28 08:51:57 +08:00
} else {
2022-07-28 09:44:56 +08:00
return `{name|群发送达率\n\n}{value|${value / this.info.planCount }%}`;
2022-07-28 08:51:57 +08:00
}
},
2022-07-18 10:55:29 +08:00
textStyle: {
fontSize: 16,
2022-07-28 08:51:57 +08:00
},
rich: {
name: {
2022-07-28 09:44:56 +08:00
color: "#999",
2022-07-28 08:51:57 +08:00
},
value: {
color: "#000000",
fontSize: 26,
},
2022-07-18 10:55:29 +08:00
},
2022-07-13 16:59:58 +08:00
},
2022-07-18 10:55:29 +08:00
},
2022-07-13 16:59:58 +08:00
},
2022-07-25 18:02:40 +08:00
{ value: this.info.unExecutedCount, name: "未送达数量" },
2022-07-18 10:55:29 +08:00
],
},
],
});
},
2022-07-13 16:59:58 +08:00
},
onShow() {
2022-07-18 10:55:29 +08:00
document.title = "群发居民群统计";
this.getStatistics();
2022-07-28 08:51:57 +08:00
this.getDetail();
2022-07-12 18:10:42 +08:00
},
2022-07-13 16:59:58 +08:00
mounted() {
2022-07-18 10:55:29 +08:00
this.getPieEcharts();
},
};
2022-07-12 18:10:42 +08:00
</script>
<style lang="scss" scoped>
2022-07-15 16:43:41 +08:00
.cooperationDetail {
2022-07-13 16:59:58 +08:00
::v-deep .AiTopFixed .content {
padding: 0;
}
2022-07-22 13:54:18 +08:00
::v-deep .emptyWrap {
2022-07-28 08:51:57 +08:00
border: 2px solid #d0d4dc;
2022-07-22 13:54:18 +08:00
border-radius: 8px;
padding-bottom: 20px;
}
2022-07-13 16:59:58 +08:00
.tab-select {
width: 100%;
height: 96px;
line-height: 96px;
2022-07-18 10:55:29 +08:00
background: #3975c6;
2022-07-13 16:59:58 +08:00
display: flex;
.item {
flex: 1;
text-align: center;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
2022-07-18 10:55:29 +08:00
color: #cddcf0;
2022-07-13 16:59:58 +08:00
}
.active {
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
position: relative;
color: #fff;
span {
width: 48px;
height: 4px;
2022-07-18 10:55:29 +08:00
background: #fff;
2022-07-13 16:59:58 +08:00
position: absolute;
bottom: 14px;
left: 50%;
margin-left: -24px;
}
}
}
.header {
height: 160px;
padding: 32px;
box-sizing: border-box;
2022-07-18 10:55:29 +08:00
background: #fff;
2022-07-13 16:59:58 +08:00
display: flex;
align-items: center;
.header_left {
width: calc(100% - 120px);
div:first-child {
color: #000000;
font-size: 32px;
font-weight: 600;
margin-bottom: 10px;
}
div:last-child {
color: #666666;
}
}
.header_right {
width: 120px;
2022-07-18 10:55:29 +08:00
color: #5297ff;
2022-07-13 16:59:58 +08:00
}
}
.pieEcharts {
width: 100%;
padding: 32px;
box-sizing: border-box;
.pie_info {
2022-07-18 10:55:29 +08:00
background: #fff;
2022-07-13 16:59:58 +08:00
border-radius: 16px;
padding-bottom: 20px;
box-sizing: border-box;
.tips {
color: #666666;
padding: 40px 32px 0 32px;
box-sizing: border-box;
}
.pie_card {
display: flex;
width: 100%;
align-items: center;
#pieEcharts {
width: 60%;
height: 400px;
}
2022-07-15 17:07:56 +08:00
::v-deep .emptyWrap {
width: 60%;
}
2022-07-13 16:59:58 +08:00
.pie_right {
width: 40%;
2022-07-27 09:52:33 +08:00
padding-right: 30px;
2022-07-27 09:45:31 +08:00
box-sizing: border-box;
2022-07-13 16:59:58 +08:00
div {
margin-bottom: 10px;
2022-07-27 09:45:31 +08:00
display: flex;
justify-content: space-between;
2022-07-13 16:59:58 +08:00
}
}
}
.btn {
margin: 0 auto;
width: 90%;
height: 80px;
line-height: 80px;
text-align: center;
2022-07-18 10:55:29 +08:00
color: #fff;
background: #3aa0ff;
2022-07-13 16:59:58 +08:00
border-radius: 8px;
}
}
}
.list_content {
2022-07-22 13:54:18 +08:00
padding: 0 32px 32px 32px;
2022-07-13 16:59:58 +08:00
box-sizing: border-box;
.list_card {
2022-07-18 10:55:29 +08:00
background: #fff;
2022-07-13 16:59:58 +08:00
border-radius: 16px;
padding: 30px 30px;
.tab {
margin-bottom: 34px;
}
}
}
}
2022-07-12 18:10:42 +08:00
</style>