Explorar el Código

4.0.40 低代码平台单独的迁移出来。

YangZhiJie hace 2 años
padre
commit
a152a47656

+ 1 - 6
package.json

@@ -1,7 +1,7 @@
 {
   "name": "client-base-v4",
   "description": "Leanwo Prodog Client",
-  "version": "4.0.39",
+  "version": "4.0.40",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
     "dev": "cross-env webpack serve --config ./webpack.dev.js",
@@ -14,8 +14,6 @@
     "dist"
   ],
   "peerDependencies": {
-    "@leanwo/lowcode-utils": "^1.6.0-beta.8",
-    "@leanwo/lowcode-vue-renderer": "^1.6.0-beta.9",
     "ant-design-vue": "^3.2.15",
     "click-outside-vue3": "^4.0.1",
     "dayjs": "^1.11.6",
@@ -34,9 +32,6 @@
     "@babel/eslint-parser": "^7.17.0",
     "@babel/preset-env": "^7.16.11",
     "@intlify/vue-i18n-loader": "^4.2.0",
-    "@vue/babel-helper-vue-jsx-merge-props": "^1.4.0",
-    "@vue/babel-plugin-jsx": "^1.1.1",
-    "@vue/babel-preset-jsx": "^1.4.0",
     "babel-loader": "^8.2.3",
     "clean-webpack-plugin": "^4.0.0",
     "copy-webpack-plugin": "^11.0.0",

+ 0 - 67
src/api/dic/LowcodeWindowResource.js

@@ -1,67 +0,0 @@
-import { Common } from 'pc-component-v3';
-
-/**
- * 工具类自动生成的API,请勿做任何修改,请勿做任何修改,请勿做任何修改(重要的事情说3遍)
- * 工具作者: 杨志杰
- *  
- */
-export default {
-
-  /**
-	 * 工具类自动生成的方法
-	 * 工具作者: 杨志杰
-	 * 读取文件服务器下面{}/LowcodeWindow/{moduleNo}/{lowcodeWindowNo}.{lowcodeWindowName}.json文件内容 
-	 */
-  readJson: function(lowcodeWindowNo){
-    var requestUrl = 'api/LowcodeWindowResource/readJson?lowcodeWindowNo='+lowcodeWindowNo;
-
-
-    return new Promise((resolve, reject) => {
-      $.ajax({
-        url: Common.getApiUrl2(requestUrl),
-        type: 'post',
-        contentType: 'application/json',
-				
-				
-				
-				
-        beforeSend: function(request) {
-          Common.addTokenToRequest(request);
-        },
-        success: function(data) {
-          resolve(data);
-        },
-        error: function(XMLHttpRequest, textStatus, errorThrown) {
-          reject(XMLHttpRequest);
-        },
-      });
-    });
-  },
-
-  uniqueByNo: function(lowcodeWindowNo){
-    var requestUrl = 'api/LowcodeWindowEditResource/uniqueByNo?lowcodeWindowNo='+lowcodeWindowNo;
-
-
-    return new Promise((resolve, reject) => {
-      $.ajax({
-        url: Common.getApiUrl2(requestUrl),
-        type: 'get',
-        contentType: 'application/json',
-				
-				
-				
-				
-        beforeSend: function(request) {
-          Common.addTokenToRequest(request);
-        },
-        success: function(data) {
-          resolve(data);
-        },
-        error: function(XMLHttpRequest, textStatus, errorThrown) {
-          reject(XMLHttpRequest);
-        },
-      });
-    });
-  },
-
-};

+ 0 - 2
src/index.js

@@ -20,7 +20,6 @@ window.CRUDId = -2147483640;
 
 import Login from './client/Login.vue';
 import Desktop from './client/Desktop.vue';
-import LowcodePage from './lowcode/LowcodePage';
 import Dashboard from './dashboard/Dashboard.vue';
 import Window from './window/Window.vue';
 import SheetWindow from './sheetWindow/SheetWindow.vue';
@@ -87,7 +86,6 @@ export {
   Login,
   SamlLogin,
   Desktop,
-  LowcodePage,
   Dashboard,
   Window,
   SheetWindow,

+ 0 - 101
src/lowcode/LowcodeConfig.js

@@ -1,101 +0,0 @@
-import { buildComponents, AssetLoader } from '@leanwo/lowcode-utils';
-import LowcodeWindowResource from '../api/dic/LowcodeWindowResource.js';
-import { Notify, Uuid } from 'pc-component-v3';
-
-/**
- * 从服务器端获取 Project Schema
- * @param {*} lowcodeWindowNo 
- * @returns 
- */
-const getProjectSchema = async lowcodeWindowNo => {
-  let baseObjectResponse = await LowcodeWindowResource.readJson(lowcodeWindowNo);
-  
-  if(baseObjectResponse.errorCode === 0){
-    let projectSchema = JSON.parse(baseObjectResponse.data);
-    return projectSchema;
-  }else{
-    let lowcodeJSON = {};
-    Notify.error('提示', baseObjectResponse.errorMessage, false);
-  }
-};
-
-
-/**
- * 从服务器端获取 Lowcode Window
- * @param {*} lowcodeWindowNo 
- * @returns 
- */
-const getLowcodeWidnow = async lowcodeWindowNo => {
-  let baseObjectResponse = await LowcodeWindowResource.uniqueByNo(lowcodeWindowNo);
-  
-  if(baseObjectResponse.errorCode === 0){
-    return baseObjectResponse.data;
-  }else{
-    Notify.error('提示', baseObjectResponse.errorMessage, false);
-    return null;
-  }
-};
-
-const init = async lowcodeWindowNo => {
-  // const packages = [{'package':'lowcode-engine-vue-material-dashboard','version':'1.0.0','library':'lowcode-engine-vue-material-dashboard',
-  // 'urls':['http://127.0.0.1:9002\\index.js']}];
-  // const packages = JSON.parse(window.localStorage.getItem('packages') || '[]');
-  // const projectSchema = JSON.parse(window.localStorage.getItem('projectSchema') || '{}');
-
-
-
-  const lowcodeWindow = await getLowcodeWidnow(lowcodeWindowNo);
-  const projectSchema = await getProjectSchema(lowcodeWindowNo);
-  let materialInfos = lowcodeWindow.materialInfos;
-  const { componentsMap: componentsMapArray = [], componentsTree = [] } = projectSchema;
-
-  const componentsMap = {};
-  componentsMapArray.forEach(component => {
-    componentsMap[component.componentName] = component;
-  });
-
-  const libraryMap = {};
-  const libraryAsset = [];
-  // packages.forEach(({ package: _package, library, urls, renderUrls }) => {
-  //   libraryMap[_package] = library;
-  //   if (renderUrls) {
-  //     libraryAsset.push(renderUrls);
-  //   } else if (urls) {
-  //     libraryAsset.push(urls);
-  //   }
-  // });
-
-  if(materialInfos == null || materialInfos.length == 0){
-    Notify.error('错误', '低代码定义中缺少物料的定义,请在低代码编辑器选择使用到的物料。', false);
-    return;
-  }
-
-  for(let i = 0, size = materialInfos.length; i < size; i ++) {
-    let materialInfo = materialInfos[i];
-    const assets = await fetch(materialInfo.url).then(res =>
-      res.json(),
-    );
-    let packages = assets.packages;
-    console.log(packages);
-    if(packages != null && packages.length > 0){
-      packages.forEach(item => {
-        libraryMap[item.package] = item.library;
-        if (item.renderUrls) {
-          libraryAsset.push(item.renderUrls);
-        } else if (item.urls) {
-          libraryAsset.push(item.urls);
-        }
-      });
-    }
-  }
-
-
-  await new AssetLoader().load(libraryAsset);
-  const components = await buildComponents(libraryMap, componentsMap);
-
-  return { schema: componentsTree[0], components };
-};
-
-export {
-  init,
-};

+ 0 - 83
src/lowcode/LowcodeExample.vue

@@ -1,83 +0,0 @@
-<template>
-  <div id="lowcode-box" />
-</template>
-
-
-<script>
-
-// import 'lowcode/sdk/sdk.js';
-// import 'lowcode/lib/themes/antd.css';
-// import 'lowcode/lib/helper.css';
-// import 'lowcode/sdk/iconfont.css';
-import { lowcodeConfig } from './LowcodeConfig.js';
-import LowcodeWindowResource from '../api/dic/LowcodeWindowResource.js';
-import Common from '../base/common/Common.js';
-import { Notify, Uuid } from 'pc-component-v3';
-
-export default {
-
-  name: 'LowcodeExample',
-
-  watch: {
-    '$route': function (to, from) {
-      let lowcodeWindowNo = this.$route.params.no;
-      if(lowcodeWindowNo != null && lowcodeWindowNo != undefined){
-        this.init();
-      }
-    },
-  },
-
-
-  mounted(){
-    let _self = this;
-    this.$nextTick(function(){
-      let lowcodeWindowNo = this.$route.params.no;
-      if(lowcodeWindowNo != null && lowcodeWindowNo != undefined){
-        this.init();
-      }
-    });
-  },
-
-  beforeUnmount(){
-    // 销毁 lowcode
-    this.destory();
-  },
-
-  methods: {
-
-    /**
-     * 初始化lowcode实例
-     */
-    init(){
-      // 初始化lowcode实例之前,先判断是否已经有lowcode实例,如果有的话就销毁。
-      this.destory();
-      let lowcodeWindowNo = this.$route.params.lowcodeWindowNo;
-      let lowcode = window.lowcodeRequire('lowcode/embed');
-      let _self = this;
-
-      LowcodeWindowResource.readJson(lowcodeWindowNo).then(baseObjectResponse => {
-        if(baseObjectResponse.errorCode === 0){
-          let lowcodeJSON = JSON.parse(baseObjectResponse.data);
-          _self.lowcodeScoped = lowcode.embed('#lowcode-box', lowcodeJSON, {}, lowcodeConfig);
-        }else{
-          let lowcodeJSON = {};
-          Notify.error('提示', baseObjectResponse.errorMessage, false);
-        }
-      },errorData => {
-        Common.processException(errorData);
-      });
-    },
-
-    /**
-     * 销毁lowcode实例
-     */
-    destory(){
-      let _self = this;
-      if(_self.lowcodeScoped != null){
-        _self.lowcodeScoped.unmount();
-        _self.lowcodeScoped = null;
-      }
-    },
-  },
-};
-</script>

+ 0 - 34
src/lowcode/LowcodePage.js

@@ -1,34 +0,0 @@
-import { defineComponent, onMounted, reactive, h, toRaw, Suspense } from 'vue';
-import VueRenderer, { config } from '@leanwo/lowcode-vue-renderer';
-import { init } from './LowcodeConfig';
-import { useRoute } from 'vue-router';
-
-const LowcodePage = defineComponent(() => {
-  const data = reactive({});
-  const route = useRoute();
-
-  onMounted(async () => {
-    let lowcodeWindowNo = toRaw(route).params.value.lowcodeWindowNo;
-    Object.assign(data, await init(lowcodeWindowNo));
-  });
-
-  return () => {
-    const { schema, components } = data;
-    if (!schema || !components) {
-      // return h('div', {}, '页面渲染异常,缺少 schema 或 components,请联系管理员。');
-      return h('div', {}, '页面加载中。');
-    }
-
-    return h('div', { class: 'lowcode-plugin-sample-preview' }, [
-      h(Suspense, null, {
-        default : () => h(VueRenderer, {
-          class: 'lowcode-plugin-sample-preview-content',
-          schema: toRaw(schema),
-          components: toRaw(components),
-        }),
-      }),
-    ]);
-  };
-});
-
-export default LowcodePage;

+ 0 - 6
src/routes/main_routes.js

@@ -1,6 +1,5 @@
 import Login from '../client/Login.vue';
 import Desktop from '../client/Desktop.vue';
-import LowcodePage from '../lowcode/LowcodePage';
 const Dashboard = () => import(/* webpackChunkName: "component-1" */ '../dashboard/Dashboard.vue');
 const Window = () => import(/* webpackChunkName: "component-2" */ '../window/Window.vue');
 
@@ -339,16 +338,11 @@ export default [
         },
       },
 
-      // 执行列表
-      { path: 'lowcode-example/:lowcodeWindowNo', component: LowcodePage },
-
 
       { path: 'pdf-print', component: PdfPrint },
 
       { path: 'report-approve', component: ReportApprove },
 
-      // 执行列表
-      { path: '/lowcode-page/:lowcodeWindowNo', component: LowcodePage },
       // 打印页面
       { path: '/single/PrintPage', component: PrintPage },
       // 卡片打印

+ 0 - 2
webpack.lib.js

@@ -115,8 +115,6 @@ module.exports = WebpackMerge.merge(baseConfig,{
 
   // 不把第三方库打包到bundle中
   externals: {
-    "@leanwo/lowcode-utils": "@leanwo/lowcode-utils",
-    "@leanwo/lowcode-vue-renderer": "@leanwo/lowcode-vue-renderer",
     "ant-design-vue": "ant-design-vue",
     "click-outside-vue3": "click-outside-vue3",
     "dayjs": "dayjs",