Browse Source

修改InfoWindow的报错提示。

yangzhijie1488@163.com 4 năm trước cách đây
mục cha
commit
713caa8ae0
6 tập tin đã thay đổi với 224 bổ sung189 xóa
  1. 1 1
      package.json
  2. 97 0
      packages/components.js
  3. 65 155
      packages/index.js
  4. 47 27
      packages/info/src/InfoWindow.vue
  5. 12 4
      packages/info/src/QueryPage.vue
  6. 2 2
      webpack.lib.js

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "pc-component-v3",
-  "version": "1.0.27",
+  "version": "1.0.28",
   "description": "",
   "main": "dist/pc-component-v3.js",
   "scripts": {

+ 97 - 0
packages/components.js

@@ -0,0 +1,97 @@
+import Loading from './loading/index.js';
+import Modal from './modal/index.js';
+import DateTime from './dateTime/index.js';
+import DateTimeV2 from './dateTime-v2/index.js';
+import Date from './date/index.js';
+import Checkbox from './checkbox/index.js';
+import AmisWidget from './amis/index.js';
+import PageSizeSelect from './page-size-select/index.js';
+import Time from './time/index.js';
+import Switches from './switches/index.js';
+import YearPicker from './year-picker/index.js';
+import VueBootstrapPagination from './vue-bootstrap-pagination/index.js';
+import VueMonthlyPicker from './vue-monthly-picker/index.js';
+import UploadWidget from './upload-widget/index.js';
+import Scanner from './scanner/index.js';
+import Navbar from './navbar/index.js';
+import ImagePreview from './image-preview/index.js';
+import InfoWindow from './info/index.js';
+import ProcessReport from './process/index.js';
+import ProcessReportResult from './process/process-report-result.js';
+import ProcessReportResultPreview from './process/process-report-result-preview.js';
+
+
+import DocGenerator from './info/doc-generator.js';
+import SearchWidget from './info/search-widget.js';
+import MultiSearchWidget from './info/multi-search-widget.js';
+import SearchAutoCompleteWidget from './info/search-auto-complete-widget.js';
+
+
+import PrintEpc from './print/print-epc.js';
+import PrintWidget from './print/print-widget.js';
+
+// import Pagination from './pagination/index.js';
+
+import TreeViewNode from './tree/index.js';
+import ClientOrganization from './client-organization/index.js';
+
+import Uuid from './common/Uuid.js';
+import Common from './common/Common.js';
+import SqlApi from './common/SqlApi.js';
+import Notify from './common/Notify.js';
+import IFrameUtil from './common/IFrameUtil.js';
+import UserStorageResource from './common/UserStorageResource.js';
+import DownloadService from './common/DownloadService.js';
+import ProcessReportResource from './process/src/api/ProcessReportResource.js';
+import CssUtil from './common/CssUtil.js';
+import JsUtil from './common/JsUtil.js';
+
+import ModalFix from './modal/src/ModalFix.js';
+import PrintUtil from './print/src/PrintUtil.js';
+
+export {
+  Loading,
+  Modal,
+  DateTime,
+  DateTimeV2,
+  Date,
+  Checkbox,
+  AmisWidget,
+  PageSizeSelect,
+  Time,
+  Switches,
+  YearPicker,
+  VueBootstrapPagination,
+  VueMonthlyPicker,
+  UploadWidget,
+  Scanner,
+  Navbar,
+  ImagePreview,
+  InfoWindow,
+  ProcessReport,
+  ProcessReportResult,
+  ProcessReportResultPreview,
+  DocGenerator,
+  SearchWidget,
+  MultiSearchWidget,
+  SearchAutoCompleteWidget,
+  PrintEpc,
+  PrintWidget,
+  TreeViewNode,
+  ClientOrganization,
+  // Pagination
+
+
+  Uuid,
+  Common,
+  SqlApi,
+  Notify,
+  IFrameUtil,
+  ModalFix,
+  PrintUtil,
+  UserStorageResource,
+  DownloadService,
+  ProcessReportResource,
+  CssUtil,
+  JsUtil,
+};

+ 65 - 155
packages/index.js

@@ -1,176 +1,86 @@
-import Loading from './loading/index.js';
-import Modal from './modal/index.js';
-import DateTime from './dateTime/index.js';
-import DateTimeV2 from './dateTime-v2/index.js';
-import Date from './date/index.js';
-import Checkbox from '../packages/checkbox/index.js';
-import AmisWidget from '../packages/amis/index.js';
-import PageSizeSelect from './page-size-select/index.js';
-import Time from './time/index.js';
-import Switches from './switches/index.js';
-import YearPicker from './year-picker/index.js';
-import VueBootstrapPagination from './vue-bootstrap-pagination/index.js';
-import VueMonthlyPicker from './vue-monthly-picker/index.js';
-import UploadWidget from './upload-widget/index.js';
-import Scanner from './scanner/index.js';
-import Navbar from './navbar/index.js';
-import ImagePreview from './image-preview/index.js';
-import InfoWindow from './info/index.js';
-import ProcessReport from './process/index.js';
-import ProcessReportResult from './process/process-report-result.js';
-import ProcessReportResultPreview from './process/process-report-result-preview.js';
-
-
-import DocGenerator from './info/doc-generator.js';
-import SearchWidget from './info/search-widget.js';
-import MultiSearchWidget from './info/multi-search-widget.js';
-import SearchAutoCompleteWidget from './info/search-auto-complete-widget.js';
-
-
-import PrintEpc from './print/print-epc.js';
-import PrintWidget from './print/print-widget.js';
-
-// import Pagination from './pagination/index.js';
-
-import TreeViewNode from './tree/index.js';
-import ClientOrganization from './client-organization/index.js';
+import * as components from './components';
 
 import langZhCn from './i18n/zh-CN.js';
 import langEnUs from './i18n/en-US.js';
 
-// import VueI18n from 'vue-i18n';
-
-
-import Uuid from './common/Uuid.js';
-import Common from './common/Common.js';
-import SqlApi from './common/SqlApi.js';
-import Notify from './common/Notify.js';
-import IFrameUtil from './common/IFrameUtil.js';
-import UserStorageResource from './common/UserStorageResource.js';
-import DownloadService from './common/DownloadService.js';
-import ProcessReportResource from './process/src/api/ProcessReportResource.js';
-import CssUtil from './common/CssUtil.js';
-import JsUtil from './common/JsUtil.js';
-
-import ModalFix from './modal/src/ModalFix.js';
-import PrintUtil from './print/src/PrintUtil.js';
-
-const components = [
-  Loading,
-  Modal,
-  DateTime,
-  DateTimeV2,
-  Date,
-  Checkbox,
-  AmisWidget,
-  PageSizeSelect,
-  Time,
-  Switches,
-  YearPicker,
-  VueBootstrapPagination,
-  VueMonthlyPicker,
-  UploadWidget,
-  Scanner,
-  Navbar,
-  ImagePreview,
-  InfoWindow,
-  ProcessReport,
-  ProcessReportResult,
-  ProcessReportResultPreview,
-  DocGenerator,
-  SearchWidget,
-  MultiSearchWidget,
-  SearchAutoCompleteWidget,
-  PrintEpc,
-  PrintWidget,
-  TreeViewNode,
-  ClientOrganization,
-  // Pagination
-];
-
-
-const install = function (app, opts = {}) {
-  console.log('start install.');
-  /* istanbul ignore if */
-  // if (install.installed){
-  //   console.log('pc-component-v3 already installed.');
-  //   return;
-  // }
+export * from './components';
 
-    
-  // Vue.use(VueI18n);
+export const install = function (app) {
+  console.log('start install pc-component-v3.');
 
   app.mixin({
     beforeCreate() {
       var _self = this;
-      // 这里为了防止 beforeCreate 比 vue-i18n 的 beforeCreate 先执行导致 this.$i18n 为空
-      this.$nextTick(() => {
-        // 判断是否为根节点,合并国际化信息
-        if (this.$root === this && this.$i18n) {
-        //if (this.$i18n) {
-          console.log('merge pc-component-v3 i18n.');
-          _self.$i18n.mergeLocaleMessage('zh-CN', langZhCn);
-          _self.$i18n.mergeLocaleMessage('en-US', langEnUs);
-        }
-      });
+      // 判断是否为根节点,合并国际化信息
+      if (this.$root === this && this.$i18n) {
+        console.log('merge pc-component-v3 i18n.');
+        _self.$i18n.mergeLocaleMessage('zh-CN', langZhCn);
+        _self.$i18n.mergeLocaleMessage('en-US', langEnUs);
+      }
     },
   });
 
-  components.map(component => {
-    console.log('install component: ' + component.name);
-    app.component(component.name, component);
+  Object.keys(components).forEach(key => {
+    const component = components[key];
+    if (component.install) {
+      console.log('install pc-component-v3 component: ' + component.name);
+      app.use(component);
+    }
   });
 
-  install.installed = true;
+  console.log('pc-component-v3 install finished.');
 
-  
-  console.log('install finished.');
+  return app;
 };
 
 
+// const install = function (app, opts = {}) {
+//   console.log('start install.');
+//   /* istanbul ignore if */
+//   // if (install.installed){
+//   //   console.log('pc-component-v3 already installed.');
+//   //   return;
+//   // }
+
+    
+//   // Vue.use(VueI18n);
+
+//   app.mixin({
+//     beforeCreate() {
+//       var _self = this;
+//       // 这里为了防止 beforeCreate 比 vue-i18n 的 beforeCreate 先执行导致 this.$i18n 为空
+//       this.$nextTick(() => {
+//         // 判断是否为根节点,合并国际化信息
+//         if (this.$root === this && this.$i18n) {
+//         //if (this.$i18n) {
+//           console.log('merge pc-component-v3 i18n.');
+//           _self.$i18n.mergeLocaleMessage('zh-CN', langZhCn);
+//           _self.$i18n.mergeLocaleMessage('en-US', langEnUs);
+//         }
+//       });
+//     },
+//   });
+
+//   components.map(component => {
+//     console.log('install component: ' + component.name);
+//     app.component(component.name, component);
+//   });
+
+//   install.installed = true;
+
+  
+//   console.log('install finished.');
+// };
+
+let version = '1.0.28';
+
+export {
+  version,
+};
+
 export default {
-  version: '1.2.9',
   install,
-  Loading,
-  Modal,
-  DateTime,
-  DateTimeV2,
-  Date,
-  Checkbox,
-  AmisWidget,
-  PageSizeSelect,
-  Time,
-  Switches,
-  YearPicker,
-  VueBootstrapPagination,
-  VueMonthlyPicker,
-  UploadWidget,
-  Scanner,
-  Navbar,
-  ImagePreview,
-  InfoWindow,
-  DocGenerator,
-  ProcessReport,
-  ProcessReportResult,
-  ProcessReportResultPreview,
-  SearchWidget,
-  MultiSearchWidget,
-  SearchAutoCompleteWidget,
-  PrintEpc,
-  PrintWidget,
-  TreeViewNode,
-  ClientOrganization,
-  // Pagination,
-  Uuid,
-  Common,
-  SqlApi,
-  Notify,
-  IFrameUtil,
-  ModalFix,
-  PrintUtil,
-  UserStorageResource,
-  DownloadService,
-  ProcessReportResource,
-  CssUtil,
-  JsUtil,
+  version,
 };
+
+

+ 47 - 27
packages/info/src/InfoWindow.vue

@@ -2,24 +2,34 @@
   <div>
     <component
       :is="componentName"
-      :key="componentName + '-' + componentLoadedCount" ref="infoComponent" :field-value="fieldValue" :info-window="infoWindowDto"
-      :where-clause-source="whereClauseSource" :is-search-widget="isSearchWidget" :parent-model-data="parentModelData"
-      :model-data="modelData" :multiple="multiple" @data-selected="dataSelected" @delete-selected="deleteSelected"
+      v-if="componentName != null && componentName != '' && componentLoadedCount > 0"
+      :key="componentName + '-' + componentLoadedCount" 
+      ref="infoComponent" 
+      :field-value="fieldValue" 
+      :info-window="infoWindowDto"
+      :where-clause-source="whereClauseSource" 
+      :is-search-widget="isSearchWidget" 
+      :parent-model-data="parentModelData"
+      :model-data="modelData" 
+      :multiple="multiple" 
+      @data-selected="dataSelected"
+      @delete-selected="deleteSelected"
     />
 
     <Loading v-if="loading" />
   </div>
 </template>
 <script>
-var Common = require('../../common/Common.js').default;
-var Notify = require('../../common/Notify.js').default;
-var CssUtil = require('../../common/CssUtil.js').default;
-var JsUtil = require('../../common/JsUtil.js').default;
-var QueryPage = require('./QueryPage.vue').default;
-var Loading = require('../../loading/src/Loading.vue').default;
-var ClientOrganization = require('../../client-organization/src/ClientOrganization.vue').default;
-
-export default {
+import { defineComponent } from 'vue';
+import Common from '../../common/Common.js';
+import Notify from '../../common/Notify.js';
+import CssUtil from '../../common/CssUtil.js';
+import JsUtil from '../../common/JsUtil.js';
+import QueryPage from './QueryPage.vue';
+import Loading from '../../loading/src/Loading.vue';
+import ClientOrganization from '../../client-organization/src/ClientOrganization.vue';
+
+export default defineComponent({
   name: 'InfoWindow',
 
   components: {
@@ -31,34 +41,42 @@ export default {
   props: {
     'whereClauseSource': {
       type: Object,
-      default: null,
+      default(){
+        return null;
+      },
     },
     'isSearchWidget': {
       type: Boolean,
-      default: null,
+      default: false,
     },
     'parentModelData': {
       type: Object,
-      default: null,
+      default(){
+        return null;
+      },
     },
     'modelData': {
       type: Object,
-      default: null,
+      default(){
+        return null;
+      },
     },
     'fieldValue': {
       type: Object,
-      default: null,
+      default(){
+        return null;
+      },
     },
     /**
-         * 查询窗口编号
-         */
+     * 查询窗口编号
+     */
     'infoWindowNo': {
       type: String,
       default: null,
     },
     /**
-         * 是否多选
-         */
+     * 是否多选
+     */
     'multiple': {
       type: Boolean,
       default: false,
@@ -69,12 +87,10 @@ export default {
 
   data: function () {
     return {
-      'infoWindowDto': {},
-      // 显示部件名称
-      'componentName': '',
+      infoWindowDto: {},
+      componentName: '',  // 显示部件名称
       loading: false,
-      moduleDtos: [],
-      componentLoadedCount: 1, // 异步组件加载成功的数量
+      componentLoadedCount: 0, // 异步组件加载成功的数量
     };
   },
 
@@ -128,6 +144,10 @@ export default {
             _self.componentName = 'QueryPage';
           }
 
+          if(_self.componentName === 'QueryPage'){
+            _self.componentLoadedCount ++;
+          }
+
           _self.$nextTick(function () {
             if (_self.infoWindowDto.componentName == undefined || _self.infoWindowDto.componentName == '') {
               if (_self.infoWindowDto.infoWindowType == undefined || _self.infoWindowDto.infoWindowType == 'TableGrid' || _self.infoWindowDto.infoWindowType == 'NONE') {
@@ -213,6 +233,6 @@ export default {
       }
     },
   },
-};
+});
 
 </script>

+ 12 - 4
packages/info/src/QueryPage.vue

@@ -221,7 +221,9 @@ export default {
   props: {
     'whereClauseSource':{
       type: Object,
-      default: null,
+      default(){
+        return null;
+      },
     },  
     'isSearchWidget':{
       type: Boolean,
@@ -229,15 +231,21 @@ export default {
     }, 
     'parentModelData': {
       type: Object,
-      default: null,
+      default(){
+        return null;
+      },
     },
     'modelData': {
       type: Object,
-      default: null,
+      default(){
+        return null;
+      },
     },
     'fieldValue': {
       type: Object,
-      default: null,
+      default(){
+        return null;
+      },
     },
     /**
      * 是否多选

+ 2 - 2
webpack.lib.js

@@ -16,7 +16,7 @@ module.exports = WebpackMerge.merge(baseConfig,{
     library: "pc-component-v3",
     libraryTarget: "umd",
     // 「devtool 中模块」的文件名模板(用于冲突)
-    umdNamedDefine: true
+    umdNamedDefine: false
   },
 
   
@@ -24,7 +24,7 @@ module.exports = WebpackMerge.merge(baseConfig,{
     minimize: true,    // 压缩 bundle
   },
   
-  // devtool: 'source-map',
+  devtool: 'source-map',
 
   plugins: (module.exports.plugins || []).concat([
     new webpack.LoaderOptionsPlugin({