<template>
<view  :style="'padding-bottom:' + bottom ">
  	  <view class='zhanline'></view>
	  <!-- 第一页 -->
			<uni-forms class='inform'  :class="disabled?'disabledbox':''" ref="form" :rules="rules" :modelValue="datainfo">
				<view class="info_tit">基本信息</view>
				<uni-forms-item name="dh"  style='margin-bottom: 0;'>
				 <view class="flexc infolist infolistd">
				  	<view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>督办单号</view>
				  	<input  placeholder="请输入督办单号" :disabled='disabled' v-model="datainfo.dh"   class="f16  c34 flex1 txr"/>
				  </view>
				</uni-forms-item>
				<uni-forms-item name="deptName" style='margin-bottom: 0;'>
				 <view class="flexc infolist infolistd">
				  	<view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>督办部门名称</view>
				  	<input  placeholder="请输入督办部门名称" :disabled='disabled' v-model="datainfo.deptName"   class="f16  c34 flex1 txr"/>
				  </view>
				</uni-forms-item>
				<uni-forms-item name="xmbh" style='margin-bottom: 0;'>
				 <view class="flexc infolist infolistd">
				  	<view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>项目编号</view>
				  	<input  placeholder="请输入项目编号" :disabled='disabled' v-model="datainfo.xmbh"   class="f16  c34 flex1 txr"/>
				  </view>
				</uni-forms-item>
				<uni-forms-item name="xmmc" style='margin-bottom: 0;'>
				 <view class="flexc infolist infolistd">
				  	<view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>项目名称</view>
				  	<input  placeholder="请输入项目名称" :disabled='disabled' v-model="datainfo.xmmc"   class="f16  c34 flex1 txr"/>
				  </view>
				</uni-forms-item>
				
				<!-- <uni-forms-item name="sfwlhxxxm" style='margin-bottom: 0;'>
				 <view class="flexc infolist">
				  	<view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>是否为回复</view>
					<picker  range-key='label' :value="lhindex" :range="hflist" class="infolist_a" @change='bindDateChangea'>
						<view :class="sfwlhxxxm?'':'f16 co80'">{{sfwlhxxxm||"请选择是否回复"}}</view>
					</picker>
				  </view>
				</uni-forms-item> -->
				<uni-forms-item name="dbTime" style='margin-bottom: 0;' >
				 <view class="flexc infolist infolistd">
				  	<view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>督办日期</view>
					<view class="infolist_a">{{datainfo.dbTime}}</view>
				  	<!-- <picker mode="date" :value="datainfo.tbrq" :end="currentdate" class="infolist_a" @change='bindDateChange'>
						<view :class="datainfo.tbrq?'':'f16 co80'">{{datainfo.tbrq||"请选择填表日期"}}</view>
				  	</picker> -->
				  </view>
				</uni-forms-item>
				<uni-forms-item name="blsx" style='margin-bottom: 0;'>
				 <view class="flexc infolist infolistd">
				  	<view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>办理时限</view>
				  	<input  placeholder="请输入办理时限" :disabled='disabled' v-model="datainfo.blsx"  class="f16  c34 flex1 txr"/>
				  </view>
				</uni-forms-item>
				<uni-forms-item name="dbsx" style='margin-bottom: 0;'>
				 <view class="flexc infolist infolistd" style="align-items: flex-start;">
				  	<view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>督办事项</view>
					<textarea auto-height="true" :disabled='disabled' v-model="datainfo.dbsx" placeholder="请输入督办事项" class="text" placeholderStyle='text-align: right;font-size:32rpx;color:#808080'></textarea>
				  </view>
				</uni-forms-item>
				<uni-forms-item name="tbr" style='margin-bottom: 0;'>
				 <view class="flexc infolist">
				  	<view class="f16 fw c34 flex0 pr pl12">填报人</view>
				  	<input  placeholder="请输入填报人"  v-model="datainfo.tbr"   class="f16  c34 flex1 txr"/>
				  </view>
				</uni-forms-item>
				<uni-forms-item name="phone" style='margin-bottom: 0;'>
				 <view class="flexc infolist">
				  	<view class="f16 fw c34 flex0 pr pl12">联系电话</view>
				  	<input  placeholder="请输入联系电话" v-model="datainfo.phone"   class="f16  c34 flex1 txr"/>
				  </view>
				</uni-forms-item>
				<uni-forms-item name="jzqk" style='margin-bottom: 0;'>
				 <view class="flexc infolist" style="align-items: flex-start;">
				  	<view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>进展情况</view>
					<textarea auto-height="true"  v-model="datainfo.jzqk" placeholder="请输入项目进展情况" class="text" placeholderStyle='text-align: right;font-size:32rpx;color:#808080'></textarea>
					
				  </view>
				</uni-forms-item>
				<uni-forms-item name="czwt" style='margin-bottom: 0;'>
				 <view class="flexc infolist" style="align-items: flex-start;">
				  	<view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>存在问题</view>
					<textarea auto-height="true"  v-model="datainfo.czwt" placeholder="请输入存在问题" class="text" placeholderStyle='text-align: right;font-size:32rpx;color:#808080;'></textarea>
				  </view>
				</uni-forms-item>
				<uni-forms-item name="jjjy" style='margin-bottom: 0;'>
				 <view class="flexc infolist" style="align-items: flex-start;">
				  	<view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>解决建议</view>
					<textarea auto-height="true"  v-model="datainfo.jjjy" placeholder="请输入解决建议" class="text" placeholderStyle='text-align: right;font-size:32rpx;color:#808080;'></textarea>
				  </view>
				</uni-forms-item>
				<uni-forms-item name="gzjh" style='margin-bottom: 0;'>
				 <view class="flexc infolist" style="align-items: flex-start;">
				  	<view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>下一步工作计划</view>
					<textarea auto-height="true"  v-model="datainfo.gzjh" placeholder="请输入下一步工作计划" class="text" placeholderStyle='text-align: right;font-size:32rpx;color:#808080;'></textarea>
				  </view>
				</uni-forms-item>
				<uni-forms-item name="remark" style='margin-bottom: 0;'>
				 <view class="flexc infolist" style="align-items: flex-start;">
				  	<view class="f16 fw c34 flex0 pr pl12">备注</view>
					<textarea auto-height="true"  v-model="datainfo.remark" placeholder="请输入备注" class="text" placeholderStyle='text-align: right;font-size:32rpx;color:#808080;'></textarea>
				  </view>
				</uni-forms-item>
				<!-- v-if="checkPermi(['',''])" -->
				<view class="infobtn flexcc cf f16 f500"  @click="getSubmit">提交</view>
			</uni-forms>
		<!-- 弹窗 -->
		<!-- <pop-up :type="poptype" @getClose='getClose'   @getXmSubmitFn='getXmSubmitFn'></pop-up> -->
  </view>
