cloud-web-corejs 1.0.54-dev.686 → 1.0.54-dev.688

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.
@@ -1403,7 +1403,7 @@ let chartContainers = [],
1403
1403
  let buttonCon1 = this.copyNewFieldWidget(
1404
1404
  this.getFieldWidgetByType("reset_button")
1405
1405
  );
1406
- buttonCon1.options.label = "重置";
1406
+ // buttonCon1.options.label = "重置";
1407
1407
 
1408
1408
  let buttonCon2 = this.copyNewFieldWidget(
1409
1409
  this.getFieldWidgetByType("save_button")
@@ -1,134 +1,186 @@
1
1
  <template>
2
- <form-item-wrapper :designer="designer" :field="field" :rules="rules" :design-state="designState"
3
- :parent-widget="parentWidget" :parent-list="parentList" :index-of-parent-list="indexOfParentList"
4
- :sub-form-row-index="subFormRowIndex" :sub-form-col-index="subFormColIndex" :sub-form-row-id="subFormRowId">
5
- <el-cascader ref="fieldEditor" :options="field.options.optionItems"
6
- v-model="fieldModel" class="full-width-input"
7
- v-show="!isReadMode"
8
- :disabled="field.options.disabled"
9
- :size="field.options.size"
10
- :clearable="field.options.clearable"
11
- :filterable="field.options.filterable"
12
- :props="{ checkStrictly: field.options.checkStrictly, multiple: field.options.multiple, expandTrigger: 'hover' }"
13
- @visible-change="hideDropDownOnClick" @expand-change="hideDropDownOnClick"
14
- :placeholder="getI18nLabel(field.options.placeholder || '请选择')"
15
- @focus="handleFocusCustomEvent" @blur="handleBlurCustomEvent"
16
- @change="handleChangeEvent">
2
+ <form-item-wrapper
3
+ :designer="designer"
4
+ :field="field"
5
+ :rules="rules"
6
+ :design-state="designState"
7
+ :parent-widget="parentWidget"
8
+ :parent-list="parentList"
9
+ :index-of-parent-list="indexOfParentList"
10
+ :sub-form-row-index="subFormRowIndex"
11
+ :sub-form-col-index="subFormColIndex"
12
+ :sub-form-row-id="subFormRowId"
13
+ >
14
+ <el-cascader
15
+ ref="fieldEditor"
16
+ :options="field.options.optionItems"
17
+ v-model="fieldModel"
18
+ v-show="!isReadMode"
19
+ class="full-width-input"
20
+ :disabled="field.options.disabled || isReadMode"
21
+ :clearable="field.options.clearable"
22
+ :filterable="field.options.filterable"
23
+ :placeholder="
24
+ field.options.placeholder || i18nt('render.hint.selectPlaceholder')
25
+ "
26
+ :show-all-levels="showFullPath"
27
+ :props="{
28
+ checkStrictly: field.options.checkStrictly,
29
+ multiple: field.options.multiple,
30
+ expandTrigger: 'hover',
31
+ value: valueKey,
32
+ label: labelKey,
33
+ children: childrenKey,
34
+ }"
35
+ @visible-change="hideDropDownOnClick"
36
+ @expand-change="hideDropDownOnClick"
37
+ @focus="handleFocusCustomEvent"
38
+ @blur="handleBlurCustomEvent"
39
+ @clear="handleClearEvent"
40
+ @change="onFieldChangeEvent"
41
+ >
17
42
  </el-cascader>
18
43
  <template v-if="isReadMode">
19
- <span class="readonly-mode-field">{{contentForReadMode}}</span>
44
+ <span class="readonly-mode-field">{{ contentForReadMode }}</span>
20
45
  </template>
21
46
  </form-item-wrapper>
22
47
  </template>
23
48
 
24
49
  <script>
