imatrix-ui 0.2.42-up → 0.2.44-test
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/lib/super-ui.css +1 -1
- package/lib/super-ui.js +14777 -14716
- package/lib/super-ui.umd.cjs +76 -76
- package/package.json +1 -1
- package/packages/IntervalSelection/src/sectionDate.vue +16 -16
- package/packages/department-tree/src/department-tree.vue +3 -0
- package/packages/super-grid/src/dynamic-input.vue +4 -3
- package/packages/super-grid/src/normal-column.vue +7 -2
- package/packages/super-grid/src/super-grid.vue +79 -2
- package/src/styles/theme/dark-blue/dialog.scss +1 -5
- package/src/utils/range-selector.js +19 -3
- package/src/utils/util.js +236 -68
- package/src/views/dsc-component/tabs/tab-content.vue +13 -1
package/package.json
CHANGED
|
@@ -275,9 +275,14 @@ export default {
|
|
|
275
275
|
// 填充默认值
|
|
276
276
|
setTimeScope() {
|
|
277
277
|
const dataOptions = this.colFieldSetting.options
|
|
278
|
+
let myDefaultValue = dataOptions.defaultValueSetting ? dataOptions.defaultValueSetting.paramValue : null
|
|
279
|
+
if (myDefaultValue === undefined || myDefaultValue === null || myDefaultValue === '') {
|
|
280
|
+
myDefaultValue = dataOptions.defaultValue
|
|
281
|
+
}
|
|
278
282
|
const defaultValueMap = getDateRangeSelectorDefaultValue(
|
|
279
283
|
dataOptions.stareScopeTimeType,
|
|
280
|
-
dataOptions.format
|
|
284
|
+
dataOptions.format,
|
|
285
|
+
myDefaultValue
|
|
281
286
|
)
|
|
282
287
|
if (defaultValueMap) {
|
|
283
288
|
const startTimeTemp = defaultValueMap.startTimeTemp
|
|
@@ -286,45 +291,40 @@ export default {
|
|
|
286
291
|
const myEndDate = defaultValueMap.endDate
|
|
287
292
|
if (
|
|
288
293
|
dataOptions.showType === 'year' &&
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
dataOptions.stareScopeTimeType !== undefined
|
|
294
|
+
startTimeTemp &&
|
|
295
|
+
endTimeTemp
|
|
292
296
|
) {
|
|
293
297
|
// 年范围选择器
|
|
294
298
|
this.yearStartDate = startTimeTemp
|
|
295
299
|
this.yearDate = endTimeTemp
|
|
296
300
|
} else if (
|
|
297
301
|
dataOptions.showType === 'quarterScope' &&
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
dataOptions.stareScopeTimeType !== undefined
|
|
302
|
+
startTimeTemp &&
|
|
303
|
+
endTimeTemp
|
|
301
304
|
) {
|
|
302
305
|
// 季度范围选择器
|
|
303
306
|
this.ScopeStartDate = startTimeTemp
|
|
304
307
|
this.ScopeEndDate = endTimeTemp
|
|
305
308
|
} else if (
|
|
306
309
|
dataOptions.showType === 'week' &&
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
dataOptions.stareScopeTimeType !== undefined
|
|
310
|
+
startTimeTemp &&
|
|
311
|
+
endTimeTemp
|
|
310
312
|
) {
|
|
311
313
|
// 周范围选择器
|
|
312
314
|
this.weekStareDate = startTimeTemp
|
|
313
315
|
this.weekDate = endTimeTemp
|
|
314
316
|
} else if (
|
|
315
317
|
dataOptions.showType === 'monthrange' &&
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
dataOptions.stareScopeTimeType !== undefined
|
|
318
|
+
startTimeTemp &&
|
|
319
|
+
endTimeTemp
|
|
319
320
|
) {
|
|
320
321
|
// 月份范围选择器
|
|
321
322
|
this.monthStareDate = startTimeTemp
|
|
322
323
|
this.monthDate = endTimeTemp
|
|
323
324
|
} else if (
|
|
324
325
|
dataOptions.showType === 'daterange' &&
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
dataOptions.stareScopeTimeType !== undefined
|
|
326
|
+
startTimeTemp &&
|
|
327
|
+
endTimeTemp
|
|
328
328
|
) {
|
|
329
329
|
// 日期范围选择器
|
|
330
330
|
this.datStareDate = [startTimeTemp, endTimeTemp]
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
:row-index="position?position.row:null"
|
|
14
14
|
:select-options="options"
|
|
15
15
|
:value="innerValue"
|
|
16
|
+
:additional-param-map="additionalParamMap"
|
|
16
17
|
@change="cellEvent('change',$event)"
|
|
17
18
|
@input="cellEvent('input',$event)"
|
|
18
19
|
/>
|
|
@@ -424,7 +425,7 @@ import dynamicSourceSelect from '../../dynamic-source-select/src/dynamic-source-
|
|
|
424
425
|
import {getEntityFieldValue, setEntityFieldValue} from '../../../src/utils/util'
|
|
425
426
|
import {getToken} from '../../../src/utils/auth'
|
|
426
427
|
import apis from './apis'
|
|
427
|
-
import ViewImageDialog from './view-image-dialog
|
|
428
|
+
import ViewImageDialog from './view-image-dialog'
|
|
428
429
|
import {$emit} from '../../utils/gogocodeTransfer'
|
|
429
430
|
|
|
430
431
|
export default {
|
|
@@ -880,8 +881,8 @@ export default {
|
|
|
880
881
|
if (eventName === 'clear') {
|
|
881
882
|
if ((this.type === 'multiselect' || this.type === 'select') && isDynamicDataSourceSource(this.column)) {
|
|
882
883
|
for (let index = 0; index < this.valueSetOptions.length; index++) {
|
|
883
|
-
if (this.column.prop !== this.valueSetOptions[
|
|
884
|
-
|
|
884
|
+
if (this.column.prop !== this.valueSetOptions[index].valueColumn.dbColumnName) {
|
|
885
|
+
this.setCellValue(this.valueSetOptions[index].valueColumn.dbColumnName, null, 'input')
|
|
885
886
|
}
|
|
886
887
|
}
|
|
887
888
|
}
|
|
@@ -137,6 +137,7 @@
|
|
|
137
137
|
:select-options="column.valueSet"
|
|
138
138
|
:show-value="$escapeHtml(getLabel(scope.row, scope.$index))"
|
|
139
139
|
:value="getCellValue(scope.row)"
|
|
140
|
+
:additional-param-map="additionalParamMap"
|
|
140
141
|
/>
|
|
141
142
|
</span>
|
|
142
143
|
<!-- 自定义格式的时候 -->
|
|
@@ -171,6 +172,7 @@
|
|
|
171
172
|
$escapeHtml(getLabel(pageGridData[scope.$index], scope.$index))
|
|
172
173
|
"
|
|
173
174
|
:value="getCellValue(pageGridData[scope.$index])"
|
|
175
|
+
:additional-param-map="additionalParamMap"
|
|
174
176
|
/></span>
|
|
175
177
|
<span
|
|
176
178
|
v-else-if="
|
|
@@ -457,7 +459,8 @@ import {
|
|
|
457
459
|
getFileList,
|
|
458
460
|
isDynamicDataSourceSource,
|
|
459
461
|
isHasEditOption,
|
|
460
|
-
isRequiredEdit
|
|
462
|
+
isRequiredEdit,
|
|
463
|
+
getAdditionalParamMap
|
|
461
464
|
} from './utils'
|
|
462
465
|
import DynamicInput from './dynamic-input.vue'
|
|
463
466
|
import store from './store'
|
|
@@ -547,6 +550,7 @@ export default {
|
|
|
547
550
|
) {
|
|
548
551
|
parentFormData = gridParams.options.extraParam.entityMap
|
|
549
552
|
}
|
|
553
|
+
const additionalParamMap = getAdditionalParamMap(gridParams)
|
|
550
554
|
return {
|
|
551
555
|
selectRow: null,
|
|
552
556
|
that: this,
|
|
@@ -569,6 +573,7 @@ export default {
|
|
|
569
573
|
showRichEditorViewer: false,
|
|
570
574
|
getFormData: gridParams.options.getFormData,
|
|
571
575
|
getTableGridData: gridParams.options.getGridData,
|
|
576
|
+
additionalParamMap
|
|
572
577
|
}
|
|
573
578
|
},
|
|
574
579
|
computed: {
|
|
@@ -1060,7 +1065,7 @@ export default {
|
|
|
1060
1065
|
this.column,
|
|
1061
1066
|
row,
|
|
1062
1067
|
this.isSql,
|
|
1063
|
-
|
|
1068
|
+
this.additionalParamMap,
|
|
1064
1069
|
gridParams.contextParameter,
|
|
1065
1070
|
tableName,
|
|
1066
1071
|
this.listCode
|
|
@@ -60,8 +60,9 @@
|
|
|
60
60
|
class="elTable"
|
|
61
61
|
:tree-props="getTreeProps(parentProp, isSql, isLazy, dataSourceType)"
|
|
62
62
|
@sort-change="handleSortChange"
|
|
63
|
-
@select="
|
|
64
|
-
@select-all="
|
|
63
|
+
@select="selectRecord"
|
|
64
|
+
@select-all="selectAllRecord"
|
|
65
|
+
@selection-change="selectionChangeEvent"
|
|
65
66
|
@row-click="rowClickEvent"
|
|
66
67
|
@row-dblclick="rowDblclickEvent"
|
|
67
68
|
@expand-change="expandChange"
|
|
@@ -657,6 +658,7 @@ export default {
|
|
|
657
658
|
handler(newValue, oldValue) {
|
|
658
659
|
console.log('watch====options.extraParam.entityMap===改变==', newValue)
|
|
659
660
|
this.parentFormData = newValue
|
|
661
|
+
this.$emit('change-form-data', this.parentFormData)
|
|
660
662
|
}
|
|
661
663
|
}
|
|
662
664
|
},
|
|
@@ -2918,6 +2920,81 @@ export default {
|
|
|
2918
2920
|
store.set(this.code, gridParams)
|
|
2919
2921
|
this['subTableData'] = data
|
|
2920
2922
|
},
|
|
2923
|
+
// 选择记录
|
|
2924
|
+
selectRecord(selection, row){
|
|
2925
|
+
let selectRecordEventResult = true
|
|
2926
|
+
const gridParams = store.get(this.code)
|
|
2927
|
+
if (isHasOptionFunction('selectRecord', this.code)) {
|
|
2928
|
+
selectRecordEventResult = gridParams.options.selectRecord.call(this, {
|
|
2929
|
+
gridData: this.isSubTableShowPage
|
|
2930
|
+
? this.subTableData
|
|
2931
|
+
: this.gridData,
|
|
2932
|
+
columns: gridParams.columns,
|
|
2933
|
+
superGrid: this.$refs.superGrid,
|
|
2934
|
+
pageGridData: this.isSubTableShowPage
|
|
2935
|
+
? this.gridData
|
|
2936
|
+
: null,
|
|
2937
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
2938
|
+
selection: selection,
|
|
2939
|
+
row: row,
|
|
2940
|
+
parentFormData: this.parentFormData
|
|
2941
|
+
})
|
|
2942
|
+
if(selectRecordEventResult !== undefined && selectRecordEventResult=== false){
|
|
2943
|
+
// 最后选中的记录取消选中状态
|
|
2944
|
+
this.$refs.superGrid.toggleRowSelection(row, false)
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
this.select(selection, row)
|
|
2948
|
+
},
|
|
2949
|
+
// 取消选择记录
|
|
2950
|
+
selectAllRecord(selection){
|
|
2951
|
+
let selectAllRecordsEventResult = true
|
|
2952
|
+
const gridParams = store.get(this.code)
|
|
2953
|
+
if (isHasOptionFunction('selectAllRecords', this.code)) {
|
|
2954
|
+
selectAllRecordsEventResult = gridParams.options.selectAllRecords.call(this, {
|
|
2955
|
+
gridData: this.isSubTableShowPage
|
|
2956
|
+
? this.subTableData
|
|
2957
|
+
: this.gridData,
|
|
2958
|
+
columns: gridParams.columns,
|
|
2959
|
+
superGrid: this.$refs.superGrid,
|
|
2960
|
+
pageGridData: this.isSubTableShowPage
|
|
2961
|
+
? this.gridData
|
|
2962
|
+
: null,
|
|
2963
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
2964
|
+
selection: selection,
|
|
2965
|
+
parentFormData: this.parentFormData
|
|
2966
|
+
})
|
|
2967
|
+
if(selectAllRecordsEventResult !== undefined && selectAllRecordsEventResult=== false){
|
|
2968
|
+
// 取消所有记录选中状态
|
|
2969
|
+
this.$refs.superGrid.toggleAllSelection()
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
this.selectAll(selection)
|
|
2973
|
+
},
|
|
2974
|
+
// 选择记录发生改变时
|
|
2975
|
+
selectionChangeEvent(newSelection){
|
|
2976
|
+
const gridParams = store.get(this.code)
|
|
2977
|
+
if (isHasOptionFunction('selectionChange', this.code)) {
|
|
2978
|
+
gridParams.options.selectionChange.call(this, {
|
|
2979
|
+
gridData: this.isSubTableShowPage
|
|
2980
|
+
? this.subTableData
|
|
2981
|
+
: this.gridData,
|
|
2982
|
+
columns: gridParams.columns,
|
|
2983
|
+
superGrid: this.$refs.superGrid,
|
|
2984
|
+
pageGridData: this.isSubTableShowPage
|
|
2985
|
+
? this.gridData
|
|
2986
|
+
: null,
|
|
2987
|
+
additionalParamMap: gridParams.additionalParamMap,
|
|
2988
|
+
selection: newSelection,
|
|
2989
|
+
parentFormData: this.parentFormData
|
|
2990
|
+
})
|
|
2991
|
+
// if(selectionChangeEventResult !== undefined && selectionChangeEventResult=== false){
|
|
2992
|
+
// // 最后选中的记录取消选中状态
|
|
2993
|
+
// this.$refs.superGrid.toggleRowSelection(newSelection[newSelection.length - 1], false)
|
|
2994
|
+
// }
|
|
2995
|
+
}
|
|
2996
|
+
this.selectionChange(newSelection)
|
|
2997
|
+
},
|
|
2921
2998
|
},
|
|
2922
2999
|
emits: [
|
|
2923
3000
|
'change-grid-data',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {getLastNDate} from './util'
|
|
1
2
|
export function getFirstDayOfSeason(date) {
|
|
2
3
|
var month = new Date(date).getMonth()
|
|
3
4
|
if (month < 3) {
|
|
@@ -31,7 +32,12 @@ function formatDate(time) {
|
|
|
31
32
|
|
|
32
33
|
export function formatTimefn(format, dateTime) {
|
|
33
34
|
if (format === undefined || format === null || format === '') {
|
|
34
|
-
|
|
35
|
+
let val = dateTime
|
|
36
|
+
// if(typeof dateTime === 'number') {
|
|
37
|
+
// // 表示是毫秒值
|
|
38
|
+
// val = new Date(dateTime)
|
|
39
|
+
// }
|
|
40
|
+
return val
|
|
35
41
|
}
|
|
36
42
|
const nowTime = new Date(dateTime)
|
|
37
43
|
const year = nowTime.getFullYear()
|
|
@@ -95,9 +101,9 @@ export function formatTimefn(format, dateTime) {
|
|
|
95
101
|
return format
|
|
96
102
|
}
|
|
97
103
|
|
|
98
|
-
export function getDateRangeSelectorDefaultValue(stareScopeTimeType, format) {
|
|
104
|
+
export function getDateRangeSelectorDefaultValue(stareScopeTimeType, format, defaultValueSetting) {
|
|
99
105
|
let Staretime = ''
|
|
100
|
-
|
|
106
|
+
let endTime = new Date()
|
|
101
107
|
const computeTime = new Date()
|
|
102
108
|
if (stareScopeTimeType === 'oneYear') {
|
|
103
109
|
// 近一年
|
|
@@ -177,6 +183,16 @@ export function getDateRangeSelectorDefaultValue(stareScopeTimeType, format) {
|
|
|
177
183
|
// 近三周
|
|
178
184
|
const MondayTime = getWeekOfSeason(computeTime)
|
|
179
185
|
Staretime = new Date(MondayTime - 14 * 24 * 60 * 60 * 1000)
|
|
186
|
+
} else {
|
|
187
|
+
if (defaultValueSetting && defaultValueSetting.includes('${context.')) {
|
|
188
|
+
defaultValueSetting = defaultValueSetting.replace('${context.', '').replace('}', '')
|
|
189
|
+
const dates = getLastNDate(defaultValueSetting)
|
|
190
|
+
if(dates && Array.isArray(dates)) {
|
|
191
|
+
// 表示是区间范围组件需要的值
|
|
192
|
+
Staretime = dates[0]
|
|
193
|
+
endTime = dates[1]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
180
196
|
}
|
|
181
197
|
if (Staretime) {
|
|
182
198
|
const startTimeTemp = new Date(Staretime).getTime()
|
package/src/utils/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import i18n from '../i18n/i18n'
|
|
2
|
-
import {executeExpression} from './calculator/calculator-util'
|
|
3
|
-
import {getLangByShort} from './common-util'
|
|
2
|
+
import { executeExpression } from './calculator/calculator-util'
|
|
3
|
+
import { getLangByShort } from './common-util'
|
|
4
4
|
|
|
5
5
|
export function getI18n() {
|
|
6
6
|
if (!window.$locale) {
|
|
@@ -89,69 +89,69 @@ export function findDynamicDataSourceByCode(
|
|
|
89
89
|
searchParam
|
|
90
90
|
) {
|
|
91
91
|
let watchAttrValue
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
parentEntity = searchParam.parent
|
|
102
|
-
listCode = searchParam._listCode
|
|
103
|
-
formCode = searchParam._formCode
|
|
104
|
-
tableName = searchParam._tableName
|
|
105
|
-
}
|
|
106
|
-
const params = {
|
|
107
|
-
searchText,
|
|
108
|
-
watchAttrValue,
|
|
109
|
-
parent: parentEntity
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
if (additionalParameterStr && typeof (additionalParameterStr) === 'object') {
|
|
113
|
-
params.additionalParamMap = additionalParameterStr
|
|
114
|
-
} else if (additionalParameterStr && typeof (additionalParameterStr) === 'string') {
|
|
115
|
-
params.additionalParamMap = JSON.parse(additionalParameterStr)
|
|
116
|
-
}
|
|
117
|
-
if (params.additionalParamMap === undefined) {
|
|
118
|
-
params.additionalParamMap = {}
|
|
119
|
-
}
|
|
120
|
-
if (listCode) {
|
|
121
|
-
params.additionalParamMap._listCode = listCode
|
|
122
|
-
}
|
|
123
|
-
if (formCode) {
|
|
124
|
-
params.additionalParamMap._formCode = formCode
|
|
125
|
-
}
|
|
126
|
-
if (tableName) {
|
|
127
|
-
params.additionalParamMap._tableName = tableName
|
|
128
|
-
}
|
|
129
|
-
if (entity && entity !== null) {
|
|
130
|
-
params.entity = entity
|
|
131
|
-
}
|
|
132
|
-
const backendUrl = window.$vueApp.config.globalProperties.baseURL
|
|
133
|
-
|
|
134
|
-
return new Promise((resolve, reject) => {
|
|
135
|
-
// 页面设计不请求动态数据源
|
|
136
|
-
if (window.$vueApp.config.globalProperties.systemCode !== undefined && window.$vueApp.config.globalProperties.systemCode === 'iMatrix') {
|
|
137
|
-
resolve()
|
|
138
|
-
} else {
|
|
139
|
-
window.$vueApp.config.globalProperties.$http.post(backendUrl + '/common/dynamic-data-source/' + dynamicSourceCode, params).then(result => {
|
|
140
|
-
if (result.backendUrl) {
|
|
141
|
-
// result.backendUrl表示需要使用动态数据源所属的系统路径重新获得一次数据
|
|
142
|
-
window.$vueApp.config.globalProperties.$http.post(result.backendUrl + '/common/dynamic-data-source/' + dynamicSourceCode, params).then(finallyResult => {
|
|
143
|
-
resolve(finallyResult)
|
|
144
|
-
}).catch(error => {
|
|
145
|
-
reject(error)
|
|
146
|
-
})
|
|
147
|
-
} else {
|
|
148
|
-
resolve(result)
|
|
92
|
+
let parentEntity
|
|
93
|
+
let listCode
|
|
94
|
+
let formCode
|
|
95
|
+
let tableName
|
|
96
|
+
if (searchParam) {
|
|
97
|
+
watchAttrValue = searchParam.watchAttrValue
|
|
98
|
+
if (watchAttrValue === undefined || watchAttrValue === null) {
|
|
99
|
+
watchAttrValue = ''
|
|
149
100
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
101
|
+
parentEntity = searchParam.parent
|
|
102
|
+
listCode = searchParam._listCode
|
|
103
|
+
formCode = searchParam._formCode
|
|
104
|
+
tableName = searchParam._tableName
|
|
105
|
+
}
|
|
106
|
+
const params = {
|
|
107
|
+
searchText,
|
|
108
|
+
watchAttrValue,
|
|
109
|
+
parent: parentEntity
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
if (additionalParameterStr && typeof (additionalParameterStr) === 'object') {
|
|
113
|
+
params.additionalParamMap = additionalParameterStr
|
|
114
|
+
} else if (additionalParameterStr && typeof (additionalParameterStr) === 'string') {
|
|
115
|
+
params.additionalParamMap = JSON.parse(additionalParameterStr)
|
|
116
|
+
}
|
|
117
|
+
if (params.additionalParamMap === undefined) {
|
|
118
|
+
params.additionalParamMap = {}
|
|
119
|
+
}
|
|
120
|
+
if (listCode) {
|
|
121
|
+
params.additionalParamMap._listCode = listCode
|
|
122
|
+
}
|
|
123
|
+
if (formCode) {
|
|
124
|
+
params.additionalParamMap._formCode = formCode
|
|
153
125
|
}
|
|
154
|
-
|
|
126
|
+
if (tableName) {
|
|
127
|
+
params.additionalParamMap._tableName = tableName
|
|
128
|
+
}
|
|
129
|
+
if (entity && entity !== null) {
|
|
130
|
+
params.entity = entity
|
|
131
|
+
}
|
|
132
|
+
const backendUrl = window.$vueApp.config.globalProperties.baseURL
|
|
133
|
+
|
|
134
|
+
return new Promise((resolve, reject) => {
|
|
135
|
+
// 页面设计不请求动态数据源
|
|
136
|
+
if (window.$vueApp.config.globalProperties.systemCode !== undefined && window.$vueApp.config.globalProperties.systemCode === 'iMatrix') {
|
|
137
|
+
resolve()
|
|
138
|
+
} else {
|
|
139
|
+
window.$vueApp.config.globalProperties.$http.post(backendUrl + '/common/dynamic-data-source/' + dynamicSourceCode, params).then(result => {
|
|
140
|
+
if (result.backendUrl) {
|
|
141
|
+
// result.backendUrl表示需要使用动态数据源所属的系统路径重新获得一次数据
|
|
142
|
+
window.$vueApp.config.globalProperties.$http.post(result.backendUrl + '/common/dynamic-data-source/' + dynamicSourceCode, params).then(finallyResult => {
|
|
143
|
+
resolve(finallyResult)
|
|
144
|
+
}).catch(error => {
|
|
145
|
+
reject(error)
|
|
146
|
+
})
|
|
147
|
+
} else {
|
|
148
|
+
resolve(result)
|
|
149
|
+
}
|
|
150
|
+
}).catch(error => {
|
|
151
|
+
reject(error)
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
})
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/**
|
|
@@ -434,11 +434,179 @@ function getSubEntityFieldValue(subEntityData, fieldName) {
|
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
function getContextValue(contextParameterMap, propValue) {
|
|
437
|
+
let value = getLastNDate(propValue)
|
|
437
438
|
if (contextParameterMap) {
|
|
438
|
-
|
|
439
|
+
value = contextParameterMap[propValue]
|
|
440
|
+
}
|
|
441
|
+
return value
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* 获得最近n天的开始日期和结束日期集合
|
|
445
|
+
* @param {*} propValue currentTime/currentWeek/currentMonth/currentQuarter/currentYear/lastNDay:n
|
|
446
|
+
* @returns [startDate,endDate],例如:[2024/2/26 00:00:00,2023/3/3 23:59:59]
|
|
447
|
+
*/
|
|
448
|
+
export function getLastNDate(propValue) {
|
|
449
|
+
let value
|
|
450
|
+
if (propValue &&
|
|
451
|
+
propValue === 'currentTime') {
|
|
452
|
+
// 当前时间
|
|
453
|
+
value = new Date()
|
|
454
|
+
}
|
|
455
|
+
if (propValue &&
|
|
456
|
+
propValue === 'currentWeek') {
|
|
457
|
+
// 本周
|
|
458
|
+
value = getCurrentWeek()
|
|
459
|
+
}
|
|
460
|
+
if (propValue &&
|
|
461
|
+
propValue === 'currentMonth') {
|
|
462
|
+
// 本月
|
|
463
|
+
value = getCurrentMonth()
|
|
464
|
+
}
|
|
465
|
+
if (propValue &&
|
|
466
|
+
propValue === 'currentQuarter') {
|
|
467
|
+
// 本季度
|
|
468
|
+
value = getCurrentQuarter()
|
|
469
|
+
}
|
|
470
|
+
if (propValue &&
|
|
471
|
+
propValue === 'currentYear') {
|
|
472
|
+
// 本年
|
|
473
|
+
value = getCurrentYear()
|
|
474
|
+
}
|
|
475
|
+
if (propValue &&
|
|
476
|
+
propValue.indexOf('lastNDay') >= 0) {
|
|
477
|
+
// 最近n天 lastNDay:n,例如:lastNDay:5,表示最近5天
|
|
478
|
+
const n = propValue.substring(propValue.indexOf(':') + 1)
|
|
479
|
+
value = getLastNDay(parseInt(n))
|
|
439
480
|
}
|
|
481
|
+
return value
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* 获得当前周的周一和周日的的日期
|
|
485
|
+
* 例如:[2024/2/26 00:00:00,2023/3/3 23:59:59]
|
|
486
|
+
* @returns
|
|
487
|
+
*/
|
|
488
|
+
function getCurrentWeek() {
|
|
489
|
+
const new_Date = new Date() //获取本周一周日期
|
|
490
|
+
const timesStamp = new_Date.getTime();
|
|
491
|
+
const currenDay = new_Date.getDay();
|
|
492
|
+
// 周一
|
|
493
|
+
const monday = new Date(timesStamp + 24 * 60 * 60 * 1000 * (0 - (currenDay + 6) % 7))
|
|
494
|
+
// 周日
|
|
495
|
+
const sunday = new Date(timesStamp + 24 * 60 * 60 * 1000 * (6 - (currenDay + 6) % 7))
|
|
496
|
+
const startDate = monday.toLocaleDateString() + " " + monday.toLocaleTimeString()
|
|
497
|
+
const endDate = sunday.toLocaleDateString() + " " + sunday.toLocaleTimeString()
|
|
498
|
+
console.log(`getCurrentMonth从 ${startDate} 开始,到 ${endDate} 结束`);
|
|
499
|
+
return [monday, sunday]
|
|
440
500
|
}
|
|
501
|
+
/**
|
|
502
|
+
* 获得当前月第1天和最后1天的日期
|
|
503
|
+
* 例如:[2023/1/1 00:00:00,2023/1/31 23:59:59]
|
|
504
|
+
* @returns [xxx,xxx]
|
|
505
|
+
*/
|
|
506
|
+
function getCurrentMonth() {
|
|
507
|
+
// 创建一个新的Date对象,表示当前时间
|
|
508
|
+
const currentDate = new Date();
|
|
509
|
+
|
|
510
|
+
// 获取当前年份和月份
|
|
511
|
+
const year = currentDate.getFullYear(); // 获取完整的四位年份
|
|
512
|
+
const month = currentDate.getMonth() + 1; // getMonth返回值范围为0-11,因此加上1得到真正的月份
|
|
513
|
+
|
|
514
|
+
// 设置起始日期为本月第一天
|
|
515
|
+
currentDate.setDate(1);
|
|
516
|
+
|
|
517
|
+
// 将起始日期格式化成字符串形式(YYYY-MM-DD)
|
|
518
|
+
const startDateStr = `${year}/${month < 10 ? '0' : ''}${month}/01`;
|
|
519
|
+
|
|
520
|
+
// 设置结束日期为下个月第一天的前一天
|
|
521
|
+
currentDate.setMonth(currentDate.getMonth() + 2);
|
|
522
|
+
currentDate.setDate(0);
|
|
523
|
+
|
|
524
|
+
// 将结束日期格式化成字符串形式(YYYY-MM-DD)
|
|
525
|
+
const endDateStr = `${currentDate.getFullYear()}/${currentDate.getMonth() < 9 ? '0' : ''}${(currentDate.getMonth() + 1)}/01`;
|
|
526
|
+
const startDate11 = new Date(Date.parse(startDateStr))
|
|
527
|
+
const endDate11 = new Date(new Date(Date.parse(endDateStr)).getTime() - 1000)
|
|
528
|
+
const startDate = startDate11.toLocaleDateString() + " " + startDate11.toLocaleTimeString()
|
|
529
|
+
const endDate = endDate11.toLocaleDateString() + " " + endDate11.toLocaleTimeString()
|
|
530
|
+
console.log(`getCurrentMonth从 ${startDate} 开始,到 ${endDate} 结束`);
|
|
531
|
+
return [startDate11, endDate11]
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* 获得当前季度第1天和最后一天的日期
|
|
535
|
+
* 例如:[2023/1/1 00:00:00,2023/3/31 23:59:59]
|
|
536
|
+
* @returns
|
|
537
|
+
*/
|
|
538
|
+
function getCurrentQuarter() {
|
|
539
|
+
const currentDate = new Date();
|
|
540
|
+
const quarterStartIndex = (currentDate.getMonth() + 3) % 12;
|
|
541
|
+
let firstDayOfQuarter; // 存放第一天的Date对象
|
|
542
|
+
if (currentDate.getMonth() < quarterStartIndex + 2) {
|
|
543
|
+
firstDayOfQuarter = new Date(currentDate.getFullYear(), quarterStartIndex, 1);
|
|
544
|
+
} else {
|
|
545
|
+
firstDayOfQuarter = new Date(currentDate.getFullYear() + 1, quarterStartIndex, 1);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
let lastDayOfQuarter; // 存放最后一天的Date对象
|
|
549
|
+
if (firstDayOfQuarter.getMonth() === 11) {
|
|
550
|
+
lastDayOfQuarter = new Date(firstDayOfQuarter.getFullYear() + 1, 0, 0);
|
|
551
|
+
} else {
|
|
552
|
+
lastDayOfQuarter = new Date(firstDayOfQuarter.getFullYear(), firstDayOfQuarter.getMonth() + 3, 0);
|
|
553
|
+
}
|
|
554
|
+
lastDayOfQuarter = new Date(lastDayOfQuarter.getTime() + (24 * 60 * 60 * 1000) - 1000)
|
|
555
|
+
const startDate = firstDayOfQuarter.toLocaleDateString() + " " + firstDayOfQuarter.toLocaleTimeString()
|
|
556
|
+
const endDate = lastDayOfQuarter.toLocaleDateString() + " " + lastDayOfQuarter.toLocaleTimeString()
|
|
557
|
+
console.log(`getCurrentQuarter从 ${startDate} 开始,到 ${endDate} 结束`);
|
|
558
|
+
return [firstDayOfQuarter, lastDayOfQuarter]
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* 获得本年的第1天和最后一天的日期
|
|
562
|
+
* 例如:[2023/1/1 00:00:00,2023/12/31 23:59:59]
|
|
563
|
+
* @returns
|
|
564
|
+
*/
|
|
565
|
+
function getCurrentYear() {
|
|
566
|
+
// 创建一个新的日期对象
|
|
567
|
+
const currentYear = new Date().getFullYear(); // 获取当前年份
|
|
568
|
+
|
|
569
|
+
// 设置为当前年的1月1号(第一天)
|
|
570
|
+
let firstDayOfCurrentYear = new Date(currentYear, 0);
|
|
571
|
+
firstDayOfCurrentYear.setMonth(0, 1); // 将月份设置为0表示1月
|
|
572
|
+
|
|
573
|
+
// 设置为下一年的12月31号(最后一天)
|
|
574
|
+
let lastDayOfCurrentYear = new Date(currentYear + 1, 0);
|
|
575
|
+
lastDayOfCurrentYear = lastDayOfCurrentYear.getTime() - 1000
|
|
576
|
+
lastDayOfCurrentYear = new Date(lastDayOfCurrentYear)
|
|
577
|
+
const startDate = firstDayOfCurrentYear.toLocaleDateString() + " " + firstDayOfCurrentYear.toLocaleTimeString()
|
|
578
|
+
const endDate = lastDayOfCurrentYear.toLocaleDateString() + " " + lastDayOfCurrentYear.toLocaleTimeString()
|
|
579
|
+
console.log(`getCurrentYear从 ${startDate} 开始,到 ${endDate} 结束`);
|
|
580
|
+
return [firstDayOfCurrentYear, lastDayOfCurrentYear]
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* 获得最近n天的日期[n天前,当前日期]。
|
|
584
|
+
* 例如:[2024/2/25 00:00:00,2024/2/29 23:59:59]
|
|
585
|
+
* @param {} n
|
|
586
|
+
*/
|
|
587
|
+
function getLastNDay(n) {
|
|
588
|
+
let currentDate = new Date(); // 创建一个表示今天的Date对象
|
|
589
|
+
let year = currentDate.getFullYear(); // 获取完整的四位年份
|
|
590
|
+
let month = currentDate.getMonth() + 1; // getMonth返回值范围为0-11,因此加上1得到真正的月份
|
|
591
|
+
let date = currentDate.getDate(); // getMonth返回值范围为0-11,因此加上1得到真正的月份
|
|
592
|
+
let startDateStr = `${year}/${month < 10 ? '0' : ''}${month}/${date}`;
|
|
593
|
+
currentDate = new Date(Date.parse(startDateStr))
|
|
594
|
+
currentDate.setDate(currentDate.getDate() + 1)
|
|
595
|
+
currentDate = new Date(currentDate.getTime() - 1000)
|
|
441
596
|
|
|
597
|
+
let lastNDay = new Date(); // 创建一个表示今天的Date对象
|
|
598
|
+
lastNDay.setDate(lastNDay.getDate() - (n - 1));
|
|
599
|
+
const lastNYear = lastNDay.getFullYear(); // 获取完整的四位年份
|
|
600
|
+
const lastNMonth = lastNDay.getMonth() + 1; // getMonth返回值范围为0-11,因此加上1得到真正的月份
|
|
601
|
+
const lastNDate = lastNDay.getDate(); // getMonth返回值范围为0-11,因此加上1得到真正的月份
|
|
602
|
+
const endtDateStr = `${lastNYear}/${lastNMonth < 10 ? '0' : ''}${lastNMonth}/${lastNDate}`;
|
|
603
|
+
lastNDay = new Date(Date.parse(endtDateStr))
|
|
604
|
+
|
|
605
|
+
const startDate = lastNDay.toLocaleDateString() + " " + lastNDay.toLocaleTimeString()
|
|
606
|
+
const endDate = currentDate.toLocaleDateString() + " " + currentDate.toLocaleTimeString()
|
|
607
|
+
console.log(`getLastNDay从 ${startDate} 开始,到 ${endDate} 结束`);
|
|
608
|
+
retur[lastNDay, currentDate]
|
|
609
|
+
}
|
|
442
610
|
export function getPropValue(
|
|
443
611
|
propValue,
|
|
444
612
|
entity,
|
|
@@ -572,11 +740,11 @@ export function setEntityFieldValue(entity, prop, value) {
|
|
|
572
740
|
parentObj[subProp] = value
|
|
573
741
|
}
|
|
574
742
|
}
|
|
575
|
-
|
|
576
|
-
|
|
743
|
+
} else {
|
|
744
|
+
if (entity[prop] === undefined || entity[prop] === null) {
|
|
577
745
|
// 动态对象属性赋值,防止属性不存在,导致属性无法赋值问题
|
|
578
746
|
entity[prop] = value
|
|
579
|
-
|
|
747
|
+
} else {
|
|
580
748
|
// 静态对象属性赋值,提高性能
|
|
581
749
|
entity[prop] = value
|
|
582
750
|
}
|
|
@@ -681,7 +849,7 @@ export function findSystemInfoByCode(systemCode) {
|
|
|
681
849
|
if (!systemCode) {
|
|
682
850
|
systemCode = window.$vueApp.config.globalProperties.systemCode
|
|
683
851
|
}
|
|
684
|
-
|
|
852
|
+
|
|
685
853
|
window.$vueApp.config.globalProperties.$http
|
|
686
854
|
.get(
|
|
687
855
|
window.$vueApp.config.globalProperties.baseAPI +
|