cloud-web-corejs 1.0.54-dev.251 → 1.0.54-dev.253

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.54-dev.251",
4
+ "version": "1.0.54-dev.253",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -0,0 +1,301 @@
1
+ <template>
2
+ <el-dialog
3
+ :visible.sync="showDialog"
4
+ v-el-drag-dialog
5
+ v-el-dialog-center
6
+ v-bind="dialogConfig"
7
+ @close="close"
8
+ >
9
+ <div class="cont designer-view" v-bind="bodyConfig" id="containt">
10
+ <component v-if="showWfContent && wfContent" :is="wfContent" visible-key="showWfContent" :outParam.sync="outParam"
11
+ :_dataId.sync="dataId" :defaultShowWfContent="defaultShowWfContent" :_isOutLink="true"
12
+ :parent-target="_self"
13
+ @reload="$reloadHandle" v-bind="queryParam" v-on="listeners"></component>
14
+ </div>
15
+ <span slot="footer" class="dialog-footer" v-if="option.showFooter!==false" v-bind="option.footerConfig">
16
+ <el-button type="primary" plain class="button-sty" @click="close">
17
+ <i class="el-icon-close el-icon"></i>
18
+ {{ $t2('取 消', 'system.button.cancel2') }}
19
+ </el-button>
20
+ <el-button type="primary" @click="dialogSubmit" class="button-sty">
21
+ <i class="el-icon-check el-icon"></i>
22
+ {{ $t2('确 定', 'system.button.confirm2') }}
23
+ </el-button>
24
+ </span>
25
+ </el-dialog>
26
+ </template>
27
+
28
+ <script>
29
+
30
+ export default {
31
+ // name: "vabSearchDialog",
32
+ components: {},
33
+ props: {
34
+ visiable: Boolean,
35
+ option: Object
36
+ },
37
+ mixins: [],
38
+ inject: ["getFormConfig"],
39
+
40
+ mounted() {
41
+
42
+ },
43
+ data() {
44
+ var that = this;
45
+ return {
46
+ showFormField: "_tt",
47
+ showDialog: true,
48
+ falseValue: false,
49
+ selectMulti: true,
50
+
51
+ formJson: {},
52
+ formData: {},
53
+ optionData: {},
54
+ showRender: false,
55
+ formTemplate: {},
56
+ /* formCode: null,*/
57
+ layoutType: null,
58
+ conditionParam: null,
59
+ formInsData: null,
60
+ $grid: null,
61
+ currentLayoutType: null,
62
+ dataId: null,
63
+
64
+ showWfContent: true,
65
+ wfContent: null,
66
+ outParam: null,
67
+ // dataId: null,
68
+ defaultShowWfContent: null,
69
+ queryParam: {},
70
+ listeners:null
71
+ };
72
+ },
73
+ computed: {
74
+ formCode() {
75
+ return this.option.formCode;
76
+ },
77
+ dialogParam() {
78
+ return this.option?.param;
79
+ },
80
+ formConfig() {
81
+ return this.option?.formConfig;
82
+ },
83
+ dialogConfig() {
84
+ let customClass = "dialog-style list-dialog dialog-checkbox pd_0";
85
+ if (this.option.dialogConfig?.customClass) {
86
+ customClass = customClass + " " + this.option.dialogConfig.customClass
87
+ }
88
+ let config = {
89
+ title: this.formTemplate.formName,
90
+ appendToBody: true,
91
+ modalAppendToBody: true,
92
+ closeOnClickModal: false,
93
+ modal: false,
94
+ width: "1200px",
95
+ fullscreen: this.option.fullscreen,
96
+ };
97
+ config = Object.assign({}, config, this.option.dialogConfig, {customClass});
98
+ config.title = this.$t1(config.title);
99
+ return config;
100
+ },
101
+ bodyConfig() {
102
+ let config = {};
103
+ let classStr = this.currentLayoutType
104
+ if (this.option.bodyConfig?.class) {
105
+ classStr = classStr + " " + this.option.bodyConfig.class;
106
+ }
107
+ if (this.option.showFooter == false) {
108
+ classStr = classStr + " nfootBtn";
109
+ }
110
+ config = Object.assign({}, config, this.option.bodyConfig, {class: classStr});
111
+ return config;
112
+ }
113
+ },
114
+ created() {
115
+ /*let dataId = this.option?.formConfig?.dataId??null
116
+ delete this.option?.formConfig?.dataId
117
+ this.dataId = dataId;*/
118
+
119
+ let currentFormConfig = this.getFormConfig();
120
+ this.currentLayoutType = currentFormConfig.layoutType
121
+
122
+ // this.selectMulti = this.option.multiple ?? true;
123
+ this.initData();
124
+ },
125
+ methods: {
126
+ initData() {
127
+ const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
128
+ let queryParam = this.$baseLodash.cloneDeep(this.dialogParam);
129
+ let murl = queryParam.urlmobile;
130
+ let purl = murl && isMobile ? murl : queryParam.url;
131
+ let dataId = queryParam.dataId;
132
+ if (purl == '/index') {
133
+ location.hash = '/home';
134
+ location.reload();
135
+ return;
136
+ }
137
+
138
+ this.dataId = dataId;
139
+ if (queryParam.showWfContent == 'true') {
140
+ this.defaultShowWfContent = true;
141
+ }
142
+
143
+ delete queryParam.urlmobile;
144
+ delete queryParam.url;
145
+
146
+ if (purl.indexOf('.html') >= 0) {
147
+ let eUrl = purl;
148
+ let pstr = Object.keys(queryParam).map(key => {
149
+ return key + "=" + queryParam[key]
150
+ }).join("&")
151
+
152
+ if (pstr) {
153
+ if (purl.indexOf('.html?') >= 0) {
154
+ eUrl = eUrl + '&' + pstr
155
+ } else {
156
+ eUrl = eUrl + '?' + pstr
157
+ }
158
+ }
159
+
160
+ location.href = eUrl;
161
+ return
162
+ }
163
+
164
+ delete queryParam.dataId;
165
+ delete queryParam.showWfContent;
166
+ delete queryParam.access_token;
167
+ delete queryParam.tp;
168
+ delete queryParam.thirdparty_info;
169
+ delete queryParam.i18nLang;
170
+
171
+ let url = purl + '.vue';
172
+ this.queryParam = queryParam;
173
+ let listeners= this.option?.on;
174
+ this.listeners = listeners;
175
+
176
+ this.showWfContent = true;
177
+
178
+ let t = "@base/views";
179
+ let urlArr = [
180
+ '/user/bill_setting/h5_view.vue',
181
+ '/user/form/view/list.vue',
182
+ '/user/form/view/edit.vue'
183
+ ]
184
+
185
+ if (urlArr.includes(url)) {
186
+ this.wfContent = require('@base/views' + url).default;
187
+ } else if (url.startsWith(t)) {
188
+ let path = url.slice(t.length);
189
+ this.wfContent = require('@base/views' + path).default;
190
+ } else {
191
+ this.wfContent = require('@/views' + url).default;
192
+ }
193
+ },
194
+
195
+
196
+ reload(e, option) {
197
+ let updateParam = option?.updateParam || {};
198
+ Object.assign(this.formConfig, updateParam)
199
+ this.showRender = false;
200
+ this.getReportTemplate();
201
+ },
202
+ async getReportTemplate(callback) {
203
+ let param = {
204
+ objTypeCode: this.$attrs.objTypeCode,
205
+ objId: this.$attrs.objId,
206
+ taskId: this.$attrs.taskId
207
+ };
208
+ this.conditionParam = param;
209
+ let url, data;
210
+ url = USER_PREFIX + `/formTemplate/getByFormCode`;
211
+ data = {stringOne: this.formCode}
212
+
213
+ let that = this;
214
+ this.$http({
215
+ url: url,
216
+ method: `post`,
217
+ data: data,
218
+ isLoading: true,
219
+ loadingTarget: document.body,
220
+ modalStrictly: true,
221
+ success: res => {
222
+ let formTemplate = res.objx || {};
223
+ this.formTemplate = formTemplate;
224
+ this.formJson = formTemplate.formViewContent ? JSON.parse(formTemplate.formViewContent) : {};
225
+ this.layoutType = this.formJson.formConfig.layoutType
226
+ let formConfig = this.formJson.formConfig;
227
+ if (formConfig.searchDialogUniqueField) {
228
+ this.fieldKey = formConfig.searchDialogUniqueField;
229
+ }
230
+
231
+ this.showRender = true;
232
+
233
+
234
+ }
235
+ });
236
+ },
237
+ close() {
238
+ let formRef = this.$refs.vFormRef;
239
+ this.showDialog = false;
240
+ this.$emit('update:visiable', false);
241
+ this.option.close && this.option.close(formRef, this);
242
+ },
243
+ dialogSubmit() {
244
+ let formRef = this.$refs.vFormRef;
245
+ if (this.option.confirm) {
246
+ if (this.option.confirm(formRef, this) !== false) {
247
+ this.close();
248
+ }
249
+ } else {
250
+ this.close();
251
+ }
252
+ }
253
+ }
254
+ }
255
+ </script>
256
+
257
+ <style lang="scss" scoped>
258
+ ::v-deep .H5 .h5-fixed-bottom-btns {
259
+ bottom: 95px;
260
+ }
261
+
262
+ .list-dialog {
263
+ .el-dialog__body {
264
+ height: calc(100% - 42px);
265
+
266
+ .cont {
267
+ height: calc(100vh - 210px);
268
+
269
+ &.nfootBtn {
270
+ height: calc(100vh - 158px)
271
+ }
272
+
273
+ &#containt {
274
+ padding: 0;
275
+
276
+ ::v-deep .grid-container {
277
+ outline: none;
278
+
279
+ &.detail-wrap .d-cont {
280
+ height: calc(100vh - 150px);
281
+
282
+ .title .field-wrapper {
283
+ display: inline-block !important
284
+ }
285
+ }
286
+ }
287
+ }
288
+ }
289
+ }
290
+
291
+ &.is-fullscreen .el-dialog__body {
292
+ .cont {
293
+ height: calc(100vh - 110px);
294
+
295
+ &.nfootBtn {
296
+ height: calc(100vh - 58px)
297
+ }
298
+ }
299
+ }
300
+ }
301
+ </style>
@@ -8,7 +8,7 @@ import {
8
8
  getAccessUrl,
9
9
  generateId
10
10
  } from "../../../../../components/xform/utils/util";
