471 lines
12 KiB
Vue
471 lines
12 KiB
Vue
<template>
|
||
<div class="circleDetail">
|
||
<div class="content">
|
||
<div class="header">
|
||
<div class="header_left">
|
||
<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>
|
||
<div>
|
||
创建时间: <span>{{ detail.createTime }}</span>
|
||
</div>
|
||
</div>
|
||
<div class="header_right" @click="toDetail">查看详情</div>
|
||
</div>
|
||
|
||
<div class="pieEcharts">
|
||
<div class="pie_info">
|
||
<div class="tips" v-if="detail.status">
|
||
数据更新于<span>{{ info.remindTime }}</span>
|
||
</div>
|
||
<div class="pie_card">
|
||
<div id="pieEcharts"></div>
|
||
<div class="pie_right">
|
||
<div>
|
||
<span>计划执行成员:</span>
|
||
<span>{{ info.planCount || 0 }}</span>
|
||
</div>
|
||
<div>
|
||
<span>未执行成员:</span>
|
||
<span>{{ info.unExecutedCount || 0 }}</span>
|
||
</div>
|
||
<div>
|
||
<span>已执行成员:</span>
|
||
<span>{{ info.executedCount || 0 }}</span>
|
||
</div>
|
||
<div v-if="type == 'Residents'">
|
||
<span>无法执行成员:</span>
|
||
<span>{{ info.cannotExecuteCount || 0 }}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div v-if="detail.status == 4" class="btn" @click="remindSend">提醒成员发送</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="list_content">
|
||
<div class="list_card">
|
||
<div class="tab" v-show="update">
|
||
<div class="item" :class="subIndex == index? 'bgactive': ''" v-for="(item,index) in subsection" :key="index" @click="changeSub(index)">
|
||
{{ item }}
|
||
</div>
|
||
</div>
|
||
|
||
<AiTable
|
||
:data="tableData"
|
||
:colConfigs="type =='CircleOfFriends'? colConfigs1: colConfigs0"
|
||
v-if="tableData.length"/>
|
||
<AiEmpty v-if="!tableData.length" description="暂无数据"></AiEmpty>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import echarts from "echarts";
|
||
export default {
|
||
name: "circleDetail",
|
||
data() {
|
||
return {
|
||
pieEcharts: null,
|
||
subIndex: 0,
|
||
tableData: [],
|
||
id: "",
|
||
info: {},
|
||
current: 1,
|
||
firstClickTime: "",
|
||
currentClickTime: "",
|
||
detail: {},
|
||
|
||
subsection: [],
|
||
update: true,
|
||
type: "",
|
||
percent: 0,
|
||
};
|
||
},
|
||
computed: {
|
||
colConfigs0() {
|
||
return [
|
||
{ prop: "userName", label: "成员" },
|
||
{ prop: "customerCount", label: "预计送达居民"},
|
||
];
|
||
},
|
||
colConfigs1() {
|
||
return [
|
||
{ prop: "userName", label: "成员" },
|
||
{ prop: "customerCount", label: "预计发送朋友圈"},
|
||
];
|
||
},
|
||
},
|
||
onLoad(o) {
|
||
this.id = o.id;
|
||
this.type = o.type
|
||
},
|
||
watch: {
|
||
type: {
|
||
handler(v) {
|
||
if(v=="CircleOfFriends") {
|
||
this.subsection = ["未执行","已执行"]
|
||
}
|
||
if(v=="Residents") {
|
||
this.subsection = ["未执行","已执行","无法执行"]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
methods: {
|
||
getDetail() {
|
||
this.$http.post(`/app/whchatmomentstask/queryDetailById?id=${this.id}`).then((res) => {
|
||
if (res?.data) {
|
||
this.detail = res.data;
|
||
}
|
||
});
|
||
},
|
||
|
||
toDetail() {
|
||
uni.navigateTo({ url: `./detail?id=${this.id}&type=${this.type}` });
|
||
},
|
||
// 提醒发送
|
||
remindSend() {
|
||
uni.getSystemInfo({
|
||
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
|
||
}
|
||
}
|
||
});
|
||
this.currentClickTime = +new Date();
|
||
let time = this.currentClickTime - this.firstClickTime;
|
||
if (time >= 3600000) {
|
||
this.$http.post("/app/whchatmomentstask/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);
|
||
}
|
||
},
|
||
// 切换分段器
|
||
changeSub(index) {
|
||
this.subIndex = index;
|
||
this.getStatistics();
|
||
},
|
||
// 获取表格数据
|
||
getStatistics() {
|
||
this.$http.post('/app/whchatmomentstask/detailStatistics', null, {
|
||
params: {
|
||
sendStatus: this.subIndex,
|
||
taskId: this.id,
|
||
current: this.current,
|
||
size: 3000,
|
||
},
|
||
})
|
||
.then((res) => {
|
||
if (res?.data) {
|
||
this.info = res.data
|
||
this.tableData = res.data.executedList.records
|
||
setTimeout(()=>{
|
||
this.getPieEcharts()
|
||
}, 1000)
|
||
}
|
||
});
|
||
},
|
||
|
||
// 饼图
|
||
getPieEcharts() {
|
||
this.pieEcharts = echarts.init(document.getElementById("pieEcharts"));
|
||
this.pieEcharts.setOption({
|
||
tooltip: {
|
||
show: false,
|
||
},
|
||
color: ["#1684fc","#ccc"],
|
||
series: [
|
||
{
|
||
name: "任务完成率",
|
||
type: "pie",
|
||
radius: ["50%", "70%"],
|
||
avoidLabelOverlap: false,
|
||
label: {
|
||
normal: {
|
||
show: false,
|
||
position: "center",
|
||
},
|
||
},
|
||
labelLine: {
|
||
show: false,
|
||
},
|
||
data: [
|
||
{
|
||
value: this.info.executedCount,
|
||
name: "已执行成员",
|
||
label: {
|
||
normal: {
|
||
show: true,
|
||
formatter: ({ name, value }) => {
|
||
this.percent = value / this.info.planCount * 100 || 0
|
||
// console.log(this.percent)
|
||
return `{name|任务达成率\n\n}{value|${ this.percent }%}`
|
||
},
|
||
textStyle: {
|
||
fontSize: 16,
|
||
},
|
||
rich: {
|
||
name: {
|
||
color: "#999",
|
||
|
||
},
|
||
value: {
|
||
color: "#000000",
|
||
fontSize: 26,
|
||
},
|
||
},
|
||
},
|
||
},
|
||
},
|
||
{
|
||
value: this.info.planCount - this.info.executedCount,
|
||
name: "未执行成员"
|
||
},
|
||
],
|
||
},
|
||
],
|
||
});
|
||
},
|
||
},
|
||
onShow() {
|
||
document.title = this.type == "Residents"? '群发居民':'群发朋友圈';
|
||
this.$dict.load("mstStatus")
|
||
this.getStatistics();
|
||
this.getDetail();
|
||
},
|
||
mounted() {
|
||
this.getPieEcharts();
|
||
},
|
||
};
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.circleDetail {
|
||
::v-deep .AiTopFixed .content {
|
||
padding: 0;
|
||
}
|
||
::v-deep .emptyWrap {
|
||
border: 2px solid #d0d4dc;
|
||
border-radius: 8px;
|
||
padding-bottom: 20px;
|
||
}
|
||
.tab-select {
|
||
width: 100%;
|
||
height: 96px;
|
||
line-height: 96px;
|
||
background: #3975c6;
|
||
display: flex;
|
||
|
||
.item {
|
||
flex: 1;
|
||
text-align: center;
|
||
font-size: 28px;
|
||
font-family: PingFangSC-Regular, PingFang SC;
|
||
color: #cddcf0;
|
||
}
|
||
|
||
.active {
|
||
font-family: PingFangSC-Medium, PingFang SC;
|
||
font-weight: 500;
|
||
position: relative;
|
||
color: #fff;
|
||
|
||
span {
|
||
width: 48px;
|
||
height: 4px;
|
||
background: #fff;
|
||
position: absolute;
|
||
bottom: 14px;
|
||
left: 50%;
|
||
margin-left: -24px;
|
||
}
|
||
}
|
||
}
|
||
|
||
.header {
|
||
padding: 32px;
|
||
box-sizing: border-box;
|
||
background: #fff;
|
||
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;
|
||
|
||
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;
|
||
}
|
||
}
|
||
div:last-child {
|
||
color: #666666;
|
||
}
|
||
}
|
||
.header_right {
|
||
width: 120px;
|
||
color: #5297ff;
|
||
}
|
||
}
|
||
|
||
.pieEcharts {
|
||
width: 100%;
|
||
padding: 32px;
|
||
box-sizing: border-box;
|
||
.pie_info {
|
||
background: #fff;
|
||
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;
|
||
}
|
||
::v-deep .emptyWrap {
|
||
width: 60%;
|
||
}
|
||
.pie_right {
|
||
width: 40%;
|
||
padding-right: 30px;
|
||
box-sizing: border-box;
|
||
div {
|
||
margin-bottom: 10px;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
}
|
||
}
|
||
}
|
||
.btn {
|
||
margin: 0 auto;
|
||
width: 90%;
|
||
height: 80px;
|
||
line-height: 80px;
|
||
text-align: center;
|
||
color: #fff;
|
||
background: #3aa0ff;
|
||
border-radius: 8px;
|
||
}
|
||
}
|
||
}
|
||
|
||
.list_content {
|
||
padding: 0 32px 32px 32px;
|
||
box-sizing: border-box;
|
||
|
||
.list_card {
|
||
background: #fff;
|
||
border-radius: 16px;
|
||
padding: 30px 30px;
|
||
|
||
.tab {
|
||
margin-bottom: 34px;
|
||
|
||
::v-deep .u-subsection uni-view{
|
||
background: #eeef !important;
|
||
}
|
||
}
|
||
|
||
::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%;
|
||
}
|
||
}
|
||
}
|
||
.tab {
|
||
height: 70px;
|
||
background-color: #eeeeef;
|
||
padding: 3px 4px;
|
||
border-radius: 10px;
|
||
box-sizing: border-box;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
.item {
|
||
flex: 1;
|
||
height: 58px;
|
||
line-height: 58px;
|
||
align-self: center;
|
||
text-align: center;
|
||
border-radius: 16px;
|
||
color: #606266;
|
||
}
|
||
.bgactive {
|
||
background: #fff;
|
||
font-weight: 600;
|
||
color: #3aa0ff;
|
||
}
|
||
}
|
||
}
|
||
</style> |