123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- <template>
- <view style="overflow: hidden;">
- <cu-custom bgColor="bg-blue" :isBack="true">
- <block slot="backText">安全巡视</block>
- <block slot="content"></block>
- <block slot="right">
- <view class=" flex justify-center">
- <!-- <button class="margin-top-ssm cu-btn round bg-blue text-blue"><text class="cuIcon-add"></text></button> -->
- </view>
- </block>
- </cu-custom>
- <!-- 项目合同信息 -->
- <!-- <view style="padding: 22rpx 0;background-color: #F7F7F7;">
- <cu-project :projectList="projectList" style="height: 236rpx;background-color: #C6E6FF;"></cu-project>
- </view> -->
- <view style="padding: 0rpx 0rpx 22rpx;background-color: #F7F7F7;">
- <view class="cu-item shadowType" style="height: 100%;background-color: #FFFFFF;border-radius: 0 0 20rpx 20rpx;border-top: 2rpx solid#0A8CD5;" >
- <calendar @selected-change="datechange" ref="calendarData" :showBack="true" :dotList="dotList" :dotStyle="dotStyle"></calendar>
- </view>
- </view>
- <!-- 日志 -->
- <view class="journal_b">
- <view class="journal_1">
- <view :class="chooseTime=='' ? 'journal_ts':'journal_time'">
- {{chooseTime=='' ? '请选择时间':chooseTime}}
- ({{personLength}}人)
- </view>
- <view>
- <button @click="navTo()" v-if="type==0 && chooseTime!=''" class="journal-btn" >立即填报</button>
- <button @click="navTo()" v-if="type==1 && chooseTime!=''" class="journal-btn" >编辑</button>
- <text v-if="type==2 && chooseTime!=''" class="text-gray">未开始</text>
- <text v-if="type==4" class="text-gray"></text><!-- 别人的日志只能看不能操作 -->
- </view>
- </view>
- </view>
- <view>
- <view style="overflow-x: scroll;width: 100%;margin: 20rpx 0 0 16rpx ;display: flex;">
- <view class="name-box" style="flex-shrink: 0;"
- :class="index == curPersonIndex ? 'name-sele' : '' "
- v-for="(person,index) in personList" :key="index"
- @click="selectPerson(index)">{{person.username}}</view>
- </view>
- </view>
- <view v-if="type==0 || type==2 || type ==null || chooseTime==''" class="padding bg-white text-center">
- <view class="padding">
- <image class="menuImageNoTask" src="../../static/task/noTask.png"></image>
- </view>
- <view class="padding">暂时没有提交日志~</view>
- </view>
- <view v-else style="padding: 22rpx 22rpx 80rpx;">
- <template v-if="isZJ">
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">检查日期:
- <text class="margin-right-sm2">{{logData.date}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">工程地点、部位:
- <text class="margin-right-sm2">{{logData.jobContent}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">隐患或危险因素描述:
- <text class="margin-right-sm2">{{logData.problem}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">处理意见:
- <text class="margin-right-sm2">{{logData.processingOpinion}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">复查日期:
- <text class="margin-right-sm2">{{logData.fuchadate}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">施工责任人:
- <text class="margin-right-sm2">{{logData.superreviewer}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">整改落实情况:
- <text class="margin-right-sm2">{{logData.patrolContent}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">复查意见:
- <text class="margin-right-sm2">{{logData.reviewOpinions}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">备注:
- <text class="margin-right-sm2">{{logData.remark}}</text>
- </text>
- </view>
- </template>
- <template v-else>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">编号:
- <text class="margin-right-sm2">{{logData.serialNumber}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">巡查日期:
- <text class="margin-right-sm2">{{logData.date}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">复查日期:
- <text class="margin-right-sm2">{{logData.fuchadate}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">复查人:
- <text class="margin-right-sm2">{{logData.superreviewer}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">巡查位置、内容:
- <text class="margin-right-sm2">{{logData.jobContent}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">存在的安全隐患:
- <text class="margin-right-sm2">{{logData.patrolContent}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">隐患处理情况:
- <text class="margin-right-sm2">{{logData.acceptance}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">隐患整改复查情况:
- <text class="margin-right-sm2">{{logData.problem}}</text>
- </text>
- </view>
- </template>
-
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- userInfo:"",
- projectList:'',
- index:0,
- content:"",
- dotList:[],
- dotStyle:{color: 'black'},
- type:null,
- chooseTime:"",
- logData:"",
- chooseData:"",
-
- personList:[],
- curPersonIndex:0,
-
- isZJ:0,
- }
- },
- computed:{
- personLength: function () {
- var num = 0;
- for (let i = 0; i < this.personList.length; i++) {
- if(this.personList[i].id){
- num ++;
- }
- }
- return num;
- }
- },
- onShow() {
- var that = this;
- that.onLoadData();
- that.chooseTime='';
- /* 监听今天 */
- uni.$on("clickToday", res => {
- that.findDiaryByToday();
- });
- },
- methods: {
- datechange(e){
- var nowDate =new Date().toISOString().slice(0, 10);
- this.chooseTime = e.fullDate;
- if(nowDate<e.fullDate || !e.info){//超出今天或者在项目开始前都算 未开始
- this.type=2;
- this.personList = [];
- return;
- }
-
- //未填写过不查询
- if(!(e.info && e.info.id)){
- this.type = 0;
- this.personList = [];
- return;
- }
-
-
- this.curPersonIndex = [0];
- this.http.request('/app/superpatrol/getDataByDate', {
- recorderId:'',
- contractId:this.projectList.contractId,
- date:e.fullDate
- }).then((res)=>{
- //如果没人填写过
- if(!res.datas || res.datas.length < 1){
- this.type = 0;
- this.personList = [];
- return;
- }
-
- //console.log(res)
-
- //根据数据获取当前是否 已经填写了
- let myIndex = -1;
- res.datas.forEach((item,index)=>{
- if(item.recorderId == this.userInfo.id){
- myIndex = index;
- return;
- }
- })
- if(myIndex > -1){
- this.type = 1;
- //把自己放到第一位
- let myData = res.datas.splice(myIndex,1);
- res.datas.unshift(myData[0]);
- }else{
- this.type = 0;
- res.datas.unshift({
- username:this.userInfo.userName,
- recorderId:this.userInfo.id,
- id:''
- });
- }
- this.personList = res.datas;
-
- this.chooseData = res.datas[0];
- this.logData = res.datas[0];
- })
- },
- navTo(){
- uni.navigateTo({
- url:"update/update?time="+this.chooseTime+"&type="+this.type+"&id="+this.chooseData.id
- })
- },
- /* 刷新方法 */
- onLoadData(){
- var userInfo = uni.getStorageSync("userInfo")
- if(userInfo){
- this.userInfo = userInfo;
- }
- var project = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id);
- if(project){
- this.projectList =project;//获取选中的当前项目
- }else{
- this.findProject();
- }
- this.findDiaryDate();
-
- this.getIsZJ();
- },
- /* 查询项目 */
- findProject(){
- var that =this;
- that.http.request('/app/login', { userId:this.userInfo.id }).then((result)=>{
- if(result.datas.length!=0){
- that.projectList=result.datas[0];
- //默认选中第一条
- uni.setStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id,that.projectList);
- }
- })
-
- },
- /* 获取施工日志*/
- findDiaryDate(){
- var that =this;
- that.http.request('/app/superpatrol/list', {
- recorderId:that.userInfo.id,
- contractId:that.projectList.contractId
- }).then((result)=>{
- that.dotList = result;
- if(!that.$refs.calendarData || !that.$refs.calendarData.selectedItem){
- //如果当前没有选择的日期获取今天的
- let today =that.intervalTime.getTime();
- this.chooseTime = today
- //如果不在日期范围内不请求
- let dateListSort = JSON.parse(JSON.stringify(result));
- dateListSort.sort(function(a, b) {
- return b.date < a.date ? -1 : 1
- })
- //console.log(dateListSort)
-
- if(today>dateListSort[0].date || today<dateListSort[dateListSort.length-1].date){
- return
- }
-
- that.findDiaryByToday();
- }
- if(that.$refs.calendarData && that.$refs.calendarData.selectedItem){
- //如果有获取当前的
- var selectedItem = that.$refs.calendarData.selectedItem
- var time = selectedItem.fullDate;
- //console.log(that.dotList)
- that.dotList.forEach(item=>{
- if(item.date == time){
- that.datechange(Object.assign(selectedItem,{'info':item}));
- return;
- }
- })
- }
- })
- },
- /* 根据当前时间获取施工日志数据*/
- findDiaryByToday(){
- var that =this;
- var time =that.intervalTime.getTime();
- //console.log(time)
-
- this.http.request('/app/superpatrol/getDataByDate', {
- recorderId:'',
- contractId:this.projectList.contractId,
- date:time
- }).then((res)=>{
- //如果没人填写过
- if(!res.datas || res.datas.length < 1){
- this.chooseTime = time;
- this.type = 0;
- this.personList = [];
- return;
- }
-
- //console.log(res)
- this.chooseTime = time;
- //根据数据获取当前是否 已经填写了
- let myIndex = -1;
- res.datas.forEach((item,index)=>{
- if(item.recorderId == this.userInfo.id){
- myIndex = index;
- return;
- }
- })
- if(myIndex > -1){
- this.type = 1;
- //把自己放到第一位
- let myData = res.datas.splice(myIndex,1);
- res.datas.unshift(myData[0]);
- }else{
- this.type = 0;
- res.datas.unshift({
- username:this.userInfo.userName,
- recorderId:this.userInfo.id,
- id:''
- });
- }
- this.personList = res.datas;
-
- this.chooseData = res.datas[0];
- this.logData = res.datas[0];
- })
- },
- selectPerson(index){
- this.curPersonIndex = index;
- //是否有填写日志
- if(this.personList[index].id){
- //只能看别人
- if(this.personList[index].recorderId == this.userInfo.id){
- this.type = 1;
- }else{
- this.type = 4;
- }
- this.chooseData = this.personList[index];
- this.logData = this.personList[index];
- }else{
- this.type = 0;
- }
- },
-
- getIsZJ(){
- this.http.request('/app/working/checkProjectIsZj', {
- projectId:this.projectList.id
- }).then((result)=>{
- if(result.result == '1'){
- this.isZJ = 1;
- }else{
- this.isZJ = 0;
- }
- })
- }
- }
- }
- </script>
- <style>
- page{background-color: #fff;}
- .solid-bottom-type{
- border-bottom: 0.5px solid #eee;
- }
- .solid-top-type{
- border-top: 2px solid #0A8CD5;
- }
- .shadowType {
- -moz-box-shadow: 0px 1px 4px #D0D0D0;
- -webkit-box-shadow: 0px 1px 4px #D0D0D0;
- box-shadow: 0px 1px 4px #D0D0D0;
- }
- .journal_b{background-color: #F7F7F7;}
- .journal_1{background-color: #FFFFFF;border-bottom: 1rpx solid #E3E1E1;border-radius: 20rpx 20rpx 0 0;height: 100rpx;display: flex;align-items: center;justify-content: space-between;padding: 0 22rpx;box-shadow: 1px -1px 2px #D0D0D0}
- .journal_ts{font-size: 30rpx;}
- .journal_time{font-size: 30rpx;color: #101010;font-weight: bold;}
- .journal-btn{width: 100%;height: 60rpx;line-height: 60rpx;font-size: 26rpx;color: #0A8CD5;border-radius: 100rpx;border: 2rpx solid #0A8CD5;background-color: #fff;}
- .journal-btn::after{
- border: none;
- }
- .margin-bottom-sm{margin-bottom: 22rpx;}
- .margin-right-sm{margin-right: 16rpx;font-size: 30rpx;color: #101010;}
- .margin-right-sm2{font-size: 30rpx;color: #8a8a8a;}
-
- .name-box{
- /* width: 140rpx;
- height: 50rpx;
- border-radius: 50rpx;
- line-height: 50rpx;
- text-align: center; */
-
- background-color: #F7F7F7;
- margin-right: 20rpx;
- padding: 10rpx 26rpx;
- border-radius: 50rpx;
- }
- .name-sele{
- background-color: #E2F3FD;
- }
- </style>
|