<template>
  <div>
	  <div class="content">
	  	<div class="content_item content_item_padding0">
	  	    <div class="label">项目名称</div>
	  	    <div class="content_right">
	  	        <el-input class="ename_input" 
	  			placeholder="请输入项目名称关键字" v-model="jskBidPlanDto.projectName" ></el-input>
	  	    </div>
	  	</div>
		<div class="content_item">
		    <div class="label">招标单位</div>
		    <div class="content_right">
		        <el-input class="ename_input" 
				placeholder="请输入招标采购单位关键字" v-model="jskBidPlanDto.tenderee" ></el-input>
		    </div>
		</div>
		<div class="content_item">
		    <div class="label">工程规模</div>
		    <div class="content_right">
		        <el-input class="ename_input" 
				placeholder="请输入工程规模关键字" v-model="jskBidPlanDto.projectScale" ></el-input>
		    </div>
		</div>
		<div class="content_item">
		    <div class="label">更多筛选</div>
		    <div class="content_right">
				<el-dropdown @command="IssueTimehandleCommand" trigger="click"   placement="bottom-start" class="el-dropdown-land" ref="IssueTimeShowPopper" :hide-on-click="false" >
				  <span class="el-dropdown-link" :class="IssueTimeValue ? 'color_text' : ''" >
				    发布时间{{ IssueTimeValue ? " 1项" : ""}}
					<i class="el-icon-caret-bottom"></i>
				  </span>
				  <div>
				    <el-dropdown-menu slot="dropdown">
				      <el-dropdown-item  v-for="(item, i) in IssueTimeOptions" class="el-dropdown-land"  :class=" IssueTimeValue && IssueTimeValue == item.value ? 'color_text': '' " :key="i" :command="item.value">
				        <div @mouseenter="hidePoper">{{ item.label }}</div>
				      </el-dropdown-item>
				      <el-dropdown-item command="自定义" style="padding: 0; text-indent: 20px">
				        <div @mouseenter="mouseenter">
				          <span :class="IssueTimeValue == '自定义' ? 'color_text' : ''">
				            自定义<i class="el-icon-arrow-right"></i>
				          </span>
				          <el-date-picker
				            v-if="IssueTimeShowPopper"
				            @change="changeIssueTime"
				            class="land_date_picker"
				            v-model="IssueTime"
				            ref="datePicker"
				            value-format="yyyy-MM-dd"
				            type="daterange"
				            range-separator="至"
				            start-placeholder="开始日期"
				            end-placeholder="结束日期"
				          >
				          </el-date-picker>
				        </div>
				      </el-dropdown-item>
				    </el-dropdown-menu>
				  </div>
				</el-dropdown>
		       <div class="select-popper" >
		         <span :class="{color_text:jskBidPlanDto.province.length ||jskBidPlanDto.city.length ||jskBidPlanDto.area.length,}">
					 项目属地{{jskBidPlanDto.province.length ||jskBidPlanDto.city.length ||jskBidPlanDto.area.length? jskBidPlanDto.province.length + jskBidPlanDto.city.length +jskBidPlanDto.area.length +"项": ""}}
		           <i class="el-icon-caret-bottom"></i>
		         </span>
		         <el-cascader
		           ref="address"
		           class="cascader-region"
		           v-model="addressType"
		           :options="addressList"
		           :props="props"
		           @change="domicileChange"
		           collapse-tags
		           clearable
		         ></el-cascader>
		       </div>
			   <div class="select-popper">
			     <span :class="{ color_text: jskBidPlanDto.objectType.length }">
			       标的物类型{{jskBidPlanDto.objectType.length? jskBidPlanDto.objectType.length + "项": ""}}
			       <i class="el-icon-caret-bottom"></i>
			     </span>
			     <el-select v-model="jskBidPlanDto.objectType" class="select-multiple" multiple placeholder="请选择">
			       <el-option v-for="(item, i) in bidPlanObjectTypeList" :key="i":label="item" :value="item">
			       </el-option>
			     </el-select>
			   </div>
			   <div class="select-popper">
			     <span :class="{ color_text: jskBidPlanDto.projectType.length }">
			       项目类型{{jskBidPlanDto.projectType.length? jskBidPlanDto.projectType.length + "项": ""}}
			       <i class="el-icon-caret-bottom"></i>
			     </span>
			     <el-select v-model="jskBidPlanDto.projectType" class="select-multiple" multiple placeholder="请选择">
			       <el-option v-for="(item, i) in projectTypeList" :key="i":label="item" :value="item">
			       </el-option>
			     </el-select>
			   </div>
			   <div class="select-popper">
			     <span :class="{ color_text: jskBidPlanDto.tenderWay.length }">
			       招标方式{{jskBidPlanDto.tenderWay.length? jskBidPlanDto.tenderWay.length + "项": ""}}
			       <i class="el-icon-caret-bottom"></i>
			     </span>
			     <el-select v-model="jskBidPlanDto.tenderWay" class="select-multiple" multiple placeholder="请选择">
			       <el-option v-for="(item, i) in tenderWayList" :key="i":label="item" :value="item">
			       </el-option>
			     </el-select>
			   </div>
			   <el-dropdown @command="planTenderAmounthandleCommand" class="el-dropdown-land"  placement="bottom-start" trigger="click" ref="planTenderAmountShowPopper" :hide-on-click="false">
			   	<span class="el-dropdown-link" :class="jskBidPlanDto.startPlanTenderAmount ||jskBidPlanDto.endPlanTenderAmount ? 'color_text': ''">
			   		合同预估金额{{jskBidPlanDto.startPlanTenderAmount ||jskBidPlanDto.endPlanTenderAmount? " 1项": ""}}<i class="el-icon-caret-bottom"></i>
			   	</span>
			   	<el-dropdown-menu slot="dropdown">
			   		<el-dropdown-item v-for="(item, i) in planTenderAmount" :class="jskBidPlanDto.startPlanTenderAmount == item.value[0] &&jskBidPlanDto.endPlanTenderAmount == item.value[1] &&
			                      !startPlanTenderAmount &&!endPlanTenderAmount? 'color_text': '' " :key="i" :command="item.value">{{ item.label }}</el-dropdown-item>
			   			<el-dropdown-item command="" style="padding: 0; text-indent: 20px">
			   				<div @mouseenter="planTenderAmountShowPopper = true" @mouseleave="planTenderAmountShowPopper = false">
			   					<span :class="(startPlanTenderAmount || endPlanTenderAmount) &&jskBidPlanDto.startPlanTenderAmount ==startPlanTenderAmount &&
			                               jskBidPlanDto.endPlanTenderAmount == endPlanTenderAmount? 'color_text': '' ">
			   						自定义<i class="el-icon-arrow-right"></i>
			   					</span>
			   					<div class="jabph_popper_box" style="position: absolute"v-if="planTenderAmountShowPopper">
			   						<div class="jabph_popper_wrap">
			   							从
			   							<el-input class="jabph_popper_input" v-limit-num clearable v-model="startPlanTenderAmount"></el-input>
			   							万
			   						</div>
			   						<div class="jabph_popper_wrap">
			   							到
			   							<el-input class="jabph_popper_input" v-limit-num clearable v-model="endPlanTenderAmount"></el-input>
			   							万
			   						</div>
			   						<div style="">
			   							<el-button size="mini" @click="planTenderAmountCancel">取消</el-button>
			   							<el-button type="primary" size="mini" @click="planTenderAmountPopperConfirm">确定</el-button>
			   						</div>
			   					</div>
			   				</div>
			   			</el-dropdown-item>
			   	</el-dropdown-menu>
			   </el-dropdown>
			   <el-dropdown @command="PlanTenderDatehandleCommand" trigger="click"   placement="bottom-start" class="el-dropdown-land" ref="PlanTenderDateShowPopper" :hide-on-click="false" >
				  <span class="el-dropdown-link" :class="PlanTenderDateValue ? 'color_text' : ''" >
				    计划招标时间{{ PlanTenderDateValue ? " 1项" : ""}}
					<i class="el-icon-caret-bottom"></i>
				  </span>
				  <div>
				    <el-dropdown-menu slot="dropdown">
				      <el-dropdown-item  v-for="(item, i) in PlanTenderDateOptions" class="el-dropdown-land"  :class=" PlanTenderDateValue && PlanTenderDateValue == item.value ? 'color_text': '' " :key="i" :command="item.value">
				        <div @mouseenter="hidePoper1">{{ item.label }}</div>
				      </el-dropdown-item>
				      <el-dropdown-item command="自定义" style="padding: 0; text-indent: 20px">
				        <div @mouseenter="mouseenter1">
				          <span :class="PlanTenderDateValue == '自定义' ? 'color_text' : ''">
				            自定义<i class="el-icon-arrow-right"></i>
				          </span>
				          <el-date-picker
				            v-if="PlanTenderDateShowPopper"
				            @change="changePlanTenderDate"
				            class="land_date_picker"
				            v-model="PlanTenderDate"
				            ref="datePicker1"
				            value-format="yyyy-MM-dd"
				            type="daterange"
				            range-separator="至"
				            start-placeholder="开始日期"
				            end-placeholder="结束日期"
				          >
				          </el-date-picker>
				        </div>
				      </el-dropdown-item>
				    </el-dropdown-menu>
				  </div>
				</el-dropdown>
			   <div class="select-popper">
			     <span :class="{ color_text: jskBidPlanDto.projectCapitalSource.length }">
			       资金来源{{jskBidPlanDto.projectCapitalSource.length? jskBidPlanDto.projectCapitalSource.length + "项": ""}}
			       <i class="el-icon-caret-bottom"></i>
			     </span>
			     <el-select v-model="jskBidPlanDto.projectCapitalSource" class="select-multiple" multiple placeholder="请选择">
			       <el-option v-for="(item, i) in projectCapitalSourceList" :key="i":label="item" :value="item">
			       </el-option>
			     </el-select>
			   </div>
			   
			 
			   
			   
			   
		    </div>
		</div>
		<div class="content_item content_item_padding0">
		    <div class="geduan">
		       
		    </div>
		</div>
		<div class="content_item content_item_padding0">
			
			<div class="search-new">
				<span @click="search()">查询</span>
				<span @click="reset">重置</span>
			</div>
		</div>
		
		
	  </div>
	  <div class="bottomlist">
	  	<div class="bottomlist-title">
	  		<div></div>
	  		<div class="title-right">
	  			<p>共有{{total}}条</p>
	  			<p>
	  				<img src="@/assets/images/EXCEL.png" alt="">
	  				<span class="excel" @click="$message({message: '功能正在开发中',type: 'warning'})">导出EXCEL</span>
	  			</p>
	  		</div>
	  		  
	  	</div>
		<div class="table-item-jf1" v-if="tableData.length==0">
			<img class="item-jf-img" src="@/assets/images/kong.png" alt="">
			<div class="item-jf-titel">抱歉，没找到相关数据！</div>
			<div class="item-jf-text">建议调整关键词或筛选条件，重新搜索！</div>
		</div>
	  	<ul class="bottomlist-content" v-if="tableData.length>0">
	  		<li class="bottomlist-list" v-for="item in tableData">
	  			<p class="list-titel">
	  				 <router-link  :to="'/radar/Bidding/details/'+ item.id" tag="a" class="list-titel-a" v-html="item.projectName"  ></router-link>
	  				 <!-- <div  v-else-if="item.projectName" v-html="item.projectName"></div> -->
	  			</p>
	  			<div class="content-label" v-if="(item.province||item.city||item.area)||(item.projectType&&item.projectType!='其他'&&item.projectType!='空白')||(item.objectType&&item.objectType!='其他'&&item.objectType!='空白')">
	  				<span class="list-label" v-if="item.domicile">
						{{item.province}}
						<template v-if="item.city">
							 -{{item.city}}
						</template>
						<template v-if="item.area">
							  -{{item.area}}
						</template>
					</span>
					<span class="list-label list-label-wl" v-if="item.objectType">{{item.objectType}}</span>
					<span class="list-label list-label-lx" v-if="item.projectType">{{item.projectType}}</span>
					
	  			</div>
	  			
	  			<div  class="list-content" v-if="item.tenderee||item.planTenderAmount||item.projectCapitalSource">
	  				<p class="list-content-text"  v-if="item.tenderee">
	  					<span>招采单位：</span>
							<span v-if="item.tendereeId">
								 <span class="blue"   @click="getUipIdByCid(item.tendereeId)" v-html="item.tenderee"></span>
							</span>
							<span v-else  v-html="item.tenderee">
							</span>
							
						</span>
	  				</p>
	  				<p class="list-content-text"  v-if="item.planTenderAmount">
	  					<span>合同预估金额（万元）：</span>
	  					<span>{{item.planTenderAmount||'--'}}</span>
	  				</p>
	  				<p class="list-content-text" v-if="item.projectCapitalSource">
	  					<span>资金来源：</span>
	  					<span>{{item.projectCapitalSource||'--'}}</span>
	  				</p>
	  				
	  				
	  			</div>
				<div  class="list-content list-content1" v-if="item.issueTime||item.planTenderDateStart||item.sourceName">
					<p class="list-content-text" v-if="item.issueTime">
						<span>发布时间：</span>
						<span >{{item.issueTime||'--'}}</span>
					</p>
					<p class="list-content-text" v-if="item.planTenderDateStart">
						<span>预计招标时间：</span>
						<span>{{item.planTenderDateStart||'--'}}</span>
					</p>
					<p class="list-content-text"  v-if="item.sourceName">
						<span>来源网站：</span>
						<span  >{{item.sourceName||'--'}}</span>
					</p>
					
					
				</div>
				<div  class="list-content  list-addree"  v-if="item.projectScale">
					<p class="list-content-text">
						<span class="content-text-gc">工程规模：</span>
						<span class="content-text-p" v-html="item.projectScale"></span>
					</p>
					
				</div>
	  			
	  		</li>
	  	</ul>
	  	<div class="pagination clearfix"  v-show="total>0">
	  		  <el-pagination
	  		    background
	  		    :page-size="limit"
	  		    :current-page="page"
	  		    @current-change="handleCurrentChange"
	  		    layout="prev, pager, next"
	  		    :total="total">
	  		  </el-pagination>
	  	</div>
	  	
	  </div>
  </div>
