<template>
	<view class="clued navbar">
		<!-- 顶部 -->
		<view class="pfixed">
		<uni-nav-bar  left-icon="left" fixed="true" :border='border'   statusBar='true'  title="政府项目详情" rightWidth='180rpx' @clickRight="clickRight" @clickLeft='getBack'>
			<block slot="right">
				<view class="min_top" >
					<image :src="moreimg"></image>
				</view>
			</block>
		</uni-nav-bar>
			<tab-list :tablist='tablist' :tabidx='tabidx' :height='90' @getCheck="goCheck"></tab-list>
			<!-- 节点安排 -->
			<block v-if="tabidx==2">
				<view class="zhanline"></view>
				<view class="alldata flexc">
					<!-- <view class="f16 c34">是否完成</view> -->
					<picker class="flexc" range-key='label' :value="wcindex" :range="wclist"  @change="bindDateChangedana">
						<view v-if="isWc" class="f15 c34">{{isWc=='Y'?'是':'否'}}</view>
						<view v-else class="f15 co80">选择是否完成</view>
					</picker>
					<image :src="upimg"></image>
				</view>
			</block>
			<block v-if="tabidx==3">
				<view class="zhanline"></view>
				<view class="rate_top">
					<time-year @bindDateChange="bindDateChange" :timedate="timedate" fields='month' textAlign='right' timetxt='选择日期'></time-year>
					<!-- <view class="rate_switch" @click="getSwitch">
						<view class="tit" :class="switchflag?'act':''">周</view>
						<view class="tit " :class="switchflag?'':'act'">月</view>
					</view> -->
				</view>
			</block>
			
		</view>
		<!-- 站位的 -->
		<uni-nav-bar  left-icon="left" :border='border'   statusBar='true' />
		<view style="height: 90rpx;"></view>
		<view class="zhanline"></view>
		
		
		<!-- 详情 -->
		<!-- -->
		<view class="cldetail"  v-if="(datainfoa&&tabidx==0)||(datainfoa&&tabidx==1)||(datainfoc.length&&tabidx==3)||(datainfod.length&&tabidx==2)">
			<view >
				<!-- 基本信息 -->
				<block v-if="tabidx==0"><basic :datainfo='datainfoa'  @getDown="getDown"></basic></block>
				<block v-if="tabidx==1"><stage :datainfo='datainfoa'  @getDown="getDown"></stage></block>
				<block v-if="tabidx==2"><point :datainfo='datainfod' :fgwchlist="fgwchlist"  @getDown="getDown" @getDelFn='getdbDelFn' @getPutFn="getdbPutFn" @getjdShFn="getjdShFn" @getCbFn="getCbFn" @getHuiFn="getHuiFn" @getjzqklistFn="getjzqklistFn"></point></block>
				<block v-if="tabidx==3"><rate :datainfo='datainfoc'  @getDown="getDown" @getDelFn='getxmDelFn' @getPutFn="getxmPutFn" @getShFn="getShFn"></rate></block>
				
				<!-- getDown 文件预览 -->
				
				<!-- 按钮 -->
				<view class="pfixedb flexc">
					<view v-if="checkPermi(['fgw:ldps:add'])" class="cluebtn btn1"  @click="getLdFn">批示</view>
					<view class="cluebtn btn1" v-if="status==1&&xmtype==1&&tabidx==0&&checkPermi(['fgw:common:xmsh'])"  @click="getOperate(2)">基本信息审核</view>
					<view class="cluebtn btn1" v-if="xmtype==2&&status==1&&tabidx==1&&checkPermi(['fgw:common:sxsh'])"  @click="getgzsxshFn(2)">前期工作手续审核</view>

					<view class="cluebtn btn2" v-if="checkPermi(['fgw:xmsb:edit'])&&tabidx==0&&xmtype==1" @click="getUpdatabaseFn">修改信息</view>
					<view class="cluebtn btn3" v-if="checkPermi(['fgw:xmsb:edit'])&&tabidx==1&&xmtype==2" @click="getUpdataQianFn">信息上传</view>
					<!-- &&progress!=3 -->
					<view class="cluebtn btn2" v-if="checkPermi(['fgw:jzqk:add'])&&tabidx==3" @click="getAddJinFn">汇报进度</view>
					<view class="cluebtn btn2" v-if="checkPermi(['fgw:jdap:add'])&&tabidx==2" @click="getAddbyearFn('ben')">添加本年度节点</view>
					<view class="cluebtn btn1" v-if="checkPermi(['fgw:jdap:add'])&&tabidx==2" @click="getAddbyearFn('pre')">添加月份节点</view>
					
					<view class="cluebtn btn2" @click="clickRight" v-if="tabidx==1">更多</view>
				</view>
			</view>
		</view>
		<!-- v-else -->
		<view v-else>
			<!-- 无数据 -->
			<no-data></no-data>
			
			<!--  -->
			<view class="pfixedb flexc" >
				<!-- 领导批示 -->
				<view v-if="checkPermi(['fgw:ldps:add'])" class="cluebtn btn1"  @click="getLdFn">批示</view>
				<!-- 自己修改 -->
				<view class="cluebtn btn2" v-if="checkPermi(['fgw:xmsb:edit'])&&tabidx==1&&progress!=3" @click="getAddQianFn">信息上传</view>
				<view class="cluebtn btn2" v-if="checkPermi(['fgw:jzqk:add'])&&tabidx==3" @click="getAddJinFn">汇报进度</view>
				<!-- 项目进展对接点做新增 -->
				<view class="cluebtn btn2" v-if="checkPermi(['fgw:jdap:add'])&&tabidx==2" @click="getAddbyearFn('ben')">添加本年度节点</view>
				<view class="cluebtn btn1" v-if="checkPermi(['fgw:jdap:add'])&&tabidx==2" @click="getAddbyearFn('pre')">添加月份节点</view>
				
			</view>
		</view>
		
		
		<!-- 弹窗 -->
		<pop-up :type="type" @getClose='getClose' :iteminfo="iteminfo" :xmjzinfo="xmjzinfo"  @getyjSubmit='getyjSubmit' @getXmSubmitFn='getXmSubmitFn'  @getLinSubmit='getLinSubmit' ></pop-up>
		<!-- getzbSubmit ：专项根据@getzbSubmit="getzbSubmit"
		getXmSubmitFn：项目进展
		getLinSubmit：批示
		getzanFn：暂缓销号
		getyjSubmit：审核 -->
		<!-- 弹窗 -->
		<view class="bgbox" @click="getClose" v-if="moreflag||wtflag"></view>
		<view class="more_fixed" v-if="moreflag">
			<view class="more_fixedt">
				<!-- 撤回 &&progress!=2-->
				<!-- <view v-if="checkPermi(['projectV2:common:xsch'])"  @click="getXsch">撤回</view> -->
				<block v-if="xmtype==2">
					<view v-if="checkPermi(['fgw:wtxm:edit'])" @click="getwtxmFn">问题项目</view>
					<view v-if="checkPermi(['fgw:ycwt:edit'])&&datainfoa.isWt=='Y'" @click="getzcxmFn" >移除问题项目</view>
					<view v-if="checkPermi(['fgw:xmsb:edit'])" @click="getsxshFn">申请开工</view>
					<view v-if="checkPermi(['fgw:common:jgsq'])" @click="getjsshFn">申请竣工</view>
					<view v-if="checkPermi(['fgw:common:jssh'])" @click="getshsxshFn" >开工审核</view>
					<view v-if="checkPermi(['fgw:common:jgsh'])" @click="getshjsshFn" >竣工审核</view>
				</block>
				<view v-if="checkPermi(['fgw:shyj:list'])" @click="getshprogress" >审核进度</view>
				<view v-if="checkPermi(['fgw:ldps:list'])" @click="getLdwrlistFn">批示记录</view>
				<view v-if="checkPermi(['fgw:xmsb:remove'])" @click="getdeltelistFn">销号</view>
				
				

				<!-- <view>撤回信息</view> -->
				<!-- 专班跟进 -->
				<!-- <view @click="getFollowup" v-if="checkPermi(['projectV2:sbbzb:meet'])">专班跟进</view>
				<view v-if="checkPermi(['projectV2:shyj:list'])" @click="getshprogress">审核进度</view>
				
				<view v-if="checkPermi(['fgw:ldps:list'])" @click="getLdwrlistFn">查看领导批示</view> -->
				<!-- 查看批示 -->
			</view>
			<view class="more_fixedb" @click="getClose">取消</view>
		</view>
		
		<view class="fixedbox" v-if="wtflag">
			<image :src="closeimg" class="choseimg" @click="getClose"></image>
			<view class="top">问题项目</view>
			<view class="boxs">
				<view class="box">
					<view class="f16 fw c34 flex0 pr">问题项目</view>
					<picker  range-key='dictLabel' :value="wtindex" :range="wtxmbqlist" class="infolist_a" @change='bindDateChangea'>
						<view :class="wtstatus?'':'f16 co80'">{{wtstatus||"请选择问题项目"}}</view>
					</picker>
					<image :src="rimg" class="rimg"></image>
					<!-- <view class="flexc flex1 infolist" >
					 	
					 </view> -->
				</view>
			</view>
			<view class="fixedbtn" @click="getwxsuimit">提交</view>			
			
		</view>
	</view>
