Files

527 lines
13 KiB
Vue
Raw Permalink Normal View History

2022-07-12 18:10:42 +08:00
<template>
2022-07-15 16:43:41 +08:00
<div class="cooperationDetail">
2022-09-08 13:06:54 +08:00
<AiTopFixed>
2022-07-13 16:59:58 +08:00
<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>
2022-09-08 13:06:54 +08:00
</AiTopFixed>
2022-07-13 16:59:58 +08:00
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-08-01 11:25:31 +08:00
<div>{{ detail.taskTitle }} <span :class="detail.status==0? 'status0': detail.status==1? 'status1': detail.status==2? 'status2':
detail.status == 3? 'status3':detail.status==4? 'status4': 'status5'">{{ $dict.getLabel('mstStatus', detail.status) }}</span></div>
2022-07-18 10:55:29 +08:00
<div>
2022-08-01 11:25:31 +08:00
创建时间: <span>{{ createTime }}</span>
2022-07-18 10:55:29 +08:00
</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>{{
2022-07-28 14:18:24 +08:00
tabIndex == 0 ? "计划执行成员:" : "计划送达居民群:"
2022-07-28 08:51:57 +08:00
}}</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>{{
2022-07-28 14:18:24 +08:00
tabIndex == 0 ? "未执行成员:" : "未送达居民群:"
2022-07-28 08:51:57 +08:00
}}</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>{{
2022-07-28 14:18:24 +08:00
tabIndex == 0 ? "已执行成员:" : "已送达居民群:"
2022-07-28 08:51:57 +08:00
}}</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>{{
2022-07-28 14:18:24 +08:00
tabIndex == 0 ? "无法执行成员:" : "无法送达居民群:"
2022-07-28 08:51:57 +08:00
}}</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-29 10:34:02 +08:00
<div v-if="detail.status == 4" class="btn" @click="remindSend">提醒成员发送</div>
2022-07-13 16:59:58 +08:00
</div>
</div>
<div class="list_content">
<div class="list_card">
2022-09-08 13:06:54 +08:00
<div class="tab" v-show="update0">
2022-07-28 08:51:57 +08:00
<u-subsection
2022-09-08 13:06:54 +08:00
:list="subsection0"
2022-07-28 16:40:26 +08:00
mode="button"
activeColor="#3c9cff"
2022-09-08 13:06:54 +08:00
:current="subIndex0"
@change="changeSub0"
></u-subsection>
</div>
<div class="tab" v-show="update1">
<u-subsection
:list="subsection1"
mode="button"
activeColor="#3c9cff"
:current="subIndex1"
@change="changeSub1"
2022-07-28 18:25:13 +08:00
></u-subsection>
</div>
2022-07-25 10:46:48 +08:00
2022-07-18 10:55:29 +08:00
<AiTable
:data="tableData"
2022-09-08 13:06:54 +08:00
:colConfigs="tabIndex == 0 ? colConfigs0 : colConfigs1"
2022-09-08 13:20:50 +08:00
v-if="tableData.length"
>
<u-td slot="groupOwnerId" slot-scope="{ row }" style="border: none;">
<AiOpenData
v-if="row.groupOwnerId"
type="userName"
:openid="row.groupOwnerId"
/>
</u-td>
</AiTable>
2022-07-22 13:54:18 +08:00
<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 18:25:13 +08:00
subIndex0: 0,
subIndex1: 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: "",
2022-07-28 08:51:57 +08:00
detail: {},
2022-07-28 18:25:13 +08:00
2022-09-08 13:06:54 +08:00
subsection0: [
2022-07-28 15:12:26 +08:00
{ name: "未执行" },
{ name: "已执行" },
{ name: "无法执行" },
],
2022-09-08 13:06:54 +08:00
subsection1: [
{ name: "未送达" },
{ name: "已送达" },
{ name: "无法送达" },
],
update0: true,
update1: false,
2022-07-18 10:55:29 +08:00
};
2022-07-13 16:59:58 +08:00
},
computed: {
2022-09-08 13:06:54 +08:00
colConfigs0() {
2022-07-13 16:59:58 +08:00
return [
2022-09-08 13:20:50 +08:00
{ slot: "groupOwnerId", label: "成员" },
2022-09-08 13:06:54 +08:00
{ label: "预计送达居民群", prop: "groupCount" },
];
},
colConfigs1() {
return [
{ label: "居民群", prop: "groupName" },
{ label: "群人数", prop: "memberCount" },
2022-09-14 10:40:27 +08:00
{ 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 18:25:13 +08:00
if(this.tabIndex == 0) {
this.subsection = [
{ name: "未执行" },
{ name: "已执行" },
{ name: "无法执行" },
]
this.update0 = true
this.update1 = false
this.$forceUpdate()
} else if(this.tabIndex == 1) {
this.subsection = [
{ name: "未送达" },
{ name: "已送达" },
{ name: "无法送达" },
]
this.update0 = false
this.update1 = true
this.$forceUpdate()
}
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-08-02 17:30:56 +08:00
uni.getSystemInfo({
2022-08-02 17:46:38 +08:00
success: (res)=>{
if(res.platform == "ios") {
this.firstClickTime = new Date(this.detail.remindTime.replace(/-/g, "/")).getTime() || 0
} else {
this.firstClickTime = new Date(this.detail.remindTime).getTime() || 0
}
2022-08-02 16:51:06 +08:00
}
2022-08-02 17:30:56 +08:00
});
2022-08-02 17:46:38 +08:00
this.currentClickTime = +new Date();
let time = this.currentClickTime - this.firstClickTime;
if (time >= 3600000) {
this.$http.post("/app/appmasssendingtask/remindSend", null, {
params: {
id: this.id,
},
})
.then((res) => {
if (res?.code == 0) {
this.$u.toast("已提醒成员发送");
this.getDetail()
}
})
.catch(() => {});
} else {
time = 3600000 - time;
const min = Math.floor(time / 60000); // 分钟
let second = Math.floor(time / 1000); // 秒
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}秒后可以再次点击`;
}
this.$u.toast(msg);
}
2022-07-15 14:48:27 +08:00
},
2022-07-22 13:54:18 +08:00
// 切换分段器
2022-09-08 13:06:54 +08:00
changeSub0(index) {
this.subIndex0 = index;
this.getStatistics();
},
changeSub1(index) {
this.subIndex1 = index;
2022-07-28 15:37:02 +08:00
this.getStatistics();
},
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,
2022-07-28 18:25:13 +08:00
sendStatus: this.tabIndex==0? this.subIndex0: this.subIndex1,
2022-07-18 10:55:29 +08:00
taskId: this.id,
current: this.current,
2022-09-07 11:04:05 +08:00
size: 3000,
2022-07-18 10:55:29 +08:00
},
})
.then((res) => {
if (res?.data) {
2022-07-28 08:51:57 +08:00
this.info = res.data;
this.tableData = res.data.executedList.records;
2022-08-01 17:00:54 +08:00
setTimeout(()=>{
this.getPieEcharts();
}, 1000)
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-08-03 17:11:15 +08:00
show: false,
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-08-03 17:41:30 +08:00
name: "已执行成员",
2022-07-18 10:55:29 +08:00
label: {
normal: {
show: true,
2022-07-28 08:51:57 +08:00
formatter: ({ name, value }) => {
2022-08-03 18:08:07 +08:00
let num = value / this.info.planCount * 100
2022-07-28 08:51:57 +08:00
if (this.tabIndex == 0) {
2022-08-03 18:32:00 +08:00
return num % 1==0? `{name|任务达成率\n\n}{value|${num}%}`: `{name|任务达成率\n\n}{value|${ num.toFixed(1) }%}`;
2022-07-28 08:51:57 +08:00
} else {
2022-08-03 18:32:00 +08:00
return num % 1==0? `{name|群发送达率\n\n}{value|${num}%}`: `{name|群发送达率\n\n}{value|${ num.toFixed(1) }%}`;
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-08-08 10:08:35 +08:00
{
value: this.info.planCount - this.info.executedCount ,
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 = "群发居民群统计";
2022-08-01 11:25:31 +08:00
this.$dict.load("mstStatus")
2022-07-18 10:55:29 +08:00
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 {
2022-09-08 13:06:54 +08:00
// height: 160px;
2022-07-13 16:59:58 +08:00
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;
2022-08-01 11:25:31 +08:00
span {
display: inline-block;
padding: 0 8px;
border: 1px solid;
border-radius: 6px;
font-size: 26px;
font-weight: normal;
margin-left: 8px;
}
.status0 {
color: #FFA938 !important;
}
.status1 {
color: #FF6758 !important;
}
.status2 {
color: #3399FF !important;
}
.status3 {
color: #FF6758 !important;
}
.status4 {
color: #3399FF !important;
}
.status5 {
color: #1CCEB0 !important;
}
.status6 {
color: #666666 !important;
}
2022-07-13 16:59:58 +08:00
}
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-09-08 13:06:54 +08:00
::v-deep .u-subsection uni-view{
background: #eeef !important;
}
}
2022-09-20 09:23:42 +08:00
::v-deep .AiTable .u-table .u-tr .u-td p{
width: 100%;
word-break: keep-all;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
::v-deep .AiTable .u-table .u-tr .u-td {
width: 30%;
}
2022-07-13 16:59:58 +08:00
}
}
}
2022-07-12 18:10:42 +08:00
</style>