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.

213 lines
5.8 KiB

2 months ago
<template>
<view>
<uni-data-select v-model="equipmentName" :localdata="typeList" @change="search" :clear="false"
placeholder="请选择您要查找的公示内容"></uni-data-select>
<scroll-view scroll-y="true" style="height: calc(100vh - 100rpx);" enableBackToTop="true"
@scrolltolower="loadMore()">
<view style="margin-top: 10rpx;" v-for="(item, index) in textData" :key="index">
<uni-card :title="item.name" style="margin: none;padding: none;">
<view slot="title"
style="display: flex;padding: 15rpx; justify-content: space-between;color: #000;font-size: 14px;border-bottom: 1px solid #EEEEEE;">
<p style="color: #212121;font-size: 30rpx;">{{ item.name }}</p>
<p style="display:flex;color: #FF9907;align-items: center;">
<!-- <u-badge :isDot="true" type="error"></u-badge> -->
版本{{ item.fileVersion }}
</p>
</view>
<u-row>
<view>公示内容{{setDict(item.publicitty,typeList) }}</view>
</u-row>
<u-row>
<view>备注{{item.remarks}}</view>
</u-row>
<u-row>
<view>摘要</view>
</u-row>
<view style="background: #F9FBFC;border-radius: 3px;padding: 20rpx;">
<u-read-more showHeight="60" :toggle="true" style="font-size: 30rpx;"><rich-text
:nodes="item.workAbstract === null ? ' ' : item.workAbstract"></rich-text></u-read-more>
</view>
<view v-if="item.fileList === null ? false : item.fileList.length === 0 ? false : true">
查看附件
<u-cell-group :border="false" v-for="(item1, index) in item.fileList" :key="index">
<!-- pdf格式的才给查看 预防软件报错 -->
<u-cell style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;"
v-if="item1.fileSuffix === 'pdf'" :border="false" :title="item1.relName">
<u-button @click="goToPdfSee(item1.showUrl)" slot="value" shape="circle"
style="width: 20%;height: 45rpx;text-align: center;" type="primary"
text="查看"></u-button>
</u-cell>
</u-cell-group>
</view>
<view v-else>
查看附件
<text style="color: grey;">暂无可查看附件</text>
</view>
</uni-card>
</view>
<view v-if="flag" style="text-align: center;margin-top: 300rpx;"></view>
</scroll-view>
</view>
</template>
<script>
import {
listManageWorkSys,
listManageWork
} from '@/api/indexpage/safeAnQuan.js';
// 请求字典接口
import {
getDicts
} from '@/api/indexpage/user.js';
export default {
data() {
return {
textData: [],
timer: null, //搜索框定时器
total: 0, //非常规作业总数
pagenum: 1, //分页页码
flag: false,
taskQieHan: true, //用于控制搜索下拉刷新功能切换
typeList: [], //公示类型字典值
equipmentName: '', //输入框内容
};
},
created() {
this.getDicts();
},
methods: {
//请求企业证书类型类型字典
getDicts() {
// 请求企业证件类型字典
getDicts('safe_content').then(res => {
let middleData = res.data;
let a = [];
middleData.map(item => {
a.push({
value: item.dictValue,
text: item.dictLabel
});
});
this.typeList = a;
// 获取企业证件全部列表
this.getData();
})
},
// 请求企业证书类型字典值
setDict(stauts, list) {
for (let item of list) {
if (item.value === stauts) {
return item.text;
}
}
},
// 搜索外协人员名称
search(e) {
if (e === '') {
// this.clear(undefined);
} else {
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.getData(1, e);
}, 500); // 设置时间
}
},
// 清空搜索框
clear(e) {
this.equipmentName = e;
this.pagenum = 1;
this.textData = [];
// 清空搜索框搜索人员证件列表
this.getData();
},
// 获取外协人员列表
getData(num = 2, name = '') {
uni.showLoading({
title: '加载中'
});
let pageNum = this.pagenum;
let pageSize = 5;
//搜索
if (num === 1) {
pageNum = '';
pageSize = '';
this.taskQieHan = false;
} else {
this.taskQieHan = true;
pageNum = this.pagenum;
pageSize = 5;
console.log(pageNum, pageSize);
}
listManageWork({
pageNum: pageNum,
pageSize: pageSize,
publicitty: name
}).then(res => {
//关闭loading
uni.hideLoading();
if (num === 1) {
this.textData = res.rows;
} else {
this.textData = [...this.textData, ...res.rows];
}
this.total = res.total;
//是否有数据
if (this.textData.length == 0) {
this.flag = true;
} else {
this.flag = false;
}
});
},
// 下拉加载
loadMore() {
if (this.taskQieHan) {
//一次分多少页
let pageSize = 5;
//计算分页次数//要分多少页 // 总页数除以分页数
let a = this.total / pageSize + 1;
//初始化为1触发直接请求第二页
this.pagenum = this.pagenum + 1;
//判断第几页 小于总页数才请求
if (this.pagenum <= a) {
// console.log('对不', a, '-----');
// console.log(this.pagenum);
// console.log('发请求');
this.getData();
} else {
// console.log('对不', a, '-----');
// console.log(this.pagenum);
uni.showToast({
title: '没有更多了',
duration: 1000
});
}
}
},
//pdf跳转
goToPdfSee(url) {
this.$tab.navigateTo(`/pages/pdf/filePreview?urlID=${url}`);
}
}
};
</script>
<style lang="scss">
/deep/.u-cell__title-text span {
color: #0281ff;
font-size: 30rpx
}
.uni-stat__select {
background-color: #fff;
padding: 15rpx;
margin-top: 5px;
font-size: 12px;
color: #666;
}
</style>