</template>

<script>
	
import popUp from "@/components/popup/popup.vue"
import {getdbddetail,getdbdPut,getdbdDet} from "@/api/work/clue.js"

  import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  import config from '@/config'
  const baseUrl = config.baseUrl
  import { getToken } from '@/utils/auth'
  export default {
	  components:{
		  popUp
	  },
    data() {
      return {	
		selectDate: '',
		defaultPhoneHeight: '', //屏幕默认高度
		nowPhoneHeight: '', //屏幕现在的高度
		bottom:0,
		type:1,
		poptype:0,//弹窗类型 1暂存/消耗 2审核意见 3批示
		pagetype:'add',
		
		datainfo:{
			"dh":"",//单号
			"xmId":"",//项目ID
			"xmbh":"",//项目编号
			"xmmc":"",//项目名称
			"deptId":"",//督办部门id
			"deptName":"",//督办部门名称
			"isHf":"",//是否回复
			"dbTime":"",//督办日期
			"blsx":"",//办理时限
			"dbsx":"",//督办事项
			"jzqk":"",//进展情况
			"czwt":"",//存在问题
			"jjjy":"",//解决建议
			"gzjh":"",//下一步工作计划
			"tbr":"",//填报人
			"phone":"",//联系电话
			"tbTime":"",//填报日期
			"progress":""
		},
		rules:{
			jzqk: {rules: [{required: true,errorMessage: '请输入进展情况'}]},
			czwt: {rules: [{required: true,errorMessage: '请输入存在问题'}]},
			jjjy: {rules: [{required: true,errorMessage: '请输入解决建议'}]},
			gzjh: {rules: [{required: true,errorMessage: '请输入下一步工作计划'}]},
		},
		disabled:'true',
		hflist:[{label:'是',id:'S'},{label:'否',id:'N'},],//领航
		map:{text:'dictLabel',value:'dictValue'},
		id:''
		}
    },
	onLoad(e) {
		var that=this;
		this.id=e.id;
		that.getDataFn()
		
		// #ifdef APP
		uni.onKeyboardHeightChange(res=> { //监听键盘高度变化
		    const res_keyboard = uni.getSystemInfoSync();
		    let key_height = res.height - (res_keyboard.screenHeight - res_keyboard.windowHeight)
		    // let key_height = res.height - (res_keyboard.screenHeight - res_keyboard.windowHeight + res_keyboard.safeAreaInsets.bottom)
		     this.bottom = `${ key_height>0 ? key_height : 0}px`; 
		})
		// #endif
		
	},
	onHide() {
		// #ifdef APP-PLUS
		uni.offKeyboardHeightChange();  // 取消监听键盘高度变化事件，避免内存消耗
		// #endif
	    
	},
    methods: {
		checkPermi, checkRole,

		// 线索详情
		getDataFn(){
			console.log(this.id)
			getdbddetail(this.id).then(res=>{
				var that=this;
				if(res.code==200){
					this.datainfo=res.data;
				}else{
					this.$toast(res.msg)
				}
			})
		},
		getSubmit(){
			this.$refs.form.validate().then(res => {
				if(this.datainfo.phone){
					let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
					if (!regphone.test(this.datainfo.phone)) {
						this.$toast("请输入正确的联系方式")
						return
					}
				}
				var params=this.datainfo;
				getdbdPut(params).then(res=>{
					if(res.code==200){
						this.$toast('回复成功')	
						setTimeout(function() {
							uni.$emit('refreshdatalist','duban');
							uni.navigateBack({delta: 1});
						},1500);
					}else{
						this.$toast(res.msg)
					}
				})
			})
		},
		// 领航
		bindDateChangea(e) {
			var val=e.detail.value;
			this.sfwlhxxxm=this.lhlist[val].label;
			this.datainfo.sfwlhxxxm=this.lhlist[val].id
		},
		bindDateChange(e) {
			this.datainfo.tbrq = e.detail.value
		}
    }
  }
