cloud-web-corejs 1.0.261 → 1.0.263

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.261",
4
+ "version": "1.0.263",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -9,7 +9,10 @@
9
9
  :size="field.options.size"
10
10
  :clearable="field.options.clearable"
11
11
  :filterable="field.options.filterable"
12
- :props="{ checkStrictly: field.options.checkStrictly, multiple: field.options.multiple, expandTrigger: 'hover' }"
12
+ :collapse-tags="!field.options.flatCollapseTags"
13
+ :show-all-levels="showFullPath"
14
+ :props="{ checkStrictly: field.options.checkStrictly, multiple: field.options.multiple, expandTrigger: 'hover',
15
+ value: valueKey, label: labelKey, children: childrenKey }"
13
16
  @visible-change="hideDropDownOnClick" @expand-change="hideDropDownOnClick"
14
17
  :placeholder="getI18nLabel(field.options.placeholder || '请选择')"
15
18
  @focus="handleFocusCustomEvent" @blur="handleBlurCustomEvent"
@@ -69,7 +72,34 @@
69
72
  }
70
73
  },
71
74
  computed: {
75
+ labelKey() {
76
+ return this.field.options.labelKey || 'label'
77
+ },
78
+
79
+ valueKey() {
80
+ return this.field.options.valueKey || 'value'
81
+ },
82
+
83
+ childrenKey() {
84
+ return this.field.options.childrenKey || 'children'
85
+ },
72
86
 
87
+ showFullPath() {
88
+ return this.field.options.showAllLevels === undefined || !!this.field.options.showAllLevels
89
+ },
90
+
91
+ contentForReadMode() {
92
+ if (!!this.field.options.multiple) {
93
+ const curTags = this.$refs.fieldEditor.presentTags
94
+ if (!curTags || (curTags.length <= 0)) {
95
+ return '--'
96
+ } else {
97
+ return curTags.map(tagItem => tagItem.text).join(', ')
98
+ }
99
+ } else {
100
+ return this.$refs.fieldEditor.presentText || '--'
101
+ }
102
+ },
73
103
  },
74
104
  beforeCreate() {
75
105
  /* 这里不能访问方法和属性!! */
@@ -78,9 +108,9 @@
78
108
  created() {
79
109
  /* 注意:子组件mounted在父组件created之后、父组件mounted之前触发,故子组件mounted需要用到的prop
80
110
  需要在父组件created中初始化!! */
111
+ this.registerToRefList()
81
112
  this.initOptionItems()
82
113
  this.initFieldModel()
83
- this.registerToRefList()
84
114
  this.initEventHandler()
85
115
  this.buildFieldRules()
86
116
 
@@ -106,19 +136,6 @@
106
136
  })
107
137
  }, 100)
108
138
  },
109
- contentForReadMode() {
110
- if (!!this.field.options.multiple) {
111
- //console.log('test======', this.$refs.fieldEditor.presentTags)
112
- const curTags = this.$refs.fieldEditor.presentTags
113
- if (!curTags || (curTags.length <= 0)) {
114
- return '--'
115
- } else {
116
- return curTags.map(tagItem => tagItem.text).join(', ')
117
- }
118
- } else {
119
- return this.$refs.fieldEditor.presentText || '--'
120
- }
121
- },
122
139
 
123
140
  }
124
141
  }
@@ -1466,12 +1466,13 @@ modules = {
1466
1466
  e,
1467
1467
  this.field.type,
1468
1468
  this.getOptionItemLabelKey(),
1469
- this.getOptionItemValueKey()()
1469
+ this.getOptionItemValueKey()
1470
1470
  );
1471
1471
  // this.field.options.optionItems = optionItems
1472
1472
  this.setOptionItems(optionItems)
1473
1473
  },
