@dhccmobile/vue3-lo-form 0.1.19 → 0.1.21
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/dist/vue3-lo-form.common.js +110 -26
- package/dist/vue3-lo-form.common.js.map +1 -1
- package/dist/vue3-lo-form.umd.js +110 -26
- 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 +1 -1
- package/src/core/FormApi.ts +93 -30
- package/types/core/FormApi.d.ts +7 -0
|
@@ -85122,7 +85122,8 @@ class FormApi_FormApi {
|
|
|
85122
85122
|
getValue(key) {
|
|
85123
85123
|
const control = this.getControl(key);
|
|
85124
85124
|
|
|
85125
|
-
if (control
|
|
85125
|
+
if (control) {
|
|
85126
|
+
// && control instanceof FormControl
|
|
85126
85127
|
return this.decodeData(control, false);
|
|
85127
85128
|
}
|
|
85128
85129
|
|
|
@@ -85622,7 +85623,8 @@ class FormApi_FormApi {
|
|
|
85622
85623
|
|
|
85623
85624
|
|
|
85624
85625
|
setControlValue(control, key, val, isDefault, validate = true) {
|
|
85625
|
-
if (control
|
|
85626
|
+
if (control) {
|
|
85627
|
+
// && control instanceof FormControl
|
|
85626
85628
|
switch (control.code) {
|
|
85627
85629
|
case constants_enum["g" /* FormFieldType */].InputNumber.code:
|
|
85628
85630
|
if (val && control.controlAttr.zoomMultiple) {
|
|
@@ -85934,6 +85936,7 @@ class FormApi_FormApi {
|
|
|
85934
85936
|
|
|
85935
85937
|
contrast(objectA, objectB) {
|
|
85936
85938
|
const object = {};
|
|
85939
|
+
const data = {};
|
|
85937
85940
|
const fieldInfoArr = [];
|
|
85938
85941
|
|
|
85939
85942
|
if (!objectB || !objectA) {
|
|
@@ -85941,6 +85944,8 @@ class FormApi_FormApi {
|
|
|
85941
85944
|
return object;
|
|
85942
85945
|
}
|
|
85943
85946
|
|
|
85947
|
+
console.log("======", this.dvForm.desForm.formGroup.controls);
|
|
85948
|
+
|
|
85944
85949
|
for (const key in this.dvForm.desForm.formGroup.controls) {
|
|
85945
85950
|
if (!objectA[key] && !objectB[key]) {
|
|
85946
85951
|
continue;
|
|
@@ -85956,48 +85961,123 @@ class FormApi_FormApi {
|
|
|
85956
85961
|
continue;
|
|
85957
85962
|
}
|
|
85958
85963
|
|
|
85959
|
-
if (objectA[key]
|
|
85964
|
+
if (this.getChangedInfo(control, objectA[key], objectB[key])) {
|
|
85960
85965
|
const oldValue = objectA[key]; // 记录新值
|
|
85961
85966
|
|
|
85962
85967
|
const newValue = objectB[key]; // 记录旧值
|
|
85963
85968
|
|
|
85964
85969
|
const fieldInfo = {}; //日志信息
|
|
85965
85970
|
|
|
85966
|
-
|
|
85971
|
+
if (control.code !== constants_enum["g" /* FormFieldType */].Custom.code) {
|
|
85972
|
+
fieldInfo.field_cd = key; //字段英文
|
|
85967
85973
|
|
|
85968
|
-
|
|
85969
|
-
|
|
85974
|
+
const name = control.controlAttr.formFieldDescribe;
|
|
85975
|
+
fieldInfo.field_nm = name; //字段中文
|
|
85970
85976
|
|
|
85971
|
-
|
|
85977
|
+
fieldInfo.field_key = newValue; //当前值
|
|
85972
85978
|
|
|
85973
|
-
|
|
85979
|
+
const newDict = this.translateDictionaries(control, key, newValue); // 新值描述
|
|
85974
85980
|
|
|
85975
|
-
|
|
85981
|
+
fieldInfo.field_value = newDict; //当前值描述
|
|
85976
85982
|
|
|
85977
|
-
|
|
85983
|
+
fieldInfo.is_change = "1"; //是否变动
|
|
85978
85984
|
|
|
85979
|
-
|
|
85985
|
+
fieldInfo.field_old_key = oldValue; //旧值
|
|
85980
85986
|
|
|
85981
|
-
|
|
85987
|
+
const oldDict = this.translateDictionaries(control, key, oldValue); //旧值描述
|
|
85982
85988
|
|
|
85983
|
-
|
|
85989
|
+
fieldInfo.field_old_value = oldDict; //field_old_value
|
|
85984
85990
|
|
|
85985
|
-
|
|
85986
|
-
|
|
85987
|
-
|
|
85988
|
-
|
|
85989
|
-
const newName = newValue ? newDict : "空";
|
|
85991
|
+
object[key] = newValue;
|
|
85992
|
+
fieldInfoArr.push(fieldInfo);
|
|
85993
|
+
const oldName = oldValue ? oldDict : "空";
|
|
85994
|
+
const newName = newValue ? newDict : "空"; //除自定义组件均记录日志
|
|
85990
85995
|
|
|
85991
|
-
if (control.code !== constants_enum["g" /* FormFieldType */].Custom.code) {
|
|
85992
|
-
//除自定义组件均记录日志
|
|
85993
85996
|
object.changeLog = object.changeLog ? object.changeLog + "," : "";
|
|
85994
85997
|
object.changeLog = object.changeLog + "修改【" + name + "】" + "由“" + oldName + "”修改为“" + newName + "”";
|
|
85998
|
+
} else {
|
|
85999
|
+
object[key] = newValue;
|
|
85995
86000
|
}
|
|
85996
86001
|
}
|
|
85997
86002
|
}
|
|
85998
86003
|
|
|
86004
|
+
object.fieldInfoArr = fieldInfoArr;
|
|
85999
86005
|
return object;
|
|
86000
86006
|
}
|
|
86007
|
+
/**
|
|
86008
|
+
* @Description: 获取表单值更改信息
|
|
86009
|
+
* @author lzs
|
|
86010
|
+
* @date 2022/10/11
|
|
86011
|
+
* @time 09:53
|
|
86012
|
+
*/
|
|
86013
|
+
|
|
86014
|
+
|
|
86015
|
+
getChangedInfo(control, oldValue, newValue) {
|
|
86016
|
+
oldValue = oldValue + "";
|
|
86017
|
+
newValue = newValue + "";
|
|
86018
|
+
let flag = true;
|
|
86019
|
+
|
|
86020
|
+
switch (control.code) {
|
|
86021
|
+
case constants_enum["g" /* FormFieldType */].Input.code:
|
|
86022
|
+
if (oldValue === newValue) flag = false;
|
|
86023
|
+
break;
|
|
86024
|
+
|
|
86025
|
+
case constants_enum["g" /* FormFieldType */].InputNumber.code:
|
|
86026
|
+
if (oldValue === newValue) flag = false;
|
|
86027
|
+
break;
|
|
86028
|
+
|
|
86029
|
+
case constants_enum["g" /* FormFieldType */].Textarea.code:
|
|
86030
|
+
if (oldValue === newValue) flag = false;
|
|
86031
|
+
break;
|
|
86032
|
+
|
|
86033
|
+
case constants_enum["g" /* FormFieldType */].Slider.code:
|
|
86034
|
+
if (oldValue === newValue) flag = false;
|
|
86035
|
+
break;
|
|
86036
|
+
|
|
86037
|
+
case constants_enum["g" /* FormFieldType */].Rate.code:
|
|
86038
|
+
if (oldValue === newValue) flag = false;
|
|
86039
|
+
break;
|
|
86040
|
+
|
|
86041
|
+
case constants_enum["g" /* FormFieldType */].Select.code:
|
|
86042
|
+
if (oldValue === newValue) flag = false;
|
|
86043
|
+
break;
|
|
86044
|
+
|
|
86045
|
+
case constants_enum["g" /* FormFieldType */].Checkbox.code:
|
|
86046
|
+
if (oldValue === newValue) flag = false;
|
|
86047
|
+
break;
|
|
86048
|
+
|
|
86049
|
+
case constants_enum["g" /* FormFieldType */].Radio.code:
|
|
86050
|
+
if (oldValue === newValue) flag = false;
|
|
86051
|
+
break;
|
|
86052
|
+
|
|
86053
|
+
case constants_enum["g" /* FormFieldType */].TimePicker.code:
|
|
86054
|
+
if (oldValue === newValue) flag = false;
|
|
86055
|
+
break;
|
|
86056
|
+
|
|
86057
|
+
case constants_enum["g" /* FormFieldType */].DatePicker.code:
|
|
86058
|
+
oldValue = dateFormat.formatDateTime(oldValue, "YYYY-MM-dd");
|
|
86059
|
+
newValue = dateFormat.formatDateTime(newValue, "YYYY-MM-dd");
|
|
86060
|
+
if (oldValue === newValue) flag = false;
|
|
86061
|
+
break;
|
|
86062
|
+
|
|
86063
|
+
case constants_enum["g" /* FormFieldType */].Cascader.code:
|
|
86064
|
+
if (oldValue === newValue) flag = false;
|
|
86065
|
+
break;
|
|
86066
|
+
|
|
86067
|
+
case constants_enum["g" /* FormFieldType */].TreeSelect.code:
|
|
86068
|
+
if (oldValue === newValue) flag = false;
|
|
86069
|
+
break;
|
|
86070
|
+
|
|
86071
|
+
case constants_enum["g" /* FormFieldType */].Switch.code:
|
|
86072
|
+
if (oldValue === newValue) flag = false;
|
|
86073
|
+
break;
|
|
86074
|
+
|
|
86075
|
+
case constants_enum["g" /* FormFieldType */].Custom.code:
|
|
86076
|
+
break;
|
|
86077
|
+
}
|
|
86078
|
+
|
|
86079
|
+
return flag;
|
|
86080
|
+
}
|
|
86001
86081
|
/**
|
|
86002
86082
|
* @Description: 翻译字典项
|
|
86003
86083
|
* @author lzs
|
|
@@ -86093,13 +86173,17 @@ class FormApi_FormApi {
|
|
|
86093
86173
|
case constants_enum["g" /* FormFieldType */].Cascader.code:
|
|
86094
86174
|
str = "";
|
|
86095
86175
|
formTreeNodeConvertService.treeNodeConvertToArray(control.controlAttr.treeShapeOptions, [], "children").forEach(item => {
|
|
86096
|
-
value
|
|
86097
|
-
|
|
86098
|
-
|
|
86099
|
-
|
|
86100
|
-
|
|
86176
|
+
if (value) {
|
|
86177
|
+
value.split(",").forEach(index => {
|
|
86178
|
+
if (item.value === index) {
|
|
86179
|
+
str = str + item.title + ",";
|
|
86180
|
+
}
|
|
86181
|
+
});
|
|
86182
|
+
str = str.substring(0, str.length - 1);
|
|
86183
|
+
} else {
|
|
86184
|
+
str = "";
|
|
86185
|
+
}
|
|
86101
86186
|
});
|
|
86102
|
-
str = str.substring(0, str.length - 1);
|
|
86103
86187
|
break;
|
|
86104
86188
|
|
|
86105
86189
|
case constants_enum["g" /* FormFieldType */].TreeSelect.code:
|