</template>

<script>
import jsk_data from '../../../../../public/jsk.json';
import {encodeStr} from "@/assets/js/common.js"
import api from '@/api/radar/radar.js';
export default {
  name: 'Bidding',
  data() {
    return {
	  encodeStr,
	  IssueTimeOptions: [
	    {
	      label: "不限",
	      value: "",
	    },
	    {
	      label: "今天",
	      value: "今天",
	    },
	    {
	      label: "近3日",
	      value: "近3日",
	    },
	    {
	      label: "近7日",
	      value: "近7日",
	    },
	    {
	      label: "近1个月",
	      value: "近1个月",
	    },
	    {
	      label: "近3个月",
	      value: "近3个月",
	    },
	    {
	      label: "近半年",
	      value: "近半年",
	    },
	    {
	      label: "近1年",
	      value: "近1年",
	    },
	  ],
	  IssueTimeValue: "",
	  IssueTime: "",
	  IssueTimeShowPopper: false,
	  PlanTenderDateOptions: [
	    {
	      label: "不限",
	      value: "",
	    },
	    {
	      label: "今天",
	      value: "今天",
	    },
	    {
	      label: "近3日",
	      value: "近3日",
	    },
	    {
	      label: "近7日",
	      value: "近7日",
	    },
	    {
	      label: "近1个月",
	      value: "近1个月",
	    },
	    {
	      label: "近3个月",
	      value: "近3个月",
	    },
	    {
	      label: "近半年",
	      value: "近半年",
	    },
	    {
	      label: "近1年",
	      value: "近1年",
	    },
	  ],
	  PlanTenderDateValue: "",
	  PlanTenderDate: "",
	  PlanTenderDateShowPopper: false,
	  
      addressList: [],
      addressType: [],
      props: {
        multiple: true,
        expandTrigger: "hover",
        value: "id",
      },
	  bidPlanObjectTypeList: [],//标的物类型
	  projectTypeList: [],//项目类型
	  tenderWayList: [],//招标方式
	  projectCapitalSourceList: [],//资金来源
	  planTenderAmount: [{
	  		value: "不限",
	  		label: "不限",
	  	},
	  	{
	  		value: [0, 100],
	  		label: "100万元以下",
	  	},
	  	{
	  		value: [100, 1000],
	  		label: "100万-1000万元",
	  	},
	  	{
	  		value: [1000, 5000],
	  		label: "1000万-5000万元",
	  	},
	  	{
	  		value: [5000, 20000],
	  		label: "5000万-2亿元",
	  	},
	  	{
	  		value: [20000, ""],
	  		label: "2亿元以上",
	  	},
	  ],

      jskBidPlanDto: {
	    projectName:'',
		tenderee:'',
		projectScale:'',
        province: [],
        city: [],
        area: [],
		objectType:[],
		projectType:[],
		tenderWay:[],
		startPlanTenderAmount:'',
		endPlanTenderAmount:'',
		projectCapitalSource:[],
		startIssueTime:'',
		endIssueTime:'',
		startPlanTenderDate:'',
		endPlanTenderDate:'',
		
      },
	  planTenderAmountShowPopper:false,
	  startPlanTenderAmount:'',
	  endPlanTenderAmount:'',
	  
      domicile: [],
      pageFlag: true,
	  conditionsArr: [],
	  
	  tableData:[],
	  total:0,
	  page:1,
	  limit:20
    };
  },
  computed: {
    checkjskBidPlanDto() {
        let arr = [];
		let data = {};
      if(this.jskBidPlanDto.projectName){
        data = {
				title: "项目名称:",
				keyid: "projectName",
				value: this.jskBidPlanDto.projectName,
				key: "projectName"
					}
		arr.push(data)
      }
     
      if(this.jskBidPlanDto.tenderee){
        data = {
				title: "招标单位:",
				keyid: "tenderee",
				value: this.jskBidPlanDto.tenderee,
				key: "tenderee"
					}
		arr.push(data)
      }
	  if(this.jskBidPlanDto.projectScale){
	    data = {
				title: "工程规模:",
				keyid: "projectScale",
				value: this.jskBidPlanDto.projectScale,
				key: "projectScale"
	  					}
	  	arr.push(data)
	  }
      if (this.domicile.length > 0) {
        data = {
          title: "项目属地:",
          keyid: "domicile",
          value: this.domicile.join(","),
          key: "domicile"
        }
        arr.push(data)
      }
	  if (this.jskBidPlanDto.objectType.length > 0) {
	    data = {
	      title: "标的物类型:",
	      keyid: "objectType",
	      value: this.jskBidPlanDto.objectType,
	      key: "objectType"
	    }
	    arr.push(data)
	  }
	  if (this.jskBidPlanDto.projectType.length > 0) {
	    data = {
	      title: "项目类型:",
	      keyid: "projectType",
	      value: this.jskBidPlanDto.projectType,
	      key: "projectType"
	    }
	    arr.push(data)
	  }
	  if (this.jskBidPlanDto.tenderWay.length > 0) {
	    data = {
	      title: "招标方式:",
	      keyid: "tenderWay",
	      value: this.jskBidPlanDto.tenderWay,
	      key: "tenderWay"
	    }
	    arr.push(data)
	  }
	  if (this.jskBidPlanDto.projectCapitalSource.length > 0) {
	    data = {
	      title: "资金来源:",
	      keyid: "projectCapitalSource",
	      value: this.jskBidPlanDto.projectCapitalSource,
	      key: "projectCapitalSource"
	    }
	    arr.push(data)
	  }
	  
	  
      this.conditionsArr = arr
    },
  },
  mounted() {
   this.init();
      
  },
  methods: {
	getCapitalSourceSelect(){
	  	api.getCapitalSourceSelect().then(res=>{
	  		this.projectCapitalSourceList = res.data;
	  	}).catch(error=>{
	  	});
	},
	searchDic(){
	  	api.searchDic().then(res=>{
	  		this.bidPlanObjectTypeList= res.bidPlanObjectType,//标的物类型
	  		this.projectTypeList= res.projectType,//项目类型
	  		this.tenderWayList= res.tenderWay;//招标方式
	  	}).catch(error=>{
	  	});
	},
    keywordClick(val) {
      this.projectName = val
    },
	 
    search(page, limit,exportFlag) {
      if (!page) {
        this.page = 1;
      }
      if (!limit) {
        this.limit = 20;
      }
      if (!page && !limit) {
        this.reloadPage();
      }
      var data = JSON.parse(JSON.stringify(this.jskBidPlanDto));
      data.province = data.province.join(",");
      data.city = data.city.join(",");
      data.area = data.area.join(",");
	  data.objectType=data.objectType.join(",");
	  data.projectCapitalSource=data.projectCapitalSource.join(",");
	  data.projectType=data.projectType.join(",");
	  data.tenderWay=data.tenderWay.join(",");
      let params = {
        page: {
          page: this.page,
          limit: this.limit,
          field: this.field,
        },
        jskBidPlanDto: data,
      };
      if(this.projectName){
        params.projectName = this.projectName
      }else{
        delete params.projectName
      }
      if(this.keywordNot){
        params.keywordNot = this.keywordNot
      }else{
        delete params.keywordNot
      }
	  api.jskBidPlanPage(params).then(res=>{
	  	if (res.code==200) {
	  		this.tableData=res.data.list;
	  		this.total=res.data.total;
	  	}
	  }).catch(error=>{
	  	
	  });
      
      
    },
    reloadPage() {
      this.pageFlag = false;
      this.$nextTick(() => {
        this.pageFlag = true;
      });
    },
    handleCurrentChange(page) {
      this.page = page;
      this.search(page, this.limit);
    },
    handleSizeChange(limit) {
      this.limit = limit;
      this.search(this.page, limit);
    },
	IssueTimehandleCommand(command) {
	  var obj = JSON.parse(JSON.stringify(this.jskBidPlanDto));
	  if (command && command != "自定义") {
	    this.IssueTimeValue = command;
	    this.$refs.IssueTimeShowPopper.hide();
	    const datetime = new Date();
	    var startTime, endTime, Year, Month, Day;
	    Year = datetime.getFullYear();
	    Month = datetime.getMonth() + 1;
	    Day = datetime.getDate();
	    switch (command) {
	      case "今天":
	        startTime = Year + "-" + Month +"-" + Day;
	        endTime = Year + "-" + Month + "-" + Day;
	        break;
	      case "近3日":
	        endTime = Year + "-" + Month + "-" + Day;
	        if (Day > 3) {
	          startTime = Year + "-" + Month  + "-" +(Day-3);
	        } else {
	          let newTime = datetime.getTime()-3*24*60*60*1000
	          Year = new Date(newTime).getFullYear();
	          Month = new Date(newTime).getMonth() + 1;
	          Day = new Date(newTime).getDate();
	          startTime = Year + "-" + Month +"-" + Day;
	        }
	        break;
	      case "近7日":
	        endTime = Year + "-" + Month + "-" + Day;
	        if (Day > 7) {
	          startTime = Year + "-" + Month  + "-" +(Day-7);
	        } else {
	          let newTime = datetime.getTime()-7*24*60*60*1000
	          Year = new Date(newTime).getFullYear();
	          Month = new Date(newTime).getMonth() + 1;
	          Day = new Date(newTime).getDate();
	          startTime = Year + "-" + Month +"-" + Day;
	        }
	        break;
	      case "近1个月":
	        endTime = Year + "-" + Month + "-" + Day;
	        if (Month > 1) {
	          startTime = Year + "-" + (Month - 1) + "-1";
	        } else {
	          startTime = Year - 1 + "-" + (12 + Month - 1) + "-1";
	        }
	        break;
	      case "近3个月":
	        endTime = Year + "-" + Month + "-" + Day;
	        if (Month > 3) {
	          startTime = Year + "-" + (Month - 3) + "-1";
	        } else {
	          startTime = Year - 1 + "-" + (12 + Month - 3) + "-1";
	        }
	        break;
	      case "近半年":
	        endTime = Year + "-" + Month + "-" + Day;
	        if (Month > 6) {
	          startTime = Year + "-" + (Month - 6) + "-1";
	        } else {
	          startTime = Year - 1 + "-" + (12 + Month - 6) + "-1";
	        }
	        break;
	      case "近1年":
	        startTime = Year - 1 + "-" + Month + "-" + Day;
	        endTime = Year + "-" + Month + "-" + Day;
	        break;
	      case "自定义":
	        if (!this.IssueTime) {
	          this.IssueTimeValue = "";
	        }
	        break;
	    }
			if(startTime){
				var start=startTime.split('-');
				startTime=start.map((item)=>{
					if(item.length==1){
						return '0'+item
					}else{
						return item
					}
				})
				startTime=startTime.join('-')
			}
			if(endTime){
				var end=endTime.split('-');
				endTime=end.map((item)=>{
					if(item.length==1){
						return '0'+item
					}else{
						return item
					}
				})
				endTime=endTime.join('-')
			}
	    obj.startIssueTime = startTime;
	    obj.endIssueTime = endTime;
	  } else if (command == "自定义") {
	    this.$refs.datePicker.pickerVisible = true;
	  } else {
	    this.$refs.IssueTimeShowPopper.hide();
	    this.IssueTimeValue = "";
	    this.IssueTime = "";
	    obj.startIssueTime = "";
	    obj.endIssueTime = "";
	  }
	  this.jskBidPlanDto = obj;
	},
	PlanTenderDatehandleCommand(command) {
	  var obj = JSON.parse(JSON.stringify(this.jskBidPlanDto));
	  if (command && command != "自定义") {
	    this.PlanTenderDateValue = command;
	    this.$refs.PlanTenderDateShowPopper.hide();
	    const datetime = new Date();
	    var startTime, endTime, Year, Month, Day;
	    Year = datetime.getFullYear();
	    Month = datetime.getMonth() + 1;
	    Day = datetime.getDate();
	    switch (command) {
	      case "今天":
	        startTime = Year + "-" + Month +"-" + Day;
	        endTime = Year + "-" + Month + "-" + Day;
	        break;
	      case "近3日":
	        endTime = Year + "-" + Month + "-" + Day;
	        if (Day > 3) {
	          startTime = Year + "-" + Month  + "-" +(Day-3);
	        } else {
	          let newTime = datetime.getTime()-3*24*60*60*1000
	          Year = new Date(newTime).getFullYear();
	          Month = new Date(newTime).getMonth() + 1;
	          Day = new Date(newTime).getDate();
	          startTime = Year + "-" + Month +"-" + Day;
	        }
	        break;
	      case "近7日":
	        endTime = Year + "-" + Month + "-" + Day;
	        if (Day > 7) {
	          startTime = Year + "-" + Month  + "-" +(Day-7);
	        } else {
	          let newTime = datetime.getTime()-7*24*60*60*1000
	          Year = new Date(newTime).getFullYear();
	          Month = new Date(newTime).getMonth() + 1;
	          Day = new Date(newTime).getDate();
	          startTime = Year + "-" + Month +"-" + Day;
	        }
	        break;
	      case "近1个月":
	        endTime = Year + "-" + Month + "-" + Day;
	        if (Month > 1) {
	          startTime = Year + "-" + (Month - 1) + "-1";
	        } else {
	          startTime = Year - 1 + "-" + (12 + Month - 1) + "-1";
	        }
	        break;
	      case "近3个月":
	        endTime = Year + "-" + Month + "-" + Day;
	        if (Month > 3) {
	          startTime = Year + "-" + (Month - 3) + "-1";
	        } else {
	          startTime = Year - 1 + "-" + (12 + Month - 3) + "-1";
	        }
	        break;
	      case "近半年":
	        endTime = Year + "-" + Month + "-" + Day;
	        if (Month > 6) {
	          startTime = Year + "-" + (Month - 6) + "-1";
	        } else {
	          startTime = Year - 1 + "-" + (12 + Month - 6) + "-1";
	        }
	        break;
	      case "近1年":
	        startTime = Year - 1 + "-" + Month + "-" + Day;
	        endTime = Year + "-" + Month + "-" + Day;
	        break;
	      case "自定义":
	        if (!this.PlanTenderDate) {
	          this.PlanTenderDateValue = "";
	        }
	        break;
	    }
			if(startTime){
				var start=startTime.split('-');
				startTime=start.map((item)=>{
					if(item.length==1){
						return '0'+item
					}else{
						return item
					}
				})
				startTime=startTime.join('-')
			}
			if(endTime){
				var end=endTime.split('-');
				endTime=end.map((item)=>{
					if(item.length==1){
						return '0'+item
					}else{
						return item
					}
				})
				endTime=endTime.join('-')
			}
	    obj.startPlanTenderDate = startTime;
	    obj.endPlanTenderDate = endTime;
	  } else if (command == "自定义") {
	    this.$refs.datePicker1.pickerVisible = true;
	  } else {
	    this.$refs.PlanTenderDateShowPopper.hide();
	    this.PlanTenderDateValue = "";
	    this.PlanTenderDate = "";
	    obj.startPlanTenderDate = "";
	    obj.endPlanTenderDate = "";
	  }
	  this.jskBidPlanDto = obj;
	},
	changeIssueTime(type) {
	  if(type=='bid'&&this.tenderDate){
	    this.tenderDateValue = "自定义";
	    var obj = JSON.parse(JSON.stringify(this.jskBidPlanDto));
	    obj.startTenderTime = this.tenderDate[0];
	    obj.endTenderTime = this.tenderDate[1];
	    this.jskBidPlanDto = obj;
	  }else if(this.IssueTime) {
	    this.IssueTimeValue = "自定义";
	    var obj = JSON.parse(JSON.stringify(this.jskBidPlanDto));
	    obj.startIssueTime = this.IssueTime[0];
	    obj.endIssueTime = this.IssueTime[1];
	    this.jskBidPlanDto = obj;
	  }
	},
	changePlanTenderDate(type) {
	  if(type=='bid'&&this.tenderDate){
	    this.tenderDateValue = "自定义";
	    var obj = JSON.parse(JSON.stringify(this.jskBidPlanDto));
	    obj.startTenderTime = this.tenderDate[0];
	    obj.endTenderTime = this.tenderDate[1];
	    this.jskBidPlanDto = obj;
	  }else if(this.PlanTenderDate) {
	    this.PlanTenderDateValue = "自定义";
	    var obj = JSON.parse(JSON.stringify(this.jskBidPlanDto));
	    obj.startPlanTenderDate = this.PlanTenderDate[0];
	    obj.endPlanTenderDate = this.PlanTenderDate[1];
	    this.jskBidPlanDto = obj;
	  }
	},
	hidePoper(type) {
	  if(type=='bid'&&this.$refs.tenderDatePicker){
	    this.$refs.tenderDatePicker.pickerVisible = false;
	  }else if(this.$refs.datePicker){
	    this.$refs.datePicker.pickerVisible = false;
	  }
	},
	hidePoper1(type) {
	  if(type=='bid'&&this.$refs.tenderDatePicker){
	    this.$refs.tenderDatePicker.pickerVisible = false;
	  }else if(this.$refs.datePicker1){
	    this.$refs.datePicker1.pickerVisible = false;
	  }
	},
	mouseenter(type) {
	  if(type=='bid'){
	    this.tenderDateShowPopper = true;
	    if(this.tenderDateValue=="自定义"){
	      this.$nextTick(() => {
	        this.$refs.tenderDatePicker.pickerVisible = true;
	      });
	    }
	  }else{
	    this.IssueTimeShowPopper = true;
	    if(this.IssueTimeValue=="自定义"){
	      this.$nextTick(() => {
	        this.$refs.datePicker.pickerVisible = true;
	      });
	    }
	  }
	},
	mouseenter1(type) {
	  if(type=='bid'){
	    this.tenderDateShowPopper = true;
	    if(this.tenderDateValue=="自定义"){
	      this.$nextTick(() => {
	        this.$refs.tenderDatePicker.pickerVisible = true;
	      });
	    }
	  }else{
	    this.PlanTenderDateShowPopper = true;
	    if(this.PlanTenderDateValue=="自定义"){
	      this.$nextTick(() => {
	        this.$refs.datePicker1.pickerVisible = true;
	      });
	    }
	  }
	},
	clearIssueTime(type) {
	  var obj = JSON.parse(JSON.stringify(this.jskBidPlanDto));
	  if(type=='bid'){
	    this.tenderDate = "";
	    this.tenderDateValue = "";
	    obj.startTenderTime = "";
	    obj.endTenderTime = "";
	  }else{
	    this.IssueTime = "";
	    this.IssueTimeValue = "";
	    obj.startIssueTime = "";
	    obj.endIssueTime = "";
	  }
	  this.jskBidPlanDto = obj;
	},
	clearPlanTenderDate(type) {
	  var obj = JSON.parse(JSON.stringify(this.jskBidPlanDto));
	  if(type=='bid'){
	    this.tenderDate = "";
	    this.tenderDateValue = "";
	    obj.startTenderTime = "";
	    obj.endTenderTime = "";
	  }else{
	    this.PlanTenderDate = "";
	    this.PlanTenderDateValue = "";
	    obj.startPlanTenderDate = "";
	    obj.endPlanTenderDate = "";
	  }
	  this.jskBidPlanDto = obj;
	},
    deleteDomicile() {
      this.$refs.address.handleClear();
    },
	
    domicileChange() {
      let arr = this.$refs.address.getCheckedNodes();
      let province = [],
        city = [],
        area = [];
      this.domicile = [];
      for (var i in arr) {
        if (arr[i].parent) {
          if (!arr[i].parent.checked) {
            arr[i].hasChildren && city.push(arr[i].value);
            arr[i].hasChildren && this.domicile.push(arr[i].label);
            !arr[i].hasChildren && area.push(arr[i].value);
            !arr[i].hasChildren && this.domicile.push(arr[i].label);
          }
        } else {
          province.push(arr[i].value);
          this.domicile.push(arr[i].label);
        }
      }
      var obj = JSON.parse(JSON.stringify(this.jskBidPlanDto));
      obj.province = province;
      obj.city = city;
      obj.area = area;
      this.jskBidPlanDto = obj;
    },
    addressListfn() {
      var str = [];
      for (let x = 0; x < 3; x++) {
        for (let i = 0; i < jsk_data.length; i++) {
          if (jsk_data[i].regionLevel == x + 1 && x + 1 == 1) {
            str.push({
              id: jsk_data[i].id,
              label: jsk_data[i].regionName,
              short: jsk_data[i].short,
              value: jsk_data[i].parentId,
              children:jsk_data[i].id==900000?undefined:[],
            });
          } else if (jsk_data[i].regionLevel == x + 1 && x + 1 == 2&&str) {
            for (let j = 0; j < str.length; j++) {
              if (str[j].id == jsk_data[i].parentId) {
                str[j].children.push({
                  id: jsk_data[i].id,
                  label: jsk_data[i].regionName,
                  short: jsk_data[i].short,
                  value: jsk_data[i].parentId,
                  children: [],
                });
              }
            }
          } else if (jsk_data[i].regionLevel == x + 1 && x + 1 == 3) {
            for (let j = 0; j < str.length; j++) {
              if(str[j].children){
                for (let k = 0; k < str[j].children.length; k++) {
                  if (str[j].children[k].id == jsk_data[i].parentId) {
                    str[j].children[k].children.push({
                      id: jsk_data[i].id,
                      label: jsk_data[i].regionName,
                      short: jsk_data[i].short,
                      value: jsk_data[i].parentId,
                    });
                  }
                }
              }
            }
          }
        }
      }
      this.addressList = str;
    },
	planTenderAmountPopperConfirm() {
		if (
			this.startPlanTenderAmount &&
			this.endPlanTenderAmount &&
			!(Number(this.endPlanTenderAmount) > Number(this.startPlanTenderAmount))
		) {
			return this.$message.warning("最小值必须小于最大值,请重新输入！");
		}
		this.planTenderAmountShowPopper = false;
		var obj = JSON.parse(JSON.stringify(this.jskBidPlanDto));
		obj.startPlanTenderAmount = this.startPlanTenderAmount;
		obj.endPlanTenderAmount = this.endPlanTenderAmount;
		this.jskBidPlanDto = obj;
		this.$refs.planTenderAmountShowPopper.hide();
	},
	planTenderAmountCancel() {
		this.planTenderAmountShowPopper = false;
		this.$refs.planTenderAmountShowPopper.hide();
	},
	planTenderAmounthandleCommand(command) {
		if (command) {
			this.$refs.planTenderAmountShowPopper.hide();
			var obj = JSON.parse(JSON.stringify(this.jskBidPlanDto));
			this.startPlanTenderAmount = "";
			this.endPlanTenderAmount = "";
			if (command == "不限") {
				obj.startPlanTenderAmount = "";
				obj.endPlanTenderAmount = "";
			} else {
				obj.startPlanTenderAmount = command[0];
				obj.endPlanTenderAmount = command[1];
			}
			this.jskBidPlanDto = obj;
		}
	},
	getUipIdByCid(companyId){
		var params=[companyId]
		api.getUipIdByCid(params).then(res=>{
					if (res.code==200) {
							if(res.data&&res.data.length>0&&res.data[0].uipId){
								this.$router.push({path: '/enterprise/'+this.encodeStr(companyId)})
							}else{
								this.$router.push({path: '/company/'+this.encodeStr(companyId)})
							}
							
					}
		 }).catch(error=>{
		 	
		 });
	},
    reset() {
      Object.assign(this.$data, this.$options.data.call(this)); //重置data
      this.init();
      this.$emit("reset");
    },
    init(){
      this.search();
      this.addressListfn();
	  this.searchDic();
      this.getCapitalSourceSelect();
    },
   
  },
};
</script>
<style lang="scss" scoped>
	.content{
	  padding: 0px 16px;
	  padding-top: 16px;
	  border-radius: 4px 4px 4px 4px;
	   background: #FFFFFF;
	   .content_item{
		   padding-top: 20px;
		   display: flex;
		   align-items: center;
	       .label{
	           width: 84px;
			   font-size: 14px;
			   font-weight: 400;
			   color: rgba(35,35,35,0.8);
	       }
	       .content_right{
	           
	           .ename_input{
	               width: 640px;
	               margin-right: 20px;
	           }
			   .land_ipt_470 {
			   	width: 640px;
			   }
	       }
		   
		 .item_ckquery_list {
			display: flex;
		
		}
		
		 .item_ckquery_list .el-input__icon {
			position: relative;
			top: 1px;
		}
		.ckquery_list_right {
			width: 640px;
		}
		.register_count_ipt{
			margin-left: 0px;
			
		}
		.register_count_ipt .el-input__inner{
			width: 174px;
		}
		::v-deep .el-input-group__prepend{
			padding: 0 8px;
		}
		.content-projecttype{
			display: flex;
			align-items: center;
			justify-content: center;
			.projecttype{
				font-weight: 400;
				color: #232323;
				padding: 1px 5px;
				margin-right: 4px;
				cursor: pointer;
				border-radius: 3px 3px 3px 3px;
				font-size: 14px;
			}
			.projecttype:first-child{
				padding-left: 0px;
			}
			.projecttype:hover{
				background: #F3F4F5;
				padding: 1px 5px;
			}
			.activetype{
				background: #F3F4F5;
				padding: 1px 5px !important;
			}
		}
		
		
	   
	   }
	   .content_item_padding0{
		   padding: 0;
	   }
		
	}
	.bottomlist{
		width: 100%;
		background-color: #FFFFFF;
		
	     border-radius: 4px 4px 4px 4px;
		.bottomlist-title{
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 12px;
			padding: 16px ;
			border-bottom: 1px solid #EFEFEF;
			 
			.title-right{
				display: flex;
				align-items: center;
				p:first-child{
					font-size: 12px;
					font-weight: 400;
					color: #3D3D3D;
					margin-right: 10px;
				}
				p:last-child{
					display: flex;
					align-items: center;
					font-size: 14px;
					font-weight: 400;
					color: rgba(35,35,35,0.8);
				}
				img{
					width: 18px;
					height: 18px;
				}
				.excel{
					cursor: pointer;
				}
			}
			
		}
		.bottomlist-content{
			
			padding-bottom: 0px;
		}
		.bottomlist-list{
			padding: 16px;
			font-size: 14px;
			border-bottom: 1px solid #EFEFEF;
			padding-bottom: 14px;
			.list-titel{
				font-size: 16px;
				font-weight: 700;
				color: #3D3D3D;
				line-height: 19px;
				.list-titel-a{
					text-decoration: none;
					color:#3D3D3D;
				}
				a:hover, a:visited, a:link, a:active{
					color:#3D3D3D;
				}
			}
			.content-label{
				margin-top: 8px;
				.list-label{
					background: #F3F3FF;
					color: #8491E8;
					border-radius: 1px 1px 1px 1px;
					padding: 3px 7px;
					font-size: 12px;
					margin-right: 8px;
					
				}
				.list-label-wl{
					background: #e8f7f0;
					color: #38c8bf;
					
				}
				.list-label-lx{
					background: #e4f3fd;
					color: #41a1fd;
				}
			}
			
			
			.list-content{
				margin-top: 12px;
				display: flex;
				justify-content: start;
				align-items: center;
				
				.list-content-text{
					display: flex;
					justify-content: start;
					align-items:flex-start ;
					margin-right: 32px;
					font-size: 14px;
					
					span:first-child{
						font-weight: 400;
						color: rgba(35,35,35,0.4);
						line-height: 15px
					}
					span:last-child{
						font-weight: 400;
						color: rgba(35,35,35,0.8);
						line-height: 15px
					}
					.content-text-gc{
						width: 72px;
					}
					.content-text-p{
						width: 1200px;
					}
					.blue{
						color: #0081FF !important;
						cursor: pointer;
						
					}
					
				}
				
				
			}
			.list-addree{
				width: auto;
				background: #F3F4F5;
				display: inline-flex;
				margin-top: 16px;
				.list-content-text{
					margin-left: 16px;
					span{
						line-height: 30px!important;
					}
				}
				img{
					width: 14px;
					margin: 0  8px;
					
				}
			}
			
			.list-content1{
				margin-top: 8px;
			}
			
		}
		.bottomlist-list:hover{
			background: #F6F9FC;
			cursor: pointer;
		}
		
		.pagination{
			padding: 14px ;
		   .el-pagination{
			   float: right;
		   }
		}
	}
	
	
</style>