1474
1474
  loadOptions: function (e, rowOptionFlag) {
1475
+ debugger
1475
1476
  let optionItems = baseRefUtil.translateOptionItems(
1476
1477
  e,
1477
1478
  this.field.type,
@@ -65,6 +65,12 @@
65
65
  :disabled="optionModel.commonAttributeEnabled || !optionModel.formScriptEnabled"
66
66
  ></el-input>
67
67
  </el-form-item>
68
+ <el-form-item
69
+ v-if="hasConfig('childrenKey')"
70
+ :label="i18nt('designer.setting.childrenKeyName')"
71
+ >
72
+ <el-input v-model="optionModel.childrenKey"></el-input>
73
+ </el-form-item>
68
74
  <template
69
75
  v-if="!optionModel.commonAttributeEnabled && !optionModel.formScriptEnabled"
70
76
  >
@@ -305,11 +311,12 @@
305
311
  <script>
306
312
  import Draggable from "vuedraggable";
307
313
  import i18n from "../../../../components/xform/utils/i18n";
314
+ import propertyMixin from "../../../../components/xform/form-designer/setting-panel/property-editor/propertyMixin";
308
315
 
309
316
  export default {
310
317
  name: "OptionItemsSetting",
311
318
  componentName: "PropertyEditor",
312
- mixins: [i18n],
319
+ mixins: [i18n, propertyMixin],
313
320
  components: {
314
321
  Draggable,
315
322
  },
@@ -1,7 +1,12 @@
1
1
  <template>
2
- <el-form-item :label="i18nt('designer.setting.multiple')">
3
- <el-switch v-model="optionModel.multiple"></el-switch>
4
- </el-form-item>
2
+ <div>
3
+ <el-form-item :label="i18nt('designer.setting.multiple')">
4
+ <el-switch v-model="optionModel.multiple"></el-switch>
5
+ </el-form-item>
6
+ <el-form-item :label="i18nt('平铺选项')">
7
+ <el-switch v-model="optionModel.flatCollapseTags"></el-switch>
8
+ </el-form-item>
9
+ </div>
5
10
  </template>
6
11
 
7
12
  <script>
@@ -87,6 +87,7 @@ export default {
87
87
  "census",
88
88
  "status",
89
89
  "gantt",
90
+ "cascader",
90
91
  ],
91
92
  };
92
93
  },
@@ -49,6 +49,7 @@ const COMMON_PROPERTIES = {
49
49
  'remote': 'remote-editor',
50
50
  'automaticDropdown': 'automaticDropdown-editor',
51
51
  'checkStrictly': 'checkStrictly-editor',
52
+ 'showAllLevels': 'showAllLevels-editor',
52
53
  'multiple': 'multiple-editor',
53
54
  'multipleLimit': 'multipleLimit-editor',
54
55
  'contentPosition': 'contentPosition-editor',
@@ -3535,6 +3535,68 @@ export const advancedFields = [
3535
3535
  showRules: [],
3536
3536
  },
3537
3537
  },
3538
+ {
3539
+ type: "cascader",
3540
+ icon: "cascader-field",
3541
+ commonFlag: !0,
3542
+ formItemFlag: true,
3543
+ options: {
3544
+ name: "",
3545
+ keyNameEnabled: false,
3546
+ keyName: "", //数据键值名称
3547
+ label: "",
3548
+ labelAlign: "",
3549
+ defaultValue: "",
3550
+ placeholder: "",
3551
+ size: "",
3552
+ labelWidth: null,
3553
+ labelHidden: false,
3554
+ columnWidth: "200px",
3555
+ disabled: false,
3556
+ hidden: false,
3557
+ clearable: true,
3558
+ filterable: false,
3559
+ multiple: false,
3560
+ flatCollapseTags: false,
3561
+ checkStrictly: false, //可选择任意一级选项,默认不开启
3562
+ showAllLevels: true, //显示完整路径
3563
+ dsEnabled: false, // 是否使用数据源数据
3564
+ dsName: "", // 数据源名称
3565
+ dataSetName: "", //数据集名称
3566
+ labelKey: "label",
3567
+ valueKey: "value",
3568
+ childrenKey: "children",
3569
+ optionItems: [
3570
+ {
3571
+ label: "select 1",
3572
+ value: 1,
3573
+ children: [{ label: "child 1", value: 11 }],
3574
+ },
3575
+ { label: "select 2", value: 2 },
3576
+ { label: "select 3", value: 3 },
3577
+ ],
3578
+ required: false,
3579
+ requiredHint: "",
3580
+ customRule: "",
3581
+ customRuleHint: "",
3582
+ //-------------------
3583
+ customClass: "", //自定义css类名
3584
+ labelIconClass: null,
3585
+ labelIconPosition: "rear",
3586
+ labelTooltip: null,
3587
+
3588
+ ...httpConfig,
3589
+ ...defaultWfConfig,
3590
+ formScriptEnabled: false,
3591
+ //-------------------
3592
+ onCreated: "",
3593
+ onMounted: "",
3594
+ onChange: "",
3595
+ onFocus: "",
3596
+ onBlur: "",
3597
+ onValidate: "",
3598
+ },
3599
+ },
3538
3600
  ];
