agilebuilder-ui 1.0.90-tmp2 → 1.0.90-tmp21
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 +117 -88
- package/lib/super-ui.umd.cjs +5 -5
- package/package.json +1 -1
- package/packages/fs-upload-list/src/fs-upload-list.vue +2 -2
- package/packages/super-grid/src/apis.js +47 -9
- package/packages/super-grid/src/dynamic-input.vue +12 -17
- package/packages/super-grid/src/formValidatorUtil.js +74 -15
- package/packages/super-grid/src/normal-column-content.vue +24 -21
- package/packages/super-grid/src/normal-column.vue +3 -22
- package/packages/super-grid/src/super-grid-service.js +1 -0
- package/packages/super-grid/src/super-grid.vue +0 -3
- package/packages/super-grid/src/utils.js +2 -2
- package/src/i18n/langs/cn.js +2 -1
- package/src/i18n/langs/en.js +2 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<span>
|
|
3
3
|
<template v-if="!disabled">
|
|
4
4
|
<template v-if="!isMobile">
|
|
5
5
|
<el-input
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
<template v-else>
|
|
121
121
|
<fs-preview :entity="row" :file-set-obj="fileSetObj" :is-sql="isSql" :label="value" />
|
|
122
122
|
</template>
|
|
123
|
-
</
|
|
123
|
+
</span>
|
|
124
124
|
</template>
|
|
125
125
|
|
|
126
126
|
<script>
|
|
@@ -1453,14 +1453,15 @@ const apis = {
|
|
|
1453
1453
|
}
|
|
1454
1454
|
]
|
|
1455
1455
|
*/
|
|
1456
|
-
dynamicControlTableEdit(pageContext, customRules){
|
|
1457
|
-
|
|
1456
|
+
dynamicControlTableEdit(pageContext, customRules, listCode){
|
|
1457
|
+
const gridParams = store.get(listCode)
|
|
1458
|
+
// console.log('dynamicControlTableEdit----customRules-----', customRules, gridParams.options.customRules)
|
|
1458
1459
|
if(!customRules){
|
|
1459
1460
|
return
|
|
1460
1461
|
}
|
|
1461
1462
|
let gridCustomRules = {}
|
|
1462
|
-
if(
|
|
1463
|
-
gridCustomRules = JSON.parse(JSON.stringify(
|
|
1463
|
+
if(gridParams.options.customRules){
|
|
1464
|
+
gridCustomRules = JSON.parse(JSON.stringify(gridParams.options.customRules))
|
|
1464
1465
|
}
|
|
1465
1466
|
customRules.forEach(item=>{
|
|
1466
1467
|
const copyItem = JSON.parse(JSON.stringify(item))
|
|
@@ -1469,10 +1470,11 @@ const apis = {
|
|
|
1469
1470
|
let columnRules
|
|
1470
1471
|
if(!gridCustomRules[prop]){
|
|
1471
1472
|
gridCustomRules[prop] = {}
|
|
1472
|
-
} else {
|
|
1473
|
-
// 获得当前列已有的自定义规则集合
|
|
1474
|
-
columnRules = gridCustomRules[prop].rules
|
|
1475
1473
|
}
|
|
1474
|
+
// console.log('dynamicControlTableEdit----gridCustomRules111-----', gridCustomRules)
|
|
1475
|
+
// 获得当前列已有的自定义规则集合
|
|
1476
|
+
columnRules = gridCustomRules[prop].rules
|
|
1477
|
+
|
|
1476
1478
|
if(copyItem.rules){
|
|
1477
1479
|
if(!columnRules){
|
|
1478
1480
|
columnRules = []
|
|
@@ -1482,9 +1484,45 @@ const apis = {
|
|
|
1482
1484
|
}
|
|
1483
1485
|
// 当前列总的自定义规则更新
|
|
1484
1486
|
copyItem.rules = columnRules
|
|
1485
|
-
this.options.customRules[prop] = copyItem
|
|
1487
|
+
// this.options.customRules[prop] = copyItem
|
|
1488
|
+
if(!gridParams.options.customRules){
|
|
1489
|
+
gridParams.options.customRules = {}
|
|
1490
|
+
}
|
|
1491
|
+
// console.log('dynamicControlTableEdit----gridParams.options.customRules222-----', gridParams.options.customRules)
|
|
1492
|
+
gridParams.options.customRules[prop] = copyItem
|
|
1486
1493
|
})
|
|
1487
|
-
console.log('dynamicControlTableEdit----
|
|
1494
|
+
// console.log('dynamicControlTableEdit----gridParams.options.customRules333-----', gridParams.options.customRules)
|
|
1495
|
+
},
|
|
1496
|
+
doLayout(hiddenColumns, listCode) {
|
|
1497
|
+
if(!listCode){
|
|
1498
|
+
listCode = this.code
|
|
1499
|
+
}
|
|
1500
|
+
const gridParams = store.get(listCode)
|
|
1501
|
+
const orgHiddenColumns = gridParams.hiddenColumns
|
|
1502
|
+
console.log('doLayout----orgHiddenColumns=', orgHiddenColumns)
|
|
1503
|
+
if(hiddenColumns && hiddenColumns.length > 0){
|
|
1504
|
+
let hiddenColumnsResult = orgHiddenColumns
|
|
1505
|
+
if(!hiddenColumnsResult){
|
|
1506
|
+
hiddenColumnsResult = []
|
|
1507
|
+
}
|
|
1508
|
+
if(hiddenColumnsResult.length === 0){
|
|
1509
|
+
hiddenColumnsResult = hiddenColumns
|
|
1510
|
+
} else {
|
|
1511
|
+
hiddenColumns.forEach(prop=>{
|
|
1512
|
+
if(hiddenColumnsResult.indexOf(prop) < 0) {
|
|
1513
|
+
// 去重处理
|
|
1514
|
+
hiddenColumnsResult.push(prop)
|
|
1515
|
+
}
|
|
1516
|
+
})
|
|
1517
|
+
}
|
|
1518
|
+
console.log('doLayout----hiddenColumnsResult=', hiddenColumnsResult)
|
|
1519
|
+
this.options.hiddenColumns = hiddenColumnsResult
|
|
1520
|
+
} else {
|
|
1521
|
+
this.options.hiddenColumns = orgHiddenColumns
|
|
1522
|
+
}
|
|
1523
|
+
if (this.$refs && this.$refs.superGrid) {
|
|
1524
|
+
this.$refs.superGrid.doLayout()
|
|
1525
|
+
}
|
|
1488
1526
|
}
|
|
1489
1527
|
}
|
|
1490
1528
|
export default apis
|
|
@@ -743,17 +743,17 @@ export default {
|
|
|
743
743
|
if(!this.gridOptions.customRules){
|
|
744
744
|
this.gridOptions.customRules = {}
|
|
745
745
|
}
|
|
746
|
-
this
|
|
746
|
+
this.$watch('gridOptions.customRules.'+this.column.prop,
|
|
747
747
|
(newVal, oldVal)=> {
|
|
748
|
-
this.packageCustomRules()
|
|
748
|
+
this.packageCustomRules(newVal)
|
|
749
749
|
},
|
|
750
750
|
{
|
|
751
751
|
immediate: true,
|
|
752
752
|
deep: true,
|
|
753
753
|
})
|
|
754
|
-
this
|
|
754
|
+
this.$watch('gridOptions.customRules._all_fields',
|
|
755
755
|
(newVal, oldVal)=> {
|
|
756
|
-
this.packageCustomRules()
|
|
756
|
+
this.packageCustomRules(newVal)
|
|
757
757
|
},
|
|
758
758
|
{
|
|
759
759
|
immediate: true,
|
|
@@ -1815,21 +1815,16 @@ export default {
|
|
|
1815
1815
|
this.innerValue = value
|
|
1816
1816
|
this.blurEvent()
|
|
1817
1817
|
},
|
|
1818
|
-
packageCustomRules() {
|
|
1819
|
-
|
|
1818
|
+
packageCustomRules(columnRule) {
|
|
1819
|
+
console.log('packageCustomRules---columnRule=', columnRule)
|
|
1820
|
+
if(!columnRule){
|
|
1820
1821
|
return
|
|
1821
1822
|
}
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
this.$emit('change-disabled', columnRule.disabled)
|
|
1828
|
-
}
|
|
1829
|
-
if(columnRule.required !== undefined){
|
|
1830
|
-
this.$emit('change-required', columnRule.required)
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1823
|
+
if(columnRule.disabled !== undefined){
|
|
1824
|
+
this.$emit('change-disabled', columnRule.disabled)
|
|
1825
|
+
}
|
|
1826
|
+
if(columnRule.required !== undefined){
|
|
1827
|
+
this.$emit('change-required', columnRule.required)
|
|
1833
1828
|
}
|
|
1834
1829
|
}
|
|
1835
1830
|
}
|
|
@@ -87,41 +87,100 @@ function getValidator(listCode) {
|
|
|
87
87
|
}
|
|
88
88
|
const gridParams = store.get(listCode)
|
|
89
89
|
const editFieldInfos = gridParams.columns
|
|
90
|
+
const customRules = gridParams.options.customRules
|
|
90
91
|
const rules = {}
|
|
91
92
|
if (editFieldInfos) {
|
|
92
93
|
editFieldInfos.forEach((editField) => {
|
|
93
|
-
setRules(rules, editField, listCode)
|
|
94
|
+
setRules(rules, editField, listCode, customRules)
|
|
94
95
|
})
|
|
95
96
|
}
|
|
96
97
|
// console.log('rules', rules)
|
|
97
98
|
return rules
|
|
98
99
|
}
|
|
99
100
|
|
|
100
|
-
function setRules(rules, editField, listCode) {
|
|
101
|
+
function setRules(rules, editField, listCode, customRules) {
|
|
101
102
|
const prop = editField.prop
|
|
102
103
|
if (editField.groupHeader && editField.children && editField.children.length > 0) {
|
|
103
104
|
// 组合表头时或者动态列,递归设置规则,
|
|
104
105
|
editField.children.forEach((child) => {
|
|
105
|
-
setRules(rules, child, listCode)
|
|
106
|
+
setRules(rules, child, listCode, customRules)
|
|
106
107
|
})
|
|
107
108
|
} else {
|
|
108
|
-
if
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
if(prop) {
|
|
110
|
+
// 获得当前列的自定义校验规则
|
|
111
|
+
const columnCustomRules = getColumnCustomRules(editField, customRules)
|
|
112
|
+
if ((columnCustomRules || editField.validations) && !isDisableEdit(prop, listCode)) {
|
|
113
|
+
let validations = editField.validations? JSON.parse(editField.validations): []
|
|
114
|
+
validations.forEach((item) => {
|
|
115
|
+
if (item.pattern) {
|
|
116
|
+
// 后台传递的是正则字符串,不能直接使用
|
|
117
|
+
item.pattern = new RegExp(item.pattern)
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
validations = validations.concat(columnCustomRules)
|
|
121
|
+
if (prop.indexOf('.') > 0) {
|
|
122
|
+
setObjectPropRule(editField, rules, validations)
|
|
123
|
+
} else {
|
|
124
|
+
if (validations && validations.length > 0) {
|
|
125
|
+
rules[prop] = [...validations]
|
|
126
|
+
}
|
|
114
127
|
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 获得当前列的自定义校验规则
|
|
134
|
+
* @param {*} editField
|
|
135
|
+
* @param {*} customRules
|
|
136
|
+
* @returns
|
|
137
|
+
*/
|
|
138
|
+
function getColumnCustomRules(editField, customRules) {
|
|
139
|
+
const prop = editField.prop
|
|
140
|
+
let columnCustomRules = []
|
|
141
|
+
let requiredRule
|
|
142
|
+
const allFieldsName = '_all_fields'
|
|
143
|
+
let columnRule
|
|
144
|
+
if(customRules){
|
|
145
|
+
columnRule = customRules[prop]? customRules[prop]: customRules[allFieldsName]
|
|
146
|
+
}
|
|
147
|
+
if(columnRule && (columnRule.required || columnRule.rules)) {
|
|
148
|
+
// 表示配置的必填或其它验证规则时
|
|
149
|
+
const mustFillMsg = getI18n().t('imatrixUIMessage.mustFill', {
|
|
150
|
+
label: editField.label
|
|
151
|
+
})
|
|
152
|
+
columnCustomRules = columnRule.rules? JSON.parse(JSON.stringify(columnRule.rules)): null
|
|
153
|
+
if(columnCustomRules && columnCustomRules.length > 0){
|
|
154
|
+
// 获得必填验证规则
|
|
155
|
+
const requiredRules = columnCustomRules.filter(item=>item.required)
|
|
156
|
+
if(requiredRules && requiredRules.length > 0){
|
|
157
|
+
requiredRule = requiredRules[0]
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if(columnRule.name === allFieldsName && columnCustomRules){
|
|
161
|
+
// 所有字段_all_fields的验证的message更新,补充“label”
|
|
162
|
+
columnCustomRules.forEach(item=>{
|
|
163
|
+
item.message = editField.label + item.message
|
|
115
164
|
})
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
165
|
+
}
|
|
166
|
+
if(!requiredRule && columnRule.required) {
|
|
167
|
+
// 当rules中没有配置必填验证,但是有required为true时,则封装必填验证规则,到集合中
|
|
168
|
+
if(!columnCustomRules){
|
|
169
|
+
columnCustomRules = []
|
|
122
170
|
}
|
|
171
|
+
requiredRule = {
|
|
172
|
+
required: true,
|
|
173
|
+
message: mustFillMsg,
|
|
174
|
+
trigger: 'blur'
|
|
175
|
+
}
|
|
176
|
+
columnCustomRules.push(requiredRule)
|
|
177
|
+
}
|
|
178
|
+
if(requiredRule && !requiredRule.message) {
|
|
179
|
+
// 如果必填验证规则中message为空时,封装默认的必填验证规则,'_all_fields'可能会为空
|
|
180
|
+
requiredRule.message = mustFillMsg
|
|
123
181
|
}
|
|
124
182
|
}
|
|
183
|
+
return columnCustomRules
|
|
125
184
|
}
|
|
126
185
|
/**
|
|
127
186
|
* 验证实体
|
|
@@ -457,16 +457,12 @@ export default {
|
|
|
457
457
|
isShowForm: {
|
|
458
458
|
type: Boolean,
|
|
459
459
|
default: false
|
|
460
|
-
},
|
|
461
|
-
// 列表配置信息
|
|
462
|
-
options: {
|
|
463
|
-
type: Object,
|
|
464
|
-
default: null
|
|
465
460
|
}
|
|
466
461
|
},
|
|
467
462
|
data() {
|
|
468
463
|
let parentFormData
|
|
469
464
|
const gridParams = store.get(this.listCode)
|
|
465
|
+
const options = gridParams.options
|
|
470
466
|
if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
|
|
471
467
|
parentFormData = gridParams.options.extraParam.entityMap
|
|
472
468
|
}
|
|
@@ -481,7 +477,10 @@ export default {
|
|
|
481
477
|
scanEnable = true
|
|
482
478
|
}
|
|
483
479
|
const componentId = this.listCode + '_' + this.column.prop
|
|
484
|
-
|
|
480
|
+
let lineEdit
|
|
481
|
+
if (gridParams.lineEdit !== null && gridParams.lineEdit !== undefined) {
|
|
482
|
+
lineEdit = gridParams.lineEdit
|
|
483
|
+
}
|
|
485
484
|
return {
|
|
486
485
|
selectRow: null,
|
|
487
486
|
that: this,
|
|
@@ -511,22 +510,24 @@ export default {
|
|
|
511
510
|
componentId,
|
|
512
511
|
controlConfig,
|
|
513
512
|
rowLinkConfigMapping: {},
|
|
514
|
-
requiredClass
|
|
513
|
+
requiredClass: '',
|
|
514
|
+
lineEdit,
|
|
515
|
+
options
|
|
515
516
|
}
|
|
516
517
|
},
|
|
517
518
|
computed: {
|
|
518
|
-
lineEdit() {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
},
|
|
519
|
+
// lineEdit() {
|
|
520
|
+
// let isLineEdit = false
|
|
521
|
+
// if (this.listCode) {
|
|
522
|
+
// const gridParams = store.get(this.listCode)
|
|
523
|
+
// if (gridParams.lineEdit !== null && gridParams.lineEdit !== undefined) {
|
|
524
|
+
// isLineEdit = gridParams.lineEdit
|
|
525
|
+
// } else {
|
|
526
|
+
// isLineEdit = false
|
|
527
|
+
// }
|
|
528
|
+
// }
|
|
529
|
+
// return isLineEdit
|
|
530
|
+
// },
|
|
530
531
|
|
|
531
532
|
...mapGetters(['preventReclick'])
|
|
532
533
|
},
|
|
@@ -612,6 +613,7 @@ export default {
|
|
|
612
613
|
}
|
|
613
614
|
}
|
|
614
615
|
this.setScanRuleSets()
|
|
616
|
+
this.requiredClass = this.isRequired(this.row.$editing) ? 'm-requried' : ''
|
|
615
617
|
},
|
|
616
618
|
mounted() {
|
|
617
619
|
// 监听保存时点击按钮事件线触发
|
|
@@ -971,7 +973,8 @@ export default {
|
|
|
971
973
|
}
|
|
972
974
|
},
|
|
973
975
|
isRequired(editing) {
|
|
974
|
-
|
|
976
|
+
console.log('isRequired---this.lineEdit=', this.lineEdit)
|
|
977
|
+
if (!this.isFormSubTable && this.lineEdit && this.lineEdit.editable && this.isEditable && editing && this.column.validations) {
|
|
975
978
|
if (this.column.validations.indexOf('"required":true') > 0) {
|
|
976
979
|
return true
|
|
977
980
|
}
|
|
@@ -1042,7 +1045,7 @@ export default {
|
|
|
1042
1045
|
.m-requried {
|
|
1043
1046
|
float: left;
|
|
1044
1047
|
white-space: nowrap;
|
|
1045
|
-
width:
|
|
1048
|
+
width: 96%;
|
|
1046
1049
|
}
|
|
1047
1050
|
|
|
1048
1051
|
.m-requried::after {
|
|
@@ -146,16 +146,12 @@ export default {
|
|
|
146
146
|
listToolbarFormData: {
|
|
147
147
|
type: Object,
|
|
148
148
|
default: null
|
|
149
|
-
},
|
|
150
|
-
// 列表配置信息
|
|
151
|
-
options: {
|
|
152
|
-
type: Object,
|
|
153
|
-
default: null
|
|
154
149
|
}
|
|
155
150
|
},
|
|
156
151
|
data() {
|
|
157
152
|
let parentFormData
|
|
158
153
|
const gridParams = store.get(this.listCode)
|
|
154
|
+
const options = gridParams.options
|
|
159
155
|
if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
|
|
160
156
|
parentFormData = gridParams.options.extraParam.entityMap
|
|
161
157
|
}
|
|
@@ -169,7 +165,8 @@ export default {
|
|
|
169
165
|
subTableCanAdd: true, // 表单子表时是否有新增权限
|
|
170
166
|
isShowAdd: false, // 是否显示表头的新增按钮
|
|
171
167
|
cellWidth: null,
|
|
172
|
-
parentFormData
|
|
168
|
+
parentFormData,
|
|
169
|
+
options
|
|
173
170
|
}
|
|
174
171
|
},
|
|
175
172
|
computed: {
|
|
@@ -370,20 +367,4 @@ export default {
|
|
|
370
367
|
</script>
|
|
371
368
|
|
|
372
369
|
<style lang="scss" scoped>
|
|
373
|
-
.annex-cell {
|
|
374
|
-
padding-right: 5px;
|
|
375
|
-
cursor: pointer;
|
|
376
|
-
color: #409eff;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
.m-requried {
|
|
380
|
-
float: left;
|
|
381
|
-
white-space: nowrap;
|
|
382
|
-
width: 100%;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
.m-requried::after {
|
|
386
|
-
content: '*';
|
|
387
|
-
color: #f56c6c;
|
|
388
|
-
}
|
|
389
370
|
</style>
|
|
@@ -176,6 +176,7 @@ const superGridService = {
|
|
|
176
176
|
gridParams.pagination = this.pagination
|
|
177
177
|
gridParams.pageContext = this.pageContext
|
|
178
178
|
gridParams.configureObj = this.configureObj
|
|
179
|
+
gridParams.hiddenColumns = this.options.hiddenColumns?JSON.parse(JSON.stringify(this.options.hiddenColumns)):[]
|
|
179
180
|
if (this.pagination) {
|
|
180
181
|
// 监控每行显示多少条变量使用
|
|
181
182
|
this.pageSize = this.pagination.pageSize
|
|
@@ -264,8 +264,8 @@ export function isDisableEdit(prop, listCode, row) {
|
|
|
264
264
|
}
|
|
265
265
|
if (isDiabled === false) {
|
|
266
266
|
// 表示不是禁止编辑的,继续校验自定义规则中是否是禁止编辑的
|
|
267
|
-
if(gridParams.options.customRules && gridParams.options.customRules[prop]){
|
|
268
|
-
const columnRules = gridParams.options.customRules[prop]
|
|
267
|
+
if(gridParams.options.customRules && (gridParams.options.customRules[prop] || gridParams.options.customRules['_all_fields'])){
|
|
268
|
+
const columnRules = gridParams.options.customRules[prop]? gridParams.options.customRules[prop]: gridParams.options.customRules['_all_fields']
|
|
269
269
|
if(columnRules && columnRules.disabled){
|
|
270
270
|
isDiabled = true
|
|
271
271
|
}
|
package/src/i18n/langs/cn.js
CHANGED
|
@@ -83,7 +83,8 @@ const cn = {
|
|
|
83
83
|
forbiddenExceptionLinkUrl: '请点击进行权限申请',
|
|
84
84
|
forbiddenExceptionLinkUser: '如有疑问请联系',
|
|
85
85
|
uploadFileTip: '上传的文件不超过{fileSize}M',
|
|
86
|
-
asyncExportJumpMsg: '或点击我跳转到下载页面'
|
|
86
|
+
asyncExportJumpMsg: '或点击我跳转到下载页面',
|
|
87
|
+
mustFill: '{label} 必须填写'
|
|
87
88
|
},
|
|
88
89
|
// 列表组件
|
|
89
90
|
superGrid: {
|
package/src/i18n/langs/en.js
CHANGED
|
@@ -85,7 +85,8 @@ const en = {
|
|
|
85
85
|
forbiddenExceptionLinkUrl: 'please click to apply',
|
|
86
86
|
forbiddenExceptionLinkUser: 'if you have any questions,please contact',
|
|
87
87
|
uploadFileTip: 'The file size should lower {fileSize}M',
|
|
88
|
-
asyncExportJumpMsg: 'Or click me to jump to download page.'
|
|
88
|
+
asyncExportJumpMsg: 'Or click me to jump to download page.',
|
|
89
|
+
mustFill: '{label} must fill'
|
|
89
90
|
},
|
|
90
91
|
superGrid: {
|
|
91
92
|
columnConfig: 'Column Config',
|