11
- import FormValidators from "../../../../../components/xform/utils/validators";
11
+ import FormValidators, {getRegExp} from "../../../../../components/xform/utils/validators";
12
12
  import scriptHttpMixin from "../../../../../components/xform/mixins/scriptHttp";
13
13
  import defaultHandleMixin from "../../../../../components/xform/mixins/defaultHandle";
14
14
 
@@ -245,7 +245,7 @@ modules = {
245
245
  nullValue = undefined;
246
246
  } else if (widgetType === 'checkbox' || (widgetType === 'select' && this.field.options.multiple)) {
247
247
  nullValue = [];
248
- }else if(widgetType == "time-range" || widgetType=="date-range" || (widgetType === 'date' && this.field.options.type=="dates")){
248
+ } else if (widgetType == "time-range" || widgetType == "date-range" || (widgetType === 'date' && this.field.options.type == "dates")) {
249
249
  nullValue = [];
250
250
  }
251
251
  if (void 0 === currentData[this.fieldKeyName]) {
@@ -701,70 +701,134 @@ modules = {
701
701
  void 0 !== this.field.options.defaultValue &&
702
702
  (this.fieldModel = this.field.options.defaultValue);
703
703
  },
704
- clearFieldRules: function () {
705
- this.field.formItemFlag && this.rules.splice(0, this.rules.length);
704
+
705
+ clearFieldRules() {
706
+ if (!this.field.formItemFlag) {
707
+ return
708
+ }
709
+
710
+ this.rules.splice(0, this.rules.length) //清空已有
706
711
  },
707
- buildFieldRules: function () {
708
- var e = this;
709
- if (this.field.formItemFlag) {
710
- if (
711
- (this.rules.splice(0, this.rules.length),
712
- this.field.options.required &&
712
+
713
+ getValidateDefaultMsg(labelCode, vldName) {
714
+ let label = this.$t1(labelCode);
715
+ let map = {
716
+ number: "[{label}]包含非数字字符",
717
+ letter: "[{label}]包含非字母字符",
718
+ letterAndNumber: "[{label}]只能输入字母或数字",
719
+ mobilePhone: "[{label}]手机号码格式有误",
720
+ letterStartNumberIncluded: "[{label}]必须以字母开头,可包含数字",
721
+ noChinese: "[{label}]不可输入中文字符",
722
+ chinese: "[{label}]只能输入中文字符",
723
+ email: "[{label}]邮箱格式有误",
724
+ url: "[{label}]URL格式有误",
725
+ required: "[{label}]不能为空"
726
+ }
727
+ let result = null
728
+ let value = map[vldName]
729
+ if (!value) {
730
+ value = "[{label}]invalid value"
731
+ }
732
+ result = this.$t1(value, {label});
733
+ return result
734
+ },
735
+ getValidationHintMsg() {
736
+ let vldName = this.field.options.validation
737
+ if (this.field.options.validationHint) {
738
+ return this.$t1(this.field.options.validationHint)
739
+ } else {
740
+ return this.getValidateDefaultMsg(this.field.options.label, vldName)
741
+ }
742
+ },
743
+ getRequiredHintMsg() {
744
+ if (this.field.options.requiredHint) {
745
+ return this.$t1(this.field.options.requiredHint)
746
+ } else {
747
+ return this.getValidateDefaultMsg(this.field.options.label, "required")
748
+ }
749
+ },
750
+ buildFieldRules() {
751
+ if (!this.field.formItemFlag || this.field.options.hidden) {
752
+ return
753
+ }
754
+
755
+ this.rules.splice(0, this.rules.length) //清空已有
756
+ if (!!this.field.options.required) {
757
+ this.rules.push({
758
+ required: true,
759
+ //trigger: ['blur', 'change'],
760
+ trigger: ['blur'], /* 去掉change事件触发校验,change事件触发时formModel数据尚未更新,导致radio/checkbox必填校验出错!! */
761
+ message: this.getRequiredHintMsg()
762
+ })
763
+ }
764
+
765
+ if (!!this.field.options.validation) {
766
+ let vldName = this.field.options.validation
767
+ if (!!FormValidators[vldName]) {
713
768
  this.rules.push({
714
- required: !0,
715
- trigger: ["blur"],
716
- message:
717
- this.field.options.requiredHint ||
718
- this.i18nt("render.hint.fieldRequired"),
719
- }),
720
- this.field.options.validation)
721
- ) {
722
- var t = this.field.options.validation;
723
- a["a"][t]
724
- ? this.rules.push({
725
- validator: a["a"][t],
726
- trigger: ["blur", "change"],
727
- label: this.field.options.label,
728
- errorMsg: this.field.options.validationHint,
729
- })
730
- : this.rules.push({
731
- validator: a["a"]["regExp"],
732
- trigger: ["blur", "change"],
733
- regExp: t,
734
- label: this.field.options.label,
735
- errorMsg: this.field.options.validationHint,
736
- });
737
- }
738
- if (this.field.options.onValidate) {
739
- var i = function (t, i, n) {
740
- var o = new Function(
741
- "rule",
742
- "value",
743
- "callback",
744
- e.field.options.onValidate
745
- );
746
- return o.call(e, t, i, n);
747
- };
769
+ validator: FormValidators[vldName],
770
+ trigger: ['blur', 'change'],
771
+ label: this.field.options.label,
772
+ // errorMsg: this.field.options.validationHint
773
+ errorMsg: this.getValidationHintMsg()
774
+ })
775
+ } else {
748
776
  this.rules.push({
749
- validator: i,
750
- trigger: ["blur", "change"],
777
+ validator: FormValidators['regExp'],
778
+ trigger: ['blur', 'change'],
779
+ regExp: vldName,
751
780
  label: this.field.options.label,
752
- });
781
+ // errorMsg: this.field.options.validationHint
782
+ errorMsg: this.getValidationHintMsg()
783
+ })
753
784
  }
754
785
  }
786
+
787
+ if (!!this.field.options.onValidate) {
788
+ let customFn = (rule, value, callback) => {
789
+ let tmpFunc = new Function('rule', 'value', 'callback', this.field.options.onValidate)
790
+ return tmpFunc.call(this, rule, value, callback)
791
+ }
792
+ this.rules.push({
793
+ validator: customFn,
794
+ trigger: ['blur', 'change'],
795
+ label: this.field.options.label
796
+ })
797
+ }
755
798
  },
756
- disableChangeValidate: function () {
757
- this.rules &&
758
- this.rules.forEach(function (e) {
759
- e.trigger && e.trigger.splice(0, e.trigger.length);
760
- });
799
+
800
+ /**
801
+ * 禁用字段值变动触发表单校验
802
+ */
803
+ disableChangeValidate() {
804
+ if (!this.rules) {
805
+ return
806
+ }
807
+
808
+ this.rules.forEach(rule => {
809
+ if (!!rule.trigger) {
810
+ rule.trigger.splice(0, rule.trigger.length)
811
+ }
812
+ })
761
813
  },
762
- enableChangeValidate: function () {
763
- this.rules &&
764
- this.rules.forEach(function (e) {
765
- e.trigger && (e.trigger.push("blur"), e.trigger.push("change"));
766
- });
814
+
815
+ /**
816
+ * 启用字段值变动触发表单校验
817
+ */
818
+ enableChangeValidate() {
819
+ if (!this.rules) {
820
+ return
821
+ }
822
+
823
+ this.rules.forEach(rule => {
824
+ if (!!rule.trigger) {
825
+ rule.trigger.push('blur')
826
+ rule.trigger.push('change')
827
+ }
828
+ })
767
829
  },
830
+
831
+
768
832
  disableOptionOfList: function (e, t) {
769
833
  e &&
770
834
  e.length > 0 &&
@@ -1,32 +1,32 @@
1
1
  <template>
2
- <el-form-item
3
- :label="i18nt('designer.setting.required')"
4
- v-show="showProperty()"
5
- >
6
- <el-switch v-model="optionModel.required"></el-switch>
2
+ <el-form-item :label="i18nt('designer.setting.required')">
3
+ <el-switch v-model="optionModel.required" @change="handleChangeEvent"></el-switch>
7
4
  </el-form-item>
8
5
  </template>
9
6
 
10
7
  <script>
11
- import i18n from "../../../../../components/xform/utils/i18n";
8
+ import i18n from "../../../../../components/xform/utils/i18n"
12
9
 
13
- export default {
14
- name: "required-editor",
15
- mixins: [i18n],
16
- props: {
17
- designer: Object,
18
- selectedWidget: Object,
19
- optionModel: Object,
20
- },
21
- methods: {
22
- showProperty() {
23
- let widgetRef = this.designer.vueInstance.getWidgetRef(
24
- this.selectedWidget.options.name
25
- );
26
- return widgetRef?.$attrs["table-condition"] !== true;
10
+ export default {
11
+ name: "required-editor",
12
+ mixins: [i18n],
13
+ props: {
14
+ designer: Object,
15
+ selectedWidget: Object,
16
+ optionModel: Object,
27
17
  },
28
- },
29
- };
18
+ methods: {
19
+ handleChangeEvent(val) {
20
+ const wRef = this.designer.formWidget.getSelectedWidgetRef()
21
+ if (wRef && wRef.setRequired) {
22
+ wRef.setRequired(val)
23
+ }
24
+ },
25
+
26
+ }
27
+ }
30
28
  </script>
31
29
 
32
- <style scoped></style>
30
+ <style scoped>
31
+
32
+ </style>
@@ -5,10 +5,10 @@
5
5
  </template>
6
6
 
7
7
  <script>
8
- import i18n from "../../../../../components/xform/utils/i18n"
9
- import propertyMixin from "../../../../../components/xform/form-designer/setting-panel/property-editor/propertyMixin"
8
+ import i18n from "../../../../../components/xform/utils/i18n"
9
+ import propertyMixin from "../../../../../components/xform/form-designer/setting-panel/property-editor/propertyMixin"
10
10
 
11
- export default {
11
+ export default {
12
12
  name: "requiredHint-editor",
13
13
  mixins: [i18n, propertyMixin],
14
14
  props: {
@@ -15,9 +15,9 @@
15
15
  </template>
16
16
 
17
17
  <script>
18
- import i18n from "../../../../../components/xform/utils/i18n"
18
+ import i18n from "../../../../../components/xform/utils/i18n"
19
19
 
20
- export default {
20
+ export default {
21
21
  name: "validation-editor",
22
22
  mixins: [i18n],
23
23
  props: {
@@ -5,9 +5,9 @@
5
5
  </template>
6
6
 
7
7
  <script>
8
- import i18n from "../../../../../components/xform/utils/i18n"
8
+ import i18n from "../../../../../components/xform/utils/i18n"
9
9
 
10
- export default {
10
+ export default {
11
11
  name: "validationHint-editor",
12
12
  mixins: [i18n],
13
13
  props: {
@@ -29,9 +29,9 @@ const COMMON_PROPERTIES = {
29
29
  'labelHidden': 'labelHidden-editor',
30
30
  'rows': 'rows-editor',
31
31
  'required': 'required-editor',
32
- // 'requiredHint': 'requiredHint-editor',
33
- // 'validation': 'validation-editor',
34
- // 'validationHint': 'validationHint-editor',
32
+ 'requiredHint': 'requiredHint-editor',
33
+ 'validation': 'validation-editor',
34
+ 'validationHint': 'validationHint-editor',
35
35
  'readonly': 'readonly-editor',
36
36
  'disabled': 'disabled-editor',
37
37
  'hidden': 'hidden-editor',
@@ -59,6 +59,7 @@
59
59
  <importDialog v-if="showImportDialog" :visiable.sync="showImportDialog" :param="importDialogOption"
60
60
  :parentTarget="_self"></importDialog>
61
61
  <formDrawer v-if="showFormDrawer" :visiable.sync="showFormDrawer" :option="formDrawerOption"></formDrawer>
62
+ <fileReferenceDialog v-if="showFileReferenceDialog" :visiable.sync="showFileReferenceDialog" :option="fileReferenceDialogOption"></fileReferenceDialog>
62
63
  </div>
63
64
  </template>
64
65
 
@@ -76,7 +77,9 @@ export default {
76
77
  searchFormDialog: () => import("../../../components/xform/form-designer/form-widget/dialog/searchFormDialog.vue"),
77
78
  formDialog: () => import("../../../components/xform/form-designer/form-widget/dialog/formDialog.vue"),
78
79
  importDialog: () => import("../../../components/xform/form-designer/form-widget/dialog/importDialog.vue"),
79
- formDrawer: () => import("../../../components/xform/form-designer/form-widget/dialog/formDrawer.vue")
80
+ formDrawer: () => import("../../../components/xform/form-designer/form-widget/dialog/formDrawer.vue"),
81
+ fileReferenceDialog: () => import("../../../components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue")
82
+
80
83
  },
81
84
  mixins: [indexMixin],
82
85
  };