Files
dvcp_v2_wechat_app/src/project/weiyang/AppResidentFile/AppResidentFile.vue

697 lines
19 KiB
Vue
Raw Normal View History

2024-07-08 14:10:18 +08:00
<template>
<div class="AppResidentFile">
2024-07-12 11:56:16 +08:00
<u-navbar back-icon-color="#000" title="居民信息管理" title-color="#000" title-width="300" title-size="32"
:title-bold="true" :background="backgroundNavbar" :is-fixed="true" height="44"></u-navbar>
<div class="header-content-bg">
<img src="https://cdn.sinoecare.com/i/2024/07/12/6690a1303d423.png" alt="">
</div>
<div class="statistics-content" v-if="currentTabBar == 0">
2024-07-16 10:12:00 +08:00
<div class="top-tabs">
2024-07-12 11:56:16 +08:00
<u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="96" bg-color="#fff" inactive-color="#222"
active-color="#1D2229" :bar-style="barStyle" font-size="34" @change="change"></u-tabs>
</div>
<div class="statistics-chart" v-if="currentTabs == 0">
<div class="statistics-num">
<div class="item">
<div class="total color-026AF2">{{ groupSum }}</div>
<div class="label">群聊总数</div>
</div>
<div class="item">
<div class="total color-5476A2">{{ todayList1.total }}</div>
<div class="label">群成员</div>
</div>
<div class="item">
<div class="total color-4AC98E">{{ todayList1.increase }}</div>
<div class="label">今日入群</div>
</div>
<div class="item">
<div class="total color-026AF2">{{ todayList1.decrease }}</div>
<div class="label">今日退群</div>
2024-07-08 14:10:18 +08:00
</div>
</div>
2024-07-12 11:56:16 +08:00
<div class="echartes">
<canvas
canvas-id="qtjid"
id="qtjid"
class="e-canvas"
@tap="chartClick"
/>
2024-07-08 14:10:18 +08:00
</div>
</div>
2024-07-12 11:56:16 +08:00
<div class="statistics-chart" v-if="currentTabs == 1">
<div class="statistics-num">
<div class="item">
<div class="total color-026AF2">{{ todayList2.total }}</div>
<div class="label">居民总数</div>
</div>
<div class="item">
<div class="total color-4AC98E">{{ todayList2.increase }}</div>
<div class="label">今日新增</div>
</div>
<div class="item">
<div class="total color-FF8002">{{ todayList2.decrease }}</div>
<div class="label">今日流失</div>
2024-07-08 14:10:18 +08:00
</div>
</div>
2024-07-12 11:56:16 +08:00
<div class="echartes">
<canvas
canvas-id="tjid"
id="tjid"
class="e-canvas"
@tap="chartClick"
/>
2024-07-08 14:10:18 +08:00
</div>
</div>
</div>
2024-07-12 11:56:16 +08:00
<div class="list-content" v-if="currentTabBar == 1">
<!-- <AiTopFixed>
<u-search
placeholder="请输入昵称、姓名"
:show-action="false"
search-icon-color="#ccc"
v-model="search.name"
@search="(page1.current = 1), getList()"
/>
2024-07-08 14:10:18 +08:00
<AiCell>
2024-07-12 11:56:16 +08:00
<b slot="label" class="title"
><i v-html="page1.total || 0" />个居民</b
>
2024-07-08 14:10:18 +08:00
</AiCell>
2024-07-12 11:56:16 +08:00
</AiTopFixed> -->
2024-07-08 14:10:18 +08:00
2024-07-12 11:56:16 +08:00
<div class="search-top">
<u-search placeholder="姓名/联系方式/身份证后6位" v-model="search.name" :show-action="false" bg-color="#F4F5FA" search-icon-color="#F4F5FA"
color="#666" height="72" @search="(page1.current = 1), getList()" ></u-search>
</div>
<div class="user-list-content">
<!-- <AiCell
v-for="item in data"
:key="item.id"
@click.native="showResident(item)"
>
2024-07-08 14:10:18 +08:00
<template #label>
<AiImage :src="item.avatar" preview />
</template>
<div class="card wrap start" flex>
<b>{{ item.name }}</b>
2024-07-12 11:56:16 +08:00
<div flex class="tag" v-for="(tag, j) in item.tags" :key="j">
{{ tag.tagName }}
</div>
<div
class="realName"
shrink
v-html="`真实姓名:${item.realName || '-'}`"
/>
2024-07-08 14:10:18 +08:00
</div>
2024-07-12 11:56:16 +08:00
</AiCell> -->
<div class="item" v-for="item in data" :key="item.id" @click.native="showResident(item)">
<div class="left-img">
<img :src="item.avatar" alt="">
</div>
<div class="right-info">
<div class="name-flex">
<div>{{ item.name }}</div>
<p>
<span flex class="tag" v-for="(tag, j) in item.tags" :key="j">
{{ tag.tagName }}
</span>
</p>
</div>
<p class="item-idnumber">真实姓名{{ item.idNumber }} {{item.realName }}</p>
</div>
</div>
2024-07-08 14:10:18 +08:00
</div>
</div>
2024-07-12 11:56:16 +08:00
<div class="list-content" v-if="currentTabBar == 2">
<!-- <AiTopFixed>
<u-search
placeholder="请输入群名、群主名"
:show-action="false"
search-icon-color="#ccc"
v-model="search.name"
@search="(page2.current = 1), getList()"
/>
2024-07-08 14:10:18 +08:00
<AiCell>
2024-07-12 11:56:16 +08:00
<b slot="label" class="title"
><i v-html="page2.total || 0" />个居民群</b
>
2024-07-08 14:10:18 +08:00
</AiCell>
2024-07-12 11:56:16 +08:00
</AiTopFixed> -->
<div class="search-top">
<u-search placeholder="请输入群名、群主名" v-model="search.name" :show-action="false" bg-color="#F4F5FA" search-icon-color="#F4F5FA"
color="#666" height="72" @search="(page2.current = 1), getList()" ></u-search>
</div>
2024-07-08 14:10:18 +08:00
2024-07-12 11:56:16 +08:00
<!-- <div class="mainPane">
<AiCell
v-for="(item, i) in list"
:key="i"
@click.native="toGroupList(item)"
>
2024-07-08 14:10:18 +08:00
<template #label>
<AiImage :src="item.avatar" preview />
</template>
<div class="card column start" flex>
<div flex class="groupName">
2024-07-12 11:56:16 +08:00
<b>{{ item.name || "群聊" }}</b>
<div class="personCount" v-if="item.personCount">
({{ item.personCount }})
</div>
2024-07-08 14:10:18 +08:00
</div>
<div class="owner" v-html="`群主:${item.ownerName}`" />
<div flex class="trends">
<div flex v-html="`今日入群:<em>${item.increase || 0}</em>`" />
<div flex v-html="`今日退群:<p>${item.decrease || 0}</p>`" />
</div>
</div>
</AiCell>
2024-07-12 11:56:16 +08:00
</div> -->
<div class="user-list-content">
<div class="item group-item" v-for="item in list" :key="item.id" @click.native="toGroupList(item)">
<div class="left-img">
<img src="https://cdn.sinoecare.com/i/2024/07/12/66908ea79780f.png" alt="">
</div>
<div class="right-info">
<div class="name-flex">
<div>{{ item.name || "群聊" }}</div>
</div>
<p class="item-idnumber">{{ item.personCount }} | 群主:{{ item.ownerName }}</p>
</div>
</div>
2024-07-08 14:10:18 +08:00
</div>
</div>
2024-07-12 11:56:16 +08:00
<div class="footer-tabs">
2024-07-08 14:10:18 +08:00
<div class="item" @click="changeTab(index)" v-for="(item, index) in lists" :key="index">
2024-07-12 11:56:16 +08:00
<img :src="currentTabBar == index ? item.selectedIconPath : item.iconPath" alt=""/>
2024-07-08 14:10:18 +08:00
<p :class="currentTabBar == index ? 'color-3267F0' : ''">{{ item.text }}</p>
</div>
</div>
</div>
</template>
<script>
2024-07-12 11:56:16 +08:00
import uCharts from "./components/echarts/u-charts.min.js";
var uChartsInstance = {};
import { mapState } from "vuex";
2024-07-08 14:10:18 +08:00
export default {
2024-07-12 11:56:16 +08:00
name: "AppResidentFile",
appName: "居民信息管理",
customNavigation: true,
2024-07-08 14:10:18 +08:00
data() {
return {
2024-07-12 11:56:16 +08:00
backgroundNavbar: {
background: 'url(https://cdn.sinoecare.com/i/2024/07/12/6690a1309c7d3.png) no-repeat',
backgroundSize: 'cover',
},
2024-07-08 14:10:18 +08:00
lists: [
{
2024-07-12 11:56:16 +08:00
iconPath: "https://cdn.sinoecare.com/i/2024/07/10/668dec966fb64.png",
selectedIconPath:
"https://cdn.sinoecare.com/i/2024/07/10/668dec96d5b3a.png",
text: "统计分析",
2024-07-08 14:10:18 +08:00
customIcon: false,
},
{
2024-07-12 11:56:16 +08:00
iconPath: "https://cdn.sinoecare.com/i/2024/07/10/668dec9437d53.png",
selectedIconPath:
"https://cdn.sinoecare.com/i/2024/07/10/668dec960242f.png",
text: "居民列表",
2024-07-08 14:10:18 +08:00
customIcon: false,
},
{
2024-07-12 11:56:16 +08:00
iconPath: "https://cdn.sinoecare.com/i/2024/07/10/668dec94c98d4.png",
selectedIconPath:
"https://cdn.sinoecare.com/i/2024/07/10/668dec957e497.png",
text: "居民群列表",
2024-07-08 14:10:18 +08:00
customIcon: false,
},
],
currentTabBar: 0,
currentTabs: 0,
tabList: [
{
2024-07-12 11:56:16 +08:00
name: "居民群统计",
2024-07-08 14:10:18 +08:00
},
{
2024-07-12 11:56:16 +08:00
name: "居民统计",
2024-07-08 14:10:18 +08:00
},
],
2024-07-12 11:56:16 +08:00
barStyle: {
'width': '20px',
'height': '4px',
'border-radius': '3px',
'bottom': '-4px',
'background': '#026AF2'
},
2024-07-08 14:10:18 +08:00
Echarts1: null,
Echarts2: null,
2024-07-12 11:56:16 +08:00
areaId: "",
2024-07-08 14:10:18 +08:00
current: 1,
2024-07-12 11:56:16 +08:00
keyword: "",
2024-07-08 14:10:18 +08:00
data: [],
2024-07-12 11:56:16 +08:00
search: { name: "" },
2024-07-08 14:10:18 +08:00
list: [],
weekList: [],
2024-07-12 11:56:16 +08:00
groupSum: "",
2024-07-08 14:10:18 +08:00
todayList1: [],
todayList2: [],
2024-07-12 11:56:16 +08:00
counts1: "",
counts2: "",
2024-07-08 14:10:18 +08:00
page2: { current: 1, size: 10, total: 0 },
2024-07-12 11:56:16 +08:00
search2: { name: "" },
2024-07-08 14:10:18 +08:00
page1: { current: 1, size: 10, total: 0 },
2024-07-12 11:56:16 +08:00
search1: { name: "" },
cWidth: 750,
cHeight: 500,
};
2024-07-08 14:10:18 +08:00
},
computed: {
2024-07-12 11:56:16 +08:00
...mapState(["user", "global"]),
2024-07-08 14:10:18 +08:00
},
onLoad() {
2024-07-12 11:56:16 +08:00
//this.Echarts1 = echarts.init(this.$refs.echarts1)
// this.getServerData()
this.areaId = this.user.areaId;
this.getEchart1();
this.page1.current == 1;
this.getList();
2024-07-08 14:10:18 +08:00
},
2024-07-12 11:56:16 +08:00
onShow() {
uni.setNavigationBarColor({
frontColor: 'black',
backgroundColor: '#ffffff'
})
2024-07-08 14:10:18 +08:00
},
methods: {
2024-07-12 11:56:16 +08:00
drawCharts(id, data) {
const ctx = uni.createCanvasContext(id, this);
uChartsInstance[id] = new uCharts({
type: "line",
context: ctx,
width: 346,
height: 232,
categories: data.categories,
series: data.series,
animation: true,
background: "#FFFFFF",
color: ["#4B87FE", "#4AC98E", "#FF8002"],
padding: [15, 10, 0, 15],
enableScroll: false,
legend: {},
xAxis: {
disableGrid: true,
},
yAxis: {
gridType: "dash",
dashLength: 2,
},
extra: {
line: {
type: "straight",
width: 2,
activeType: "hollow",
},
},
});
},
chartClick(e) {
uChartsInstance[e.target.id].showToolTip(e);
},
2024-07-08 14:10:18 +08:00
// 居民列表
getList() {
this.$instance
2024-07-12 11:56:16 +08:00
.post("/app/wxcp/wxcustomer/list", null, {
2024-07-08 14:10:18 +08:00
params: { ...this.page1, ...this.search, type: 1 },
})
.then((res) => {
if (res?.data) {
if (this.page1.current > 1) {
2024-07-12 11:56:16 +08:00
this.data = [...this.data, ...res.data.records];
} else this.data = res.data.records;
this.page1.total = res.data.total;
2024-07-08 14:10:18 +08:00
}
2024-07-12 11:56:16 +08:00
});
2024-07-08 14:10:18 +08:00
},
// reachBottom() {
// if (this.page1.total > this.list.length) {
// this.page1.current++
// this.getList()
// }
// },
showResident({ id }) {
id &&
uni.navigateTo({
2024-07-12 11:56:16 +08:00
url: "./resident?id=" + id,
});
2024-07-08 14:10:18 +08:00
},
// 居民群列表
getList2() {
this.$instance
2024-07-12 11:56:16 +08:00
.post("/app/wxcp/wxgroup/list", null, {
2024-07-08 14:10:18 +08:00
params: { ...this.page2, ...this.search },
})
.then((res) => {
if (res?.data) {
let meta = res.data.records?.map((e) => ({
...e,
2024-07-12 11:56:16 +08:00
avatar: e?.avatar || this.$cdn + "groupAvatar.png",
}));
2024-07-08 14:10:18 +08:00
if (this.page2.current > 1) {
2024-07-12 11:56:16 +08:00
this.list = [...this.list, ...meta];
} else this.list = meta;
this.page2.total = res.data.total;
2024-07-08 14:10:18 +08:00
}
2024-07-12 11:56:16 +08:00
});
2024-07-08 14:10:18 +08:00
},
// reachBottom() {
// if (this.page2.total > this.list.length) {
// this.page2.current = this.page2.current + 1
// this.getList2()
// }
// },
toGroupList(item) {
uni.navigateTo({
url: `./GroupList?id=${item.id}`,
2024-07-12 11:56:16 +08:00
});
2024-07-08 14:10:18 +08:00
},
// 居民群统计
getEchart1() {
this.$instance.post(`/app/wxcp/wxgroup/groupStatistic`).then((res) => {
if (res.code === 0) {
2024-07-12 11:56:16 +08:00
this.weekList = res.data.list;
this.groupSum = res.data.groupSum;
this.todayList1 = res.data.today;
var chartData = {
categories: Object.keys(this.weekList).map((e) =>
e.substring(e.length - 5, e.length)
),
series: [
{
name: "居民总数",
data: Object.values(this.weekList).map((e) => e.total),
2024-07-08 14:10:18 +08:00
},
2024-07-12 11:56:16 +08:00
{
name: "入群人数",
data: Object.values(this.weekList).map((e) => e.increase),
2024-07-08 14:10:18 +08:00
},
2024-07-12 11:56:16 +08:00
{
name: "退群人数",
data: Object.values(this.weekList).map((e) => e.decrease),
2024-07-08 14:10:18 +08:00
},
2024-07-12 11:56:16 +08:00
],
};
this.drawCharts("qtjid", chartData);
}
});
2024-07-08 14:10:18 +08:00
},
2024-07-12 11:56:16 +08:00
// 居民统计
getEchart2() {
this.$instance
.post(
`/app/wxcp/wxcustomerlog/customerStatistic?areaId=${this.user.areaId}`
)
.then((res) => {
if (res.code === 0) {
this.todayList2 = res.data.today;
var chartData = {
categories: Object.keys(res.data.list).map((e) =>
e.substring(e.length - 5, e.length)
),
series: [
{
name: "居民总数",
data: Object.values(res.data.list).map((e) => e.total),
2024-07-08 14:10:18 +08:00
},
2024-07-12 11:56:16 +08:00
{
name: "新增居民数",
data: Object.values(res.data.list).map((e) => e.increase),
2024-07-08 14:10:18 +08:00
},
2024-07-12 11:56:16 +08:00
{
name: "流失居民数",
data: Object.values(res.data.list).map((e) => e.decrease),
2024-07-08 14:10:18 +08:00
},
2024-07-12 11:56:16 +08:00
],
};
console.log(chartData);
this.drawCharts("tjid", chartData);
}
});
2024-07-08 14:10:18 +08:00
},
changeTab(e) {
2024-07-12 11:56:16 +08:00
this.currentTabBar = e;
2024-07-08 14:10:18 +08:00
if (this.currentTabBar == 0) {
2024-07-12 11:56:16 +08:00
this.getList();
2024-07-08 14:10:18 +08:00
this.$nextTick(() => {
if (this.currentTabs == 0) {
2024-07-12 11:56:16 +08:00
this.getEchart1();
2024-07-08 14:10:18 +08:00
}
if (this.currentTabs == 1) {
2024-07-12 11:56:16 +08:00
this.getEchart2();
2024-07-08 14:10:18 +08:00
}
2024-07-12 11:56:16 +08:00
});
2024-07-08 14:10:18 +08:00
}
if (this.currentTabBar == 1) {
2024-07-12 11:56:16 +08:00
this.page1.current == 1;
this.getList();
2024-07-08 14:10:18 +08:00
}
if (this.currentTabBar == 2) {
2024-07-12 11:56:16 +08:00
this.page2.current == 1;
this.getList2();
2024-07-08 14:10:18 +08:00
}
},
change(index) {
2024-07-12 11:56:16 +08:00
this.currentTabs = index;
2024-07-08 14:10:18 +08:00
this.$nextTick(() => {
if (index == 0) {
2024-07-12 11:56:16 +08:00
this.getEchart1();
2024-07-08 14:10:18 +08:00
} else {
2024-07-12 11:56:16 +08:00
this.getEchart2();
2024-07-08 14:10:18 +08:00
}
2024-07-12 11:56:16 +08:00
});
2024-07-08 14:10:18 +08:00
},
},
onReachBottom() {
if (this.currentTabBar == 1) {
2024-07-12 11:56:16 +08:00
this.page1.current++;
this.getList();
2024-07-08 14:10:18 +08:00
}
if (this.currentTabBar == 2) {
2024-07-12 11:56:16 +08:00
this.page2.current++;
this.getList2();
2024-07-08 14:10:18 +08:00
}
},
2024-07-12 11:56:16 +08:00
};
2024-07-08 14:10:18 +08:00
</script>
<style scoped lang="scss">
uni-page-body {
height: 100%;
}
.AppResidentFile {
height: 100%;
2024-07-12 11:56:16 +08:00
.header-content-bg {
width: 100%;
position: relative;
img {
width: 100%;
height: 592px;
position: absolute;
z-index: -1;
2024-07-08 14:10:18 +08:00
}
}
2024-07-12 11:56:16 +08:00
.statistics-content {
padding-bottom: 216px;
2024-07-16 10:12:00 +08:00
.top-tabs {
padding: 32px;
box-sizing: border-box;
::v-deep .u-tabs {
border-radius: 16px;
}
}
2024-07-12 11:56:16 +08:00
.statistics-chart {
padding: 0 32px;
.statistics-num {
display: flex;
background: #fff;
width: 100%;
padding: 36px 0;
border-radius: 16px;
.item {
2024-07-08 14:10:18 +08:00
flex: 1;
2024-07-12 11:56:16 +08:00
text-align: center;
.total {
line-height: 56px;
font-family: DINAlternate-Bold;
font-weight: 700;
font-size: 48px;
margin-bottom: 10px;
}
.label {
line-height: 40px;
font-family: PingFangSC-Regular;
font-size: 28px;
color: #666;
}
.color-026AF2{
color: #026AF2;
}
.color-5476A2{
color: #5476A2;
}
.color-4AC98E{
color: #4AC98E;
}
.color-FF8002{
color: #FF8002;
}
2024-07-08 14:10:18 +08:00
}
}
2024-07-12 11:56:16 +08:00
.echartes {
background: #fff;
box-sizing: border-box;
width: 686px;
height: 528px;
background: #fff;
border-radius: 16px;
margin: 32px 0 0 0;
padding: 32px 32px 32px 0;
box-sizing: border-box;
.e-canvas {
2024-07-08 14:10:18 +08:00
width: 100%;
2024-07-12 11:56:16 +08:00
height: 100%;
2024-07-08 14:10:18 +08:00
}
}
}
}
2024-07-12 11:56:16 +08:00
.list-content {
width: 686px;
height: calc(100% - 216px);
background: #FFF;
border-radius: 16px;
margin: 32px 0 0 32px;
position: relative;
.search-top {
position: absolute;
top: 0;
left: 0;
padding: 28px 32px;
width: 686px;
box-sizing: border-box;
background-color: #fff;
z-index: 99;
2024-07-08 14:10:18 +08:00
}
2024-07-12 11:56:16 +08:00
.user-list-content {
background-color: #fff;
padding-top: 128px;
.item {
display: flex;
padding: 24px 32px 0;
box-sizing: border-box;
.left-img {
width: 112px;
img {
width: 80px;
height: 80px;
border-radius: 50%;
2024-07-08 14:10:18 +08:00
}
2024-07-12 11:56:16 +08:00
}
.right-info {
width: calc(100% - 112px);
padding-bottom: 24px;
border-bottom: 1px solid #eee;
.name-flex {
display: flex;
justify-content: space-between;
margin-bottom: 8px;
div {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 32px;
color: #333;
line-height: 44px;
}
p {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: 252px;
line-height: 44px;
font-family: PingFangSC-Regular;
font-size: 28px;
color: #999;
text-align: right;
}
2024-07-08 14:10:18 +08:00
}
2024-07-12 11:56:16 +08:00
.item-idnumber {
line-height: 36px;
font-family: PingFangSC-Regular;
font-size: 26px;
color: #999;
2024-07-08 14:10:18 +08:00
}
}
}
2024-07-12 11:56:16 +08:00
.group-item {
.left-img {
width: 136px;
img {
width: 112px;
height: 112px;
border-radius: 4px;
}
}
.right-info {
width: calc(100% - 136px);
2024-07-08 14:10:18 +08:00
}
}
}
}
2024-07-12 11:56:16 +08:00
.footer-tabs {
2024-07-08 14:10:18 +08:00
width: 100%;
2024-07-12 11:56:16 +08:00
height: 168px;
2024-07-08 14:10:18 +08:00
background: #fff;
border-top: 1px solid #ddd;
position: fixed;
bottom: 0;
left: 0;
display: flex;
.item {
flex: 1;
text-align: center;
img {
width: 56px;
height: 56px;
margin-top: 8px;
}
p {
font-size: 22px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #c4cad4;
line-height: 8px;
}
.color-3267F0 {
color: #3267f0;
}
}
}
}
</style>