Files
dvcp_v2_wxcp_app/src/apps/AppWalkask/AppWalkask.vue
花有清香月有阴 a1c6215ae4 重绘
2021-12-13 18:55:01 +08:00

417 lines
12 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="AppWalkask">
<template v-if="isList">
<u-navbar title="走访慰问" back-icon-color="#fff" title-color="#fff" title-width="300" title-size="36" :border-bottom="false" :background="backgroundNavbar"> </u-navbar>
<div class="header-top">
<u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="96" bg-color="#3975C6" inactive-color="#fff" active-color="#fff" @change="change"></u-tabs>
</div>
<div class="header-middle">
<div class="currentLeft" v-if="currentTabs == 0">
<div class="currentLeft-top">
<div class="left">
<img src="./components/images/icon2.png" alt="" />
<AiAreaPicker v-model="areaId" ref="areaIds" :areaId="areaId" @select="areaSelect" style="color: #fff"> </AiAreaPicker>
<!-- <div class="btns" style="display: inline-block" @click="show = true">
<u-icon name="arrow-down"></u-icon>
</div> -->
</div>
<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>
<u-select v-model="show" :list="areaList"></u-select>
</div>
<div @click.stop="btnHide" class="datas" v-if="data.length > 0">
<div class="cards" @click.stop="toDetail(item)" v-for="(item, i) in data" :key="i">
<div class="cards-top">
<div class="cards-left">
<span class="walkName">走访对象{{ item.createUserName }}</span>
<span class="tags">残疾人</span>
<span class="tags">居家看护</span>
</div>
<div class="cards-right" @click.stop="showHide">
<img src="./components/images/1.png" alt="" />
</div>
<div class="btn" v-if="showBtn">
<span @click="toAdd(item)">编辑</span>
<span @click="toDetele(item)">删除</span>
</div>
</div>
<div class="cards-hint">{{ item.description }}</div>
<div class="imgs">
<img :src="items.url" alt="" v-for="(items, i) in item.images" :key="i" @click.stop="previewImage(item.images, items.url)" />
</div>
<div class="cards-bottom">
<span>走访人{{ item.createUserName }}</span>
<span>{{ item.createTime }}</span>
</div>
</div>
</div>
<div v-else>
<AiEmpty description="您还未添加过入户调查走访" class="emptyWrap"> </AiEmpty>
<div class="addBtn">点击<span class="toAdd" @click="toAdd">新增按钮</span>试试试吧~</div>
</div>
</div>
<div class="currentRight" v-if="currentTabs == 1">
<div class="currentLeft-top">
<div class="left">
<img src="./components/images/icon2.png" alt="" />
<AiAreaPicker v-model="areaId" ref="areaIds" :areaId="areaId" @select="areaSelect" style="color: #fff"> </AiAreaPicker>
<!-- <div class="btns" style="display: inline-block" @click="show = true">
<u-icon name="arrow-down"></u-icon>
</div> -->
</div>
<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>
<u-select v-model="show" :list="areaList"></u-select>
</div>
<div @click.stop="btnHide" class="datas" v-if="data.length > 0">
<div class="cards" @click.stop="toDetail(item)" v-for="(item, i) in data" :key="i">
<div class="cards-top">
<div class="cards-left">
<span class="walkName">走访对象{{ item.createUserName }}</span>
<span class="tags">残疾人</span>
<span class="tags">居家看护</span>
</div>
<div class="cards-right" @click.stop="showHide">
<img src="../AppWalkask/components/images/1.png" alt="" />
</div>
<div class="btn" v-if="showBtn">
<span @click="toAdd(item)">编辑</span>
<span @click="toDetele(item)">删除</span>
</div>
</div>
<div class="cards-hint">{{ item.description }}</div>
<div class="imgs">
<img :src="items.url" alt="" v-for="items in item.images" :key="items.id" @click.stop="previewImage(item.images, items.url)" />
</div>
<div class="cards-bottom">
<span>走访人{{ item.createUserName }}</span>
<span>{{ item.createTime }}</span>
</div>
</div>
</div>
<div v-else>
<AiEmpty description="您还未添加过入户调查走访" class="emptyWrap"> </AiEmpty>
<div class="addBtn">点击<span class="toAdd" @click="toAdd">新增按钮</span>试试试吧~</div>
</div>
</div>
</div>
<u-modal v-model="deletShow" content="您确认要删除该条信息吗?" :show-cancel-button="true" :mask-close-able="true" :show-title="false" @confirm="delet"></u-modal>
<img src="../AppWalkask/components/images/add@2x.png" class="fixedImg" alt="" @click="toAdd" />
</template>
<component v-else :is="comp" :params="params"></component>
</div>
</template>
<script>
import { mapState } from 'vuex'
import add from './add.vue'
import detail from './detail.vue'
export default {
name: 'AppWalkask',
appName: '走访慰问',
components: {
add,
detail,
},
props: {},
data() {
return {
data: [],
backgroundNavbar: {
backgroundColor: '#3975C6',
},
tabList: [
{
name: '全部',
},
{
name: '我的走访',
},
],
currentTabs: 0,
show: false,
areaList: [
{
value: '0',
label: '武汉',
},
{
value: '1',
label: '襄阳',
},
],
current: 0,
keyword: '',
showBtn: false,
deletShow: false,
isList: true,
comp: '',
params: null,
current: 1,
areaId: '',
deletId: '',
}
},
computed: { ...mapState(['user']) },
created() {
console.log(this.user)
this.areaId = this.user.areaId
this.getList()
},
mounted() {},
methods: {
getList() {
this.$http
.post('/app/appvisitvondolence/list', null, {
params: {
size: 6,
current: this.current,
areaId: this.areaId,
},
})
.then((res) => {
if (res.code == 0) {
this.data = res.data.records
if (this.data) {
this.data.map((item) => {
if (item.images) {
item.images = JSON.parse(item.images || '[]')
}
return item
})
}
}
})
},
areaSelect(e) {
if (e.type == 5) {
this.areaId = e.id
} else {
return this.$u.toast('请选择到村')
}
},
change(index) {
this.currentTabs = index
},
toAdd(item) {
console.log('编辑', '添加')
const id = item.id
// this.isList = false
// this.comp = 'add'
// this.params = 12313
if (id) {
this.comp = 'add'
// this.params = id
this.params = 12313
this.isList = false
}
},
toDetail(item) {
// const { id } = item.id
this.isList = false
this.comp = 'detail'
this.params = detail
},
toDetele(item) {
this.deletShow = true
this.deletId = item.id
},
delet() {
console.log('delet')
this.$http.post(`/app/appvisitvondolence/delete?ids=${this.deletId}`).then((res) => {
if (res.code == 0) {
this.$u.toast('删除成功!')
this.getList()
}
})
},
showHide() {
if (this.showBtn == false) {
this.showBtn = true
} else {
this.showBtn = false
}
},
btnHide() {
this.showBtn = false
},
handerSearch(e) {
this.keyword = e
this.current = 1
// this.getList()
},
handerClear() {
this.keyword = ''
this.current = 1
// this.getList()
},
previewImage(images, img) {
uni.previewImage({
urls: images.map((v) => v.url),
current: img,
})
},
},
}
</script>
<style lang="scss" scoped>
.AppWalkask {
height: 100%;
.header-middle {
.currentLeft,
.currentRight {
padding-bottom: 56px;
background: #fff;
.currentLeft-top {
display: flex;
align-items: center;
background: #3975c6;
padding: 24px 30px;
.left {
width: 40%;
display: flex;
align-items: center;
img {
width: 48px;
height: 48px;
}
}
}
.datas {
.cards {
margin: 30px 30px 24px 30px;
border-bottom: 1px solid #dddddd;
.cards-top {
display: flex;
justify-content: space-between;
.cards-left {
.walkName {
font-size: 32px;
font-weight: 500;
margin-right: 16px;
}
.tags {
display: inline-block;
padding: 6px 16px;
background: #f3f4f7;
border-radius: 4px;
font-size: 12px;
color: #999999;
margin-left: 16px;
}
}
.cards-right {
position: relative;
width: 32px;
margin-top: 1%;
}
.btn {
position: absolute;
z-index: 99;
right: 45px;
top: 350px;
width: 224px;
height: 204px;
background: #ffffff;
box-shadow: 0px 4px 12px 4px rgba(162, 162, 162, 0.5);
border-radius: 4px;
}
}
.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;
}
.imgs {
margin-top: 20px;
img {
width: 224px;
height: 224px;
margin-right: 8px;
}
img:nth-child(3n + 0) {
margin-right: 0;
}
}
.cards-bottom {
margin: 24px 0 16px 0;
font-size: 24px;
color: #999999;
}
}
}
.addBtn {
text-align: center;
color: #b7b7b7;
margin-top: 5px;
font-weight: 800;
.toAdd {
color: #467dfe;
}
}
}
}
.fixedImg {
position: fixed;
right: 0;
top: 1004px;
width: 128px;
height: 128px;
}
}
</style>