25
- import FormItemWrapper from './form-item-wrapper'
26
- import emitter from '../../../../../components/xform/utils/emitter'
27
- import i18n from "../../../../../components/xform/utils/i18n";
28
- import fieldMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/fieldMixin";
29
-
30
- export default {
31
- name: "cascader-widget",
32
- componentName: 'FieldWidget', //必须固定为FieldWidget,用于接收父级组件的broadcast事件
33
- mixins: [emitter, fieldMixin, i18n],
34
- props: {
35
- field: Object,
36
- parentWidget: Object,
37
- parentList: Array,
38
- indexOfParentList: Number,
39
- designer: Object,
40
-
41
- designState: {
42
- type: Boolean,
43
- default: false
44
- },
45
-
46
- subFormRowIndex: { /* 子表单组件行索引,从0开始计数 */
47
- type: Number,
48
- default: -1
49
- },
50
- subFormColIndex: { /* 子表单组件列索引,从0开始计数 */
51
- type: Number,
52
- default: -1
53
- },
54
- subFormRowId: { /* 子表单组件行Id,唯一id且不可变 */
55
- type: String,
56
- default: ''
57
- },
50
+ import FormItemWrapper from "./form-item-wrapper";
51
+ import emitter from "../../../../../components/xform/utils/emitter";
52
+ import i18n from "../../../../../components/xform/utils/i18n";
53
+ import fieldMixin from "../../../../../components/xform/form-designer/form-widget/field-widget/fieldMixin";
58
54
 
55
+ export default {
56
+ name: "cascader-widget",
57
+ componentName: "FieldWidget", //必须固定为FieldWidget,用于接收父级组件的broadcast事件
58
+ mixins: [emitter, fieldMixin, i18n],
59
+ props: {
60
+ field: Object,
61
+ parentWidget: Object,
62
+ parentList: Array,
63
+ indexOfParentList: Number,
64
+ designer: Object,
65
+
66
+ designState: {
67
+ type: Boolean,
68
+ default: false,
59
69
  },
60
- components: {
61
- FormItemWrapper,
70
+
71
+ subFormRowIndex: {
72
+ /* 子表单组件行索引,从0开始计数 */ type: Number,
73
+ default: -1,
62
74
  },
63
- inject: ['refList', 'globalOptionData', 'globalModel'],
64
- data() {
65
- return {
66
- oldFieldValue: null, //field组件change之前的值
67
- fieldModel: null,
68
- rules: [],
69
- }
75
+ subFormColIndex: {
76
+ /* 子表单组件列索引,从0开始计数 */ type: Number,
77
+ default: -1,
70
78
  },
71
- computed: {
72
-
79
+ subFormRowId: {
80
+ /* 子表单组件行Id,唯一id且不可变 */ type: String,
81
+ default: "",
73
82
  },
74
- beforeCreate() {
75
- /* 这里不能访问方法和属性!! */
83
+ },
84
+ components: {
85
+ FormItemWrapper,
86
+ },
87
+ inject: ["refList", "globalOptionData", "globalModel"],
88
+ data() {
89
+ return {
90
+ oldFieldValue: null, //field组件change之前的值
91
+ fieldModel: null,
92
+ rules: [],
93
+ };
94
+ },
95
+ computed: {
96
+ labelKey() {
97
+ return this.field.options.labelKey || "label";
76
98
  },
77
99
 
78
- created() {
79
- /* 注意:子组件mounted在父组件created之后、父组件mounted之前触发,故子组件mounted需要用到的prop
80
- 需要在父组件created中初始化!! */
81
- this.initOptionItems()
82
- this.initFieldModel()
83
- this.registerToRefList()
84
- this.initEventHandler()
85
- this.buildFieldRules()
86
-
87
- this.handleOnCreated()
100
+ valueKey() {
101
+ return this.field.options.valueKey || "value";
88
102
  },
89
103
 
90
- mounted() {
91
- this.handleOnMounted()
104
+ childrenKey() {
105
+ return this.field.options.childrenKey || "children";
92
106
  },
93
107
 
94
- beforeDestroy() {
95
- this.unregisterFromRefList()
108
+ showFullPath() {
109
+ return (
110
+ this.field.options.showAllLevels === undefined ||
111
+ !!this.field.options.showAllLevels
112
+ );
96
113
  },
97
114
 
98
- methods: {
99
- /* 开启任意级节点可选后,点击radio隐藏下拉框 */
100
- hideDropDownOnClick() {
101
- setTimeout(() => {
102
- document.querySelectorAll(".el-cascader-panel .el-radio").forEach((el) => {
103
- el.onclick = () => {
104
- this.$refs.fieldEditor.dropDownVisible = false //单选框部分点击隐藏下拉框
105
- }
106
- })
107
- }, 100)
108
- },
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
- }
115
+ contentForReadMode() {
116
+ if (!!this.field.options.multiple) {
117
+ //console.log('test======', this.$refs.fieldEditor.presentTags)
118
+ const curTags = this.$refs.fieldEditor.presentTags;
119
+ if (!curTags || curTags.length <= 0) {
120
+ return "--";
118
121
  } else {
119
- return this.$refs.fieldEditor.presentText || '--'
122
+ return curTags.map((tagItem) => tagItem.text).join(", ");
120
123
  }
121
- },
124
+ } else {
125
+ return this.$refs.fieldEditor.presentText || "--";
126
+ }
127
+ },
128
+ },
129
+ beforeCreate() {
130
+ /* 这里不能访问方法和属性!! */
131
+ },
132
+
133
+ created() {
134
+ /* 注意:子组件mounted在父组件created之后、父组件mounted之前触发,故子组件mounted需要用到的prop
135
+ 需要在父组件created中初始化!! */
136
+ this.registerToRefList();
137
+ this.initOptionItems();
138
+ this.initFieldModel();
139
+ this.initEventHandler();
140
+ this.buildFieldRules();
122
141
 
123
- }
124
- }
142
+ this.handleOnCreated();
143
+ },
144
+
145
+ mounted() {
146
+ this.handleOnMounted();
147
+ },
148
+
149
+ beforeDestroy() {
150
+ this.unregisterFromRefList();
151
+ },
152
+
153
+ methods: {
154
+ /* 开启任意级节点可选后,点击radio隐藏下拉框 */
155
+ hideDropDownOnClick() {
156
+ setTimeout(() => {
157
+ document
158
+ .querySelectorAll(".el-cascader-panel .el-radio")
159
+ .forEach((el) => {
160
+ el.onclick = () => {
161
+ this.$refs.fieldEditor.dropDownVisible = false; //单选框部分点击隐藏下拉框
162
+ };
163
+ });
164
+ }, 100);
165
+ },
166
+
167
+ handleClearEvent() {
168
+ if (!!this.designState) {
169
+ //设计状态不触发事件
170
+ return;
171
+ }
172
+
173
+ this.fieldModel = null;
174
+ this.onFieldChangeEvent(null);
175
+ },
176
+ },
177
+ };
125
178
  </script>
126
179
 
127
180
  <style lang="scss" scoped>
128
- @import "~@/styles/global.scss"; //* form-item-wrapper已引入,还需要重复引入吗? *//
129
-
130
- .full-width-input {
131
- width: 100% !important;
132
- }
181
+ @import "~@/styles/global.scss"; //* form-item-wrapper已引入,还需要重复引入吗? *//
133
182
 
183
+ .full-width-input {
184
+ width: 100% !important;
185
+ }
134
186
  </style>
@@ -71,6 +71,8 @@ modules = {
71
71
  "getReportTemplate",
72
72
  "getObjectFieldFlag",
73
73
  "getObjectName",
74
+ "setCETriggerFlag",
75
+ "clearCETriggerFlag",
74
76
  ],
75
77
  data: function () {
76
78
  return {
@@ -177,8 +179,8 @@ modules = {
177
179
  selectedItems == null
178
180
  ? []
179
181
  : Array.isArray(selectedItems)
180
- ? selectedItems
181
- : [selectedItems];
182
+ ? selectedItems
183
+ : [selectedItems];
182
184
  const labelField = this.getOptionItemLabelKey();
183
185
  return items.map((item) => this.$t1(item[labelField])).join(",");
184
186
  },
@@ -214,8 +216,8 @@ modules = {
214
216
  return isMultiple
215
217
  ? resultList
216
218
  : resultList.length > 0
217
- ? resultList[0]
218
- : null;
219
+ ? resultList[0]
220
+ : null;
219
221
  },
220
222
  initValueWatchEvent() {
221
223
  if (!this.designer) {
@@ -1100,6 +1102,18 @@ modules = {
1100
1102
  i[this.fieldKeyName] = e;
1101
1103
  } else this.formModel[this.fieldKeyName] = e;
1102
1104
  },
1105
+ onFieldChangeEvent(value) {
1106
+ if (!!this.designState) {
1107
+ //设计状态不触发事件
1108
+ return;
1109
+ }
1110
+
1111
+ this.setCETriggerFlag(); //设置用户触发事件标志
1112
+ this.handleChangeEvent(value);
1113
+ setTimeout(() => {
1114
+ this.clearCETriggerFlag(); //复位用户触发事件标志
1115
+ }, 200);
1116
+ },
1103
1117
  handleChangeEvent: function (e) {
1104
1118
  let widgetType = this.field.type;
1105
1119
  if (widgetType === "select") {