@dhccmobile/vue3-lo-form 1.1.41 → 2.0.0
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/.env.local.bak +6 -6
- package/.eslintrc.js +28 -28
- package/README.md +70 -62
- package/babel.config.js +3 -3
- package/dist/vue3-lo-form.common.js +7700 -107778
- package/dist/vue3-lo-form.common.js.map +1 -1
- package/dist/vue3-lo-form.css +1 -1
- package/dist/vue3-lo-form.umd.js +7773 -107851
- package/dist/vue3-lo-form.umd.js.map +1 -1
- package/dist/vue3-lo-form.umd.min.js +1 -56
- package/dist/vue3-lo-form.umd.min.js.map +1 -1
- package/package.json +65 -61
- package/public/index.html +17 -17
- package/public/js/pinyin.ts +101 -101
- 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 -31
- 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 +15 -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 -147
- 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 +73 -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 -659
- 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/tsconfig.json +40 -40
- 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 -111
- 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 +15 -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 -144
- 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/vue.config.js +38 -29
- package/dhccmobile-vue3-lo-form-1.1.41.tgz +0 -0
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
interface Config {
|
|
2
|
-
value: number;
|
|
3
|
-
order: number;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
function transform(configs: Config[]): unknown {
|
|
7
|
-
if (configs != null && configs.length > 0) {
|
|
8
|
-
const arr: string[] = [];
|
|
9
|
-
configs.sort((a: Config, b: Config) => a.order - b.order).forEach((item) => arr.push(item.value + "fr"));
|
|
10
|
-
return arr.join(" ");
|
|
11
|
-
} else {
|
|
12
|
-
return `1fr`;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @description: 网格布局比例分配
|
|
17
|
-
* @author ChenRui
|
|
18
|
-
* @date 2020/12/1 19:32
|
|
19
|
-
*/
|
|
20
|
-
const generateGridTemplateColumns = (configs: Config[]) => {
|
|
21
|
-
return transform(configs);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default generateGridTemplateColumns;
|
|
1
|
+
interface Config {
|
|
2
|
+
value: number;
|
|
3
|
+
order: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
function transform(configs: Config[]): unknown {
|
|
7
|
+
if (configs != null && configs.length > 0) {
|
|
8
|
+
const arr: string[] = [];
|
|
9
|
+
configs.sort((a: Config, b: Config) => a.order - b.order).forEach((item) => arr.push(item.value + "fr"));
|
|
10
|
+
return arr.join(" ");
|
|
11
|
+
} else {
|
|
12
|
+
return `1fr`;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @description: 网格布局比例分配
|
|
17
|
+
* @author ChenRui
|
|
18
|
+
* @date 2020/12/1 19:32
|
|
19
|
+
*/
|
|
20
|
+
const generateGridTemplateColumns = (configs: Config[]) => {
|
|
21
|
+
return transform(configs);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default generateGridTemplateColumns;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description: 通用字典转换
|
|
3
|
-
* @author ChenRui
|
|
4
|
-
* @date 2020/7/29 18:43
|
|
5
|
-
*/
|
|
6
|
-
function encode(code: string, switchEnumFiled: any, attribute?: string, defaultVal?: any) {
|
|
7
|
-
if (switchEnumFiled != null && Object.values(switchEnumFiled).length > 0) {
|
|
8
|
-
for (const switchEnum of Object.values(switchEnumFiled) as any) {
|
|
9
|
-
return switchEnum[attribute || "name"] || defaultVal;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return defaultVal || "";
|
|
13
|
-
}
|
|
14
|
-
const switchEnumConvert = (code: string, switchEnumFiled: any, attribute?: string, defaultVal?: any) => {
|
|
15
|
-
return encode(code, switchEnumFiled, attribute, defaultVal);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default switchEnumConvert;
|
|
1
|
+
/**
|
|
2
|
+
* @description: 通用字典转换
|
|
3
|
+
* @author ChenRui
|
|
4
|
+
* @date 2020/7/29 18:43
|
|
5
|
+
*/
|
|
6
|
+
function encode(code: string, switchEnumFiled: any, attribute?: string, defaultVal?: any) {
|
|
7
|
+
if (switchEnumFiled != null && Object.values(switchEnumFiled).length > 0) {
|
|
8
|
+
for (const switchEnum of Object.values(switchEnumFiled) as any) {
|
|
9
|
+
return switchEnum[attribute || "name"] || defaultVal;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return defaultVal || "";
|
|
13
|
+
}
|
|
14
|
+
const switchEnumConvert = (code: string, switchEnumFiled: any, attribute?: string, defaultVal?: any) => {
|
|
15
|
+
return encode(code, switchEnumFiled, attribute, defaultVal);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default switchEnumConvert;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { ZoomType } from "@/constants/enum/zoom-type";
|
|
2
|
-
import { FormControl } from "@/domain/FormControl";
|
|
3
|
-
import { MathJsStatic } from "mathjs";
|
|
4
|
-
import { getCurrentInstance } from "vue";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @description: 通用字典转换
|
|
8
|
-
* @author ChenRui
|
|
9
|
-
* @date 2020/7/29 18:43
|
|
10
|
-
*/
|
|
11
|
-
function encode(data: any, formControl: FormControl) {
|
|
12
|
-
const proxy: any = getCurrentInstance()?.proxy;
|
|
13
|
-
const mathjs: MathJsStatic = proxy?.$mathjs as MathJsStatic;
|
|
14
|
-
if (data && formControl.controlAttr.zoomMultiple) {
|
|
15
|
-
if (formControl.controlAttr.zoomType === ZoomType.enlarge.code) {
|
|
16
|
-
data = mathjs.format(mathjs.evaluate(`${data} * ${formControl.controlAttr.zoomMultiple}`), { notation: "fixed" });
|
|
17
|
-
} else if (formControl.controlAttr.zoomType === ZoomType.narrow.code) {
|
|
18
|
-
data = mathjs.format(mathjs.evaluate(`${data} / ${formControl.controlAttr.zoomMultiple}`), { notation: "fixed" });
|
|
19
|
-
} else if (formControl.controlAttr.zoomType === ZoomType.automatic.code) {
|
|
20
|
-
data = mathjs.format(mathjs.evaluate(`${data} * ${formControl.controlAttr.zoomMultiple}`), { notation: "fixed" });
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
if (String(formControl.value) === "0") {
|
|
24
|
-
data = 0;
|
|
25
|
-
}
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
const zoomMultiple = (code: any, formControl: FormControl) => {
|
|
29
|
-
return encode(code, formControl);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default zoomMultiple;
|
|
1
|
+
import { ZoomType } from "@/constants/enum/zoom-type";
|
|
2
|
+
import { FormControl } from "@/domain/FormControl";
|
|
3
|
+
import { MathJsStatic } from "mathjs";
|
|
4
|
+
import { getCurrentInstance } from "vue";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @description: 通用字典转换
|
|
8
|
+
* @author ChenRui
|
|
9
|
+
* @date 2020/7/29 18:43
|
|
10
|
+
*/
|
|
11
|
+
function encode(data: any, formControl: FormControl) {
|
|
12
|
+
const proxy: any = getCurrentInstance()?.proxy;
|
|
13
|
+
const mathjs: MathJsStatic = proxy?.$mathjs as MathJsStatic;
|
|
14
|
+
if (data && formControl.controlAttr.zoomMultiple) {
|
|
15
|
+
if (formControl.controlAttr.zoomType === ZoomType.enlarge.code) {
|
|
16
|
+
data = mathjs.format(mathjs.evaluate(`${data} * ${formControl.controlAttr.zoomMultiple}`), { notation: "fixed" });
|
|
17
|
+
} else if (formControl.controlAttr.zoomType === ZoomType.narrow.code) {
|
|
18
|
+
data = mathjs.format(mathjs.evaluate(`${data} / ${formControl.controlAttr.zoomMultiple}`), { notation: "fixed" });
|
|
19
|
+
} else if (formControl.controlAttr.zoomType === ZoomType.automatic.code) {
|
|
20
|
+
data = mathjs.format(mathjs.evaluate(`${data} * ${formControl.controlAttr.zoomMultiple}`), { notation: "fixed" });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (String(formControl.value) === "0") {
|
|
24
|
+
data = 0;
|
|
25
|
+
}
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
const zoomMultiple = (code: any, formControl: FormControl) => {
|
|
29
|
+
return encode(code, formControl);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default zoomMultiple;
|
package/src/index.ts
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { App } from "vue";
|
|
2
|
-
import DyForm from "./components/form/DvForm.vue";
|
|
3
|
-
import { formToolsService } from "@/services";
|
|
4
|
-
import { DEFAULT_FORM_FILE_NAME } from "./constants/config/form.config";
|
|
5
|
-
import { formLocalForageService } from "@/services";
|
|
6
|
-
import { dictLocalForageService } from "@/services";
|
|
7
|
-
import { create, subtractDependencies, addDependencies, multiplyDependencies, divideDependencies, formatDependencies, evaluateDependencies, MathJsStatic } from "mathjs";
|
|
8
|
-
import { cleanLocalForageService } from "@/services";
|
|
9
|
-
|
|
10
|
-
export * from "./components/index";
|
|
11
|
-
export * from "./constants/index";
|
|
12
|
-
export * from "./core/index";
|
|
13
|
-
export * from "./domain/index";
|
|
14
|
-
export * from "./services/index";
|
|
15
|
-
export * from "./store/index";
|
|
16
|
-
export * from "./types/vfForm";
|
|
17
|
-
import "./styles/index.scss";
|
|
18
|
-
|
|
19
|
-
import "dayjs/locale/zh-cn";
|
|
20
|
-
import dayjs from "dayjs";
|
|
21
|
-
|
|
22
|
-
const components: any = {
|
|
23
|
-
DyForm,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const install: any = function (app: App, options: any) {
|
|
27
|
-
if (install.installed) return;
|
|
28
|
-
install.installed = true;
|
|
29
|
-
// Modal.install(vue);
|
|
30
|
-
Object.keys(components).forEach((key) => {
|
|
31
|
-
app.component(key, components[key]);
|
|
32
|
-
});
|
|
33
|
-
dayjs.locale("zh-cn");
|
|
34
|
-
|
|
35
|
-
const url: string = options && options.url ? options.url : "./resources/json/" + DEFAULT_FORM_FILE_NAME;
|
|
36
|
-
app.config.globalProperties.$qlForm = {
|
|
37
|
-
url: url,
|
|
38
|
-
dictUrl: options && options.dictUrl ? options.dictUrl : "",
|
|
39
|
-
dictRestLoadMode: options && options.dictRestLoadMode ? options.dictRestLoadMode : "GET",
|
|
40
|
-
dictRestLoadBody: options && options.dictRestLoadBody ? options.dictRestLoadBody : undefined,
|
|
41
|
-
dictRestLoadHeaders: options && options.dictRestLoadHeaders ? options.dictRestLoadHeaders : undefined,
|
|
42
|
-
dictRestLoadOnlyBody: options && options.dictRestLoadOnlyBody ? options.dictRestLoadOnlyBody : false,
|
|
43
|
-
loadMode: options && options.loadMode ? options.loadMode : "static",
|
|
44
|
-
appId: options && options.appId ? options.appId : "",
|
|
45
|
-
onlySimpleLoadConfig: options && options.onlySimpleLoadConfig ? options.onlySimpleLoadConfig : false,
|
|
46
|
-
urls: options?.urls,
|
|
47
|
-
dictUrls: options?.dictUrls,
|
|
48
|
-
};
|
|
49
|
-
app.config.globalProperties.$formToolsService = formToolsService;
|
|
50
|
-
(window as any).$app = app;
|
|
51
|
-
cleanLocalForageService.init();
|
|
52
|
-
formLocalForageService.init();
|
|
53
|
-
dictLocalForageService.init();
|
|
54
|
-
|
|
55
|
-
const mathjsDependencies: any = {
|
|
56
|
-
formatDependencies,
|
|
57
|
-
subtractDependencies,
|
|
58
|
-
multiplyDependencies,
|
|
59
|
-
evaluateDependencies,
|
|
60
|
-
addDependencies,
|
|
61
|
-
divideDependencies,
|
|
62
|
-
};
|
|
63
|
-
const mathjs: Partial<MathJsStatic> = create(mathjsDependencies, {
|
|
64
|
-
number: "BigNumber",
|
|
65
|
-
precision: 20,
|
|
66
|
-
});
|
|
67
|
-
app.config.globalProperties.$mathjs = mathjs;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const VueLoForm = {
|
|
71
|
-
install,
|
|
72
|
-
};
|
|
73
|
-
export default VueLoForm;
|
|
1
|
+
import { App } from "vue";
|
|
2
|
+
import DyForm from "./components/form/DvForm.vue";
|
|
3
|
+
import { formToolsService } from "@/services";
|
|
4
|
+
import { DEFAULT_FORM_FILE_NAME } from "./constants/config/form.config";
|
|
5
|
+
import { formLocalForageService } from "@/services";
|
|
6
|
+
import { dictLocalForageService } from "@/services";
|
|
7
|
+
import { create, subtractDependencies, addDependencies, multiplyDependencies, divideDependencies, formatDependencies, evaluateDependencies, MathJsStatic } from "mathjs";
|
|
8
|
+
import { cleanLocalForageService } from "@/services";
|
|
9
|
+
|
|
10
|
+
export * from "./components/index";
|
|
11
|
+
export * from "./constants/index";
|
|
12
|
+
export * from "./core/index";
|
|
13
|
+
export * from "./domain/index";
|
|
14
|
+
export * from "./services/index";
|
|
15
|
+
export * from "./store/index";
|
|
16
|
+
export * from "./types/vfForm";
|
|
17
|
+
import "./styles/index.scss";
|
|
18
|
+
|
|
19
|
+
import "dayjs/locale/zh-cn";
|
|
20
|
+
import dayjs from "dayjs";
|
|
21
|
+
|
|
22
|
+
const components: any = {
|
|
23
|
+
DyForm,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const install: any = function (app: App, options: any) {
|
|
27
|
+
if (install.installed) return;
|
|
28
|
+
install.installed = true;
|
|
29
|
+
// Modal.install(vue);
|
|
30
|
+
Object.keys(components).forEach((key) => {
|
|
31
|
+
app.component(key, components[key]);
|
|
32
|
+
});
|
|
33
|
+
dayjs.locale("zh-cn");
|
|
34
|
+
|
|
35
|
+
const url: string = options && options.url ? options.url : "./resources/json/" + DEFAULT_FORM_FILE_NAME;
|
|
36
|
+
app.config.globalProperties.$qlForm = {
|
|
37
|
+
url: url,
|
|
38
|
+
dictUrl: options && options.dictUrl ? options.dictUrl : "",
|
|
39
|
+
dictRestLoadMode: options && options.dictRestLoadMode ? options.dictRestLoadMode : "GET",
|
|
40
|
+
dictRestLoadBody: options && options.dictRestLoadBody ? options.dictRestLoadBody : undefined,
|
|
41
|
+
dictRestLoadHeaders: options && options.dictRestLoadHeaders ? options.dictRestLoadHeaders : undefined,
|
|
42
|
+
dictRestLoadOnlyBody: options && options.dictRestLoadOnlyBody ? options.dictRestLoadOnlyBody : false,
|
|
43
|
+
loadMode: options && options.loadMode ? options.loadMode : "static",
|
|
44
|
+
appId: options && options.appId ? options.appId : "",
|
|
45
|
+
onlySimpleLoadConfig: options && options.onlySimpleLoadConfig ? options.onlySimpleLoadConfig : false,
|
|
46
|
+
urls: options?.urls,
|
|
47
|
+
dictUrls: options?.dictUrls,
|
|
48
|
+
};
|
|
49
|
+
app.config.globalProperties.$formToolsService = formToolsService;
|
|
50
|
+
(window as any).$app = app;
|
|
51
|
+
cleanLocalForageService.init();
|
|
52
|
+
formLocalForageService.init();
|
|
53
|
+
dictLocalForageService.init();
|
|
54
|
+
|
|
55
|
+
const mathjsDependencies: any = {
|
|
56
|
+
formatDependencies,
|
|
57
|
+
subtractDependencies,
|
|
58
|
+
multiplyDependencies,
|
|
59
|
+
evaluateDependencies,
|
|
60
|
+
addDependencies,
|
|
61
|
+
divideDependencies,
|
|
62
|
+
};
|
|
63
|
+
const mathjs: Partial<MathJsStatic> = create(mathjsDependencies, {
|
|
64
|
+
number: "BigNumber",
|
|
65
|
+
precision: 20,
|
|
66
|
+
});
|
|
67
|
+
app.config.globalProperties.$mathjs = mathjs;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const VueLoForm = {
|
|
71
|
+
install,
|
|
72
|
+
};
|
|
73
|
+
export default VueLoForm;
|
package/src/main.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { createApp } from "vue";
|
|
2
|
-
import App from "./App.vue";
|
|
3
|
-
import "ant-design-vue/dist/antd.css";
|
|
4
|
-
import "@dhccmobile/common-style/css/common-style.css";
|
|
5
|
-
import VueLoForm from "@/index";
|
|
6
|
-
|
|
7
|
-
const app = createApp(App);
|
|
8
|
-
// 设置为 true 以在浏览器开发工具的 performance/timeline 面板中启用对组件初始化、编译、渲染和更新的性能追踪。
|
|
9
|
-
app.config.performance = true;
|
|
10
|
-
app
|
|
11
|
-
.use(VueLoForm, {
|
|
12
|
-
url:
|
|
13
|
-
appId: "1009549605007003648",
|
|
14
|
-
onlySimpleLoadConfig: false,
|
|
15
|
-
loadMode: "dynamic",
|
|
16
|
-
})
|
|
17
|
-
.mount("#app");
|
|
1
|
+
import { createApp } from "vue";
|
|
2
|
+
import App from "./App.vue";
|
|
3
|
+
import "ant-design-vue/dist/antd.css";
|
|
4
|
+
import "@dhccmobile/common-style/css/common-style.css";
|
|
5
|
+
import VueLoForm from "@/index";
|
|
6
|
+
|
|
7
|
+
const app = createApp(App);
|
|
8
|
+
// 设置为 true 以在浏览器开发工具的 performance/timeline 面板中启用对组件初始化、编译、渲染和更新的性能追踪。
|
|
9
|
+
app.config.performance = true;
|
|
10
|
+
app
|
|
11
|
+
.use(VueLoForm, {
|
|
12
|
+
url: "http://10.7.114.81:30570",
|
|
13
|
+
appId: "1009549605007003648,1014269796445605888,1015215693289242624,1028015525370548224",
|
|
14
|
+
onlySimpleLoadConfig: false,
|
|
15
|
+
loadMode: "dynamic",
|
|
16
|
+
})
|
|
17
|
+
.mount("#app");
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
class ApiService {
|
|
2
|
-
createBasicHeaders() {
|
|
3
|
-
return {
|
|
4
|
-
"Content-Type": "application/json",
|
|
5
|
-
Accept: "application/json",
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
createAuthHeaders(accessToken: string, jti: string) {
|
|
10
|
-
return {
|
|
11
|
-
Authorization: "bearer " + accessToken,
|
|
12
|
-
"user-identity": jti,
|
|
13
|
-
"Content-Type": "application/json",
|
|
14
|
-
Accept: "application/json",
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
fetch(path: string, query: { [key: string]: any }, body: any, method: string, header: any) {
|
|
19
|
-
path = query != null ? this.urlQueryConvert(path, query) : path;
|
|
20
|
-
return fetch(path, {
|
|
21
|
-
method: method ? method : "GET",
|
|
22
|
-
headers: header,
|
|
23
|
-
body: body,
|
|
24
|
-
}).then(
|
|
25
|
-
function (response) {
|
|
26
|
-
response.status; //=> number 100–599
|
|
27
|
-
response.statusText; //=> String
|
|
28
|
-
response.headers; //=> Headers
|
|
29
|
-
response.url; //=> String
|
|
30
|
-
|
|
31
|
-
return response.json();
|
|
32
|
-
},
|
|
33
|
-
function (error) {
|
|
34
|
-
error.message; //=> String
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @description: url请求参数组装
|
|
41
|
-
* @author ChenRui
|
|
42
|
-
* @date 2020/8/28 15:21
|
|
43
|
-
*/
|
|
44
|
-
urlQueryConvert(url: string, query: { [key: string]: any }) {
|
|
45
|
-
let connectiveSymbol = "";
|
|
46
|
-
if (url.indexOf("?") !== -1) {
|
|
47
|
-
connectiveSymbol = "&";
|
|
48
|
-
} else {
|
|
49
|
-
connectiveSymbol = "?";
|
|
50
|
-
}
|
|
51
|
-
if (query) {
|
|
52
|
-
Object.keys(query).forEach((key, idx) => {
|
|
53
|
-
const val = query[key];
|
|
54
|
-
if (idx === 0) {
|
|
55
|
-
if (val != null && val !== "null" && val !== "undefined") {
|
|
56
|
-
url += connectiveSymbol + key + "=" + val;
|
|
57
|
-
} else {
|
|
58
|
-
url += connectiveSymbol + key + "=";
|
|
59
|
-
}
|
|
60
|
-
} else {
|
|
61
|
-
if (val != null && val !== "null" && val !== "undefined") {
|
|
62
|
-
url += "&" + key + "=" + val;
|
|
63
|
-
} else {
|
|
64
|
-
url += "&" + key + "=";
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return url;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const apiService = new ApiService();
|
|
73
|
-
export { apiService };
|
|
1
|
+
class ApiService {
|
|
2
|
+
createBasicHeaders() {
|
|
3
|
+
return {
|
|
4
|
+
"Content-Type": "application/json",
|
|
5
|
+
Accept: "application/json",
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
createAuthHeaders(accessToken: string, jti: string) {
|
|
10
|
+
return {
|
|
11
|
+
Authorization: "bearer " + accessToken,
|
|
12
|
+
"user-identity": jti,
|
|
13
|
+
"Content-Type": "application/json",
|
|
14
|
+
Accept: "application/json",
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
fetch(path: string, query: { [key: string]: any }, body: any, method: string, header: any) {
|
|
19
|
+
path = query != null ? this.urlQueryConvert(path, query) : path;
|
|
20
|
+
return fetch(path, {
|
|
21
|
+
method: method ? method : "GET",
|
|
22
|
+
headers: header,
|
|
23
|
+
body: body,
|
|
24
|
+
}).then(
|
|
25
|
+
function (response) {
|
|
26
|
+
response.status; //=> number 100–599
|
|
27
|
+
response.statusText; //=> String
|
|
28
|
+
response.headers; //=> Headers
|
|
29
|
+
response.url; //=> String
|
|
30
|
+
|
|
31
|
+
return response.json();
|
|
32
|
+
},
|
|
33
|
+
function (error) {
|
|
34
|
+
error.message; //=> String
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @description: url请求参数组装
|
|
41
|
+
* @author ChenRui
|
|
42
|
+
* @date 2020/8/28 15:21
|
|
43
|
+
*/
|
|
44
|
+
urlQueryConvert(url: string, query: { [key: string]: any }) {
|
|
45
|
+
let connectiveSymbol = "";
|
|
46
|
+
if (url.indexOf("?") !== -1) {
|
|
47
|
+
connectiveSymbol = "&";
|
|
48
|
+
} else {
|
|
49
|
+
connectiveSymbol = "?";
|
|
50
|
+
}
|
|
51
|
+
if (query) {
|
|
52
|
+
Object.keys(query).forEach((key, idx) => {
|
|
53
|
+
const val = query[key];
|
|
54
|
+
if (idx === 0) {
|
|
55
|
+
if (val != null && val !== "null" && val !== "undefined") {
|
|
56
|
+
url += connectiveSymbol + key + "=" + val;
|
|
57
|
+
} else {
|
|
58
|
+
url += connectiveSymbol + key + "=";
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
if (val != null && val !== "null" && val !== "undefined") {
|
|
62
|
+
url += "&" + key + "=" + val;
|
|
63
|
+
} else {
|
|
64
|
+
url += "&" + key + "=";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return url;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const apiService = new ApiService();
|
|
73
|
+
export { apiService };
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { FormConfig } from "../domain/FormConfig";
|
|
2
|
-
import * as sourceLocalForage from "localforage";
|
|
3
|
-
import { NAME } from "../constants/config/storage.config";
|
|
4
|
-
class CleanLocalForageService {
|
|
5
|
-
localForage: any;
|
|
6
|
-
config: any;
|
|
7
|
-
get formConfig(): Partial<FormConfig> {
|
|
8
|
-
if ((window as any).$app.config.globalProperties.$qlForm) {
|
|
9
|
-
return (window as any).$app.config.globalProperties.$qlForm;
|
|
10
|
-
}
|
|
11
|
-
return {};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
constructor() {}
|
|
15
|
-
|
|
16
|
-
init(): void {
|
|
17
|
-
const appId: string = this.formConfig.appId ? this.formConfig.appId : "";
|
|
18
|
-
this.config = {
|
|
19
|
-
driver: sourceLocalForage.INDEXEDDB, // Force WebSQL; same as using setDriver()
|
|
20
|
-
name: NAME,
|
|
21
|
-
version: 1.0,
|
|
22
|
-
storeName: "clean:" + appId, // Should be alphanumeric, with underscores.
|
|
23
|
-
description: "用于清理实例的缓存对象",
|
|
24
|
-
};
|
|
25
|
-
this.localForage = sourceLocalForage.createInstance(this.config);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @description: 设值
|
|
30
|
-
* @author ChenRui
|
|
31
|
-
* @date 2021/3/12 16:31
|
|
32
|
-
*/
|
|
33
|
-
setItem(key: string, value: any): any {
|
|
34
|
-
this.localForage.setItem(key, value);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @description: 取值
|
|
39
|
-
* @author ChenRui
|
|
40
|
-
* @date 2021/3/12 16:31
|
|
41
|
-
*/
|
|
42
|
-
getItem(key: string): Promise<any> {
|
|
43
|
-
return this.localForage.getItem(key);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @description: 删除实例
|
|
48
|
-
* @author ChenRui
|
|
49
|
-
* @date 2021/6/22 11:08
|
|
50
|
-
*/
|
|
51
|
-
dropInstance(): void {
|
|
52
|
-
if (this.localForage != null) {
|
|
53
|
-
this.localForage.dropInstance().then();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
const cleanLocalForageService: CleanLocalForageService = new CleanLocalForageService();
|
|
58
|
-
export { CleanLocalForageService, cleanLocalForageService };
|
|
1
|
+
import { FormConfig } from "../domain/FormConfig";
|
|
2
|
+
import * as sourceLocalForage from "localforage";
|
|
3
|
+
import { NAME } from "../constants/config/storage.config";
|
|
4
|
+
class CleanLocalForageService {
|
|
5
|
+
localForage: any;
|
|
6
|
+
config: any;
|
|
7
|
+
get formConfig(): Partial<FormConfig> {
|
|
8
|
+
if ((window as any).$app.config.globalProperties.$qlForm) {
|
|
9
|
+
return (window as any).$app.config.globalProperties.$qlForm;
|
|
10
|
+
}
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
constructor() {}
|
|
15
|
+
|
|
16
|
+
init(): void {
|
|
17
|
+
const appId: string = this.formConfig.appId ? this.formConfig.appId : "";
|
|
18
|
+
this.config = {
|
|
19
|
+
driver: sourceLocalForage.INDEXEDDB, // Force WebSQL; same as using setDriver()
|
|
20
|
+
name: NAME,
|
|
21
|
+
version: 1.0,
|
|
22
|
+
storeName: "clean:" + appId, // Should be alphanumeric, with underscores.
|
|
23
|
+
description: "用于清理实例的缓存对象",
|
|
24
|
+
};
|
|
25
|
+
this.localForage = sourceLocalForage.createInstance(this.config);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @description: 设值
|
|
30
|
+
* @author ChenRui
|
|
31
|
+
* @date 2021/3/12 16:31
|
|
32
|
+
*/
|
|
33
|
+
setItem(key: string, value: any): any {
|
|
34
|
+
this.localForage.setItem(key, value);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description: 取值
|
|
39
|
+
* @author ChenRui
|
|
40
|
+
* @date 2021/3/12 16:31
|
|
41
|
+
*/
|
|
42
|
+
getItem(key: string): Promise<any> {
|
|
43
|
+
return this.localForage.getItem(key);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @description: 删除实例
|
|
48
|
+
* @author ChenRui
|
|
49
|
+
* @date 2021/6/22 11:08
|
|
50
|
+
*/
|
|
51
|
+
dropInstance(): void {
|
|
52
|
+
if (this.localForage != null) {
|
|
53
|
+
this.localForage.dropInstance().then();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const cleanLocalForageService: CleanLocalForageService = new CleanLocalForageService();
|
|
58
|
+
export { CleanLocalForageService, cleanLocalForageService };
|