olp-table 5.3.4 → 5.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -92
- package/.env.build +0 -1
- package/README.md +0 -26
- package/babel.config.js +0 -5
- package/jsconfig.json +0 -22
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/rmMode.bat +0 -1
- package/src/App.vue +0 -199
- package/src/api/crud.js +0 -22
- package/src/api/dist.js +0 -6
- package/src/assets/iconfont/iconfont.css +0 -20
- package/src/assets/iconfont/iconfont.json +0 -16
- package/src/assets/iconfont/iconfont.ttf +0 -0
- package/src/assets/iconfont/iconfont.woff +0 -0
- package/src/assets/iconfont/iconfont.woff2 +0 -0
- package/src/assets/logo.png +0 -0
- package/src/components/auto-height/index.vue +0 -75
- package/src/components/codemirror-tag.vue +0 -100
- package/src/components/lazy-load-select.vue +0 -107
- package/src/components/ol-dialog-excel.vue +0 -112
- package/src/components/ol-dialog-import.vue +0 -304
- package/src/components/ol-dialog-json.vue +0 -82
- package/src/components/ol-dialog-table.vue +0 -81
- package/src/components/ol-dialog-upload-file.vue +0 -208
- package/src/components/ol-dict-tag.vue +0 -271
- package/src/components/ol-select-dom.vue +0 -71
- package/src/components/ol-table-filter.vue +0 -28
- package/src/components/ol-table-render.vue +0 -44
- package/src/components/ol-table-select.vue +0 -150
- package/src/components/pinia-init.vue +0 -18
- package/src/components/table/model/ModelMixins.js +0 -43
- package/src/components/table/model/model-index.vue +0 -121
- package/src/components/table/model/ot-left-right.vue +0 -18
- package/src/components/table/model/ot-left-tree-right-table.scss +0 -14
- package/src/components/table/model/ot-left-tree-right-table.vue +0 -41
- package/src/components/table/model/ot-top-1-bottom-2.vue +0 -39
- package/src/components/table/model/ot-top-2-bottom-1.vue +0 -38
- package/src/components/table/model/ot-top-2-bottom-2.vue +0 -38
- package/src/components/table/model/ot-top-bottom.vue +0 -18
- package/src/components/table/model/splitpanesModel.css +0 -22
- package/src/components/table/model/splitpanesModel.vue +0 -54
- package/src/components/table/ol-form/index.vue +0 -537
- package/src/components/table/ol-form-v3/index.vue +0 -455
- package/src/components/table/ol-main-form-sub-table/index.vue +0 -601
- package/src/components/table/ol-pager/index.vue +0 -46
- package/src/components/table/ol-table/components/ol-table-column-config/columnIndex.vue +0 -233
- package/src/components/table/ol-table/components/ol-table-column-config/index.vue +0 -145
- package/src/components/table/ol-table/components/ol-table-column-dict-color/index.vue +0 -88
- package/src/components/table/ol-table/index.vue +0 -232
- package/src/components/table/ol-table-operate/index.vue +0 -61
- package/src/components/table/ol-table-search/index.vue +0 -17
- package/src/components/table/ol-table-tool-btn/index.vue +0 -60
- package/src/components/tree/components/o-tree.vue +0 -289
- package/src/components/tree/index.vue +0 -46
- package/src/components/v-component/index.vue +0 -43
- package/src/config/dev-config.js +0 -5
- package/src/config/prod-config.js +0 -5
- package/src/config/shared-config.js +0 -20
- package/src/data.js +0 -9378
- package/src/directives/permission/hasPermi.js +0 -63
- package/src/directives/permission/hasRole.js +0 -30
- package/src/main.js +0 -55
- package/src/mixins/VTMixin/DefaultMethods.js +0 -749
- package/src/mixins/VTMixin/OTMixinBody.js +0 -105
- package/src/mixins/VTMixin/OTMixinBodyFooter.js +0 -93
- package/src/mixins/VTMixin/OTMixinBodyMethods.js +0 -420
- package/src/mixins/VTMixin/OTMixinColumnMethod.js +0 -450
- package/src/mixins/VTMixin/OTMixinInitMethod.js +0 -130
- package/src/mixins/VTMixin/OTMixinPager.js +0 -38
- package/src/mixins/VTMixin/OTMixinSortable.js +0 -43
- package/src/mixins/VTMixin/index.js +0 -18
- package/src/package/index.js +0 -20
- package/src/plugins/axios.js +0 -61
- package/src/store/dict.js +0 -76
- package/src/store/dictType.js +0 -52
- package/src/store/permi.js +0 -45
- package/src/styles/common.scss +0 -37
- package/src/styles/index.scss +0 -48
- package/src/styles/theme.scss +0 -32
- package/src/utils/AESCRUDUtils.js +0 -87
- package/src/utils/DateUtils.js +0 -35
- package/src/utils/ExcelUtil.js +0 -159
- package/src/utils/TableSortUtil.js +0 -91
- package/src/utils/columnProp.js +0 -3
- package/src/utils/groupCompute.js +0 -68
- package/src/utils/http/httpFactory.js +0 -92
- package/src/utils/http/httpFactory2.js +0 -79
- package/src/utils/http/httpUtil.js +0 -123
- package/src/utils/http/httpUtils.js +0 -38
- package/src/utils/loadStyle.js +0 -14
- package/src/utils/message.js +0 -56
- package/src/utils/object.js +0 -80
- package/src/utils/security/TokenUtil.js +0 -19
- package/src/utils/tree.js +0 -54
- package/src/utils/util.js +0 -127
- package/src/views/Test/index.vue +0 -77
- package/src/views/Test/index2.vue +0 -33
- package/src/views/components/btn-config/index.vue +0 -202
- package/src/views/components/option-config/index.vue +0 -192
- package/src/views/db/chineseToEnglish.vue +0 -127
- package/src/views/db/filed.vue +0 -395
- package/src/views/db/index.vue +0 -192
- package/src/views/db/preview/index.vue +0 -139
- package/src/views/db/preview/left.vue +0 -204
- package/src/views/db/preview/right.vue +0 -466
- package/src/views/groupTable/index.vue +0 -137
- package/src/views/groupTable/ol-table-column-config/columnIndex.vue +0 -194
- package/src/views/groupTable/ol-table-column-config/index.vue +0 -92
- package/src/views/table/add-or-edit/config/base-config/index.vue +0 -539
- package/src/views/table/add-or-edit/config/base-config/table-form.vue +0 -333
- package/src/views/table/add-or-edit/config/column-config/header-config.vue +0 -475
- package/src/views/table/add-or-edit/config/column-config/index.vue +0 -790
- package/src/views/table/add-or-edit/config/data/column.js +0 -218
- package/src/views/table/add-or-edit/config/data/crud.js +0 -122
- package/src/views/table/add-or-edit/config/data/events.js +0 -109
- package/src/views/table/add-or-edit/config/data/method.js +0 -127
- package/src/views/table/add-or-edit/config/data/option.js +0 -725
- package/src/views/table/add-or-edit/config/data/page.js +0 -79
- package/src/views/table/add-or-edit/config/field-config/filed-config-table.vue +0 -42
- package/src/views/table/add-or-edit/config/field-config/index.vue +0 -91
- package/src/views/table/add-or-edit/config/form-config/index.vue +0 -1179
- package/src/views/table/add-or-edit/config/index.vue +0 -376
- package/src/views/table/add-or-edit/config/initFormObject.js +0 -25
- package/src/views/table/add-or-edit/config/script-config/LeftMeun.vue +0 -71
- package/src/views/table/add-or-edit/config/script-config/index.vue +0 -70
- package/src/views/table/add-or-edit/config/table-config/btn-config.vue +0 -340
- package/src/views/table/add-or-edit/config/table-config/btn-sort.vue +0 -132
- package/src/views/table/add-or-edit/config/table-config/index.vue +0 -446
- package/src/views/table/add-or-edit/configOld/dataTags/filed-config-table-model.vue +0 -41
- package/src/views/table/add-or-edit/configOld/dataTags/filed-config.vue +0 -74
- package/src/views/table/add-or-edit/configOld/dataTags/index.vue +0 -439
- package/src/views/table/add-or-edit/configOld/dataTags/set-table-sql.vue +0 -79
- package/src/views/table/add-or-edit/configOld/dataTags/table-on-config.vue +0 -74
- package/src/views/table/add-or-edit/configOld/index.vue +0 -127
- package/src/views/table/add-or-edit/configOld/tableTags/columnConfig.js +0 -5
- package/src/views/table/add-or-edit/configOld/tableTags/index.vue +0 -353
- package/src/views/table/add-or-edit/configOld/tableTags/operation-but-config.vue +0 -75
- package/src/views/table/add-or-edit/configOld/tableTags/tool-but-config.vue +0 -92
- package/src/views/table/add-or-edit/index.vue +0 -201
- package/src/views/table/add-or-edit/themeModel/index.vue +0 -53
- package/src/views/table/add-or-edit/themeModel/init-model-table.vue +0 -48
- package/src/views/table/add-or-edit/themeModel/init-model.vue +0 -81
- package/src/views/table/add-or-edit/themeModel/left-right.vue +0 -24
- package/src/views/table/add-or-edit/themeModel/left-tree-right-table.vue +0 -75
- package/src/views/table/add-or-edit/themeModel/olTableSearchModelMixins.js +0 -42
- package/src/views/table/add-or-edit/themeModel/splitpanesThemeModel.vue +0 -49
- package/src/views/table/add-or-edit/themeModel/top-1-bottom-2.vue +0 -29
- package/src/views/table/add-or-edit/themeModel/top-2-bottom-1.vue +0 -32
- package/src/views/table/add-or-edit/themeModel/top-2-bottom-2.vue +0 -32
- package/src/views/table/add-or-edit/themeModel/top-bottom.vue +0 -14
- package/src/views/table/index.vue +0 -43
- package/src/views/table/index2.vue +0 -199
- package/src/views/table/preview/index.vue +0 -29
- package/src/views/tree/components/config-core-data.vue +0 -85
- package/src/views/tree/components/config-core-table.vue +0 -362
- package/src/views/tree/components/config-core-tree/data/events.js +0 -95
- package/src/views/tree/components/config-core-tree/data/option.js +0 -88
- package/src/views/tree/components/config-core-tree/data/prop.js +0 -28
- package/src/views/tree/components/config-core-tree/index.vue +0 -181
- package/src/views/tree/components/config-core.vue +0 -42
- package/src/views/tree/components/form-config/index.vue +0 -967
- package/src/views/tree/index.vue +0 -424
- package/vue.config.js +0 -44
- /package/{olp-table/demo.html → demo.html} +0 -0
- /package/{olp-table/fonts → fonts}/iconfont.1720006583309.7e4906d9.woff +0 -0
- /package/{olp-table/fonts → fonts}/iconfont.1720006583309.947a27f0.ttf +0 -0
- /package/{olp-table/olp-table.common.js → olp-table.common.js} +0 -0
- /package/{olp-table/olp-table.css → olp-table.css} +0 -0
- /package/{olp-table/olp-table.umd.js → olp-table.umd.js} +0 -0
- /package/{olp-table/olp-table.umd.min.js → olp-table.umd.min.js} +0 -0
|
@@ -1,749 +0,0 @@
|
|
|
1
|
-
import {handleTree} from "@/utils/tree";
|
|
2
|
-
import {useMessage} from "@/utils/message";
|
|
3
|
-
import {post, get, request, postAes} from "@/utils/http/httpUtils";
|
|
4
|
-
import {exportExcel} from "@/utils/ExcelUtil";
|
|
5
|
-
import VXETable from "vxe-table";
|
|
6
|
-
import {groupAndCompute} from "@/utils/groupCompute";
|
|
7
|
-
|
|
8
|
-
const message = useMessage() // 消息弹窗
|
|
9
|
-
export const DefaultMethods = {
|
|
10
|
-
methods: {
|
|
11
|
-
//删除主子表
|
|
12
|
-
async doRemoveMainAndSub({obj, row},subTableName, whereObj, subForeignKey, content) {
|
|
13
|
-
if (content) {
|
|
14
|
-
let type = await VXETable.modal.confirm({
|
|
15
|
-
content: content, title: '提示', status: 'warning'
|
|
16
|
-
})
|
|
17
|
-
if (type == "cancel") {
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
this.doPostAes(obj.code, '/online/crudAes/deleteMainAndSubs', {
|
|
22
|
-
dbName: this.tableConfig.dbName,
|
|
23
|
-
tableName: this.tableConfig.mainTable,
|
|
24
|
-
subTableName:subTableName,
|
|
25
|
-
whereMap: this.doGetWhereMap(row, whereObj),//更新条件
|
|
26
|
-
subForeignKey:subForeignKey,
|
|
27
|
-
})
|
|
28
|
-
},
|
|
29
|
-
//单个更新
|
|
30
|
-
async doOneSave({obj, row}, updateObj, whereObj, content) {
|
|
31
|
-
if (content) {
|
|
32
|
-
let type = await VXETable.modal.confirm({
|
|
33
|
-
content: content, title: '提示', status: 'warning'
|
|
34
|
-
})
|
|
35
|
-
if (type == "cancel") {
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (!row) {
|
|
40
|
-
VXETable.modal.message({
|
|
41
|
-
content: "数据为空!", title: '提示', status: 'error'
|
|
42
|
-
})
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
let dataSource = this.table.dataSource;
|
|
46
|
-
if (!dataSource) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
row[this.formMainList.edit.formMain.updateKey] = ''
|
|
50
|
-
let params = {
|
|
51
|
-
dbName: this.tableConfig.dbName,
|
|
52
|
-
tableName: this.tableConfig.mainTable,
|
|
53
|
-
genIdMap:{[this.formMainList.edit.formMain.updateKey]: 'uuid'},
|
|
54
|
-
columnAndValueMap: this.getColumnTableUpdateValue(this.table.columns,row),
|
|
55
|
-
whereMap: this.doGetWhereMap(row, this.formMainList.edit.formMain.updateKey)
|
|
56
|
-
}
|
|
57
|
-
this.doPostAes(obj.code, '/online/crudAes/save', params)
|
|
58
|
-
},
|
|
59
|
-
//单个更新
|
|
60
|
-
async doOneModify({obj, row}, updateObj, whereObj, content) {
|
|
61
|
-
if (content) {
|
|
62
|
-
let type = await VXETable.modal.confirm({
|
|
63
|
-
content: content, title: '提示', status: 'warning'
|
|
64
|
-
})
|
|
65
|
-
if (type == "cancel") {
|
|
66
|
-
return
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
this.doPostAes(obj.code, '/online/crudAes/modify', {
|
|
71
|
-
dbName: this.tableConfig.dbName,
|
|
72
|
-
tableName: this.tableConfig.mainTable,
|
|
73
|
-
columnAndValueMap: this.doGetColumnAndValueMap(row, updateObj),//更新字段
|
|
74
|
-
whereMap: this.doGetWhereMap(row, whereObj),//更新条件
|
|
75
|
-
})
|
|
76
|
-
},
|
|
77
|
-
//批量更新
|
|
78
|
-
async doBatchModify(code, updateObj, whereObj, content, updateRecords) {
|
|
79
|
-
if (content) {
|
|
80
|
-
let type = await VXETable.modal.confirm({
|
|
81
|
-
content: content, title: '提示', status: 'warning'
|
|
82
|
-
})
|
|
83
|
-
if (type == "cancel") {
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
let rows = updateRecords;
|
|
88
|
-
if (!updateRecords || updateRecords.length <= 0) {
|
|
89
|
-
rows = this.getSelectRows();
|
|
90
|
-
}
|
|
91
|
-
if (rows.length == 0) {
|
|
92
|
-
VXETable.modal.message({
|
|
93
|
-
content: "请选数据!", title: '提示', status: 'error'
|
|
94
|
-
})
|
|
95
|
-
return
|
|
96
|
-
}
|
|
97
|
-
let list = [];
|
|
98
|
-
for (const row of rows) {
|
|
99
|
-
list.push({
|
|
100
|
-
columnAndValueMap: this.doGetColumnAndValueMap(row, updateObj),//更新字段
|
|
101
|
-
whereMap: this.doGetWhereMap(row, whereObj),//更新条件
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
this.doPostAes(code, '/online/crudAes/batchModify', {
|
|
105
|
-
dbName: this.tableConfig.dbName,
|
|
106
|
-
tableName: this.tableConfig.mainTable,
|
|
107
|
-
list
|
|
108
|
-
})
|
|
109
|
-
},
|
|
110
|
-
doPostAes(code, url, params) {
|
|
111
|
-
this.loading[code] = true
|
|
112
|
-
postAes(this.http, url, params).then(r => {
|
|
113
|
-
if (r != false) {
|
|
114
|
-
this.query();
|
|
115
|
-
}
|
|
116
|
-
}).finally(() => {
|
|
117
|
-
this.loading[code] = false
|
|
118
|
-
});
|
|
119
|
-
},
|
|
120
|
-
/**
|
|
121
|
-
* 根据列配置获取数据库表更新数据
|
|
122
|
-
* @param column
|
|
123
|
-
* @param formData
|
|
124
|
-
* @returns {{}}
|
|
125
|
-
*/
|
|
126
|
-
getTableUpdateValue(column, formData) {
|
|
127
|
-
let columnAndValueMap = {}
|
|
128
|
-
for (let {prop,tableField} of column) {
|
|
129
|
-
if (!tableField || tableField != '1') {
|
|
130
|
-
continue
|
|
131
|
-
}
|
|
132
|
-
let value = formData[prop];
|
|
133
|
-
if (value) {
|
|
134
|
-
if (value instanceof String) {
|
|
135
|
-
value = value.trim();
|
|
136
|
-
}
|
|
137
|
-
columnAndValueMap[prop] = value;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return columnAndValueMap;
|
|
141
|
-
},
|
|
142
|
-
getColumnTableUpdateValue(column, formData) {
|
|
143
|
-
let columnAndValueMap = {}
|
|
144
|
-
for (let {field,tableSaveToOtherProp} of column) {
|
|
145
|
-
// 勾选,不属于数据库表字段
|
|
146
|
-
if (tableSaveToOtherProp && tableSaveToOtherProp == '1') {
|
|
147
|
-
continue
|
|
148
|
-
}
|
|
149
|
-
let value = formData[field];
|
|
150
|
-
if (value) {
|
|
151
|
-
if (value instanceof String) {
|
|
152
|
-
value = value.trim();
|
|
153
|
-
}
|
|
154
|
-
columnAndValueMap[field] = value;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return columnAndValueMap;
|
|
158
|
-
},
|
|
159
|
-
doGetColumnAndValueMap(row, updateObj) {
|
|
160
|
-
let columnAndValueMap = {};
|
|
161
|
-
for (let key of updateObj.split(",")) {
|
|
162
|
-
let k = key.split("=");
|
|
163
|
-
|
|
164
|
-
if (k.length == 2) {
|
|
165
|
-
columnAndValueMap[k[0]] = k[1];
|
|
166
|
-
} else {
|
|
167
|
-
k = key.split(":");
|
|
168
|
-
columnAndValueMap[k[k.length - 1]] = row[k[0]];
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return columnAndValueMap;
|
|
172
|
-
},
|
|
173
|
-
doGetColumnAndValueAny(rows, updateObj) {
|
|
174
|
-
if (!updateObj) {
|
|
175
|
-
return rows;
|
|
176
|
-
}
|
|
177
|
-
let list = []
|
|
178
|
-
let keys = [];
|
|
179
|
-
let hasKey = '';
|
|
180
|
-
for (const row of rows) {
|
|
181
|
-
keys = keys.length >=1 ?keys:Object.keys(row)
|
|
182
|
-
if (!hasKey) {
|
|
183
|
-
hasKey = this.hasUpdateKey(keys, updateObj)
|
|
184
|
-
}
|
|
185
|
-
if (hasKey) {
|
|
186
|
-
Object.assign(row, this.doGetColumnAndValueMap(row, updateObj))
|
|
187
|
-
}
|
|
188
|
-
list.push(row);
|
|
189
|
-
}
|
|
190
|
-
return list;
|
|
191
|
-
},
|
|
192
|
-
getJs(v, columnsStr) {
|
|
193
|
-
// let colemn = "HT_RentbillOID:BillID,ShopNumber:ShopNumber,rent:rent,tenant:tenant,Assetaddress:Assetaddress,DJYPFMY:DJYPFMY,MJPFM:MJPFM";
|
|
194
|
-
// return 'this.table.data.push(...this.doGetColumnAndValueAny(v, columnsStr))'
|
|
195
|
-
},
|
|
196
|
-
hasUpdateKey(keys, updateObj) {
|
|
197
|
-
for (const key of keys) {
|
|
198
|
-
if (updateObj.indexOf(key) >= 0) {
|
|
199
|
-
return '1';
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return '0';
|
|
203
|
-
},
|
|
204
|
-
doGetWhereMap(row, whereObj) {
|
|
205
|
-
let whereMap = {};
|
|
206
|
-
for (let key of whereObj.split(",")) {
|
|
207
|
-
let k = key.split(":");
|
|
208
|
-
whereMap[k[k.length - 1]] = row[k[0]];
|
|
209
|
-
}
|
|
210
|
-
return whereMap;
|
|
211
|
-
},
|
|
212
|
-
/**
|
|
213
|
-
* 内置批量删除方法
|
|
214
|
-
* @param o
|
|
215
|
-
* @returns {Promise<void>}
|
|
216
|
-
*/ batchRemove() {
|
|
217
|
-
this.confirm("您选中" + this.getSelectRows().length + '条数据,删除后不可恢复,您确定要删除吗?', '删除提示', 'error').then(type => {
|
|
218
|
-
if (type != "cancel") {
|
|
219
|
-
let list = [];
|
|
220
|
-
for (let r of this.getSelectRows()) {
|
|
221
|
-
let p = JSON.parse(JSON.stringify(this.deleteParameter));
|
|
222
|
-
delete p['$parentId'];
|
|
223
|
-
for (let key of Object.keys(p)) {
|
|
224
|
-
p[key] = r[key];
|
|
225
|
-
}
|
|
226
|
-
list.push(p);
|
|
227
|
-
}
|
|
228
|
-
this.loading['batchDelete'] = true
|
|
229
|
-
postAes(this.http, '/online/crudAes/batchDelete', {
|
|
230
|
-
dbName: this.tableConfig.dbName,
|
|
231
|
-
tableName: this.tableConfig.mainTable,
|
|
232
|
-
list: list
|
|
233
|
-
}).then(r => {
|
|
234
|
-
if (r != false) {
|
|
235
|
-
this.query();
|
|
236
|
-
}
|
|
237
|
-
}).finally(() => {
|
|
238
|
-
this.loading['batchDelete'] = false
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
})
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}, /**
|
|
245
|
-
* 内置重置方法
|
|
246
|
-
* @param o
|
|
247
|
-
* @returns {Promise<void>}
|
|
248
|
-
*/ resetQuery() {
|
|
249
|
-
for (let k of Object.keys(this.table.formConfig.data)) {
|
|
250
|
-
this.table.formConfig.data[k] = undefined
|
|
251
|
-
}
|
|
252
|
-
for (let k of Object.keys(this.parameter)) {
|
|
253
|
-
this.parameter[k] = undefined
|
|
254
|
-
}
|
|
255
|
-
this.initDefaultValue();
|
|
256
|
-
this.query();
|
|
257
|
-
}, /**
|
|
258
|
-
* 内置根据参数查询
|
|
259
|
-
* @param o
|
|
260
|
-
* @returns {Promise<void>}
|
|
261
|
-
*/
|
|
262
|
-
queryParams(parameter) {
|
|
263
|
-
if (parameter) {
|
|
264
|
-
Object.assign(this.parameter, parameter)
|
|
265
|
-
}
|
|
266
|
-
return this.query();
|
|
267
|
-
}, /**
|
|
268
|
-
* 内置查询
|
|
269
|
-
* @param o
|
|
270
|
-
* @returns {Promise<void>}
|
|
271
|
-
*/
|
|
272
|
-
query() {
|
|
273
|
-
let axios = undefined;
|
|
274
|
-
if (this.tableConfig.definitionSql == 2) {
|
|
275
|
-
if (this.tableConfig.requestType == '1') {
|
|
276
|
-
axios = post(this.http, this.tableConfig.api, this.getParams(), false, false);
|
|
277
|
-
} else {
|
|
278
|
-
axios = get(this.http, this.tableConfig.api, this.getParams(), false);
|
|
279
|
-
}
|
|
280
|
-
} else {
|
|
281
|
-
axios = postAes(this.http, '/online/crudAes/query', this.getParams(), false, false);
|
|
282
|
-
}
|
|
283
|
-
this.doQuery(axios);
|
|
284
|
-
}, doQuery(axios) {
|
|
285
|
-
if (this.loading['select']) {
|
|
286
|
-
return
|
|
287
|
-
}
|
|
288
|
-
this.table.loading = true;
|
|
289
|
-
this.loading['select'] = true
|
|
290
|
-
axios.then(({data, code, msg}) => {
|
|
291
|
-
if (code != 200 && code != 0) {
|
|
292
|
-
message.error(msg)
|
|
293
|
-
return
|
|
294
|
-
}
|
|
295
|
-
let respData = (data instanceof Array) ? data : data.listData;
|
|
296
|
-
if (this.table.treeConfig) {
|
|
297
|
-
//id , parentId , children
|
|
298
|
-
respData = handleTree(respData, this.table.treeConfig.treeId, this.table.treeConfig.treeParentId);
|
|
299
|
-
}
|
|
300
|
-
this.table.data = respData;
|
|
301
|
-
this.doGroupAndCompute(respData)
|
|
302
|
-
this.pagination.total = data.count;
|
|
303
|
-
}).finally(() => {
|
|
304
|
-
this.table.loading = false;
|
|
305
|
-
this.loading['select'] = false
|
|
306
|
-
});
|
|
307
|
-
},
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* 内置删除方法
|
|
311
|
-
* @param o
|
|
312
|
-
* @returns {Promise<void>}
|
|
313
|
-
*/
|
|
314
|
-
remove(o) {
|
|
315
|
-
let {row} = o;
|
|
316
|
-
this.confirm('数据删除后不可恢复,您确定要删除吗?', '删除提示', 'error').then(type => {
|
|
317
|
-
if (type != "cancel") {
|
|
318
|
-
let params = {};
|
|
319
|
-
for (let key of Object.keys(this.deleteParameter)) {
|
|
320
|
-
if (key != '$parentId') {
|
|
321
|
-
params[key] = row[key];
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
postAes(this.http, '/online/crudAes/delete', {
|
|
325
|
-
where: params,
|
|
326
|
-
dbName: this.tableConfig.dbName,
|
|
327
|
-
tableName: this.tableConfig.mainTable,
|
|
328
|
-
}).then(r => {
|
|
329
|
-
if (r != false) {
|
|
330
|
-
this.query()
|
|
331
|
-
}
|
|
332
|
-
})
|
|
333
|
-
}
|
|
334
|
-
})
|
|
335
|
-
}, /**
|
|
336
|
-
* 获取查询参数
|
|
337
|
-
* @returns {{enablePage: OTMixinBodyMethods.methods.pagination.enabled, theme: OTMixinBodyMethods.methods.theme, id: OTMixinBodyMethods.methods.uuid}}
|
|
338
|
-
*/
|
|
339
|
-
getParams() {
|
|
340
|
-
if (this.tableConfig.definitionSql == 2) {
|
|
341
|
-
let params = JSON.parse(JSON.stringify(this.table.formConfig.data));
|
|
342
|
-
if (params.enablePage) {
|
|
343
|
-
params.pageNumber = this.pagination.currentPage;
|
|
344
|
-
params.pageSize = this.pagination.pageSize;
|
|
345
|
-
}
|
|
346
|
-
return {...this.parameter, ...params}
|
|
347
|
-
}
|
|
348
|
-
let params = {
|
|
349
|
-
id: this.uuid, theme: this.theme, enablePage: this.pagination.enabled
|
|
350
|
-
};
|
|
351
|
-
if (params.enablePage) {
|
|
352
|
-
params.pageNumber = this.pagination.currentPage;
|
|
353
|
-
params.pageSize = this.pagination.pageSize;
|
|
354
|
-
}
|
|
355
|
-
let paramsKey = [];
|
|
356
|
-
for (let o of this.table.formConfig.items) {
|
|
357
|
-
let value = this.table.formConfig.data[o.key];
|
|
358
|
-
if (value == undefined || value == '' || (o.itemRender && o.itemRender.name == '$buttons')) {
|
|
359
|
-
continue
|
|
360
|
-
}
|
|
361
|
-
let key = o.key.replace(/\$/g, '');
|
|
362
|
-
if (o.tableName != undefined && o.tableName != '') {
|
|
363
|
-
key = o.tableName + '.' + key;
|
|
364
|
-
}
|
|
365
|
-
//文本域
|
|
366
|
-
if (o.itemRender && o.itemRender.name == "textarea" && o.type != "9") {
|
|
367
|
-
let values = value instanceof Array ? value : value.split("\n");
|
|
368
|
-
if (values.length != 0) {
|
|
369
|
-
let queryParameterMapIn = [];
|
|
370
|
-
for (let v of values) {
|
|
371
|
-
if (v != undefined && v.toString().trim() != '') {
|
|
372
|
-
queryParameterMapIn.push(v);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
if (queryParameterMapIn.length != 0) {
|
|
376
|
-
if (!params['queryParameterMapIn']) {
|
|
377
|
-
params['queryParameterMapIn'] = {};
|
|
378
|
-
}
|
|
379
|
-
params['queryParameterMapIn'][key] = queryParameterMapIn;
|
|
380
|
-
paramsKey.push(key);
|
|
381
|
-
} else if (params['queryParameterMapIn']) {
|
|
382
|
-
delete params['queryParameterMapIn'][key];
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
} else if (value.toString().trim() != '') {
|
|
387
|
-
if (!params['queryParameterListAnd']) {
|
|
388
|
-
params['queryParameterListAnd'] = [];
|
|
389
|
-
}
|
|
390
|
-
let values = value instanceof Array ? value : value.split(",");
|
|
391
|
-
if (o.type == "98") {
|
|
392
|
-
params['queryParameterListAnd'].push({
|
|
393
|
-
value: values[0], key: key, type: 5, toDate: o.toDate
|
|
394
|
-
});
|
|
395
|
-
params['queryParameterListAnd'].push({
|
|
396
|
-
value: values[1], key: key, type: 6, toDate: o.toDate
|
|
397
|
-
});
|
|
398
|
-
paramsKey.push(key);
|
|
399
|
-
} else if (value.length == 1 && !(value instanceof Array)) {
|
|
400
|
-
o.value = value;
|
|
401
|
-
//type 查询类型 默认等于1--> 1:= 2:!= 3: > 4:< 5: >= 6: <= 7:like '%value' 8:like '%value%' 9:like 'value%'
|
|
402
|
-
//replace(/\$/g, '') 目的解决范围
|
|
403
|
-
let obj = {
|
|
404
|
-
value: value, key: key, type: o.type, toDate: o.toDate
|
|
405
|
-
};
|
|
406
|
-
params['queryParameterListAnd'].push(obj);
|
|
407
|
-
paramsKey.push(key);
|
|
408
|
-
} else {
|
|
409
|
-
for (let v of values) {
|
|
410
|
-
if (!v) {
|
|
411
|
-
continue;
|
|
412
|
-
}
|
|
413
|
-
let obj = {
|
|
414
|
-
value: v, key: key, type: o.type, toDate: o.toDate
|
|
415
|
-
};
|
|
416
|
-
params['queryParameterListAnd'].push(obj);
|
|
417
|
-
paramsKey.push(key);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
for (let key of Object.keys(this.parameter)) {
|
|
423
|
-
let v = this.parameter[key];
|
|
424
|
-
if (paramsKey.indexOf(key) === -1 && v != undefined && v != '') {
|
|
425
|
-
if (!params['queryParameterListAnd']) {
|
|
426
|
-
params['queryParameterListAnd'] = [];
|
|
427
|
-
}
|
|
428
|
-
params['queryParameterListAnd'].push({
|
|
429
|
-
key: key, value: v
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
if (this.orderByColumns.length != 0) {
|
|
434
|
-
params['orderBy'] = this.orderByColumns;
|
|
435
|
-
}
|
|
436
|
-
if (this.events['queryBefore']) {
|
|
437
|
-
this.events['queryBefore'](params)
|
|
438
|
-
}
|
|
439
|
-
return params;
|
|
440
|
-
}, /**
|
|
441
|
-
* 导出数据
|
|
442
|
-
* @param columns 自定义导出字段 t_id
|
|
443
|
-
* @param selectData 选择数据: 当前页数据、勾选行数据、全部数据
|
|
444
|
-
* @param name
|
|
445
|
-
*/
|
|
446
|
-
exportData({exportParam, cancelEvent}) {
|
|
447
|
-
let {columns, selectData, name} = exportParam
|
|
448
|
-
for (let column of this.table.columns) {
|
|
449
|
-
for (let c of columns) {
|
|
450
|
-
if (column.field === c.field && column.params) {
|
|
451
|
-
c.params = column.params;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
let data = []
|
|
456
|
-
switch (selectData) {
|
|
457
|
-
case '1': // 当前页
|
|
458
|
-
data = this.table?.data
|
|
459
|
-
break
|
|
460
|
-
case '2': // 勾选
|
|
461
|
-
data = this.getSelectRows()
|
|
462
|
-
if (!data || data.length == 0) return message.error('勾选行数据为空!')
|
|
463
|
-
break
|
|
464
|
-
case '3': // 全部数据
|
|
465
|
-
this.exportExcelAll(columns, name)
|
|
466
|
-
break
|
|
467
|
-
default:
|
|
468
|
-
data = this.table.data
|
|
469
|
-
break
|
|
470
|
-
}
|
|
471
|
-
if (selectData != '3') {
|
|
472
|
-
exportExcel({
|
|
473
|
-
data: data,
|
|
474
|
-
name: name,
|
|
475
|
-
columns: columns,
|
|
476
|
-
option: {align: this.$table ? this.$table.align : 'center'}
|
|
477
|
-
})
|
|
478
|
-
}
|
|
479
|
-
cancelEvent()
|
|
480
|
-
}, /**
|
|
481
|
-
* 全部数据导出
|
|
482
|
-
* @param fields 自定义导出字段
|
|
483
|
-
* @param name 文件名
|
|
484
|
-
*/
|
|
485
|
-
exportExcelAll(columns, name) {
|
|
486
|
-
let params = this.getParams();
|
|
487
|
-
params.enablePage = false;
|
|
488
|
-
if (this.tableConfig.definitionSql == 2) {
|
|
489
|
-
params.pageNumber = 1;
|
|
490
|
-
params.pageSize = 50000;
|
|
491
|
-
}
|
|
492
|
-
let url = this.tableConfig.definitionSql == 2 ? this.tableConfig.api : '/online/crud/query';
|
|
493
|
-
let method = this.tableConfig.definitionSql == 2 ? (this.tableConfig.requestType == '1' ? 'post' : 'get') : 'post'
|
|
494
|
-
request(this.http, {
|
|
495
|
-
url: url, method: method, data: params, timeout: 1000 * 90 * 90
|
|
496
|
-
}, false, false).then(({data}) => {
|
|
497
|
-
let respData = (data instanceof Array) ? data : data.listData;
|
|
498
|
-
exportExcel({
|
|
499
|
-
data: respData,
|
|
500
|
-
name: name,
|
|
501
|
-
columns: columns,
|
|
502
|
-
option: {align: this.$table ? this.$table.align : 'center'}
|
|
503
|
-
})
|
|
504
|
-
})
|
|
505
|
-
}, /**
|
|
506
|
-
* 内置确认框
|
|
507
|
-
* @param content
|
|
508
|
-
* @param title
|
|
509
|
-
* @param status
|
|
510
|
-
* @returns {Promise<"model"|"mask"|"close"|"confirm"|"cancel"|"exit"|"exist">}
|
|
511
|
-
*/
|
|
512
|
-
async confirm(content, title, status) {
|
|
513
|
-
return await VXETable.modal.confirm({
|
|
514
|
-
content: content, title: title, status: status
|
|
515
|
-
})
|
|
516
|
-
}, /**
|
|
517
|
-
* 内置调用方法
|
|
518
|
-
* @param m
|
|
519
|
-
* @param v
|
|
520
|
-
* @param d
|
|
521
|
-
*/
|
|
522
|
-
emits({m, v, d, js}) {
|
|
523
|
-
if (js) {
|
|
524
|
-
eval(js)
|
|
525
|
-
} else if (m && this[m]) {
|
|
526
|
-
this[m](v);
|
|
527
|
-
}
|
|
528
|
-
if (d != false) {
|
|
529
|
-
this.customUrl = undefined;
|
|
530
|
-
}
|
|
531
|
-
}, /**
|
|
532
|
-
* 设置工具栏 but
|
|
533
|
-
* @param code 编码
|
|
534
|
-
* @param key 要设置的key
|
|
535
|
-
* @param value 要设置的value
|
|
536
|
-
*/
|
|
537
|
-
setToolBtn(code, key, value) {
|
|
538
|
-
for (let toolBtn of this.toolBtn) {
|
|
539
|
-
if (toolBtn.code == code) {
|
|
540
|
-
toolBtn[key] = value;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
}, /**
|
|
544
|
-
* 设置操作按钮 but
|
|
545
|
-
* @param code 编码
|
|
546
|
-
* @param key 要设置的key
|
|
547
|
-
* @param value 要设置的value
|
|
548
|
-
*/
|
|
549
|
-
setOperationBtn(code, key, value) {
|
|
550
|
-
for (let toolBtn of this.operationBtn) {
|
|
551
|
-
if (toolBtn.code == code) {
|
|
552
|
-
toolBtn[key] = value;
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
},
|
|
556
|
-
/**
|
|
557
|
-
* 获取修改数据(包括未修改数据)
|
|
558
|
-
*/
|
|
559
|
-
getUpdateRecords() {
|
|
560
|
-
if (this.$table) {
|
|
561
|
-
return this.$table.getUpdateRecords()
|
|
562
|
-
}
|
|
563
|
-
},
|
|
564
|
-
/**
|
|
565
|
-
* 批量保存
|
|
566
|
-
*/
|
|
567
|
-
async batchSave(code, content, rows, foreignKey, foreignKeyValue) {
|
|
568
|
-
if (content) {
|
|
569
|
-
let type = await VXETable.modal.confirm({
|
|
570
|
-
content: content, title: '提示', status: 'warning'
|
|
571
|
-
})
|
|
572
|
-
if (type == "cancel") {
|
|
573
|
-
return
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
if (rows.length == 0) {
|
|
577
|
-
VXETable.modal.message({
|
|
578
|
-
content: "请选数据!", title: '提示', status: 'error'
|
|
579
|
-
})
|
|
580
|
-
return
|
|
581
|
-
}
|
|
582
|
-
let list = [];
|
|
583
|
-
let updateList = [];
|
|
584
|
-
let dataSource = this.table.dataSource;
|
|
585
|
-
this.formMainList.edit.formMain.updateKey = this.formMainList.edit.formMain.updateKey.trim();
|
|
586
|
-
const srcMap = new Map(dataSource.map(item => [item[this.formMainList.edit.formMain.updateKey], item]));
|
|
587
|
-
for (const row of rows) {
|
|
588
|
-
let rowId = row[this.formMainList.edit.formMain.updateKey];
|
|
589
|
-
if (rowId) {
|
|
590
|
-
updateList.push({
|
|
591
|
-
columnAndValueMap: this.getDifferingProperties(row, srcMap.get(row[this.formMainList.edit.formMain.updateKey])),//更新字段
|
|
592
|
-
whereMap: this.doGetWhereMap(row, this.formMainList.edit.formMain.updateKey),//更新条件
|
|
593
|
-
});
|
|
594
|
-
continue
|
|
595
|
-
}
|
|
596
|
-
let columnTableUpdateValue = this.getColumnTableUpdateValue(this.table.columns,row);
|
|
597
|
-
columnTableUpdateValue[foreignKey] = foreignKeyValue?foreignKeyValue:this.mainId
|
|
598
|
-
list.push(columnTableUpdateValue);
|
|
599
|
-
}
|
|
600
|
-
if (updateList && updateList.length >= 1) {
|
|
601
|
-
console.log('updateList:', updateList)
|
|
602
|
-
this.doPostAes(code, '/online/crudAes/batchModify', {
|
|
603
|
-
dbName: this.tableConfig.dbName,
|
|
604
|
-
tableName: this.tableConfig.mainTable,
|
|
605
|
-
updateList
|
|
606
|
-
})
|
|
607
|
-
}
|
|
608
|
-
if (list && list.length >= 1) {
|
|
609
|
-
this.doPostAes(code, '/online/crudAes/batchSave', {
|
|
610
|
-
dbName: this.tableConfig.dbName,
|
|
611
|
-
tableName: this.tableConfig.mainTable,
|
|
612
|
-
tableConfigId: this.tableConfig.tableConfigId,
|
|
613
|
-
columnAndValueListMap: list,
|
|
614
|
-
genIdMap: {[this.formMainList.edit.formMain.updateKey]: 'uuid'}
|
|
615
|
-
})
|
|
616
|
-
}
|
|
617
|
-
},
|
|
618
|
-
/**
|
|
619
|
-
* 保存修改
|
|
620
|
-
*/
|
|
621
|
-
async saveUpdate(code, content) {
|
|
622
|
-
let dataSource = this.table.dataSource;
|
|
623
|
-
const srcMap = new Map(dataSource.map(item => [item[this.formMainList.edit.formMain.updateKey], item]));
|
|
624
|
-
let rows = []
|
|
625
|
-
for (const row of this.getUpdateRecords()) {
|
|
626
|
-
let src = srcMap.get(row[this.formMainList.edit.formMain.updateKey]);
|
|
627
|
-
rows.push(this.getDifferingProperties(row, src));
|
|
628
|
-
}
|
|
629
|
-
// console.log('saveUpdate:',rows)
|
|
630
|
-
if (content) {
|
|
631
|
-
let type = await VXETable.modal.confirm({
|
|
632
|
-
content: content, title: '提示', status: 'warning'
|
|
633
|
-
})
|
|
634
|
-
if (type == "cancel") {
|
|
635
|
-
return
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
if (rows.length == 0) {
|
|
639
|
-
VXETable.modal.message({
|
|
640
|
-
content: "请选数据!", title: '提示', status: 'error'
|
|
641
|
-
})
|
|
642
|
-
return
|
|
643
|
-
}
|
|
644
|
-
let list = [];
|
|
645
|
-
for (const row of this.getUpdateRecords()) {
|
|
646
|
-
list.push({
|
|
647
|
-
columnAndValueMap: this.getDifferingProperties(row, srcMap.get(row[this.formMainList.edit.formMain.updateKey])),//更新字段
|
|
648
|
-
whereMap: this.doGetWhereMap(row, this.formMainList.edit.formMain.updateKey),//更新条件
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
this.doPostAes(code, '/online/crudAes/batchModify', {
|
|
652
|
-
dbName: this.tableConfig.dbName,
|
|
653
|
-
tableName: this.tableConfig.mainTable,
|
|
654
|
-
list
|
|
655
|
-
})
|
|
656
|
-
// this.doBatchModify('batchModify', "age", this.formMainList.edit.formMain.updateKey, "确认修改编辑数据吗?", this.getUpdateRecords())
|
|
657
|
-
},
|
|
658
|
-
/**
|
|
659
|
-
* 获取新增数据
|
|
660
|
-
*/
|
|
661
|
-
getInsertEvent() {
|
|
662
|
-
if (this.$table) {
|
|
663
|
-
return this.$table.getInsertRecords()
|
|
664
|
-
}
|
|
665
|
-
},
|
|
666
|
-
/**
|
|
667
|
-
* 获取删除数据
|
|
668
|
-
* @returns {*}
|
|
669
|
-
*/
|
|
670
|
-
getRemoveEvent() {
|
|
671
|
-
if (this.$table) {
|
|
672
|
-
return this.$table.getRemoveRecords()
|
|
673
|
-
}
|
|
674
|
-
},
|
|
675
|
-
/**
|
|
676
|
-
* 获取选中
|
|
677
|
-
* @returns {*|*[]|*[]}
|
|
678
|
-
*/
|
|
679
|
-
getSelectRows() {
|
|
680
|
-
if (this.selectBox == 1) {
|
|
681
|
-
return this.$table.getRadioRecord() ? [this.$table.getRadioRecord()] : []
|
|
682
|
-
} else if (this.selectBox == 2) {
|
|
683
|
-
return this.$table.getCheckboxRecords(true)
|
|
684
|
-
}
|
|
685
|
-
}, updateColumn(rows) {
|
|
686
|
-
this.table['show-footer'] = false;
|
|
687
|
-
if (rows && rows instanceof Array) {
|
|
688
|
-
for (let o of this.table.columns) {
|
|
689
|
-
for (let row of rows) {
|
|
690
|
-
if (row.id == o.id) {
|
|
691
|
-
for (let key of Object.keys(row)) {
|
|
692
|
-
o[key] = row[key];
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
this.setColumnHide(o);
|
|
697
|
-
this.setFixed(o);
|
|
698
|
-
this.setShowFooter(o);
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
let data = this.table.columns.sort((a, b) => {
|
|
702
|
-
return a.sort - b.sort;
|
|
703
|
-
})
|
|
704
|
-
this.doGroupAndCompute()
|
|
705
|
-
this.$table.reloadColumn(data)
|
|
706
|
-
}, doGroupAndCompute(dataSource) {
|
|
707
|
-
if (dataSource) {
|
|
708
|
-
this.table.dataSource = JSON.parse(JSON.stringify(dataSource));
|
|
709
|
-
}
|
|
710
|
-
if (this.tableConfig.paging != 2) {
|
|
711
|
-
if (dataSource != undefined) {
|
|
712
|
-
this.table.data = dataSource;
|
|
713
|
-
}
|
|
714
|
-
return
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
let groupKey = [];
|
|
718
|
-
let comValue = [];
|
|
719
|
-
for (let column of this.table.columns) {
|
|
720
|
-
if (column.visible && column.groupToOtherProp == 1) {
|
|
721
|
-
groupKey.push(column.field)
|
|
722
|
-
}
|
|
723
|
-
if (column.groupTotalToOtherProp) {
|
|
724
|
-
comValue.push(column.field + ":" + column.groupTotalToOtherProp)
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
if (dataSource == undefined) {
|
|
728
|
-
dataSource = this.table.dataSource;
|
|
729
|
-
}
|
|
730
|
-
if (groupKey.length != 0 & comValue.length != 0) {
|
|
731
|
-
dataSource = groupAndCompute(groupKey, comValue, dataSource)
|
|
732
|
-
}
|
|
733
|
-
this.table.data = dataSource;
|
|
734
|
-
this.$table.reloadData(this.table.data)
|
|
735
|
-
},
|
|
736
|
-
getDifferingProperties(tar, src) {
|
|
737
|
-
const differingProperties = {};
|
|
738
|
-
// 假设两个对象都有相同的属性
|
|
739
|
-
for (const key in tar) {
|
|
740
|
-
if (tar.hasOwnProperty(key) && src.hasOwnProperty(key)) {
|
|
741
|
-
if (tar[key] !== src[key]) {
|
|
742
|
-
differingProperties[key] = tar[key]; // 可以选择返回obj2的值,或创建一个数组存放两个值
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
return differingProperties;
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
}
|