123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- <template>
- <view>
- <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: 0 22rpx 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}}</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>
- </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;">
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">平均气温:
- <text class="margin-right-sm2">{{logData.averageTemperature}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">天气:
- <text class="margin-right-sm2">{{logData.weather}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">开工时间:
- <text class="margin-right-sm2">{{logData.startTime}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">工程名称:
- <text class="margin-right-sm2">{{logData.itemName}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">施工部位:
- <text class="margin-right-sm2">{{logData.site}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">施工组织计划:
- <text class="margin-right-sm2">{{logData.orgPlan}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">安全交底:
- <text class="margin-right-sm2">{{logData.safetyDegree}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">技术交底:
- <text class="margin-right-sm2">{{logData.technologyDegree}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">下达施工任务:
- <text class="margin-right-sm2">{{logData.releaseTask}}</text>
- </text>
- </view>
- <view class="margin-bottom-sm">
- <text class="margin-right-sm">重要记事:
- <text class="margin-right-sm2">{{logData.importantNote}}</text>
- </text>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- userInfo:"",
- projectList:'',
- index:0,
- content:"",
- dotList:[],
- dotStyle:{color: 'black'},
- type:null,
- chooseTime:"",
- logData:"",
- chooseData:""
- }
- },
- onShow() {
- var that = this;
- that.onLoadData();
- that.chooseTime='';
- /* 监听今天 */
- uni.$on("clickToday", res => {
- that.findDiaryByToday();
- });
- },
- methods: {
- datechange(e) {
- //console.log(e);
- //debugger
- if(e.isToday){//判断是否为今天
- if(e.info){
- if(e.info.id){//判断是否有施工日志
- this.type=1;
- this.logData=e.info;
- }else{
- this.type=0
- }
- }else{
- this.type=2
- }
-
- }else{
- var nowDate =new Date().toISOString().slice(0, 10);
- if(nowDate<e.fullDate){//判断是否为超前时间
- this.type=2
- }else{
- if(e.info){//判断是否在合同段的计划时间内
- if(e.info.id){//判断是否有施工日志
- this.type=1;
- this.logData=e.info;
- }else{
- this.type=0
- }
- }else{
- this.type=2
- }
- }
- }
- this.chooseTime =e.fullDate;
- this.chooseData =e.info;
- },
- 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();
- },
- /* 查询项目 */
- 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/diary/findDateList', { userId:that.userInfo.id,contractId:that.projectList.contractId }).then((result)=>{
- that.dotList = result.datas;
- if(!that.$refs.calendarData || !that.$refs.calendarData.selectedItem){
- //如果当前没有选择的日期获取今天的
- 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();
- that.http.request('/app/diary/findDataByToday', { userId:that.userInfo.id,contractId:that.projectList.contractId,date:time }).then((res)=>{
- var value =false;
- that.dotList.forEach(item=>{
- if(item.date == time){
- value=true;
- }
- })
- if(value){
- var data ={"fullDate":time,isToday:true,show:true,"info": res.datas==null ? {id:null} : res.datas[0] };
- that.datechange(data);
- }else{
- var data ={"fullDate":time,isToday:true,show:true,"info": res.datas==null ? undefined : res.datas[0] };
- that.datechange(data);
- }
- })
- },
- }
- }
- </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: 2rpx 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 0px 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;}
- .margin-bottom-sm{margin-bottom: 22rpx;}
- .margin-right-sm{margin-right: 16rpx;font-size: 30rpx;color: #101010;}
- .margin-right-sm2{font-size: 30rpx;color: #AEAEAE;}
- </style>
|