</script>

<style lang="scss">
 page {
    background-color: #ffffff;
  }


.inform{padding-top: 30rpx; padding-bottom: 160rpx;}
  .infolist{padding: 30rpx 32rpx 30rpx 24rpx;position: relative;
	.cir{position: absolute;font-size: 36rpx;font-weight: bold;color: #FE5706;left: 0rpx;}
	
  }
  .delimg{width: 40rpx;height:40rpx;margin-left: 16rpx;display: flex;align-items: center;justify-content: center;
  	image{width: 30rpx;height: 30rpx;}
  }
  .infobtn{width: 100%;height: 88rpx;background: #FA5F03;line-height: 88rpx;position: fixed;left: 0;right: 0;bottom: 0;z-index: 3;}
  .input_ye image{width: 34rpx;height: 18rpx;}
.info_tit{font-size: 32rpx;color: #FE5706;padding: 30rpx 26rpx;font-weight: bold;}
.infolist_a{height: 44rpx;flex: 1;text-align: right;font-size: 32rpx;color: #343434;}
.infolist_add{position: absolute;right: 0;top: -40rpx;font-size: 28rpx;color: #41C942;padding-right: 30rpx;
	image{width: 30rpx;height: 30rpx;margin-right: 20rpx;}
}
 .inform /deep/ .uni-forms-item__error{margin-top: -30rpx;margin-left: 24rpx;}
 .inform textarea{min-height: 44rpx;}
  .inform .pl12{margin-right: 10rpx;}

  
  .inform /deep/ .uni-easyinput__content-textarea{min-height: 200rpx;}
  .disabledbox{
  	.infolistd{background-color: #F5f5f5;}
  }
</style>
