@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModelError, RuntimeModelError, RuntimeError } from '@ibiz-template/core';
|
|
2
|
-
import { PanelItemController, getPanelItemProvider, isDataContainer, PanelNotifyState, execDELogicById } from '@ibiz-template/runtime';
|
|
2
|
+
import { PanelItemController, getPanelItemProvider, isDataContainer, getAllPanelField, PanelData, PanelNotifyState, execDELogicById } from '@ibiz-template/runtime';
|
|
3
3
|
import { SingleDataContainerState } from './single-data-container.state.mjs';
|
|
4
4
|
|
|
5
5
|
"use strict";
|
|
@@ -146,7 +146,8 @@ class SingleDataContainerController extends PanelItemController {
|
|
|
146
146
|
* @param {IData[]} items
|
|
147
147
|
*/
|
|
148
148
|
async setData(data) {
|
|
149
|
-
|
|
149
|
+
const fields = getAllPanelField(this.model);
|
|
150
|
+
this.state.data = new PanelData(fields, data);
|
|
150
151
|
this.childrenStateNotify(PanelNotifyState.LOAD);
|
|
151
152
|
}
|
|
152
153
|
/**
|
|
@@ -239,6 +240,18 @@ class SingleDataContainerController extends PanelItemController {
|
|
|
239
240
|
updateData();
|
|
240
241
|
});
|
|
241
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* 通知所有子面板成员面板操作过程中的数据变更
|
|
245
|
+
*
|
|
246
|
+
* @author lxm
|
|
247
|
+
* @date 2022-09-20 18:09:40
|
|
248
|
+
* @param {string[]} names
|
|
249
|
+
*/
|
|
250
|
+
childDataChangeNotify(names) {
|
|
251
|
+
Object.values(this.panelItems).forEach((panelItem) => {
|
|
252
|
+
panelItem.dataChangeNotify(names);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
242
255
|
/**
|
|
243
256
|
* 设置面板数据的值
|
|
244
257
|
*
|
|
@@ -250,7 +263,7 @@ class SingleDataContainerController extends PanelItemController {
|
|
|
250
263
|
return;
|
|
251
264
|
}
|
|
252
265
|
this.state.data[name] = value;
|
|
253
|
-
this.
|
|
266
|
+
this.childDataChangeNotify([name]);
|
|
254
267
|
}
|
|
255
268
|
}
|
|
256
269
|
|
|
@@ -4,7 +4,9 @@ export declare class LoginViewEngine extends ViewEngineBase {
|
|
|
4
4
|
route: RouteLocationNormalizedLoaded;
|
|
5
5
|
get AppLoginView(): ViewController;
|
|
6
6
|
onMounted(): Promise<void>;
|
|
7
|
+
onDestroyed(): Promise<void>;
|
|
7
8
|
call(key: string, args?: IData): Promise<IData | null | undefined>;
|
|
8
9
|
login(args: IData): Promise<void>;
|
|
9
10
|
cancelChanges(): Promise<void>;
|
|
11
|
+
private enterKeyListener;
|
|
10
12
|
}
|
|
@@ -12,6 +12,20 @@ class LoginViewEngine extends ViewEngineBase {
|
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
14
14
|
__publicField(this, "route", useRoute());
|
|
15
|
+
__publicField(this, "enterKeyListener", async (event) => {
|
|
16
|
+
if (event.key === "Enter" && this.AppLoginView.layoutPanel) {
|
|
17
|
+
const args = {
|
|
18
|
+
data: [
|
|
19
|
+
{
|
|
20
|
+
isRemember: this.AppLoginView.layoutPanel.data.isRemember,
|
|
21
|
+
username: this.AppLoginView.layoutPanel.data.username,
|
|
22
|
+
password: this.AppLoginView.layoutPanel.data.password
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
};
|
|
26
|
+
await this.login(args);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
15
29
|
}
|
|
16
30
|
get AppLoginView() {
|
|
17
31
|
return this.view.getController("AppLoginView");
|
|
@@ -31,6 +45,11 @@ class LoginViewEngine extends ViewEngineBase {
|
|
|
31
45
|
);
|
|
32
46
|
}
|
|
33
47
|
}
|
|
48
|
+
document.addEventListener("keydown", this.enterKeyListener);
|
|
49
|
+
}
|
|
50
|
+
async onDestroyed() {
|
|
51
|
+
super.onDestroyed();
|
|
52
|
+
document.removeEventListener("keydown", this.enterKeyListener);
|
|
34
53
|
}
|
|
35
54
|
async call(key, args = {}) {
|
|
36
55
|
if (key === SysUIActionTag.LOGIN) {
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
var vue3Util = require('@ibiz-template/vue3-util');
|
|
5
|
+
require('./data-import.css');
|
|
6
|
+
var runtime = require('@ibiz-template/runtime');
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
const DataImport = /* @__PURE__ */ vue.defineComponent({
|
|
10
|
+
name: "DataImport",
|
|
11
|
+
props: {
|
|
12
|
+
dismiss: {
|
|
13
|
+
type: Function,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
appDataEntity: {
|
|
17
|
+
type: Object,
|
|
18
|
+
required: true
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
setup(props) {
|
|
22
|
+
const ns = vue3Util.useNamespace("data-import");
|
|
23
|
+
const inputUpLoad = vue.ref();
|
|
24
|
+
const message = vue.ref({
|
|
25
|
+
state: "ready",
|
|
26
|
+
message: ""
|
|
27
|
+
});
|
|
28
|
+
const isLoading = vue.ref(false);
|
|
29
|
+
const onFileChange = async ($event) => {
|
|
30
|
+
const obj = $event.target;
|
|
31
|
+
if (!obj.files) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const selectedFile = obj.files[0];
|
|
35
|
+
obj.value = null;
|
|
36
|
+
let result;
|
|
37
|
+
isLoading.value = true;
|
|
38
|
+
try {
|
|
39
|
+
if (ibiz.env.enableMqtt) {
|
|
40
|
+
result = await runtime.asyncImportData(selectedFile, props.appDataEntity);
|
|
41
|
+
} else {
|
|
42
|
+
result = await runtime.importData(selectedFile, props.appDataEntity);
|
|
43
|
+
}
|
|
44
|
+
ibiz.mc.command.send({
|
|
45
|
+
srfdecodename: props.appDataEntity.codeName
|
|
46
|
+
}, "OBJECTCREATED");
|
|
47
|
+
const {
|
|
48
|
+
success,
|
|
49
|
+
total,
|
|
50
|
+
message: _message
|
|
51
|
+
} = result;
|
|
52
|
+
const totalNum = total ? Number(total) : 0;
|
|
53
|
+
const successNum = success ? Number(success) : 0;
|
|
54
|
+
const errorNum = total - success;
|
|
55
|
+
message.value.state = _message ? "error" : "over";
|
|
56
|
+
message.value.message = _message || `\u5171\u8BA1\u5BFC\u5165\u6570\u636E ${totalNum} \u6761\uFF0C\u9519\u8BEF[${errorNum}]\uFF0C\u6210\u529F[${successNum}]`;
|
|
57
|
+
} finally {
|
|
58
|
+
isLoading.value = false;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const onLinkClick = async () => {
|
|
62
|
+
var _a;
|
|
63
|
+
const templateUrl = `${props.appDataEntity.codeName2.toLowerCase()}/importtemplate`;
|
|
64
|
+
const res = await ibiz.net.request(templateUrl, {
|
|
65
|
+
responseType: "blob"
|
|
66
|
+
});
|
|
67
|
+
if (res.status === 200) {
|
|
68
|
+
let fileName = ((_a = res.headers["content-disposition"].split(";").find((str) => str.indexOf("filename=") !== -1)) == null ? void 0 : _a.slice(9)) || "";
|
|
69
|
+
fileName = decodeURIComponent(fileName);
|
|
70
|
+
const blob = new Blob([res.data], {
|
|
71
|
+
type: "application/vnd.ms-excel"
|
|
72
|
+
});
|
|
73
|
+
const elink = document.createElement("a");
|
|
74
|
+
elink.download = fileName;
|
|
75
|
+
elink.style.display = "none";
|
|
76
|
+
elink.href = URL.createObjectURL(blob);
|
|
77
|
+
document.body.appendChild(elink);
|
|
78
|
+
elink.click();
|
|
79
|
+
URL.revokeObjectURL(elink.href);
|
|
80
|
+
document.body.removeChild(elink);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const selectFile = () => {
|
|
84
|
+
inputUpLoad.value.click();
|
|
85
|
+
};
|
|
86
|
+
const onCancelButtonClick = () => {
|
|
87
|
+
props.dismiss();
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
ns,
|
|
91
|
+
onLinkClick,
|
|
92
|
+
selectFile,
|
|
93
|
+
onCancelButtonClick,
|
|
94
|
+
onFileChange,
|
|
95
|
+
inputUpLoad,
|
|
96
|
+
isLoading,
|
|
97
|
+
message
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
render() {
|
|
101
|
+
return vue.withDirectives(vue.createVNode("div", {
|
|
102
|
+
"class": this.ns.b()
|
|
103
|
+
}, [vue.createVNode("input", {
|
|
104
|
+
"ref": "inputUpLoad",
|
|
105
|
+
"type": "file",
|
|
106
|
+
"style": "display: none",
|
|
107
|
+
"accept": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
108
|
+
"onChange": this.onFileChange
|
|
109
|
+
}, null), vue.createVNode("div", {
|
|
110
|
+
"class": this.ns.e("caption")
|
|
111
|
+
}, [vue.createTextVNode("\u5BFC\u5165\u6570\u636E")]), this.message.state === "ready" ? vue.createVNode("div", {
|
|
112
|
+
"class": this.ns.b("upload"),
|
|
113
|
+
"onClick": this.selectFile
|
|
114
|
+
}, [vue.createVNode("img", {
|
|
115
|
+
"class": this.ns.be("upload", "img"),
|
|
116
|
+
"src": "./assets/images/icon-import.svg"
|
|
117
|
+
}, null), vue.createVNode("span", {
|
|
118
|
+
"class": this.ns.be("upload", "text")
|
|
119
|
+
}, [vue.createTextVNode("\u5355\u51FB\u6B64\u533A\u57DF\u8FDB\u884C\u4E0A\u4F20")])]) : vue.createVNode("div", {
|
|
120
|
+
"class": [this.ns.b("message")]
|
|
121
|
+
}, [vue.createVNode("div", {
|
|
122
|
+
"class": this.ns.be("message", "title")
|
|
123
|
+
}, [vue.createTextVNode("\u5BFC\u5165\u7ED3\u679C")]), vue.createVNode("div", {
|
|
124
|
+
"class": [this.ns.be("message", "content"), this.ns.is("error", this.message.state === "error")]
|
|
125
|
+
}, [this.message.message])]), vue.createVNode("div", {
|
|
126
|
+
"class": this.ns.e("template-container")
|
|
127
|
+
}, [vue.createVNode("div", {
|
|
128
|
+
"class": this.ns.e("template-description")
|
|
129
|
+
}, [vue.createTextVNode("\u4E0B\u8F7D\u5BFC\u5165\u6A21\u7248\uFF0C\u5E76\u6309\u8981\u6C42\u586B\u5199\uFF1A")]), vue.createVNode("div", {
|
|
130
|
+
"class": this.ns.e("template-link"),
|
|
131
|
+
"onClick": this.onLinkClick
|
|
132
|
+
}, [vue.createVNode("ion-icon", {
|
|
133
|
+
"class": this.ns.e("link-icon"),
|
|
134
|
+
"name": "link"
|
|
135
|
+
}, null), this.appDataEntity.logicName, vue.createTextVNode("\u6570\u636E\u5BFC\u5165\u6A21\u677F\u6587\u4EF6")])]), vue.createVNode("div", {
|
|
136
|
+
"class": this.ns.e("button-bar")
|
|
137
|
+
}, [vue.createVNode(vue.resolveComponent("el-button"), {
|
|
138
|
+
"onClick": this.onCancelButtonClick
|
|
139
|
+
}, {
|
|
140
|
+
default: () => [vue.createTextVNode("\u53D6\u6D88")]
|
|
141
|
+
}), this.message.state !== "ready" && vue.createVNode(vue.resolveComponent("el-button"), {
|
|
142
|
+
"onClick": this.selectFile
|
|
143
|
+
}, {
|
|
144
|
+
default: () => [vue.createTextVNode("\u7EE7\u7EED\u5BFC\u5165")]
|
|
145
|
+
})])]), [[vue.resolveDirective("loading"), this.isLoading]]);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
exports.DataImport = DataImport;
|
|
@@ -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)}
|
package/lib/common/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var vue = require('vue');
|
|
5
6
|
var actionToolbar = require('./action-toolbar/action-toolbar.cjs');
|
|
6
7
|
var col = require('./col/col.cjs');
|
|
7
8
|
var icon = require('./icon/icon.cjs');
|
|
@@ -19,6 +20,7 @@ var extendActionTimeline = require('./extend-action-timeline/extend-action-timel
|
|
|
19
20
|
var viewMessage = require('./view-message/view-message.cjs');
|
|
20
21
|
var pagination = require('./pagination/pagination.cjs');
|
|
21
22
|
var sortBar = require('./sort-bar/sort-bar.cjs');
|
|
23
|
+
var dataImport = require('./data-import/data-import.cjs');
|
|
22
24
|
var controlLoadingPlaceholder = require('./control-loading-placeholder/control-loading-placeholder.cjs');
|
|
23
25
|
|
|
24
26
|
"use strict";
|
|
@@ -41,6 +43,13 @@ const IBizCommonComponents = {
|
|
|
41
43
|
v.component(viewMessage.ViewMessage.name, viewMessage.ViewMessage);
|
|
42
44
|
v.component(pagination.IBizPagination.name, pagination.IBizPagination);
|
|
43
45
|
v.component(sortBar.IBizSortBar.name, sortBar.IBizSortBar);
|
|
46
|
+
v.component(dataImport.DataImport.name, dataImport.DataImport);
|
|
47
|
+
v.component(
|
|
48
|
+
"IBizMapChart",
|
|
49
|
+
vue.defineAsyncComponent({
|
|
50
|
+
loader: () => Promise.resolve().then(function () { return require('./map-chart/map-chart.cjs'); })
|
|
51
|
+
})
|
|
52
|
+
);
|
|
44
53
|
}
|
|
45
54
|
};
|
|
46
55
|
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var ramda = require('ramda');
|
|
7
|
+
var vue3Util = require('@ibiz-template/vue3-util');
|
|
8
|
+
var mapChart_util = require('./map-chart.util.cjs');
|
|
9
|
+
var mapManager = require('./map-manager.cjs');
|
|
10
|
+
require('./map-chart.css');
|
|
11
|
+
|
|
12
|
+
"use strict";
|
|
13
|
+
const IBizMapChart = /* @__PURE__ */ vue.defineComponent({
|
|
14
|
+
name: "IBizMapChart",
|
|
15
|
+
props: {
|
|
16
|
+
areaData: {
|
|
17
|
+
type: Array
|
|
18
|
+
},
|
|
19
|
+
pointData: {
|
|
20
|
+
type: Array
|
|
21
|
+
},
|
|
22
|
+
options: {
|
|
23
|
+
type: Object,
|
|
24
|
+
default: () => ({})
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
setup(props, {
|
|
28
|
+
emit
|
|
29
|
+
}) {
|
|
30
|
+
const ns = vue3Util.useNamespace("map-chart");
|
|
31
|
+
const options = vue.computed(() => {
|
|
32
|
+
return ramda.mergeDeepWithKey((_key, x, z) => {
|
|
33
|
+
return ramda.isNil(z) ? x : z;
|
|
34
|
+
}, mapChart_util.defaultOpts, props.options);
|
|
35
|
+
});
|
|
36
|
+
const findData = (id, type) => {
|
|
37
|
+
if (type === "area" && props.areaData) {
|
|
38
|
+
return props.areaData.find((item) => item._id === id);
|
|
39
|
+
}
|
|
40
|
+
if (type === "point" && props.pointData) {
|
|
41
|
+
return props.pointData.find((item) => item._id === id);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const {
|
|
45
|
+
chartRef,
|
|
46
|
+
historyNames,
|
|
47
|
+
changeMap,
|
|
48
|
+
getCityName,
|
|
49
|
+
goBack,
|
|
50
|
+
refresh
|
|
51
|
+
} = mapManager.useMapManager(options, (mapName) => {
|
|
52
|
+
const {
|
|
53
|
+
visualMap,
|
|
54
|
+
pointSymbol
|
|
55
|
+
} = options.value;
|
|
56
|
+
const areaData2 = props.areaData || [];
|
|
57
|
+
const pointData2 = props.pointData || [];
|
|
58
|
+
const result = {
|
|
59
|
+
geo: {
|
|
60
|
+
map: mapName
|
|
61
|
+
},
|
|
62
|
+
tooltip: {
|
|
63
|
+
trigger: "item",
|
|
64
|
+
// 全局的tooltip样式
|
|
65
|
+
textStyle: {
|
|
66
|
+
color: "#fff",
|
|
67
|
+
fontSize: 12
|
|
68
|
+
},
|
|
69
|
+
backgroundColor: "rgba(0, 0, 0, 0.47)",
|
|
70
|
+
borderWidth: 0,
|
|
71
|
+
extraCssText: "backdrop-filter: blur(3px);"
|
|
72
|
+
},
|
|
73
|
+
visualMap: {
|
|
74
|
+
min: visualMap.min,
|
|
75
|
+
max: visualMap.max,
|
|
76
|
+
text: visualMap.text,
|
|
77
|
+
realtime: false,
|
|
78
|
+
hoverLink: false,
|
|
79
|
+
inRange: {
|
|
80
|
+
color: visualMap.rangeColor
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
series: [
|
|
84
|
+
// 地图区块序列
|
|
85
|
+
{
|
|
86
|
+
type: "map",
|
|
87
|
+
map: mapName,
|
|
88
|
+
// 地图JSON里和name匹配的属性名称
|
|
89
|
+
nameProperty: "adcodeStr",
|
|
90
|
+
itemStyle: {
|
|
91
|
+
borderColor: "#FFF",
|
|
92
|
+
borderWidth: 2
|
|
93
|
+
},
|
|
94
|
+
tooltip: {
|
|
95
|
+
formatter: (params) => {
|
|
96
|
+
if (!params.data) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const find = findData(params.data._id, "area");
|
|
100
|
+
if (!find) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
return find._tooltip;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
label: {
|
|
107
|
+
// 区块文字固定显示
|
|
108
|
+
show: true,
|
|
109
|
+
// 字体样式
|
|
110
|
+
color: "#000000",
|
|
111
|
+
fontSize: 14,
|
|
112
|
+
formatter: (params) => {
|
|
113
|
+
return getCityName(params.name);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
select: {
|
|
117
|
+
disabled: true
|
|
118
|
+
},
|
|
119
|
+
data: areaData2.map((item) => ({
|
|
120
|
+
name: `${item._areaCode}`,
|
|
121
|
+
value: item._value,
|
|
122
|
+
_id: item._id
|
|
123
|
+
}))
|
|
124
|
+
},
|
|
125
|
+
// 地图散点序列
|
|
126
|
+
{
|
|
127
|
+
type: "scatter",
|
|
128
|
+
coordinateSystem: "geo",
|
|
129
|
+
symbol: pointSymbol,
|
|
130
|
+
symbolSize: 20,
|
|
131
|
+
visualMap: false,
|
|
132
|
+
itemStyle: {
|
|
133
|
+
color: "#FF1D00"
|
|
134
|
+
},
|
|
135
|
+
label: {
|
|
136
|
+
show: true,
|
|
137
|
+
// 字体样式
|
|
138
|
+
color: "#000000",
|
|
139
|
+
fontSize: 14,
|
|
140
|
+
textShadowBlur: 0,
|
|
141
|
+
formatter: (params) => {
|
|
142
|
+
const find = findData(params.data._id, "point");
|
|
143
|
+
return find == null ? void 0 : find._text;
|
|
144
|
+
},
|
|
145
|
+
// 偏移
|
|
146
|
+
position: "left",
|
|
147
|
+
offset: [10, -15]
|
|
148
|
+
},
|
|
149
|
+
tooltip: {
|
|
150
|
+
formatter: (params) => {
|
|
151
|
+
const find = findData(params.data._id, "point");
|
|
152
|
+
return find == null ? void 0 : find._tooltip;
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
data: pointData2.map((item) => {
|
|
156
|
+
return {
|
|
157
|
+
_id: item._id,
|
|
158
|
+
symbol: item._symbol ? `image://${item._symbol}` : void 0,
|
|
159
|
+
value: [Number(item._longitude), Number(item._latitude)],
|
|
160
|
+
// 每个点逃离visualMap
|
|
161
|
+
visualMap: false
|
|
162
|
+
};
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
};
|
|
167
|
+
return result;
|
|
168
|
+
}, (name, e) => {
|
|
169
|
+
switch (name) {
|
|
170
|
+
case "mapChange":
|
|
171
|
+
emit("mapChange", e);
|
|
172
|
+
break;
|
|
173
|
+
case "pointClick":
|
|
174
|
+
emit("pointClick", {
|
|
175
|
+
data: findData(e._id, "point")
|
|
176
|
+
});
|
|
177
|
+
break;
|
|
178
|
+
case "areaClick":
|
|
179
|
+
emit("areaClick", {
|
|
180
|
+
data: findData(e._id, "area")
|
|
181
|
+
});
|
|
182
|
+
break;
|
|
183
|
+
default:
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
vue.onMounted(() => {
|
|
188
|
+
changeMap(options.value.defaultAreaCode, true);
|
|
189
|
+
});
|
|
190
|
+
const {
|
|
191
|
+
areaData,
|
|
192
|
+
pointData
|
|
193
|
+
} = vue.toRefs(props);
|
|
194
|
+
vue.watch([areaData, pointData], () => {
|
|
195
|
+
refresh();
|
|
196
|
+
});
|
|
197
|
+
return {
|
|
198
|
+
ns,
|
|
199
|
+
chartRef,
|
|
200
|
+
historyNames,
|
|
201
|
+
goBack
|
|
202
|
+
};
|
|
203
|
+
},
|
|
204
|
+
render() {
|
|
205
|
+
return vue.createVNode("div", {
|
|
206
|
+
"class": this.ns.b()
|
|
207
|
+
}, [vue.createVNode("div", {
|
|
208
|
+
"class": this.ns.e("chart"),
|
|
209
|
+
"ref": "chartRef"
|
|
210
|
+
}, null), this.historyNames.length > 1 && vue.createVNode("div", {
|
|
211
|
+
"class": this.ns.e("goback"),
|
|
212
|
+
"onClick": () => {
|
|
213
|
+
this.goBack();
|
|
214
|
+
}
|
|
215
|
+
}, [vue.createTextVNode("\u8FD4\u56DE")])]);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
exports.IBizMapChart = IBizMapChart;
|
|
220
|
+
exports.default = IBizMapChart;
|
|
@@ -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,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
const GradientColors = ["#90d1e7", "#fff600", "#ff5200"];
|
|
5
|
+
const defaultOpts = {
|
|
6
|
+
/** true地图code标识使用字符串,false使用数字 */
|
|
7
|
+
strAreaCode: false,
|
|
8
|
+
/** 热力图配置 */
|
|
9
|
+
visualMap: {
|
|
10
|
+
/** 两端的文本,如 ['高', '低'] */
|
|
11
|
+
text: ["\u9AD8", "\u4F4E"],
|
|
12
|
+
/** 底部代表的值 */
|
|
13
|
+
min: 0,
|
|
14
|
+
/** 顶部代表的值 */
|
|
15
|
+
max: 100,
|
|
16
|
+
/** 热力图渐变颜色数组 */
|
|
17
|
+
rangeColor: GradientColors
|
|
18
|
+
},
|
|
19
|
+
/** 点图标 */
|
|
20
|
+
pointSymbol: "pin",
|
|
21
|
+
/** 地图json数据基础路径 */
|
|
22
|
+
jsonBaseUrl: "/assets/json/map",
|
|
23
|
+
/** 默认打开的区域编码 */
|
|
24
|
+
defaultAreaCode: 1e5
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.GradientColors = GradientColors;
|
|
28
|
+
exports.defaultOpts = defaultOpts;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var echarts = require('echarts');
|
|
4
|
+
var vue = require('vue');
|
|
5
|
+
var mapJson = require('./map-json.cjs');
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
function useMapManager(opts, calcEchartsOpts, emit) {
|
|
9
|
+
const mapInfos = /* @__PURE__ */ new Map();
|
|
10
|
+
const currentName = vue.ref("");
|
|
11
|
+
const historyNames = vue.ref([]);
|
|
12
|
+
let chart;
|
|
13
|
+
const chartRef = vue.ref();
|
|
14
|
+
const parseJson = (json) => {
|
|
15
|
+
const info = {
|
|
16
|
+
cityNames: {},
|
|
17
|
+
noChild: json.features.length === 1
|
|
18
|
+
};
|
|
19
|
+
json.features.forEach((item) => {
|
|
20
|
+
const { adcode, name } = item.properties;
|
|
21
|
+
info.cityNames[adcode] = name;
|
|
22
|
+
});
|
|
23
|
+
return info;
|
|
24
|
+
};
|
|
25
|
+
const registerMap = async (name) => {
|
|
26
|
+
if (mapInfos.has(name)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const json = await mapJson.getJsonUrl(opts.value.jsonBaseUrl, name);
|
|
30
|
+
mapInfos.set(name, parseJson(json));
|
|
31
|
+
echarts.registerMap(name, json);
|
|
32
|
+
};
|
|
33
|
+
const getCityName = (mapName) => {
|
|
34
|
+
const info = mapInfos.get(currentName.value);
|
|
35
|
+
if (info) {
|
|
36
|
+
return info.cityNames[mapName];
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const refresh = () => {
|
|
40
|
+
if (currentName.value) {
|
|
41
|
+
const options = calcEchartsOpts(currentName.value);
|
|
42
|
+
chart.setOption(options);
|
|
43
|
+
chart.resize();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const changeMap = async (name, isInit = false) => {
|
|
47
|
+
if (!isInit) {
|
|
48
|
+
emit("mapChange", {
|
|
49
|
+
areaCode: opts.value.strAreaCode ? `${name}` : Number(name)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const strName = `${name}`;
|
|
53
|
+
if (!mapInfos.has(strName)) {
|
|
54
|
+
await registerMap(strName);
|
|
55
|
+
}
|
|
56
|
+
currentName.value = strName;
|
|
57
|
+
historyNames.value.push(strName);
|
|
58
|
+
refresh();
|
|
59
|
+
};
|
|
60
|
+
const goBack = () => {
|
|
61
|
+
if (historyNames.value.length > 1) {
|
|
62
|
+
historyNames.value.pop();
|
|
63
|
+
const name = historyNames.value.pop();
|
|
64
|
+
changeMap(name);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
vue.onMounted(() => {
|
|
68
|
+
chart = echarts.init(chartRef.value);
|
|
69
|
+
window.addEventListener("resize", () => {
|
|
70
|
+
chart == null ? void 0 : chart.resize();
|
|
71
|
+
});
|
|
72
|
+
chart.on("click", (params) => {
|
|
73
|
+
if (params.componentType === "series") {
|
|
74
|
+
if (params.seriesType === "scatter") {
|
|
75
|
+
emit("pointClick", params.data);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (params.seriesType === "map") {
|
|
79
|
+
if (params.data) {
|
|
80
|
+
emit("areaClick", params.data);
|
|
81
|
+
}
|
|
82
|
+
if (params.name !== currentName.value) {
|
|
83
|
+
debugger;
|
|
84
|
+
changeMap(params.name);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
chart.on("mouseover", function(params) {
|
|
90
|
+
if (params.componentType === "series") {
|
|
91
|
+
if (params.seriesType === "scatter") {
|
|
92
|
+
const dataIndex = params.dataIndex;
|
|
93
|
+
const option = chart.getOption();
|
|
94
|
+
const seriesData = option.series[params.seriesIndex].data;
|
|
95
|
+
const originSize = option.series[params.seriesIndex].symbolSize;
|
|
96
|
+
seriesData[dataIndex].symbolSize = originSize + 10;
|
|
97
|
+
chart.setOption(option);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
chart.on("mouseout", function(params) {
|
|
102
|
+
if (params.componentType === "series") {
|
|
103
|
+
if (params.seriesType === "scatter") {
|
|
104
|
+
const dataIndex = params.dataIndex;
|
|
105
|
+
const option = chart.getOption();
|
|
106
|
+
const seriesData = option.series[params.seriesIndex].data;
|
|
107
|
+
delete seriesData[dataIndex].symbolSize;
|
|
108
|
+
chart.setOption(option);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
chartRef,
|
|
115
|
+
historyNames,
|
|
116
|
+
currentName,
|
|
117
|
+
changeMap,
|
|
118
|
+
getCityName,
|
|
119
|
+
goBack,
|
|
120
|
+
refresh
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
exports.useMapManager = useMapManager;
|
package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-container/form-mdctrl-container.cjs
CHANGED
|
@@ -31,7 +31,7 @@ const FormMDCtrlContainer = /* @__PURE__ */ vue.defineComponent({
|
|
|
31
31
|
const insertButtonClick = () => {
|
|
32
32
|
emit("insertButtonClick");
|
|
33
33
|
};
|
|
34
|
-
const hasCaption = !!c.model.caption;
|
|
34
|
+
const hasCaption = c.model.showCaption && !!c.model.caption;
|
|
35
35
|
return {
|
|
36
36
|
ns,
|
|
37
37
|
c,
|
|
@@ -51,12 +51,12 @@ const FormMDCtrlContainer = /* @__PURE__ */ vue.defineComponent({
|
|
|
51
51
|
"class": this.ns.b("title")
|
|
52
52
|
}, [vue.createVNode("span", {
|
|
53
53
|
"class": this.ns.b("caption")
|
|
54
|
-
}, [this.controller.model.caption]),
|
|
54
|
+
}, [this.controller.model.showCaption && this.controller.model.caption]), this.buttonVisible && this.controller.isCreate && vue.createVNode(vue.resolveComponent("el-button"), {
|
|
55
55
|
"class": this.ns.b("add-btn"),
|
|
56
56
|
"onClick": () => this.insertButtonClick()
|
|
57
57
|
}, {
|
|
58
58
|
default: () => [vue.createTextVNode("\u6DFB\u52A0")]
|
|
59
|
-
})
|
|
59
|
+
})]), renderFormContent()]]);
|
|
60
60
|
};
|
|
61
61
|
return vue.createVNode("div", {
|
|
62
62
|
"class": [this.ns.b(), this.ns.b(this.c.model.codeName), this.ns.b(this.c.model.contentType.toLowerCase()), ...this.controller.containerClass, this.ns.is("no-caption", !this.hasCaption)]
|