</template>

<script>
	import tabList from "@/components/toptab/tab.vue"
	import { getToken } from '@/utils/auth' 
	import popUp from "@/components/popup/popup.vue"
	import basic from "@/components/zdclue/tbasic.vue"  //基本信息
	import stage from "@/components/zdclue/stage.vue"  //前期工作手续
	import rate from "@/components/zdclue/rate.vue"  //项目进展
	import point from "@/components/zdclue/point.vue"  //节点安排
	import timeYear from "@/components/timedata/timeyear.vue"
	import { getDictionaryFn} from '@/api/work/index.js'
	import {getxmsbDetail,getlistzdapdFn,getdelzdapdFn,getshzdapdFn,getcbzdlapdFn,getxmsbPutFn,getxmsbdelFn} from '@/api/zdwork/addclue.js'
	import {getaddzdshyjFn,getaddzdjzqkFn,getlistzdjzqkFn,getputzdjzqkFn,getdelzdjzqkFn,getzczdldpsFn,getaddzdldpsFn,getputzdldpsFn,getsqjgsqFn,getshjsshFn,getshjgshFn,getshsxshFn,getshzdjzqkFn} from '@/api/zdwork/clue.js'
	
	
	import config from '@/config.js';
	const baseUrl = config.baseUrl;
	import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
	import noData from "@/components/nodata/nodata.vue"
	export default{
		data(){
			return{
				border:false,
				tabidx:0,
				id:'',
				// 
				tablist:[{tit:'基本信息',val:0,limt:'fgw:xmsb:query'},{tit:'节点安排',val:2,limt:'fgw:dbd:list'},{tit:'前期工作手续',val:1,limt:'fgw:xmsb:query'},{tit:'项目进展',val:3,limt:'fgw:jzqk:list'}],
				active: 0,
				
				type:0,//弹窗类型 1暂存/消耗 2审核意见 3批示
				
				moreimg:require("@/static/images/index/more.png"),
				upimg:require("@/static/images/index/up.png"),
				rimg:require("@/static/images/mine/rimg.png"),
				closeimg:require('@/static/images/close.png'),
				moreflag:false,
				roles:this.$store.state.user.roles[0],
				progress:'',//阶段
				status:'',//状态
				deptId:this.$store.state.user.deptId,
				datainfoa:'',
				datainfob:'',
				datainfoc:[],
				datainfod:[],
				zcstatus:'add',
				xmjzstatus:'add',
				switchflag:false,
				id:'',
				beginTime:'',
				xmjzinfo:{},//项目进展
				iteminfo:{},//暂存
				iteminfos:{},//暂存
				pageSize: 10,
				pageNum: 1,
				reachflag:true,
				wclist:[{label:'是',id:'Y'},{label:'否',id:'N'},],//完成
				wcindex:0,
				isWc:'',
				fgwchlist:[],//超期等级
				xmtype:1,//项目阶段
				timedate:'',//选择日期
				shtype:'',
				checkid:'',//节点的id
				jzqkid:'',//进展情况id,
				wtxmbqlist:[],//问题项目
				wtType:'',
				wtstatus:'',
				wtflag:false,
				wtindex:''
			}
		},
		components:{
			tabList,popUp,noData,basic,stage,rate,point,timeYear
		},
		onUnload(){
			uni.$off('refreshdatazd')
		},
		onLoad(e) {
			this.id=e.id;
			uni.$on('refreshdatazd',(e) => {
				this.beginTime='';
				this.checkid='';
				this.isWc='';
				this.reachflag=true;
				this.pageNum=1;
				this.datainfoc=[];
				this.datainfod=[];
				this.getDataFn();
			})
			this.tabidx=Number(e.tabidx)||0;
			this.getDataFns()
			// if(checkPermi(['fgw:xmsb:query'])){
				
			// }
			this.getldzcFn();
			this.getinvestmentarea()
			
		},
		onReachBottom() {
			if(this.tabidx==2||this.tabidx==3){
				if (this.reachflag) {
					this.pageNum++
					this.getDataFn()
				}
			}
			
		},
		methods:{
			checkPermi, checkRole,
			getwtxmFn(){
				this.moreflag=false;
				this.wtflag=true;
			},
			bindDateChangea(e){
				var val=e.detail.value;
				this.wtType=this.wtxmbqlist[val].dictValue;
				this.wtstatus=this.wtxmbqlist[val].dictLabel;
			},
			getwxsuimit(){
				var that=this;
				if(!this.wtType){
					this.$toast('请选择问题项目')
					return
				}
				var params=this.datainfoa
				var params={
					id:this.datainfoa.id,
					isWt:'Y',
					wtType:this.wtType
				}
				// 都是走修改信息
				getxmsbPutFn(params).then(res=>{
					if(res.code==200){
						that.$toast('修改成功');
						that.wtflag=false;
						that.wtType=false;
					}else{
						this.$toast(res.msg)
					}
				})
			},
			getzcxmFn(){
				var that = this;
				that.moreflag=false;
				uni.showModal({
					title: '提示',
					content: "是否更改为正常项目",
					success: function(res) {
						if (res.confirm) {
							// var params=JSON.parse(JSON.stringify(that.datainfoa));
							// params.isJs=3;
							var params={
								id:that.datainfoa.id,
								isWt:'N',
								wtType:''
							}
							// 都是走修改信息
							getxmsbPutFn(params).then(res=>{
								if(res.code==200){
									that.$toast('修改成功')	
									setTimeout(function(){
										uni.$emit('refreshdatalistzd');
										that.type=0;
										uni.navigateBack({
											delta:1
										})
									},1500)
								}else{
									that.$toast(res.msg)
								}
							})
						} else if (res.cancel) {
						}
					}
				});
			},
			getsxshFn(){//申请开工
				var that = this;
				that.moreflag=false;
				uni.showModal({
					title: '提示',
					content: "是否申请开工",
					success: function(res) {
						if (res.confirm) {
							// var params=JSON.parse(JSON.stringify(that.datainfoa));
							// params.isJs=3;
							var params={
								id:that.datainfoa.id,
								isJs:3,
							}
							// 都是走修改信息
							getxmsbPutFn(params).then(res=>{
								if(res.code==200){
									that.$toast('申请开工成功')	
									setTimeout(function() {
										
									},1500);
								}else{
									that.$toast(res.msg)
								}
							})
						} else if (res.cancel) {
						}
					}
				});
			},
			getjsshFn(){//申请竣工
				var that = this;
				that.moreflag=false;
				uni.showModal({
					title: '提示',
					content: "是否申请竣工",
					success: function(res) {
						if (res.confirm) {
							// var params=JSON.parse(JSON.stringify(that.datainfoa));
							// params.isJs=3;
							var params={
								id:that.datainfoa.id,
							}
							getsqjgsqFn(params).then(res=>{
								if(res.code==200){
									that.$toast('申请竣工成功')	
									setTimeout(function() {
										
									},1500);
								}else{
									that.$toast(res.msg)
								}
							})
						} else if (res.cancel) {
						}
					}
				});
			},
			// 前期工作手续审核
			getgzsxshFn(){
				this.shtype='gzsx';
				this.type=Number(2);
				this.moreflag=false;
				this.iteminfo={}
			},
			//开工审核
			getshsxshFn(){
				this.shtype='kgsh';
				this.moreflag=false;
				this.type=Number(2);
				this.iteminfo={}
			},
			//竣工审核
			getshjsshFn(){
				this.shtype='jgsh';
				this.moreflag=false;
				this.type=Number(2);
				this.iteminfo={}
			},
			getShFn(e){//进展情况
				this.shtype='jzqk';
				this.jzqkid=e;
				this.moreflag=false;
				this.type=Number(2);
				this.iteminfo={}
			},
			//节点审核
			getjdShFn(data){
				this.shtype='jdsh';
				this.checkid=data;
				this.moreflag=false;
				this.type=Number(2);
				this.iteminfo={}
			},
			// 字典值
			getinvestmentarea(){
				// 超期等级
				getDictionaryFn('fgwch').then(res=>{
					if(res.code==200){
						this.fgwchlist=res.data
					}
				})
				//问题项目
				
				getDictionaryFn('problem_items').then(res=>{
					if(res.code==200){
						this.wtxmbqlist=res.data
					}
				})
			},
			getLdwrlistFn(){
				this.moreflag=false
				var newobj={
					xmId:this.datainfoa.id,
					xmmc:this.datainfoa.xmmc,
				}
				this.$tab.navigateTo('/pages/zdpages/work/ldwritten?data='+encodeURIComponent(JSON.stringify(newobj)))
			},
			// 完成
			bindDateChangedana(e) {
				var val=e.detail.value;
				this.isWc=this.wclist[val].id;
				this.reachflag=true;
				this.pageNum=1;
				this.datainfod=[];
				this.getDataFn()
			},
			getldzcFn(){
				if(checkPermi(['fgw:ldps:queryZc'])){
					var params={
						xmId:this.id
					}
					getzczdldpsFn(params).then(res=>{
						if(res.code==200){
							this.iteminfos=res.data||{}
							if(res.data){
								this.zcstatus='update'
							}else{
								this.zcstatus='add'
							}
						}
					})
				}
				
			},
			// 获取项目进展
			getlistzdjzqkFn(){
				var that=this;
				var params={
					pageSize:this.pageSize,
					pageNum: this.pageNum,
					xmId:this.id,	
					xmmc:this.datainfoa.xmmc,
					jdId:this.checkid
				}
				params['params[beginTime]']=this.beginTime
				if(this.pageNum==1){
					this.datainfoc = [];
				}
				getlistzdjzqkFn(params).then(res=>{
					if(res.code==200){
						if (res.rows.length < this.pageSize) {
							this.reachflag = false
							this.wtdt = '到底了~';
						} else {
							var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum -	1)
							if (num < res.total) {
								this.reachflag = true
								this.wtdt = '上拉加载更多'
							} else {
								this.reachflag = false
								this.wtdt = '到底了~';
							}
						}
						if (this.pageNum == 1) {
							this.datainfoc = res.rows;
						} else {
							this.datainfoc = this.datainfoc.concat(res.rows)
						}
					}else{
						this.$toast(res.msg)
					}
				})
			},
			// 获取节点安排
			getlistzdapdFn(){
				var that=this;
				var sfwc=''
				if(this.isWc=='Y'){
					sfwc=3
				}else{
					sfwc=''
				}
				var params={
					pageSize:this.pageSize,
					pageNum: this.pageNum,
					xmId:this.id,	
					xmmc:this.datainfoa.xmmc,
					sfwc:sfwc,
				}
				if(this.pageNum==1){
					this.datainfod = [];
				}
				getlistzdapdFn(params).then(res=>{
					if(res.code==200){
						if (res.rows.length < this.pageSize) {
							this.reachflag = false
							this.wtdt = '到底了~';
						} else {
							var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum -	1)
							if (num < res.total) {
								this.reachflag = true
								this.wtdt = '上拉加载更多'
							} else {
								this.reachflag = false
								this.wtdt = '到底了~';
							}
						}
						if (this.pageNum == 1) {
							this.datainfod = res.rows;
						} else {
							this.datainfod = this.datainfod.concat(res.rows)
						}
					}else{
						this.$toast(res.msg)
					}
				})
			},
			goCheck(data){
				// 基本信息审核之后才能填后续的
				// console.log(this.xmtype,123)
				if(this.xmtype==2){
					this.tabidx=data;
					this.beginTime='';
					this.timedate='';
					this.isWc='';
					this.checkid='';
					this.reachflag=true;
					this.pageNum=1;
					this.datainfoc=[];
					this.datainfod=[];
					if((data==0||data==1)&&this.datainfoa){
					}else{
						this.getDataFn()
					}
				}else{
					if(data==0){
						this.tabidx=data;
						this.beginTime='';
						this.timedate='';
						this.isWc='';
						this.checkid='';
						this.reachflag=true;
						this.pageNum=1;
						this.datainfoc=[];
						this.datainfod=[];
						if(!this.datainfoa){
							this.getDataFn()
						}
					}
				}
			},
			getDataFns(){
				var that=this;
				getxmsbDetail(this.id).then(res=>{
					if(res.code==200){
						console.log(res.data.progress)
						that.progress=res.data.progress;
						that.xmtype=res.data.type;
						that.status=res.data.status;
						that.active=res.data.type;
						that.datainfoa=res.data;
						if(that.tabidx==0&&that.xmtype==2){
							that.tabidx=1
						}
						var strnum=Number(res.data.sjbz) + Number(res.data.sczbj) + Number(res.data.zxz) + Number(res.data.rz)
						this.datainfoa.hj=strnum.toFixed(2);
					}else{
						this.$toast(res.msg)
					}
				})
				if(that.tabidx==2){
					this.getlistzdapdFn()
				}else if(that.tabidx==3){
					this.getlistzdjzqkFn()
				}
			},
			// 获取申报表详情
			getDataFn(){
				var that=this;
				if(that.tabidx==2){
					this.getlistzdapdFn()
					// 节点安排
				}else if(that.tabidx==3){
					this.getlistzdjzqkFn()
				}else{
					getxmsbDetail(this.id).then(res=>{
						if(res.code==200){
							that.progress=res.data.progress;
							that.xmtype=res.data.type;
							that.status=res.data.status;
							that.active=res.data.type;
							that.datainfoa=res.data;
							if(that.xmtype==2){
								that.tabidx=1
							}
							var strnum=Number(res.data.sjbz) + Number(res.data.sczbj) + Number(res.data.zxz) + Number(res.data.rz)
							this.datainfoa.hj=strnum.toFixed(2);
						}else{
							this.$toast(res.msg)
						}
					})
				}
				
			},
			bindDateChange(e){
				var time=e.split('-')
				var s=time.join('')
				this.beginTime=s+'01';
				this.datainfoc=[];
				this.reachflag=true;
				this.pageNum=1;
				this.checkid='';
				this.timedate='';
				this.getDataFn()	
			},
			// 项目进展
			getAddJinFn(){
				// this.type=6;
				// this.xmjzstatus='add';
				// this.xmjzinfo={};
				// this.xmjzinfo.xmId=this.datainfoa.id;
				// this.xmjzinfo.xmmc=this.datainfoa.xmmc;
				var newobj={
					id:this.datainfoa.id,
					xmmc:this.datainfoa.xmmc,
				}
				this.$tab.navigateTo('/pages/zdpages/work/addratelist?data='+encodeURIComponent(JSON.stringify(newobj)))
			},
			getxmPutFn(data){
				var newobj={
					id:this.datainfoa.id,
					xmmc:this.datainfoa.xmmc,
					pagetype:'update',
					xmhbid:data.id
				}
				this.$tab.navigateTo('/pages/zdpages/work/addrate?data='+encodeURIComponent(JSON.stringify(newobj)))
				// this.type=6;
				// this.xmjzstatus='update'
				// this.xmjzinfo=JSON.parse(JSON.stringify(data))
			},
			getxmDelFn(data){
				var that=this;
				var params=JSON.parse(JSON.stringify(data))
				getdelzdjzqkFn(params.id).then(res=>{
					if(res.code==200){
						that.$toast('删除项目进展成功')
						setTimeout(function(){
							that.type=0;
							that.pageNum=1;
							that.reachflag=true;
							that.datainfoc=[];
							that.getDataFn()
						},1500)									
					}else{
						this.$toast(res.msg)
					}
				})
			},
			//催报
			getCbFn(data){
				var that=this;
				getcbzdlapdFn(data).then(res=>{
					if(res.code==200){
						this.$toast('催报节点安排成功')								
					}else{
						this.$toast(res.msg)
					}
				})
			},
			// 节点安排
			getdbDelFn(data){
				var that=this;
				getdelzdapdFn(data).then(res=>{
					if(res.code==200){
						that.$toast('删除节点安排成功')
						setTimeout(function(){
							that.type=0;
							that.pageNum=1;
							that.reachflag=true;
							that.datainfod=[];
							that.getDataFn()
						},1500)									
					}else{
						this.$toast(res.msg)
					}
				})
			},
			//汇报
			getHuiFn(ite){
				var newobj={
					id:this.datainfoa.id,
					xmmc:this.datainfoa.xmmc,
					pagetype:'add',
					jdId:ite.id,
					year:ite.year,
					month:ite.month,
				}
				this.$tab.navigateTo('/pages/zdpages/work/addrate?data='+encodeURIComponent(JSON.stringify(newobj)))
			},
			// 查看汇报进度
			getjzqklistFn(data){
				var year=data.year;
				var month=data.month;
				var time=year+month+'01';
				this.checkid=data.id;
				this.tabidx=3;
				this.beginTime='';
				this.timedate='';
				this.reachflag=true;
				this.pageNum=1;
				this.datainfoc=[];
				this.getDataFn()
			},
			getAddbyearFn(e){
				
				var newobj={
					id:this.datainfoa.id,
					xmmc:this.datainfoa.xmmc,
					pagetype:'add'
				}
				if(e=='ben'){
					this.$tab.navigateTo('/pages/zdpages/work/addpoint?data='+encodeURIComponent(JSON.stringify(newobj)))
				}else{
					this.$tab.navigateTo('/pages/zdpages/work/addpointfn?data='+encodeURIComponent(JSON.stringify(newobj)))
				}
				
			},
			
			getdbPutFn(data){
				var newobj={
					id:this.datainfoa.id,
					xmmc:this.datainfoa.xmmc,
					jdId:data,
					pagetype:'update'
				}
				// 判断是当前年还是非当前年
				// if(e=='ben'){
				// 	this.$tab.navigateTo('/pages/zdpages/work/addpoint?data='+encodeURIComponent(JSON.stringify(newobj)))
				// }else{
					this.$tab.navigateTo('/pages/zdpages/work/addpointfn?data='+encodeURIComponent(JSON.stringify(newobj)))
				// }
				
				// this.$tab.navigateTo('/pages/zdpages/work/addpoint?data='+encodeURIComponent(JSON.stringify(newobj)))
			},
			getXmSubmitFn(data){
				var that=this;
				var params=JSON.parse(JSON.stringify(data))
				params.xmId=this.datainfoa.id;
				params.xmmc=this.datainfoa.xmmc;
				params.deptId=this.deptId; 
				params.deptName=this.$store.state.user.deptName; 
				if(this.xmjzstatus=='update'){
					params.id=this.xmjzinfo.id; 
					getputzdjzqkFn(params).then(res=>{
						if(res.code==200){
							that.$toast('修改项目进展成功')
							setTimeout(function(){
								that.type=0;
								that.pageNum=1;
								that.reachflag=true;
								that.datainfoc=[];
								that.getDataFn()
							},1500)									
						}else{
							this.$toast(res.msg)
						}
					})
				}else{
					getaddzdjzqkFn(params).then(res=>{
						if(res.code==200){
							that.$toast('添加项目进展成功')
							setTimeout(function(){
								that.type=0;
								that.pageNum=1;
								that.reachflag=true;
								that.datainfoc=[];
								that.getDataFn()
							},1500)									
						}else{
							this.$toast(res.msg)
						}
					})
				}
				
			},
			getBack(){
				uni.navigateBack({
					delta:1
				})
			},
			getDown(e){
				var url=baseUrl+e;
				// 提示
				uni.showLoading({
					title: '加载中'
				});
				uni.downloadFile({
					url: url,//文件的下载路径
					success(result) {
						uni.hideLoading()
						 var filePath = result.tempFilePath;
						    uni.openDocument({
						      filePath: filePath,
						      showMenu: true,
						      success: function (res) {
						        console.log('打开文档成功');
						      }
						    });
					},
					fail(res) {
						uni.hideLoading()
					}
				})
			},
			// 审核进度
			getshprogress(){
				this.moreflag=false;
				this.$tab.navigateTo('/pages/zdpages/work/shprogress?id='+this.datainfoa.id)
			},
			getAddQianFn(){
				var newobj={
					id:this.id,
					xmmc:this.datainfoa.xmmc,
					pagetype:'add'
				}
				this.$tab.navigateTo('/pages/zdpages/work/addstage?data='+encodeURIComponent(JSON.stringify(newobj)))
			},
			getUpdataQianFn(){
				var newobj={
					id:this.id,
					xmmc:this.datainfoa.xmmc,
					pagetype:'update'
				}
				this.$tab.navigateTo('/pages/zdpages/work/addstage?data='+encodeURIComponent(JSON.stringify(newobj)))
			},
			getUpdatabaseFn(){
				var newobj={
					id:this.datainfoa.id,
					pagetype:'update'
				}
				this.$tab.navigateTo('/pages/zdpages/work/addreport?data='+encodeURIComponent(JSON.stringify(newobj)))
			},
			getSwitch(){
				this.switchflag=!this.switchflag
			},
			clickRight(){
				this.moreflag=true
			},
			// 审核
			getOperate(e){
				this.type=Number(e);
				this.iteminfo={}
			},
			getClose(){
				this.type=0;
				this.shtype='';
				this.moreflag=false;
				this.wtflag=false;
			},
			//销号
			getdeltelistFn(){
				var that=this;
				var str='销号';
				that.moreflag=false;
				uni.showModal({
					title: '确认'+str,
					content: "是否确认"+str+"该条线索",
					cancelText: '取消'+str,
					confirmText: '确认'+str,
					success: function(res) {
						if (res.confirm) {
							var id=that.datainfoa.id;
							getxmsbdelFn(id).then(res=>{
								if(res.code==200){
									that.$toast("销号成功")
									setTimeout(function(){
										uni.$emit('refreshdatalistzd');
										that.type=0;
										uni.navigateBack({
											delta:1
										})
									},1500)
								}else{
									that.$toast(res.msg)
								}
							})
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				});
			},
			getLdFn(){
				this.type=7;
				this.iteminfo={};
				this.iteminfo=JSON.parse(JSON.stringify(this.iteminfos));
			},
			getyjSubmit(e){
				var that=this;
				var params=JSON.parse(JSON.stringify(e))
				params.deptId=this.$store.state.user.deptId;
				params.shrxm=this.$store.state.user.name;
				params.xmId=this.datainfoa.id;
				params.xmmc=this.datainfoa.xmmc; 
				
				params.progress=this.datainfoa.progress; 
				// 判断是什么的审核
				if(that.shtype=='gzsx'){// 前期工作手续审核
					getshsxshFn(params).then(res=>{
						if(res.code==200){
							that.$toast("审核提交成功")
							setTimeout(function(){
								uni.$emit('refreshdatalistzd');
								that.type=0;
								uni.navigateBack({
									delta:1
								})
							},1500)
						}else{
							this.$toast(res.msg)
						}
					})
				}else if(that.shtype=='kgsh'){//开工审核
					getshjsshFn(params).then(res=>{
						if(res.code==200){
							that.$toast("审核提交成功")
							setTimeout(function(){
								uni.$emit('refreshdatalistzd');
								that.type=0;
								uni.navigateBack({
									delta:1
								})
							},1500)
						}else{
							this.$toast(res.msg)
						}
					})
				}else if(that.shtype=='jgsh'){//竣工审核
					getshjgshFn(params).then(res=>{
						if(res.code==200){
							that.$toast("审核提交成功")
							setTimeout(function(){
								uni.$emit('refreshdatalistzd');
								that.type=0;
								uni.navigateBack({
									delta:1
								})
							},1500)
						}else{
							this.$toast(res.msg)
						}
					})
				}else if(that.shtype=='jdsh'){//节点审核
					var newobj={
						ids:that.checkid,
						shyj:params.shyj,
					}
					if(params.shjg==3){
						newobj.shjg=2
					}else if(params.shjg==2){
						newobj.shjg=1
					}
					// shjg:params.shjg,
					getshzdapdFn(newobj).then(res=>{
						if(res.code==200){
							that.$toast("审核提交成功")
							setTimeout(function(){
								uni.$emit('refreshdatalistzd');
								that.type=0;
								that.getDataFn();
								// uni.navigateBack({
								// 	delta:1
								// })
							},1500)
						}else{
							this.$toast(res.msg)
						}
					})
				}else if(that.shtype=='jzqk'){//进展情况审核
					// params.id=that.jzqkid;
					var newobj={
						id:that.jzqkid,
						shjg:params.shjg,
						shyj:params.shyj,
						deptId:this.$store.state.user.deptId,
						shrxm:this.$store.state.user.name,
						xmId:this.datainfoa.id,
						xmmc:this.datainfoa.xmmc,
					}
					
					getshzdjzqkFn(newobj).then(res=>{
						if(res.code==200){
							that.$toast("审核提交成功")
							setTimeout(function(){
								uni.$emit('refreshdatalistzd');
								that.type=0;
								that.getDataFn();
								// uni.navigateBack({
								// 	delta:1
								// })
							},1500)
						}else{
							this.$toast(res.msg)
						}
					})
				}else{
					getaddzdshyjFn(params).then(res=>{
						if(res.code==200){
							that.$toast("审核提交成功")
							setTimeout(function(){
								uni.$emit('refreshdatalistzd');
								that.type=0;
								uni.navigateBack({
									delta:1
								})
							},1500)
						}else{
							this.$toast(res.msg)
						}
					})
				}
			},
			getLinSubmit(data){
				var that=this;
				var params={};
				var str=''
				if(data.type==0){//暂存
					params.zcpsnr=data.psnr;
					params.type=1;
					str='批示暂存成功'
				}else{
					params.psnr=data.psnr;
					params.type=2;
					str='批示提交成功'
				}
				params.xmId=this.datainfoa.id;
				// params.xmbh=this.datainfoa.xmbh;
				params.xmmc=this.datainfoa.xmmc;
				// 新增
				if(this.zcstatus=='add'){
					getaddzdldpsFn(params).then(res=>{
						if(res.code==200){
							that.$toast(str)
							setTimeout(function(){
								if(data.type!=0){
									uni.$emit('refreshdatalistzd','ldps');;
								}
								that.getldzcFn()
								that.type=0;
							},1500)
						}else{
							this.$toast(res.msg)
						}
					})	
				}else{
					params.id=this.iteminfos.id
					getputzdldpsFn(params).then(res=>{
						if(res.code==200){
							that.$toast(str)
							setTimeout(function(){
								if(data.type!=0){
									uni.$emit('refreshdatalistzd','ldps');;
								}
								that.getldzcFn()
								that.type=0;
							},1500)
						}else{
							this.$toast(res.msg)
						}
					})	
				}
				
			},
		}
	}
