You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
193 lines
4.5 KiB
193 lines
4.5 KiB
<template> |
|
<view class="flex search"> |
|
<view class="search-item flex justify-center" :search="searchFlag"> |
|
<view class="search-item-conent"> |
|
<uni-easyinput prefixIcon="search" type="text" v-model="query.taskName" placeholder="搜索" :inputBorder="false" @focus="searchFlag = true" /> |
|
|
|
</view> |
|
</view> |
|
<view class="search-item flex justify-center" v-if="!searchFlag" @tap="showPopup"> |
|
<view :class="filterFlag ? 'search-item-conent active': 'search-item-conent'"> |
|
<uni-icons customPrefix="customicons" type="filter" size="20" color="#666" /> |
|
<view>筛选</view> |
|
</view> |
|
</view> |
|
<view v-else> |
|
<view class="cancel-btn" @tap="searchFlag = false">取消</view> |
|
</view> |
|
</view> |
|
<view class="negative-container"> |
|
<view class="card negative-item" v-for="item in list" @tap="open(item)"> |
|
<view class="negative-title"> |
|
<view>{{ item.taskName }}</view> |
|
<view></view> |
|
</view> |
|
<view class="row"> |
|
<view class="col col-24"> |
|
<view class="label">自查类型:</view> |
|
<view class="content">{{ item.type }}</view> |
|
</view> |
|
<view class="col col-24"> |
|
<view class="label">自查单位:</view> |
|
<view class="content">{{ item.supDepartName }}</view> |
|
</view> |
|
<view class="col col-24"> |
|
<view class="label">自查时间:</view> |
|
<view class="content">{{ item.beginTime }} ~ {{ item.endTime }}</view> |
|
</view> |
|
</view> |
|
<view class="negative-bottom"> |
|
<uni-tag text="自查中" type="primary" v-if="item.taskStatus === 'todo'"></uni-tag> |
|
<uni-tag text="已完结" v-else></uni-tag> |
|
</view> |
|
</view> |
|
<empty v-if="list.length === 0" /> |
|
</view> |
|
|
|
<uni-popup ref="filterPopupRef" type="top"> |
|
<view class="popup-container"> |
|
<view class="popup-header"> |
|
<view>全部筛选</view> |
|
<uni-icons type="closeempty" class="close-btn" @tap="closePopup"></uni-icons> |
|
</view> |
|
<view class="popup-body"> |
|
<view class="filter-container"> |
|
|
|
<view class="filter-label mt-10">自查单位</view> |
|
<view class="mb-10"> |
|
<uni-data-picker :localdata="departs" placeholder="请选择自查单位" :border="false" |
|
:map="{text:'shortName', value: 'id'}" v-model="query.supDepartId" @change="search" /> |
|
</view> |
|
|
|
</view> |
|
</view> |
|
<view class="footer col-24 flex gap-8"> |
|
<button class="col-12" @tap="reset">重置</button> |
|
<button type="primary" @tap="handleSearch" class="col-12">完成</button> |
|
</view> |
|
</view> |
|
</uni-popup> |
|
</template> |
|
<script> |
|
import store from '@/store' |
|
import { getDictOptions } from '@/common/dict' |
|
import { listTaskSelfexamination } from '@/api/selfexamination.js' |
|
import { |
|
departTree |
|
} from '@/api/depart' |
|
import { getDictLabel } from '@/common/util' |
|
|
|
|
|
let oldList; |
|
let _this; |
|
|
|
export default { |
|
data() { |
|
return { |
|
list: [], |
|
query: { |
|
size: 100, |
|
current: 1 |
|
}, |
|
departs: [], |
|
searchFlag: false, |
|
filterFlag: false |
|
} |
|
}, |
|
setup(props, context) { |
|
return { |
|
getDictLabel |
|
} |
|
}, |
|
watch: { |
|
searchFlag(val) { |
|
if (val) { |
|
oldList = this.list; |
|
this.list = [] |
|
} else { |
|
this.list = oldList |
|
} |
|
}, |
|
'query.taskName': function(val) { |
|
if (_this.searchFlag) { |
|
if (val) { |
|
_this.getList() |
|
} else { |
|
this.list = [] |
|
} |
|
|
|
} |
|
} |
|
}, |
|
onLoad() { |
|
_this = this; |
|
this.getList(); |
|
departTree().then(data => { |
|
this.departs = data[0].children |
|
}) |
|
}, |
|
methods: { |
|
open(item) { |
|
uni.navigateTo({ |
|
url: `/pages/task/selfexamination/info?id=${item.id}` |
|
}); |
|
}, |
|
getList() { |
|
uni.showLoading({ |
|
title: '数据加载中' |
|
}); |
|
listTaskSelfexamination(this.query).then(data => { |
|
this.list = data.records |
|
uni.hideLoading(); |
|
}); |
|
}, |
|
showPopup() { |
|
this.$refs.filterPopupRef.open() |
|
}, |
|
closePopup() { |
|
this.$refs.filterPopupRef.close() |
|
}, |
|
search() { |
|
if (this.query.supDepartId) { |
|
this.filterFlag = true |
|
} else { |
|
this.filterFlag = false |
|
} |
|
this.getList() |
|
}, |
|
handleSearch() { |
|
this.search() |
|
this.closePopup() |
|
}, |
|
reset() { |
|
this.filterFlag = false |
|
this.query = { |
|
size: 100, |
|
current: 1 |
|
} |
|
this.getList() |
|
} |
|
} |
|
} |
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
.negative-container { |
|
max-height: calc(100vh - 98rpx); |
|
overflow: auto; |
|
} |
|
.negative-title { |
|
display: flex; |
|
justify-content: space-between; |
|
margin-bottom: 12rpx; |
|
font-weight: 500; |
|
font-size: 16px; |
|
} |
|
.negative-bottom { |
|
display: flex; |
|
justify-content: space-between; |
|
.negative-tag { |
|
color: #FF0000; |
|
} |
|
} |
|
</style> |