export function yjbzPopup(type, data) {
	console.log(data)
	let html,
		rice,
		wheat,
		oil,
		other = 0
	let emergencyLevel = ''
	// 样式
	const popupCss = `style ="width: 630px;opacity: 0.8;"`
	const titleCss = `style ="font-size: 18px;padding: 15px 10px;font-weight: bold;color: #fff;
					margin-bottom:15px;background: #1970D2;"`
	const liCss = `style ="width:50%;float: left;color: #fff;font-size: 16px;list-style: none;"`
	const lasttLiCss = `style ="width:100%;float: left;color: #fff;font-size: 16px;list-style: none;"`
	const labelCss = `style ="float: left;width: 120px;display: block;line-height: 28px;
							text-align: right;font-weight: bold;"`
	const tdthCss = `style ="width: 20%;line-height: 32px;text-align: center;font-size: 16px;
						color: #fff;border: 1px solid #dcdfe6;"`
	const valueCss = `style="float: left;display: block;line-height: 28px;width:180px;overflow: hidden;
	white-space: pre-wrap; "`
	const typeCss = `style="line-height: 28px;display: inline-block;width:100%;margin-left:60px "`

	// 应急级别
	if (data.isNational) {
		emergencyLevel = '国家级、'
	} else if (data.isProvincial) {
		emergencyLevel = emergencyLevel + '省级、'
	} else if (data.isCity) {
		emergencyLevel = emergencyLevel + '市级、'
	} else if (data.isCounty) {
		emergencyLevel = emergencyLevel + '县级'
	}
	emergencyLevel =
		emergencyLevel.substring(emergencyLevel.length - 1) == '、'
			? emergencyLevel.substring(0, emergencyLevel.length - 1)
			: emergencyLevel
	//  大米 小麦
	if (data.esNetworkEntryGrainList) {
		data.esNetworkEntryGrainList.map((item) => {
			console.log(item.grainVariety)
			if (item.grainVariety == '1') {
				wheat = item.quantity
			} else if (item.grainVariety == '2') {
				rice = item.quantity
			} else if (item.grainVariety == '3') {
				oil = item.quantity
			} else {
				other = item.quantity
			}
		})
	}
	// type = 2
	if (type == '1') {
		html = `<div ${popupCss}>
				<div ${titleCss}>${data.enterpriseName}供应网点</div>
				<div style="padding:10px 15px">
					<ul style="overflow: hidden">
						<li ${liCss}>
							<span ${labelCss}>网点地址：</span><span ${valueCss}>${data.actualBusinessAddress}</span></li>
						<li ${liCss}><span ${labelCss}>所属地区：</span><span ${valueCss}>${data.cityState}</span></li>
						<li ${liCss}><span ${labelCss}>负责人：</span><span ${valueCss}>${data.contactPerson}</span></li>
						<li ${liCss}><span ${labelCss}>联系电话：</span><span ${valueCss}>${data.contactNumber}</span></li>
						<li ${liCss}><span ${labelCss}>经度：</span><span ${valueCss}>${data.longitude}</span></li>
						<li ${liCss}><span ${labelCss}>纬度：</span><span ${valueCss}>${data.latitude}</span></li>
					</ul>
					<table style="width: 100%">
						<tr>
							<th ${tdthCss}>品种</th>
							<th ${tdthCss}>小麦粉成品粮</th>
							<th ${tdthCss}>大米成品粮</th>
							<th ${tdthCss}>食用油成品粮</th>
							<th ${tdthCss}>其他成品粮</th>
						</tr>
						<tr>
							<th ${tdthCss}>数量（吨）</th>
							<td ${tdthCss}>${wheat}</td>
							<td ${tdthCss}>${rice}</td>
							<td ${tdthCss}>${oil}</td>
							<td ${tdthCss}>${other}</td>
						</tr>
					</table>
				</div>
			</div>`
	} else if (type == '2') {
		html = `<div ${popupCss}>
					<div ${titleCss}>${data.enterpriseName}应急加工企业</div>
					<div style="padding:10px 15px">
						<ul style="overflow: hidden">
							<li ${liCss}>
								<span ${labelCss}>企业地址：</span><span ${valueCss}>${data.actualBusinessAddress}</span></li>
							<li ${liCss}><span ${labelCss}>所属地区：</span><span ${valueCss}>${data.cityState}</span></li>
							<li ${liCss}><span ${labelCss}>联系电话：</span><span ${valueCss}>${data.contactNumber}</span></li>
							<li ${liCss}><span ${labelCss}>应急级别：</span><span ${valueCss}>${emergencyLevel}</span></li>
							<li ${liCss}><span ${labelCss}>经度：</span><span ${valueCss}>${data.longitude}</span></li>
							<li ${liCss}><span ${labelCss}>纬度：</span><span ${valueCss}>${data.latitude}</span></li>
							<li ${lasttLiCss}>
							<span ${labelCss}>加工能力：</span>
							<span ${typeCss}>小麦日加工量(吨)：${data.processData.wheatQuantity}</span>
							<span ${typeCss}>稻谷日加工量(吨)：${data.processData.riceQuantity}</span>
							<span ${typeCss}>油料处理日产量(吨)：${data.processData.oilQuantity}</span>
							</ul>
					</div>
				</div>`
	} else if (type == '3') {
		html = `<div ${popupCss}>
			<div ${titleCss}>${data.enterpriseName}应急配送企业</div>
			<div style="padding:10px 15px">
				<ul style="overflow: hidden">
					<li ${liCss}>
						<span ${labelCss}>企业地址：</span><span ${valueCss}>${data.actualBusinessAddress}</span></li>
					<li ${liCss}><span ${labelCss}>所属地区：</span><span ${valueCss}>${data.cityState}</span></li>
					<li ${liCss}><span ${labelCss}>联系电话：</span><span ${valueCss}>${data.contactNumber}</span></li>
					<li ${liCss}><span ${labelCss}>应急级别：</span><span ${valueCss}>${emergencyLevel}</span></li>
					<li ${liCss}><span ${labelCss}>日运输能力：</span><span ${valueCss}>${data.ownVehiclesDailyDeliveryCapacity}</span></li>
					<li ${liCss}><span ${labelCss}>运送车辆数量：</span><span ${valueCss}>${data.ownTransportVehicles}</span></li>
					<li ${liCss}><span ${labelCss}>辐射范围：</span><span ${valueCss}>${data.radiationRange}</span></li>
					<li ${liCss}><span ${labelCss}>经度：</span><span ${valueCss}>${data.longitude}</span></li>
					<li ${liCss}><span ${labelCss}>纬度：</span><span ${valueCss}>${data.latitude}</span></li>
					</ul>
			</div>
		</div>`
	} else {
		html = `<div ${popupCss}>
			<div ${titleCss}>${data.enterpriseName}应急仓储企业</div>
			<div style="padding:10px 15px">
				<ul style="overflow: hidden">
					<li ${liCss}>
						<span ${labelCss}>网点地址：</span><span ${valueCss}>${data.actualBusinessAddress}</span></li>
					<li ${liCss}><span ${labelCss}>所属地区：</span><span ${valueCss}>${data.cityState}</span></li>
					<li ${liCss}><span ${labelCss}>负责人：</span><span ${valueCss}>${data.contactPerson}</span></li>
					<li ${liCss}><span ${labelCss}>联系电话：</span><span ${valueCss}>${data.contactNumber}</span></li>
					<li ${liCss}><span ${labelCss}>经度：</span><span ${valueCss}>${data.longitude}</span></li>
					<li ${liCss}><span ${labelCss}>纬度：</span><span ${valueCss}>${data.latitude}</span></li>
				</ul>
				<table style="width: 100%">
					<tr>
						<th ${tdthCss}>品种（日库存）</th>
						<th ${tdthCss}>小麦原粮</th>
						<th ${tdthCss}>大米成品粮</th>
						<th ${tdthCss}>食用油成品粮</th>
						<th ${tdthCss}>其他原粮</th>
					</tr>
					<tr>
						<th ${tdthCss}>数量（吨）</th>
						<td ${tdthCss}>${wheat}</td>
						<td ${tdthCss}>${rice}</td>
						<td ${tdthCss}>${oil}</td>
						<td ${tdthCss}>${other}</td>
					</tr>
				</table>
			</div>
		</div>`
	}
	return html
}
