Files
dvcp_v2_wxcp_app/src/apps/AppWalkask/AppWalkask.vue

346 lines
8.4 KiB
Vue
Raw Normal View History

2021-12-07 18:18:14 +08:00
<template>
<div class="AppWalkask">
2021-12-08 17:10:41 +08:00
<template v-if="isList">
<div class="header-top">
2021-12-15 18:37:15 +08:00
<u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="96" bg-color="#3975C6" inactive-color="#fff" active-color="#fff" @change="change"></u-tabs>
2021-12-08 17:10:41 +08:00
</div>
2021-12-07 18:18:14 +08:00
2021-12-08 17:10:41 +08:00
<div class="header-middle">
2021-12-16 19:23:26 +08:00
<div class="currentLeft">
2021-12-08 17:10:41 +08:00
<div class="currentLeft-top">
<div class="left">
2021-12-22 15:35:01 +08:00
<AiAreaPicker v-model="areaId" all :areaId="areaId" @select="areaSelect" style="color: #fff"></AiAreaPicker>
2021-12-08 17:10:41 +08:00
</div>
2021-12-15 18:37:15 +08:00
<u-search v-model="keyword" :clearabled="true" placeholder="请输入标题" :show-action="false" bg-color="#1F5CAF" search-icon-color="#E2E8F1" color="#E2E8F1" height="58" @search="handerSearch" @clear="handerClear"></u-search>
2021-12-08 17:10:41 +08:00
</div>
2021-12-14 15:51:00 +08:00
<template v-if="data.length > 0">
<AiCard v-for="(item, i) in data" :key="i" @click.native="goDetail(item, 1)">
<template #custom>
2021-12-08 17:10:41 +08:00
<div class="cards-left">
2021-12-22 16:36:28 +08:00
<span class="walkName">走访对象{{ item.name }}</span>
2021-12-22 15:35:01 +08:00
<span class="tags">{{ item.menuLevel3Name }}</span>
<span class="tags">{{ $dict.getLabel('realityStatus', item.reality) }}</span>
2021-12-08 17:10:41 +08:00
</div>
2021-12-14 15:51:00 +08:00
<div class="cards-hint">{{ item.description }}</div>
2021-12-08 17:10:41 +08:00
2021-12-14 15:51:00 +08:00
<div class="imgs">
2021-12-15 18:37:15 +08:00
<img :src="items.url" alt="" v-for="(items, i) in item.images" :key="i" @click.stop="previewImage(item.images, items.url)" />
2021-12-08 17:10:41 +08:00
</div>
2021-12-14 15:51:00 +08:00
<div class="cards-bottom">
<span>走访人{{ item.createUserName }}</span>
<span style="margin-left: 8px">{{ item.createTime }}</span>
</div>
</template>
2021-12-08 17:10:41 +08:00
2021-12-14 15:51:00 +08:00
<template #menu>
<div class="menu" @tap.stop="goDetail(item, 2)">编辑</div>
<div class="menu" @tap.stop="toDetele(item)">删除</div>
</template>
</AiCard>
</template>
2021-12-08 17:10:41 +08:00
2021-12-09 17:44:57 +08:00
<div v-else>
2021-12-15 14:37:20 +08:00
<AiEmpty description="您还未添加过入户调查走访" class="emptyWrap"></AiEmpty>
2021-12-08 17:10:41 +08:00
2021-12-16 16:04:21 +08:00
<div class="addBtns">
<span> 点击</span>
<span class="toAdds" @click="goDetail">新增按钮</span>
<span> 试试试吧~</span>
</div>
2021-12-09 17:44:57 +08:00
</div>
2021-12-08 17:10:41 +08:00
</div>
</div>
2021-12-15 18:37:15 +08:00
<u-modal v-model="deletShow" content="您确认要删除该条信息吗?" :show-cancel-button="true" :mask-close-able="true" :show-title="false" @confirm="delet"></u-modal>
2021-12-08 17:10:41 +08:00
2021-12-14 15:51:00 +08:00
<AiFixedBtn>
2021-12-15 18:37:15 +08:00
<div class="addBtn iconfont iconfont-iconfangda" @tap.stop="goDetail()" />
2021-12-14 15:51:00 +08:00
</AiFixedBtn>
2021-12-08 17:10:41 +08:00
</template>
<component v-else :is="comp" :params="params"></component>
2021-12-07 18:18:14 +08:00
</div>
</template>
<script>
2021-12-15 18:37:15 +08:00
import { mapState } from 'vuex'
2021-12-13 10:28:46 +08:00
import add from './add.vue'
import detail from './detail.vue'
2021-12-08 17:10:41 +08:00
2021-12-07 18:18:14 +08:00
export default {
name: 'AppWalkask',
appName: '走访慰问',
2021-12-13 11:50:28 +08:00
components: {
add,
detail,
},
2021-12-08 17:10:41 +08:00
props: {},
2021-12-07 18:18:14 +08:00
data() {
return {
2021-12-08 17:10:41 +08:00
data: [],
tabList: [
2021-12-07 18:18:14 +08:00
{
name: '全部',
},
{
name: '我的走访',
},
],
currentTabs: 0,
2021-12-08 17:10:41 +08:00
show: false,
keyword: '',
deletShow: false,
isList: true,
comp: '',
params: null,
current: 1,
2021-12-10 16:47:42 +08:00
areaId: '',
2021-12-16 16:04:21 +08:00
size: 10,
2021-12-13 18:55:01 +08:00
deletId: '',
2021-12-16 16:04:21 +08:00
pages: 0,
2021-12-07 18:18:14 +08:00
}
},
2021-12-16 16:04:21 +08:00
computed: {
...mapState(['user']),
},
onLoad() {
2021-12-24 11:38:05 +08:00
uni.setNavigationBarTitle({ title: '走访慰问' })
2021-12-10 16:47:42 +08:00
this.areaId = this.user.areaId
2021-12-22 15:35:01 +08:00
this.$dict.load('realityStatus').then(() => {
this.getList()
})
},
2021-12-15 18:37:15 +08:00
mounted() {},
2021-12-07 18:18:14 +08:00
methods: {
getList() {
this.$http
2021-12-15 18:37:15 +08:00
.post('/app/appvisitvondolence/list', null, {
params: {
2021-12-16 16:04:21 +08:00
size: this.size,
2021-12-15 18:37:15 +08:00
current: this.current,
areaId: this.areaId,
createUserId: this.currentTabs == 1 ? this.user.id : '',
title: this.keyword,
},
})
.then((res) => {
if (res.code == 0) {
2021-12-22 16:36:28 +08:00
if (this.current > res.data.pages) {
return
}
2021-12-15 18:37:15 +08:00
this.data = this.current > 1 ? [...this.data, ...res.data.records] : res.data.records
2021-12-16 16:04:21 +08:00
this.pages = res.data.pages
2021-12-15 18:37:15 +08:00
if (this.data) {
this.data.map((item) => {
if (item.images) {
item.images = JSON.parse(item.images || '[]')
}
return item
})
}
}
2021-12-15 18:37:15 +08:00
})
},
2021-12-10 16:47:42 +08:00
areaSelect(e) {
2021-12-16 19:23:26 +08:00
this.areaId = e.id
2021-12-16 16:04:21 +08:00
this.getList()
2021-12-10 16:47:42 +08:00
},
2021-12-07 18:18:14 +08:00
change(index) {
2021-12-14 17:59:01 +08:00
this.areaId = this.user.areaId
this.keyword = ''
this.currentTabs = index
2021-12-14 17:59:01 +08:00
this.getList()
2021-12-07 18:18:14 +08:00
},
2021-12-08 17:10:41 +08:00
2021-12-14 15:51:00 +08:00
goDetail(item, hint) {
this.isList = false
if (hint == 1 || hint == 2) {
this.comp = hint == 1 ? 'detail' : 'add'
this.params = item
} else {
2021-12-13 18:55:01 +08:00
this.comp = 'add'
2021-12-14 15:51:00 +08:00
this.params = 111
2021-12-13 18:55:01 +08:00
}
2021-12-08 17:10:41 +08:00
},
2021-12-13 18:55:01 +08:00
toDetele(item) {
this.deletShow = true
this.deletId = item.id
},
2021-12-08 17:10:41 +08:00
delet() {
2021-12-13 18:55:01 +08:00
this.$http.post(`/app/appvisitvondolence/delete?ids=${this.deletId}`).then((res) => {
if (res.code == 0) {
this.$u.toast('删除成功!')
this.getList()
}
})
2021-12-08 17:10:41 +08:00
},
handerSearch(e) {
this.keyword = e
this.current = 1
2021-12-14 17:59:01 +08:00
this.getList()
2021-12-08 17:10:41 +08:00
},
handerClear() {
this.keyword = ''
this.current = 1
2021-12-14 17:59:01 +08:00
this.getList()
2021-12-08 17:10:41 +08:00
},
2021-12-13 18:55:01 +08:00
previewImage(images, img) {
uni.previewImage({
urls: images.map((v) => v.url),
current: img,
})
},
2021-12-07 18:18:14 +08:00
},
2021-12-16 16:04:21 +08:00
onReachBottom() {
this.current = this.current + 1
this.getList()
},
2021-12-07 18:18:14 +08:00
}
</script>
<style lang="scss" scoped>
2021-12-16 16:04:21 +08:00
uni-page-body {
height: 100%;
background: #fff;
}
2021-12-07 18:18:14 +08:00
.AppWalkask {
2021-12-08 17:10:41 +08:00
height: 100%;
2021-12-15 14:37:20 +08:00
2021-12-08 17:10:41 +08:00
.header-middle {
2021-12-12 12:26:08 +08:00
.currentLeft,
.currentRight {
2021-12-09 17:44:57 +08:00
padding-bottom: 56px;
2021-12-15 14:37:20 +08:00
2021-12-08 17:10:41 +08:00
.currentLeft-top {
display: flex;
align-items: center;
background: #3975c6;
padding: 24px 30px;
2021-12-14 15:51:00 +08:00
2021-12-08 17:10:41 +08:00
.left {
2021-12-10 16:47:42 +08:00
width: 40%;
display: flex;
align-items: center;
2021-12-15 14:37:20 +08:00
2021-12-10 16:47:42 +08:00
img {
width: 48px;
height: 48px;
}
2021-12-08 17:10:41 +08:00
}
}
2021-12-14 15:51:00 +08:00
.AiCard {
::v-deep .start {
2021-12-08 17:10:41 +08:00
border-bottom: 1px solid #dddddd;
2021-12-15 14:37:20 +08:00
2021-12-14 15:51:00 +08:00
.fill {
2021-12-08 17:10:41 +08:00
.cards-left {
.walkName {
font-size: 32px;
font-weight: 500;
margin-right: 16px;
2021-12-14 15:51:00 +08:00
color: #333;
2021-12-08 17:10:41 +08:00
}
2021-12-15 14:37:20 +08:00
2021-12-08 17:10:41 +08:00
.tags {
display: inline-block;
padding: 6px 16px;
background: #f3f4f7;
border-radius: 4px;
font-size: 12px;
color: #999999;
margin-left: 16px;
}
}
2021-12-15 14:37:20 +08:00
2021-12-14 15:51:00 +08:00
.cards-hint {
margin-top: 16px;
font-size: 30px;
color: #666666;
line-height: 1.4;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
2021-12-08 17:10:41 +08:00
}
2021-12-15 14:37:20 +08:00
2021-12-14 15:51:00 +08:00
.imgs {
margin-top: 20px;
2021-12-15 14:37:20 +08:00
2021-12-14 15:51:00 +08:00
img {
width: 221px;
height: 221px;
margin-right: 8px;
}
2021-12-15 14:37:20 +08:00
2021-12-14 15:51:00 +08:00
img:nth-child(3n + 0) {
margin-right: 0;
}
2021-12-08 17:10:41 +08:00
}
2021-12-15 14:37:20 +08:00
2021-12-14 15:51:00 +08:00
.cards-bottom {
margin: 24px 0 16px 0;
font-size: 24px;
color: #999999;
2021-12-08 17:10:41 +08:00
}
}
2021-12-14 15:51:00 +08:00
}
2021-12-08 17:10:41 +08:00
2021-12-14 15:51:00 +08:00
::v-deep .mask {
.moreMenu {
.menu {
text-align: center;
line-height: 80px;
width: 192px;
height: 80px;
font-size: 28px;
font-weight: 400;
color: #333333;
}
2021-12-08 17:10:41 +08:00
}
}
}
2021-12-16 16:04:21 +08:00
.addBtns {
2021-12-08 17:10:41 +08:00
text-align: center;
color: #b7b7b7;
2021-12-16 16:04:21 +08:00
margin-top: 10px;
2021-12-08 17:10:41 +08:00
font-weight: 800;
2021-12-15 14:37:20 +08:00
2021-12-14 15:51:00 +08:00
.toAdds {
2021-12-08 17:10:41 +08:00
color: #467dfe;
}
}
}
}
2021-12-14 15:51:00 +08:00
.addBtn {
width: 96px;
height: 96px;
flex-shrink: 0;
background: $uni-color-primary;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
font-size: 48px;
color: #fff;
border-radius: 50%;
justify-content: center;
align-items: center;
display: flex;
}
2021-12-07 18:18:14 +08:00
}
</style>