<template>
	<div>
		<div class="content">
			<div class="content_item">
			    <div class="label">项目名称</div>
			    <div class="content_right">
			        <el-input class="ename_input" 
					placeholder="请输入项目名称关键字" v-model="establishmentDto.keyword" ></el-input>
			    </div>
			</div>
			<div class="content_item">
			    <div class="label">项目业主</div>
			    <div class="content_right">
			        <el-input class="ename_input" 
					placeholder="请输入项目业主名称或关键词" v-model="establishmentDto.companyName" ></el-input>
			    </div>
			</div>
			<div class="content_item">
			    <div class="label">审批部门</div>
			    <div class="content_right">
			        <el-input class="ename_input" 
					placeholder="请输入审批部门名称或关键词" v-model="establishmentDto.examineOffice" ></el-input>
			    </div>
			</div>
			<div class="content_item">
			    <div class="label">建设地点</div>
			    <div class="content_right">
			        <el-input class="ename_input" 
					placeholder="请输入建设地点名称关键词" v-model="establishmentDto.buildAddre" ></el-input>
			    </div>
			</div>
			<div class="content_item">
			    <div class="label">建设规模</div>
			    <div class="content_right">
			        <el-input class="ename_input" 
					placeholder="请输入建设规模名称关键词" v-model="establishmentDto.buildScale" ></el-input>
			    </div>
			</div>
			<div class="content_item">
			    <div class="label">土地信息</div>
			    <div class="content_right">
				   <div class="select-popper">
				   		<span :class="{ color_text: establishmentDto.projectType.length }">
				   			项目类型{{establishmentDto.projectType.length? establishmentDto.projectType.length + "项": ""}}
				   			<i class="el-icon-caret-bottom"></i>
				   		</span>
				   		<el-select v-model="establishmentDto.projectType" class="select-multiple" multiple placeholder="请选择">
				   			<el-option v-for="(item, i) in projectTypeOptions" :key="i" :label="item" :value="item">
				   			</el-option>
				   		</el-select>
				   	</div>
					
					<div class="select-popper">
						<span :class="{ color_text: establishmentDto.industry.length }">
							所属行业{{establishmentDto.industry.length? establishmentDto.industry.length + "项": ""}}
							<i class="el-icon-caret-bottom"></i>
						</span>
					    <el-select v-model="establishmentDto.industry" class="select-multiple" multiple placeholder="请选择">
							<el-option v-for="(item, i) in industryOptions" :key="i" :label="item" :value="item">
							</el-option>
						</el-select>
					</div>
					
					<div class="select-popper">
							<span :class="{color_text:establishmentDto.province.length ||establishmentDto.city.length ||establishmentDto.district.length,}">
								项目属地{{establishmentDto.province.length ||establishmentDto.city.length ||establishmentDto.district.length
					                    ? establishmentDto.province.length +establishmentDto.city.length +establishmentDto.district.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>
					<el-dropdown @command="moneyhandleCommand"  class="el-dropdown-land" trigger="click" ref="moneyShowPopper" :hide-on-click="false">
							<span class="el-dropdown-link" :class=" establishmentDto.startMoney || establishmentDto.endMoney? 'color_text' : ''">
								总投资{{establishmentDto.startMoney || establishmentDto.endMoney? " 1项": ""}}<i class="el-icon-caret-bottom"></i>
							</span>
							<el-dropdown-menu slot="dropdown">
								<el-dropdown-item v-for="(item, i) in moneyOptions" :class="establishmentDto.startMoney == item.value[0] &&establishmentDto.endMoney == item.value[1] 
								 &&!startMoney &&!endMoney? 'color_text' : ''" :key="i" :command="item.value">{{ item.label }}</el-dropdown-item>
										<el-dropdown-item command="" style="padding: 0; text-indent: 20px">
											<div @mouseenter="moneyShowPopper = true" @mouseleave="moneyShowPopper = false">
												<span :class="(startMoney || endMoney) &&establishmentDto.startMoney == startMoney &&establishmentDto.endMoney == endMoney? 'color_text' : '' ">
															自定义<i class="el-icon-arrow-right"></i>
												</span>
												<div class="jabph_popper_box" style="position: absolute" v-if="moneyShowPopper">
													<div class="jabph_popper_wrap">
														从
														<el-input class="jabph_popper_input" v-limit-num clearable v-model="startMoney"></el-input>
														万
													</div>
													<div class="jabph_popper_wrap">
														到
														<el-input class="jabph_popper_input" v-limit-num clearable v-model="endMoney"></el-input>
														万
													</div>
													<div style="">
														<el-button size="mini" @click="moneyCancel">取消</el-button>
														<el-button type="primary" size="mini" @click="moneyPopperConfirm">确定</el-button>
													</div>
												</div>
											</div>
										</el-dropdown-item>
							</el-dropdown-menu>
					</el-dropdown>
					<div class="select-popper">
						<span class="el-dropdown-link" :class="{ color_text: establishmentDto.isProject }">
							是否为向民间推介项目{{ establishmentDto.isProject ? " 1项" : "" }}<i class="el-icon-caret-bottom"></i>
						</span>
						<el-select v-model="establishmentDto.isProject" class="select-multiple" placeholder="请选择">
							<el-option v-for="(item, i) in isProjectOptions" :key="i" :label="item.label"
								:value="item.value.toString()">
							</el-option>
						</el-select>
					</div>
					<el-dropdown @command="planStartTimehandleCommand"  class="el-dropdown-land" trigger="click" ref="planStartTimeShowPopper":hide-on-click="false">
						<span class="el-dropdown-link" :class="planStartTimeValue ? 'color_text' : ''">
							计划开工时间{{ planStartTimeValue ? " 1项" : ""}}<i class="el-icon-caret-bottom"></i>
						</span>
						<div>
							<el-dropdown-menu slot="dropdown">
								<el-dropdown-item v-for="(item, i) in handleTimeOptions" :class=" planStartTimeValue && planStartTimeValue == 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="planStartTimeValue == '自定义' ? 'color_text' : ''">
												自定义<i class="el-icon-arrow-right"></i>
											</span>
											<el-date-picker v-if="planStartTimeShowPopper" @change="changePlanStartTime" class="land_date_picker" v-model="planStartTime" 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>
					<el-dropdown @command="planEndTimehandleCommand"  class="el-dropdown-land" trigger="click" ref="planEndTimeShowPopper" :hide-on-click="false">
						<span class="el-dropdown-link" :class="planEndTimeValue ? 'color_text' : ''">
							计划完工日期{{ planEndTimeValue ? " 1项" : ""}}<i class="el-icon-caret-bottom"></i>
						</span>
						<div>
							<el-dropdown-menu slot="dropdown">
								<el-dropdown-item v-for="(item, i) in handleTimeOptions" :class="planEndTimeValue && planEndTimeValue == item.value? 'color_text': ''" :key="i" :command="item.value">
									<div @mouseenter="hidePoper2">{{ item.label }}</div>
										</el-dropdown-item>
											<el-dropdown-item command="自定义" style="padding: 0; text-indent: 20px">
												<div @mouseenter="mouseenter2">
													<span :class="planEndTimeValue == '自定义' ? 'color_text' : ''">
														自定义<i class="el-icon-arrow-right"></i>
													</span>
													<el-date-picker v-if="planEndTimeShowPopper" @change="changePlanEndTime"class="land_date_picker" v-model="planEndTime" ref="datePicker2"
														value-format="yyyy-MM-dd" type="daterange" range-separator="至"tart-placeholder="开始日期" end-placeholder="结束日期">
													</el-date-picker>
												</div>
											</el-dropdown-item>
							</el-dropdown-menu>
						</div>
					</el-dropdown>
				 
				   
			    </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>导出EXCEL</span>
					</p>
				</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/Establishment/details/'+ item.id" tag="a" class="list-titel-a" v-html="item.projectName" ></router-link>
					</p>
					<div class="content-label" v-if="item.domicile||item.projectType&&item.projectType!='其他'&&item.projectType!='空白'||item.industry&&item.industry!='其他'&&item.industry!='空白'">
						<span class="list-label " v-if="item.projectType&&item.projectType!='其他'&&item.projectType!='空白'">
						 {{item.projectType}}
						</span>
						  <span class="list-label list-label-wl" v-if="item.industry&&item.industry!='其他'&&item.industry!='空白'">
						   {{item.industry}}
						  </span>
						  <span class="list-label list-label-lx" v-if="item.domicile">
						      {{item.domicile}}
						  </span>
					</div>
					
					
					<div  class="list-content">
						<p class="list-content-text" v-if="item.companyName">
							<span>项目业主：</span>
							<router-link  :to="`/company/${encodeStr(item.companyId)}/`" tag="a" class="list-titel-a blue" v-html="item.companyName" ></router-link>
						</p>
						
						<p class="list-content-text"v-if="item.money">
							<span>总投资：</span>
							<span v-html="item.money+'万元'"></span>
						</p>
						<p class="list-content-text"v-if="item.planStartTime">
							<span>计划开工日期：</span>
							<span>{{item.planStartTime}}</span>
						</p>
						<p class="list-content-text"v-if="item.planEndTime">
							<span>计划完工日期：</span>
							<span>{{item.planEndTime}}</span>
						</p>
						<p class="list-content-text"v-if="item.isProject!=null">
							<span>是否为民间推介项目：</span>
							<span>{{item.isProject==0?'否':'是'}}</span>
						</p>
						
						
					</div>
					<div  class="list-content"  v-if="item.buildScale">
						<p class="list-content-text">
							<span class="content-text-gc">建设规模：</span>
							<span class="content-text-p">{{item.buildScale||'--'}}</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: 'Establishment',
		components: {
		},
		data() {
			return {
				encodeStr,
				//是否为向民间推介项目
				isProjectOptions: [{
						value: 0,
						label: "否",
					},
					{
						value: 1,
						label: "是",
					}
				],
				isShow: false,
				openVip: {
					open: false,
				},
				loginData: {
					loginShow: false
				},
				token: "",
				example: 'search-njxm',
				selectedHeight: 64,
				addressList: [],
				addressType: [],
				props: {
					multiple: true,
					expandTrigger: "hover",
					value: "id",
				},
				field: "",
				fieldOptions: [{
						value: "",
						label: "默认排序",
					},
					{
						value: "money",
						label: "总投资从大到小",
					},
					{
						value: "acreage",
						label: "出让面积从大到小",
					},
				],

				moneyOptions: [{
						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亿元以上",
					},
				],
				handleTimeOptions: [{
						label: "不限",
						value: "",
					},
					{
						label: "近1个月",
						value: "近1个月",
					},
					{
						label: "近半年",
						value: "近半年",
					},
					{
						label: "近1年",
						value: "近1年",
					},
					{
						label: "近3年",
						value: "近3年",
					},
				],
				handleTimeValue: "",
				planStartTimeValue: "",
				planEndTimeValue: "",
				industryOptions: [],
				examineStatusOptions: [
					"不通过",
					"作废",
					"变更",
					"备案",
					"审批",
					"申报",
					"退回",
					"通过",
					"其他"
				],
				projectTypeOptions: [
					"房建工程",
					"市政工程",
					"公路工程",
					"水利工程",
					"铁路工程",
					"通信工程",
					"电力工程",
					"机电工程",
					"冶金工程",
					"矿山工程",
					"石油化工工程",
					"港口与航道工程",
					"其他",
					"空白"
				],
				buildNatureOptions: [
					"扩建",
					"技改",
					"技改及其他",
					"改建",
					"改扩建",
					"新建",
					"迁建",
					"其他"
				],
				establishmentDto: {
					province: [],
					city: [],
					district: [],
					projectType: [],
					industry: [],
				},
				conditionTitles: {
					keyword: "关键词:",
					companyName: "项目业主:",
					examineOffice: "审批部门:",
					buildAddre: "建设地点:",
					buildScale: "建设规模:",
				},
				domicile: [],
				startMoney: "",
				endMoney: "",
				moneyShowPopper: false,
				handleTime: "",
				handleTimeShowPopper: false,
				planStartTime: "",
				planStartTimeShowPopper: false,
				planEndTime: "",
				planEndTimeShowPopper: false,
				pageFlag: true,
				conditionsArr: [],
				
				tableData:[],
				total:0,
				page:1,
				limit:20
			};
		},
		
		computed: {
			checkEstablishmentDto() {
				let arr = [];
				let flag = false;
				let data = {};
				let keyid, value, title;
				if (this.domicile.length > 0) {
					data = {
						title: "项目属地:",
						keyid: "domicile",
						value: this.domicile.join(","),
						key: "domicile"
					}
					arr.push(data)
				}
				if (this.handleTimeValue == "自定义") {
					data = {
						title: "办结时间:",
						keyid: "handleTime",
						value: this.establishmentDto.handleTimeStart + "~" + this.establishmentDto.handleTimeEnd,
						key: "handleTime"
					}
					arr.push(data)
				}
				if (this.handleTimeValue && this.handleTimeValue != "自定义") {
					data = {
						title: "办结时间:",
						keyid: "handleTime",
						value: this.handleTimeValue,
						key: "handleTime"
					}
					arr.push(data)
				}
				if (this.planStartTimeValue && this.planStartTimeValue != "自定义") {
					data = {
						title: "计划开工时间:",
						keyid: "planStartTime",
						value: this.planStartTimeValue,
						key: "planStartTime"
					}
					arr.push(data)
				}
				if (this.planStartTimeValue == "自定义") {
					data = {
						title: "计划开工时间:",
						keyid: "planStartTime",
						value: this.establishmentDto.planStartTimeStart + "~" + this.establishmentDto.planStartTimeEnd,
						key: "planStartTime"
					}
					arr.push(data)
				}
				if (this.planEndTimeValue && this.planEndTimeValue != "自定义") {
					data = {
						title: "计划完工日期:",
						keyid: "planEndTime",
						value: this.planEndTimeValue,
						key: "planEndTime"
					}
					arr.push(data)
				}
				if (this.planEndTimeValue == "自定义") {
					data = {
						title: "计划完工日期:",
						keyid: "planEndTime",
						value: this.establishmentDto.planEndTimeStart + "~" + this.establishmentDto.planEndTimeEnd,
						key: "planEndTime"
					}
					arr.push(data)
				}
				for (var i in this.establishmentDto) {
					if (this.establishmentDto[i]) {
						keyid = i;
						value = this.establishmentDto[i];
						if (
							Object.prototype.toString.call(this.establishmentDto[i]) ===
							"[object Array]"
						) {
							if (this.establishmentDto[i].length > 0) {
								flag = true;
								switch (i) {
									case 'examineStatus':
										title = "审批结果:";
										break;
									case 'projectType':
										title = "项目类型:";
										break;
									case 'industry':
										title = "所属行业:";
										break;
									case 'isProject':
										title = "是否为向民间推介项目:";
										break;
									default:
										title = "";
										break;
								}
							} else {
								title = ""
							}
						} else {
							title = this.conditionTitles[i];
							flag = true;
						}
						if (title) {
							data = {
								keyid: keyid,
								value: value,
								title: title,
								key: value
							}
							arr.push(data)
						}
					}
				}
				this.conditionsArr = arr
				return flag;
			},
		},
		mounted() {
			this.init();
			


		},
		methods: {
			searchDic(){
				api.searchDic().then(res=>{
					this.projectTypeOptions = res.projectType;
					this.industryOptions = res.establishmentIndustry
				}).catch(error=>{
					
				});
							 
			},
		
			refresh(value) {
				if (value) {
					this.$router.go(0)
				}
			},
			reloadPage() {
				this.pageFlag = false;
				this.$nextTick(() => {
					this.pageFlag = true;
				});
			},
			handleCurrentChange(page) {
				this.page = page;
				this.search(page, this.limit);
			},
			fieldCommand(command) {
				this.field = command;
				this.search();
			},
			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.establishmentDto));
				data.province = data.province.join(",");
				data.city = data.city.join(",");
				data.district = data.district.join(",");
				data.projectType = data.projectType.join(",");
				data.industry = data.industry.join(",");
				if (data.isProject && data.isProject === 0) {
					data.isProject = parseInt(data.isProject);
				}
				if(!this.ckhasValue(data)){
					data={};
				}
				
				let params = {
					page: {
						page: this.page,
						limit: this.limit,
						field: this.field,
					},
					establishmentDto: data,
				};
				
				api.establishmentPage(params).then(res=>{
					if (res.code==200) {
						this.tableData=res.data.list;
						this.total=res.data.total;
					}
				}).catch(error=>{
					
				});
				
			},
			
			
			deleteDomicile() {
				this.$refs.address.handleClear();
			},
			domicileChange() {
				let arr = this.$refs.address.getCheckedNodes();
				let province = [],
					city = [],
					district = [];
				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 && district.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.establishmentDto));
				obj.province = province;
				obj.city = city;
				obj.district = district;
				this.establishmentDto = obj;
			},
			moneyPopperConfirm() {
				if (
					this.startMoney &&
					this.endMoney &&
					!(Number(this.endMoney) > Number(this.startMoney))
				) {
					return this.$message.warning("最小值必须小于最大值,请重新输入！");
				}
				this.moneyShowPopper = false;
				var obj = JSON.parse(JSON.stringify(this.establishmentDto));
				obj.startMoney = this.startMoney;
				obj.endMoney = this.endMoney;
				this.establishmentDto = obj;
				this.$refs.moneyShowPopper.hide();
			},
			moneyCancel() {
				this.moneyShowPopper = false;
				this.$refs.moneyShowPopper.hide();
			},
			moneyhandleCommand(command) {
				if (command) {
					this.$refs.moneyShowPopper.hide();
					var obj = JSON.parse(JSON.stringify(this.establishmentDto));
					this.startMoney = "";
					this.endMoney = "";
					if (command == "不限") {
						obj.startMoney = "";
						obj.endMoney = "";
					} else {
						obj.startMoney = command[0];
						obj.endMoney = command[1];
					}
					this.establishmentDto = obj;
				}
			},
			handleTimehandleCommand(command) {
				var obj = JSON.parse(JSON.stringify(this.establishmentDto));
				if (command && command != "自定义") {
					this.handleTimeValue = command;
					this.$refs.handleTimeShowPopper.hide();
					const datetime = new Date();
					var startTime, endTime, Year, Month, Day;
					Year = datetime.getFullYear();
					Month = datetime.getMonth() + 1;
					Day = datetime.getDate();
					switch (command) {
						case "近1个月":
							if (Month > 1) {
								startTime = Year + "-" + (Month - 1) + "-1";
							} else {
								startTime = Year - 1 + "-" + (12 + Month - 1) + "-1";
							}
							endTime = Year + "-" + Month + "-" + Day;
							break;
						case "近半年":
							if (Month > 6) {
								startTime = Year + "-" + (Month - 6) + "-1";
							} else {
								startTime = Year - 1 + "-" + (12 + Month - 6) + "-1";
							}
							endTime = Year + "-" + Month + "-" + Day;
							break;
						case "近1年":
							startTime = Year - 1 + "-" + Month + "-" + Day;
							endTime = Year + "-" + Month + "-" + Day;
							break;
						case "近3年":
							startTime = Year - 3 + "-" + Month + "-" + Day;
							endTime = Year + "-" + Month + "-" + Day;
							break;
						case "自定义":
							if (!this.handleTime) {
								this.handleTimeValue = "";
							}
							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.handleTimeStart = startTime;
					obj.handleTimeEnd = endTime;
				} else if (command == "自定义") {
					this.$refs.datePicker.pickerVisible = true;
				} else {
					this.$refs.handleTimeShowPopper.hide();
					this.handleTimeValue = "";
					this.handleTime = "";
					obj.handleTimeStart = "";
					obj.handleTimeEnd = "";
				}
				this.establishmentDto = obj;
			},
			planStartTimehandleCommand(command) {
				var obj = JSON.parse(JSON.stringify(this.establishmentDto));
				if (command && command != "自定义") {
					this.planStartTimeValue = command;
					this.$refs.planStartTimeShowPopper.hide();
					const datetime = new Date();
					var startTime, endTime, Year, Month, Day;
					Year = datetime.getFullYear();
					Month = datetime.getMonth() + 1;
					Day = datetime.getDate();
					switch (command) {
						case "近1个月":
							if (Month > 1) {
								startTime = Year + "-" + (Month - 1) + "-1";
							} else {
								startTime = Year - 1 + "-" + (12 + Month - 1) + "-1";
							}
							endTime = Year + "-" + Month + "-" + Day;
							break;
						case "近半年":
							if (Month > 6) {
								startTime = Year + "-" + (Month - 6) + "-1";
							} else {
								startTime = Year - 1 + "-" + (12 + Month - 6) + "-1";
							}
							endTime = Year + "-" + Month + "-" + Day;
							break;
						case "近1年":
							startTime = Year - 1 + "-" + Month + "-" + Day;
							endTime = Year + "-" + Month + "-" + Day;
							break;
						case "近3年":
							startTime = Year - 3 + "-" + Month + "-" + Day;
							endTime = Year + "-" + Month + "-" + Day;
							break;
						case "自定义":
							if (!this.planStartTime) {
								this.planStartTimeValue = "";
							}
							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.planStartTimeStart = startTime;
					obj.planStartTimeEnd = endTime;
				} else if (command == "自定义") {
					this.$refs.datePicker1.pickerVisible = true;
				} else {
					this.$refs.planStartTimeShowPopper.hide();
					this.planStartTimeValue = "";
					this.planStartTime = "";
					obj.planStartTimeStart = "";
					obj.planStartTimeEnd = "";
				}
				this.establishmentDto = obj;
			},
			planEndTimehandleCommand(command) {
				var obj = JSON.parse(JSON.stringify(this.establishmentDto));
				if (command && command != "自定义") {
					this.planEndTimeValue = command;
					this.$refs.planEndTimeShowPopper.hide();
					const datetime = new Date();
					var startTime, endTime, Year, Month, Day;
					Year = datetime.getFullYear();
					Month = datetime.getMonth() + 1;
					Day = datetime.getDate();
					switch (command) {
						case "近1个月":
							if (Month > 1) {
								startTime = Year + "-" + (Month - 1) + "-1";
							} else {
								startTime = Year - 1 + "-" + (12 + Month - 1) + "-1";
							}
							endTime = Year + "-" + Month + "-" + Day;
							break;
						case "近半年":
							if (Month > 6) {
								startTime = Year + "-" + (Month - 6) + "-1";
							} else {
								startTime = Year - 1 + "-" + (12 + Month - 6) + "-1";
							}
							endTime = Year + "-" + Month + "-" + Day;
							break;
						case "近1年":
							startTime = Year - 1 + "-" + Month + "-" + Day;
							endTime = Year + "-" + Month + "-" + Day;
							break;
						case "近3年":
							startTime = Year - 3 + "-" + Month + "-" + Day;
							endTime = Year + "-" + Month + "-" + Day;
							break;
						case "自定义":
							if (!this.planEndTime) {
								this.planEndTimeValue = "";
							}
							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.planEndTimeStart = startTime;
					obj.planEndTimeEnd = endTime;
				} else if (command == "自定义") {
					this.$refs.datePicker2.pickerVisible = true;
				} else {
					this.$refs.planEndTimeShowPopper.hide();
					this.planEndTimeValue = "";
					this.planEndTime = "";
					obj.planEndTimeStart = "";
					obj.planEndTimeEnd = "";
				}
				this.establishmentDto = obj;
			},
			changeHandleTime() {
				if (this.handleTime) {
					this.handleTimeValue = "自定义";
					var obj = JSON.parse(JSON.stringify(this.establishmentDto));
					obj.handleTimeStart = this.handleTime[0];
					obj.handleTimeEnd = this.handleTime[1];
					this.establishmentDto = obj;
				}
			},
			changePlanStartTime() {
				if (this.planStartTime) {
					this.planStartTimeValue = "自定义";
					var obj = JSON.parse(JSON.stringify(this.establishmentDto));
					obj.planStartTimeStart = this.planStartTime[0];
					obj.planStartTimeEnd = this.planStartTime[1];
					this.establishmentDto = obj;
				}
			},
			changePlanEndTime() {
				if (this.planEndTime) {
					this.planEndTimeValue = "自定义";
					var obj = JSON.parse(JSON.stringify(this.establishmentDto));
					obj.planEndTimeStart = this.planEndTime[0];
					obj.planEndTimeEnd = this.planEndTime[1];
					this.establishmentDto = 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;
			},
			hidePoper() {
				if (this.$refs.datePicker) {
					this.$refs.datePicker.pickerVisible = false;
				}
			},
			mouseenter() {
				this.handleTimeShowPopper = true;
				if (this.handleTimeValue == "自定义") {
					this.$nextTick(() => {
						this.$refs.datePicker.pickerVisible = true;
					});
				}
			},
			hidePoper1() {
				if (this.$refs.datePicker1) {
					this.$refs.datePicker1.pickerVisible = false;
				}
			},
			mouseenter1() {
				this.planStartTimeShowPopper = true;
				if (this.planStartTimeValue == "自定义") {
					this.$nextTick(() => {
						this.$refs.datePicker1.pickerVisible = true;
					});
				}
			},
			hidePoper2() {
				if (this.$refs.datePicker2) {
					this.$refs.datePicker2.pickerVisible = false;
				}
			},
			mouseenter2() {
				this.planEndTimeShowPopper = true;
				if (this.planEndTimeValue == "自定义") {
					this.$nextTick(() => {
						this.$refs.datePicker2.pickerVisible = true;
					});
				}
			},
			
			clearHandleTime() {
				this.handleTime = "";
				this.handleTimeValue = "";
				var obj = JSON.parse(JSON.stringify(this.establishmentDto));
				obj.handleTimeStart = "";
				obj.handleTimeEnd = "";
				this.establishmentDto = obj;
			},
			clearPlanStartTime() {
				this.planStartTime = "";
				this.planStartTimeValue = "";
				var obj = JSON.parse(JSON.stringify(this.establishmentDto));
				obj.planStartTimeStart = "";
				obj.planStartTimeEnd = "";
				this.establishmentDto = obj;
			},
			clearPlanEndTime() {
				this.planEndTime = "";
				this.planEndTimeValue = "";
				var obj = JSON.parse(JSON.stringify(this.establishmentDto));
				obj.planEndTimeStart = "";
				obj.planEndTimeEnd = "";
				this.establishmentDto = obj;
			},
			reset() {
				Object.assign(this.$data, this.$options.data.call(this)); //重置data
				this.init();
			},
			init() {
				this.search();
				this.addressListfn();
				this.searchDic();

			},
			ckhasValue(param){
				 var ckhasValue;
				 if(param){
					ckhasValue=this.hasValueThroughObj(0,param);
				 }else{
					ckhasValue=false;
				 }
				 return ckhasValue;
			 },
			 hasValueThroughObj(times,param,excludeKeys,excludeValues){
			
				   if(times==0){
				            this.hasValue=false;
				        }
				        var excludeKeys=['yitihuaSource'];
				        var excludeValues=['and','or','{}','[]','','null','undefined'];
				      　if(Array.isArray(param)){
				            for(let i=0;i<param.length;i++){
				                var objParam = param[i];
				                Object.keys(objParam).map(key => {
				                    if(Array.isArray(objParam[key])||objParam[key] instanceof Object){
				                        this.hasValueThroughObj(1,objParam[key],excludeKeys,excludeValues);
				                    }else{
				                        if(objParam instanceof Object) {
				                            if (!excludeKeys.includes(key)&&!excludeValues.includes(objParam[key])) {
			
				                                this.hasValue =true;
				                                // return hasValue;
				                            }
				                        }
				                    }
				              })
				            }
				      　}else{
				      　    if(param instanceof Object) {
				               Object.keys(param).map(key => {
				                    if(Array.isArray(param[key])||param[key] instanceof Object){
				                        this.hasValueThroughObj(1,param[key],excludeKeys,excludeValues);
				                    }else{
				                        if (!excludeKeys.includes(key)&&!excludeValues.includes(param[key])) {
			
				                           this.hasValue =true;
				                            // return hasValue;
				                        }
				                    }
				                })
				            }
				        }
				        return this.hasValue;
			},
		},
	};
</script>

<style lang="scss" scoped>
	
	.content{
	  padding: 0px 16px;
	  border-radius: 4px 4px 4px 4px;
	   background: #FFFFFF;
	   .content_item{
		   padding-top: 12px;
		   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;
				}
			}
			
		}
		.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: 12px;
				.list-label{
					background: #F3F3FF;
					color: #8491E8;
					border-radius: 1px 1px 1px 1px;
				
					padding: 3px 7px;
					font-size: 12px;
					
				}
				.list-label-wl{
					background: #e8f7f0;
					color: #38c8bf;
					
				}
				.list-label-lx{
					background: #e4f3fd;
					color: #41a1fd;
				}
			}
			
			
			.list-content{
				margin-top: 8px;
				display: flex;
				justify-content: start;
				align-items: center;
				
				.list-content-text{
					margin-top: 7px;
					display: flex;
					justify-content: start;
					align-items: center;
					margin-right: 27px;
					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: 12px;
				.list-content-text{
					margin-top: 0px;
					span{
						line-height: 30px!important;
					}
				}
				img{
					width: 14px;
					margin: 0  8px;
					
				}
			}
			
			
		}
		.bottomlist-list:hover{
			background: #F6F9FC;
			cursor: pointer;
		}
		.pagination{
			padding: 14px ;
		   .el-pagination{
			   float: right;
		   }
		}
	}
	
	
</style>