hn_ldlz/ldlz-H5/pages/wtjl/index.vue

904 lines
25 KiB
Vue

<template>
<view>
<page-meta :page-font-size="$store.state.vuex_fontsize+'px'"
:root-font-size="$store.state.vuex_fontsize+'px'"></page-meta>
<!-- 履职记录 -->
<view class="wtjl">
<view class="uni-padding-wrap uni-common-mt">
<u-tabs :list="items" :current="current" @click="onClickItem" :activeStyle="{
color: '#303133',
fontWeight: 'bold',
transform: 'scale(1.05)'
}" :inactiveStyle="{
color: '#606266',
transform: 'scale(1)'
}" :lineColor="'#00B37D'"></u-tabs>
<!-- <uni-segmented-control :values="items" style-type="text" @clickItem="onClickItem" /> -->
</view>
</view>
<view class="myRecord" v-if="current === 0">
<view style="width: 100%;display: flex;justify-content: space-between;">
<picker mode="selector" :range="myyears" @change="myonYearChange" style="width: 29%;">
<view class="picker" style="width: 100%;">
<view>
{{myselectedYear}}
</view>
<u-icon name="arrow-down"></u-icon>
</view>
</picker>
<picker mode="selector" :range="mymonths" @change="myonMonthChange" style="width: 29%;">
<view class="picker" style="width: 100%;">
<view>
{{myselectedMonth}}
</view>
<u-icon name="arrow-down"></u-icon>
</view>
</picker>
<picker mode="selector" :range="mylzlxType" @change="myonLzlxChange" style="width: 39%;">
<view class="picker" style="width: 100%;">
<view>
{{myselectedLzlxType}}
</view>
<u-icon name="arrow-down"></u-icon>
</view>
</picker>
</view>
<view classs="search-box" style="display: flex;justify-content: space-between;align-items: center;">
<picker mode="selector" :range="myZgType" @change="myZgChange" style="width: 35%;" range-key="label">
<view class="picker" style="width: 100%;">
<view>
{{myselectedZgTypeName}}
</view>
<u-icon name="arrow-down"></u-icon>
</view>
</picker>
<uni-search-bar style="width: 64%;" @confirm="mysearch" :focus="false" v-model="mysearchValue"
@cancel="mycancel" bgColor="#fff" radius="3" />
</view>
<view class="u-page">
<u-list @scrolltolower="myscrolltolower" v-if="myrecordList.length>0">
<u-list-item v-for="(item, index) in myrecordList" :key="index">
<view class="wtjl-box" @click="gotoDtail(item.id)">
<view class="wtjl1" style="justify-content: space-between;flex-wrap: wrap;">
<view class="title-box">
{{item.projectName}}
<view class="copy-box" :class="item.type == 0?'type-box':'type2-box'">
{{item.type == 0 ? '现场履职' :"班组履职"}}
</view>
</view>
<view class="sort" style="background: url('../../static/images/jb_red.png') no-repeat 0 0 / 100% 100%;"
v-if="index<3">
{{index+1}}
</view>
<view class="sort" style="background: url('../../static/images/jb_blue.png') no-repeat 0 0 / 100% 100%;"
v-else>
{{index+1}}
</view>
</view>
<view class="wtjl2">
<view class="time">{{item.createTime.substr(0,16)}}</view>
<!-- <view class="copy-box" @click.stop="gotoCopy(item)">复制</view> -->
</view>
<view class="wtjl3">
<view class="book-box">
<view class="book">
<u-icon size="22" :name="'../../static/images/sc.svg'"></u-icon>
<view class="name3">{{item.handbookName}}</view>
</view>
<!-- <view class="title-box"> 二、人员安全履职 </view> -->
</view>
<view v-if="item.problemList[0]" class="type2-box" @click.stop="gotoCopy(item)">复制
</view>
<!-- <view :class="item.type == 0?'type-box':'type2-box'">{{item.type == 0 ? '现场履职' :"班组履职"}}
</view> -->
</view>
<view class="wtjl4" v-if="item.problemList[0]">
<u-icon size="22" :name="'../../static/images/wt.svg'"></u-icon>
<view class="title-box">{{item.problemList[0].remark}}</view>
</view>
<view class="wtjl5" v-if="isShow()&&item.problemList[0]">
<u-icon size="22" :name="'../../static/images/rygl.svg'"></u-icon>
<view class="title-box">{{item.problemList[0].responsiblePerson}}</view>
</view>
<view class="wtjl4" v-if="!item.problemList[0]">
<u-icon size="22" :name="'../../static/images/wt.svg'"></u-icon>
<view class="title-box2">无安全问题</view>
</view>
<view class="wtjl6" v-if="item.otherUserName">
<u-icon size="20" :name="'../../static/images/txr.svg'"></u-icon>
<view class="name-box">
{{getOhterUserName(item.otherUserName).toString()}}
</view>
</view>
<view class="wtjl6" v-if="item.zgType">
<!-- <u-icon size="20" :name="'../../static/images/txr.svg'"></u-icon> -->
<view class="name-box">
<u-tag v-if="item.zgType==1" text="已整改" type="success" shape="circle" plain plainFill></u-tag>
<u-tag v-if="item.zgType==2" text="未整改" type="error" shape="circle" plain plainFill></u-tag>
</view>
</view>
</view>
</u-list-item>
</u-list>
<u-empty v-else mode="data">
</u-empty>
</view>
</view>
<view class="txrRecord" v-if="current === 1">
<view style="width: 100%;display: flex;justify-content: space-around;">
<picker mode="selector" :range="years" @change="onYearChange" style="width: 29%;">
<view class="picker" style="width: 100%;">
<view>
{{selectedYear}}
</view>
<u-icon name="arrow-down"></u-icon>
</view>
</picker>
<picker mode="selector" :range="months" @change="onMonthChange" style="width: 29%;">
<view class="picker" style="width: 100%;">
<view>
{{selectedMonth}}
</view>
<u-icon name="arrow-down"></u-icon>
</view>
</picker>
<picker mode="selector" :range="lzlxType" @change="onLzlxChange" style="width: 39%;">
<view class="picker" style="width: 100%;">
<view>
{{selectedLzlxType}}
</view>
<u-icon name="arrow-down"></u-icon>
</view>
</picker>
</view>
<view classs="search-box" style="display: flex;justify-content: space-between;align-items: center;">
<picker mode="selector" :range="zgType" @change="onZgChange" style="width: 35%;" range-key="label">
<view class="picker" style="width: 100%;">
<view>
{{selectedZgTypeName}}
</view>
<u-icon name="arrow-down"></u-icon>
</view>
</picker>
<uni-search-bar style="width: 64%;" @confirm="search" :focus="false" v-model="searchValue" @cancel="cancel" bgColor="#fff"
radius="3" />
</view>
<view class="u-page">
<u-list @scrolltolower="scrolltolower" v-if="recordList.length>0">
<u-list-item v-for="(item, index) in recordList" :key="index">
<view class="wtjl-box" @click="gotoDtail(item.id)">
<view class="wtjl1" style="justify-content: space-between;">
<view class="title-box">
{{item.projectName}}
<view class="copy-box" :class="item.type == 0?'type-box':'type2-box'">
{{item.type == 0 ? '现场履职' :"班组履职"}}
</view>
</view>
<view class="sort" style="background: url('../../static/images/jb_red.png') no-repeat 0 0 / 100% 100%;"
v-if="index<3">
{{index+1}}
</view>
<view class="sort" style="background: url('../../static/images/jb_blue.png') no-repeat 0 0 / 100% 100%;"
v-else>
{{index+1}}
</view>
</view>
<view class="wtjl2">
<view class="time">{{item.createTime.substr(0,16)}}</view>
</view>
<view class="wtjl3">
<view class="book-box">
<view class="book">
<u-icon size="22" :name="'../../static/images/sc.svg'"></u-icon>
<view class="name3">{{item.handbookName}}</view>
</view>
<!-- <view class="title-box"> 二、人员安全履职 </view> -->
</view>
<!-- <view :class="item.type == 0?'type-box':'type2-box'">{{item.type == 0 ? '现场履职' :"班组履职"}}
</view> -->
<view v-if="item.problemList[0]" class="type2-box" @click.stop="gotoCopy(item)">复制
</view>
</view>
<view class="wtjl4" v-if="item.problemList[0]">
<u-icon size="22" :name="'../../static/images/wt.svg'"></u-icon>
<view class="title-box">{{item.problemList[0].remark}}</view>
</view>
<view class="wtjl5" v-if="isShow()&&item.problemList[0]">
<u-icon size="22" :name="'../../static/images/rygl.svg'"></u-icon>
<view class="title-box">{{item.problemList[0].responsiblePerson}}</view>
</view>
<view class="wtjl4" v-if="!item.problemList[0]">
<u-icon size="22" :name="'../../static/images/wt.svg'"></u-icon>
<view class="title-box2">无安全问题</view>
</view>
<view class="wtjl6" v-if="item.otherUserName">
<u-icon size="20" :name="'../../static/images/txr.svg'"></u-icon>
<view class="name-box">
{{getOhterUserName(item.otherUserName).toString()}}
</view>
</view>
<view class="wtjl6" v-if="item.zgType">
<!-- <u-icon size="20" :name="'../../static/images/txr.svg'"></u-icon> -->
<view class="name-box">
<u-tag v-if="item.zgType==1" text="已整改" type="success" shape="circle" plain plainFill></u-tag>
<u-tag v-if="item.zgType==2" text="未整改" type="error" shape="circle" plain plainFill></u-tag>
</view>
</view>
</view>
</u-list-item>
</u-list>
<u-empty v-else mode="data">
</u-empty>
</view>
</view>
<!-- 复制弹出框 -->
<view>
<u-modal :show="copyShow" title="履职内容" confirmText="复制" cancelText="取消" :showCancelButton='true'
@cancel="copyCancel" @confirm="copyConfirm">
<view class="slot-content">
<rich-text :nodes="content"></rich-text>
</view>
</u-modal>
</view>
</view>
</template>
<script>
import {
mylzProblemRecordList,
lzProblemRecordList
} from '@/api/record.js'
import auth from "@/plugins/auth.js"
export default {
data() {
return {
current: 0,
items: [{
name: '我的记录'
}, {
name: '同行人记录'
}],
copyShow: false,
content: ``,
// 我的记录
myselectedYear: new Date().getFullYear() + '年', // 默认选中的年份
myyears: [], // 年份数组
myselectedMonth: '全部月', // 默认选中的年份
mymonths: ["全部月"], // 年份数组
myselectedLzlxType: '履职类型', // 默认全部
mylzlxType: ["全部", "班组履职", "现场履职"], // 履职类型
myselectedZgType: '', // 默认全部
myselectedZgTypeName: '是否整改', // 默认全部
myZgType: [{
id: "",
label: "全部"
}, {
id: "2",
label: "未整改"
}, {
id: "1",
label: "已整改"
}], // 履职类型
mysearchValue: '', // 搜索框的值
myrecordList: [],
mypageNum: 1,
mytotal: 0,
// 同行人记录
selectedYear: new Date().getFullYear() + '年', // 默认选中的年份
years: [], // 年份数组
selectedMonth: '全部月', // 默认选中的年份
months: ["全部月"], // 年份数组
selectedLzlxType: '履职类型', // 默认全部
lzlxType: ["全部", "班组履职", "现场履职"], // 履职类型
selectedZgType: '', // 默认全部
selectedZgTypeName: '是否整改', // 默认全部
zgType: [{
id: "",
label: "全部"
}, {
id: "2",
label: "未整改"
}, {
id: "1",
label: "已整改"
}], // 履职类型
searchValue: '', // 搜索框的值
recordList: [],
pageNum: 1,
total: 0
}
},
onLoad(option) {
this.mylzProblemRecordList();
// 初始化年份数组
for (let i = new Date().getFullYear(); i >= 2010; i--) {
this.myyears.push(i + '年');
}
// 初始化月份数组
for (let i = 1; i < 13; i++) {
this.mymonths.push(i + '月');
}
},
methods: {
isShow() {
return auth.hasPermi('system:config:showResponsiblePerson');
},
getOhterUserName(otherUserName) {
if (otherUserName) {
let arr = otherUserName.split(',');
if (arr.length > 0) {
return arr;
} else {
return [];
}
} else {
return [];
}
},
// 点击 tab 切换
onClickItem(e) {
console.log(e);
if (this.current !== e.index) {
this.current = e.index
}
if (this.current == 1) {
// 初始化年份数组
for (let i = new Date().getFullYear(); i >= 2010; i--) {
this.years.push(i + '年');
}
// 初始化月份数组
for (let i = 1; i < 13; i++) {
this.months.push(i + '月');
}
this.pageNum = 1
this.recordList = []
this.lzProblemRecordList();
} else {
// 初始化年份数组
for (let i = new Date().getFullYear(); i >= 2010; i--) {
this.myyears.push(i + '年');
}
// 初始化月份数组
for (let i = 1; i < 13; i++) {
this.mymonths.push(i + '月');
}
this.mypageNum = 1
this.myrecordList = []
this.mylzProblemRecordList();
}
},
// 点击复制按钮
gotoCopy(item) {
this.copyShow = true;
var copyData = [];
item.problemList.forEach((e, i) => {
copyData.push(
i + 1 + '、' + e.remark + '。'
)
})
this.content =
`${item.projectName}项目在${item.createTime.substr(0,16)}${item.type==0?'现场履职':'班组履职'},发现以下问题:<br>${copyData.join('<br>')}`
},
copyCancel() {
this.copyShow = false;
},
copyConfirm() {
this.copyShow = false;
this.copyToClipboard(this.content.replace(/<br\s*\/?>/g, "\r"));
uni.showToast({
title: '复制成功',
icon: 'none'
})
},
copyToClipboard(text) {
try {
navigator.clipboard.writeText(text);
console.log('内容已复制到剪贴板');
} catch (err) {
console.error('复制到剪贴板失败', err);
}
},
gotoDtail(item) {
uni.navigateTo({
url: '/pages/wtjl/detail?id=' + item
})
},
// ----------------------我的记录-----------------------
myonYearChange(e) {
// 选中年份变更时触发
this.myselectedYear = this.myyears[e.detail.value];
this.mypageNum = 1
this.myrecordList = []
this.mylzProblemRecordList()
},
myonMonthChange(e) {
// 选中年份变更时触发
this.myselectedMonth = this.mymonths[e.detail.value];
this.mypageNum = 1
this.myrecordList = []
this.mylzProblemRecordList()
},
myonLzlxChange(e) {
// 选中履职类型变更时触发
this.myselectedLzlxType = this.mylzlxType[e.detail.value];
this.mypageNum = 1
this.myrecordList = []
this.mylzProblemRecordList()
},
myZgChange(e) {
// 选中履职类型变更时触发
this.myselectedZgType = this.myZgType[e.detail.value].id;
this.myselectedZgTypeName = this.myZgType[e.detail.value].label;
this.mypageNum = 1
this.myrecordList = []
this.mylzProblemRecordList()
},
mysearch(res) {
// 搜索时触发
this.mysearchValue = res.value;
this.mypageNum = 1
this.myrecordList = []
this.mylzProblemRecordList()
},
mycancel(res) {
// 取消时触发
this.mysearchValue = '';
this.mypageNum = 1
this.myrecordList = []
this.mylzProblemRecordList()
},
myscrolltolower() {
if (this.mytotal > this.mypageNum * 10) {
this.mypageNum++
this.mylzProblemRecordList()
}
},
// 我的记录列表
mylzProblemRecordList() {
uni.showLoading({
title: '获取中...'
})
var params = {}
params.pageNum = this.mypageNum
if (this.myselectedMonth == '全部月') {
// console.log('myselectedYear',this.myselectedYear.replace("年",""));
params.startTime = this.myselectedYear.replace("年", "-01-01")
params.endTime = this.myselectedYear.replace("年", "-12-31")
} else {
let myselectedMonth = parseInt(this.myselectedMonth);
if (myselectedMonth <= 9) {
myselectedMonth = '0' + myselectedMonth.toString() + '月';
} else {
myselectedMonth = '0' + myselectedMonth.toString() + '月';
}
params.startTime = this.myselectedYear.replace("年", "-") + myselectedMonth.replace("月", "-01")
params.endTime = this.myselectedYear.replace("年", "-") + myselectedMonth.replace("月", "-31")
}
params.handbookType = (this.myselectedLzlxType === '履职类型' || this.myselectedLzlxType === '全部') ? '' : (this
.myselectedLzlxType === '现场履职' ? 0 : 1); // 履职类型赋值
params.keyword = this.mysearchValue; // 搜索框赋值
params.zgType = this.myselectedZgType;
mylzProblemRecordList(params).then(res => {
uni.hideLoading();
this.mytotal = res.total
console.log('我的记录列表数据', res);
res.rows.forEach(e => {
this.myrecordList.push(e)
})
})
},
// ----------------------同行人记录----------------------
onYearChange(e) {
// 选中年份变更时触发
this.selectedYear = this.years[e.detail.value];
this.pageNum = 1
this.recordList = []
this.lzProblemRecordList()
},
onMonthChange(e) {
// 选中年份变更时触发
this.selectedMonth = this.months[e.detail.value];
this.pageNum = 1
this.recordList = []
this.lzProblemRecordList()
},
onLzlxChange(e) {
// 选中履职类型变更时触发
this.selectedLzlxType = this.lzlxType[e.detail.value];
this.pageNum = 1
this.recordList = []
this.lzProblemRecordList()
},
onZgChange(e) {
// 选中履职类型变更时触发
this.selectedZgType = this.zgType[e.detail.value].id;
this.selectedZgTypeName = this.zgType[e.detail.value].label;
this.pageNum = 1
this.recordList = []
this.lzProblemRecordList()
},
scrolltolower() {
if (this.total > this.pageNum * 10) {
this.pageNum++
this.lzProblemRecordList()
}
},
search(res) {
// 搜索时触发
this.searchValue = res.value;
this.pageNum = 1
this.recordList = []
this.lzProblemRecordList()
},
cancel(res) {
// 取消时触发
this.searchValue = '';
this.pageNum = 1
this.recordList = []
this.lzProblemRecordList()
},
// 同行人记录列表
lzProblemRecordList() {
uni.showLoading({
title: '获取中...'
})
var params = {}
params.pageNum = this.pageNum
if (this.selectedMonth == '全部月') {
params.startTime = this.selectedYear.replace("年", "-01-01")
params.endTime = this.selectedYear.replace("年", "-12-31")
} else {
let selectedMonth = parseInt(this.selectedMonth);
if (selectedMonth <= 9) {
selectedMonth = '0' + selectedMonth.toString() + '月';
} else {
selectedMonth = selectedMonth.toString() + '月';
}
params.startTime = this.selectedYear.replace("年", "-") + selectedMonth.replace("月", "-01")
params.endTime = this.selectedYear.replace("年", "-") + selectedMonth.replace("月", "-31")
}
params.handbookType = (this.selectedLzlxType === '履职类型' || this.selectedLzlxType === '全部') ? '' : (this
.selectedLzlxType === '现场履职' ? 0 : 1); // 履职类型赋值
params.keyword = this.searchValue; // 搜索框赋值
params.zgType = this.selectedZgType;
lzProblemRecordList(params).then(res => {
uni.hideLoading();
this.total = res.total
console.log('同行人记录列表数据', res);
res.rows.forEach(e => {
this.recordList.push(e)
})
})
}
}
}
</script>
<style lang="scss" scoped>
uni-page-body {
height: 100%;
padding: 10rpx;
background-color: #FAFAFA;
}
.picker {
background-color: #ffffff;
box-sizing: border-box;
border: #e4e4e4 solid 1px;
border-radius: 5px;
width: 100px;
height: 35px;
font-size: 11px;
line-height: 35px;
padding-left: 10px;
padding-right: 10px;
display: flex;
justify-content: space-between;
}
.wtjl {
margin-top: 2px;
}
.myRecord,
.txrRecord {
padding: 20rpx;
}
.wtjl-box {
width: 100%;
margin-bottom: 10px;
padding: 19px;
background: inherit;
background-color: rgba(255, 255, 255, 1);
box-sizing: border-box;
border-width: 1px;
border-style: solid;
border-color: rgba(242, 242, 242, 1);
border-radius: 4px;
.wtjl1 {
position: relative;
.title-box {
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑', sans-serif;
font-weight: 600;
font-style: normal;
font-size: 16px;
line-height: 28px;
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
display: inline-block;
width: 80%;
.copy-box {
display: inline-block;
height: 21px;
font-family: 'Font Awesome 5 Pro', sans-serif;
font-weight: 400;
font-style: normal;
font-size: 12px;
// letter-spacing: 1px;
color: #24BD8E;
// line-height: 12px;
box-sizing: border-box;
// border-width: 1px;
// border-style: solid;
// border-color: #24BD8E;
// border-radius: 1px;
margin-left: 5px;
}
.type-box {
width: 60px;
line-height: 21px;
text-align: center;
border: none;
box-shadow: none;
font-family: 'Arial Normal', 'Arial', sans-serif;
font-weight: 400;
font-style: normal;
font-size: 12px;
color: #ffaa00;
background-color: #fffbee;
}
.type2-box {
width: 50px;
border: none;
// background: #00aaff;
box-shadow: none;
font-family: 'Arial Normal', 'Arial', sans-serif;
font-weight: 400;
font-style: normal;
font-size: 12px;
color: #00aaff;
background-color: #e6fcff;
}
}
.sort {
width: 35px;
height: 30px;
display: flex;
justify-content: center;
align-items: center;
color: rgba(255, 255, 255, 0.8);
font-family: 'DIN Condensed Bold', 'DIN', sans-serif;
font-weight: 700;
font-style: normal;
font-size: 14px;
position: absolute;
right: -8px;
top: -8px;
}
.lzr-box {
width: 55%;
font-size: 11px;
letter-spacing: 1px;
color: #999999;
text-align: left;
font-family: 'Arial Normal', 'Arial', sans-serif;
font-weight: 400;
font-style: normal;
margin-left: 10px;
}
}
.wtjl2 {
display: flex;
align-items: center;
.time {
font-size: 13px;
color: #999999;
font-family: 'Arial Normal', 'Arial', sans-serif;
font-weight: 400;
font-style: normal
}
}
.wtjl3 {
display: flex;
justify-content: space-between;
align-items: center;
.book-box {
.book {
display: flex;
align-items: center;
.name3 {
font-size: 15px;
color: #333333;
font-family: 'Arial Normal', 'Arial', sans-serif;
font-weight: 600;
margin-left: 10px;
}
}
}
.type-box {
display: flex;
align-items: center;
justify-content: center;
width: 60px;
height: 25px;
border: none;
border-radius: 5px;
background: linear-gradient(180deg, #FEC52B 0%, #FC7833 100%);
box-shadow: none;
font-family: 'Arial Normal', 'Arial', sans-serif;
font-weight: 400;
font-style: normal;
font-size: 12px;
color: #FFFFFF;
}
.type2-box {
display: flex;
align-items: center;
justify-content: center;
width: 60px;
height: 25px;
border: none;
border-radius: 5px;
background: #24BD8E;
box-shadow: none;
font-family: 'Arial Normal', 'Arial', sans-serif;
font-weight: 400;
font-style: normal;
font-size: 12px;
color: #FFFFFF;
}
}
.wtjl4 {
display: flex;
align-items: center;
margin-top: 10px;
.title-box {
font-family: 'Arial Normal', 'Arial', sans-serif;
font-weight: 500;
color: #ff0000;
font-size: 15px;
margin-left: 10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.title-box2 {
font-family: 'Arial Normal', 'Arial', sans-serif;
font-weight: 200;
color: #999;
font-size: 14px;
margin-left: 10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.wtjl5 {
display: flex;
align-items: center;
margin-top: 10px;
.title-box {
font-family: 'Arial Normal', 'Arial', sans-serif;
font-weight: 500;
color: #999;
font-size: 15px;
margin-left: 10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.wtjl6 {
display: flex;
align-items: center;
margin-top: 10px;
.name-box {
display: flex;
align-items: center;
justify-content: center;
font-family: 'Arial Normal', 'Arial', sans-serif;
font-weight: 400;
font-style: normal;
font-size: 14px;
color: #999;
margin-left: 10px;
}
}
.wtjl7 {}
}
.u-divider {
margin: 5px 0;
}
::v-deep .uni-searchbar {
padding-left: 0px;
padding-right: 0px;
}
::v-deep .uni-searchbar__box {
border: 1px solid #e4e4e4;
}
::v-deep .picker {
border-radius: 3px;
}
</style>