constructionLog.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-blue" :isBack="true">
  4. <block slot="backText">施工日志</block>
  5. <block slot="content"></block>
  6. <block slot="right">
  7. <view class=" flex justify-center">
  8. <!-- <button class="margin-top-ssm cu-btn round bg-blue text-blue"><text class="cuIcon-add"></text></button> -->
  9. </view>
  10. </block>
  11. </cu-custom>
  12. <!-- 项目合同信息 -->
  13. <view style="padding: 22rpx 0;background-color: #F7F7F7;">
  14. <cu-project :projectList="projectList" style="height: 236rpx;background-color: #C6E6FF;"></cu-project>
  15. </view>
  16. <view style="padding: 0 22rpx 22rpx;background-color: #F7F7F7;">
  17. <view class="cu-item shadowType" style="height: 100%;background-color: #FFFFFF;border-radius: 0 0 20rpx 20rpx;border-top: 2rpx solid#0A8CD5;" >
  18. <calendar @selected-change="datechange" ref="calendarData" :showBack="true" :dotList="dotList" :dotStyle="dotStyle"></calendar>
  19. </view>
  20. </view>
  21. <!-- 日志 -->
  22. <view class="journal_b">
  23. <view class="journal_1">
  24. <view :class="chooseTime=='' ? 'journal_ts':'journal_time'">{{chooseTime=='' ? '请选择时间':chooseTime}}</view>
  25. <view>
  26. <button @click="navTo()" v-if="type==0 && chooseTime!=''" class="journal-btn" >立即填报</button>
  27. <button @click="navTo()" v-if="type==1 && chooseTime!=''" class="journal-btn" >编辑</button>
  28. <text v-if="type==2 && chooseTime!=''" class="text-gray">未开始</text>
  29. </view>
  30. </view>
  31. </view>
  32. <view v-if="type==0 || type==2 || type ==null || chooseTime==''" class="padding bg-white text-center">
  33. <view class="padding">
  34. <image class="menuImageNoTask" src="../../static/task/noTask.png"></image>
  35. </view>
  36. <view class="padding">暂时没有提交日志~</view>
  37. </view>
  38. <view v-else style="padding: 22rpx 22rpx 80rpx;">
  39. <view class="margin-bottom-sm">
  40. <text class="margin-right-sm">平均气温:
  41. <text class="margin-right-sm2">{{logData.averageTemperature}}</text>
  42. </text>
  43. </view>
  44. <view class="margin-bottom-sm">
  45. <text class="margin-right-sm">天气:
  46. <text class="margin-right-sm2">{{logData.weather}}</text>
  47. </text>
  48. </view>
  49. <view class="margin-bottom-sm">
  50. <text class="margin-right-sm">开工时间:
  51. <text class="margin-right-sm2">{{logData.startTime}}</text>
  52. </text>
  53. </view>
  54. <view class="margin-bottom-sm">
  55. <text class="margin-right-sm">工程名称:
  56. <text class="margin-right-sm2">{{logData.itemName}}</text>
  57. </text>
  58. </view>
  59. <view class="margin-bottom-sm">
  60. <text class="margin-right-sm">施工部位:
  61. <text class="margin-right-sm2">{{logData.site}}</text>
  62. </text>
  63. </view>
  64. <view class="margin-bottom-sm">
  65. <text class="margin-right-sm">施工组织计划:
  66. <text class="margin-right-sm2">{{logData.orgPlan}}</text>
  67. </text>
  68. </view>
  69. <view class="margin-bottom-sm">
  70. <text class="margin-right-sm">安全交底:
  71. <text class="margin-right-sm2">{{logData.safetyDegree}}</text>
  72. </text>
  73. </view>
  74. <view class="margin-bottom-sm">
  75. <text class="margin-right-sm">技术交底:
  76. <text class="margin-right-sm2">{{logData.technologyDegree}}</text>
  77. </text>
  78. </view>
  79. <view class="margin-bottom-sm">
  80. <text class="margin-right-sm">下达施工任务:
  81. <text class="margin-right-sm2">{{logData.releaseTask}}</text>
  82. </text>
  83. </view>
  84. <view class="margin-bottom-sm">
  85. <text class="margin-right-sm">重要记事:
  86. <text class="margin-right-sm2">{{logData.importantNote}}</text>
  87. </text>
  88. </view>
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. export default {
  94. data() {
  95. return {
  96. userInfo:"",
  97. projectList:'',
  98. index:0,
  99. content:"",
  100. dotList:[],
  101. dotStyle:{color: 'black'},
  102. type:null,
  103. chooseTime:"",
  104. logData:"",
  105. chooseData:""
  106. }
  107. },
  108. onShow() {
  109. var that = this;
  110. that.onLoadData();
  111. that.chooseTime='';
  112. /* 监听今天 */
  113. uni.$on("clickToday", res => {
  114. that.findDiaryByToday();
  115. });
  116. },
  117. methods: {
  118. datechange(e) {
  119. //console.log(e);
  120. //debugger
  121. if(e.isToday){//判断是否为今天
  122. if(e.info){
  123. if(e.info.id){//判断是否有施工日志
  124. this.type=1;
  125. this.logData=e.info;
  126. }else{
  127. this.type=0
  128. }
  129. }else{
  130. this.type=2
  131. }
  132. }else{
  133. var nowDate =new Date().toISOString().slice(0, 10);
  134. if(nowDate<e.fullDate){//判断是否为超前时间
  135. this.type=2
  136. }else{
  137. if(e.info){//判断是否在合同段的计划时间内
  138. if(e.info.id){//判断是否有施工日志
  139. this.type=1;
  140. this.logData=e.info;
  141. }else{
  142. this.type=0
  143. }
  144. }else{
  145. this.type=2
  146. }
  147. }
  148. }
  149. this.chooseTime =e.fullDate;
  150. this.chooseData =e.info;
  151. },
  152. navTo(){
  153. uni.navigateTo({
  154. url:"update/update?time="+this.chooseTime+"&type="+this.type+"&id="+this.chooseData.id
  155. })
  156. },
  157. /* 刷新方法 */
  158. onLoadData(){
  159. var userInfo = uni.getStorageSync("userInfo")
  160. if(userInfo){
  161. this.userInfo = userInfo;
  162. }
  163. var project = uni.getStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id);
  164. if(project){
  165. this.projectList =project;//获取选中的当前项目
  166. }else{
  167. this.findProject();
  168. }
  169. this.findDiaryDate();
  170. },
  171. /* 查询项目 */
  172. findProject(){
  173. var that =this;
  174. that.http.request('/app/login', { userId:this.userInfo.id }).then((result)=>{
  175. if(result.datas.length!=0){
  176. that.projectList=result.datas[0];
  177. //默认选中第一条
  178. uni.setStorageSync("porject"+"_"+uni.getStorageSync("userInfo").id,that.projectList);
  179. }
  180. })
  181. },
  182. /* 获取施工日志*/
  183. findDiaryDate(){
  184. var that =this;
  185. that.http.request('/app/diary/findDateList', { userId:that.userInfo.id,contractId:that.projectList.contractId }).then((result)=>{
  186. that.dotList = result.datas;
  187. if(!that.$refs.calendarData || !that.$refs.calendarData.selectedItem){
  188. //如果当前没有选择的日期获取今天的
  189. that.findDiaryByToday();
  190. }
  191. if(that.$refs.calendarData && that.$refs.calendarData.selectedItem){
  192. //如果有获取当前的
  193. var selectedItem = that.$refs.calendarData.selectedItem
  194. var time = selectedItem.fullDate;
  195. //console.log(that.dotList)
  196. that.dotList.forEach(item=>{
  197. if(item.date == time){
  198. that.datechange(Object.assign(selectedItem,{'info':item}));
  199. return;
  200. }
  201. })
  202. }
  203. })
  204. },
  205. /* 根据当前时间获取施工日志数据*/
  206. findDiaryByToday(){
  207. var that =this;
  208. var time =that.intervalTime.getTime();
  209. that.http.request('/app/diary/findDataByToday', { userId:that.userInfo.id,contractId:that.projectList.contractId,date:time }).then((res)=>{
  210. var value =false;
  211. that.dotList.forEach(item=>{
  212. if(item.date == time){
  213. value=true;
  214. }
  215. })
  216. if(value){
  217. var data ={"fullDate":time,isToday:true,show:true,"info": res.datas==null ? {id:null} : res.datas[0] };
  218. that.datechange(data);
  219. }else{
  220. var data ={"fullDate":time,isToday:true,show:true,"info": res.datas==null ? undefined : res.datas[0] };
  221. that.datechange(data);
  222. }
  223. })
  224. },
  225. }
  226. }
  227. </script>
  228. <style>
  229. page{background-color: #fff;}
  230. .solid-bottom-type{
  231. border-bottom: 0.5px solid #eee;
  232. }
  233. .solid-top-type{
  234. border-top: 2px solid #0A8CD5;
  235. }
  236. .shadowType {
  237. -moz-box-shadow: 0px 1px 4px #D0D0D0;
  238. -webkit-box-shadow: 0px 1px 4px #D0D0D0;
  239. box-shadow: 0px 1px 4px #D0D0D0;
  240. }
  241. .journal_b{background-color: #F7F7F7;}
  242. .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}
  243. .journal_ts{font-size: 30rpx;}
  244. .journal_time{font-size: 30rpx;color: #101010;font-weight: bold;}
  245. .journal-btn{width: 100%;height: 60rpx;line-height: 60rpx;font-size: 26rpx;color: #0A8CD5;border-radius: 100rpx;border: 2rpx solid #0A8CD5;background-color: #fff;}
  246. .margin-bottom-sm{margin-bottom: 22rpx;}
  247. .margin-right-sm{margin-right: 16rpx;font-size: 30rpx;color: #101010;}
  248. .margin-right-sm2{font-size: 30rpx;color: #AEAEAE;}
  249. </style>