@dhccmobile/vue3-lo-form 2.0.0 → 2.0.1
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/README.md +70 -70
- package/dist/vue3-lo-form.common.js +1189 -1069
- package/dist/vue3-lo-form.common.js.map +1 -1
- package/dist/vue3-lo-form.umd.js +1189 -1069
- package/dist/vue3-lo-form.umd.js.map +1 -1
- package/dist/vue3-lo-form.umd.min.js +1 -1
- package/dist/vue3-lo-form.umd.min.js.map +1 -1
- package/package.json +73 -65
- package/src/App.vue +741 -741
- package/src/components/form/DvForm.vue +642 -642
- package/src/components/form/DvFormLayout.vue +1569 -1569
- package/src/components/form/StretchText.vue +90 -90
- package/src/components/index.ts +3 -3
- package/src/constants/config/form-template.config.ts +32 -32
- package/src/constants/config/form.config.ts +4 -4
- package/src/constants/config/storage.config.ts +4 -4
- package/src/constants/encode-assets/svg.ts +11 -11
- package/src/constants/enum/builtIn-label.enum.ts +5 -5
- package/src/constants/enum/cache-type.enum.ts +7 -7
- package/src/constants/enum/control-format-type.enum.ts +9 -9
- package/src/constants/enum/dynamic-option-type.enum.ts +6 -6
- package/src/constants/enum/form-bus-attr.enum.ts +8 -8
- package/src/constants/enum/form-field-class.enum.ts +7 -7
- package/src/constants/enum/form-field-type.enum.ts +25 -25
- package/src/constants/enum/form-type.enum.ts +5 -5
- package/src/constants/enum/index.ts +19 -19
- package/src/constants/enum/lateral-arrangement.enum.ts +9 -9
- package/src/constants/enum/money-unit.enum.ts +6 -6
- package/src/constants/enum/option-type.enum.ts +5 -5
- package/src/constants/enum/submitted-type.enum.ts +32 -32
- package/src/constants/enum/support-upload-type.enum.ts +5 -5
- package/src/constants/enum/switch.enum.ts +5 -5
- package/src/constants/enum/upload-type.enum.ts +17 -17
- package/src/constants/enum/validate-rules.enum.ts +25 -25
- package/src/constants/enum/validate-status.enum.ts +8 -8
- package/src/constants/enum/vertical-arrangement.enum.ts +7 -7
- package/src/constants/enum/zoom-type.ts +6 -6
- package/src/constants/index.ts +3 -3
- package/src/core/FormApi.ts +1238 -1238
- package/src/core/index.ts +1 -1
- package/src/domain/AbstractControl.ts +6 -6
- package/src/domain/Control.ts +14 -14
- package/src/domain/CustomFormat.ts +6 -6
- package/src/domain/DesForm.ts +48 -48
- package/src/domain/DesFormControl.ts +241 -241
- package/src/domain/DesFormLayout.ts +51 -51
- package/src/domain/FieldChangeHistory.ts +9 -9
- package/src/domain/FormConfig.ts +16 -15
- package/src/domain/FormControl.ts +125 -125
- package/src/domain/FormEnum.ts +9 -9
- package/src/domain/FormGroup.ts +42 -42
- package/src/domain/FormRestfulResponse.ts +6 -6
- package/src/domain/ProvideInjectData.ts +10 -10
- package/src/domain/SysDictDetail.ts +38 -38
- package/src/domain/SysDictInfo.ts +40 -40
- package/src/domain/SysDictTreeDetail.ts +52 -52
- package/src/domain/index.ts +12 -12
- package/src/filtres/amount-capitalization.filter.ts +154 -154
- package/src/filtres/extract-options.filter.ts +53 -53
- package/src/filtres/generate-grid-column-end.filter.ts +22 -22
- package/src/filtres/generate-grid-template-columns.filter.ts +24 -24
- package/src/filtres/switch-enum-convert.filter.ts +18 -18
- package/src/filtres/zoom-multiple.filter.ts +32 -32
- package/src/index.ts +74 -73
- package/src/main.ts +17 -17
- package/src/services/api.service.ts +73 -73
- package/src/services/clean-local-forage.service.ts +58 -58
- package/src/services/date-format.service.ts +74 -74
- package/src/services/dict-local-forage.service.ts +58 -58
- package/src/services/form-bean-utils.service.ts +41 -41
- package/src/services/form-local-forage.service.ts +59 -59
- package/src/services/form-tools.service.ts +739 -739
- package/src/services/form-tree-node-convert.service.ts +240 -240
- package/src/services/form-validate.service.ts +103 -103
- package/src/services/index.ts +9 -9
- package/src/services/router.service.ts +96 -96
- package/src/services/validate-generator.service.ts +710 -710
- package/src/shims-vue.d.ts +6 -6
- package/src/store/dict.store.ts +63 -63
- package/src/store/form.store.ts +32 -32
- package/src/store/index.ts +2 -2
- package/src/styles/datePicker.scss +125 -125
- package/src/styles/index.scss +195 -195
- package/src/styles/theme1.scss +277 -277
- package/src/styles/theme2.scss +376 -376
- package/src/styles/themes.scss +9 -9
- package/src/types/vfForm.ts +11 -11
- package/types/components/index.d.ts +3 -3
- package/types/constants/config/form-template.config.d.ts +30 -30
- package/types/constants/config/form.config.d.ts +4 -4
- package/types/constants/config/storage.config.d.ts +4 -4
- package/types/constants/encode-assets/svg.d.ts +5 -5
- package/types/constants/enum/builtIn-label.enum.d.ts +7 -7
- package/types/constants/enum/cache-type.enum.d.ts +15 -15
- package/types/constants/enum/control-format-type.enum.d.ts +23 -23
- package/types/constants/enum/dynamic-option-type.enum.d.ts +11 -11
- package/types/constants/enum/form-bus-attr.enum.d.ts +19 -19
- package/types/constants/enum/form-field-class.enum.d.ts +18 -18
- package/types/constants/enum/form-field-type.enum.d.ts +111 -111
- package/types/constants/enum/form-type.enum.d.ts +11 -11
- package/types/constants/enum/index.d.ts +19 -19
- package/types/constants/enum/lateral-arrangement.enum.d.ts +23 -23
- package/types/constants/enum/money-unit.enum.d.ts +15 -15
- package/types/constants/enum/option-type.enum.d.ts +11 -11
- package/types/constants/enum/submitted-type.enum.d.ts +115 -115
- package/types/constants/enum/support-upload-type.enum.d.ts +11 -11
- package/types/constants/enum/switch.enum.d.ts +11 -11
- package/types/constants/enum/upload-type.enum.d.ts +59 -59
- package/types/constants/enum/validate-rules.enum.d.ts +2 -2
- package/types/constants/enum/validate-status.enum.d.ts +2 -2
- package/types/constants/enum/vertical-arrangement.enum.d.ts +21 -21
- package/types/constants/enum/zoom-type.d.ts +15 -15
- package/types/constants/index.d.ts +3 -3
- package/types/core/FormApi.d.ts +376 -376
- package/types/core/index.d.ts +1 -1
- package/types/domain/AbstractControl.d.ts +5 -5
- package/types/domain/Control.d.ts +13 -13
- package/types/domain/CustomFormat.d.ts +5 -5
- package/types/domain/DesForm.d.ts +32 -32
- package/types/domain/DesFormControl.d.ts +160 -160
- package/types/domain/DesFormLayout.d.ts +33 -33
- package/types/domain/FieldChangeHistory.d.ts +9 -9
- package/types/domain/FormConfig.d.ts +16 -15
- package/types/domain/FormControl.d.ts +60 -60
- package/types/domain/FormEnum.d.ts +10 -10
- package/types/domain/FormGroup.d.ts +27 -27
- package/types/domain/FormRestfulResponse.d.ts +6 -6
- package/types/domain/ProvideInjectData.d.ts +10 -10
- package/types/domain/SysDictDetail.d.ts +24 -24
- package/types/domain/SysDictInfo.d.ts +26 -26
- package/types/domain/SysDictTreeDetail.d.ts +34 -34
- package/types/domain/index.d.ts +12 -12
- package/types/filtres/amount-capitalization.filter.d.ts +7 -7
- package/types/filtres/extract-options.filter.d.ts +13 -13
- package/types/filtres/generate-grid-column-end.filter.d.ts +11 -11
- package/types/filtres/generate-grid-template-columns.filter.d.ts +11 -11
- package/types/filtres/switch-enum-convert.filter.d.ts +2 -2
- package/types/filtres/zoom-multiple.filter.d.ts +3 -3
- package/types/index.d.ts +13 -13
- package/types/main.d.ts +2 -2
- package/types/services/api.service.d.ts +25 -25
- package/types/services/clean-local-forage.service.d.ts +28 -28
- package/types/services/date-format.service.d.ts +21 -21
- package/types/services/dict-local-forage.service.d.ts +28 -28
- package/types/services/form-bean-utils.service.d.ts +23 -23
- package/types/services/form-local-forage.service.d.ts +28 -28
- package/types/services/form-tools.service.d.ts +153 -153
- package/types/services/form-tree-node-convert.service.d.ts +104 -104
- package/types/services/form-validate.service.d.ts +32 -32
- package/types/services/index.d.ts +9 -9
- package/types/services/router.service.d.ts +40 -40
- package/types/services/validate-generator.service.d.ts +154 -154
- package/types/store/dict.store.d.ts +29 -29
- package/types/store/form.store.d.ts +17 -17
- package/types/store/index.d.ts +2 -2
- package/types/types/vfForm.d.ts +10 -10
- package/.env.local.bak +0 -6
- package/.eslintrc.js +0 -28
- package/babel.config.js +0 -3
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/public/js/pinyin.ts +0 -101
- package/tsconfig.json +0 -40
- package/vue.config.js +0 -38
package/src/App.vue
CHANGED
|
@@ -1,741 +1,741 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="lo-container" ref="scrollView">
|
|
3
|
-
<div class="lo-content">
|
|
4
|
-
<div class="lo-title">form API测试</div>
|
|
5
|
-
<div class="lo-ins">
|
|
6
|
-
<div class="lo-api">
|
|
7
|
-
<div class="lo-api-item">
|
|
8
|
-
<div class="lo-item-title">编辑模式:</div>
|
|
9
|
-
<div class="lo-item-opts">
|
|
10
|
-
<a-switch v-model:checked="formApi.edit" checked-children="开" un-checked-children="关" />
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
<div class="lo-api">
|
|
15
|
-
<div class="lo-api-item">
|
|
16
|
-
<div class="lo-item-title">控件对象key值:</div>
|
|
17
|
-
<div class="lo-item-opts">
|
|
18
|
-
<a-input v-model:value="controlKey" placeholder="请输入控件key值" />
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
<div class="lo-api-item">
|
|
22
|
-
<div class="lo-item-title">目标属性:</div>
|
|
23
|
-
<div class="lo-item-opts">
|
|
24
|
-
<a-select v-model:value="controlAttr" show-search :filter-option="filterOption" style="width: 150px">
|
|
25
|
-
<a-select-option :value="''">请选择</a-select-option>
|
|
26
|
-
<a-select-option v-for="(propName, i) of Object.keys(attribute)" :value="attribute[propName]" :key="i" placeholder="属性名称">
|
|
27
|
-
{{ propName }}
|
|
28
|
-
</a-select-option>
|
|
29
|
-
</a-select>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
<div class="lo-api-item">
|
|
33
|
-
<div class="lo-item-title">设置值:</div>
|
|
34
|
-
<div class="lo-item-opts">
|
|
35
|
-
<a-input v-model:value="controlvalue" placeholder="相关值" />
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
<div class="lo-api-item">
|
|
39
|
-
<div class="lo-item-title">读操作:</div>
|
|
40
|
-
<div class="lo-item-opts">
|
|
41
|
-
<a-button type="primary" class="ml-5" @click="getControl()">获取控件对象</a-button>
|
|
42
|
-
<a-button type="primary" class="ml-5" @click="getControlEl()">获取控件dom对象</a-button>
|
|
43
|
-
<a-button type="primary" class="ml-5" @click="getValue()">获取值</a-button>
|
|
44
|
-
<a-button type="primary" class="ml-5" @click="getText()">获取文本</a-button>
|
|
45
|
-
<a-button type="primary" class="ml-5" @click="getOptions()">获取可选项</a-button>
|
|
46
|
-
<a-button type="primary" class="ml-5" @click="getValidate()">获取校验</a-button>
|
|
47
|
-
<a-button type="primary" class="ml-5" @click="removeValidate()">移除校验</a-button>
|
|
48
|
-
<a-button type="primary" class="ml-5" @click="getValidates()">获取校验集合</a-button>
|
|
49
|
-
<a-button type="primary" class="ml-5" @click="refreshValidate()">校验指定控件</a-button>
|
|
50
|
-
<a-button type="primary" class="ml-5" @click="validateReport()">校验表单</a-button>
|
|
51
|
-
<a-button type="primary" class="ml-5" @click="validateTips()">校验表单并弹出提示</a-button>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
<div class="lo-api">
|
|
56
|
-
<div class="lo-api-item">
|
|
57
|
-
<div class="lo-item-title">写操作:</div>
|
|
58
|
-
<div class="lo-item-opts">
|
|
59
|
-
<a-button type="primary" class="ml-5" @click="setValue()">设置值</a-button>
|
|
60
|
-
<a-button type="primary" class="ml-5" @click="setOptions()">设置可选项</a-button>
|
|
61
|
-
<a-button type="primary" class="ml-5" @click="setAttribute()">设置常规属性</a-button>
|
|
62
|
-
<a-button type="primary" class="ml-5" @click="setValidate()">设置校验</a-button>
|
|
63
|
-
<div style="display: inline-block; margin: 0 10px 0 15px">|</div>
|
|
64
|
-
<a-button type="primary" class="ml-5" @click="setFormData()">赋值整个表单</a-button>
|
|
65
|
-
<a-button type="primary" class="ml-5" @click="setFormOldData()">赋值整个表单-新旧值对比</a-button>
|
|
66
|
-
<a-button type="primary" class="ml-5" @click="resetValue()">重置整个表单</a-button>
|
|
67
|
-
<a-button type="primary" class="ml-5" @click="refreshAndUpdateData()">刷新与更新整个表单</a-button>
|
|
68
|
-
<a-button type="primary" class="ml-5" @click="resetFormValidateState()">重置表单校验状态</a-button>
|
|
69
|
-
<div style="display: inline-block; margin: 0 10px 0 15px">|</div>
|
|
70
|
-
<a-button type="primary" class="ml-5" @click="setFieldChangeHistory()">设置变更历史</a-button>
|
|
71
|
-
<div style="display: inline-block; margin: 0 10px 0 15px">|</div>
|
|
72
|
-
<a-button type="primary" class="ml-5" @click="setAutoCompleteOptions()">设置自动完成数据</a-button>
|
|
73
|
-
<div style="display: inline-block; margin: 0 10px 0 15px">|</div>
|
|
74
|
-
<a-button type="primary" class="ml-5" @click="setControl()">api方式新增控件对象</a-button>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
<div class="lo-api">
|
|
79
|
-
<div class="lo-api-item">
|
|
80
|
-
<div class="lo-item-title">写操作:</div>
|
|
81
|
-
<div class="lo-item-opts">
|
|
82
|
-
<a-button type="primary" class="ml-5" @click="getAttribute()">获取常规属性</a-button>
|
|
83
|
-
<a-button type="primary" class="ml-5" @click="setAttribute()">设置常规属性</a-button>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
<div class="lo-api">
|
|
88
|
-
<div class="lo-api-item">
|
|
89
|
-
<div class="lo-item-title">自定义类型:</div>
|
|
90
|
-
<div class="lo-item-opts">
|
|
91
|
-
<a-input v-model:value="controlCustomType" placeholder="相关值" />
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
<div class="lo-api-item">
|
|
95
|
-
<div class="lo-item-title">操作:</div>
|
|
96
|
-
<div class="lo-item-opts">
|
|
97
|
-
<a-button type="primary" class="ml-5" @click="setFormatDisplayAndOutput()">设置自定义控件格式化显示和输出</a-button>
|
|
98
|
-
|
|
|
99
|
-
<a-button type="primary" class="ml-5" @click="submit()">提交表单显示</a-button>
|
|
100
|
-
</div>
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
<div class="lo-input">
|
|
104
|
-
<!--styleMode="credit-rd" :formId="'773549593606574080'"-->
|
|
105
|
-
<dy-form v-if="showForm" :formId="'995416144285929472'" v-model:edit="formApi.edit" v-model:formApi="formApi" @change="onChange($event)" @click="onClick($event)" @focus="onFocus($event)" @blur="onBlur($event)" @addon-before="onAddonBeforeHandler($event)" @addon-after="onAddonAfterHandler($event)" @add-item="selectAddItem($event)">
|
|
106
|
-
<template #combinationSelector="{ control, onChange }">
|
|
107
|
-
<div class="lo-custom-control-box">
|
|
108
|
-
<a-input v-model:value="control.formControl.value" @input="onChange(control.formControl)" v-if="control && control.formControl" />
|
|
109
|
-
<!-- <a-input-number style="flex-grow: 1" v-model="control.formControl.value" :min="1" :max="100" @change="onChange(control)" />
|
|
110
|
-
<a-select style="flex-basis: 100px; max-width: 100px">
|
|
111
|
-
<a-select-option value="jack"> Jack </a-select-option>
|
|
112
|
-
<a-select-option value="lucy"> Lucy </a-select-option>
|
|
113
|
-
</a-select>-->
|
|
114
|
-
</div>
|
|
115
|
-
</template>
|
|
116
|
-
<!--<template v-slot:input:prefix:testx1-1>¥</template>
|
|
117
|
-
<template v-slot:input:suffix:testx1-1>RMB</template>
|
|
118
|
-
<template v-slot:input:addonBefore:testx1-1>https://</template>
|
|
119
|
-
<template v-slot:input:addonAfter:testx1-1>.cn</template>
|
|
120
|
-
<template v-slot:select:suffixIcon:testx1-1-1>哇哈哈</template>-->
|
|
121
|
-
<!--<template v-slot:select:suffixIcon:testx1-1-1>哇哈哈</template>-->
|
|
122
|
-
<template v-slot:select:suffixIcon:productName>
|
|
123
|
-
<div class="lo-multiple-select-suffix-icon" @click="handleMultiChoiceEmbeddedCustomization">
|
|
124
|
-
<img :src="dropDownListSvg" />
|
|
125
|
-
</div>
|
|
126
|
-
</template>
|
|
127
|
-
</dy-form>
|
|
128
|
-
</div>
|
|
129
|
-
<div class="lo-value">
|
|
130
|
-
<span class="lo-title">输出: {{ formApi.formData }}</span>
|
|
131
|
-
</div>
|
|
132
|
-
<div>
|
|
133
|
-
<pre>
|
|
134
|
-
{{ dictionaryFormatCollection.sysDictTreeDetailOptions }}
|
|
135
|
-
</pre
|
|
136
|
-
>
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
</div>
|
|
140
|
-
</div>
|
|
141
|
-
</template>
|
|
142
|
-
|
|
143
|
-
<script lang="ts">
|
|
144
|
-
import { Ref } from "vue-property-decorator";
|
|
145
|
-
import { FormRestfulResponse } from "./domain/FormRestfulResponse";
|
|
146
|
-
import { Attribute, FormApi } from "./core/index";
|
|
147
|
-
import DyForm from "./components/form/DvForm.vue";
|
|
148
|
-
import { Switch, Button, Input, Select, InputNumber } from "ant-design-vue";
|
|
149
|
-
import { Control, CustomFormat, DesForm, DesFormControl, FieldChangeHistory, FormControl, Validate, ValidateReport } from "./domain/index";
|
|
150
|
-
import { ValidateRules, ValidateStatus } from "./constants/enum/index";
|
|
151
|
-
import { DROP_DOWN_LIST_SVG_XML } from "./constants/encode-assets/svg";
|
|
152
|
-
import { formTemplate } from "./constants/config/form-template.config";
|
|
153
|
-
import { DictionaryFormatCollection, formToolsService } from "./services/form-tools.service";
|
|
154
|
-
import { Options, Vue } from "vue-property-decorator";
|
|
155
|
-
@Options({
|
|
156
|
-
name: "vf-app",
|
|
157
|
-
components: {
|
|
158
|
-
DyForm,
|
|
159
|
-
[Switch.name]: Switch,
|
|
160
|
-
[Button.name]: Button,
|
|
161
|
-
[Input.name]: Input,
|
|
162
|
-
[InputNumber.name]: InputNumber,
|
|
163
|
-
[Select.name]: Select,
|
|
164
|
-
[Select.Option.displayName + ""]: Select.Option,
|
|
165
|
-
[Select.OptGroup.displayName + ""]: Select.OptGroup,
|
|
166
|
-
},
|
|
167
|
-
})
|
|
168
|
-
export default class App extends Vue {
|
|
169
|
-
@Ref() scrollView: any;
|
|
170
|
-
dropDownListSvg = DROP_DOWN_LIST_SVG_XML;
|
|
171
|
-
showForm = false;
|
|
172
|
-
controlKey = "productName";
|
|
173
|
-
controlvalue = "productName";
|
|
174
|
-
controlCustomType = "combinationSelector";
|
|
175
|
-
controlAttr: Attribute | any = "";
|
|
176
|
-
attribute = Attribute;
|
|
177
|
-
srcDesForm: DesForm | undefined;
|
|
178
|
-
fieldChangeHistory: FieldChangeHistory = {
|
|
179
|
-
productName: [
|
|
180
|
-
{ time: "2021-09-08", before: "玖龙", after: "玲珑", author: "爱笑笑" },
|
|
181
|
-
{ time: "2021-09-09", before: "玲珑", after: "黑珑", author: "爱笑笑" },
|
|
182
|
-
{ time: "2021-09-11", before: "玖龙", after: "玲珑", author: "爱笑笑" },
|
|
183
|
-
{ time: "2021-09-12", before: "玲珑", after: "黑珑", author: "爱笑笑" },
|
|
184
|
-
{ time: "2021-09-13", before: "玖龙", after: "玲珑", author: "爱笑笑" },
|
|
185
|
-
{ time: "2021-09-14", before: "玲珑", after: "黑珑", author: "爱笑笑" },
|
|
186
|
-
{ time: "2021-09-17", before: "玖龙", after: "玲珑", author: "爱笑笑" },
|
|
187
|
-
{ time: "2021-09-16", before: "玲珑", after: "黑珑", author: "爱笑笑" },
|
|
188
|
-
],
|
|
189
|
-
};
|
|
190
|
-
formApi: FormApi = new FormApi({
|
|
191
|
-
edit: true,
|
|
192
|
-
});
|
|
193
|
-
dictionaryFormatCollection: DictionaryFormatCollection = {
|
|
194
|
-
sysDictDetailOptions: [],
|
|
195
|
-
sysDictTreeDetailOptions: [],
|
|
196
|
-
};
|
|
197
|
-
mounted(): void {
|
|
198
|
-
const desForm: DesForm | any = formTemplate;
|
|
199
|
-
desForm.desFormLayouts[0].desFormControls.push({
|
|
200
|
-
formFieldId: "1",
|
|
201
|
-
layoutId: "1",
|
|
202
|
-
boundProperty: "xx.applyId",
|
|
203
|
-
extendBoundPropertyOne: "",
|
|
204
|
-
extendBoundPropertyTwo: "",
|
|
205
|
-
formFieldDescribe: "申请编号",
|
|
206
|
-
controlType: "1",
|
|
207
|
-
tableFieldOrder: 1,
|
|
208
|
-
fieldDefaultValue: '""',
|
|
209
|
-
titleWidth: "",
|
|
210
|
-
isBoldTitle: "0",
|
|
211
|
-
isHideTitle: "0",
|
|
212
|
-
titleColor: "",
|
|
213
|
-
placeholder: "",
|
|
214
|
-
tips: "",
|
|
215
|
-
isNotEdit: "0",
|
|
216
|
-
bindingPrefix: "",
|
|
217
|
-
bindingSuffix: "",
|
|
218
|
-
builtInFrontLabel: "",
|
|
219
|
-
builtInPostLabel: "",
|
|
220
|
-
isHideControl: "0",
|
|
221
|
-
controlWidth: "",
|
|
222
|
-
isPasswordBox: "0",
|
|
223
|
-
initRowHeight: null,
|
|
224
|
-
isFixedRowHeight: "0",
|
|
225
|
-
formatType: "1",
|
|
226
|
-
minValue: null,
|
|
227
|
-
maxValue: null,
|
|
228
|
-
step: null,
|
|
229
|
-
decimalPlaces: null,
|
|
230
|
-
thousandthPercentileFormat: "0",
|
|
231
|
-
unit: "",
|
|
232
|
-
moneyUnit: "[]",
|
|
233
|
-
defineOptionalUnits: "",
|
|
234
|
-
defineOptionalUnitsDefault: "",
|
|
235
|
-
zoomType: "",
|
|
236
|
-
zoomMultiple: null,
|
|
237
|
-
isShowCapitalization: "0",
|
|
238
|
-
isLineFeedDisplay: "0",
|
|
239
|
-
isOptionType: "2",
|
|
240
|
-
optionConfig: "",
|
|
241
|
-
dynamicOptionType: "1",
|
|
242
|
-
generalDictionary: "",
|
|
243
|
-
generalDictionaryOptions: "",
|
|
244
|
-
treeShape: "",
|
|
245
|
-
treeShapeOptions: "",
|
|
246
|
-
disableNonLeafNodes: "0",
|
|
247
|
-
dateFormat: "YYYY-MM-DD",
|
|
248
|
-
timeFormat: "HH:mm:ss",
|
|
249
|
-
isSupportMultiple: "0",
|
|
250
|
-
maxUploadNumber: null,
|
|
251
|
-
limitSize: null,
|
|
252
|
-
supportUploadType: "1",
|
|
253
|
-
extendUploadType: "",
|
|
254
|
-
customUploadType: "",
|
|
255
|
-
attachmentExtendProperties: "",
|
|
256
|
-
isMultipleChoice: "0",
|
|
257
|
-
isSearchable: "0",
|
|
258
|
-
canAddEntry: "0",
|
|
259
|
-
isClearButton: "0",
|
|
260
|
-
onOpeningValue: "",
|
|
261
|
-
whenClosedValue: "",
|
|
262
|
-
onOpeningText: "",
|
|
263
|
-
whenClosedText: "",
|
|
264
|
-
customFieldName: "",
|
|
265
|
-
verificationRules: "[]",
|
|
266
|
-
busAttr: '{"submittedType":"","isSupplement":false,"isKeyElements":false,"isTrack":false}',
|
|
267
|
-
});
|
|
268
|
-
this.srcDesForm = formToolsService.formatDesForm(desForm);
|
|
269
|
-
this.$formToolsService.init().then((res: FormRestfulResponse) => {
|
|
270
|
-
this.showForm = true;
|
|
271
|
-
// this.formApi.setAttribute("testx1-1-1", Attribute.TextFold, true);
|
|
272
|
-
// this.formApi.setAttribute("testx1-1-1", Attribute.HiddenDropdown, true);
|
|
273
|
-
});
|
|
274
|
-
// this.dictLocalcConvert();
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
created() {}
|
|
278
|
-
|
|
279
|
-
onChange(e: any): void {
|
|
280
|
-
if (e instanceof FormControl) {
|
|
281
|
-
e.formControl = e;
|
|
282
|
-
}
|
|
283
|
-
const paymentType = this.formApi.getValue("productName");
|
|
284
|
-
const comId = this.formApi.getValue("comId");
|
|
285
|
-
if (e.formControl && e.formControl.key === "productName") {
|
|
286
|
-
// this.formApi.setAttribute("productId", Attribute.IsHideControl, paymentType === "2");
|
|
287
|
-
this.formApi.setRequiredValidate("productCode", paymentType === "2");
|
|
288
|
-
} else if (e.formControl && e.formControl.key === "comId") {
|
|
289
|
-
this.formApi.setAttribute("productId", Attribute.IsHideControl, comId);
|
|
290
|
-
}
|
|
291
|
-
console.log(e);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
onClick(e: any): void {
|
|
295
|
-
/*console.log(e);*/
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
onFocus(e: any): void {
|
|
299
|
-
/*console.log(e);*/
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
onBlur(e: any): void {
|
|
303
|
-
/*console.log(e);*/
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* @description: 内置前置标签事件
|
|
308
|
-
* @author ChenRui
|
|
309
|
-
* @date 2021/4/23 9:42
|
|
310
|
-
*/
|
|
311
|
-
onAddonBeforeHandler(event: any): void {
|
|
312
|
-
console.log("AddonBefore", event);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* @description: 内置后置标签事件
|
|
317
|
-
* @author ChenRui
|
|
318
|
-
* @date 2021/4/23 9:43
|
|
319
|
-
*/
|
|
320
|
-
onAddonAfterHandler(event: any): void {
|
|
321
|
-
console.log("AddonAfter", event);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
selectAddItem(e: any): void {
|
|
325
|
-
/*console.log(e);*/
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
filterOption(input: any, option: any) {
|
|
329
|
-
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* @description: 获取监控对象
|
|
334
|
-
* @author ChenRui
|
|
335
|
-
* @date 2021/1/29 10:05
|
|
336
|
-
*/
|
|
337
|
-
getControl(): void {
|
|
338
|
-
const control: Control = this.formApi.getControl(this.controlKey);
|
|
339
|
-
/*const it: IterableIterator<any> = this.formApi.encodedFormData;
|
|
340
|
-
let val = it.next().value;
|
|
341
|
-
while (val) {
|
|
342
|
-
console.log(val);
|
|
343
|
-
val = it.next().value;
|
|
344
|
-
}*/
|
|
345
|
-
console.log("控件对象:", control);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* @description: 获取值
|
|
350
|
-
* @author ChenRui
|
|
351
|
-
* @date 2021/1/29 14:58
|
|
352
|
-
*/
|
|
353
|
-
getValue(): void {
|
|
354
|
-
const val: any = this.formApi.getValue(this.controlKey);
|
|
355
|
-
console.log("控件值:", val);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* @description: 设置值
|
|
360
|
-
* @author ChenRui
|
|
361
|
-
* @date 2021/1/29 16:37
|
|
362
|
-
*/
|
|
363
|
-
setValue(): void {
|
|
364
|
-
this.formApi.setValue(this.controlKey, this.controlvalue);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* @description: 重置数据
|
|
369
|
-
* @author ChenRui
|
|
370
|
-
* @date 2021/2/22 17:40
|
|
371
|
-
*/
|
|
372
|
-
resetValue(): void {
|
|
373
|
-
this.formApi.resetValue();
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* @description: 刷新整个表单
|
|
378
|
-
* @author ChenRui
|
|
379
|
-
* @date 2022/4/6 11:24
|
|
380
|
-
*/
|
|
381
|
-
refreshAndUpdateData(): void {
|
|
382
|
-
this.formApi.refreshAndUpdateData();
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* @description: 重置表单校验状态
|
|
387
|
-
* @author ChenRui
|
|
388
|
-
* @date 2022/4/6 12:04
|
|
389
|
-
*/
|
|
390
|
-
resetFormValidateState(): void {
|
|
391
|
-
this.formApi.resetFormValidateState();
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* @description: 新增控件对象
|
|
396
|
-
* @author ChenRui
|
|
397
|
-
* @date 2021/8/27 11:19
|
|
398
|
-
*/
|
|
399
|
-
setControl(): void {
|
|
400
|
-
// const control: Control = this.formApi.setControl(this.controlKey);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* @description: 设置字段变更历史
|
|
405
|
-
* @author ChenRui
|
|
406
|
-
* @date 2021/4/25 16:36
|
|
407
|
-
*/
|
|
408
|
-
setFieldChangeHistory(): void {
|
|
409
|
-
this.formApi.setFieldChangeHistory(this.fieldChangeHistory);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* @description: 设置自动完成数据
|
|
414
|
-
* @author ChenRui
|
|
415
|
-
* @date 2022/5/7 18:16
|
|
416
|
-
*/
|
|
417
|
-
setAutoCompleteOptions(): void {
|
|
418
|
-
this.formApi.setAttribute(this.controlKey, Attribute.AutoCompleteOptions, ["张三"]);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* @description: 获取文本
|
|
423
|
-
* @author ChenRui
|
|
424
|
-
* @date 2021/1/29 15:14
|
|
425
|
-
*/
|
|
426
|
-
getText(): void {
|
|
427
|
-
const text: any = this.formApi.getText(this.controlKey);
|
|
428
|
-
console.log("文本:", text);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* @description: 获取可选项
|
|
433
|
-
* @author ChenRui
|
|
434
|
-
* @date 2021/1/29 16:20
|
|
435
|
-
*/
|
|
436
|
-
getOptions(): void {
|
|
437
|
-
const options: any[] = this.formApi.getOptions(this.controlKey);
|
|
438
|
-
console.log("可选项:", options);
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* @description: 设置可选项
|
|
443
|
-
* @author ChenRui
|
|
444
|
-
* @date 2021/1/29 16:21
|
|
445
|
-
*/
|
|
446
|
-
setOptions(): void {
|
|
447
|
-
const data: any[] = [
|
|
448
|
-
{ value: "1", title: "张三" },
|
|
449
|
-
{ value: "2", title: "李四" },
|
|
450
|
-
{ value: "3", title: "王五" },
|
|
451
|
-
{ value: "4", title: "赵六" },
|
|
452
|
-
{ value: "5", title: "孙七" },
|
|
453
|
-
{ value: "6", title: "周八" },
|
|
454
|
-
{ value: "7", title: "吴九" },
|
|
455
|
-
{ value: "8", title: "郑十" },
|
|
456
|
-
];
|
|
457
|
-
this.formApi.setOptions(this.controlKey, data, "2");
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* @description: 设置常规属性
|
|
462
|
-
* @author ChenRui
|
|
463
|
-
* @date 2021/1/29 17:29
|
|
464
|
-
*/
|
|
465
|
-
setAttribute(): void {
|
|
466
|
-
if (this.controlAttr) {
|
|
467
|
-
this.formApi.setAttribute(this.controlKey, this.controlAttr, this.controlvalue);
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* @description: 获取常规属性
|
|
473
|
-
* @author ChenRui
|
|
474
|
-
* @date 2021/1/29 18:11
|
|
475
|
-
*/
|
|
476
|
-
getAttribute(): void {
|
|
477
|
-
if (this.controlAttr) {
|
|
478
|
-
const attr: any = this.formApi.getAttribute(this.controlKey, this.controlAttr);
|
|
479
|
-
console.log("属性值:", attr);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
/**
|
|
484
|
-
* @description: 获取校验
|
|
485
|
-
* @author ChenRui
|
|
486
|
-
* @date 2021/1/30 11:49
|
|
487
|
-
*/
|
|
488
|
-
getValidate(): void {
|
|
489
|
-
const validate: any = this.formApi.getValidate(this.controlKey, this.controlvalue);
|
|
490
|
-
console.log("字段校验结果:", validate);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* @description: 获取校验集合
|
|
495
|
-
* @author ChenRui
|
|
496
|
-
* @date 2021/1/30 11:50
|
|
497
|
-
*/
|
|
498
|
-
getValidates(): void {
|
|
499
|
-
const validates: any[] = this.formApi.getValidates(this.controlKey);
|
|
500
|
-
console.log("表单校验结果:", validates);
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
refreshValidate(): void {
|
|
504
|
-
this.formApi.refreshValidate(this.controlKey);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* @description:
|
|
509
|
-
* @author ChenRui
|
|
510
|
-
* @date 2021/4/1 21:29
|
|
511
|
-
*/
|
|
512
|
-
removeValidate(): void {
|
|
513
|
-
this.formApi.removeValidate(this.controlKey, ValidateRules.Required.code);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
/**
|
|
517
|
-
* @description: 获取控件dom对象
|
|
518
|
-
* @author ChenRui
|
|
519
|
-
* @date 2021/2/26 17:16
|
|
520
|
-
*/
|
|
521
|
-
getControlEl(): void {
|
|
522
|
-
const controlEl: any = this.formApi.getControlEl(this.controlKey);
|
|
523
|
-
console.log("控件选项:", controlEl);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* @description: 获取校验报告
|
|
528
|
-
* @author ChenRui
|
|
529
|
-
* @date 2021/2/22 14:08
|
|
530
|
-
*/
|
|
531
|
-
validateReport(): void {
|
|
532
|
-
const result: boolean = this.formApi.validate();
|
|
533
|
-
// this.formApi.setAttribute("testx1-1", Attribute.IsHideControl, true);
|
|
534
|
-
const validateResults: ValidateReport[] = this.formApi.validateReport();
|
|
535
|
-
console.log("校验结果:", validateResults);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* @description: 校验表单并提示
|
|
540
|
-
* @author ChenRui
|
|
541
|
-
* @date 2021/8/18 17:38
|
|
542
|
-
*/
|
|
543
|
-
validateTips(): void {
|
|
544
|
-
// this.$formToolsService.validateTips(this.formApi, this.scrollView);
|
|
545
|
-
// this.formApi.validateTips(this.scrollView);
|
|
546
|
-
this.formApi.validateTips(window);
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
* @description: 设置校验
|
|
551
|
-
* @author ChenRui
|
|
552
|
-
* @date 2021/1/30 11:56
|
|
553
|
-
*/
|
|
554
|
-
setValidate(): void {
|
|
555
|
-
const validates: Validate[] = [
|
|
556
|
-
{
|
|
557
|
-
name: "define",
|
|
558
|
-
validateFunc: (val: any) => {
|
|
559
|
-
if (val == null || val === "") {
|
|
560
|
-
return {
|
|
561
|
-
validateStatus: ValidateStatus.Error.code,
|
|
562
|
-
errorMsg: "空空空",
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
return {
|
|
566
|
-
validateStatus: ValidateStatus.Success.code,
|
|
567
|
-
};
|
|
568
|
-
},
|
|
569
|
-
},
|
|
570
|
-
];
|
|
571
|
-
// this.formApi.setValidate(this.controlKey, validates);
|
|
572
|
-
this.formApi.setValidate("testx1-5-4", {
|
|
573
|
-
ruleType: ValidateRules.Required.code,
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
* @description: 设置格式化显示与输出
|
|
579
|
-
* @author ChenRui
|
|
580
|
-
* @date 2021/2/4 19:55
|
|
581
|
-
*/
|
|
582
|
-
setFormatDisplayAndOutput(): void {
|
|
583
|
-
const customFormat: CustomFormat = {
|
|
584
|
-
display: (val: any, desFormControl: DesFormControl) => {
|
|
585
|
-
return val + "$";
|
|
586
|
-
},
|
|
587
|
-
output: (val: any, desFormControl: DesFormControl) => {
|
|
588
|
-
return val + "$$";
|
|
589
|
-
},
|
|
590
|
-
};
|
|
591
|
-
this.formApi.setFormatDisplayAndOutput(this.controlCustomType, customFormat);
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
/**
|
|
595
|
-
* @description: 提交表单
|
|
596
|
-
* @author ChenRui
|
|
597
|
-
* @date 2021/11/15 22:44
|
|
598
|
-
*/
|
|
599
|
-
submit(): void {
|
|
600
|
-
console.log(this.formApi.formData);
|
|
601
|
-
console.log(this.formApi.encodedFormData);
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* @description: 赋值整个表单
|
|
606
|
-
* @author ChenRui
|
|
607
|
-
* @date 2021/2/4 10:32
|
|
608
|
-
*/
|
|
609
|
-
setFormData(): void {
|
|
610
|
-
/*const data: any = {
|
|
611
|
-
"testx1-1": "笑哈哈",
|
|
612
|
-
"testx1-2": 40,
|
|
613
|
-
"test1-1": {
|
|
614
|
-
"testx1-1-1": "1",
|
|
615
|
-
"testx1-1-2": "2",
|
|
616
|
-
},
|
|
617
|
-
"test1-2": {
|
|
618
|
-
"testx1-2-1": "1,2",
|
|
619
|
-
"testx1-2-2": "00001,00002",
|
|
620
|
-
},
|
|
621
|
-
"test1-4": {
|
|
622
|
-
"testx1-4-1": "9921313@qq.com",
|
|
623
|
-
},
|
|
624
|
-
"test1-5": {
|
|
625
|
-
"testx1-5-1": "04:23:55",
|
|
626
|
-
"testx1-5-2": "2021-12-04",
|
|
627
|
-
},
|
|
628
|
-
};*/
|
|
629
|
-
const data = {
|
|
630
|
-
productId: "2222",
|
|
631
|
-
};
|
|
632
|
-
this.formApi.setFormData(data, false, false);
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* @description: 赋值整个表单
|
|
637
|
-
* @author ChenRui
|
|
638
|
-
* @date 2021/2/4 10:32
|
|
639
|
-
*/
|
|
640
|
-
setFormOldData(): void {
|
|
641
|
-
const data = {
|
|
642
|
-
productId: "2222",
|
|
643
|
-
productCode: 11111,
|
|
644
|
-
comId: 1,
|
|
645
|
-
productName: "1",
|
|
646
|
-
deptId: "2121",
|
|
647
|
-
engName: "2",
|
|
648
|
-
updateUser: "1",
|
|
649
|
-
productVersion: "1",
|
|
650
|
-
productManangerName: "2",
|
|
651
|
-
productMananger: "1992-06-13",
|
|
652
|
-
mark: "111",
|
|
653
|
-
createTime: "1,11,111",
|
|
654
|
-
xxx: "2222",
|
|
655
|
-
};
|
|
656
|
-
this.formApi.setFormData(data, false, false, data);
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
handleMultiChoiceEmbeddedCustomization(): void {
|
|
660
|
-
console.log("下了多选自定义事件");
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
dictLocalcConvert(): void {
|
|
664
|
-
/*const appData = require("./assets/x.json");
|
|
665
|
-
const dictionaryFormatCollection: DictionaryFormatCollection = formToolsService.inidDictOptions(appData);
|
|
666
|
-
this.dictionaryFormatCollection = dictionaryFormatCollection;*/
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
</script>
|
|
670
|
-
|
|
671
|
-
<style lang="scss" scoped>
|
|
672
|
-
.ml-5 {
|
|
673
|
-
margin-left: 5px;
|
|
674
|
-
}
|
|
675
|
-
.lo-container {
|
|
676
|
-
display: flex;
|
|
677
|
-
flex-direction: column;
|
|
678
|
-
.lo-content {
|
|
679
|
-
display: flex;
|
|
680
|
-
flex-direction: column;
|
|
681
|
-
margin-bottom: 20px;
|
|
682
|
-
padding: 10px 20px;
|
|
683
|
-
border: 1px solid #f0f0f0;
|
|
684
|
-
.lo-title {
|
|
685
|
-
font-size: 16px;
|
|
686
|
-
margin-bottom: 15px;
|
|
687
|
-
}
|
|
688
|
-
.lo-ins {
|
|
689
|
-
display: flex;
|
|
690
|
-
flex-direction: column;
|
|
691
|
-
.lo-api {
|
|
692
|
-
display: flex;
|
|
693
|
-
flex-wrap: wrap;
|
|
694
|
-
margin-bottom: 10px;
|
|
695
|
-
.lo-api-item {
|
|
696
|
-
display: flex;
|
|
697
|
-
flex-direction: row;
|
|
698
|
-
margin-right: 20px;
|
|
699
|
-
.lo-item-title {
|
|
700
|
-
min-width: 100px;
|
|
701
|
-
margin-right: 5px;
|
|
702
|
-
display: flex;
|
|
703
|
-
align-items: center;
|
|
704
|
-
}
|
|
705
|
-
.lo-item-opts {
|
|
706
|
-
display: flex;
|
|
707
|
-
flex-wrap: wrap;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
.lo-input {
|
|
712
|
-
margin: 5px 0;
|
|
713
|
-
}
|
|
714
|
-
.lo-value {
|
|
715
|
-
.lo-title {
|
|
716
|
-
margin-right: 10px;
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
.d-flex {
|
|
723
|
-
display: flex;
|
|
724
|
-
}
|
|
725
|
-
.flex-row {
|
|
726
|
-
flex-direction: row;
|
|
727
|
-
}
|
|
728
|
-
.mt-1 {
|
|
729
|
-
margin-top: 3px;
|
|
730
|
-
}
|
|
731
|
-
.mb-2 {
|
|
732
|
-
margin-bottom: 6px;
|
|
733
|
-
}
|
|
734
|
-
.mr-2 {
|
|
735
|
-
margin-right: 6px;
|
|
736
|
-
}
|
|
737
|
-
.lo-combination-selector {
|
|
738
|
-
display: flex;
|
|
739
|
-
flex-direction: row;
|
|
740
|
-
}
|
|
741
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="lo-container" ref="scrollView">
|
|
3
|
+
<div class="lo-content">
|
|
4
|
+
<div class="lo-title">form API测试</div>
|
|
5
|
+
<div class="lo-ins">
|
|
6
|
+
<div class="lo-api">
|
|
7
|
+
<div class="lo-api-item">
|
|
8
|
+
<div class="lo-item-title">编辑模式:</div>
|
|
9
|
+
<div class="lo-item-opts">
|
|
10
|
+
<a-switch v-model:checked="formApi.edit" checked-children="开" un-checked-children="关" />
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="lo-api">
|
|
15
|
+
<div class="lo-api-item">
|
|
16
|
+
<div class="lo-item-title">控件对象key值:</div>
|
|
17
|
+
<div class="lo-item-opts">
|
|
18
|
+
<a-input v-model:value="controlKey" placeholder="请输入控件key值" />
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="lo-api-item">
|
|
22
|
+
<div class="lo-item-title">目标属性:</div>
|
|
23
|
+
<div class="lo-item-opts">
|
|
24
|
+
<a-select v-model:value="controlAttr" show-search :filter-option="filterOption" style="width: 150px">
|
|
25
|
+
<a-select-option :value="''">请选择</a-select-option>
|
|
26
|
+
<a-select-option v-for="(propName, i) of Object.keys(attribute)" :value="attribute[propName]" :key="i" placeholder="属性名称">
|
|
27
|
+
{{ propName }}
|
|
28
|
+
</a-select-option>
|
|
29
|
+
</a-select>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="lo-api-item">
|
|
33
|
+
<div class="lo-item-title">设置值:</div>
|
|
34
|
+
<div class="lo-item-opts">
|
|
35
|
+
<a-input v-model:value="controlvalue" placeholder="相关值" />
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="lo-api-item">
|
|
39
|
+
<div class="lo-item-title">读操作:</div>
|
|
40
|
+
<div class="lo-item-opts">
|
|
41
|
+
<a-button type="primary" class="ml-5" @click="getControl()">获取控件对象</a-button>
|
|
42
|
+
<a-button type="primary" class="ml-5" @click="getControlEl()">获取控件dom对象</a-button>
|
|
43
|
+
<a-button type="primary" class="ml-5" @click="getValue()">获取值</a-button>
|
|
44
|
+
<a-button type="primary" class="ml-5" @click="getText()">获取文本</a-button>
|
|
45
|
+
<a-button type="primary" class="ml-5" @click="getOptions()">获取可选项</a-button>
|
|
46
|
+
<a-button type="primary" class="ml-5" @click="getValidate()">获取校验</a-button>
|
|
47
|
+
<a-button type="primary" class="ml-5" @click="removeValidate()">移除校验</a-button>
|
|
48
|
+
<a-button type="primary" class="ml-5" @click="getValidates()">获取校验集合</a-button>
|
|
49
|
+
<a-button type="primary" class="ml-5" @click="refreshValidate()">校验指定控件</a-button>
|
|
50
|
+
<a-button type="primary" class="ml-5" @click="validateReport()">校验表单</a-button>
|
|
51
|
+
<a-button type="primary" class="ml-5" @click="validateTips()">校验表单并弹出提示</a-button>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="lo-api">
|
|
56
|
+
<div class="lo-api-item">
|
|
57
|
+
<div class="lo-item-title">写操作:</div>
|
|
58
|
+
<div class="lo-item-opts">
|
|
59
|
+
<a-button type="primary" class="ml-5" @click="setValue()">设置值</a-button>
|
|
60
|
+
<a-button type="primary" class="ml-5" @click="setOptions()">设置可选项</a-button>
|
|
61
|
+
<a-button type="primary" class="ml-5" @click="setAttribute()">设置常规属性</a-button>
|
|
62
|
+
<a-button type="primary" class="ml-5" @click="setValidate()">设置校验</a-button>
|
|
63
|
+
<div style="display: inline-block; margin: 0 10px 0 15px">|</div>
|
|
64
|
+
<a-button type="primary" class="ml-5" @click="setFormData()">赋值整个表单</a-button>
|
|
65
|
+
<a-button type="primary" class="ml-5" @click="setFormOldData()">赋值整个表单-新旧值对比</a-button>
|
|
66
|
+
<a-button type="primary" class="ml-5" @click="resetValue()">重置整个表单</a-button>
|
|
67
|
+
<a-button type="primary" class="ml-5" @click="refreshAndUpdateData()">刷新与更新整个表单</a-button>
|
|
68
|
+
<a-button type="primary" class="ml-5" @click="resetFormValidateState()">重置表单校验状态</a-button>
|
|
69
|
+
<div style="display: inline-block; margin: 0 10px 0 15px">|</div>
|
|
70
|
+
<a-button type="primary" class="ml-5" @click="setFieldChangeHistory()">设置变更历史</a-button>
|
|
71
|
+
<div style="display: inline-block; margin: 0 10px 0 15px">|</div>
|
|
72
|
+
<a-button type="primary" class="ml-5" @click="setAutoCompleteOptions()">设置自动完成数据</a-button>
|
|
73
|
+
<div style="display: inline-block; margin: 0 10px 0 15px">|</div>
|
|
74
|
+
<a-button type="primary" class="ml-5" @click="setControl()">api方式新增控件对象</a-button>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
<div class="lo-api">
|
|
79
|
+
<div class="lo-api-item">
|
|
80
|
+
<div class="lo-item-title">写操作:</div>
|
|
81
|
+
<div class="lo-item-opts">
|
|
82
|
+
<a-button type="primary" class="ml-5" @click="getAttribute()">获取常规属性</a-button>
|
|
83
|
+
<a-button type="primary" class="ml-5" @click="setAttribute()">设置常规属性</a-button>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
<div class="lo-api">
|
|
88
|
+
<div class="lo-api-item">
|
|
89
|
+
<div class="lo-item-title">自定义类型:</div>
|
|
90
|
+
<div class="lo-item-opts">
|
|
91
|
+
<a-input v-model:value="controlCustomType" placeholder="相关值" />
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="lo-api-item">
|
|
95
|
+
<div class="lo-item-title">操作:</div>
|
|
96
|
+
<div class="lo-item-opts">
|
|
97
|
+
<a-button type="primary" class="ml-5" @click="setFormatDisplayAndOutput()">设置自定义控件格式化显示和输出</a-button>
|
|
98
|
+
|
|
|
99
|
+
<a-button type="primary" class="ml-5" @click="submit()">提交表单显示</a-button>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
<div class="lo-input">
|
|
104
|
+
<!--styleMode="credit-rd" :formId="'773549593606574080'"-->
|
|
105
|
+
<dy-form v-if="showForm" :formId="'995416144285929472'" v-model:edit="formApi.edit" v-model:formApi="formApi" @change="onChange($event)" @click="onClick($event)" @focus="onFocus($event)" @blur="onBlur($event)" @addon-before="onAddonBeforeHandler($event)" @addon-after="onAddonAfterHandler($event)" @add-item="selectAddItem($event)">
|
|
106
|
+
<template #combinationSelector="{ control, onChange }">
|
|
107
|
+
<div class="lo-custom-control-box">
|
|
108
|
+
<a-input v-model:value="control.formControl.value" @input="onChange(control.formControl)" v-if="control && control.formControl" />
|
|
109
|
+
<!-- <a-input-number style="flex-grow: 1" v-model="control.formControl.value" :min="1" :max="100" @change="onChange(control)" />
|
|
110
|
+
<a-select style="flex-basis: 100px; max-width: 100px">
|
|
111
|
+
<a-select-option value="jack"> Jack </a-select-option>
|
|
112
|
+
<a-select-option value="lucy"> Lucy </a-select-option>
|
|
113
|
+
</a-select>-->
|
|
114
|
+
</div>
|
|
115
|
+
</template>
|
|
116
|
+
<!--<template v-slot:input:prefix:testx1-1>¥</template>
|
|
117
|
+
<template v-slot:input:suffix:testx1-1>RMB</template>
|
|
118
|
+
<template v-slot:input:addonBefore:testx1-1>https://</template>
|
|
119
|
+
<template v-slot:input:addonAfter:testx1-1>.cn</template>
|
|
120
|
+
<template v-slot:select:suffixIcon:testx1-1-1>哇哈哈</template>-->
|
|
121
|
+
<!--<template v-slot:select:suffixIcon:testx1-1-1>哇哈哈</template>-->
|
|
122
|
+
<template v-slot:select:suffixIcon:productName>
|
|
123
|
+
<div class="lo-multiple-select-suffix-icon" @click="handleMultiChoiceEmbeddedCustomization">
|
|
124
|
+
<img :src="dropDownListSvg" />
|
|
125
|
+
</div>
|
|
126
|
+
</template>
|
|
127
|
+
</dy-form>
|
|
128
|
+
</div>
|
|
129
|
+
<div class="lo-value">
|
|
130
|
+
<span class="lo-title">输出: {{ formApi.formData }}</span>
|
|
131
|
+
</div>
|
|
132
|
+
<div>
|
|
133
|
+
<pre>
|
|
134
|
+
{{ dictionaryFormatCollection.sysDictTreeDetailOptions }}
|
|
135
|
+
</pre
|
|
136
|
+
>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</template>
|
|
142
|
+
|
|
143
|
+
<script lang="ts">
|
|
144
|
+
import { Ref } from "vue-property-decorator";
|
|
145
|
+
import { FormRestfulResponse } from "./domain/FormRestfulResponse";
|
|
146
|
+
import { Attribute, FormApi } from "./core/index";
|
|
147
|
+
import DyForm from "./components/form/DvForm.vue";
|
|
148
|
+
import { Switch, Button, Input, Select, InputNumber } from "ant-design-vue";
|
|
149
|
+
import { Control, CustomFormat, DesForm, DesFormControl, FieldChangeHistory, FormControl, Validate, ValidateReport } from "./domain/index";
|
|
150
|
+
import { ValidateRules, ValidateStatus } from "./constants/enum/index";
|
|
151
|
+
import { DROP_DOWN_LIST_SVG_XML } from "./constants/encode-assets/svg";
|
|
152
|
+
import { formTemplate } from "./constants/config/form-template.config";
|
|
153
|
+
import { DictionaryFormatCollection, formToolsService } from "./services/form-tools.service";
|
|
154
|
+
import { Options, Vue } from "vue-property-decorator";
|
|
155
|
+
@Options({
|
|
156
|
+
name: "vf-app",
|
|
157
|
+
components: {
|
|
158
|
+
DyForm,
|
|
159
|
+
[Switch.name]: Switch,
|
|
160
|
+
[Button.name]: Button,
|
|
161
|
+
[Input.name]: Input,
|
|
162
|
+
[InputNumber.name]: InputNumber,
|
|
163
|
+
[Select.name]: Select,
|
|
164
|
+
[Select.Option.displayName + ""]: Select.Option,
|
|
165
|
+
[Select.OptGroup.displayName + ""]: Select.OptGroup,
|
|
166
|
+
},
|
|
167
|
+
})
|
|
168
|
+
export default class App extends Vue {
|
|
169
|
+
@Ref() scrollView: any;
|
|
170
|
+
dropDownListSvg = DROP_DOWN_LIST_SVG_XML;
|
|
171
|
+
showForm = false;
|
|
172
|
+
controlKey = "productName";
|
|
173
|
+
controlvalue = "productName";
|
|
174
|
+
controlCustomType = "combinationSelector";
|
|
175
|
+
controlAttr: Attribute | any = "";
|
|
176
|
+
attribute = Attribute;
|
|
177
|
+
srcDesForm: DesForm | undefined;
|
|
178
|
+
fieldChangeHistory: FieldChangeHistory = {
|
|
179
|
+
productName: [
|
|
180
|
+
{ time: "2021-09-08", before: "玖龙", after: "玲珑", author: "爱笑笑" },
|
|
181
|
+
{ time: "2021-09-09", before: "玲珑", after: "黑珑", author: "爱笑笑" },
|
|
182
|
+
{ time: "2021-09-11", before: "玖龙", after: "玲珑", author: "爱笑笑" },
|
|
183
|
+
{ time: "2021-09-12", before: "玲珑", after: "黑珑", author: "爱笑笑" },
|
|
184
|
+
{ time: "2021-09-13", before: "玖龙", after: "玲珑", author: "爱笑笑" },
|
|
185
|
+
{ time: "2021-09-14", before: "玲珑", after: "黑珑", author: "爱笑笑" },
|
|
186
|
+
{ time: "2021-09-17", before: "玖龙", after: "玲珑", author: "爱笑笑" },
|
|
187
|
+
{ time: "2021-09-16", before: "玲珑", after: "黑珑", author: "爱笑笑" },
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
formApi: FormApi = new FormApi({
|
|
191
|
+
edit: true,
|
|
192
|
+
});
|
|
193
|
+
dictionaryFormatCollection: DictionaryFormatCollection = {
|
|
194
|
+
sysDictDetailOptions: [],
|
|
195
|
+
sysDictTreeDetailOptions: [],
|
|
196
|
+
};
|
|
197
|
+
mounted(): void {
|
|
198
|
+
const desForm: DesForm | any = formTemplate;
|
|
199
|
+
desForm.desFormLayouts[0].desFormControls.push({
|
|
200
|
+
formFieldId: "1",
|
|
201
|
+
layoutId: "1",
|
|
202
|
+
boundProperty: "xx.applyId",
|
|
203
|
+
extendBoundPropertyOne: "",
|
|
204
|
+
extendBoundPropertyTwo: "",
|
|
205
|
+
formFieldDescribe: "申请编号",
|
|
206
|
+
controlType: "1",
|
|
207
|
+
tableFieldOrder: 1,
|
|
208
|
+
fieldDefaultValue: '""',
|
|
209
|
+
titleWidth: "",
|
|
210
|
+
isBoldTitle: "0",
|
|
211
|
+
isHideTitle: "0",
|
|
212
|
+
titleColor: "",
|
|
213
|
+
placeholder: "",
|
|
214
|
+
tips: "",
|
|
215
|
+
isNotEdit: "0",
|
|
216
|
+
bindingPrefix: "",
|
|
217
|
+
bindingSuffix: "",
|
|
218
|
+
builtInFrontLabel: "",
|
|
219
|
+
builtInPostLabel: "",
|
|
220
|
+
isHideControl: "0",
|
|
221
|
+
controlWidth: "",
|
|
222
|
+
isPasswordBox: "0",
|
|
223
|
+
initRowHeight: null,
|
|
224
|
+
isFixedRowHeight: "0",
|
|
225
|
+
formatType: "1",
|
|
226
|
+
minValue: null,
|
|
227
|
+
maxValue: null,
|
|
228
|
+
step: null,
|
|
229
|
+
decimalPlaces: null,
|
|
230
|
+
thousandthPercentileFormat: "0",
|
|
231
|
+
unit: "",
|
|
232
|
+
moneyUnit: "[]",
|
|
233
|
+
defineOptionalUnits: "",
|
|
234
|
+
defineOptionalUnitsDefault: "",
|
|
235
|
+
zoomType: "",
|
|
236
|
+
zoomMultiple: null,
|
|
237
|
+
isShowCapitalization: "0",
|
|
238
|
+
isLineFeedDisplay: "0",
|
|
239
|
+
isOptionType: "2",
|
|
240
|
+
optionConfig: "",
|
|
241
|
+
dynamicOptionType: "1",
|
|
242
|
+
generalDictionary: "",
|
|
243
|
+
generalDictionaryOptions: "",
|
|
244
|
+
treeShape: "",
|
|
245
|
+
treeShapeOptions: "",
|
|
246
|
+
disableNonLeafNodes: "0",
|
|
247
|
+
dateFormat: "YYYY-MM-DD",
|
|
248
|
+
timeFormat: "HH:mm:ss",
|
|
249
|
+
isSupportMultiple: "0",
|
|
250
|
+
maxUploadNumber: null,
|
|
251
|
+
limitSize: null,
|
|
252
|
+
supportUploadType: "1",
|
|
253
|
+
extendUploadType: "",
|
|
254
|
+
customUploadType: "",
|
|
255
|
+
attachmentExtendProperties: "",
|
|
256
|
+
isMultipleChoice: "0",
|
|
257
|
+
isSearchable: "0",
|
|
258
|
+
canAddEntry: "0",
|
|
259
|
+
isClearButton: "0",
|
|
260
|
+
onOpeningValue: "",
|
|
261
|
+
whenClosedValue: "",
|
|
262
|
+
onOpeningText: "",
|
|
263
|
+
whenClosedText: "",
|
|
264
|
+
customFieldName: "",
|
|
265
|
+
verificationRules: "[]",
|
|
266
|
+
busAttr: '{"submittedType":"","isSupplement":false,"isKeyElements":false,"isTrack":false}',
|
|
267
|
+
});
|
|
268
|
+
this.srcDesForm = formToolsService.formatDesForm(desForm);
|
|
269
|
+
this.$formToolsService.init().then((res: FormRestfulResponse) => {
|
|
270
|
+
this.showForm = true;
|
|
271
|
+
// this.formApi.setAttribute("testx1-1-1", Attribute.TextFold, true);
|
|
272
|
+
// this.formApi.setAttribute("testx1-1-1", Attribute.HiddenDropdown, true);
|
|
273
|
+
});
|
|
274
|
+
// this.dictLocalcConvert();
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
created() {}
|
|
278
|
+
|
|
279
|
+
onChange(e: any): void {
|
|
280
|
+
if (e instanceof FormControl) {
|
|
281
|
+
e.formControl = e;
|
|
282
|
+
}
|
|
283
|
+
const paymentType = this.formApi.getValue("productName");
|
|
284
|
+
const comId = this.formApi.getValue("comId");
|
|
285
|
+
if (e.formControl && e.formControl.key === "productName") {
|
|
286
|
+
// this.formApi.setAttribute("productId", Attribute.IsHideControl, paymentType === "2");
|
|
287
|
+
this.formApi.setRequiredValidate("productCode", paymentType === "2");
|
|
288
|
+
} else if (e.formControl && e.formControl.key === "comId") {
|
|
289
|
+
this.formApi.setAttribute("productId", Attribute.IsHideControl, comId);
|
|
290
|
+
}
|
|
291
|
+
console.log(e);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
onClick(e: any): void {
|
|
295
|
+
/*console.log(e);*/
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
onFocus(e: any): void {
|
|
299
|
+
/*console.log(e);*/
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
onBlur(e: any): void {
|
|
303
|
+
/*console.log(e);*/
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* @description: 内置前置标签事件
|
|
308
|
+
* @author ChenRui
|
|
309
|
+
* @date 2021/4/23 9:42
|
|
310
|
+
*/
|
|
311
|
+
onAddonBeforeHandler(event: any): void {
|
|
312
|
+
console.log("AddonBefore", event);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* @description: 内置后置标签事件
|
|
317
|
+
* @author ChenRui
|
|
318
|
+
* @date 2021/4/23 9:43
|
|
319
|
+
*/
|
|
320
|
+
onAddonAfterHandler(event: any): void {
|
|
321
|
+
console.log("AddonAfter", event);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
selectAddItem(e: any): void {
|
|
325
|
+
/*console.log(e);*/
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
filterOption(input: any, option: any) {
|
|
329
|
+
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* @description: 获取监控对象
|
|
334
|
+
* @author ChenRui
|
|
335
|
+
* @date 2021/1/29 10:05
|
|
336
|
+
*/
|
|
337
|
+
getControl(): void {
|
|
338
|
+
const control: Control = this.formApi.getControl(this.controlKey);
|
|
339
|
+
/*const it: IterableIterator<any> = this.formApi.encodedFormData;
|
|
340
|
+
let val = it.next().value;
|
|
341
|
+
while (val) {
|
|
342
|
+
console.log(val);
|
|
343
|
+
val = it.next().value;
|
|
344
|
+
}*/
|
|
345
|
+
console.log("控件对象:", control);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* @description: 获取值
|
|
350
|
+
* @author ChenRui
|
|
351
|
+
* @date 2021/1/29 14:58
|
|
352
|
+
*/
|
|
353
|
+
getValue(): void {
|
|
354
|
+
const val: any = this.formApi.getValue(this.controlKey);
|
|
355
|
+
console.log("控件值:", val);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* @description: 设置值
|
|
360
|
+
* @author ChenRui
|
|
361
|
+
* @date 2021/1/29 16:37
|
|
362
|
+
*/
|
|
363
|
+
setValue(): void {
|
|
364
|
+
this.formApi.setValue(this.controlKey, this.controlvalue);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* @description: 重置数据
|
|
369
|
+
* @author ChenRui
|
|
370
|
+
* @date 2021/2/22 17:40
|
|
371
|
+
*/
|
|
372
|
+
resetValue(): void {
|
|
373
|
+
this.formApi.resetValue();
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* @description: 刷新整个表单
|
|
378
|
+
* @author ChenRui
|
|
379
|
+
* @date 2022/4/6 11:24
|
|
380
|
+
*/
|
|
381
|
+
refreshAndUpdateData(): void {
|
|
382
|
+
this.formApi.refreshAndUpdateData();
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* @description: 重置表单校验状态
|
|
387
|
+
* @author ChenRui
|
|
388
|
+
* @date 2022/4/6 12:04
|
|
389
|
+
*/
|
|
390
|
+
resetFormValidateState(): void {
|
|
391
|
+
this.formApi.resetFormValidateState();
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* @description: 新增控件对象
|
|
396
|
+
* @author ChenRui
|
|
397
|
+
* @date 2021/8/27 11:19
|
|
398
|
+
*/
|
|
399
|
+
setControl(): void {
|
|
400
|
+
// const control: Control = this.formApi.setControl(this.controlKey);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @description: 设置字段变更历史
|
|
405
|
+
* @author ChenRui
|
|
406
|
+
* @date 2021/4/25 16:36
|
|
407
|
+
*/
|
|
408
|
+
setFieldChangeHistory(): void {
|
|
409
|
+
this.formApi.setFieldChangeHistory(this.fieldChangeHistory);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* @description: 设置自动完成数据
|
|
414
|
+
* @author ChenRui
|
|
415
|
+
* @date 2022/5/7 18:16
|
|
416
|
+
*/
|
|
417
|
+
setAutoCompleteOptions(): void {
|
|
418
|
+
this.formApi.setAttribute(this.controlKey, Attribute.AutoCompleteOptions, ["张三"]);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* @description: 获取文本
|
|
423
|
+
* @author ChenRui
|
|
424
|
+
* @date 2021/1/29 15:14
|
|
425
|
+
*/
|
|
426
|
+
getText(): void {
|
|
427
|
+
const text: any = this.formApi.getText(this.controlKey);
|
|
428
|
+
console.log("文本:", text);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* @description: 获取可选项
|
|
433
|
+
* @author ChenRui
|
|
434
|
+
* @date 2021/1/29 16:20
|
|
435
|
+
*/
|
|
436
|
+
getOptions(): void {
|
|
437
|
+
const options: any[] = this.formApi.getOptions(this.controlKey);
|
|
438
|
+
console.log("可选项:", options);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* @description: 设置可选项
|
|
443
|
+
* @author ChenRui
|
|
444
|
+
* @date 2021/1/29 16:21
|
|
445
|
+
*/
|
|
446
|
+
setOptions(): void {
|
|
447
|
+
const data: any[] = [
|
|
448
|
+
{ value: "1", title: "张三" },
|
|
449
|
+
{ value: "2", title: "李四" },
|
|
450
|
+
{ value: "3", title: "王五" },
|
|
451
|
+
{ value: "4", title: "赵六" },
|
|
452
|
+
{ value: "5", title: "孙七" },
|
|
453
|
+
{ value: "6", title: "周八" },
|
|
454
|
+
{ value: "7", title: "吴九" },
|
|
455
|
+
{ value: "8", title: "郑十" },
|
|
456
|
+
];
|
|
457
|
+
this.formApi.setOptions(this.controlKey, data, "2");
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* @description: 设置常规属性
|
|
462
|
+
* @author ChenRui
|
|
463
|
+
* @date 2021/1/29 17:29
|
|
464
|
+
*/
|
|
465
|
+
setAttribute(): void {
|
|
466
|
+
if (this.controlAttr) {
|
|
467
|
+
this.formApi.setAttribute(this.controlKey, this.controlAttr, this.controlvalue);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* @description: 获取常规属性
|
|
473
|
+
* @author ChenRui
|
|
474
|
+
* @date 2021/1/29 18:11
|
|
475
|
+
*/
|
|
476
|
+
getAttribute(): void {
|
|
477
|
+
if (this.controlAttr) {
|
|
478
|
+
const attr: any = this.formApi.getAttribute(this.controlKey, this.controlAttr);
|
|
479
|
+
console.log("属性值:", attr);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* @description: 获取校验
|
|
485
|
+
* @author ChenRui
|
|
486
|
+
* @date 2021/1/30 11:49
|
|
487
|
+
*/
|
|
488
|
+
getValidate(): void {
|
|
489
|
+
const validate: any = this.formApi.getValidate(this.controlKey, this.controlvalue);
|
|
490
|
+
console.log("字段校验结果:", validate);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* @description: 获取校验集合
|
|
495
|
+
* @author ChenRui
|
|
496
|
+
* @date 2021/1/30 11:50
|
|
497
|
+
*/
|
|
498
|
+
getValidates(): void {
|
|
499
|
+
const validates: any[] = this.formApi.getValidates(this.controlKey);
|
|
500
|
+
console.log("表单校验结果:", validates);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
refreshValidate(): void {
|
|
504
|
+
this.formApi.refreshValidate(this.controlKey);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* @description:
|
|
509
|
+
* @author ChenRui
|
|
510
|
+
* @date 2021/4/1 21:29
|
|
511
|
+
*/
|
|
512
|
+
removeValidate(): void {
|
|
513
|
+
this.formApi.removeValidate(this.controlKey, ValidateRules.Required.code);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* @description: 获取控件dom对象
|
|
518
|
+
* @author ChenRui
|
|
519
|
+
* @date 2021/2/26 17:16
|
|
520
|
+
*/
|
|
521
|
+
getControlEl(): void {
|
|
522
|
+
const controlEl: any = this.formApi.getControlEl(this.controlKey);
|
|
523
|
+
console.log("控件选项:", controlEl);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* @description: 获取校验报告
|
|
528
|
+
* @author ChenRui
|
|
529
|
+
* @date 2021/2/22 14:08
|
|
530
|
+
*/
|
|
531
|
+
validateReport(): void {
|
|
532
|
+
const result: boolean = this.formApi.validate();
|
|
533
|
+
// this.formApi.setAttribute("testx1-1", Attribute.IsHideControl, true);
|
|
534
|
+
const validateResults: ValidateReport[] = this.formApi.validateReport();
|
|
535
|
+
console.log("校验结果:", validateResults);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* @description: 校验表单并提示
|
|
540
|
+
* @author ChenRui
|
|
541
|
+
* @date 2021/8/18 17:38
|
|
542
|
+
*/
|
|
543
|
+
validateTips(): void {
|
|
544
|
+
// this.$formToolsService.validateTips(this.formApi, this.scrollView);
|
|
545
|
+
// this.formApi.validateTips(this.scrollView);
|
|
546
|
+
this.formApi.validateTips(window);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* @description: 设置校验
|
|
551
|
+
* @author ChenRui
|
|
552
|
+
* @date 2021/1/30 11:56
|
|
553
|
+
*/
|
|
554
|
+
setValidate(): void {
|
|
555
|
+
const validates: Validate[] = [
|
|
556
|
+
{
|
|
557
|
+
name: "define",
|
|
558
|
+
validateFunc: (val: any) => {
|
|
559
|
+
if (val == null || val === "") {
|
|
560
|
+
return {
|
|
561
|
+
validateStatus: ValidateStatus.Error.code,
|
|
562
|
+
errorMsg: "空空空",
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
return {
|
|
566
|
+
validateStatus: ValidateStatus.Success.code,
|
|
567
|
+
};
|
|
568
|
+
},
|
|
569
|
+
},
|
|
570
|
+
];
|
|
571
|
+
// this.formApi.setValidate(this.controlKey, validates);
|
|
572
|
+
this.formApi.setValidate("testx1-5-4", {
|
|
573
|
+
ruleType: ValidateRules.Required.code,
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* @description: 设置格式化显示与输出
|
|
579
|
+
* @author ChenRui
|
|
580
|
+
* @date 2021/2/4 19:55
|
|
581
|
+
*/
|
|
582
|
+
setFormatDisplayAndOutput(): void {
|
|
583
|
+
const customFormat: CustomFormat = {
|
|
584
|
+
display: (val: any, desFormControl: DesFormControl) => {
|
|
585
|
+
return val + "$";
|
|
586
|
+
},
|
|
587
|
+
output: (val: any, desFormControl: DesFormControl) => {
|
|
588
|
+
return val + "$$";
|
|
589
|
+
},
|
|
590
|
+
};
|
|
591
|
+
this.formApi.setFormatDisplayAndOutput(this.controlCustomType, customFormat);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* @description: 提交表单
|
|
596
|
+
* @author ChenRui
|
|
597
|
+
* @date 2021/11/15 22:44
|
|
598
|
+
*/
|
|
599
|
+
submit(): void {
|
|
600
|
+
console.log(this.formApi.formData);
|
|
601
|
+
console.log(this.formApi.encodedFormData);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* @description: 赋值整个表单
|
|
606
|
+
* @author ChenRui
|
|
607
|
+
* @date 2021/2/4 10:32
|
|
608
|
+
*/
|
|
609
|
+
setFormData(): void {
|
|
610
|
+
/*const data: any = {
|
|
611
|
+
"testx1-1": "笑哈哈",
|
|
612
|
+
"testx1-2": 40,
|
|
613
|
+
"test1-1": {
|
|
614
|
+
"testx1-1-1": "1",
|
|
615
|
+
"testx1-1-2": "2",
|
|
616
|
+
},
|
|
617
|
+
"test1-2": {
|
|
618
|
+
"testx1-2-1": "1,2",
|
|
619
|
+
"testx1-2-2": "00001,00002",
|
|
620
|
+
},
|
|
621
|
+
"test1-4": {
|
|
622
|
+
"testx1-4-1": "9921313@qq.com",
|
|
623
|
+
},
|
|
624
|
+
"test1-5": {
|
|
625
|
+
"testx1-5-1": "04:23:55",
|
|
626
|
+
"testx1-5-2": "2021-12-04",
|
|
627
|
+
},
|
|
628
|
+
};*/
|
|
629
|
+
const data = {
|
|
630
|
+
productId: "2222",
|
|
631
|
+
};
|
|
632
|
+
this.formApi.setFormData(data, false, false);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* @description: 赋值整个表单
|
|
637
|
+
* @author ChenRui
|
|
638
|
+
* @date 2021/2/4 10:32
|
|
639
|
+
*/
|
|
640
|
+
setFormOldData(): void {
|
|
641
|
+
const data = {
|
|
642
|
+
productId: "2222",
|
|
643
|
+
productCode: 11111,
|
|
644
|
+
comId: 1,
|
|
645
|
+
productName: "1",
|
|
646
|
+
deptId: "2121",
|
|
647
|
+
engName: "2",
|
|
648
|
+
updateUser: "1",
|
|
649
|
+
productVersion: "1",
|
|
650
|
+
productManangerName: "2",
|
|
651
|
+
productMananger: "1992-06-13",
|
|
652
|
+
mark: "111",
|
|
653
|
+
createTime: "1,11,111",
|
|
654
|
+
xxx: "2222",
|
|
655
|
+
};
|
|
656
|
+
this.formApi.setFormData(data, false, false, data);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
handleMultiChoiceEmbeddedCustomization(): void {
|
|
660
|
+
console.log("下了多选自定义事件");
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
dictLocalcConvert(): void {
|
|
664
|
+
/*const appData = require("./assets/x.json");
|
|
665
|
+
const dictionaryFormatCollection: DictionaryFormatCollection = formToolsService.inidDictOptions(appData);
|
|
666
|
+
this.dictionaryFormatCollection = dictionaryFormatCollection;*/
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
</script>
|
|
670
|
+
|
|
671
|
+
<style lang="scss" scoped>
|
|
672
|
+
.ml-5 {
|
|
673
|
+
margin-left: 5px;
|
|
674
|
+
}
|
|
675
|
+
.lo-container {
|
|
676
|
+
display: flex;
|
|
677
|
+
flex-direction: column;
|
|
678
|
+
.lo-content {
|
|
679
|
+
display: flex;
|
|
680
|
+
flex-direction: column;
|
|
681
|
+
margin-bottom: 20px;
|
|
682
|
+
padding: 10px 20px;
|
|
683
|
+
border: 1px solid #f0f0f0;
|
|
684
|
+
.lo-title {
|
|
685
|
+
font-size: 16px;
|
|
686
|
+
margin-bottom: 15px;
|
|
687
|
+
}
|
|
688
|
+
.lo-ins {
|
|
689
|
+
display: flex;
|
|
690
|
+
flex-direction: column;
|
|
691
|
+
.lo-api {
|
|
692
|
+
display: flex;
|
|
693
|
+
flex-wrap: wrap;
|
|
694
|
+
margin-bottom: 10px;
|
|
695
|
+
.lo-api-item {
|
|
696
|
+
display: flex;
|
|
697
|
+
flex-direction: row;
|
|
698
|
+
margin-right: 20px;
|
|
699
|
+
.lo-item-title {
|
|
700
|
+
min-width: 100px;
|
|
701
|
+
margin-right: 5px;
|
|
702
|
+
display: flex;
|
|
703
|
+
align-items: center;
|
|
704
|
+
}
|
|
705
|
+
.lo-item-opts {
|
|
706
|
+
display: flex;
|
|
707
|
+
flex-wrap: wrap;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
.lo-input {
|
|
712
|
+
margin: 5px 0;
|
|
713
|
+
}
|
|
714
|
+
.lo-value {
|
|
715
|
+
.lo-title {
|
|
716
|
+
margin-right: 10px;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
.d-flex {
|
|
723
|
+
display: flex;
|
|
724
|
+
}
|
|
725
|
+
.flex-row {
|
|
726
|
+
flex-direction: row;
|
|
727
|
+
}
|
|
728
|
+
.mt-1 {
|
|
729
|
+
margin-top: 3px;
|
|
730
|
+
}
|
|
731
|
+
.mb-2 {
|
|
732
|
+
margin-bottom: 6px;
|
|
733
|
+
}
|
|
734
|
+
.mr-2 {
|
|
735
|
+
margin-right: 6px;
|
|
736
|
+
}
|
|
737
|
+
.lo-combination-selector {
|
|
738
|
+
display: flex;
|
|
739
|
+
flex-direction: row;
|
|
740
|
+
}
|
|
741
|
+
</style>
|