eoss 0.1.0-alpha.30 → 0.1.0-alpha.32

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.
Files changed (40) hide show
  1. package/lib/eoss.common.js +503 -324
  2. package/lib/index.js +1 -1
  3. package/lib/lowcode-view.js +194 -113
  4. package/lib/lowcode.js +155 -104
  5. package/lib/main.js +104 -47
  6. package/lib/process-config.js +14 -18
  7. package/lib/process-module.js +9 -12
  8. package/lib/process-rule.js +2 -5
  9. package/lib/tabs.js +4 -0
  10. package/lib/theme-chalk/index.css +1 -1
  11. package/lib/theme-chalk/lowcode-view.css +1 -1
  12. package/lib/theme-chalk/tabs.css +1 -1
  13. package/lib/wujie.js +2 -3
  14. package/package.json +1 -1
  15. package/packages/lowcode/src/attribute/javascript.vue +2 -0
  16. package/packages/lowcode/src/attribute/property.vue +38 -56
  17. package/packages/lowcode/src/attribute.vue +3 -1
  18. package/packages/lowcode/src/lowcode.vue +8 -2
  19. package/packages/lowcode/src/pages.vue +0 -1
  20. package/packages/lowcode/src/render.vue +15 -1
  21. package/packages/lowcode/src/util/source-generator.js +29 -15
  22. package/packages/lowcode/src/util/source-parser.js +35 -3
  23. package/packages/lowcode-view/src/{Modulels.vue → Modules.vue} +63 -74
  24. package/packages/lowcode-view/src/view.vue +54 -14
  25. package/packages/main/src/components/pages.vue +4 -1
  26. package/packages/main/src/components/router-page.vue +29 -1
  27. package/packages/main/src/components/sub-menu.vue +2 -0
  28. package/packages/main/src/early.vue +1 -0
  29. package/packages/main/src/gzw.vue +1 -0
  30. package/packages/main/src/minxs.js +13 -1
  31. package/packages/process-config/src/NodeConfig.vue +0 -1
  32. package/packages/process-config/src/NodeForm.vue +0 -1
  33. package/packages/process-module/src/FormList.vue +0 -1
  34. package/packages/process-module/src/main.vue +0 -2
  35. package/packages/process-rule/src/main.vue +0 -3
  36. package/packages/tabs/src/tabs.vue +5 -1
  37. package/packages/theme-chalk/src/lowcode-view.scss +1 -0
  38. package/packages/theme-chalk/src/tabs.scss +2 -1
  39. package/packages/wujie/src/wujie.vue +0 -1
  40. package/src/index.js +1 -1
@@ -3528,7 +3528,7 @@ module.exports = require("lodash/set");
3528
3528
  // ESM COMPAT FLAG
3529
3529
  __webpack_require__.r(__webpack_exports__);
3530
3530
 