</script>

<style lang="scss" scoped>
.clued{min-height: 100vh;background-color: #fff;box-sizing: border-box;padding-bottom: 100rpx;}


.cldetail{}
.cldelist{padding: 48rpx 28rpx 36rpx;border-bottom: 2rpx solid #E5E5E5;}

.cldelista{
	border-bottom: 2rpx solid #E5E5E5;
	.contentt{padding:48rpx 28rpx;
		.cldelistz{display: flex;align-items: center;justify-content: flex-end;
			image{width: 26rpx;height: 20rpx;margin-left: 20rpx;transition: all .5s; }
		}
	}
	.content{padding: 0rpx 28rpx 40rpx 28rpx;}
	.contenta{padding: 22rpx 0;
		.tit{font-size: 32rpx;font-weight: bold;color: #343434;margin-bottom: 20rpx;}
		.txt{font-size: 32rpx;color: #666666;}
	}
	&.cldelistb{padding: 48rpx 28rpx;}
}

// 操作按钮
.cluebtn{
	display: flex;align-items: center;justify-content: center;font-weight: bold;font-size: 32rpx;color: #ffff;height: 100rpx;
	&.btn1{background-color: #1FB9F7;flex: 1;}
	&.btn2{background-color:#fe5706;flex: 1;}
	&.btn3{background-color:#6bd24c;flex: 1;}
	&.btn4{background-color:#20ACCF;flex: 1;}
}

.rimg{width: 14rpx;height: 28rpx;flex: 0 0 auto;margin-left: 10rpx;}
.boxs{padding: 60rpx 0;
	.box{display: flex;align-items: center;min-height:100rpx;}
}
.fixedbtn{width:100%;height: 80rpx;background: #FF6400;
border-radius: 10rpx;display: flex;align-items: center;justify-content: center;font-size: 32rpx;font-weight: bold;color: #FFFFFF;
	&.btn1{background-color: #20ACCF;margin-bottom: 36rpx;}
}
.infolist_a{height: 44rpx;flex: 1;text-align: right;font-size: 32rpx;color: #343434;
	view{line-height: 44rpx;}
}
// 审核通过
.clued_tong{width: 100%;height: 70rpx;font-size: 32rpx;font-weight: 500;
&.btn{background: #C0FFC0;color: #28C529;}
&.btn1{background: #ffcaac;color: #ff440b;}
}

// 消息
.min_top{position: relative;width: 44rpx;height: 44rpx;display: flex;align-items: center;justify-content: center;margin-right: 32rpx;
	image{width: 44rpx;height: 34rpx;}
	
}
// 周月
.rate_top{padding-right: 24rpx;display: flex;align-items: center;justify-content: space-between;height: 92rpx;}
// position: fixed;left: 0;right: 0;top: 204rpx;background: #ffffff;
.rate_switch{background: #d3d3d3;display: flex;align-items: center;width: 152rpx;border-radius: 52rpx;overflow: hidden;border: 2rpx solid #d3d3d3;
	.tit{font-size: 30rpx;font-weight: 500;color: #666666;width: 50%;display: flex;align-items: center;justify-content: center;height: 52rpx;}
	.act{font-weight: bold;color: #FE5706;background: #ffffff;}
}
.alldata{padding: 20rpx;height: 80rpx;box-sizing: border-box;
		image{width: 22rpx;height: 16rpx;margin-left: 14rpx;}
		.alldatain{min-width: 124rpx;}
	}
</style>