2025-06-27 10:04:22 +08:00

2786 lines
115 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0, user-scalable=0">
<title></title>
<script src="./lib/jquery/dist/jquery.js"></script>
<script src="./lib/vuejs/vue.js"></script>
<script src="./lib/echarts5temp/composition-api1.0.0-rc.js"></script>
<script src="./lib/echarts5temp/echarts5.0.2.js"></script>
<!--<script src="../lib/echarts5temp/vue-echarts6.0.0-beta.js"></script>-->
<script src="./lib/vuejs/axios.min.js"></script>
<script src="./lib/elementui/index.js"></script>
<script src="./lib/linq.js/Content/Scripts/linq.min.js"></script>
<link href="./lib/elementui/index.css" rel="stylesheet" />
</head>
<body>
<div id="app" style="background-color:#013954">
<el-container v-loading="loading" v-loading.fullscreen.lock="true" :element-loading-text="showLoadingTip"
element-loading-spinner="el-icon-loading" element-loading-background="#013954">
<el-header style="margin-top: 30px;">
<el-tooltip class="item" effect="dark" content="恢复搜索栏" placement="bottom-start">
<el-button icon="el-icon-delete" circle @click="nullFunction" tooltip="rrrrr"></el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="精准搜索" placement="bottom-start">
<el-button icon="el-icon-search" circle @click="drawer = true"></el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="自由组合搜索" placement="bottom-start">
<el-button icon="el-icon-pie-chart" circle @click="free = true"></el-button>
</el-tooltip>
<el-drawer title="组合查询" :visible.sync="drawer" :direction="direction" :before-close="handleClose"
size="80%">
<div>
<!--组合查询设计,浅笑写代码的地方...-->
<el-form :inline="true" class="demo-form-inline">
<el-form-item label="检测项目">
<el-select v-model="jcxm_value" size="mini" filterable multiple placeholder="请选择检测项目">
<el-option v-for="item in options" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="监测环节">
<el-select v-model="jchj_value" size="mini" filterable multiple placeholder="请选择监测环节">
<el-option v-for="item in options2" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="食品大类">
<el-select v-model="spdl_value" size="mini" filterable multiple placeholder="请选择食品大类"
@change="search2(1)">
<el-option v-for="item in options3" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="食品亚类">
<el-select v-model="spyl_value" size="mini" filterable multiple placeholder="请选择食品亚类"
@change="search2(2)">
<el-option v-for="item in options4" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="食品品种">
<el-select v-model="sppz_value" size="mini" filterable multiple placeholder="请选择食品品种"
@change="search2(3)">
<el-option v-for="item in options5" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="食品细类">
<el-select v-model="spxl_value" size="mini" filterable multiple placeholder="请选择食品细类">
<el-option v-for="item in options6" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="是否进口">
<el-select v-model="sfjk_value" size="mini" filterable multiple placeholder="请选择是否进口">
<el-option v-for="item in options7" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="检验大类">
<el-select v-model="jydl_value" size="mini" filterable multiple placeholder="请选择检验大类">
<el-option v-for="item in options8" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="任务来源">
<el-select v-model="rwly_value" size="mini" filterable multiple placeholder="请选择任务来源">
<el-option v-for="item in options9" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
<!--这块写入相关的选择框-->
<el-divider></el-divider>
<el-form ref="multisearch" :model="multisearch" label-width="150px" b>
<el-form-item label="合并年份计算">
<el-switch v-model="multisearch.isYearSum"></el-switch>
</el-form-item>
<!-- <el-form-item label="合并区域计算">
<el-switch v-model="multisearch.isAreaSum"></el-switch>
</el-form-item>
<el-form-item label="区域选择">
<el-checkbox-group v-model="multisearch.areas">
<el-checkbox v-for="item in selArea" :label="item"></el-checkbox>
</el-checkbox-group>
</el-form-item> -->
<el-form-item label="年份选择">
<el-checkbox-group v-model="multisearch.years">
<el-checkbox v-for="item in selYear" :label="item"></el-checkbox>
</el-checkbox-group>
<el-checkbox v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
</el-form-item>
</el-form>
<el-divider></el-divider>
<el-button
style="width: 100px;display: block;margin-left: auto;margin-right: auto;margin-top: 50px;margin-bottom: 20px;"
@click="search(0)">查询</el-button>
</div>
</el-drawer>
<el-drawer title="组合查询" :visible.sync="free" :direction="direction" :before-close="handleClose"
size="80%">
<div>
<!--组合查询设计,浅笑写代码的地方...-->
<el-form :inline="true" class="demo-form-inline">
<div class="demo-input-suffix" style="margin-left: 25%;">
<el-select v-model="ruleForm.leibie" placeholder="请选择类别">
<el-option v-for="(item,index) in Myjson" :key="index" :label="item.mytext"
:value="item.mytext" />
</el-select>
<el-select style="width: 150px;" v-model="ruleForm.tiaojian" placeholder="请选择条件">
<el-option v-for="(item,index) in Myjson1" :key="index" :label="item.mytext"
:value="item.mytext" />
</el-select>
<el-input style="width: 200px;" v-model="ruleForm.neirong" placeholder="请输入内容"
clearable></el-input>
<el-button plain @click="btnFuntion('and')">and</el-button>
<el-button plain @click="btnFuntion('or')">or</el-button>
<el-button plain @click="kuoHaoFuntion('(')">(</el-button>
<el-button plain @click="kuoHaoFuntion(')')">)</el-button>
</div>
<div>
<el-table :data="ruleData" style="width: 70%;margin: 50px; margin-left: 15%;">
<el-table-column prop="leibie" label="类别">
</el-table-column>
<el-table-column prop="tiaojian" label="条件">
</el-table-column>
<el-table-column prop="neirong" label="内容">
</el-table-column>
<el-table-column prop="fangshi" label="方式">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button @click="deleteFunction(scope.row)" type="text" size="small">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-form>
<el-button
style="width: 100px; display: block; margin-left: auto; margin-right: auto; margin-top: 50px; margin-bottom:20px;"
@click="search(1)">查询</el-button>
</div>
</el-drawer>
<el-radio-group v-model="radioModel" size="medium" @change="selectModel">
<el-radio-button label="项次数"></el-radio-button>
<el-radio-button label="项次数不合格率"></el-radio-button>
<el-radio-button label="件数"></el-radio-button>
<el-radio-button label="件数不合格率"></el-radio-button>
<!-- <el-radio-button label="覆盖率"></el-radio-button> -->
<el-radio-button label="生产企业"></el-radio-button>
<el-radio-button label="平均值"></el-radio-button>
<!-- <el-radio-button label="流向"></el-radio-button> -->
</el-radio-group>
</el-header>
<el-main>
<!--左边显示的详细情况按钮-->
<el-popover placement="right" width="400" trigger="click">
<div v-if="PopDestShow==0">
<!--自由搜索开始块-->
<div style="width:400px">
<span>暂无查询条件设置</span>
</div>
</div>
<div v-if="PopDestShow==1">
<!--精确搜索开始块-->
<div style="width:400px;">
<span v-if="jcxm_value!=''">检测项目:{{jcxm_value}}</span>
</div>
<div style="width:400px;">
<span v-if="jchj_value!=''">监测环节:{{jchj_value}}</span>
</div>
<div style="width:400px;">
<span v-if="spdl_value!=''">食品大类:{{spdl_value}}</span>
</div>
<div style="width:400px;">
<span v-if="spyl_value!=''">食品亚类:{{spyl_value}}</span>
</div>
<div style="width:400px;">
<span v-if="sppz_value!=''">食品品种:{{sppz_value}}</span>
</div>
<div style="width:400px;">
<span v-if="spxl_value!=''">食品细类:{{spxl_value}}</span>
</div>
<div style="width:400px;">
<span v-if="sfjk_value!=''">是否进口:{{sfjk_value}}</span>
</div>
<div style="width:400px;">
<span v-if="jydl_value!=''">检验大类:{{jydl_value}}</span>
</div>
<div style="width:400px;">
<span v-if="rwly_value!=''">任务来源:{{rwly_value}}</span>
</div>
<div style="width:400px;">
<span v-if="multisearch.isYearSum">年份:{{multisearch.years}}</span>
</div>
</div> <!--精确搜索结束块-->
<div v-if="PopDestShow==2">
<!--自由搜索开始块-->
<div style="width:400px">
<span>自由查询:</span>
<!-- {{ruleData}} -->
<el-table :data="ruleData"
height="250"
border
style="width: 400px">
<el-table-column prop="leibie"
label="类别">
</el-table-column>
<el-table-column prop="tiaojian"
label="条件">
</el-table-column>
<el-table-column prop="neirong"
label="内容">
</el-table-column>
<el-table-column prop="fangshi"
label="方式">
</el-table-column>
</el-table>
</div>
</div> <!--精确搜索结束块-->
<el-button slot="reference" icon="el-icon-arrow-right" circle
style="position:absolute;top:50%;z-index:2"></el-button>
</el-popover>
<div style="z-index: 255; position: absolute; margin-top: 40px; margin-left: 80%;">
<el-button round @click="paiXuFunction">排序</el-button>
</div>
<div id="main" v-show="mapShow==true" style="width: 100%;height:700px;">
</div>
</el-main>
</el-container>
</div>
</body>
</html>
<style>
.el-drawer__body {
overflow-y: scroll;
}
</style>
<script>
///////////////////////////////////////////////////
//该部分是Vue应用封装
var app = new Vue({
el: '#app',
data() {
return {
//geoJsonScatter: {}, //
//geoCoordMapScatter: {}, //地理位置信息
//displayDataScatter:[], //地理位置显示数据
mapShow: true,
mapShow2: true,
multisearch: {
years: ['2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020', '2021'],
areas: ["阿根廷",
"埃及",
"爱尔兰",
"奥地利",
"澳大利亚",
"澳门",
"巴西",
"保加利亚",
"比利时",
"波兰",
"丹麦",
"德国",
"俄罗斯",
"厄瓜多尔",
"法国",
"菲律宾",
"斐济共和国",
"芬兰",
"哥伦比亚",
"哥斯达黎加",
"韩国",
"荷兰",
"加拿大",
"克罗地亚",
"马来西亚",
"美国",
"秘鲁",
"缅甸",
"墨西哥",
"南非",
"挪威",
"葡萄牙",
"其它地区",
"日本",
"瑞典",
"瑞士",
"斯里兰卡",
"台湾",
"泰国",
"土耳其",
"乌克兰",
"西班牙",
"希腊",
"香港",
"新加坡",
"新西兰",
"匈牙利",
"牙买加",
"以色列",
"意大利",
"印度",
"印度尼西亚",
"越南",
"智利",
"中国",
"中国台湾",
"中国香港"],
isYearSum: false,
isAreaSum: false
},
selYear: ['2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020', '2021'],
selArea: ["阿根廷",
"埃及",
"爱尔兰",
"奥地利",
"澳大利亚",
"澳门",
"巴西",
"保加利亚",
"比利时",
"波兰",
"丹麦",
"德国",
"俄罗斯",
"厄瓜多尔",
"法国",
"菲律宾",
"斐济共和国",
"芬兰",
"哥伦比亚",
"哥斯达黎加",
"韩国",
"荷兰",
"加拿大",
"克罗地亚",
"马来西亚",
"美国",
"秘鲁",
"缅甸",
"墨西哥",
"南非",
"挪威",
"葡萄牙",
"其它地区",
"日本",
"瑞典",
"瑞士",
"斯里兰卡",
"台湾",
"泰国",
"土耳其",
"乌克兰",
"西班牙",
"希腊",
"香港",
"新加坡",
"新西兰",
"匈牙利",
"牙买加",
"以色列",
"意大利",
"印度",
"印度尼西亚",
"越南",
"智利",
"中国",
"中国台湾",
"中国香港"],
//全选
checkAll: true,
//组合查询显示关闭
drawer: false,
//自由查询显示关闭
free: false,
//弹出界面的方向设定
direction: 'ttb',
radioModel: "项次数",
options: [],//监测项目
jcxm_value: '',
options2: [],//监测环节
jchj_value: '',
options3: [],//食品大类
spdl_value: '',
options4: [],//食品亚类
spyl_value: '',
options5: [],//食品品种
sppz_value: '',
options6: [],//食品细类
spxl_value: '',
str_num: 0,//判断食品等级 大类1 亚类2 品种3 细类4
options7: [
{
label: "是",
value: "是"
},
{
label: "否",
value: "否"
},
],//是否进口
sfjk_value: '',
options8: [],//检验大类
jydl_value: '',
options9: [],//任务来源
rwly_value: '',
//mapData1: [],
num: 0, //动态判断主搜索模块
numBer: 1000,
loading: true,
condition: '',
//showMapTip: ' 食品实时监管统计数据展示',
showLoadingTip: '正在进行海量实时数据计算,大约需要30秒钟,请等待...',
Myjson:
[
{ "mytext": "年份", "PY": "RWNF" },
{ "mytext": "抽样单编号", "PY": "CYDBH" },
{ "mytext": "任务编号", "PY": "RWBH" },
{ "mytext": "流水号", "PY": "LSH" },
{ "mytext": "任务来源", "PY": "RWLY" },
{ "mytext": "任务类型", "PY": "RWLX" },
{ "mytext": "任务性质", "PY": "RWXZ" },
{ "mytext": "被抽样人信息(名称)", "PY": "BCYRMC" },
{ "mytext": "执行年月", "PY": "ZXNY" },
//-----------新食品分类----------------------------
{ "mytext": "食品大类", "PY": "SP_DL" },
{ "mytext": "食品亚类", "PY": "SP_YL" },
{ "mytext": "食品品种", "PY": "SP_PZ" },
{ "mytext": "食品细类", "PY": "SP_XL" },
//-------------------------------------------------
//-----------原食品分类----------------------------
{ "mytext": "原食品分类", "PY": "OldYPFL" },
//-------------------------------------------------------
{ "mytext": "区域类型", "PY": "QYLX" },
{ "mytext": "地址(市)", "PY": "DZ_S" },
{ "mytext": "地址(区(县))", "PY": "DZ_QX" },
{ "mytext": "地址(街道(镇)", "PY": "DZ_Z" },
{ "mytext": "地址(弄)", "PY": "DZ_N" },
{ "mytext": "地址(号)", "PY": "DZ_H" },
{ "mytext": "地址(室)", "PY": "DZ_S1" },
{ "mytext": "连贯地址", "PY": "BCYDWMC" },
{ "mytext": "法人代表", "PY": "FRDB" },
{ "mytext": "年销售额", "PY": "NXSE" },
{ "mytext": "营业执照号", "PY": "YYZZH" },
{ "mytext": "联系人", "PY": "LXR1" },
{ "mytext": "经营许可证", "PY": "JYXKZ" },
{ "mytext": "电话", "PY": "DH1" },
{ "mytext": "传真", "PY": "CZ" },
{ "mytext": "邮编", "PY": "YX" },
{ "mytext": "抽样地点", "PY": "CYDD" },
{ "mytext": "抽样地点类型", "PY": "CYDDLX" },
{ "mytext": "样品来源", "PY": "YPLY" },
{ "mytext": "样品属性", "PY": "YPSX" },
{ "mytext": "样品类型", "PY": "YPLX" },
{ "mytext": "样品名称", "PY": "YPMC" },
{ "mytext": "商标", "PY": "SB" },
{ "mytext": "生产/ 加工\n购进日期", "PY": "SCJGGJRQ" },
{ "mytext": "规格型号", "PY": "GGXH" },
{ "mytext": "样品批号", "PY": "YPPH" },
{ "mytext": "保质期", "PY": "BZQ" },
{ "mytext": "执行标准/技术文件", "PY": "ZXBZ" },
{ "mytext": "质量等级", "PY": "ZLDJ" },
{ "mytext": "生产许可证编号", "PY": "SCXKZBH" },
{ "mytext": "单价", "PY": "DJ" },
{ "mytext": "是否出口", "PY": "SFCK" },
{ "mytext": "抽样基数/批量", "PY": "CYJS" },
{ "mytext": "抽样数量(含备样)", "PY": "CYSL" },
{ "mytext": "备样数量", "PY": "BYSL" },
{ "mytext": "样品形态", "PY": "YPXT" },
{ "mytext": "包装分类", "PY": "BZFL" },
{ "mytext": "生产者名称", "PY": "SCZMC" },
{ "mytext": "生产者地址_省", "PY": "SCZDZ_S" },
{ "mytext": "生产者地址_市", "PY": "SCZDZ_s" },
{ "mytext": "生产者地址_区县", "PY": "SCZDZ_Q" },
{ "mytext": "生产者地址", "PY": "SCZDZ" },
{ "mytext": "联系电话", "PY": "LXDH" },
{ "mytext": "(标称)样品储存条件", "PY": "YPCCTJ" },
{ "mytext": "寄、送样品截止日期", "PY": "YPJZRQ" },
{ "mytext": "寄送样品地址", "PY": "JSYPDZ" },
{ "mytext": "抽样样品包装", "PY": "CYYPBZ" },
{ "mytext": "抽样方式", "PY": "CYFS" },
{ "mytext": "抽样单位信息(单位名称)", "PY": "CYDWMC" },
{ "mytext": "抽样单位信息(地址)", "PY": "CYDWDZ" },
{ "mytext": "抽样单位信息(联系人)", "PY": "CYDWLXR" },
{ "mytext": "抽样单位信息(电话)", "PY": "CYDWDH" },
{ "mytext": "抽样单位信息(传真)", "PY": "CYDWCZ" },
{ "mytext": "抽样单位信息(邮编)", "PY": "CYDWYB" },
//{ "mytext": "备注", "PY": "QT" },
{ "mytext": "被抽样单位签名", "PY": "BCYDWQM" },
{ "mytext": "被抽样单位签名时间", "PY": "BCYDWSJ" },
{ "mytext": "抽样人", "PY": "CYRQM" },
{ "mytext": "抽样单位", "PY": "CYDW" },
{ "mytext": "抽样人签名时间", "PY": "CYSJ" },
{ "mytext": "检测机构", "PY": "JCDW" },
{ "type": 0, "mytext": "----以下样品检验信息----", "PY": "1" },
{ "type": 2, "mytext": "检测大类", "PY": "JCDL" },
{ "type": 2, "mytext": "检测亚类", "PY": "JCYL" },
{ "type": 2, "mytext": "检测小类", "PY": "JCXL" },
{ "type": 2, "mytext": "检测项目", "PY": "JCXM" },
{ "type": 2, "mytext": "检测标准", "PY": "JCBZ" },
{ "type": 2, "mytext": "评价标准", "PY": "PJBZ" },
{ "type": 2, "mytext": "检测方法", "PY": "JCFF" },
{ "type": 2, "mytext": "方法名称", "PY": "JCMC" },
{ "type": 2, "mytext": "定性值", "PY": "ffjcx" },
{ "type": 2, "mytext": "定性值单位", "PY": "ffjcxDW" },
{ "type": 2, "mytext": "定量值", "PY": "ffdlx" },
{ "type": 2, "mytext": "定量值单位", "PY": "ffdlxDW" },
{ "type": 2, "mytext": "限量值", "PY": "bzz" },
{ "type": 2, "mytext": "限量值单位", "PY": "xlzDW" },
{ "type": 2, "mytext": "检测值", "PY": "jcz" },
{ "type": 2, "mytext": "检测值单位", "PY": "jczDW" },
{ "type": 2, "mytext": "单项判定", "PY": "Yzhen" },
{ "type": 2, "mytext": "备注", "PY": "QT" },
{ "type": 0, "mytext": "----以下样品检验结果信息----", "PY": "1" },
{ "type": 2, "mytext": "检测结果", "PY": "JieGuo" },
{ "type": 2, "mytext": "是否进口", "PY": "SFJK" },
{ "type": 2, "mytext": "原产地", "PY": "YCD" },
{ "type": 2, "mytext": "网络平台名称", "PY": "WLPTMC" },
{ "type": 2, "mytext": "检验机构简称", "PY": "JYJGJC" },
]
,//条件查询内容
Myjson1: [
{ "mytext": "等于" },
{ "mytext": "不等于" },
{ "mytext": "包含" },
{ "mytext": "不包含" },
{ "mytext": "大于" },
{ "mytext": "小于" },
{ "mytext": "大于等于" },
{ "mytext": "小于等于" },
]
,//条件查询判断
ruleForm: {
leibie: '',
tiaojian: '',
neirong: '',
fangshi: '',
},
//条件查询数组
ruleData: [],
//显示查询弹出气泡的内容
PopDestShow: 0,
}
},
mounted() {
var _this = this; //this指向vue
Vue.prototype.$loading = this.loading
let sendArr = [
axios.get('./home/GetDistinctJCXM'),
axios.get('./home/GetDistinctJCHJ'),
axios.get('./home/GetDistinctSPDL'),
axios.get('./home/GetDistinctSPYL?str='),
axios.get('./home/GetDistinctSPPZ?str='),
axios.get('./home/GetDistinctSPXL?str='),
axios.get('./home/GetDistinctJYDL'),
axios.get('./home/GetDistinctRWLY'),
axios.get('../map/map/global.json'),
//axios.get("../data/year.json"),
// axios.get("../map/geoCoordMapjson2020_1.json"),
// axios.get("../map/datajson2020_1.json")
]
// , resScattergeoCoordMap, resScatterdisplayData
axios.all(sendArr).then(axios.spread(function (res1, res2, res3, res4, res5, res6, res8, res9, resGeo) {
//浅笑写的下来菜单的内容,重新封装
_this.putSearchData(_this.options, res1);
_this.putSearchData(_this.options2, res2);
_this.putSearchData(_this.options3, res3);
_this.putSearchData(_this.options4, res4);
_this.putSearchData(_this.options5, res5);
_this.putSearchData(_this.options6, res6);
_this.putSearchData(_this.options8, res8);
_this.putSearchData(_this.options9, res9);
//从后台读取预先设定的上海地图
geoJson = resGeo.data
//从后台读取年份列表
//year = resYear.data
//散点图叠加部分的参数
// geoCoordMapScatter2 = resScattergeoCoordMap.data
// displayDataScatter2 = resScatterdisplayData.data
//默认启动的显示内容
_this.getXiangCiShu();
showMapTip = "项次数"
}));
//window.getBCYDWMCfunction = this.getBCYDWMCfunction;
// let sendArr2 = [
// axios.get('../map/shmapall.json'),
// axios.get('../map/geoCoordMapjson2020_1.json'),
// axios.get('../map/datajson2020_1.json')
// ]
// axios.get('./home/JCZDWjson').then(function (res){
// console.log(res.data);
// });
// axios.all(sendArr2).then(axios.spread(function (res1, res2,res3) {
// _this.geoJsonScatter = res1.data
// _this.geoCoordMapScatter = res2.data
// _this.displayDataScatter = res3.data
// _this.scatterMap()
// }));
},
methods: {
//全选
handleCheckAllChange(val) {
if (this.checkAll) {
this.selYear.forEach(item => {
this.multisearch.years.push(item)
})
} else {
this.multisearch.years = []
}
},
//设置查询框的下来数据通用方法
putSearchData(opt, res) {
for (var i = 0; i < res.data.data.length; i++) {
opt.push({ label: res.data.data[i], value: res.data.data[i] })
}
},
//查询窗体关闭的响应动作
handleClose(done) {
done();
//this.$confirm('确认关闭?')
// .then(_ => {
// done();
// })
// .catch(_ => { });
},
//radio切换的相关设置
selectModel(e) {
this.mapShow = true
this.mapShow2 = false
//将左边的气泡显示为内容提示
this.PopDestShow = 0
switch (e) {
case "项次数":
this.getXiangCiShu()
showMapTip = e
this.num = 0
bigTitle="上海市食品安全风险监测结果统计"
break;
case "项次数不合格率":
this.getXiangCiShuHeGeLv()
showMapTip = e
this.num = 1
numStr = 2;
bigTitle="上海市食品安全风险监测结果统计"
break;
case "件数":
this.getZongJianShu()
showMapTip = e
this.num = 2
bigTitle="上海市食品安全风险监测结果统计"
break;
case "件数不合格率":
this.getZongJianShuHeGeLv()
showMapTip = e
this.num = 3
numStr = 2;
bigTitle="上海市食品安全风险监测结果统计"
break;
case "覆盖率":
this.getFuGaiLv()
showMapTip = "覆盖率(件/千人)"
this.num = 4
numStr = 3;
bigTitle="上海市食品安全风险监测结果统计"
break;
case "平均值":
this.getPingJunZhi()
showMapTip = e
this.num = 5
bigTitle="上海市食品安全风险监测结果统计"
break;
case "生产企业":
// this.mapShow = false
// this.mapShow2 = true
this.num = 6
SahDianTuData = []
//this.getSanDianTuDT();
this.getSanDianTu();
bigTitle="生产企业数量"
break;
case "流向":
// this.mapShow = false
// this.mapShow2 = true
this.num = 7
this.getQuanGuoDiTu();
break;
default:
}
},
//清空查询
nullFunction() {
var _this = this; //this指向vue
_this.loading = true;
_this.jcxm_value = "";
_this.jchj_value = "";
_this.spdl_value = "";
_this.spxl_value = "";
_this.spyl_value = "";
_this.sppz_value = "";
_this.sfjk_value = "";
_this.jydl_value = "";
_this.rwly_value = "";
let str = "jcxm=0";
switch (_this.num) {
case 0:
_this.getXiangCiShu();
break;
case 1:
_this.getXiangCiShuHeGeLv();
break;
case 2:
_this.getZongJianShu();
break;
case 3:
_this.getZongJianShuHeGeLV();
break;
case 4:
_this.getFuGaiLv();
break;
case 5:
_this.getPingJunZhi();
break;
case 6:
SahDianTuData = []
_this.getSanDianTu();
break;
case 7:
_this.getQuanGuoDiTu();
break;
default:
}
_this.loading = false;
},
//查询 亚类 品种 细类
search2(val) {
var _this = this; //this指向vue
_this.str_num = val;
if (_this.str_num == 1) {
_this.spyl_value = "";
_this.sppz_value = "";
_this.spxl_value = "";
axios.get('./home/GetDistinctSPYL?str=' + _this.spdl_value).then(function (res) {
_this.options4 = [];
for (var i = 0; i < res.data.data.length; i++) {
_this.options4.push({ label: res.data.data[i], value: res.data.data[i] })
}
})
}
if (_this.str_num == 2) {
_this.sppz_value = "";
_this.spxl_value = "";
axios.get('./home/GetDistinctSPPZ?str=' + _this.spyl_value).then(function (res) {
_this.options5 = [];
for (var i = 0; i < res.data.data.length; i++) {
_this.options5.push({ label: res.data.data[i], value: res.data.data[i] })
}
})
}
if (_this.str_num == 3) {
_this.spxl_value = "";
axios.get('./home/GetDistinctSPXL?str=' + _this.sppz_value).then(function (res) {
_this.options6 = [];
for (var i = 0; i < res.data.data.length; i++) {
_this.options6.push({ label: res.data.data[i], value: res.data.data[i] })
}
})
}
},
//查询
search(val) {
var _this = this; //this指向vue
_this.drawer = false;
_this.free = false;
_this.loading = true;
this.condition = "";
this.PopDestShow = val + 1; //传进来的值是0和1精准和自由两种加上1就正好是1和2
if (val == 0) {
let str = "";
str = "JCXM=" + _this.jcxm_value;
str += "||CYDD=" + _this.jchj_value;
str += "||SP_DL=" + _this.spdl_value;
str += "||SP_YL=" + _this.spyl_value;
str += "||SP_PZ=" + _this.sppz_value;
str += "||SP_XL=" + _this.spxl_value;
str += "||SFJK=" + _this.sfjk_value;
str += "||JCDL=" + _this.jydl_value;
str += "||RWLY=" + _this.rwly_value;
this.condition = str;
}
if (val == 1) {
var dT = _this.ruleData;
//console.log(dT);
Enumerable.From(dT).order
var HaveWhere = false
let sqlstr = "";
var kuohaoNum = 0;
var kuohaoI = 1;
dT.forEach(function (item, index) {
var lianjieleixing = " and ";
if (HaveWhere)//已有筛选条件 则将传来的 And OR 添加到查询语句
{
lianjieleixing = item.fangshi;
}
HaveWhere = true;//进入循环 则立刻变为 有 筛选条件
var shuxingmingE = ""//"mytext": "年份", "PY": "RWNF"
_this.Myjson.forEach(function (item2, index) {
if (item2.mytext == item.leibie) {
shuxingmingE = item2.PY;
}
})
let tiaojianzhi = item.neirong;
let yunxuanfu = item.tiaojian;
switch (yunxuanfu) {
case "(":
sqlstr = sqlstr + " and " + yunxuanfu + " ";
kuohaoNum = 1;
kuohaoI = 0;
//console.log("222", kuohaoNum);
break;
case ")":
sqlstr = sqlstr + yunxuanfu + " ";
kuohaoNum = 2;
break;
case "包含":
if (kuohaoNum == 1) {
if (kuohaoI == 0) {
sqlstr += " \"" + shuxingmingE + "\" like '%" + tiaojianzhi + "%' ";
} else {
sqlstr += " or \"" + shuxingmingE + "\" like '%" + tiaojianzhi + "%' ";
}
kuohaoI++;
} else {
sqlstr += lianjieleixing + " \"" + shuxingmingE + "\" like '%" + tiaojianzhi + "%' ";
}
break;
case "不包含":
if (kuohaoNum == 1) {
if (kuohaoI == 0) {
sqlstr += " \"" + shuxingmingE + "\" not like '%" + tiaojianzhi + "%' ";
} else {
sqlstr += " or \"" + shuxingmingE + "\" not like '%" + tiaojianzhi + "%' ";
}
kuohaoI++;
} else {
sqlstr += lianjieleixing + " \"" + shuxingmingE + "\" not like '%" + tiaojianzhi + "%' ";
}
break;
case "等于":
if (shuxingmingE != "jcz") {
//console.log("1");
if (kuohaoNum == 1) {
//console.log("11");
if (kuohaoI == 0) {
//console.log("111");
sqlstr += " \"" + shuxingmingE + "\" = '" + tiaojianzhi + "' ";
} else {
//console.log("1111");
sqlstr += " or \"" + shuxingmingE + "\" = '" + tiaojianzhi + "' ";
}
kuohaoI++;
} else {
//console.log("11111", kuohaoNum);
sqlstr += lianjieleixing + " \"" + shuxingmingE + "\" = '" + tiaojianzhi + "' ";
}
}
else {
if (kuohaoNum == 1) {
if (kuohaoI == 0) {
sqlstr += " \"" + shuxingmingE + "\" = " + tiaojianzhi + " ";
} else {
sqlstr += " or \"" + shuxingmingE + "\" = " + tiaojianzhi + " ";
}
kuohaoI++;
} else {
sqlstr += lianjieleixing + " \"" + shuxingmingE + "\" = " + tiaojianzhi + " ";
}
}
break;
case "不等于":
if (shuxingmingE != "jcz") {
if (kuohaoNum == 1) {
if (kuohaoI == 0) {
sqlstr += " \"" + shuxingmingE + "\" <> '" + tiaojianzhi + "' ";
} else {
sqlstr += " or \"" + shuxingmingE + "\" <> '" + tiaojianzhi + "' ";
}
kuohaoI++;
} else {
sqlstr += lianjieleixing + " \"" + shuxingmingE + "\" <> '" + tiaojianzhi + "' ";
}
}
else {
if (kuohaoNum == 1) {
if (kuohaoI == 0) {
sqlstr += " \"" + shuxingmingE + "\" <> " + tiaojianzhi + " ";
} else {
sqlstr += " or \"" + shuxingmingE + "\" <> " + tiaojianzhi + " ";
}
kuohaoI++;
} else {
sqlstr += lianjieleixing + " \"" + shuxingmingE + "\" <> " + tiaojianzhi + " ";
}
}
break;
case "大于":
if (shuxingmingE != "jcz") {
if (kuohaoNum == 1) {
if (kuohaoI == 0) {
sqlstr += " \"" + shuxingmingE + "\" > '" + tiaojianzhi + "' ";
} else {
sqlstr += " or \"" + shuxingmingE + "\" > '" + tiaojianzhi + "' ";
}
kuohaoI++;
} else {
sqlstr += lianjieleixing + " \"" + shuxingmingE + "\" > '" + tiaojianzhi + "' ";
}
}
else {
if (kuohaoNum == 1) {
if (kuohaoI == 0) {
sqlstr += " \"" + shuxingmingE + "\" > " + tiaojianzhi + " ";
} else {
sqlstr += " or \"" + shuxingmingE + "\" > " + tiaojianzhi + " ";
}
kuohaoI++;
} else {
sqlstr += lianjieleixing + " \"" + shuxingmingE + "\" > " + tiaojianzhi + " ";
}
}
break;
case "小于":
if (shuxingmingE != "jcz") {
if (kuohaoNum == 1) {
if (kuohaoI == 0) {
sqlstr += " \"" + shuxingmingE + "\" < '" + tiaojianzhi + "' ";
} else {
sqlstr += " or \"" + shuxingmingE + "\" < '" + tiaojianzhi + "' ";
}
kuohaoI++;
} else {
sqlstr += lianjieleixing + " \"" + shuxingmingE + "\" < '" + tiaojianzhi + "' ";
}
}
else {
if (kuohaoNum == 1) {
if (kuohaoI == 0) {
sqlstr += " \"" + shuxingmingE + "\" < " + tiaojianzhi + " ";
} else {
sqlstr += " or \"" + shuxingmingE + "\" < " + tiaojianzhi + " ";
}
kuohaoI++;
} else {
sqlstr += lianjieleixing + " \"" + shuxingmingE + "\" < " + tiaojianzhi + " ";
}
}
break;
case "大于等于":
if (shuxingmingE != "jcz") {
if (kuohaoNum == 1) {
if (kuohaoI == 0) {
sqlstr += " \"" + shuxingmingE + "\" >= '" + tiaojianzhi + "' ";
} else {
sqlstr += " or \"" + shuxingmingE + "\" >= '" + tiaojianzhi + "' ";
}
kuohaoI++;
} else {
sqlstr += lianjieleixing + " \"" + shuxingmingE + "\" >= '" + tiaojianzhi + "' ";
}
}
else {
if (kuohaoNum == 1) {
if (kuohaoI == 0) {
sqlstr += " \"" + shuxingmingE + "\" >= " + tiaojianzhi + " ";
} else {
sqlstr += " or \"" + shuxingmingE + "\" >= " + tiaojianzhi + " ";
}
kuohaoI++;
} else {
sqlstr += lianjieleixing + " \"" + shuxingmingE + "\" >= " + tiaojianzhi + " ";
}
}
break;
case "小于等于":
if (shuxingmingE != "jcz") {
if (kuohaoNum == 1) {
if (kuohaoI == 0) {
sqlstr += " \"" + shuxingmingE + "\" <= '" + tiaojianzhi + "' ";
} else {
sqlstr += " or \"" + shuxingmingE + "\" <= '" + tiaojianzhi + "' ";
}
kuohaoI++;
} else {
sqlstr += lianjieleixing + " \"" + shuxingmingE + "\" <= '" + tiaojianzhi + "' ";
}
}
else {
if (kuohaoNum == 1) {
if (kuohaoI == 0) {
sqlstr += " \"" + shuxingmingE + "\"\" <= " + tiaojianzhi + " ";
} else {
sqlstr += " or \"" + shuxingmingE + "\"\" <= " + tiaojianzhi + " ";
}
kuohaoI++;
} else {
sqlstr += lianjieleixing + " \"\"" + shuxingmingE + "\"\" <= " + tiaojianzhi + " ";
}
}
break;
}
})
this.condition = sqlstr;
// console.log(this.condition);
}
let n = _this.num;
if (n == 0) {
axios.get('./home/tongji?sqlname=XiangCiShu&condition=' + replaceCondition(this.condition) + '&multisearch=' + JSON.stringify(this.multisearch) + '&strDZ=global').then(function (res) {
mapData = res.data.mapdata;
year = res.data.year;
refreshMap();
_this.loading = false;
})
}
if (n == 1) {
numStr = 2;
axios.get('./home/tongji?sqlname=XiangCiShu_HeGeLv&condition=' + replaceCondition(this.condition) + '&multisearch=' + JSON.stringify(this.multisearch) + '&strDZ=global').then(function (res) {
mapData = res.data.mapdata;
year = res.data.year;
refreshMap();
_this.loading = false;
})
}
if (n == 2) {
axios.get('./home/tongji?sqlname=ZongJianShu&condition=' + replaceCondition(this.condition) + '&multisearch=' + JSON.stringify(this.multisearch) + '&strDZ=global').then(function (res) {
mapData = res.data.mapdata;
year = res.data.year;
refreshMap();
_this.loading = false;
})
}
if (n == 3) {
numStr = 2;
axios.get('./home/tongji?sqlname=ZongJianShu_HeGeLv&condition=' + replaceCondition(this.condition) + '&multisearch=' + JSON.stringify(this.multisearch) + '&strDZ=global').then(function (res) {
mapData = res.data.mapdata;
year = res.data.year;
refreshMap();
_this.loading = false;
})
}
if (n == 4) {
numStr = 3;
axios.get('./home/tongji?sqlname=FuGaiLv&condition=' + replaceCondition(this.condition) + '&multisearch=' + JSON.stringify(this.multisearch) + '&strDZ=global').then(function (res) {
mapData = res.data.mapdata;
year = res.data.year;
refreshMap();
_this.loading = false;
})
}
if (n == 5) {
if (_this.jcxm_value.length > 0) {
axios.get('../map/JCZDW.json').then(function (res) {
var sss = _this.jcxm_value[0];
console.log(sss, res.data)
var arrRes = Enumerable.From(res.data).Where(function (x) { return x.name == sss }).ToArray();
console.log(arrRes)
showMapTip = arrRes[0].value;
});
}
//console.log(showMapTip)
axios.get('./home/tongji?sqlname=PingJunZhi&condition=' + replaceCondition(this.condition) + '&multisearch=' + JSON.stringify(this.multisearch) + '&strDZ=global').then(function (res) {
mapData = res.data.mapdata;
year = res.data.year;
refreshMap();
_this.loading = false;
})
}
if (n == 6) {
//_this.getSanDianTuBase();
axios.get('./home/tongji?sqlname=SanDianTu&condition=' + replaceCondition(this.condition) + '&multisearch=' + JSON.stringify(this.multisearch) + '&strDZ=global').then(function (res) {
mapData = res.data.mapdata;
year = res.data.year;
refreshMap();
_this.loading = false;
});
}
if (n == 7) {
axios.get('./home/SearchQianXi?condition=' + replaceCondition(this.condition) ).then(axios.spread(function (res2) {
d1 = res2.data
qianxiAdd();
_this.loading = false;
}));
}
},
//项次数
getXiangCiShu() {
var _this = this; //this指向vue
_this.loading = true;
_this.num = 0;
axios.get('./home/XiangCiShuNew' + '?strDZ=global').then(function (res) {
//console.log('xiangcishu',res)
mapData = [];
mapData = res.data;
year = _this.selYear;
refreshMap();
_this.loading = false;
});
},
//项次数不合格率
getXiangCiShuHeGeLv() {
var _this = this; //this指向vue
_this.loading = true;
_this.num = 1;
axios.get('./home/XiangCiShuHeGeLvNew' + '?strDZ=global').then(function (res) {
mapData = []
mapData = res.data;
year = _this.selYear;
//console.log('xiangcishuhegelv', JSON.stringify(mapData));
refreshMap();
_this.loading = false;
});
},
//件数
getZongJianShu() {
var _this = this; //this指向vue
_this.loading = true;
_this.num = 2;
axios.get('./home/ZongJianShuNew' + '?strDZ=global').then(function (res) {
mapData = []
mapData = res.data;
year = _this.selYear;
refreshMap();
_this.loading = false;
});
},
//件数不合格率
getZongJianShuHeGeLv() {
var _this = this; //this指向vue
_this.loading = true;
_this.num = 3;
axios.get('./home/ZongJianShuHeGeLVNew' + '?strDZ=global').then(function (res) {
mapData = []
mapData = res.data;
year = _this.selYear;
refreshMap();
_this.loading = false;
});
},
//覆盖率
getFuGaiLv() {
var _this = this; //this指向vue
_this.loading = true;
_this.num = 4;
axios.get('./home/FuGaiLvNew' + '?strDZ=global').then(function (res) {
mapData = []
mapData = res.data;
year = _this.selYear;
refreshMap();
_this.loading = false;
});
},
//平均值
getPingJunZhi() {
var _this = this; //this指向vue
_this.loading = true;
_this.num = 5;
axios.get('./home/PingJunZhiNew' + '?strDZ=global').then(function (res) {
mapData = []
mapData = res.data;
year = _this.selYear;
refreshMap();
_this.loading = false;
});
},
////散点图
getSanDianTu() {
var _this = this; //this指向vue
_this.loading = true;
_this.num = 6;
axios.get('./home/SanDianTuChinaAndGlobal?strDZ=global').then(function (res) {
mapData = []
mapData = res.data;
year = _this.selYear;
refreshMap();
_this.loading = false;
});
},
//散点图抓状图Data
getSanDianTuBase() {
var _this = this; //this指向vue
_this.loading = true;
_this.num = 6;
axios.get('./home/SanDianTuBase?condition=' + replaceCondition(this.condition) + '&strDZ=global').then(function (res) {
SahDianTuDataDT = res.data;
scatterAdd();
_this.loading = false;
});
},
//全国迁徙图
getQuanGuoDiTu() {
var _this = this; //this指向vue
_this.loading = true;
let sendArr = [
axios.get('../map/data-qianxi.json'),
axios.get('./home/SearchQianXi?condition=')
]
axios.all(sendArr).then(axios.spread(function (res1, res2) {
geoJson = res1.data
d1 = res2.data
qianxiAdd();
_this.loading = false;
}));
},
//括号新增
kuoHaoFuntion(a) {
//this.ruleForm.fangshi = a;
var dT = {
leibie: "",
tiaojian: a,
neirong: "",
fangshi: ""
};
this.ruleData.push(dT);
},
//组合查询条件
btnFuntion(a) {
this.ruleForm.fangshi = a;
var dT = {
leibie: this.ruleForm.leibie,
tiaojian: this.ruleForm.tiaojian,
neirong: this.ruleForm.neirong,
fangshi: this.ruleForm.fangshi
};
this.ruleData.push(dT);
},
//删除组合查询
deleteFunction(a) {
var aa = this.ruleData.indexOf(a);
this.ruleData.splice(aa, 1);
},
//排序按钮
paiXuFunction() {
if (isBarSort) {
isBarSort = false
} else {
isBarSort = true
}
let n = this.num;
if (n == 1 || n == 3 || n == 4) {
numStr = 2
}
if (n == 66) {
scatterAdd();
} else {
refreshMap();
}
}
}
})
///////////////////////////////////////////////////
///////////////////////////////////////////////////
//该部分是原有echarts的部分调整代码
//初始化界面地图层
var myChart = echarts.init(document.getElementById('main'));
//公用地图地理数据
var geoJson = {};
//标题栏目数据
var showMapTip = '食品实时监管统计数据展示';
//显示年份数组(可配置)
var year = [];
var area = [];
var d1 = {};//全国地图数据
var geoJson = {};//全国地图
var numStr = 0;//判断参数 2为不合格率保留2位小数 3为覆盖率保留2位小数
var bigTitle="上海市食品安全风险监测结果统计"; //定义动态的标题显示内容
//地图上每个区县的热点位置
var geoCoordMap = {
"济南": [116.98, 36.67],
"北京": [116.404184, 39.914578],
"尼日利亚": [-4.388361, 11.186148],
"美国洛杉矶": [-118.24311, 34.052713],
"香港邦泰": [114.195466, 22.282751],
"美国芝加哥": [-87.801833, 41.870975],
"加纳库马西": [-4.62829, 7.72415],
"英国曼彻斯特": [-1.657222, 51.886863],
"德国汉堡": [10.01959, 54.38474],
"哈萨克斯坦阿拉木图": [45.326912, 41.101891],
"俄罗斯伊尔库茨克": [89.116876, 67.757906],
"巴西": [-48.678945, -10.493623],
"埃及达米埃塔": [31.815593, 31.418032],
"西班牙巴塞罗纳": [2.175129, 41.385064],
"柬埔寨金边": [104.88659, 11.545469],
"意大利米兰": [9.189948, 45.46623],
"乌拉圭蒙得维的亚": [-56.162231, -34.901113],
"莫桑比克马普托": [32.608571, -25.893473],
"阿尔及利亚阿尔及尔": [3.054275, 36.753027],
"阿联酋迪拜": [55.269441, 25.204514],
"匈牙利布达佩斯": [17.108519, 48.179162],
"澳大利亚悉尼": [150.993137, -33.675509],
"美国加州": [-121.910642, 41.38028],
"澳大利亚墨尔本": [144.999416, -37.781726],
"墨西哥": [-99.094092, 19.365711],
"加拿大温哥华": [-123.023921, 49.311753],
"阿富汗": [69.11, 34.28],
"阿尔巴尼亚": [19.49, 41.18],
"阿尔及利亚": [3.08, 36.42],
"美属萨摩亚": [-170.43, -14.16],
"安道尔": [1.32, 42.31],
"安哥拉": [13.15, -8.50],
"安提瓜和巴布达": [-61.48, 17.20],
"阿根廷": [-60.00, -36.30],
"亚美尼亚": [44.31, 40.10],
"阿鲁巴": [-70.02, 12.32],
"澳大利亚": [149.08, -35.15],
"奥地利": [16.22, 48.12],
"阿塞拜疆": [49.56, 40.29],
"巴哈马": [-77.20, 25.05],
"巴林": [50.30, 26.10],
"孟加拉国": [90.26, 23.43],
"巴巴多斯": [-59.30, 13.05],
"白俄罗斯": [27.30, 53.52],
"比利时": [4.21, 50.51],
"伯利兹": [-88.30, 17.18],
"贝宁": [2.42, 6.23],
"不丹": [89.45, 27.31],
"玻利维亚": [-68.10, -16.20],
"波斯尼亚和黑塞哥维那": [18.26, 43.52],
"博茨瓦纳": [25.57, -24.45],
"巴西": [-47.55, -15.47],
"英属维尔京群岛": [-64.37, 18.27],
"文莱": [115.00, 4.52],
"保加利亚": [23.20, 42.45],
"布基纳法索": [-1.30, 12.15],
"布隆迪": [29.18, -3.16],
"柬埔寨": [104.55, 11.33],
"喀麦隆": [11.35, 3.50],
"加拿大": [-75.42, 45.27],
"佛得角": [-23.34, 15.02],
"开曼群岛": [-81.24, 19.20],
"中非共和国": [18.35, 4.23],
"乍得": [14.59, 12.10],
"智利": [-70.40, -33.24],
"中国": [116.20, 39.55],
"哥伦比亚": [-74.00, 4.34],
"科摩罗": [43.16, -11.40],
"刚果": [15.12, -4.09],
"哥斯达黎加": [-84.02, 9.55],
"科特迪瓦": [-5.17, 6.49],
"克罗地亚": [15.58, 45.50],
"古巴": [-82.22, 23.08],
"塞浦路斯": [33.25, 35.10],
"捷克共和国": [14.22, 50.05],
"朝鲜": [125.30, 39.09],
"刚果(扎伊尔)": [15.15, -4.20],
"丹麦": [12.34, 55.41],
"吉布提": [42.20, 11.08],
"多米尼加": [-61.24, 15.20],
"多米尼加共和国": [-69.59, 18.30],
"东帝汶": [125.34, -8.29],
"厄瓜多尔": [-78.35, -0.15],
"埃及": [31.14, 30.01],
"萨尔瓦多": [-89.10, 13.40],
"赤道几内亚": [8.50, 3.45],
"厄立特里亚": [38.55, 15.19],
"爱沙尼亚": [24.48, 59.22],
"埃塞俄比亚": [38.42, 9.02],
"福克兰群岛(马尔维纳斯群岛)": [-59.51, -51.40],
"法罗群岛": [-6.56, 62.05],
"斐济": [178.30, -18.06],
"芬兰": [25.03, 60.15],
"法国": [2.20, 48.50],
"法属圭亚那": [-52.18, 5.05],
"法属波利尼西亚": [-149.34, -17.32],
"加蓬": [9.26, 0.25],
"冈比亚": [-16.40, 13.28],
"格鲁吉亚": [44.50, 41.43],
"德国": [13.25, 52.30],
"加纳": [-0.06, 5.35],
"希腊": [23.46, 37.58],
"格陵兰": [-51.35, 64.10],
"瓜德罗普岛": [-61.44, 16.00],
"危地马拉": [-90.22, 14.40],
"根西岛": [-2.33, 49.26],
"几内亚": [-13.49, 9.29],
"几内亚比绍": [-15.45, 11.45],
"圭亚那": [-58.12, 6.50],
"海地": [-72.20, 18.40],
"赫德岛和麦当劳群岛": [74.00, -53.00],
"洪都拉斯": [-87.14, 14.05],
"匈牙利": [19.05, 47.29],
"冰岛": [-21.57, 64.10],
"印度": [77.13, 28.37],
"印度尼西亚": [106.49, -6.09],
"伊朗": [51.30, 35.44],
"伊拉克": [44.30, 33.20],
"爱尔兰": [-6.15, 53.21],
"以色列": [35.12, 31.47],
"意大利": [12.29, 41.54],
"牙买加": [-76.50, 18.00],
"约旦": [35.52, 31.57],
"哈萨克斯坦": [71.30, 51.10],
"肯尼亚": [36.48, -1.17],
"基里巴斯": [173.00, 1.30],
"科威特": [48.00, 29.30],
"吉尔吉斯斯坦": [74.46, 42.54],
"老挝": [102.36, 17.58],
"拉脱维亚": [24.08, 56.53],
"黎巴嫩": [35.31, 33.53],
"莱索托": [27.30, -29.18],
"利比里亚": [-10.47, 6.18],
"阿拉伯利比亚民众国": [13.07, 32.49],
"列支敦士登": [9.31, 47.08],
"立陶宛": [25.19, 54.38],
"卢森堡": [6.09, 49.37],
"马达加斯加": [47.31, -18.55],
"马拉维": [33.48, -14.00],
"马来西亚": [101.41, 3.09],
"马尔代夫": [73.28, 4.00],
"马里": [-7.55, 12.34],
"马耳他": [14.31, 35.54],
"马提尼克岛": [-61.02, 14.36],
"毛里塔尼亚": [57.30, -20.10],
"马约特岛": [45.14, -12.48],
"墨西哥": [-99.10, 19.20],
"密克罗尼西亚(联邦) ": [158.09, 6.55],
"摩尔多瓦共和国": [28.50, 47.02],
"莫桑比克": [32.32, -25.58],
"缅甸": [96.20, 16.45],
"纳米比亚": [17.04, -22.35],
"尼泊尔": [85.20, 27.45],
"荷兰": [4.54, 52.23],
"荷属安的列斯": [-69.00, 12.05],
"新喀里多尼亚": [166.30, -22.17],
"新西兰": [174.46, -41.19],
"尼加拉瓜": [-86.20, 12.06],
"尼日尔": [2.06, 13.27],
"尼日利亚": [7.32, 9.05],
"诺福克岛": [168.43, -45.20],
"北马里亚纳群岛": [145.45, 15.12],
"挪威": [10.45, 59.55],
"阿曼": [58.36, 23.37],
"巴基斯坦": [73.10, 33.40],
"帕劳": [134.28, 7.20],
"巴拿马": [-79.25, 9.00],
"巴布亚新几内亚": [147.08, -9.24],
"巴拉圭": [-57.30, -25.10],
"秘鲁": [-77.00, -12.00],
"菲律宾": [121.03, 14.40],
"波兰": [21.00, 52.13],
"葡萄牙": [-9.10, 38.42],
"波多黎各": [-66.07, 18.28],
"卡塔尔": [51.35, 25.15],
"韩国": [126.58, 37.31],
"罗马尼亚": [26.10, 44.27],
"俄罗斯": [37.35, 55.45],
"卢旺达": [30.04, -1.59],
"圣基茨和尼维斯": [-62.43, 17.17],
"圣卢西亚": [-60.58, 14.02],
"圣皮埃尔和密克隆": [-56.12, 46.46],
"圣文森特和格林纳丁斯": [-61.10, 13.10],
"萨摩亚": [-171.50, -13.50],
"圣马力诺": [12.30, 43.55],
"圣多美和普林西比": [6.39, 0.10],
"沙特阿拉伯": [46.42, 24.41],
"塞内加尔": [-17.29, 14.34],
"塞拉利昂": [-13.17, 8.30],
"斯洛伐克": [17.07, 48.10],
"斯洛文尼亚": [14.33, 46.04],
"所罗门群岛": [159.57, -9.27],
"索马里": [45.25, 2.02],
"比勒陀利亚": [28.12, -25.44],
"西班牙": [-3.45, 40.25],
"苏丹": [32.35, 15.31],
"苏里南": [-55.10, 5.50],
"斯威士兰": [31.06, -26.18],
"瑞典": [18.03, 59.20],
"瑞士": [7.28, 46.57],
"阿拉伯叙利亚共和国": [36.18, 33.30],
"塔吉克斯坦": [68.48, 38.33],
"泰国": [100.35, 13.45],
"马其顿": [21.26, 42.01],
"多哥": [1.20, 6.09],
"汤加": [-174.00, -21.10],
"突尼斯": [10.11, 36.50],
"土耳其": [32.54, 39.57],
"土库曼斯坦": [57.50, 38.00],
"图瓦卢": [179.13, -8.31],
"乌干达": [32.30, 0.20],
"乌克兰": [30.28, 50.30],
"阿联酋": [54.22, 24.28],
"英国": [-0.05, 51.36],
"坦桑尼亚": [35.45, -6.08],
"美国": [-77.02, 39.91],
"美属维尔京群岛": [-64.56, 18.21],
"乌拉圭": [-56.11, -34.50],
"乌兹别克斯坦": [69.10, 41.20],
"瓦努阿图": [168.18, -17.45],
"委内瑞拉": [-66.55, 10.30],
"越南": [105.55, 21.05],
"南斯拉夫": [20.37, 44.50],
"赞比亚": [28.16, -15.28],
"津巴布韦": [31.02, -17.43]
};
//颜色设定数组
var colors = [
["#1DE9B6", "#F46E36", "#04B9FF", "#5DBD32", "#FFC809", "#FB95D5", "#BDA29A", "#6E7074", "#546570", "#C4CCD3"],
["#37A2DA", "#67E0E3", "#32C5E9", "#9FE6B8", "#FFDB5C", "#FF9F7F", "#FB7293", "#E062AE", "#E690D1", "#E7BCF3", "#9D96F5", "#8378EA", "#8378EA"],
["#DD6B66", "#759AA0", "#E69D87", "#8DC1A9", "#EA7E53", "#EEDD78", "#73A373", "#73B9BC", "#7289AB", "#91CA8C", "#F49F42"],
];
//地图实际交互数据,从后台获取(可配置)
var mapData = [];
//设定地图的显示中心点
var mapDisplayCenter = [121.4648, 31.2891];
var colorIndex = 0;
/*柱子Y名称*/
var categoryData = [];
//柱形显示的数据
var barData = [];
//是否表格显示排序(可配置)
var isBarSort = true;
//scatter叠加部分
var geoCoordMapScatter = [];
var displayDataScatter = [];
var geoCoordMapScatter2 = [];
var displayDataScatter2 = [];
var SahDianTuData = [];
var SahDianTuDataDT = [];//散点图柱状图DT
//地图动态显示方法
var refreshMap = function () {
//console.log('mapddata', JSON.stringify(mapData))
barData = []
categoryData = []
categoryData2 = []
//动态设置柱状显示的名称,实际上是区县名称
for (var key in geoCoordMap) {
categoryData2.push(key);
}
//动态设置柱状图的数据值
for (var i = 0; i < mapData.length; i++) {
barData.push([]);
categoryData.push([]);
var aaa = 0
var mapDt = [];
for (var j = 0; j < mapData[i].length; j++) {
//barData[i].push(formatDecimal(mapData[i][j].value,2))
//barData[i].push(mapData[i][j].value)
for (var k = 0; k < categoryData2.length; k++) {
if (mapData[i][j].name == categoryData2[k]) {
mapDt.push({
"name": categoryData2[k],
"value": mapData[i][j].value,
})
}
}
}
for (var j = 0; j < categoryData2.length; j++) {
for (var k = 0; k < mapDt.length; k++) {
if (categoryData2[j] == mapDt[k].name) {
if (numStr == 2) {
barData[i].push({
"name": mapDt[k].name,
"value": formatDecimal(mapDt[k].value, 2)
})
} else if (numStr == 3) {
barData[i].push({
"name": mapDt[k].name,
"value": formatDecimal(mapDt[k].value, 2)
})
//console.log(numStr, mapDt[k].value);
} else {
barData[i].push({
"name": mapDt[k].name,
"value": mapDt[k].value
})
}
categoryData[i].push(mapDt[k].name)
}
}
}
//该部分是动态排序
if (isBarSort) {
barData[i].sort(function sortNumber(a, b) {
return a.value - b.value
});
categoryData[i] = [];
for (var g = 0; g < barData[i].length; g++) {
categoryData[i].push(barData[i][g].name)
}
}
//console.log(categoryData[i]);
}
echarts.registerMap('global', geoJson);
var convertData = function (data) {
var res = [];
for (var i = 0; i < data.length; i++) {
var geoCoord = geoCoordMap[data[i].name];
if (geoCoord) {
if (numStr == 2) {
res.push({
name: data[i].name,
value: geoCoord.concat(formatDecimal(data[i].value, 2))
});
} else if (numStr == 3) {
res.push({
name: data[i].name,
value: geoCoord.concat(formatDecimal(data[i].value, 2))
});
} else {
res.push({
name: data[i].name,
value: geoCoord.concat(data[i].value)
});
}
}
}
console.log(res);
//debugger;
return res;
};
optionXyMap01 = {
timeline: {
data: year,
axisType: 'category',
autoPlay: true,
playInterval: 5000,
left: '10%',
right: '10%',
bottom: '2%',
width: '80%',
// height: null,
label: {
normal: {
textStyle: {
color: '#ddd'
}
},
emphasis: {
textStyle: {
color: '#fff'
}
}
},
symbolSize: 10,
lineStyle: {
color: '#555'
},
checkpointStyle: {
borderColor: '#777',
borderWidth: 2
},
controlStyle: {
showNextBtn: true,
showPrevBtn: true,
normal: {
color: '#666',
borderColor: '#666'
},
emphasis: {
color: '#aaa',
borderColor: '#aaa'
}
},
},
baseOption: {
animation: true,
animationDuration: 1000,
animationEasing: 'cubicInOut',
animationDurationUpdate: 1000,
animationEasingUpdate: 'cubicInOut',
grid: {
right: '1%',
top: '15%',
bottom: '10%',
width: '25%'
},
tooltip: {
trigger: 'axis', // hover触发器
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow', // 默认为直线,可选为:'line' | 'shadow'
shadowStyle: {
color: 'rgba(150,150,150,0.1)' //hover颜色
}
}
},
geo: {
show: true,
map: 'global',
roam: true,
zoom: 1,
center: mapDisplayCenter,
label: {
emphasis: {
show: false
}
},
itemStyle: {
normal: {
borderColor: 'rgba(147, 235, 248, 1)',
borderWidth: 1,
areaColor: {
type: 'radial',
x: 0.5,
y: 0.5,
r: 0.8,
colorStops: [{
offset: 0,
color: 'rgba(147, 235, 248, 0)' // 0% 处的颜色
}, {
offset: 1,
color: 'rgba(147, 235, 248, .2)' // 100% 处的颜色
}],
globalCoord: false // 缺省为 false
},
shadowColor: 'rgba(128, 217, 248, 1)',
// shadowColor: 'rgba(255, 255, 255, 1)',
shadowOffsetX: -2,
shadowOffsetY: 2,
shadowBlur: 10
},
emphasis: {
areaColor: '#389BB7',
borderWidth: 0
}
}
},
},
options: []
};
for (var n = 0; n < year.length; n++) {
optionXyMap01.options.push({
backgroundColor: '#051b4a',
title: [{
//text: showMapTip,
text: bigTitle,
subtext: '',
left: '40%',
top: '5%',
fontSize: '50px',
textStyle: {
color: '#fff'
}
},
{
id: 'statistic',
//text: year[n] + "年数据统计情况",
text: '',
left: '60%',
top: '8%',
textStyle: {
color: '#fff',
fontSize: 24
}
}
],
xAxis: {
type: 'value',
scale: true,
position: 'top',
min: 0,
boundaryGap: false,
splitLine: {
show: false
},
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
margin: 2,
textStyle: {
color: '#aaa'
}
},
},
yAxis: {
type: 'category',
name: showMapTip,
// name: 'TOP 20',
nameGap: 16,
axisLine: {
show: true,
lineStyle: {
color: '#ddd'
}
},
axisTick: {
show: false,
lineStyle: {
color: '#ddd'
}
},
axisLabel: {
interval: 0,
textStyle: {
color: '#ddd'
}
},
data: categoryData[n]
},
series: [
//未知作用
{
//文字和标志
name: 'light',
type: 'scatter',
coordinateSystem: 'geo',
data: convertData(barData[n]),
symbol: 'pin', //气泡
symbolSize: function (val) {
return 40;
},
label: {
normal: {
formatter:(numStr==2)?'{@[2]}%':'{@[2]}',
// position: 'right',
color: '#fff',
fontSize: 9,
show: true
},
emphasis: {
show: true
}
},
itemStyle: {
normal: {
color: '#F62157'
// color: colors[colorIndex][n]
}
}
},
//地图?
{
type: 'map',
map: 'global',
geoIndex: 0,
aspectScale: 0.75, //长宽比
showLegendSymbol: false, // 存在legend时显示
label: {
normal: {
show: true
},
emphasis: {
show: true,
textStyle: {
color: '#fff'
}
}
},
roam: true,
itemStyle: {
normal: {
areaColor: '#031525',
borderColor: '#FFFFFF',
},
emphasis: {
areaColor: '#2B91B7'
}
},
animation: false,
data: barData
},
//地图点的动画效果
{
// name: 'Top 5',
type: 'effectScatter',
coordinateSystem: 'geo',
data: convertData(barData[n]),
symbolSize: function (val) {
return 10;
},
showEffectOn: 'render',
rippleEffect: {
brushType: 'stroke'
},
hoverAnimation: true,
label: {
normal: {
formatter: '{b}',
position: 'right',
show: true
}
},
itemStyle: {
normal: {
color: colors[colorIndex][n],
shadowBlur: 10,
shadowColor: colors[colorIndex][n]
}
},
zlevel: 1
},
//柱状图
{
zlevel: 1.5,
type: 'bar',
symbol: 'none',
itemStyle: {
normal: {
color: colors[colorIndex][n]
}
},
data: barData[n]
}
]
})
}
myChart.clear();
myChart.setOption(optionXyMap01);
numStr = 0;
};
////////////////////////////////////////////////////
//小数点保留
var formatDecimal = function (num, decimal) {
//if()
num = num.toString()
//console.log("num1:", num);
let index = num.indexOf('.')
if (index !== -1) {
num = num.substring(0, decimal + index + 1)
return parseFloat(num).toFixed(decimal)
} else {
num = num.substring(0)
return parseFloat(num)
}
//console.log("num2:", num);
}
//转义相关的值
var replaceCondition = function (str) {
var curStr = str.replace(/\+/g, "%2b")
return curStr
}
//散点图的被抽样单位名称
let BCYDWMCstr = [];
//散点图形计算
var scatterAdd = function () {
//echarts.registerMap('global', geoJson);
echarts.regi
geoCoordMapScatter = geoCoordMapScatter2;
displayDataScatter = displayDataScatter2;
var convertData = function (data) {
var res = [];
for (var i = 0; i < data.length; i++) {
var geoCoord = geoCoordMapScatter[data[i].name];
if (geoCoord) {
res.push({
name: data[i].name,
value: geoCoord.concat(data[i].value)
});
}
}
return res;
};
var convertedData = [
convertData(displayDataScatter),
convertData(displayDataScatter.sort(function (a, b) {
return 10;
}).slice(0, 6))
];
var dt = [];
var convertedData2 = [];
var convertDT = convertedData[0];
for (var i = 0; i < convertDT.length; i++) {
dt = [];
var nameStr = convertDT[i].name;
var nameStr2 = "";
var str = "";
dt = Enumerable.From(SahDianTuData).Where(function (x) {
str = nameStr.substring(nameStr.indexOf("区") + 1, nameStr.length)
nameStr2 = x.name;
return nameStr2.indexOf(str) > 0
}).ToArray();
if (dt.length > 0 && str.length > 2) {
convertedData2.push(convertDT[i]);
}
}
if (SahDianTuData.length > 0) {
convertedData[0] = [];
convertedData[0] = convertedData2;
}
var dTvalue = [];
var dTname = [];
for (var key in geoCoordMap) {
dTname.push(key);
}
for (var g = 0; g < SahDianTuDataDT[0].length; g++) {
for (var k = 0; k < dTname.length; k++) {
if (dTname[k] == SahDianTuDataDT[0][g].name) {
dTvalue.push({
"name": SahDianTuDataDT[0][g].name,
"value": SahDianTuDataDT[0][g].value,
})
}
}
}
//该部分是动态排序
if (isBarSort) {
dTvalue.sort(function sortNumber(a, b) {
return a.value - b.value
});
}
dTname = [];
for (var g = 0; g < dTvalue.length; g++) {
dTname.push(dTvalue[g].name)
}
let option2 = {
//backgroundColor: '#404a59',
animation: true,
animationDuration: 1000,
animationEasing: 'cubicInOut',
animationDurationUpdate: 1000,
animationEasingUpdate: 'cubicInOut',
title: [
{
text: '生产企业数量',
subtext: '',
left: 'center',
textStyle: {
color: '#fff'
}
},
{
id: 'statistic',
right: 120,
top: 40,
width: 100,
textStyle: {
color: '#fff',
fontSize: 16
}
}
],
toolbox: {
iconStyle: {
normal: {
borderColor: '#fff'
},
emphasis: {
borderColor: '#b1e4ff'
}
},
feature: {
dataZoom: {},
brush: {
type: ['rect', 'polygon', 'clear']
},
saveAsImage: { show: true }
}
},
//brush: {
// outOfBrush: {
// color: '#abc'
// },
// brushStyle: {
// borderWidth: 2,
// color: 'rgba(0,0,0,0.2)',
// borderColor: 'rgba(0,0,0,0.5)',
// },
// seriesIndex: [0, 1],
// throttleType: 'debounce',
// throttleDelay: 300,
// geoIndex: 0
//},
geo: {
map: 'global',
//left: '10',
//right: '35%',
center: mapDisplayCenter,
zoom: 1,
label: {
emphasis: {
show: false
}
},
roam: true,
itemStyle: {
normal: {
areaColor: '#323c48',
borderColor: '#111'
},
emphasis: {
areaColor: '#2a333d'
}
}
},
tooltip: {
trigger: 'item',
formatter: function (param, ticket, callback) {
var value = param.name;
for (var g = 0; g < SahDianTuDataDT[0].length; g++) {
if (value == SahDianTuDataDT[0][g].name) {
return SahDianTuDataDT[0][g].value;
}
}
$.getJSON("../map/BCYDWMC.json", function (data) {
var strAddr = "";
var arrRes = Enumerable.From(data).Where(function (x) { return x.name.indexOf(value) >= 0 }).Distinct("x=>x.value").ToArray();
for (var i = 0; i < arrRes.length; i++) {
strAddr = strAddr + arrRes[i].value + "<br />";
}
BCYDWMCstr = '<div> 地址:<br />'
+ value +
'<br />单位:<br />'
+ strAddr +
'</div>';
callback(ticket, BCYDWMCstr);
})
//return BCYDWMCstr;
//callback(ticket,BCYDWMCstr)
return 'Loading....';
}
},
grid: {
right: 40,
top: 100,
bottom: 40,
width: '30%'
},
xAxis: {
type: 'value',
scale: true,
position: 'top',
boundaryGap: false,
splitLine: { show: false },
axisLine: { show: false },
axisTick: { show: false },
axisLabel: { margin: 2, textStyle: { color: '#aaa' } },
},
yAxis: {
type: 'category',
name: '',
nameGap: 16,
axisLine: { show: true, lineStyle: { color: '#ddd' } },
axisTick: { show: false, lineStyle: { color: '#ddd' } },
axisLabel: { interval: 0, textStyle: { color: '#ddd' } },
data: dTname
},
series: [
{
name: '数量',
type: 'scatter',
coordinateSystem: 'geo',
data: convertedData[0],
symbolSize: 3,
itemStyle: {
normal: {
//color: '#ddb926'
}
}
},
//柱状图
{
zlevel: 1.5,
type: 'bar',
symbol: 'none',
itemStyle: {
normal: {
color: '#ddb926'
}
},
data: dTvalue
}
]
};
myChart.clear();
myChart.setOption(option2);
}
var geoGpsMap = [121.4648, 31.2891];
var t = 1;//流入流出控制
var r = 1;//右侧流入流出文字控制
var geoCoordMap2 = {
"江苏省": [118.8062, 31.9208],
'黑龙江省': [127.9688, 45.368],
'内蒙古自治区': [110.3467, 41.4899],
"吉林省": [125.8154, 44.2584],
'北京市': [116.4551, 40.2539],
"辽宁省": [123.1238, 42.1216],
"河北省": [114.4995, 38.1006],
"天津市": [117.4219, 39.4189],
"山西省": [112.3352, 37.9413],
"陕西省": [109.1162, 34.2004],
"甘肃省": [103.5901, 36.3043],
"宁夏回族自治区": [106.3586, 38.1775],
"青海省": [101.4038, 36.8207],
"新疆维吾尔自治区": [87.9236, 43.5883],
"四川省": [103.9526, 30.7617],
"重庆市": [108.384366, 30.439702],
"山东省": [117.1582, 36.8701],
"河南省": [113.4668, 34.6234],
"安徽省": [117.29, 32.0581],
"湖北省": [114.3896, 30.6628],
"浙江省": [119.5313, 29.8773],
"福建省": [119.4543, 25.9222],
"江西省": [116.0046, 28.6633],
"湖南省": [113.0823, 28.2568],
"贵州省": [106.6992, 26.7682],
"云南省": [102.9199, 25.4663],
"广东省": [113.12244, 23.009505],
"广西壮族自治区": [108.479, 23.1152],
"海南省": [110.3893, 19.8516],
// '上海市': [121.4648, 31.2891]
//"西藏": [91.11, 29.97]
};
//全国迁徙图
var qianxiAdd = function () {
var _this = this; //this指向vue
var year = ["2020"];
mapData = [
[],
[],
];
/*柱子Y名称*/
var categoryData = [];
var barData = [];
for (var key in geoCoordMap2) {
mapData[0].push({
"year": '2020',
"name": key,
"value": _this.d1[key],
"value1": _this.d1[key],
});
}
for (var i = 0; i < mapData.length; i++) {
mapData[i].sort(function sortNumber(a, b) { return a.value - b.value });
barData.push([]);
categoryData.push([]);
for (var j = 0; j < mapData[i].length; j++) {
barData[i].push(mapData[i][j].value1);
categoryData[i].push(mapData[i][j].name);
}
}
echarts.registerMap('global', _this.geoJson);
var convertData = function (data) {
var res = [];
for (var i = 0; i < data.length; i++) {
var geoCoord = geoCoordMap2[data[i].name];
if (geoCoord) {
res.push({
name: data[i].name,
value: geoCoord.concat(data[i].value)
});
}
}
return res;
};
var convertToLineData = function (data, gps) {
var res = [];
for (var i = 0; i < data.length; i++) {
var dataItem = data[i];
var toCoord = geoCoordMap2[dataItem.name];
var fromCoord = gps; //郑州
// var toCoord = geoGps[Math.random()*3];
if (fromCoord && toCoord) {
if (t == 1) {
res.push([{
coord: toCoord,
}, {
coord: fromCoord,
value: dataItem.value
}]);
} else {
res.push([{
coord: fromCoord,
value: dataItem.value
}, {
coord: toCoord,
}]);
}
}
}
if (t == 0) {
t = 1;
} else {
t = 1;
}
return res;
};
optionXyMap01 = {
timeline: {
data: year,
axisType: 'category',
autoPlay: false,
playInterval: 5000,
left: '10%',
right: '10%',
bottom: '3%',
width: '80%',
//height: null,
//设定现实不现实时间轴的参数
show: false,
label: {
normal: {
textStyle: {
color: '#ddd'
}
},
emphasis: {
textStyle: {
color: '#fff'
}
}
},
symbolSize: 10,
lineStyle: {
color: '#555'
},
checkpointStyle: {
borderColor: '#777',
borderWidth: 2
},
controlStyle: {
showNextBtn: true,
showPrevBtn: true,
normal: {
color: '#666',
borderColor: '#666'
},
emphasis: {
color: '#aaa',
borderColor: '#aaa'
}
},
},
baseOption: {
animation: true,
animationDuration: 1000,
animationEasing: 'cubicInOut',
animationDurationUpdate: 1000,
animationEasingUpdate: 'cubicInOut',
grid: {
right: '2%',
top: '12%',
bottom: '12%',
width: '18%'
},
backgroundColor: '#2c343c',
tooltip: {
trigger: 'axis', // hover触发器
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow', // 默认为直线,可选为:'line' | 'shadow'
shadowStyle: {
color: 'rgba(150,150,150,0.1)' //hover颜色
}
}
},
visualMap: {
min: 0,
max: 150,
left: 'left',
top: 'bottom',
text: ['高', '低'],
textStyle: {
color: 'white'
},
calculable: true,
colorLightness: [0.8, 100],
color: ['#c05050', '#e5cf0d', '#5ab1ef'],
dimension: 0,
},
geo: {
show: true,
map: 'global',
roam: true,
zoom: 1,
center: [113.83531246, 34.0267395887],
label: {
emphasis: {
show: true
}
},
itemStyle: {
normal: {
borderColor: 'rgba(147, 235, 248, 1)',
borderWidth: 1,
areaColor: {
type: 'radial',
x: 0.5,
y: 0.5,
r: 0.8,
colorStops: [{
offset: 0,
color: 'rgba(147, 235, 248, 0)' // 0% 处的颜色
}, {
offset: 1,
color: 'rgba(147, 235, 248, .2)' // 100% 处的颜色
}],
globalCoord: false // 缺省为 false
},
shadowColor: 'rgba(128, 217, 248, 1)',
// shadowColor: 'rgba(255, 255, 255, 1)',
shadowOffsetX: -2,
shadowOffsetY: 2,
shadowBlur: 10
},
emphasis: {
areaColor: '#389BB7',
borderWidth: 0
}
}
},
},
options: []
};
for (var n = 0; n < year.length; n++) {
var statistic_name = "各省" + "数量";
optionXyMap01.options.push({
title:
[{
text: '总采样数据流向图',
//subtext: ' ',
left: '11%',
top: '1%',
textStyle: {
color: '#fff',
fontSize: 25
}
},
{
id: 'statistic',
text: statistic_name,
left: '75%',
top: '3%',
textStyle: {
color: '#fff',
fontSize: 16
}
}
],
xAxis: {
type: 'value',
scale: true,
position: 'top',
min: 0,
boundaryGap: false,
splitLine: {
show: false
},
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
margin: 1,
textStyle: {
color: '#aaa'
}
},
},
yAxis: {
type: 'category',
// name: 'TOP 20',
nameGap: 16,
axisLine: {
show: true,
lineStyle: {
color: '#ddd'
}
},
axisTick: {
show: false,
lineStyle: {
color: '#ddd'
}
},
axisLabel: {
interval: 0,
textStyle: {
color: '#ddd'
}
},
data: categoryData[n]
},
series: [
//未知作用
{
//文字和标志
name: 'light',
type: 'scatter',
coordinateSystem: 'geo',
data: convertData(mapData[n]),
symbolSize: function (val) {
return 6;
},
label: {
normal: {
formatter: '{b}',
position: 'right',
show: true
},
emphasis: {
show: true
}
},
itemStyle: {
normal: {
color: colors[n]
}
}
},
//地图?
{
type: 'map',
map: 'global',
geoIndex: 0,
aspectScale: 1, //长宽比
showLegendSymbol: false, // 存在legend时显示
label: {
normal: {
show: false
},
emphasis: {
show: false,
textStyle: {
color: '#fff'
}
}
},
roam: true,
itemStyle: {
normal: {
areaColor: '#031525',
borderColor: '#FFFFFF',
},
emphasis: {
areaColor: '#2B91B7'
}
},
animation: false,
data: mapData
},
//地图点的动画效果
{
// name: 'Top 5',
type: 'effectScatter',
coordinateSystem: 'geo',
data: convertData(mapData[n].sort(function (a, b) {
return b.value - a.value;
}).slice(0, 20)),
symbolSize: function (val) {
return 5;
},
showEffectOn: 'render',
rippleEffect: {
brushType: 'stroke'
},
hoverAnimation: true,
label: {
normal: {
formatter: '{b}',
position: 'right',
show: true
}
},
itemStyle: {
normal: {
color: colors[colorIndex][n],
shadowBlur: 10,
shadowColor: colors[colorIndex][n]
}
},
zlevel: 1
},
//地图线的动画效果
{
type: 'lines',
zlevel: 2,
effect: {
show: true,
period: 5, //箭头指向速度,值越小速度越快
trailLength: 0.2, //特效尾迹长度[0,1]值越大,尾迹越长重
symbol: 'arrow', //箭头图标
symbolSize: 6, //图标大小
},
lineStyle: {
normal: {
color: colors[colorIndex][n],
width: 1, //尾迹线条宽度
opacity: 0.2, //尾迹线条透明度
curveness: .3 //尾迹线条曲直度
}
},
data: convertToLineData(mapData[n], geoGpsMap)
},
//柱状图
{
zlevel: 1.5,
type: 'bar',
barMaxWidth: 8,
symbol: 'none',
itemStyle: {
normal: {
color: colors[colorIndex][n],
barBorderRadius: [0, 30, 30, 0]
}
},
data: barData[n]
}
]
});
if (r == 0) {
r = 1;
} else {
r = 0;
}
}
myChart.setOption(optionXyMap01);
}
</script>
<style>
.el-drawer {
height: 500px;
}
</style>