detection-business/pages/manage/deviceManage.vue

495 lines
8.6 KiB
Vue
Raw Normal View History

2024-09-11 15:55:28 +08:00
<!-- 默认复制 -->
<template>
<view class="content">
<view class="top-heder">
<view class="t-left" @click="getback()">
<uni-icons type="left" size="18"></uni-icons>
</view>
<view class="t-title">
<text>资料管理</text>
</view>
<view class="t-you"></view>
</view>
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
<view class="cont">
<view class="c-box" @click="addwenjian()">
<!-- <view class="">
<image src="../../static/imgs/wenjianjia.png" mode=""></image>
</view> -->
<view style="width: 100%; display: flex; justify-content: center;">
<text > + 新增文件</text>
</view>
</view>
<view class="bjimg" v-if="arrlist == ''">
<image src="http://www.nuoyunr.com/lananRsc/detection/qs.png" mode=""></image>
</view>
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
<view class="wrap-box">
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
<view class="w-box" v-for="(item,index) in arrlist" :key="index" >
<view class=" wimg" v-if="item.type=='1'" @click="enrtryFile(item.id)">
<image src="../../static/imgs/wenjianjia.png" mode=""></image>
</view>
<view class="wimg" v-else>
<image src="../../static/imgs/wenjian.png" mode=""></image>
</view>
<view class="">{{item.fileName}}</view>
<view class="" v-if="item.warnTime">{{item.warnTime}}</view>
<view class="" v-if="!item.warnTime" style=" visibility: hidden;">{{'1'}}</view>
<view class="bsd-dis">
<view class="bianji" v-if="item.type == '2'" @click="viewFile(item.filePath)">预览</view>
<view class="bianji" @click="editFile(item.id)">编辑</view>
<view class="sanchu" @click="delFile(item.id)">删除</view>
</view>
</view>
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
</view>
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
</view>
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
</view>
</template>
<script>
import config from '@/config'
import request from '../../utils/request';
export default{
data(){
return{
arrlist:[],
fileId:null,
pageNum: 1,//第几页
pageSize: 20,//一页多少张
totalPages: 0,//总数
nowFile:{}
}
},
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
onLoad(){
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
},
onShow() {
this.getlist()
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
},
onReachBottom() {
if (this.pageNum >= this.totalPages) {
uni.showToast({
title: '没有下一页数据',
icon: 'none'
})
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
} else {
this.pageNum++
this.getlist()
}
},
methods:{
async getlist(){
let res = await request({
url: '/inspectionFile/inspectionFile/list',
method: 'get',
data: {
pageSize:this.pageSize,
pageNum:this.pageNum,
fatherId:this.fileId
}
})
if (this.pageNum != 1){
this.arrlist = this.arrlist.concat(res.rows)
}else{
this.arrlist = res.rows
}
let total = res.total
2024-11-11 13:18:56 +08:00
this.totalPages = Math.ceil(total / this.pageSize);
2024-09-11 15:55:28 +08:00
},
async getback(){
if(!this.fileId){
uni.navigateBack()
}else{
let res = await request({
url: '/inspectionFile/inspectionFile/'+this.fileId,
method: 'get',
})
this.nowFile = res.data
this.arrlist=[]
this.pageNum =1
this.fileId = this.nowFile.fatherId
this.getlist()
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
}
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
},
addwenjian(){
uni.navigateTo({
url:'/pages/manage/deviceAdd?fileId='+this.fileId+'&type=add'
})
},
enrtryFile(fileId){
this.fileId = fileId
this.arrlist=[]
this.pageNum =1
this.getlist()
},
viewFile(filePath){
uni.downloadFile({
url: this.$baseUrl+filePath,
success: function (res) {
var filePath = res.tempFilePath;
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function (res) {
}
});
}
});
},
editFile(fileId){
uni.navigateTo({
url:'/pages/manage/deviceAdd?fileId='+fileId+'&type=edit'
})
},
delFile(fileId){
let that = this
uni.showModal({
title: '确认',
content: '是否确认删除',
success: function (res) {
request({
url: '/inspectionFile/inspectionFile/del/'+fileId,
method: 'post'
}).then(res=>{
if(res.code == 200){
that.getlist()
}
})
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
}
});
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
},
gostaff(){
uni.navigateTo({
url:'/pages/manage/staffManage'
})
},
goinformation(){
uni.navigateTo({
url:'/pages/manage/informationManage'
})
},
godevice(){
uni.navigateTo({
url:'/pages/manage/deviceManage'
})
},
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
},
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
}
</script>
<style scoped lang="scss">
.content{
width: 100%;
height: calc(100vh);
background-color: #F6F6F6;
box-sizing: border-box;
// padding-top: 45px;
}
.top-icon{
margin-bottom: 45px;
}
.q-fab{
position: fixed;
bottom: 50px;
right: 15px;
width: 55px;
height: 55px;
border-radius: 50%;
overflow: hidden;
image{
width: 100%;
height: 100%;
}
}
.fab-z1{
position: fixed;
bottom: 115px;
right: 15px;
width: 50px;
height: 50px;
border-radius: 50%;
overflow: hidden;
image{
width: 100%;
height: 100%;
}
}
.fab-z2{
position: fixed;
bottom: 50px;
right: 80px;
width: 50px;
height: 50px;
border-radius: 50%;
overflow: hidden;
image{
width: 100%;
height: 100%;
}
}
.c-tap{
width: 100%;
height: 40px;
box-sizing: border-box;
padding: 15px;
display: flex;
background-color: white;
align-items: center;
}
.c-top{
display: flex;
align-items: center;
justify-content: space-between;
}
.c-title{
font-size: 18px;
font-weight: bold
}
.cont{
width: 100%;
padding: 15px;
padding-top: 0px ;
box-sizing: border-box;
background-color: #F6F6F6;
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
}
.hongdian{
width: 15px;
height: 15px;
background-color: crimson;
border-radius: 50%;
overflow: hidden;
position: absolute;
top: 5px;
right: 5px;
z-index: 9999;
}
.c-box{
width: 100%;
box-sizing: border-box;
padding: 10px;
background-color: white;
margin-top: 10px;
border-radius: 10px;
display: flex;
align-items: flex-start;
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
font-size: 18px;
font-weight: bold;
image{
width: 30px;
height: 30px;
margin-right: 10px;
}
}
.c-b-top{
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
.t-left{
width: 40%;
height: 100px;
border-radius: 7px;
margin-right: 10px;
overflow: hidden;
image{
width: 100%;
height: 100%;
}
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
}
.t-right{
width: 60%;
}
.t-tilte{
font-size: 20px;
font-weight: bold;
color: #333333;
2024-11-11 13:18:56 +08:00
white-space: nowrap;
2024-09-11 15:55:28 +08:00
overflow: hidden;
text-overflow: ellipsis;
}
.tw-tilte{
width: 100%;
text-align: right;
font-size: 16px;
font-weight: bold;
color: #5e5e5e;
2024-11-11 13:18:56 +08:00
white-space: nowrap;
2024-09-11 15:55:28 +08:00
overflow: hidden;
text-overflow: ellipsis;
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
}
.t-zi{
font-size: 14px;
font-weight: 400;
color: #666666;
overflow: hidden;
text-overflow: ellipsis;
2024-11-11 13:18:56 +08:00
display: -webkit-box;
2024-09-11 15:55:28 +08:00
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
.bjimg{
width: 255px;
height: 236px;
margin: 0px auto;
margin-top: 100px;
image{
width: 100%;
height: 100%;
}
}
.c-b-bom{
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 5px;
}
.b-left{
color: #0D2E8D;
font-size: 14px;
}
.b-right{
display: flex;
justify-content: space-between;
align-items: center;
}
.z-lv{
display: flex;
align-items: center;
color: #0D2E8D;
font-size: 15px;
margin-right: 10px;
}
.y-hong{
display: flex;
align-items: center;
color: #fa3534;
font-size: 15px;
margin-right: 15px;
}
.z-img{
width: 20px;
height: 15px;
image{
width: 100%;
height: 100%;
}
margin-right: 2px;
}
.tap-box{
width: 30%;
text-align: center;
}
.gang{
height: 4px;
background: #0D2E8D;
width: 80%;
margin: 0px auto;
}
.lan{
color: #0D2E8D;
}
.top-heder{
width: 100%;
height: 68px;
background: white;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 5px 15px;
}
.t-title{
font-size: 17px;
font-weight: bold;
color: #333333;
}
.t-left{
width: 20%;
height: 20px;
}
.t-you{
width: 20%;
height: 20px;
}
.wrap-box{
width: 100%;
display: flex;
justify-content: space-between;
box-sizing: border-box;
flex-wrap: wrap;
}
.w-box{
width: 48%;
background-color: white;
margin-top: 10px;
border-radius: 10px;
box-sizing: border-box;
padding: 10px;
text-align: center;
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
}
.wimg{
width: 100%;
height: 120px;
image{
width: 100%;
height: 100%;
}
}
.bsd-dis{
display: flex;
width: 100%;
align-items: center;
justify-content: space-around;
margin-top: 10px;
}
.bianji{
width: 50px;
height: 24px;
color: #0D2E8D;
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
display: flex;
align-items: center;
justify-content: center;
border-radius: 8px;
}
.sanchu{
width: 50px;
height: 24px;
color: #FF571A;
2024-11-11 13:18:56 +08:00
2024-09-11 15:55:28 +08:00
display: flex;
align-items: center;
justify-content: center;
border-radius: 8px;
}
2024-11-11 13:18:56 +08:00
</style>