zhgdyunapp/pages/projectEnd/workTicketManage/highRiskWorkTicket.vue

586 lines
14 KiB
Vue

<template>
<view class="addIssue">
<view class="fixedheader">
<headers :showBack="pageType=='backend' ? false : true">
<view class="headerName">
工作票全过程管控
</view>
</headers>
<view class="uni-form-item">
<u-search class="uni-input" placeholder="搜索工作票编号名称" :show-action="false" @change="onRefresh"
v-model="searchInfo.workTicketNumber"></u-search>
<view @click="constructionTimeShow = true" class="calendar_box">
<view :class="{'calendar_active': constructionTimeShow}" class="calendar"></view>
<!-- <u-icon name="calendar" color="#3190F3" size="32"></u-icon> -->
</view>
</view>
<u-dropdown :class="{'dropdownFlag': !dropdownFlag}" ref="uDropdown" @open="onOpen" @close="onClose">
<u-dropdown-item :title="searchInfo.deviceStateName" @change="onVideoItemChange(1)"
v-model="searchInfo.deviceState" :options="deviceStateList"></u-dropdown-item>
<u-dropdown-item :title="searchInfo.projectName">
<view class="slot-content">
<scroll-view scroll-y="true" class="scroll-view">
<TreeView :multiple="false" :data="projectList" :children-key="'children'"
:label-key="'label'" :id-key="'value'" v-model="searchInfo.projectId"
@node-click="onVideoItemChange(2)" />
</scroll-view>
</view>
</u-dropdown-item>
<u-dropdown-item :title="searchInfo.riskTypeName" @change="onVideoItemChange(3)"
v-model="searchInfo.riskType" :options="riskTypeList"></u-dropdown-item>
</u-dropdown>
</view>
<view class="content" :style="{paddingTop: mobileTopHeight + 44 + 44 + 34 + 'px'}">
<!-- <u-tabs :bar-height="4" :font-size="28" active-color="#498CEC" inactive-color="#B3B3B3" :list="list"
:is-scroll="false" :current="current" @change="change"></u-tabs> -->
<scroll-view scroll-y="true" class="content_main" :class="{'content_main2': pageType=='backend'}">
<view class="main-box" v-if="workTicketList.length > 0">
<view class="item-box" @click="onNavigateToDetail(item)" v-for="item in workTicketList"
:key="item.id">
<image v-if="item.coverUrl" :src="url_config + 'image/'+ item.coverUrl" mode=""></image>
<view v-else class="image"></view>
<view class="box-bottom">
<view>
<view>{{item.workTicketNumber }}</view>
<view :class="{'onLine': item.deviceState == 1}"></view>
</view>
<view>
<image src="/static/location_fill.png" mode=""></image>
<view class="text-overflow">{{ defaultType ? item.constructionAreaNames : item.devName}}</view>
</view>
</view>
</view>
</view>
<view class="new-nodata-height" v-else>
<view class="new-nodata">
<view></view>
<text>暂无数据...</text>
</view>
</view>
<view :class="{'preview-btn2': pageType=='backend'}" v-if="workTicketList.length > 0"
class="preview-btn" @click="onNavigateToDetailAll">
<image src="/static/preview-icon.png" mode=""></image>
预览所有点位
</view>
</scroll-view>
</view>
<u-calendar v-model="constructionTimeShow" mode="range" :max-date="'2300-01-01'"
@change="onConstructionTimeChange"></u-calendar>
<footers v-if="pageType=='backend'" :activeTab="'highRisk'"></footers>
</view>
</template>
<script>
import TreeView from '@/components/tree-view/TreeView.vue';
import footers from "@/components/footers/footers.vue"
export default {
components: {
footers,
TreeView,
},
data() {
return {
mobileTopHeight: 0,
projectDetail: {},
list: [{
name: '全部'
}, {
name: '施工中在线'
}, {
name: '施工中离线'
}],
current: 0,
workTicketList: [],
userInfo: {},
dropdownFlag: false,
pageType: "",
pageNo: 1,
pageSize: 10,
searchInfo: {
deviceState: "",
deviceStateName: "设备状态",
projectId: [""],
projectName: "全部项目",
riskType: "",
riskTypeName: "风险状态",
applicationTime_begin: "",
applicationTime_end: "",
workTicketNumber: "",
},
deviceStateList: [{
value: "",
label: "全部设备"
}, {
value: 1,
label: "施工中在线"
}, {
value: 2,
label: "施工中离线"
}],
projectList: [],
riskTypeList: [{
value: "",
label: "全部风险"
}, {
value: 1,
label: "一般风险"
}, {
value: 2,
label: "高风险"
}],
constructionTimeShow: false,
defaultType: "",
}
},
onLoad(opts) {
// this.projectDetail = JSON.parse(uni.getStorageSync('projectDetail'))
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
this.pageType = opts.type;
if (opts.default == 1) {
this.defaultType = opts.default;
this.searchInfo.riskType = 2;
this.searchInfo.riskTypeName = "高风险";
this.searchInfo.projectName = "全部区域";
this.getQualityRegionListFn();
} else {
this.getSelectAllProjectInfoList();
}
this.getPoliceCameraItemListFn();
},
mounted() {
var that = this
uni.getSystemInfo({
success(res) {
that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0;
uni.setStorageSync('systemInfo', res)
console.log(res)
}
})
},
onReachBottom() {
console.log(1)
if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
this.isLoadMore = true
this.pageNo += 1
this.getPoliceCameraItemListFn()
}
},
onPullDownRefresh() {
console.log(2)
this.pageNo = 1
this.workTicketList = []
this.getPoliceCameraItemListFn()
},
methods: {
onNavigateToDetailAll() {
const itemIdList = this.workTicketList.map(item => item.itemId)
uni.navigateTo({
url: `./highRiskWorkTicketDetail?itemIdList=${JSON.stringify(itemIdList)}`
})
},
// 获取时间
onConstructionTimeChange(event) {
this.searchInfo.applicationTime_begin = event.startDate;
this.searchInfo.applicationTime_end = event.endDate;
this.onRefresh();
},
// 打开详情
onNavigateToDetail(row) {
uni.navigateTo({
url: `./highRiskWorkTicketDetail?itemId=${row.itemId}`
})
},
onOpen(index) {
this.$refs.uDropdown.highlight();
this.dropdownFlag = true;
},
onClose(index) {
this.$refs.uDropdown.highlight(index);
this.dropdownFlag = false;
},
onVideoItemChange(type) {
console.log("选择", type);
if (type == 1) {
const find = this.deviceStateList.find(item => item.value == this.searchInfo.deviceState);
this.searchInfo.deviceStateName = find && find.value ? find.label : "设备状态"
} else if (type == 2) {
const find = this.projectList.find(item => this.searchInfo.projectId.includes(item.value));
this.searchInfo.projectName = find && find.value ? find.label : this.defaultType ? "全部区域" : "全部项目"
this.$refs.uDropdown.close();
} else if (type == 3) {
const find = this.riskTypeList.find(item => item.value == this.searchInfo.riskType);
this.searchInfo.riskTypeName = find && find.value ? find.label : "风险状态"
}
this.onRefresh();
},
onRefresh() {
this.pageNo = 1
this.workTicketList = []
this.getPoliceCameraItemListFn()
},
// 获取工作票列表
getPoliceCameraItemListFn() {
let data = {
pageNo: this.pageNo,
pageSize: this.pageSize,
// projectSn: this.projectDetail.projectSn,
status: 2,
bindTicket: 1,
deviceState: this.searchInfo.deviceState,
riskType: this.searchInfo.riskType,
createDate_begin: this.searchInfo.applicationTime_begin,
createDate_end: this.searchInfo.applicationTime_end,
workTicketNumber: this.searchInfo.workTicketNumber,
}
if (this.defaultType) {
data.projectSn = this.projectDetail.projectSn;
data.constructionAreas = this.searchInfo.projectId.length > 0 ? this.searchInfo.projectId[0] : "";
} else {
data.projectSn = this.searchInfo.projectId.length > 0 ? this.searchInfo.projectId[0] : "";
}
this.sendRequest({
url: 'xmgl/policeCameraItem/page',
method: 'GET',
data: data,
success: res => {
uni.hideLoading()
if (res.code == 200) {
console.log("workList======================", res)
const resultList = res.result.records.map(item => {
return {
...item,
checked: false,
expandMoreShow: false,
}
})
this.workTicketList = this.workTicketList.concat(resultList)
if (res.result.records.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true
this.loadStatus = 'nomore'
} else {
this.isLoadMore = false
// that.loadStatus='more'
}
uni.stopPullDownRefresh()
}
}
})
},
// 获取所有项目
getSelectAllProjectInfoList() {
let data = {
sn: this.userInfo.sn,
}
this.sendRequest({
url: 'xmgl/project/selectAllProjectInfoList',
method: 'post',
data: data,
success: res => {
uni.hideLoading()
if (res.code == 200) {
this.projectList = [{
label: "全部项目",
value: ""
}, ...res.result.map(item => {
return {
...item,
label: item.projectName,
value: item.projectSn
}
})];
}
}
})
},
// 获取施工区域
getQualityRegionListFn() {
let that = this;
let data = {
projectSn: this.projectDetail.projectSn,
};
this.sendRequest({
url: 'xmgl/qualityRegion/list',
method: 'POST',
data: data,
success: res => {
if (res.code == 200) {
that.projectList = [{
label: "全部区域",
value: ""
}, ...res.result.map(item => {
return {
...item,
label: item.regionName,
value: item.id
}
})];;
}
}
})
},
change(index) {
this.current = index;
},
},
}
</script>
<style scoped lang="scss">
.preview-btn {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 20rpx;
width: 360rpx;
height: 84rpx;
background: #FFFFFF;
box-shadow: 0rpx 8rpx 8rpx 0rpx rgba(0, 0, 0, 0.25);
border-radius: 76rpx;
position: fixed;
left: 50%;
bottom: 0;
transform: translateX(-50%);
>uni-image {
width: 28rpx;
height: 28rpx;
margin-right: 16rpx;
}
}
.preview-btn2 {
bottom: 120rpx;
}
.main-box {
padding: 26rpx 26rpx 0;
background-color: #F2F3F7;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.item-box {
width: 340rpx;
height: 274rpx;
margin-bottom: 26rpx;
border-radius: 16rpx;
background: #FFFFFF;
.box-bottom {
// height: 102rpx;
padding: 12rpx 26rpx 12rpx;
>view:first-child {
font-weight: 500;
font-size: 22rpx;
color: #808080;
display: flex;
justify-content: space-between;
align-items: center;
>view:first-child {
flex: 1;
white-space: nowrap; /* 不换行 */
overflow: hidden; /* 隐藏溢出的内容 */
text-overflow: ellipsis; /* 用省略号表示溢出的文本 */
}
>view:last-child {
width: 20rpx;
height: 20rpx;
background-color: #D8DBE8;
border-radius: 50%;
flex-shrink: 0;
}
.onLine {
background: #00E000 !important;
}
}
>view:last-child {
display: flex;
font-size: 22rpx;
color: #CCCCCC;
margin-top: 10rpx;
.text-overflow {
flex: 1;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
>uni-image {
width: 28rpx;
height: 28rpx;
margin-right: 16rpx;
}
}
}
>uni-image,
.image {
width: 340rpx;
height: 172rpx;
border-radius: 16rpx 16rpx 0 0;
}
.image {
background-color: #000000;
}
}
}
.content_main {
padding-bottom: 130rpx;
}
.content_main2 {
padding-bottom: 220rpx;
}
/deep/ .dropdownFlag {
.u-dropdown__content {
display: none;
}
}
/deep/ .u-dropdown {
background-color: white;
.u-dropdown__content__popup {
padding: 20rpx 26rpx;
}
.u-dropdown__menu {
flex-wrap: wrap;
// height: 166rpx !important;
box-shadow: none;
padding: 0 26rpx;
justify-content: space-between;
// justify-content: center;
.u-dropdown__menu__item {
// height: 82rpx;
width: 33%;
flex: initial;
.u-flex {
width: 100%;
justify-content: center;
}
}
}
.u-dropdown__menu__item__text {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
// font-weight: 800;
// font-size: 32rpx !important;
// color: #1A1A1A !important;
}
.u-dropdown__menu__item__arrow {
// display: none;
}
}
.new-nodata {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
>view {
width: 300rpx;
height: 300rpx;
background-image: url('@/static/staffAttendance/nodata.png');
background-repeat: no-repeat;
background-size: 100% 100%;
}
>text {
font-size: 22rpx;
color: #808080;
margin-top: 60rpx;
}
}
.addIssue {
min-height: 100vh;
background-color: #F2F3F7;
}
.fixedheader {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
/deep/ .headerBox {
border-bottom: none;
}
.headerName {
z-index: 1;
}
.uni-form-item {
padding: 0 26rpx;
position: relative;
background-color: white;
display: flex;
.uni-input {
border: 2rpx solid #E4E4E4;
border-radius: 68rpx;
padding: 0;
font-size: 30rpx;
color: #444444;
width: 548rpx;
/deep/ .u-content {
background-color: #F2F3F8 !important;
.u-input {
background-color: #F2F3F8 !important;
color: #444444 !important;
font-size: 30rpx;
}
}
}
}
.calendar_box {
width: 130rpx;
height: 66rpx;
background: #F2F3F8;
border-radius: 68rpx;
margin-left: 20rpx;
display: flex;
align-items: center;
justify-content: center;
.calendar {
width: 40rpx;
height: 40rpx;
background-image: url('@/static/workTicketManage/calendar.png');
background-repeat: no-repeat;
background-size: 100% 100%;
}
.calendar_active {
background-image: url('@/static/workTicketManage/calendar-active.png');
}
}
}
</style>