3539
3601
 
3540
3602
  export const businessFields = [
@@ -266,6 +266,10 @@ modules = {
266
266
  ? this.formConfig.customClass
267
267
  : "";
268
268
  },
269
+
270
+ formModel() {
271
+ return this.formDataModel;
272
+ },
269
273
  },
270
274
  watch: {
271
275
  //
@@ -364,6 +364,7 @@ export default {
364
364
  multiple: "选项可多选",
365
365
  multipleLimit: "多选数量限制",
366
366
  checkStrictly: "任意级节点可选",
367
+ showAllLevels: "显示完整路径",
367
368
  contentPosition: "文字位置",
368
369
  dividerDirection: "分割线方向",
369
370
  plain: "朴素按钮",
@@ -197,27 +197,25 @@ export const insertCustomCssToHead = function (cssCode, formId = "") {
197
197
  head.appendChild(newStyle);
198
198
  };
199
199
 
200
- export const insertGlobalFunctionsToHtml = function (
201
- functionsCode,
202
- formId = ""
203
- ) {
204
- let bodyEle = document.getElementsByTagName("body")[0];
205
- let oldScriptEle = document.getElementById("v_form_global_functions");
206
- !!oldScriptEle && bodyEle.removeChild(oldScriptEle); //先清除后插入!!
207
- if (!!formId) {
208
- oldScriptEle = document.getElementById(
209
- "v_form_global_functions" + "-" + formId
210
- );
211
- !!oldScriptEle && bodyEle.removeChild(oldScriptEle); //先清除后插入!!
212
- }
213
-
214
- let newScriptEle = document.createElement("script");
215
- newScriptEle.id = !!formId
216
- ? "v_form_global_functions" + "-" + formId
217
- : "v_form_global_functions";
218
- newScriptEle.type = "text/javascript";
219
- newScriptEle.innerHTML = functionsCode;
220
- bodyEle.appendChild(newScriptEle);
200
+ export const insertGlobalFunctionsToHtml = function (
201
+ functionsCode,
202
+ formId = ""
203
+ ) {
204
+ if (!functionsCode || typeof functionsCode !== "string") {
205
+ return;
206
+ }
207
+ let sourceName = !!formId
208
+ ? "v_form_global_functions" + "-" + formId
209
+ : "v_form_global_functions";
210
+ try {
211
+ // (0, eval) 是间接调用形式,不可简写为 eval(...):直接 eval 会继承当前模块作用域,
212
+ // 函数声明将落在模块内而非真实 window 上。sourceURL 让 devtools 里可定位、可下断点。
213
+ (0, eval)(functionsCode + "\n//# sourceURL=" + sourceName + ".js");
214
+ } catch (e) {
215
+ // 原先 <script> 注入时语法/运行时错误只进 window.onerror、不影响表单渲染,
216
+ // 这里必须同样吞掉:否则会中断 initFormObject 整条表单初始化链路
217
+ console.error("[xform] 表单全局函数执行失败:" + sourceName, e);
218
+ }
221
219
  };
222
220
 
223
221
  export const optionExists = function (optionsObj, optionName) {
@@ -4,7 +4,7 @@
4
4
  <!-- <keep-alive :include="cachedViews"><router-view :key="key" v-if="$route.name !== 'outLink'" /></keep-alive>-->
5
5
 
6
6
  <BaseKeepAlive :include="cachedViews">
7
- <router-view :key="$route.path" v-if="$route.name !== 'outLink'" />
7
+ <router-view :key="key" v-if="$route.name !== 'outLink'" />
8
8
  </BaseKeepAlive>
9
9
 
10
10
  </transition>
@@ -28,6 +28,7 @@
28
28
  import outLink from '@base/views/user/outLink/index.vue';
29
29
  import unreadDialog from "../../layout/components/notify_message/unreadDialog.vue";
30
30
  import watermark from "./watermark";
31
+ import { isRepeatable } from "@base/utils/repeatOpen";
31
32
 
32
33
 
33
34
  export default {
@@ -37,7 +38,9 @@ export default {
37
38
  return this.$store.state.tagsView.cachedViews.filter(item => item != 'outLink');
38
39
  },
39
40
  key() {
40
- return this.$route.path;
41
+ // 可重复打开的路由按 fullPath 作为 key,使多开实例相互独立;
42
+ // 其余保持按 path,行为与原来一致。
43
+ return isRepeatable(this.$route) ? this.$route.fullPath : this.$route.path;
41
44
  },
42
45
  outVisitedViews() {
43
46
  let visitedViews = this.$store.state.tagsView.visitedViews;
@@ -83,7 +86,8 @@ export default {
83
86
  <style lang="scss" scoped>
84
87
  .app-main {
85
88
  /* 45= navbar 45 */
86
- min-height: calc(100vh - 45px);
89
+ /**min-height: calc(100vh - 45px);*/
90
+ height:calc(100vh - 10px);
87
91
  width: 100%;
88
92
  position: relative;
89
93
  overflow: hidden;
@@ -609,7 +609,8 @@ export default {
609
609
  query: { url: route.outLink, route: route.route },
610
610
  });
611
611
  } else {
612
- this.$router.push(path);
612
+ // 通用打开:可重复时附加唯一标识生成独立标签页
613
+ this.$openView(path, route);
613
614
  }
614
615
  } catch (e) {
615
616
  console.error(e);
@@ -5,7 +5,7 @@
5
5
  <router-link
6
6
  v-for="tag in visitedViews"
7
7
  ref="tag"
8
- :key="tag.path"
8
+ :key="viewKey(tag)"
9
9
  :class="isActive(tag)?'active':''"
10
10
  :to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
11
11
  tag="span"
@@ -61,6 +61,7 @@
61
61
  <script>
62
62
  import ScrollPane from './ScrollPane'
63
63
  import path from 'path'
64
+ import { viewKey, isRepeatable } from '@base/utils/repeatOpen'
64
65
 
65
66
  export default {
66
67
  components: {ScrollPane},
@@ -120,10 +121,16 @@ export default {
120
121
  if (this.$t1) {
121
122
  title = this.$t1(title)
122
123
  }
124
+ if (item.repeatIndex > 1) {
125
+ title = `${title} (${item.repeatIndex})`
126
+ }
123
127
  return title;
124
128
  },
129
+ viewKey(view) {
130
+ return viewKey(view)
131
+ },
125
132
  isActive(route) {
126
- return route.path === this.$route.path
133
+ return viewKey(route) === viewKey(this.$route)
127
134
  },
128
135
  isAffix(tag) {
129
136
  return tag.meta && tag.meta.affix
@@ -168,8 +175,12 @@ export default {
168
175
  moveToCurrentTag() {
169
176
  const tags = this.$refs.tag
170
177
  this.$nextTick(() => {
178
+ const routeIsRepeat = isRepeatable(this.$route)
171
179
  for (const tag of tags) {
172
- if (tag.to.path === this.$route.path) {
180
+ const matched = routeIsRepeat
181
+ ? tag.to.fullPath === this.$route.fullPath
182
+ : tag.to.path === this.$route.path
183
+ if (matched) {
173
184
  this.$refs.scrollPane.moveToTarget(tag)
174
185
  // when query is different then update
175
186
  if (tag.to.fullPath !== this.$route.fullPath) {
@@ -274,7 +274,6 @@ export default {
274
274
  });
275
275
  },
276
276
  openEditDialog(row, param, option) {
277
- debugger;
278
277
  if (option?.otherTab) {
279
278
  this.openOtherTab(row, param, option);
280
279
  return;
@@ -334,7 +333,6 @@ export default {
334
333
  this.openEditDialog(row, param, { multiTabEnabled: false, ...option });
335
334
  },
336
335
  openEditH5Dialog(row, param) {
337
- debugger;
338
336
  this.formCode1 = this.addFormCode;
339
337
  this.dataId = row && row.id ? row.id : null;
340
338
  this.param = param;