Files
dvcp_v2_wxcp_app/src/apps/AppInterview/AppInterview.vue

242 lines
5.7 KiB
Vue
Raw Normal View History

2021-11-15 10:29:05 +08:00
<template>
2021-11-15 15:53:44 +08:00
<div class="AppInterview">
2021-11-18 17:53:42 +08:00
<template v-if="!showDetail">
<ai-top-fixed>
<div flex>
<ai-date placeholder="日期选择" mode="range" @change="handleDateSearch"/>
<u-search placeholder="请输入标题" :show-action="false" v-model="search.title" @search="current=1,getList()"/>
</div>
</ai-top-fixed>
<template v-if="list.length>0">
<ai-card v-for="(e,index) in list" :key="index" @click.native="goDetail(e.id,1)">
<template #custom>
<div flex>
<b class="fill">{{ e.title }}</b>
</div>
<div flex v-if="!!e.fileList" class="wrap" @click.stop>
2021-11-18 17:53:42 +08:00
<ai-image v-for="(op,i) in e.fileList.slice(0,3)" :src="op.accessUrl" preview :key="i"/>
</div>
<div class="bottom">{{ e.createTime }}</div>
</template>
<template #menu>
<div class="menu" @tap.stop="goDetail(e.id)">编辑</div>
<div class="menu" @tap.stop="handleDelete(e.id)">删除</div>
</template>
</ai-card>
<u-loadmore :status="loadmore" color="#999" font-size="24"
margin-top="32" margin-bottom="80"/>
</template>
<div class="no-message" v-else>
<image src="https://cdn.cunwuyun.cn/wxAdmin/img/message.png"/>
<p>您还未添加过入户调查走访<br>点击<b>新增按钮</b>试试吧~</p>
2021-11-15 10:29:05 +08:00
</div>
2021-11-18 17:53:42 +08:00
<ai-fixed-btn>
<div class="addBtn iconfont iconfont-iconfangda" @tap="gotoAdd()"/>
</ai-fixed-btn>
2021-11-15 10:29:05 +08:00
</template>
2021-11-18 17:53:42 +08:00
<interview-detail v-else/>
2021-11-15 10:29:05 +08:00
</div>
</template>
<script>
import AiSelect from "../../components/AiSelect";
import AiTopFixed from "../../components/AiTopFixed";
import AiCard from "../../components/AiCard";
import AiImage from "../../components/AiImage";
import AiDate from "../../components/AiDate";
import AiFixedBtn from "../../components/AiFixedBtn";
2021-11-18 17:53:42 +08:00
import InterviewDetail from "./interviewDetail";
2021-11-23 14:58:51 +08:00
import AiBack from "../../components/AiBack";
2021-11-15 10:29:05 +08:00
export default {
2021-11-15 15:53:44 +08:00
name: "AppInterview",
2021-11-17 17:13:52 +08:00
appName: "调查走访",
2021-11-18 17:53:42 +08:00
inject: {
root: {}
},
2021-11-23 14:58:51 +08:00
components: {AiBack, InterviewDetail, AiFixedBtn, AiDate, AiImage, AiCard, AiTopFixed, AiSelect},
2021-11-15 10:29:05 +08:00
data() {
return {
search: {title: ""},
list: [],
current: 1,
2021-11-17 17:13:52 +08:00
pages: 0,
2021-11-15 10:29:05 +08:00
}
},
computed: {
loadmore() {
return this.pages <= this.current ? 'loading ' : 'nomore'
2021-11-18 17:53:42 +08:00
},
showDetail() {
return this.$route.hash == "#add"
2021-11-15 10:29:05 +08:00
}
},
methods: {
2021-11-30 11:39:01 +08:00
emitShow() {
2021-12-09 18:05:51 +08:00
document.title = document.title||"调查走访"
2021-12-09 18:02:13 +08:00
if (this.showDetail) {
} else {
this.current = 1;
this.getList()
}
2021-11-30 11:39:01 +08:00
},
emitReachBottom() {
this.current++;
this.getList()
},
2021-11-15 10:29:05 +08:00
getList() {
this.$http.post('/app/appinterview/list-xcx', null, {
params: {
current: this.current,
size: 10,
...this.search
}
}).then(res => {
if (res?.data) {
this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
this.pages = res.data.pages
}
})
},
goDetail(id, readonly) {
2021-11-18 17:53:42 +08:00
let query = {id}
readonly && (query.detail = 1)
this.root.goto({hash: "#add", query})
2021-11-15 10:29:05 +08:00
},
gotoAdd() {
2021-11-18 17:53:42 +08:00
this.root.goto({hash: "#add"})
2021-11-15 10:29:05 +08:00
},
handleDelete(ids) {
this.$confirm("是否要删除该调查走访").then(() => {
this.$http.post("/app/appinterview/delete", null, {
params: {ids}
}).then(res => {
if (res?.code == 0) {
this.$u.toast("删除成功!")
this.getList()
}
})
})
},
handleDateSearch(v) {
2021-12-02 11:50:35 +08:00
this.search.startTime = v?.startDate
2021-12-09 18:02:13 +08:00
this.search.endTime = v?.startDate || v?.endDate
2021-11-15 10:29:05 +08:00
this.current = 1
this.getList()
}
}
}
</script>
<style lang="scss" scoped>
2021-11-15 15:53:44 +08:00
.AppInterview {
2021-11-15 10:29:05 +08:00
width: 100%;
min-height: 100%;
box-sizing: border-box;
position: absolute;
background: #fff;
.no-message {
margin-top: 140px;
text-align: center;
color: #888;
font-size: 30px;
b {
font-size: 32px;
color: $uni-color-primary;
padding: 0 8px;
}
image {
width: 320px;
height: 240px;
}
}
::v-deep .AiCard {
width: 100%;
min-height: 160px;
background: #FFFFFF;
padding: 32px 32px 0;
box-sizing: border-box;
display: flex;
flex-direction: column;
position: relative;
b {
display: block;
width: 100%;
font-size: 30px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #333;
margin-right: 60px;
margin-bottom: 20px;
}
.iconfont-iconMore {
color: #666;
position: absolute;
right: 32px;
top: 32px;
}
.bottom {
font-size: 24px;
color: #999999;
padding: 24px 0;
border-bottom: 1px solid rgba(221, 221, 221, .4);
}
.AiImage {
width: 30%;
margin-bottom: 8px;
margin-right: 8px;
image {
width: 100%;
height: 218px;
}
}
}
.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;
}
.menu {
text-align: center;
line-height: 80px;
width: 192px;
height: 80px;
font-size: 28px;
font-weight: 400;
color: #333333;
}
::v-deep .u-search {
margin-bottom: 0 !important;
padding-left: 146px;
box-shadow: none;
.u-content {
padding-left: 50px;
box-sizing: border-box;
}
}
}
</style>