协同宣发1.1

This commit is contained in:
shijingjing
2022-09-14 10:40:27 +08:00
parent ca01f2af6c
commit 07afc7bc38
6 changed files with 566 additions and 42 deletions

View File

@@ -150,7 +150,12 @@ export default {
},
toDetail(item) {
uni.navigateTo({url: `./cooperationDetail?id=${item.id}&time=${item.createTime}`})
if(this.tabIndex == 0) {
uni.navigateTo({url: `./cooperationDetail?id=${item.id}&time=${item.createTime}`})
} else {
alert('hhh')
}
},
searchBtn() {
this.current = 1

View File

@@ -110,7 +110,7 @@
<u-popup v-model="showUpload" mode="bottom" border-radius="24">
<div class="uploadPopup">
<div class="upload_card" v-for="(item,index) in uploadList" :key="index">
<div class="upload_card" v-for="(item,index) in upload" :key="index">
<div class="upload_item">{{ item.title }}</div>
<div class="upload_list">
<div class="list_item" v-for="(e, i) in item.list" :key="i" @click="uploadBtn(e.msgType)">
@@ -233,6 +233,24 @@ export default {
]
}
],
uploadCircle: [
{
title: '从本地上传',
list: [
{
icon: 'https://cdn.cunwuyun.cn/dvcp/announce/img.png',
name: '图片',
msgType: 'image'
},
{
icon: 'https://cdn.cunwuyun.cn/dvcp/announce/video.png',
name: '视频',
msgType: 'video'
},
]
}
],
upload: [],
midiaIds: [],
sum: ''
}
@@ -317,14 +335,19 @@ export default {
let formData = new FormData()
formData.append('file', img)
formData.append('type', type)
this.$http.post('/app/wxcp/upload/uploadFile', formData,{
let url = ''
if(this.type=='Residents' || this.type=='ResidentsGroup') {
url = `/app/wxcp/upload/uploadFile`
} else if(this.type=='CircleOfFriends') {
url = `/app/wxcp/upload/uploadAttachment?attachmentType=1&mediaType=${type}`
}
this.$http.post(url, formData,{
withCredentials: false
}).then((res) => {
uni.hideLoading()
if (res?.data) {
this.$u.toast('上传成功!')
this.showUpload = false
// this.files.push(res.data)
this.files.push({
...res.data.file,
media: res.data.media,
@@ -351,6 +374,7 @@ export default {
confirm() {
if(this.flag) return
this.form.contents = []
// 文本
const firstContent = [
{
@@ -448,6 +472,9 @@ export default {
if(res?.code == 0) {
this.flag = false
this.$u.toast("新增成功")
setTimeout(() => {
navigateBack()
}, 600)
}
}).catch((err)=>{
this.flag = false
@@ -488,11 +515,15 @@ export default {
this.forms.sendScope = this.form.sendScope
this.forms.groupList = this.form.wxGroups
this.sum = this.form.wxGroups.reduce((pre, cur) => pre + cur.customerCount, 0)
this.upload = this.uploadList
} else if(this.type=='CircleOfFriends') {
this.forms.taskType = 0
this.forms.sendScope = this.form.sendScope
this.forms.executorList = this.form.wxGroups
this.sum = this.form.wxGroups.reduce((pre, cur) => pre + cur.customerCount, 0)
this.upload = this.uploadCircle
} else if(this.type == 'ResidentsGroup') {
this.upload = this.uploadList
}
this.forms.taskTitle = this.form.taskTitle

View File

@@ -0,0 +1,482 @@
<template>
<div class="circleDetail">
<!-- <AiTopFixed>
<div class="tab-select">
<div
class="item"
:class="tabIndex == index ? 'active' : ''"
v-for="(item, index) in tabs"
:key="index"
@click="tabClick(index)"
>
{{ item }}<span></span>
</div>
</div>
</AiTopFixed> -->
<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>{{ 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>{{
tabIndex == 0 ? "计划执行成员:" : "计划送达居民群:"
}}</span>
<span>{{ info.planCount || 0 }}</span>
</div>
<div>
<span>{{
tabIndex == 0 ? "未执行成员:" : "未送达居民群:"
}}</span>
<span>{{ info.unExecutedCount || 0 }}</span>
</div>
<div>
<span>{{
tabIndex == 0 ? "已执行成员:" : "已送达居民群:"
}}</span>
<span>{{ info.executedCount || 0 }}</span>
</div>
<div>
<span>{{
tabIndex == 0 ? "无法执行成员:" : "无法送达居民群:"
}}</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">
<u-subsection
:list="subsection"
mode="button"
activeColor="#3c9cff"
:current="subIndex"
@change="changeSub"
></u-subsection>
</div>
<AiTable
:data="tableData"
:colConfigs="tabIndex == 0 ? colConfigs0 : colConfigs1"
v-if="tableData.length"/>
<AiEmpty v-if="!tableData.length" description="暂无数据"></AiEmpty>
</div>
</div>
</div>
</div>
</template>
<script>
import echarts from "echarts";
export default {
data() {
return {
tabs: ["成员统计", "居民群统计"],
tabIndex: 0,
pieEcharts: null,
subIndex0: 0,
subIndex1: 0,
tableData: [],
createTime: "",
id: "",
info: {},
current: 1,
firstClickTime: "",
currentClickTime: "",
detail: {},
subsection: [
{ name: "未执行" },
{ name: "已执行" },
{ name: "无法执行" },
],
update: true,
};
},
computed: {
colConfigs0() {
return [
{ prop: "groupOwnerName", label: "成员" },
{ label: "预计送达居民", prop: "groupCount" },
];
},
colConfigs1() {
return [
{ label: "居民群", prop: "groupName" },
{ label: "群人数", prop: "memberCount" },
{ slot: "groupOwnerId", label: "群主" },
];
},
},
onLoad(o) {
this.id = o.id;
this.createTime = o.time;
},
methods: {
tabClick(index) {
this.tabIndex = index;
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()
}
this.getStatistics();
},
getDetail() {
this.$http
.post(`/app/appmasssendingtask/queryDetailById?id=${this.id}`)
.then((res) => {
if (res?.data) {
this.detail = res.data;
}
});
},
toDetail() {
uni.navigateTo({ url: `./detail?id=${this.id}` });
},
// 提醒发送
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/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);
}
},
// 切换分段器
changeSub(index) {
this.subIndex = index;
this.getStatistics();
},
// 获取数据
getStatistics() {
this.$http
.post(`/app/appmasssendingtask/detailStatistics`, null, {
params: {
type: this.tabIndex,
sendStatus: this.tabIndex==0? this.subIndex0: this.subIndex1,
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: this.tabIndex == 0 ? "任务完成率" : "群发送达率",
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 }) => {
let num = value / this.info.planCount * 100
if (this.tabIndex == 0) {
return num % 1==0? `{name|任务达成率\n\n}{value|${num}%}`: `{name|任务达成率\n\n}{value|${ num.toFixed(1) }%}`;
} else {
return num % 1==0? `{name|群发送达率\n\n}{value|${num}%}`: `{name|群发送达率\n\n}{value|${ num.toFixed(1) }%}`;
}
},
textStyle: {
fontSize: 16,
},
rich: {
name: {
color: "#999",
},
value: {
color: "#000000",
fontSize: 26,
},
},
},
},
},
{
value: this.info.planCount - this.info.executedCount ,
name: "未执行成员"
},
],
},
],
});
},
},
onShow() {
document.title = "群发居民群统计";
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;
}
}
}
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<div class="cooperationDetail">
<!-- <AiTopFixed>
<AiTopFixed>
<div class="tab-select">
<div
class="item"
@@ -12,7 +12,7 @@
{{ item }}<span></span>
</div>
</div>
</AiTopFixed> -->
</AiTopFixed>
<div class="content">
<div class="header">
@@ -66,13 +66,23 @@
<div class="list_content">
<div class="list_card">
<div class="tab" v-show="update">
<div class="tab" v-show="update0">
<u-subsection
:list="subsection"
:list="subsection0"
mode="button"
activeColor="#3c9cff"
:current="subIndex"
@change="changeSub"
: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"
></u-subsection>
</div>
@@ -106,12 +116,18 @@ export default {
currentClickTime: "",
detail: {},
subsection: [
subsection0: [
{ name: "未执行" },
{ name: "已执行" },
{ name: "无法执行" },
],
update: true,
subsection1: [
{ name: "未送达" },
{ name: "已送达" },
{ name: "无法送达" },
],
update0: true,
update1: false,
};
},
computed: {
@@ -125,7 +141,7 @@ export default {
return [
{ label: "居民群", prop: "groupName" },
{ label: "群人数", prop: "memberCount" },
{ slot: "groupOwnerId", label: "群主" },
{ prop: "groupOwnerName", label: "群主" },
];
},
},
@@ -475,6 +491,9 @@ export default {
.tab {
margin-bottom: 34px;
::v-deep .u-subsection uni-view{
background: #eeef !important;
}
}
}
}

View File

@@ -14,7 +14,6 @@
</div>
</div>
</div>
<div class="btn">
<div class="submitBtn" @click="submit">确定</div>
</div>
@@ -28,9 +27,9 @@ export default {
return {
value: '',
checkList: [
{ name: '全部居民群', checked: true, value: '0'},
{ name: '按部门选择', checked: false, value: '1'},
{ name: '按网格选择', checked: false, value: '2' }
{ name: '全部居民群', value: '0'},
{ name: '按部门选择', value: '1'},
{ name: '按网格选择', value: '2'}
],
showContent: false,
sendType: '',
@@ -49,35 +48,27 @@ export default {
},
methods: {
checkBtn(e) {
// this.checkList.forEach(v=> v.checked = false)
// e.checked = true
if(e.value == '1' || e.value == '2') {
uni.navigateTo({url: `./scopedSelect?type=${e.value}&sendType=${this.sendType}`})
}
this.sendScope = e.value;
uni.setStorageSync('sendScope', this.sendScope)
// uni.clearStorageSync('ResidentTags')
// uni.clearStorageSync('ResidentTagsRemove')
// uni.clearStorageSync('circleTags')
// uni.clearStorageSync('circleTagsRemove')
},
submit() {
if(this.sendType == 'ResidentsGroup') {
this.getWxGroups()
} else if(this.sendType == 'Residents' || this.sendType == 'CircleOfFriends') {
this.getSendScope()
}
uni.setStorageSync('sendScope', this.sendScope)
// setTimeout(() => {
uni.navigateBack({
// success: () => {
// uni.$emit('predictUser', this.wxGroups)
// }
this.getWxGroups().then(()=>{
setTimeout(() => {
uni.navigateBack()
}, 600)
})
// }, 1000)
} else if(this.sendType == 'Residents' || this.sendType == 'CircleOfFriends') {
this.getSendScope().then(()=>{
setTimeout(() => {
uni.navigateBack()
}, 600)
})
}
uni.setStorageSync('sendScope', this.sendScope)
},
// 群发居民群
getWxGroups() {

View File

@@ -150,7 +150,7 @@ export default {
return [
{ label: "居民群", prop: "groupName" },
{ label: "群人数", prop: "memberCount" },
{ prop: "groupOwnerName", label: "群主" },
{ slot: "groupOwnerId", label: "群主" },
];
},
},
@@ -510,10 +510,6 @@ export default {
background: #eeef !important;
}
}
.sub-select {
}
}
}
}