@ibiz-template/vue3-components 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +4 -4
- package/dist/index.system.min.js.map +1 -1
- package/dist/map-chart-wwfitHK_.js +2 -0
- package/dist/map-chart-wwfitHK_.js.map +1 -0
- package/es/common/data-import/data-import.css +1 -0
- package/es/common/data-import/data-import.d.ts +34 -0
- package/es/common/data-import/data-import.mjs +147 -0
- package/es/common/index.d.ts +1 -0
- package/es/common/index.mjs +9 -0
- package/es/common/map-chart/map-chart.css +1 -0
- package/es/common/map-chart/map-chart.d.ts +119 -0
- package/es/common/map-chart/map-chart.mjs +215 -0
- package/es/common/map-chart/map-chart.util.d.ts +24 -0
- package/es/common/map-chart/map-chart.util.mjs +25 -0
- package/es/common/map-chart/map-json.d.ts +1 -0
- package/es/common/map-chart/map-json.mjs +9 -0
- package/es/common/map-chart/map-manager.d.ts +20 -0
- package/es/common/map-chart/map-manager.mjs +122 -0
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-container/form-mdctrl-container.css +1 -1
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-container/form-mdctrl-container.d.ts +1 -1
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-container/form-mdctrl-container.mjs +4 -4
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-data-view/form-mdctrl-data-view.mjs +1 -1
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-form/form-mdctrl-form.mjs +1 -1
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-grid/form-mdctrl-grid.mjs +1 -1
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-list/form-mdctrl-list.mjs +1 -1
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form-shell.mjs +1 -1
- package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-grid/form-mdctrl-repeater-grid.mjs +1 -1
- package/es/control/index.d.ts +1 -0
- package/es/control/index.mjs +1 -0
- package/es/control/map/index.d.ts +5 -0
- package/es/control/map/index.mjs +13 -0
- package/es/control/map/map.css +1 -0
- package/es/control/map/map.d.ts +74 -0
- package/es/control/map/map.mjs +78 -0
- package/es/control/map/map.provider.d.ts +13 -0
- package/es/control/map/map.provider.mjs +14 -0
- package/es/index.mjs +4 -2
- package/es/panel-component/multi-data-container/multi-data-container-item.controller.d.ts +2 -0
- package/es/panel-component/multi-data-container/multi-data-container-item.controller.mjs +12 -1
- package/es/panel-component/multi-data-container/multi-data-container.controller.d.ts +1 -0
- package/es/panel-component/multi-data-container/multi-data-container.controller.mjs +8 -3
- package/es/panel-component/panel-field/panel-field.controller.mjs +3 -8
- package/es/panel-component/single-data-container/single-data-container.controller.d.ts +8 -0
- package/es/panel-component/single-data-container/single-data-container.controller.mjs +16 -3
- package/es/view-engine/login-view.engine.d.ts +2 -0
- package/es/view-engine/login-view.engine.mjs +19 -0
- package/lib/common/data-import/data-import.cjs +149 -0
- package/lib/common/data-import/data-import.css +1 -0
- package/lib/common/index.cjs +9 -0
- package/lib/common/map-chart/map-chart.cjs +220 -0
- package/lib/common/map-chart/map-chart.css +1 -0
- package/lib/common/map-chart/map-chart.util.cjs +28 -0
- package/lib/common/map-chart/map-json.cjs +11 -0
- package/lib/common/map-chart/map-manager.cjs +124 -0
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-container/form-mdctrl-container.cjs +3 -3
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-container/form-mdctrl-container.css +1 -1
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-data-view/form-mdctrl-data-view.cjs +1 -1
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-form/form-mdctrl-form.cjs +1 -1
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-grid/form-mdctrl-grid.cjs +1 -1
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-list/form-mdctrl-list.cjs +1 -1
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-form/form-mdctrl-repeater-form-shell.cjs +1 -1
- package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/form-mdctrl-repeater-grid/form-mdctrl-repeater-grid.cjs +1 -1
- package/lib/control/index.cjs +2 -0
- package/lib/control/map/index.cjs +18 -0
- package/lib/control/map/map.cjs +82 -0
- package/lib/control/map/map.css +1 -0
- package/lib/control/map/map.provider.cjs +16 -0
- package/lib/index.cjs +53 -50
- package/lib/panel-component/multi-data-container/multi-data-container-item.controller.cjs +12 -1
- package/lib/panel-component/multi-data-container/multi-data-container.controller.cjs +7 -2
- package/lib/panel-component/panel-field/panel-field.controller.cjs +3 -8
- package/lib/panel-component/single-data-container/single-data-container.controller.cjs +15 -2
- package/lib/view-engine/login-view.engine.cjs +19 -0
- package/package.json +12 -12
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
System.register(["vue","ramda","@ibiz-template/vue3-util","echarts"],function($){"use strict";var g,x,k,M,S,z,v,w,I,T,B,A,F;return{setters:[function(n){g=n.ref,x=n.onMounted,k=n.defineComponent,M=n.computed,S=n.toRefs,z=n.watch,v=n.createVNode,w=n.createTextVNode},function(n){I=n.mergeDeepWithKey,T=n.isNil},function(n){B=n.useNamespace},function(n){A=n.init,F=n.registerMap}],execute:function(){const R={strAreaCode:!1,visualMap:{text:["\u9AD8","\u4F4E"],min:0,max:100,rangeColor:["#90d1e7","#fff600","#ff5200"]},pointSymbol:"pin",jsonBaseUrl:"/assets/json/map",defaultAreaCode:1e5};async function j(r,d){return(await ibiz.net.axios({url:`${r}/${d}.json`})).data}function E(r,d,h){const l=new Map,s=g(""),f=g([]);let i;const m=g(),D=e=>{const t={cityNames:{},noChild:e.features.length===1};return e.features.forEach(o=>{const{adcode:p,name:C}=o.properties;t.cityNames[p]=C}),t},_=async e=>{if(l.has(e))return;const t=await j(r.value.jsonBaseUrl,e);l.set(e,D(t)),F(e,t)},N=e=>{const t=l.get(s.value);if(t)return t.cityNames[e]},b=()=>{if(s.value){const e=d(s.value);i.setOption(e),i.resize()}},y=async(e,t=!1)=>{t||h("mapChange",{areaCode:r.value.strAreaCode?`${e}`:Number(e)});const o=`${e}`;l.has(o)||await _(o),s.value=o,f.value.push(o),b()},c=()=>{if(f.value.length>1){f.value.pop();const e=f.value.pop();y(e)}};return x(()=>{i=A(m.value),window.addEventListener("resize",()=>{i?.resize()}),i.on("click",e=>{if(e.componentType==="series"){if(e.seriesType==="scatter"){h("pointClick",e.data);return}if(e.seriesType==="map"&&(e.data&&h("areaClick",e.data),e.name!==s.value)){debugger;y(e.name)}}}),i.on("mouseover",function(e){if(e.componentType==="series"&&e.seriesType==="scatter"){const t=e.dataIndex,o=i.getOption(),p=o.series[e.seriesIndex].data,C=o.series[e.seriesIndex].symbolSize;p[t].symbolSize=C+10,i.setOption(o)}}),i.on("mouseout",function(e){if(e.componentType==="series"&&e.seriesType==="scatter"){const t=e.dataIndex,o=i.getOption(),p=o.series[e.seriesIndex].data;delete p[t].symbolSize,i.setOption(o)}})}),{chartRef:m,historyNames:f,currentName:s,changeMap:y,getCityName:N,goBack:c,refresh:b}}const O=k({name:"IBizMapChart",props:{areaData:{type:Array},pointData:{type:Array},options:{type:Object,default:()=>({})}},setup(r,{emit:d}){const h=B("map-chart"),l=M(()=>I((c,e,t)=>T(t)?e:t,R,r.options)),s=(c,e)=>{if(e==="area"&&r.areaData)return r.areaData.find(t=>t._id===c);if(e==="point"&&r.pointData)return r.pointData.find(t=>t._id===c)},{chartRef:f,historyNames:i,changeMap:m,getCityName:D,goBack:_,refresh:N}=E(l,c=>{const{visualMap:e,pointSymbol:t}=l.value,o=r.areaData||[],p=r.pointData||[];return{geo:{map:c},tooltip:{trigger:"item",textStyle:{color:"#fff",fontSize:12},backgroundColor:"rgba(0, 0, 0, 0.47)",borderWidth:0,extraCssText:"backdrop-filter: blur(3px);"},visualMap:{min:e.min,max:e.max,text:e.text,realtime:!1,hoverLink:!1,inRange:{color:e.rangeColor}},series:[{type:"map",map:c,nameProperty:"adcodeStr",itemStyle:{borderColor:"#FFF",borderWidth:2},tooltip:{formatter:a=>{if(!a.data)return;const u=s(a.data._id,"area");if(u)return u._tooltip}},label:{show:!0,color:"#000000",fontSize:14,formatter:a=>D(a.name)},select:{disabled:!0},data:o.map(a=>({name:`${a._areaCode}`,value:a._value,_id:a._id}))},{type:"scatter",coordinateSystem:"geo",symbol:t,symbolSize:20,visualMap:!1,itemStyle:{color:"#FF1D00"},label:{show:!0,color:"#000000",fontSize:14,textShadowBlur:0,formatter:a=>{const u=s(a.data._id,"point");return u?._text},position:"left",offset:[10,-15]},tooltip:{formatter:a=>{const u=s(a.data._id,"point");return u?._tooltip}},data:p.map(a=>({_id:a._id,symbol:a._symbol?`image://${a._symbol}`:void 0,value:[Number(a._longitude),Number(a._latitude)],visualMap:!1}))}]}},(c,e)=>{switch(c){case"mapChange":d("mapChange",e);break;case"pointClick":d("pointClick",{data:s(e._id,"point")});break;case"areaClick":d("areaClick",{data:s(e._id,"area")});break}});x(()=>{m(l.value.defaultAreaCode,!0)});const{areaData:b,pointData:y}=S(r);return z([b,y],()=>{N()}),{ns:h,chartRef:f,historyNames:i,goBack:_}},render(){return v("div",{class:this.ns.b()},[v("div",{class:this.ns.e("chart"),ref:"chartRef"},null),this.historyNames.length>1&&v("div",{class:this.ns.e("goback"),onClick:()=>{this.goBack()}},[w("\u8FD4\u56DE")])])}});$({IBizMapChart:O,default:O})}}});
|
|
2
|
+
//# sourceMappingURL=map-chart-wwfitHK_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-chart-wwfitHK_.js","sources":["../src/common/map-chart/map-chart.util.ts","../src/common/map-chart/map-json.ts","../src/common/map-chart/map-manager.ts","../src/common/map-chart/map-chart.tsx"],"sourcesContent":["/** 渐变颜色集合 */\nexport const GradientColors = ['#90d1e7', '#fff600', '#ff5200'];\n\nexport const defaultOpts = {\n /** true地图code标识使用字符串,false使用数字 */\n strAreaCode: false,\n /** 热力图配置 */\n visualMap: {\n /** 两端的文本,如 ['高', '低'] */\n text: ['高', '低'],\n /** 底部代表的值 */\n min: 0,\n /** 顶部代表的值 */\n max: 100,\n /** 热力图渐变颜色数组 */\n rangeColor: GradientColors,\n },\n /** 点图标 */\n pointSymbol: 'pin',\n /** 地图json数据基础路径 */\n jsonBaseUrl: '/assets/json/map',\n /** 默认打开的区域编码 */\n defaultAreaCode: 100000 as string | number,\n};\n\nexport type MapOptions = typeof defaultOpts;\n","export async function getJsonUrl(\n baseUrl: string,\n code: string | number,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): Promise<any> {\n const res = await ibiz.net.axios({\n url: `${baseUrl}/${code}.json`,\n });\n return res.data;\n}\n","/* eslint-disable no-unused-vars */\nimport { registerMap as register, EChartsType, init } from 'echarts';\nimport { ComputedRef, onMounted, ref } from 'vue';\nimport { MapOptions } from './map-chart.util';\nimport { getJsonUrl } from './map-json';\n\n/**\n * 使用echarts地图\n * @author lxm\n * @date 2023-04-06 12:00:07\n * @export\n * @param {(name: string) => IData} calcEchartsOpts 计算echarts的Options\n * @param {(name: string, e: IData) => void} emit 事件回调\n * @return {*}\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function useMapManager(\n opts: ComputedRef<MapOptions>,\n calcEchartsOpts: (name: string) => IData,\n emit: (name: string, e: IData) => void,\n) {\n const mapInfos = new Map<string, IData>();\n\n const currentName = ref<string>('');\n\n const historyNames = ref<string[]>([]);\n\n let chart: EChartsType;\n const chartRef = ref();\n\n const parseJson = (json: IData) => {\n const info: IData = {\n cityNames: {},\n noChild: json.features.length === 1,\n };\n json.features.forEach((item: IData) => {\n const { adcode, name } = item.properties;\n info.cityNames[adcode] = name;\n });\n return info;\n };\n\n const registerMap = async (name: string) => {\n if (mapInfos.has(name)) {\n return;\n }\n const json = await getJsonUrl(opts.value.jsonBaseUrl, name);\n mapInfos.set(name, parseJson(json));\n register(name, json);\n };\n\n const getCityName = (mapName: string | number) => {\n const info = mapInfos.get(currentName.value);\n if (info) {\n return info.cityNames[mapName];\n }\n };\n\n const refresh = () => {\n if (currentName.value) {\n const options = calcEchartsOpts(currentName.value);\n chart.setOption(options);\n chart.resize();\n }\n };\n\n const changeMap = async (name: string | number, isInit: boolean = false) => {\n if (!isInit) {\n emit('mapChange', {\n areaCode: opts.value.strAreaCode ? `${name}` : Number(name),\n });\n }\n const strName = `${name}`;\n\n if (!mapInfos.has(strName)) {\n await registerMap(strName);\n }\n currentName.value = strName;\n historyNames.value.push(strName);\n refresh();\n };\n\n const goBack = () => {\n // 一个时只有当前的name,不能后退。\n if (historyNames.value.length > 1) {\n historyNames.value.pop(); // 先删除当前地图的name\n const name = historyNames.value.pop(); // 获取上一个地图的name\n changeMap(name!);\n }\n };\n\n onMounted(() => {\n chart = init(chartRef.value);\n\n window.addEventListener('resize', () => {\n chart?.resize();\n });\n\n chart.on('click', params => {\n // 散点点击事件\n if (params.componentType === 'series') {\n if (params.seriesType === 'scatter') {\n emit('pointClick', params.data as IData);\n return;\n }\n if (params.seriesType === 'map') {\n if (params.data) {\n emit('areaClick', params.data as IData);\n }\n // 禁止切换同一个地图,到最下级的时候会出现这种情况\n if (params.name !== currentName.value) {\n debugger;\n changeMap(params.name);\n }\n }\n }\n });\n\n // 散点悬浮size变大\n chart.on('mouseover', function (params) {\n if (params.componentType === 'series') {\n if (params.seriesType === 'scatter') {\n const dataIndex = params.dataIndex;\n const option: IData = chart.getOption();\n const seriesData = option.series[params.seriesIndex!].data;\n const originSize = option.series[params.seriesIndex!].symbolSize;\n // 修改悬浮的数据点大小\n seriesData[dataIndex].symbolSize = originSize + 10;\n\n // 刷新图表\n chart.setOption(option);\n }\n }\n });\n chart.on('mouseout', function (params) {\n if (params.componentType === 'series') {\n if (params.seriesType === 'scatter') {\n const dataIndex = params.dataIndex;\n const option: IData = chart.getOption();\n const seriesData = option.series[params.seriesIndex!].data;\n\n // 恢复原始的数据点大小\n delete seriesData[dataIndex].symbolSize;\n\n // 刷新图表\n chart.setOption(option);\n }\n }\n });\n });\n\n return {\n chartRef,\n historyNames,\n currentName,\n changeMap,\n getCityName,\n goBack,\n refresh,\n };\n}\n","/* eslint-disable eqeqeq */\nimport {\n defineComponent,\n onMounted,\n PropType,\n computed,\n toRefs,\n watch,\n} from 'vue';\nimport { isNil, mergeDeepWithKey } from 'ramda';\nimport { useNamespace } from '@ibiz-template/vue3-util';\nimport { IMapData } from '@ibiz-template/runtime';\nimport { defaultOpts, MapOptions } from './map-chart.util';\nimport { useMapManager } from './map-manager';\nimport './map-chart.scss';\n\nexport const IBizMapChart = defineComponent({\n name: 'IBizMapChart',\n props: {\n areaData: {\n type: Array<IMapData>,\n },\n pointData: {\n type: Array<IMapData>,\n },\n options: {\n type: Object as PropType<Partial<MapOptions>>,\n default: () => ({}),\n },\n },\n setup(props, { emit }) {\n const ns = useNamespace('map-chart');\n const options = computed(() => {\n // 后一个的undefined不覆盖\n return mergeDeepWithKey(\n (_key, x, z) => {\n return isNil(z) ? x : z;\n },\n defaultOpts,\n props.options,\n );\n });\n\n const findData = (id: string, type: 'area' | 'point') => {\n if (type === 'area' && props.areaData) {\n return props.areaData.find(item => item._id === id);\n }\n if (type === 'point' && props.pointData) {\n return props.pointData.find(item => item._id === id);\n }\n };\n\n const { chartRef, historyNames, changeMap, getCityName, goBack, refresh } =\n useMapManager(\n options,\n mapName => {\n const { visualMap, pointSymbol } = options.value;\n const areaData = props.areaData || [];\n const pointData = props.pointData || [];\n\n const result: IData = {\n geo: {\n map: mapName,\n },\n tooltip: {\n trigger: 'item',\n // 全局的tooltip样式\n textStyle: {\n color: '#fff',\n fontSize: 12,\n },\n backgroundColor: 'rgba(0, 0, 0, 0.47)',\n borderWidth: 0,\n extraCssText: 'backdrop-filter: blur(3px);',\n },\n visualMap: {\n min: visualMap.min,\n max: visualMap.max,\n text: visualMap.text,\n realtime: false,\n hoverLink: false,\n inRange: {\n color: visualMap.rangeColor,\n },\n },\n series: [\n // 地图区块序列\n {\n type: 'map',\n map: mapName,\n // 地图JSON里和name匹配的属性名称\n nameProperty: 'adcodeStr',\n itemStyle: {\n borderColor: '#FFF',\n borderWidth: 2,\n },\n tooltip: {\n formatter: (params: IData) => {\n if (!params.data) {\n // 没有数据的时候不显示tooltip\n return;\n }\n const find = findData(params.data._id, 'area')!;\n if (!find) {\n return;\n }\n return find._tooltip;\n },\n },\n label: {\n // 区块文字固定显示\n show: true,\n // 字体样式\n color: '#000000',\n fontSize: 14,\n formatter: (params: IData) => {\n return getCityName(params.name);\n },\n },\n select: {\n disabled: true,\n },\n data: areaData.map(item => ({\n name: `${item._areaCode}`,\n value: item._value,\n _id: item._id,\n })),\n },\n // 地图散点序列\n {\n type: 'scatter',\n coordinateSystem: 'geo',\n symbol: pointSymbol,\n symbolSize: 20,\n visualMap: false,\n itemStyle: {\n color: '#FF1D00',\n },\n label: {\n show: true,\n // 字体样式\n color: '#000000',\n fontSize: 14,\n textShadowBlur: 0,\n formatter: (params: IData) => {\n const find = findData(params.data._id, 'point')!;\n return find?._text;\n },\n // 偏移\n position: 'left',\n offset: [10, -15],\n },\n tooltip: {\n formatter: (params: IData) => {\n const find = findData(params.data._id, 'point')!;\n return find?._tooltip;\n },\n },\n data: pointData.map(item => {\n return {\n _id: item._id,\n symbol: item._symbol\n ? `image://${item._symbol}`\n : undefined,\n value: [Number(item._longitude), Number(item._latitude)],\n // 每个点逃离visualMap\n visualMap: false,\n };\n }),\n },\n ],\n };\n return result;\n },\n (name, e) => {\n switch (name) {\n case 'mapChange':\n emit('mapChange', e);\n break;\n case 'pointClick':\n emit('pointClick', { data: findData(e._id, 'point') });\n break;\n case 'areaClick':\n emit('areaClick', { data: findData(e._id, 'area') });\n break;\n default:\n break;\n }\n },\n );\n\n onMounted(() => {\n changeMap(options.value.defaultAreaCode, true);\n });\n\n const { areaData, pointData } = toRefs(props);\n watch([areaData, pointData], () => {\n refresh();\n });\n\n return { ns, chartRef, historyNames, goBack };\n },\n render() {\n return (\n <div class={this.ns.b()}>\n <div class={this.ns.e('chart')} ref='chartRef'></div>\n {this.historyNames.length > 1 && (\n <div\n class={this.ns.e('goback')}\n onClick={() => {\n this.goBack();\n }}\n >\n 返回\n </div>\n )}\n </div>\n );\n },\n});\n\nexport default IBizMapChart;\n"],"names":["defaultOpts","getJsonUrl","baseUrl","code","useMapManager","opts","calcEchartsOpts","emit","mapInfos","currentName","ref","historyNames","chart","chartRef","parseJson","json","info","item","adcode","name","registerMap","register","getCityName","mapName","refresh","options","changeMap","isInit","strName","goBack","onMounted","init","params","dataIndex","option","seriesData","originSize","IBizMapChart","defineComponent","props","areaData","type","Array","pointData","Object","default","setup","ns","useNamespace","computed","mergeDeepWithKey","_key","x","z","findData","id","visualMap","pointSymbol","areaData2","geo","map","tooltip","textStyle","color","fontSize","backgroundColor","borderWidth","extraCssText","min","max","text","realtime","hoverLink","inRange","nameProperty","itemStyle","borderColor","find","label","show","select","disabled","coordinateSystem","symbol","symbolSize","textShadowBlur","position","offset","pointData2","_id","value","e","data","watch","toRefs","render","_createVNode","_createTextVNode","exports"],"mappings":"6YAEO,MAAMA,EAAc,CAEzB,YAAa,GAEb,UAAW,CAET,KAAM,CAAC,SAAU,QAAQ,EAEzB,IAAK,EAEL,IAAK,IAEL,WAb0B,CAAC,UAAW,UAAW,SAAS,CAc3D,EAED,YAAa,MAEb,YAAa,mBAEb,gBAAiB,GACnB,ECrBO,eAAeC,EAAWC,EAASC,EAAM,CAI9C,OAHY,MAAM,KAAK,IAAI,MAAM,CAC/B,IAAK,GAAGD,CAAO,IAAIC,CAAI,OAC3B,CAAG,GACU,IACb,CCFO,SAASC,EAAcC,EAAMC,EAAiBC,EAAM,CACzD,MAAMC,EAA2B,IAAI,IAC/BC,EAAcC,EAAI,EAAE,EACpBC,EAAeD,EAAI,CAAA,CAAE,EAC3B,IAAIE,EACJ,MAAMC,EAAWH,IACXI,EAAaC,GA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AAAA,EAAanD,CAAA,EAAA,IAAA,CAC7CkD,GACErE,CAAAA,EACA,CAEK,GAAAuB,EAAEA,SAAAA,EAAIlC,aAAAA,EAAUF,OAAAA,CAAckB,GACvC,QAAC,CACDkE,OAASC,EAAA,MAAA,CACP,MAAA,KAAA,GAAA,EAAA,CAAA,EAAA,CAAAA,EACqB,MAAG,CAAC,MAAA,KAAA,GAAA,EAAA,OAAA,EAAA,IAAA,UACS,EAAA,IAAA,EAAA,KAAA,aAAA,OAAA,GAAAA,EAAA,MAAA,CAC7B,MAAA,KAAiB,GAAA,EAAA,UAAW,YAEVL,CAAW,KAAA,OACX,EAEf,EAAA,CAAAM,EAAA,cAAA,CAAA,CAAA,CAAA,CAAA,CAAC,CAOX,CAAA,EAAAC,EAAA,CAAA,aAAA7D,EAAA,QAAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-data-import{display:flex;flex-flow:column nowrap;width:544px;height:368px;padding:20px;background:var(--ibiz-color-bg-1)}.ibiz-data-import__caption{margin-bottom:16px;font-size:var(--ibiz-font-size-large);font-weight:600;color:var(--ibiz-text-color)}.ibiz-data-import__template-container{padding:16px 12px 0;margin-bottom:16px}.ibiz-data-import__template-link{color:#57a3fd;cursor:pointer}.ibiz-data-import__link-icon{height:19px;margin-right:2px;vertical-align:bottom}.ibiz-data-import__button-bar{margin-right:20px;text-align:right}.ibiz-data-import__button-bar .ivu-btn{margin-left:8px}.ibiz-data-import-upload{display:flex;flex-flow:column nowrap;align-items:center;justify-content:center;flex-grow:1;cursor:pointer;background:var(--ibiz-color-bg-1);border:1px dashed var(--ibiz-color-border);border-radius:4px}.ibiz-data-import-upload__img{width:50px;height:50px;margin-bottom:20px}.ibiz-data-import-message{display:flex;flex-flow:column nowrap;flex-grow:1;padding:8px 16px;overflow:auto;cursor:pointer;background:var(--ibiz-color-bg-1);border:1px dashed var(--ibiz-color-border);border-radius:4px}.ibiz-data-import-message__title{font-size:var(--ibiz-font-size-medium);font-weight:600}.ibiz-data-import-message__content{padding-left:16px}.ibiz-data-import-message__content.is-error{color:var(--ibiz-color-danger)}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IAppDataEntity } from '@ibiz/model-core';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
import './data-import.scss';
|
|
4
|
+
export declare const DataImport: import("vue").DefineComponent<{
|
|
5
|
+
dismiss: {
|
|
6
|
+
type: PropType<() => void>;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
appDataEntity: {
|
|
10
|
+
type: PropType<IAppDataEntity>;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
}, {
|
|
14
|
+
ns: import("@ibiz-template/core").Namespace;
|
|
15
|
+
onLinkClick: () => Promise<void>;
|
|
16
|
+
selectFile: () => void;
|
|
17
|
+
onCancelButtonClick: () => void;
|
|
18
|
+
onFileChange: ($event: Event) => Promise<void>;
|
|
19
|
+
inputUpLoad: import("vue").Ref<any>;
|
|
20
|
+
isLoading: import("vue").Ref<boolean>;
|
|
21
|
+
message: import("vue").Ref<{
|
|
22
|
+
state: 'ready' | 'over' | 'error';
|
|
23
|
+
message: string;
|
|
24
|
+
}>;
|
|
25
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26
|
+
dismiss: {
|
|
27
|
+
type: PropType<() => void>;
|
|
28
|
+
required: true;
|
|
29
|
+
};
|
|
30
|
+
appDataEntity: {
|
|
31
|
+
type: PropType<IAppDataEntity>;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
}>>, {}, {}>;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { ref, createVNode, createTextVNode, resolveComponent, resolveDirective, withDirectives, defineComponent } from 'vue';
|
|
2
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
3
|
+
import './data-import.css';
|
|
4
|
+
import { asyncImportData, importData } from '@ibiz-template/runtime';
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
const DataImport = /* @__PURE__ */ defineComponent({
|
|
8
|
+
name: "DataImport",
|
|
9
|
+
props: {
|
|
10
|
+
dismiss: {
|
|
11
|
+
type: Function,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
appDataEntity: {
|
|
15
|
+
type: Object,
|
|
16
|
+
required: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
setup(props) {
|
|
20
|
+
const ns = useNamespace("data-import");
|
|
21
|
+
const inputUpLoad = ref();
|
|
22
|
+
const message = ref({
|
|
23
|
+
state: "ready",
|
|
24
|
+
message: ""
|
|
25
|
+
});
|
|
26
|
+
const isLoading = ref(false);
|
|
27
|
+
const onFileChange = async ($event) => {
|
|
28
|
+
const obj = $event.target;
|
|
29
|
+
if (!obj.files) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const selectedFile = obj.files[0];
|
|
33
|
+
obj.value = null;
|
|
34
|
+
let result;
|
|
35
|
+
isLoading.value = true;
|
|
36
|
+
try {
|
|
37
|
+
if (ibiz.env.enableMqtt) {
|
|
38
|
+
result = await asyncImportData(selectedFile, props.appDataEntity);
|
|
39
|
+
} else {
|
|
40
|
+
result = await importData(selectedFile, props.appDataEntity);
|
|
41
|
+
}
|
|
42
|
+
ibiz.mc.command.send({
|
|
43
|
+
srfdecodename: props.appDataEntity.codeName
|
|
44
|
+
}, "OBJECTCREATED");
|
|
45
|
+
const {
|
|
46
|
+
success,
|
|
47
|
+
total,
|
|
48
|
+
message: _message
|
|
49
|
+
} = result;
|
|
50
|
+
const totalNum = total ? Number(total) : 0;
|
|
51
|
+
const successNum = success ? Number(success) : 0;
|
|
52
|
+
const errorNum = total - success;
|
|
53
|
+
message.value.state = _message ? "error" : "over";
|
|
54
|
+
message.value.message = _message || `\u5171\u8BA1\u5BFC\u5165\u6570\u636E ${totalNum} \u6761\uFF0C\u9519\u8BEF[${errorNum}]\uFF0C\u6210\u529F[${successNum}]`;
|
|
55
|
+
} finally {
|
|
56
|
+
isLoading.value = false;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const onLinkClick = async () => {
|
|
60
|
+
var _a;
|
|
61
|
+
const templateUrl = `${props.appDataEntity.codeName2.toLowerCase()}/importtemplate`;
|
|
62
|
+
const res = await ibiz.net.request(templateUrl, {
|
|
63
|
+
responseType: "blob"
|
|
64
|
+
});
|
|
65
|
+
if (res.status === 200) {
|
|
66
|
+
let fileName = ((_a = res.headers["content-disposition"].split(";").find((str) => str.indexOf("filename=") !== -1)) == null ? void 0 : _a.slice(9)) || "";
|
|
67
|
+
fileName = decodeURIComponent(fileName);
|
|
68
|
+
const blob = new Blob([res.data], {
|
|
69
|
+
type: "application/vnd.ms-excel"
|
|
70
|
+
});
|
|
71
|
+
const elink = document.createElement("a");
|
|
72
|
+
elink.download = fileName;
|
|
73
|
+
elink.style.display = "none";
|
|
74
|
+
elink.href = URL.createObjectURL(blob);
|
|
75
|
+
document.body.appendChild(elink);
|
|
76
|
+
elink.click();
|
|
77
|
+
URL.revokeObjectURL(elink.href);
|
|
78
|
+
document.body.removeChild(elink);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const selectFile = () => {
|
|
82
|
+
inputUpLoad.value.click();
|
|
83
|
+
};
|
|
84
|
+
const onCancelButtonClick = () => {
|
|
85
|
+
props.dismiss();
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
ns,
|
|
89
|
+
onLinkClick,
|
|
90
|
+
selectFile,
|
|
91
|
+
onCancelButtonClick,
|
|
92
|
+
onFileChange,
|
|
93
|
+
inputUpLoad,
|
|
94
|
+
isLoading,
|
|
95
|
+
message
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
render() {
|
|
99
|
+
return withDirectives(createVNode("div", {
|
|
100
|
+
"class": this.ns.b()
|
|
101
|
+
}, [createVNode("input", {
|
|
102
|
+
"ref": "inputUpLoad",
|
|
103
|
+
"type": "file",
|
|
104
|
+
"style": "display: none",
|
|
105
|
+
"accept": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
106
|
+
"onChange": this.onFileChange
|
|
107
|
+
}, null), createVNode("div", {
|
|
108
|
+
"class": this.ns.e("caption")
|
|
109
|
+
}, [createTextVNode("\u5BFC\u5165\u6570\u636E")]), this.message.state === "ready" ? createVNode("div", {
|
|
110
|
+
"class": this.ns.b("upload"),
|
|
111
|
+
"onClick": this.selectFile
|
|
112
|
+
}, [createVNode("img", {
|
|
113
|
+
"class": this.ns.be("upload", "img"),
|
|
114
|
+
"src": "./assets/images/icon-import.svg"
|
|
115
|
+
}, null), createVNode("span", {
|
|
116
|
+
"class": this.ns.be("upload", "text")
|
|
117
|
+
}, [createTextVNode("\u5355\u51FB\u6B64\u533A\u57DF\u8FDB\u884C\u4E0A\u4F20")])]) : createVNode("div", {
|
|
118
|
+
"class": [this.ns.b("message")]
|
|
119
|
+
}, [createVNode("div", {
|
|
120
|
+
"class": this.ns.be("message", "title")
|
|
121
|
+
}, [createTextVNode("\u5BFC\u5165\u7ED3\u679C")]), createVNode("div", {
|
|
122
|
+
"class": [this.ns.be("message", "content"), this.ns.is("error", this.message.state === "error")]
|
|
123
|
+
}, [this.message.message])]), createVNode("div", {
|
|
124
|
+
"class": this.ns.e("template-container")
|
|
125
|
+
}, [createVNode("div", {
|
|
126
|
+
"class": this.ns.e("template-description")
|
|
127
|
+
}, [createTextVNode("\u4E0B\u8F7D\u5BFC\u5165\u6A21\u7248\uFF0C\u5E76\u6309\u8981\u6C42\u586B\u5199\uFF1A")]), createVNode("div", {
|
|
128
|
+
"class": this.ns.e("template-link"),
|
|
129
|
+
"onClick": this.onLinkClick
|
|
130
|
+
}, [createVNode("ion-icon", {
|
|
131
|
+
"class": this.ns.e("link-icon"),
|
|
132
|
+
"name": "link"
|
|
133
|
+
}, null), this.appDataEntity.logicName, createTextVNode("\u6570\u636E\u5BFC\u5165\u6A21\u677F\u6587\u4EF6")])]), createVNode("div", {
|
|
134
|
+
"class": this.ns.e("button-bar")
|
|
135
|
+
}, [createVNode(resolveComponent("el-button"), {
|
|
136
|
+
"onClick": this.onCancelButtonClick
|
|
137
|
+
}, {
|
|
138
|
+
default: () => [createTextVNode("\u53D6\u6D88")]
|
|
139
|
+
}), this.message.state !== "ready" && createVNode(resolveComponent("el-button"), {
|
|
140
|
+
"onClick": this.selectFile
|
|
141
|
+
}, {
|
|
142
|
+
default: () => [createTextVNode("\u7EE7\u7EED\u5BFC\u5165")]
|
|
143
|
+
})])]), [[resolveDirective("loading"), this.isLoading]]);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
export { DataImport };
|
package/es/common/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from './control-loading-placeholder/control-loading-placeholder';
|
|
|
14
14
|
export * from './split/split';
|
|
15
15
|
export * from './split-trigger/split-trigger';
|
|
16
16
|
export * from './sort-bar/sort-bar';
|
|
17
|
+
export type { MapOptions } from './map-chart/map-chart.util';
|
|
17
18
|
export declare const IBizCommonComponents: {
|
|
18
19
|
install: (v: App) => void;
|
|
19
20
|
};
|
package/es/common/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { defineAsyncComponent } from 'vue';
|
|
1
2
|
import { IBizActionToolbar } from './action-toolbar/action-toolbar.mjs';
|
|
2
3
|
import { IBizCol } from './col/col.mjs';
|
|
3
4
|
import { IBizIcon } from './icon/icon.mjs';
|
|
@@ -15,6 +16,7 @@ import { IBizExtendActionTimeLine } from './extend-action-timeline/extend-action
|
|
|
15
16
|
import { ViewMessage } from './view-message/view-message.mjs';
|
|
16
17
|
import { IBizPagination } from './pagination/pagination.mjs';
|
|
17
18
|
import { IBizSortBar } from './sort-bar/sort-bar.mjs';
|
|
19
|
+
import { DataImport } from './data-import/data-import.mjs';
|
|
18
20
|
export { ControlLoadingPlaceholder } from './control-loading-placeholder/control-loading-placeholder.mjs';
|
|
19
21
|
|
|
20
22
|
"use strict";
|
|
@@ -37,6 +39,13 @@ const IBizCommonComponents = {
|
|
|
37
39
|
v.component(ViewMessage.name, ViewMessage);
|
|
38
40
|
v.component(IBizPagination.name, IBizPagination);
|
|
39
41
|
v.component(IBizSortBar.name, IBizSortBar);
|
|
42
|
+
v.component(DataImport.name, DataImport);
|
|
43
|
+
v.component(
|
|
44
|
+
"IBizMapChart",
|
|
45
|
+
defineAsyncComponent({
|
|
46
|
+
loader: () => import('./map-chart/map-chart.mjs')
|
|
47
|
+
})
|
|
48
|
+
);
|
|
40
49
|
}
|
|
41
50
|
};
|
|
42
51
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-map-chart{position:relative;min-width:300px;min-height:300px}.ibiz-map-chart__chart{width:100%;height:100%}.ibiz-map-chart__goback{position:absolute;top:60px;right:0;width:100px;height:100px;font-size:20px;color:#002a5f;text-decoration:underline;letter-spacing:6px;cursor:pointer}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { IMapData } from '@ibiz-template/runtime';
|
|
3
|
+
import './map-chart.scss';
|
|
4
|
+
export declare const IBizMapChart: import("vue").DefineComponent<{
|
|
5
|
+
areaData: {
|
|
6
|
+
type: {
|
|
7
|
+
(arrayLength: number): IMapData[];
|
|
8
|
+
(...items: IMapData[]): IMapData[];
|
|
9
|
+
new (arrayLength: number): IMapData[];
|
|
10
|
+
new (...items: IMapData[]): IMapData[];
|
|
11
|
+
isArray(arg: any): arg is any[];
|
|
12
|
+
readonly prototype: any[];
|
|
13
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
14
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
15
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
16
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
17
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
18
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
pointData: {
|
|
22
|
+
type: {
|
|
23
|
+
(arrayLength: number): IMapData[];
|
|
24
|
+
(...items: IMapData[]): IMapData[];
|
|
25
|
+
new (arrayLength: number): IMapData[];
|
|
26
|
+
new (...items: IMapData[]): IMapData[];
|
|
27
|
+
isArray(arg: any): arg is any[];
|
|
28
|
+
readonly prototype: any[];
|
|
29
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
30
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
31
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
32
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
33
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
34
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
options: {
|
|
38
|
+
type: PropType<Partial<{
|
|
39
|
+
strAreaCode: boolean;
|
|
40
|
+
visualMap: {
|
|
41
|
+
text: string[];
|
|
42
|
+
min: number;
|
|
43
|
+
max: number;
|
|
44
|
+
rangeColor: string[];
|
|
45
|
+
};
|
|
46
|
+
pointSymbol: string;
|
|
47
|
+
jsonBaseUrl: string;
|
|
48
|
+
defaultAreaCode: string | number;
|
|
49
|
+
}>>;
|
|
50
|
+
default: () => {};
|
|
51
|
+
};
|
|
52
|
+
}, {
|
|
53
|
+
ns: import("@ibiz-template/core").Namespace;
|
|
54
|
+
chartRef: import("vue").Ref<any>;
|
|
55
|
+
historyNames: import("vue").Ref<string[]>;
|
|
56
|
+
goBack: () => void;
|
|
57
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
58
|
+
areaData: {
|
|
59
|
+
type: {
|
|
60
|
+
(arrayLength: number): IMapData[];
|
|
61
|
+
(...items: IMapData[]): IMapData[];
|
|
62
|
+
new (arrayLength: number): IMapData[];
|
|
63
|
+
new (...items: IMapData[]): IMapData[];
|
|
64
|
+
isArray(arg: any): arg is any[];
|
|
65
|
+
readonly prototype: any[];
|
|
66
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
67
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
68
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
69
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
70
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
71
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
pointData: {
|
|
75
|
+
type: {
|
|
76
|
+
(arrayLength: number): IMapData[];
|
|
77
|
+
(...items: IMapData[]): IMapData[];
|
|
78
|
+
new (arrayLength: number): IMapData[];
|
|
79
|
+
new (...items: IMapData[]): IMapData[];
|
|
80
|
+
isArray(arg: any): arg is any[];
|
|
81
|
+
readonly prototype: any[];
|
|
82
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
83
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
84
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
85
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
86
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
87
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
options: {
|
|
91
|
+
type: PropType<Partial<{
|
|
92
|
+
strAreaCode: boolean;
|
|
93
|
+
visualMap: {
|
|
94
|
+
text: string[];
|
|
95
|
+
min: number;
|
|
96
|
+
max: number;
|
|
97
|
+
rangeColor: string[];
|
|
98
|
+
};
|
|
99
|
+
pointSymbol: string;
|
|
100
|
+
jsonBaseUrl: string;
|
|
101
|
+
defaultAreaCode: string | number;
|
|
102
|
+
}>>;
|
|
103
|
+
default: () => {};
|
|
104
|
+
};
|
|
105
|
+
}>>, {
|
|
106
|
+
options: Partial<{
|
|
107
|
+
strAreaCode: boolean;
|
|
108
|
+
visualMap: {
|
|
109
|
+
text: string[];
|
|
110
|
+
min: number;
|
|
111
|
+
max: number;
|
|
112
|
+
rangeColor: string[];
|
|
113
|
+
};
|
|
114
|
+
pointSymbol: string;
|
|
115
|
+
jsonBaseUrl: string;
|
|
116
|
+
defaultAreaCode: string | number;
|
|
117
|
+
}>;
|
|
118
|
+
}, {}>;
|
|
119
|
+
export default IBizMapChart;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { computed, onMounted, toRefs, watch, createVNode, createTextVNode, defineComponent } from 'vue';
|
|
2
|
+
import { isNil, mergeDeepWithKey } from 'ramda';
|
|
3
|
+
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
4
|
+
import { defaultOpts } from './map-chart.util.mjs';
|
|
5
|
+
import { useMapManager } from './map-manager.mjs';
|
|
6
|
+
import './map-chart.css';
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
const IBizMapChart = /* @__PURE__ */ defineComponent({
|
|
10
|
+
name: "IBizMapChart",
|
|
11
|
+
props: {
|
|
12
|
+
areaData: {
|
|
13
|
+
type: Array
|
|
14
|
+
},
|
|
15
|
+
pointData: {
|
|
16
|
+
type: Array
|
|
17
|
+
},
|
|
18
|
+
options: {
|
|
19
|
+
type: Object,
|
|
20
|
+
default: () => ({})
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
setup(props, {
|
|
24
|
+
emit
|
|
25
|
+
}) {
|
|
26
|
+
const ns = useNamespace("map-chart");
|
|
27
|
+
const options = computed(() => {
|
|
28
|
+
return mergeDeepWithKey((_key, x, z) => {
|
|
29
|
+
return isNil(z) ? x : z;
|
|
30
|
+
}, defaultOpts, props.options);
|
|
31
|
+
});
|
|
32
|
+
const findData = (id, type) => {
|
|
33
|
+
if (type === "area" && props.areaData) {
|
|
34
|
+
return props.areaData.find((item) => item._id === id);
|
|
35
|
+
}
|
|
36
|
+
if (type === "point" && props.pointData) {
|
|
37
|
+
return props.pointData.find((item) => item._id === id);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const {
|
|
41
|
+
chartRef,
|
|
42
|
+
historyNames,
|
|
43
|
+
changeMap,
|
|
44
|
+
getCityName,
|
|
45
|
+
goBack,
|
|
46
|
+
refresh
|
|
47
|
+
} = useMapManager(options, (mapName) => {
|
|
48
|
+
const {
|
|
49
|
+
visualMap,
|
|
50
|
+
pointSymbol
|
|
51
|
+
} = options.value;
|
|
52
|
+
const areaData2 = props.areaData || [];
|
|
53
|
+
const pointData2 = props.pointData || [];
|
|
54
|
+
const result = {
|
|
55
|
+
geo: {
|
|
56
|
+
map: mapName
|
|
57
|
+
},
|
|
58
|
+
tooltip: {
|
|
59
|
+
trigger: "item",
|
|
60
|
+
// 全局的tooltip样式
|
|
61
|
+
textStyle: {
|
|
62
|
+
color: "#fff",
|
|
63
|
+
fontSize: 12
|
|
64
|
+
},
|
|
65
|
+
backgroundColor: "rgba(0, 0, 0, 0.47)",
|
|
66
|
+
borderWidth: 0,
|
|
67
|
+
extraCssText: "backdrop-filter: blur(3px);"
|
|
68
|
+
},
|
|
69
|
+
visualMap: {
|
|
70
|
+
min: visualMap.min,
|
|
71
|
+
max: visualMap.max,
|
|
72
|
+
text: visualMap.text,
|
|
73
|
+
realtime: false,
|
|
74
|
+
hoverLink: false,
|
|
75
|
+
inRange: {
|
|
76
|
+
color: visualMap.rangeColor
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
series: [
|
|
80
|
+
// 地图区块序列
|
|
81
|
+
{
|
|
82
|
+
type: "map",
|
|
83
|
+
map: mapName,
|
|
84
|
+
// 地图JSON里和name匹配的属性名称
|
|
85
|
+
nameProperty: "adcodeStr",
|
|
86
|
+
itemStyle: {
|
|
87
|
+
borderColor: "#FFF",
|
|
88
|
+
borderWidth: 2
|
|
89
|
+
},
|
|
90
|
+
tooltip: {
|
|
91
|
+
formatter: (params) => {
|
|
92
|
+
if (!params.data) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const find = findData(params.data._id, "area");
|
|
96
|
+
if (!find) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
return find._tooltip;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
label: {
|
|
103
|
+
// 区块文字固定显示
|
|
104
|
+
show: true,
|
|
105
|
+
// 字体样式
|
|
106
|
+
color: "#000000",
|
|
107
|
+
fontSize: 14,
|
|
108
|
+
formatter: (params) => {
|
|
109
|
+
return getCityName(params.name);
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
select: {
|
|
113
|
+
disabled: true
|
|
114
|
+
},
|
|
115
|
+
data: areaData2.map((item) => ({
|
|
116
|
+
name: `${item._areaCode}`,
|
|
117
|
+
value: item._value,
|
|
118
|
+
_id: item._id
|
|
119
|
+
}))
|
|
120
|
+
},
|
|
121
|
+
// 地图散点序列
|
|
122
|
+
{
|
|
123
|
+
type: "scatter",
|
|
124
|
+
coordinateSystem: "geo",
|
|
125
|
+
symbol: pointSymbol,
|
|
126
|
+
symbolSize: 20,
|
|
127
|
+
visualMap: false,
|
|
128
|
+
itemStyle: {
|
|
129
|
+
color: "#FF1D00"
|
|
130
|
+
},
|
|
131
|
+
label: {
|
|
132
|
+
show: true,
|
|
133
|
+
// 字体样式
|
|
134
|
+
color: "#000000",
|
|
135
|
+
fontSize: 14,
|
|
136
|
+
textShadowBlur: 0,
|
|
137
|
+
formatter: (params) => {
|
|
138
|
+
const find = findData(params.data._id, "point");
|
|
139
|
+
return find == null ? void 0 : find._text;
|
|
140
|
+
},
|
|
141
|
+
// 偏移
|
|
142
|
+
position: "left",
|
|
143
|
+
offset: [10, -15]
|
|
144
|
+
},
|
|
145
|
+
tooltip: {
|
|
146
|
+
formatter: (params) => {
|
|
147
|
+
const find = findData(params.data._id, "point");
|
|
148
|
+
return find == null ? void 0 : find._tooltip;
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
data: pointData2.map((item) => {
|
|
152
|
+
return {
|
|
153
|
+
_id: item._id,
|
|
154
|
+
symbol: item._symbol ? `image://${item._symbol}` : void 0,
|
|
155
|
+
value: [Number(item._longitude), Number(item._latitude)],
|
|
156
|
+
// 每个点逃离visualMap
|
|
157
|
+
visualMap: false
|
|
158
|
+
};
|
|
159
|
+
})
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
};
|
|
163
|
+
return result;
|
|
164
|
+
}, (name, e) => {
|
|
165
|
+
switch (name) {
|
|
166
|
+
case "mapChange":
|
|
167
|
+
emit("mapChange", e);
|
|
168
|
+
break;
|
|
169
|
+
case "pointClick":
|
|
170
|
+
emit("pointClick", {
|
|
171
|
+
data: findData(e._id, "point")
|
|
172
|
+
});
|
|
173
|
+
break;
|
|
174
|
+
case "areaClick":
|
|
175
|
+
emit("areaClick", {
|
|
176
|
+
data: findData(e._id, "area")
|
|
177
|
+
});
|
|
178
|
+
break;
|
|
179
|
+
default:
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
onMounted(() => {
|
|
184
|
+
changeMap(options.value.defaultAreaCode, true);
|
|
185
|
+
});
|
|
186
|
+
const {
|
|
187
|
+
areaData,
|
|
188
|
+
pointData
|
|
189
|
+
} = toRefs(props);
|
|
190
|
+
watch([areaData, pointData], () => {
|
|
191
|
+
refresh();
|
|
192
|
+
});
|
|
193
|
+
return {
|
|
194
|
+
ns,
|
|
195
|
+
chartRef,
|
|
196
|
+
historyNames,
|
|
197
|
+
goBack
|
|
198
|
+
};
|
|
199
|
+
},
|
|
200
|
+
render() {
|
|
201
|
+
return createVNode("div", {
|
|
202
|
+
"class": this.ns.b()
|
|
203
|
+
}, [createVNode("div", {
|
|
204
|
+
"class": this.ns.e("chart"),
|
|
205
|
+
"ref": "chartRef"
|
|
206
|
+
}, null), this.historyNames.length > 1 && createVNode("div", {
|
|
207
|
+
"class": this.ns.e("goback"),
|
|
208
|
+
"onClick": () => {
|
|
209
|
+
this.goBack();
|
|
210
|
+
}
|
|
211
|
+
}, [createTextVNode("\u8FD4\u56DE")])]);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
export { IBizMapChart, IBizMapChart as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** 渐变颜色集合 */
|
|
2
|
+
export declare const GradientColors: string[];
|
|
3
|
+
export declare const defaultOpts: {
|
|
4
|
+
/** true地图code标识使用字符串,false使用数字 */
|
|
5
|
+
strAreaCode: boolean;
|
|
6
|
+
/** 热力图配置 */
|
|
7
|
+
visualMap: {
|
|
8
|
+
/** 两端的文本,如 ['高', '低'] */
|
|
9
|
+
text: string[];
|
|
10
|
+
/** 底部代表的值 */
|
|
11
|
+
min: number;
|
|
12
|
+
/** 顶部代表的值 */
|
|
13
|
+
max: number;
|
|
14
|
+
/** 热力图渐变颜色数组 */
|
|
15
|
+
rangeColor: string[];
|
|
16
|
+
};
|
|
17
|
+
/** 点图标 */
|
|
18
|
+
pointSymbol: string;
|
|
19
|
+
/** 地图json数据基础路径 */
|
|
20
|
+
jsonBaseUrl: string;
|
|
21
|
+
/** 默认打开的区域编码 */
|
|
22
|
+
defaultAreaCode: string | number;
|
|
23
|
+
};
|
|
24
|
+
export type MapOptions = typeof defaultOpts;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const GradientColors = ["#90d1e7", "#fff600", "#ff5200"];
|
|
3
|
+
const defaultOpts = {
|
|
4
|
+
/** true地图code标识使用字符串,false使用数字 */
|
|
5
|
+
strAreaCode: false,
|
|
6
|
+
/** 热力图配置 */
|
|
7
|
+
visualMap: {
|
|
8
|
+
/** 两端的文本,如 ['高', '低'] */
|
|
9
|
+
text: ["\u9AD8", "\u4F4E"],
|
|
10
|
+
/** 底部代表的值 */
|
|
11
|
+
min: 0,
|
|
12
|
+
/** 顶部代表的值 */
|
|
13
|
+
max: 100,
|
|
14
|
+
/** 热力图渐变颜色数组 */
|
|
15
|
+
rangeColor: GradientColors
|
|
16
|
+
},
|
|
17
|
+
/** 点图标 */
|
|
18
|
+
pointSymbol: "pin",
|
|
19
|
+
/** 地图json数据基础路径 */
|
|
20
|
+
jsonBaseUrl: "/assets/json/map",
|
|
21
|
+
/** 默认打开的区域编码 */
|
|
22
|
+
defaultAreaCode: 1e5
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { GradientColors, defaultOpts };
|