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.
 
 
 
 
 
 

209 lines
5.1 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.applicantEmpName" 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 comforts" @tap="open(item)">
<view class="row" style="--label-width: 160rpx">
<view class="col col-12">
<view class="label">申请人:</view>
<view class="content">{{ item.applicantEmpName }}</view>
</view>
<view class="col col-12">
<view class="label">申请时间:</view>
<view class="content">{{ item.applyDate }}</view>
</view>
<view class="col col-12">
<view class="label">受伤程度:</view>
<view class="content">{{ item.injurySeverityName }}</view>
</view>
<view class="col col-12">
<view class="label">申请金额:</view>
<view class="content">{{ item.injurySeverity }}</view>
</view>
<view class="col col-24">
<view class="label">事实与理由:</view>
<view class="content">{{ item.factReason }}</view>
</view>
</view>
<view class="negative-bottom">
<uni-tag :text="getDictLabel(comfortStatus, item.rpcStatus)" :type="getRpcStatusTagType(item.rpcStatus)" />
</view>
</view>
<empty v-if="comforts.length === 0" />
</view>
<view class="footer col-24">
<button type="primary" @tap="openAdd">我要抚慰</button>
</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>
<filter-radio :data="comfortStatus" v-model="query.rpcStatus" :prop="{text: 'dictLabel', value: 'dictValue'}" @change="search" />
</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 { listComfort } from '@/api/comfort'
import {
departTree
} from '@/api/depart'
import { getDictLabel } from '@/common/util'
let oldList;
let _this;
export default {
data() {
return {
comforts: [],
query: {
size: 20,
current: 1
},
departs: [],
searchFlag: false,
filterFlag: false,
}
},
setup(props, context) {
const processingStatus = getDictOptions('processingStatus');
const businessTypes = getDictOptions('businessType')
const comfortStatus = getDictOptions('comfortStatus')
return {
processingStatus,
businessTypes,
comfortStatus,
getDictLabel
}
},
watch: {
searchFlag(val) {
if (val) {
oldList = this.comforts;
this.comforts = []
} else {
this.comforts = oldList
}
},
'query.thingDesc': function(val) {
if (_this.searchFlag) {
if (val) {
_this.getComforts()
} else {
this.comforts = []
}
}
}
},
onLoad() {
_this = this;
this.getComforts();
departTree().then(data => {
this.departs = data[0].children
})
},
methods: {
open(item) {
uni.navigateTo({
url: '/pages/comfort/action?id=' + item.rpcId
});
},
openAdd() {
uni.navigateTo({
url: '/pages/comfort/add'
});
},
getComforts() {
uni.showLoading({
title: '数据加载中'
});
listComfort(this.query).then(data => {
this.comforts = data.records
uni.hideLoading();
});
},
showPopup() {
this.$refs.filterPopupRef.open()
},
closePopup() {
this.$refs.filterPopupRef.close()
},
search() {
if (this.query.rpcStatus) {
this.filterFlag = true
} else {
this.filterFlag = false
}
this.getComforts()
},
handleSearch() {
this.search()
this.closePopup()
},
reset() {
this.filterFlag = false
this.query = {
size: 20,
current: 1
}
this.getComforts()
},
getRpcStatusTagType(rpcStatus) {
if (rpcStatus === 'returned') {
return 'error'
}
if (rpcStatus === 'approval') {
return 'primary'
}
return ''
}
}
}
</script>
<style lang="scss" scoped>
.negative-container {
max-height: calc(100vh - 98rpx);
overflow: auto;
box-sizing: border-box;
padding-bottom: 72px;
}
.negative-bottom {
display: flex;
justify-content: space-between;
.negative-tag {
color: #FF0000;
}
}
</style>