|
@@ -12,20 +12,23 @@
|
|
|
<script>
|
|
<script>
|
|
|
|
|
|
|
|
import { defineComponent } from 'vue';
|
|
import { defineComponent } from 'vue';
|
|
|
-import { Notify, Uuid } from 'pc-component-v3';
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
import Common from '../common/Common.js';
|
|
import Common from '../common/Common.js';
|
|
|
-//import AssetDashboardClient from '../../dashboard/eam/AssetDashboardClient.vue';
|
|
|
|
|
-//import AssetDashboardOrg from '../../dashboard/eam/AssetDashboardOrg.vue';
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+import { CssUtil } from 'pc-component-v3';
|
|
|
|
|
+import { JsUtil } from 'pc-component-v3';
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
|
|
|
|
|
|
name: 'DashboardPage',
|
|
name: 'DashboardPage',
|
|
|
|
|
|
|
|
components: {
|
|
components: {
|
|
|
- //AssetDashboardClient,
|
|
|
|
|
- //AssetDashboardOrg,
|
|
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
@@ -39,11 +42,11 @@ export default defineComponent({
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
beforeUnmount: function(){
|
|
beforeUnmount: function(){
|
|
|
- //if(this.dashboardArray != null && this.dashboardArray.length > 0){
|
|
|
|
|
- // this.dashboardArray.forEach(item => {
|
|
|
|
|
- // CssUtil.dynamicUnloadCss(item.componentName);
|
|
|
|
|
- // });
|
|
|
|
|
- //}
|
|
|
|
|
|
|
+ if(this.dashboardArray != null && this.dashboardArray.length > 0){
|
|
|
|
|
+ this.dashboardArray.forEach(item => {
|
|
|
|
|
+ CssUtil.dynamicUnloadCss(item.componentName);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
@@ -85,21 +88,18 @@ export default defineComponent({
|
|
|
if(dashboards != null && dashboards.length > 0) {
|
|
if(dashboards != null && dashboards.length > 0) {
|
|
|
dashboards.forEach(function(item) {
|
|
dashboards.forEach(function(item) {
|
|
|
console.log(item);
|
|
console.log(item);
|
|
|
|
|
+ // const jsUrl = '' + '/DictionaryBase/Dashboard/BASE/2020080401.js';
|
|
|
|
|
+ //const jsUrl = '/DictionaryAsset/Dashboard/EAM/20220309_095250.js';
|
|
|
const componentName = item.componentName;
|
|
const componentName = item.componentName;
|
|
|
|
|
|
|
|
- let vueName = null;
|
|
|
|
|
- if(item.vueName != null && item.vueName != undefined) {
|
|
|
|
|
- vueName = item.vueName;
|
|
|
|
|
- let promise = null;
|
|
|
|
|
-
|
|
|
|
|
- promise = new Promise((resolve, reject) => {
|
|
|
|
|
- // import('../../../../Dictionary' + vueName).then(remoteComponent => {
|
|
|
|
|
- // resolve(remoteComponent);
|
|
|
|
|
- // }).catch(error => {
|
|
|
|
|
- // reject(error);
|
|
|
|
|
- // });
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if(item.cssUrl != null && item.cssUrl != undefined) {
|
|
|
|
|
+ CssUtil.dynamicLoadCss(item.cssUrl, componentName);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ let jsUrl = null;
|
|
|
|
|
+ if(item.jsUrl != null && item.jsUrl != undefined) {
|
|
|
|
|
+ jsUrl = item.jsUrl;
|
|
|
|
|
+ let promise = JsUtil.dynamicLoadJsModule(jsUrl);
|
|
|
promise.then(remoteComponent => {
|
|
promise.then(remoteComponent => {
|
|
|
console.log('remoteComponent:' + remoteComponent.default.name);
|
|
console.log('remoteComponent:' + remoteComponent.default.name);
|
|
|
if(componentName !== remoteComponent.default.name){
|
|
if(componentName !== remoteComponent.default.name){
|
|
@@ -107,21 +107,16 @@ export default defineComponent({
|
|
|
console.error(errorMessage);
|
|
console.error(errorMessage);
|
|
|
Notify.error('仪表盘定义错误', errorMessage, false);
|
|
Notify.error('仪表盘定义错误', errorMessage, false);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
window.app.component(componentName, remoteComponent.default);
|
|
window.app.component(componentName, remoteComponent.default);
|
|
|
var item1 = {
|
|
var item1 = {
|
|
|
no: componentName,
|
|
no: componentName,
|
|
|
componentName: componentName,
|
|
componentName: componentName,
|
|
|
- sortNo: item.sortNo,
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
console.log(_self.dashboardArray);
|
|
console.log(_self.dashboardArray);
|
|
|
_self.dashboardArray.push(item1);
|
|
_self.dashboardArray.push(item1);
|
|
|
-
|
|
|
|
|
- function sortFunction(a, b){
|
|
|
|
|
- return a.sortNo - b.sortNo;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- _self.dashboardArray.sort(sortFunction);
|
|
|
|
|
}, errorData => {
|
|
}, errorData => {
|
|
|
console.error(errorData);
|
|
console.error(errorData);
|
|
|
});
|
|
});
|