3531
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/view.vue?vue&type=template&id=0f1c9eba&
3531
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/view.vue?vue&type=template&id=a1097a78&
3532
3532
  var render = function () {
3533
3533
  var _vm = this
3534
3534
  var _h = _vm.$createElement
@@ -3537,7 +3537,7 @@ var render = function () {
3537
3537
  "es-scrollbar",
3538
3538
  { ref: "canvasComponent", staticClass: "es-lowcode-view" },
3539
3539
  [
3540
- _vm.isEdit
3540
+ _vm.isCanEdit
3541
3541
  ? _c(
3542
3542
  "div",
3543
3543
  {
@@ -3712,11 +3712,13 @@ var render = function () {
3712
3712
  },
3713
3713
  [
3714
3714
  _vm.visible
3715
- ? _c("modulels", {
3715
+ ? _c("modules", {
3716
3716
  attrs: {
3717
3717
  modules: _vm.pagesMap,
3718
3718
  filters: _vm.pages,
3719
3719
  url: _vm.listsUrl,
3720
+ styles: _vm.containerStyle,
3721
+ pageStyle: _vm.pageStyle,
3720
3722
  },
3721
3723
  on: { add: _vm.handleAdd },
3722
3724
  })
@@ -3732,7 +3734,7 @@ var staticRenderFns = []
3732
3734
  render._withStripped = true
3733
3735
 
3734
3736
 
3735
- // CONCATENATED MODULE: ./packages/lowcode-view/src/view.vue?vue&type=template&id=0f1c9eba&
3737
+ // CONCATENATED MODULE: ./packages/lowcode-view/src/view.vue?vue&type=template&id=a1097a78&
3736
3738
 
3737
3739
  // EXTERNAL MODULE: external "sortablejs"
3738
3740
  var external_sortablejs_ = __webpack_require__(55);
@@ -4444,8 +4446,8 @@ var render_component = Object(componentNormalizer["a" /* default */])(
4444
4446
  )
4445
4447
 
4446
4448
  /* harmony default export */ var src_render = (render_component.exports);
4447
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/Modulels.vue?vue&type=template&id=1f83c988&
4448
- var Modulelsvue_type_template_id_1f83c988_render = function () {
4449
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/Modules.vue?vue&type=template&id=00a7fee8&
4450
+ var Modulesvue_type_template_id_00a7fee8_render = function () {
4449
4451
  var _vm = this
4450
4452
  var _h = _vm.$createElement
4451
4453
  var _c = _vm._self._c || _h
@@ -4468,6 +4470,7 @@ var Modulelsvue_type_template_id_1f83c988_render = function () {
4468
4470
  {
4469
4471
  ref: "waterfallContainer",
4470
4472
  staticClass: "es-lowcode-view__modules--waterfall",
4473
+ style: _vm.styles,
4471
4474
  model: {
4472
4475
  value: _vm.models,
4473
4476
  callback: function ($$v) {
@@ -4533,15 +4536,18 @@ var Modulelsvue_type_template_id_1f83c988_render = function () {
4533
4536
  1
4534
4537
  )
4535
4538
  }
4536
- var Modulelsvue_type_template_id_1f83c988_staticRenderFns = []
4537
- Modulelsvue_type_template_id_1f83c988_render._withStripped = true
4539
+ var Modulesvue_type_template_id_00a7fee8_staticRenderFns = []
4540
+ Modulesvue_type_template_id_00a7fee8_render._withStripped = true
4538
4541
 
4539
4542
 
4540
- // CONCATENATED MODULE: ./packages/lowcode-view/src/Modulels.vue?vue&type=template&id=1f83c988&
4543
+ // CONCATENATED MODULE: ./packages/lowcode-view/src/Modules.vue?vue&type=template&id=00a7fee8&
4541
4544
 
4542
4545
  // EXTERNAL MODULE: ./src/utils/ajax.js
4543
4546
  var ajax = __webpack_require__(9);
4544
4547
 
4548
+ // EXTERNAL MODULE: ./src/utils/util.js
4549
+ var util = __webpack_require__(1);
4550
+
4545
4551
  // EXTERNAL MODULE: external "eoss/lib/checkbox"
4546
4552
  var checkbox_ = __webpack_require__(38);
4547
4553
  var checkbox_default = /*#__PURE__*/__webpack_require__.n(checkbox_);
@@ -4562,7 +4568,8 @@ var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_);
4562
4568
  var pagination_ = __webpack_require__(84);
4563
4569
  var pagination_default = /*#__PURE__*/__webpack_require__.n(pagination_);
4564
4570
 
4565
- // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/Modulels.vue?vue&type=script&lang=js&
4571
+ // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/Modules.vue?vue&type=script&lang=js&
4572
+ //
4566
4573
  //
4567
4574
  //
4568
4575
  //
@@ -4618,8 +4625,9 @@ var pagination_default = /*#__PURE__*/__webpack_require__.n(pagination_);
4618
4625
 
4619
4626
 
4620
4627
 
4621
- /* harmony default export */ var Modulelsvue_type_script_lang_js_ = ({
4622
- name: 'Modulels',
4628
+
4629
+ /* harmony default export */ var Modulesvue_type_script_lang_js_ = ({
4630
+ name: 'Modules',
4623
4631
 
4624
4632
  components: {
4625
4633
  EsPagination: pagination_default.a,
@@ -4632,6 +4640,18 @@ var pagination_default = /*#__PURE__*/__webpack_require__.n(pagination_);
4632
4640
 
4633
4641
  props: {
4634
4642
  url: String,
4643
+ styles: {
4644
+ type: Object,
4645
+ default: function _default() {
4646
+ return {};
4647
+ }
4648
+ },
4649
+ pageStyle: {
4650
+ type: Object,
4651
+ default: function _default() {
4652
+ return {};
4653
+ }
4654
+ },
4635
4655
  filters: {
4636
4656
  type: Array,
4637
4657
  default: function _default() {
@@ -4643,9 +4663,7 @@ var pagination_default = /*#__PURE__*/__webpack_require__.n(pagination_);
4643
4663
  default: function _default() {
4644
4664
  return [];
4645
4665
  }
4646
- },
4647
- columns: Number,
4648
- gap: Number
4666
+ }
4649
4667
  },
4650
4668
 
4651
4669
  data: function data() {
@@ -4667,6 +4685,14 @@ var pagination_default = /*#__PURE__*/__webpack_require__.n(pagination_);
4667
4685
  return this.filters.map(function (item) {
4668
4686
  return item.id;
4669
4687
  });
4688
+ },
4689
+
4690
+ // 列数/列间距与 view.vue 同源:从 pageStyle 解析,缺省 2 列 0 间距
4691
+ columnCount: function columnCount() {
4692
+ return parseInt((this.pageStyle || {}).columns || 2, 10);
4693
+ },
4694
+ columnGap: function columnGap() {
4695
+ return parseInt((this.pageStyle || {}).gap || 0, 10);
4670
4696
  }
4671
4697
  },
4672
4698
 
@@ -4690,7 +4716,7 @@ var pagination_default = /*#__PURE__*/__webpack_require__.n(pagination_);
4690
4716
  var _this = this;
4691
4717
 
4692
4718
  this.$nextTick(function () {
4693
- _this.models.length && _this.layoutWaterfall();
4719
+ _this.layoutWaterfall();
4694
4720
  });
4695
4721
  },
4696
4722
 
@@ -4743,77 +4769,59 @@ var pagination_default = /*#__PURE__*/__webpack_require__.n(pagination_);
4743
4769
  },
4744
4770
 
4745
4771
  /**
4746
- * 瀑布流布局算法(双列版本)
4747
- * 计算元素的高度和位置,一行显示2列
4772
+ * 瀑布流布局:与 view.vue 保持同一套行为,
4773
+ * masonry 模式复用 util.layoutWaterfall 完成元素分配与定位,
4774
+ * 非 masonry(grid/flex)只清理子元素绝对定位残留,交还容器 CSS 控制
4748
4775
  */
4749
4776
  layoutWaterfall: function layoutWaterfall() {
4750
4777
  var _this3 = this;
4751
4778
 
4752
- var container = this.$refs.waterfallContainer.$el;
4779
+ var ref = this.$refs.waterfallContainer;
4780
+ var container = ref && ref.$el ? ref.$el : ref;
4753
4781
  if (!container) return;
4782
+ if (this.results.length === 0) return;
4754
4783
 
4755
- // 获取容器宽度
4756
- var containerWidth = container.clientWidth;
4757
- if (containerWidth === 0) return;
4758
-
4759
- // 计算每列宽度
4760
- var columnWidth = (containerWidth - this.gap) / this.columns;
4761
-
4762
- // 初始化每列高度数组
4763
- var columnHeights = [0, 0];
4784
+ // 非瀑布流模式:grid/flex 由容器 CSS(styles prop)控制,重置子元素为普通流式布局
4785
+ if ((this.pageStyle || {}).display !== 'masonry') {
4786
+ var display = (this.pageStyle || {}).display;
4787
+ this.results.forEach(function (item) {
4788
+ if (!item.style) _this3.$set(item, 'style', {});
4789
+ if (item.style.position !== undefined) {
4790
+ _this3.$set(item.style, 'position', '');
4791
+ }
4792
+ if (item.style.left !== undefined) {
4793
+ _this3.$set(item.style, 'left', '');
4794
+ }
4795
+ if (item.style.top !== undefined) {
4796
+ _this3.$set(item.style, 'top', '');
4797
+ }
4798
+ // grid 宽度由列宽/span 决定,移除瀑布流残留的 width
4799
+ if (display === 'grid' && item.style.width) {
4800
+ _this3.$delete(item.style, 'width');
4801
+ }
4802
+ });
4803
+ container.style.height = 'auto';
4804
+ container.style.position = '';
4805
+ return;
4806
+ }
4764
4807
 
4765
- // 遍历所有元素,分配到高度最小的列
4808
+ // util 按 px 解析 width,百分比宽度(如 '100%')会被 parseInt
4809
+ // 误判成自定义像素宽度,这里先移除,让 util 回退到按 span 计算列宽
4766
4810
  this.results.forEach(function (item) {
4767
- var span = Math.max(1, Math.min(parseInt(item.style.span ? item.style.span : item.span || 1), _this3.columns));
4768
- // 找到高度最小的列
4769
- var minColIndex = 0;
4770
- if (columnHeights[1] < columnHeights[0]) {
4771
- minColIndex = 1;
4772
- }
4773
-
4774
- // 计算元素位置
4775
- var left = 0;
4776
- var top = 0;
4777
- var width = parseInt(item.style.width ? item.style.width : item.width);
4778
- var height = parseInt(item.style.height ? item.style.height : item.height);
4779
- var eleWidth = columnWidth * span + _this3.gap * (span - 1);
4780
- if (width == '100%' || span == _this3.columns) {
4781
- // 通栏元素,放在第一列顶部
4782
- left = 0;
4783
- top = Math.max.apply(Math, columnHeights);
4784
- // 更新两列的高度为相同值
4785
- columnHeights[0] = columnHeights[1] = top + (height || 0) + _this3.gap;
4786
- } else {
4787
- // 普通元素,放在高度最小的列
4788
- left = minColIndex * (eleWidth + _this3.gap);
4789
- top = columnHeights[minColIndex];
4790
- // 更新该列的高度
4791
- columnHeights[minColIndex] += (height || 0) + _this3.gap;
4792
- }
4793
-
4794
- // 设置元素样式(使用Vue的$set确保响应式)
4795
- if (!item.style) {
4796
- _this3.$set(item, 'style', {});
4811
+ var width = item.style && item.style.width;
4812
+ if (width && /%$/.test(String(width).trim())) {
4813
+ _this3.$delete(item.style, 'width');
4797
4814
  }
4798
- _this3.$set(item.style, 'position', 'absolute');
4799
- _this3.$set(item.style, 'width', width == '100%' ? '100%' : eleWidth + 'px');
4800
- _this3.$set(item.style, 'height', height + 'px');
4801
- _this3.$set(item.style, 'left', left + 'px');
4802
- _this3.$set(item.style, 'top', top + 'px');
4803
-
4804
- // 已在位置计算部分更新了列高度
4805
4815
  });
4806
4816
 
4807
- // 设置容器高度
4808
- var maxHeight = Math.max.apply(Math, columnHeights);
4809
- container.style.position = 'relative';
4810
- container.style.height = maxHeight - this.gap + 'px'; // 减去最后一个间隙
4817
+ // 瀑布流核心计算复用 util,与页面渲染态保持同一套行为
4818
+ Object(util["J" /* layoutWaterfall */])(this, container, this.results, this.columnCount, this.columnGap);
4811
4819
  }
4812
4820
  }
4813
4821
  });
4814
- // CONCATENATED MODULE: ./packages/lowcode-view/src/Modulels.vue?vue&type=script&lang=js&
4815
- /* harmony default export */ var src_Modulelsvue_type_script_lang_js_ = (Modulelsvue_type_script_lang_js_);
4816
- // CONCATENATED MODULE: ./packages/lowcode-view/src/Modulels.vue
4822
+ // CONCATENATED MODULE: ./packages/lowcode-view/src/Modules.vue?vue&type=script&lang=js&
4823
+ /* harmony default export */ var src_Modulesvue_type_script_lang_js_ = (Modulesvue_type_script_lang_js_);
4824
+ // CONCATENATED MODULE: ./packages/lowcode-view/src/Modules.vue
4817
4825
 
4818
4826
 
4819
4827
 
@@ -4821,10 +4829,10 @@ var pagination_default = /*#__PURE__*/__webpack_require__.n(pagination_);
4821
4829
 
4822
4830
  /* normalize component */
4823
4831
 
4824
- var Modulels_component = Object(componentNormalizer["a" /* default */])(
4825
- src_Modulelsvue_type_script_lang_js_,
4826
- Modulelsvue_type_template_id_1f83c988_render,
4827
- Modulelsvue_type_template_id_1f83c988_staticRenderFns,
4832
+ var Modules_component = Object(componentNormalizer["a" /* default */])(
4833
+ src_Modulesvue_type_script_lang_js_,
4834
+ Modulesvue_type_template_id_00a7fee8_render,
4835
+ Modulesvue_type_template_id_00a7fee8_staticRenderFns,
4828
4836
  false,
4829
4837
  null,
4830
4838
  null,
@@ -4832,13 +4840,10 @@ var Modulels_component = Object(componentNormalizer["a" /* default */])(
4832
4840
 
4833
4841
  )
4834
4842
 
4835
- /* harmony default export */ var Modulels = (Modulels_component.exports);
4843
+ /* harmony default export */ var Modules = (Modules_component.exports);
4836
4844
  // EXTERNAL MODULE: ./src/config/api.js
4837
4845
  var api = __webpack_require__(6);
4838
4846
 
4839
- // EXTERNAL MODULE: ./src/utils/util.js
4840
- var util = __webpack_require__(1);
4841
-
4842
4847
  // EXTERNAL MODULE: ./src/utils/resize-event.js
4843
4848
  var resize_event = __webpack_require__(37);
4844
4849
 
@@ -4850,9 +4855,14 @@ var dialog_default = /*#__PURE__*/__webpack_require__.n(dialog_);
4850
4855
  var icon_ = __webpack_require__(26);
4851
4856
  var icon_default = /*#__PURE__*/__webpack_require__.n(icon_);
4852
4857
 
4858
+ // EXTERNAL MODULE: ./src/utils/storage.js
4859
+ var storage = __webpack_require__(0);
4860
+
4853
4861
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/view.vue?vue&type=script&lang=js&
4854
4862
  var viewvue_type_script_lang_js_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
4855
4863
 
4864
+ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
4865
+
4856
4866
  function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
4857
4867
 
4858
4868
  //
@@ -4947,6 +4957,9 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob
4947
4957
  //
4948
4958
  //
4949
4959
  //
4960
+ //
4961
+ //
4962
+
4950
4963
 
4951
4964
 
4952
4965
 
@@ -4964,7 +4977,7 @@ var DROP_SPACE = 200;
4964
4977
  /* harmony default export */ var viewvue_type_script_lang_js_ = ({
4965
4978
  name: 'LowcodeView',
4966
4979
 
4967
- components: { EsScrollbar: scrollbar_default.a, Render: src_render, Modulels: Modulels, EsButton: button_default.a, EsDialog: dialog_default.a, EsIcon: icon_default.a },
4980
+ components: { EsScrollbar: scrollbar_default.a, Render: src_render, Modules: Modules, EsButton: button_default.a, EsDialog: dialog_default.a, EsIcon: icon_default.a },
4968
4981
 
4969
4982
  props: {
4970
4983
  isEdit: {
@@ -4982,6 +4995,7 @@ var DROP_SPACE = 200;
4982
4995
 
4983
4996
  data: function data() {
4984
4997
  return {
4998
+ pageData: this.page,
4985
4999
  // 组件列表
4986
5000
  components: [],
4987
5001
  // 列宽
@@ -5017,12 +5031,16 @@ var DROP_SPACE = 200;
5017
5031
  buttonText: '知道了',
5018
5032
  placement: 'left',
5019
5033
  onClose: null
5020
- }
5034
+ },
5035
+ canEdit: false
5021
5036
  };
5022
5037
  },
5023
5038
 
5024
5039
 
5025
5040
  computed: {
5041
+ isCanEdit: function isCanEdit() {
5042
+ return this.isEdit || this.canEdit;
5043
+ },
5026
5044
  styles: function styles() {
5027
5045
  return {
5028
5046
  'grid-template-columns': 'repeat(' + this.columnCount + ', 1fr)',
@@ -5087,7 +5105,7 @@ var DROP_SPACE = 200;
5087
5105
  this.getPagesMap();
5088
5106
  // 首次进入且可编辑时展示功能引导
5089
5107
  try {
5090
- var show = this.isEdit && !localStorage.getItem('es-lowcode-view-guide');
5108
+ var show = this.isCanEdit && !localStorage.getItem('es-lowcode-view-guide');
5091
5109
  this.showGuide = show;
5092
5110
  this.guideConfig = viewvue_type_script_lang_js_extends({}, this.guideConfig, {
5093
5111
  show: show,
@@ -5140,34 +5158,94 @@ var DROP_SPACE = 200;
5140
5158
  params: {
5141
5159
  mainPageComponentConfigId: this.pageId
5142
5160
  }
5143
- }).then(function (res) {
5144
- if (res.rCode != 0) return;
5145
-
5146
- var _ref = res.results || {},
5147
- pageInfo = _ref.pageInfo,
5148
- targetList = _ref.targetList;
5149
-
5150
- console.log('pageInfo', pageInfo, targetList);
5151
- //targetList后续需要完善
5152
- if (!pageInfo) return;
5153
- // pageInfo.content 是一段 JSON 字符串,内部结构为 { children, style, ... }
5154
-
5155
- var content = pageInfo.content,
5156
- page = _objectWithoutProperties(pageInfo, ['content']);
5161
+ }).then(function () {
5162
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(res) {
5163
+ var _ref2, pageInfo, targetList, content, page, parsed, userConfig, modules, _parsed, children, parseds;
5164
+
5165
+ return regeneratorRuntime.wrap(function _callee$(_context) {
5166
+ while (1) {
5167
+ switch (_context.prev = _context.next) {
5168
+ case 0:
5169
+ if (!(res.rCode != 0)) {
5170
+ _context.next = 2;
5171
+ break;
5172
+ }
5173
+
5174
+ return _context.abrupt('return');
5175
+
5176
+ case 2:
5177
+ _ref2 = res.results || {}, pageInfo = _ref2.pageInfo, targetList = _ref2.targetList;
5178
+ //targetList后续需要完善
5179
+
5180
+ if (pageInfo) {
5181
+ _context.next = 5;
5182
+ break;
5183
+ }
5184
+
5185
+ return _context.abrupt('return');
5186
+
5187
+ case 5:
5188
+ content = pageInfo.content, page = _objectWithoutProperties(pageInfo, ['content']);
5189
+ parsed = {};
5190
+
5191
+ try {
5192
+ parsed = JSON.parse(content);
5193
+ } catch (e) {
5194
+ parsed = {};
5195
+ }
5196
+ // pageInfo.content 是一段 JSON 字符串,内部结构为 { children, style, ... }
5197
+
5198
+ if (!pageInfo.code) {
5199
+ _context.next = 15;
5200
+ break;
5201
+ }
5202
+
5203
+ _context.next = 11;
5204
+ return Object(ajax["a" /* ajax */])({
5205
+ url: api["J" /* getByType */],
5206
+ params: {
5207
+ type: pageInfo.code
5208
+ }
5209
+ });
5210
+
5211
+ case 11:
5212
+ userConfig = _context.sent;
5213
+
5214
+ if (userConfig.rCode === 0 && userConfig.results && userConfig.results[pageInfo.code] && userConfig.results[pageInfo.code].userConfig) {
5215
+ modules = JSON.parse(userConfig.results[pageInfo.code].userConfig);
5216
+ _parsed = parsed, children = _parsed.children, parseds = _objectWithoutProperties(_parsed, ['children']);
5217
+
5218
+ _this.pageData = viewvue_type_script_lang_js_extends({}, page, parseds, { children: modules });
5219
+ _this.pagesMap = children || [];
5220
+ } else {
5221
+ _this.pageData = viewvue_type_script_lang_js_extends({}, page, parsed);
5222
+ }
5223
+ _context.next = 16;
5224
+ break;
5225
+
5226
+ case 15:
5227
+ _this.pageData = viewvue_type_script_lang_js_extends({}, page, parsed);
5228
+
5229
+ case 16:
5230
+ // 合并:page 保留元信息,parsed 提供 children/style 等渲染所需结构
5231
+ _this.setPageData(_this.pageData);
5232
+ // mounted 时 pages 尚为空,异步拿到数据后需重新触发布局
5233
+ _this.$nextTick(function () {
5234
+ _this.init();
5235
+ });
5236
+
5237
+ case 18:
5238
+ case 'end':
5239
+ return _context.stop();
5240
+ }
5241
+ }
5242
+ }, _callee, _this);
5243
+ }));
5157
5244
 
5158
- var parsed = {};
5159
- try {
5160
- parsed = JSON.parse(content);
5161
- } catch (e) {
5162
- parsed = {};
5163
- }
5164
- // 合并:page 保留元信息,parsed 提供 children/style 等渲染所需结构
5165
- _this.setPageData(viewvue_type_script_lang_js_extends({}, page, parsed));
5166
- // mounted 时 pages 尚为空,异步拿到数据后需重新触发布局
5167
- _this.$nextTick(function () {
5168
- _this.init();
5169
- });
5170
- }).catch(function (err) {}).finally(function () {
5245
+ return function (_x) {
5246
+ return _ref.apply(this, arguments);
5247
+ };
5248
+ }()).catch(function (err) {}).finally(function () {
5171
5249
  loadingInstance.close();
5172
5250
  });
5173
5251
  },
@@ -5178,6 +5256,8 @@ var DROP_SPACE = 200;
5178
5256
  * @param {Object} page 完整页面对象(含 children、style)
5179
5257
  */
5180
5258
  setPageData: function setPageData(page) {
5259
+ var customPage = (Object(storage["a" /* getStorage */])({ key: 'customPage' }) || '').split(',');
5260
+ this.canEdit = customPage.includes(page.code);
5181
5261
  var p = page || {};
5182
5262
  this.pages = JSON.parse(JSON.stringify(p.children || []));
5183
5263
  var style = p.style || {};
@@ -5253,13 +5333,14 @@ var DROP_SPACE = 200;
5253
5333
  method: 'post',
5254
5334
  format: false,
5255
5335
  data: {
5256
- type: 'customHomePages',
5336
+ type: this.pageData.code,
5257
5337
  userConfig: JSON.stringify(this.pages)
5258
5338
  }
5259
5339
  }).then(function (res) {
5260
5340
  if (res.rCode == 0 || res.status == 'success') {
5261
5341
  _this4.$message.success('保存成功!');
5262
- _this4.getData();
5342
+ // 保存成功后重新拉取页面配置,刷新渲染数据
5343
+ _this4.getPagesMap();
5263
5344
  _this4.edit = false;
5264
5345
  _this4.$nextTick(function () {
5265
5346
  _this4.layoutWaterfall();