687 lines
15 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="dangerbig-list">
<view class="fixedheader">
<headers :showBack="true">
<view class="headerName">
机具列表
</view>
<view class="right" @click="screenData()">
<image class="scancode" src="@/static/bthgIcon/screen.png" mode=""></image>
</view>
</headers>
<view class="searchBox">
<view class="uni-form-item">
<input class="uni-input" name="searchName" @input="handleInput" v-model="searchName"
placeholder="请输入设备名称" />
<!-- <button class="mini-btn" type="primary" size="mini" @click="loadData">搜索</button> -->
<!-- <view class="screen" @click="screenData">筛选</view>
<view class="screen" style="margin-top: 6rpx;
margin-left: 10rpx; margin-right: 10rpx;">
<image src="/static/screenIcon.png" style="width: 30rpx;height: 30rpx">
</image>
</view> -->
</view>
</view>
</view>
<view :style="{ 'padding-top': (((statusBarHeight * 2) + 100) * 2)+ 'rpx' }">
<view class="list" v-if="workList && workList.length>0">
<view class="list-item" v-for="(item,index) in workList" :key="index" @click="checkItem(item)">
<view class="list-title">
<!-- 未销项 -->
<view style="width: 75%;">
<!-- <text class="tag" v-if="item.hiddenDangerNum > 0">未销项{{item.hiddenDangerNum}}</text> -->
设备名称:{{item.equipmentName}}
</view>
<view class="info-status" v-if="item.isSpecial == 1">特种设备</view>
<!-- <view :class="{'status2': item.engineeringState !== 4, 'status4': item.engineeringState === 4}">
{{item.engineeringState === 4 ? "已完工" : "在施"}}
</view> -->
</view>
<view class="list-content">
<view class="list-info">
<view>
规格型号:
</view>
<view>
{{item.specificationModel}}
</view>
</view>
<view class="list-info">
<view>
是否特种设备:
</view>
<view>
{{item.isSpecial == 1 ? '是' : '否'}}
</view>
</view>
<view class="list-info">
<view>
项目设备编码:
</view>
<view>
{{item.projectEquipmentNumber}}
</view>
</view>
<view class="list-info">
<view>
设备管理员:
</view>
<view>
{{item.equipmentManagerName}}
</view>
</view>
<view class="list-info">
<view>
使用装置:
</view>
<view>
{{item.deviceUsed}}
</view>
</view>
<!-- <view class="list-info">
图片:<view class="download" v-for="item in item.image" :key="item.id">
<image :src="item.url.includes('http://') ? item.url : url_config+'image/'+item.url"
class="img"
@click="previewImage(item.url.includes('http://') ? item.url : url_config+'image/'+item.url)">
</image>
</view>
</view> -->
<!-- <view class="info-status" v-if="item.issuperdanger">超危</view> -->
</view>
<view class="btn_detail">
查看明细
<uni-icons2 class="arrowright" type="arrowright"></uni-icons2>
</view>
</view>
<view class="loadMoreBox" v-if="isLoadMore">
<uni-load-more :status="loadStatus" iconType="auto"></uni-load-more>
</view>
</view>
<view class="no-data" v-else>
<image class="img" src="/static/noData.png"></image>
<text class="txt">暂无数据</text>
</view>
<!-- 筛选条件弹框 -->
<uni-popup class="screenDialog" ref="screenShow" :maskClick="true" @change="closeMenu" :show="popupShow">
<view class="screenContent">
<scroll-view style="height: 80%;" scroll-y>
<view class="closeIcon" @click="closeBtn">
×
</view>
<view class="screenTitle">
筛选条件
</view>
<tki-tree ref="locationTree" :selectParent="true" :multiple="false" @confirm="(val)=>checkPointBtn(val,1)" idKey='id'
:range="listData" rangeKey="classificationName" confirmColor="#4e8af7" />
</scroll-view>
<view class="footerBtn">
<view class="foterLeft" @click="closeBtn">
取消
</view>
<view class="foterRight" @click="closeRed">
确认
</view>
</view>
</view>
</uni-popup>
</view>
</view>
</template>
<script>
import tkiTree from "@/components/tki-tree_up/tki-tree.vue"
import {
isJSON
} from '@/utils/tool.js'
export default {
components: {
tkiTree
},
data() {
return {
statusBarHeight: 0,
pageNo: 1,
pageSize: 10,
projectSn: "",
oldListData: [],
listData: [],
isLoadMore: false,
loadStatus: 'more',
workList: [],
levelList: [{
id: 1,
workCategoryName: "一级"
}, {
id: 2,
workCategoryName: "二级"
}, {
id: 3,
workCategoryName: "三级"
}, {
id: 4,
workCategoryName: "普通"
}],
searchName: "",
popupShow: false,
constructionEquipmentToolClassificationId: "",
}
},
onShow() {
this.statusBarHeight = uni.getStorageSync('systemInfo').statusBarHeight;
this.projectSn = JSON.parse(uni.getStorageSync('userInfo')).sn
},
onLoad() {
this.projectSn = JSON.parse(uni.getStorageSync('userInfo')).sn
// this.initData()
this.getWorkList()
this.getConstructionTree();
},
onReachBottom() {
console.log(1)
if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
this.isLoadMore = true
this.pageNo += 1
this.getWorkList()
}
},
onPullDownRefresh() {
console.log(2)
this.pageNo = 1
this.getWorkList();
},
methods: {
//tree 树形选择器 选中--回显
checkPointBtn(val, type) {
console.log(val)
// type==1 检查项 3 通知人
if (type == 1) {
this.constructionEquipmentToolClassificationId = val[0].id;
this.handleInput();
}
},
//点击打开筛选
screenData() {
this.$refs.screenShow.open();
this.listData = JSON.parse(JSON.stringify(this.oldListData));
console.log(this.listData, this.oldListData)
this._renderTreeList(this.listData)
this.popupShow = true
},
//扁平化树结构
_renderTreeList(list = []) {
const find = list.find(item => item.id == this.constructionEquipmentToolClassificationId)
console.log(3333, find)
if (find) {
find.checked = true;
return;
}
list.forEach(item => {
if (Array.isArray(item.children) && item.children.length > 0) {
this._renderTreeList(item.children);
}
})
// console.log(list)
},
closeMenu(e) {
console.log("关闭!!!!", e)
if (e.show == false) {
// this.$refs.screenShow.close()
this.popupShow = false;
// this.resettingBtn()
}
},
//关闭筛选
closeBtn() {
this.$refs.screenShow.close()
this.popupShow = false;
},
closeRed() {
this.$refs.locationTree._confirm()
this.$refs.screenShow.close()
this.popupShow = false;
},
//预览图片
previewImage(url) {
uni.previewImage({
urls: [url]
})
},
handleInput() {
this.pageNo = 1;
this.workList = [];
this.getWorkList();
},
getConstructionTree() {
let data = {
projectSn: this.projectSn,
constructionEquipmentToolClassificationId: "",
}
this.sendRequest({
url: 'xmgl/constructionEquipmentToolClassification/tree/list',
method: 'get',
data: data,
success: res => {
uni.hideLoading()
if (res.code == 200) {
console.log("workList======================", res)
const newResult = [{
children: [],
classificationName: "全部",
id: "",
parentId: "0",
}, ...res.result]
this.listData = newResult;
this.oldListData = [...newResult];
}
}
})
},
getWorkList() {
let data = {
pageNo: this.pageNo,
pageSize: this.pageSize,
projectSn: this.projectSn,
equipmentName: this.searchName,
constructionEquipmentToolClassificationId: this.constructionEquipmentToolClassificationId,
}
this.sendRequest({
url: 'xmgl/constructionEquipmentTool/page',
method: 'get',
data: data,
success: res => {
uni.hideLoading()
if (res.code == 200) {
console.log("workList======================", res)
// this.listData = res.result.records
// this.workList=this.workList.concat(res.result)
const newResult = res.result.records.map(item => {
return {
...item,
image: isJSON(item.file) ? JSON
.parse(item.file) : [],
}
})
this.workList = this.workList.concat(newResult)
if (res.result.records.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true
this.loadStatus = 'nomore'
} else {
this.isLoadMore = false
// that.loadStatus='more'
}
uni.stopPullDownRefresh()
}
}
})
},
checkItem(val) {
console.log(val)
uni.navigateTo({
url: './equipmentManage/detail?id=' + val.id
})
}
}
}
</script>
<style lang="scss" scoped>
.tki-tree-view {
max-height: 70%;
}
.screenDialog {
position: absolute;
// top: 11%;
// height: 95%;
/* background: pink; */
background: white;
width: 100%;
border-radius: 40rpx;
margin-left: -4%;
background-color: white;
/* 设置为半透明的灰色 */
z-index: 9;
/* 设置一个较大的 z-index 值,保证遮罩层在最上层 */
.closeIcon {
float: right;
font-size: 50rpx;
color: gray;
margin-right: 3%;
}
.screenTitle {
text-align: center;
margin-top: 4%;
font-size: 36rpx;
font-weight: 500;
}
.uni-popup__wrapper-box {
height: 70vh;
overflow: scroll;
position: fixed;
bottom: 0,
}
.screenContent {
width: 100vw;
height: 70%;
// width: 90%;
// margin: -65% 0%;
overflow: scroll;
// position: relative;
// margin-top: 180%;
border-radius: 40rpx 40rpx 0 0;
// margin-left: -4%;
background-color: white;
padding-left: 10%;
position: fixed;
left: 0;
bottom: 0;
.titleItem {
font-size: 28rpx;
.regionText {
display: inline-block;
margin-left: 16%;
width: 380rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
}
.footerBtn {
display: flex;
text-align: center;
line-height: 80rpx;
margin-top: 2%;
// margin-left: 6%;
position: absolute;
bottom: 10%;
width: 100%;
.foterLeft {
width: 43%;
background: #f6f7f8;
height: 80rpx;
border-top-left-radius: 40rpx;
border-bottom-left-radius: 40rpx;
color: #5181f6;
}
.foterRight {
width: 43%;
background: #5181f6;
height: 80rpx;
border-top-right-radius: 40rpx;
border-bottom-right-radius: 40rpx;
color: #fff;
}
}
}
.searchBox {
// background-color: white;
background-color: #F3F5F7;
}
.uni-form-item {
position: relative;
display: flex;
align-items: center;
font-size: 28rpx;
/* .search-icon{
position: absolute;
top: 50%;
right: 50rpx;
transform: translateY(-50%);
} */
}
.uni-input {
border-radius: 40rpx;
margin: 20rpx;
// background-color: #f7f8fa;
background: #FFFFFF;
height: 70rpx;
line-height: 60rpx;
padding: 0 40rpx;
font-size: 28rpx;
flex: 1;
// width: 70%;
}
.screen {
line-height: 100rpx;
color: gray;
}
.flex {
display: flex;
align-items: center;
}
.content {
padding: 0px 30rpx 20rpx;
box-sizing: border-box;
width: 100%;
}
.download {
display: flex;
flex-wrap: wrap;
align-items: center;
margin-top: 10rpx;
// justify-content: center;
}
.img {
width: 120rpx;
height: 120rpx;
}
.dangerbig-list {
min-height: 100%;
// background: #F6F6F6;
background-color: #F3F5F7;
.fixedheader {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 2;
.headerName {
z-index: 1;
}
:deep( .headerBox ){
background-color: #F3F5F7;
}
:deep( .right ){
font-size: 24rpx;
position: absolute;
right: 20rpx;
top: 50%;
z-index: 4;
transform: translateY(-50%);
.scancode {
width: 44rpx;
height: 44rpx;
}
}
}
.list {
padding: 20rpx 0;
margin: 0 20rpx;
.list-item {
background: #fff;
margin-bottom: 20rpx;
// padding: 20rpx 0;
padding-top: 10rpx;
position: relative;
border-radius: 24rpx;
.list-title {
padding: 10rpx 40rpx;
// border-bottom: 4rpx solid #F6F6F6;
display: flex;
align-items: center;
justify-content: space-between;
color: #1A1A1A;
.tag {
background: #F0AD4E;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
margin-right: 20rpx;
margin-left: -20rpx;
height: 32rpx;
}
.status1 {
background: #2b8df3;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
}
.status2 {
background: #F0AD4E;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
}
.status3 {
background: #B22222;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
}
.status4 {
background: #ccc;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
}
}
.list-content {
margin-top: 14rpx;
padding-bottom: 20rpx;
border-bottom: 1px dashed #CCCCCC;
}
.list-info {
display: flex;
padding: 10rpx 40rpx;
margin-left: 40rpx;
font-size: 28rpx;
// border-bottom: 2rpx solid #F6F6F6;
color: #444444;
position: relative;
> view:first-child {
width: 220rpx;
}
> view:last-child {
flex: 1;
word-break: break-all;
}
}
.list-info::after {
content: '';
width: 15rpx;
height: 15rpx;
background-color: #007BF5;
border-radius: 50%;
border: 10rpx solid #EBF0FA;
position: absolute;
left: 0;
top: 14rpx;
// top: 50%;
// transform: translateY(-50%);
}
.info-status {
padding: 3rpx 16rpx;
// border: 1px solid #DD524D;
// border-radius: 6rpx;
// color: #DD524D;
margin-left: 10rpx;
border-radius: 30rpx;
background-color: #DD524D;
color: white;
}
.btn_detail {
// background-color: #4181FE;
// color: white;
// padding: 3rpx 16rpx;
// border-radius: 30rpx;
// position: absolute;
// bottom: 16rpx;
// right: 16rpx;
padding: 20rpx 40rpx;
font-size: 26rpx;
color: #FF0000;
text-align: right;
.arrowright {
color: #FF0000 !important;
font-size: 24rpx !important;
}
}
}
}
.btn {
height: 96rpx;
width: 100%;
line-height: 96rpx;
text-align: center;
background: #4181FE;
color: #fff;
position: fixed;
bottom: 0;
left: 0;
}
.no-data {
text-align: center;
.img {
display: block;
height: 200rpx;
width: 200rpx;
margin: 0 auto;
margin-top: 560rpx;
margin-bottom: 60rpx;
}
.txt {
color: #CFC8CC;
}
}
}
</style>