123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <template>
- <view>
- <view class="search">
- <u-search placeholder="搜索患者" v-model="param.patientName" bgColor="white" :showAction="false" @search="refresh()" @clear="(param.patientName = ''), refresh()"></u-search>
- </view>
- <view class="listv">
- <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
- <view class="title omit">
- <text class="icon" v-if="item.top === 1"></text>
- <text>{{ item.templateName }}</text>
- </view>
- <view class="desc">
- <text>{{ item.patientName }}</text>
- <text>{{ item.createTime }}</text>
- <text class="del" @click.stop="del(item, index)">删除</text>
- <text class="edit" @click.stop="go('/pages/follow/doctor/add?id=' + item.id + ' &patientName=' + item.patientName)">编辑</text>
- <text class="icon state" :style="{ color: item.state == 0 ? '#b5b5b5' : '#4CAF50' }" v-if="param.type == 1">{{ item.state == 0 ? '待回访' : '已回访' }}</text>
- </view>
- </view>
- <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
- <u-empty v-if="!loadMore && list.length == 0"></u-empty>
- </view>
- <view class="mfooter">
- <button class="btn" @click="go('/pages/follow/doctor/add?type=' + param.type)">
- <text class="icon"></text>
- <text>新增</text>
- </button>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- list: [],
- param: { pageNum: 1, pageSize: 10, orderByColumn: 'k.id', isAsc: 'desc' },
- loadMore: true
- };
- },
- onLoad(e) {
- this.param.type = e.type || 0;
- this.getData();
- uni.$on('record', (res) => {
- this.refresh();
- });
- setTimeout(() => {
- uni.setNavigationBarTitle({ title: this.param.type == 0 ? '复诊提醒' : '随访记录' });
- }, 300);
- },
- methods: {
- getData() {
- this.http.request({
- url: '/work/record/list',
- data: this.param,
- loading: 'false',
- success: (res) => {
- this.loadMore = res.data.pages > this.param.pageNum ? true : false;
- res.data.rows.forEach((item) => {
- item.createTime = uni.$u.timeFrom(Date.parse(item.createTime));
- this.list.push(item);
- });
- }
- });
- },
- del(item, index) {
- uni.showModal({
- title: '提示',
- content: '确定删除该内容?',
- success: (res) => {
- if (res.confirm) {
- this.http.request({
- url: '/work/record/remove/' + item.id,
- success: (res) => {
- uni.showToast({ title: '删除成功' });
- this.list.splice(index, 1);
- }
- });
- }
- }
- });
- },
- detail(item) {
- if (this.param.type == 1) {
- uni.navigateTo({ url: '/pages/follow/detail?id=' + item.id });
- }
- },
- go(url) {
- uni.navigateTo({ url: url });
- },
- //刷新数据
- refresh() {
- this.loadMore = true;
- this.param.pageNum = 1;
- this.list = [];
- this.getData();
- }
- },
- //下拉刷新
- onPullDownRefresh() {
- setTimeout(() => {
- this.refresh();
- uni.stopPullDownRefresh();
- }, 1000);
- },
- //上拉加载
- onReachBottom() {
- if (this.loadMore) {
- this.param.pageNum++;
- this.getData();
- }
- }
- };
- </script>
- <style lang="scss"></style>
|