|
|
@@ -62,14 +62,24 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
let defaultVal = ''
|
|
|
+ let initData = this.models[this.field.name]
|
|
|
if (this.field.field_type === 'table') {
|
|
|
// 一对多,是数组,一对一是对象
|
|
|
defaultVal = []
|
|
|
+ if (initData) {
|
|
|
+ const tem = JSON.parse(JSON.stringify(initData))
|
|
|
+ tem.sort &&
|
|
|
+ tem.sort(
|
|
|
+ (a, b) =>
|
|
|
+ (a.tenantId || a.tenant_id_) - (b.tenantId || b.tenant_id_)
|
|
|
+ )
|
|
|
+ initData = tem
|
|
|
+ }
|
|
|
} else {
|
|
|
defaultVal = ''
|
|
|
}
|
|
|
return {
|
|
|
- dataModel: this.models[this.field.name] || defaultVal,
|
|
|
+ dataModel: initData || defaultVal,
|
|
|
fieldRights: this.rights[this.field.name] || 'e'
|
|
|
}
|
|
|
},
|
|
|
@@ -106,16 +116,16 @@ export default {
|
|
|
return this.mode === 'dialog'
|
|
|
? true
|
|
|
: this.readonlyRights
|
|
|
- ? true
|
|
|
- : this.fieldRights === FormOptions.t.PERMISSIONS.READ
|
|
|
+ ? true
|
|
|
+ : this.fieldRights === FormOptions.t.PERMISSIONS.READ
|
|
|
},
|
|
|
required() {
|
|
|
// 必填 【只读隐藏,都设置非必填】
|
|
|
return this.readonly || this.hidden
|
|
|
? false
|
|
|
: this.fieldRights === FormOptions.t.PERMISSIONS.REQUIRED
|
|
|
- ? true
|
|
|
- : this.field.field_options.required || false
|
|
|
+ ? true
|
|
|
+ : this.field.field_options.required || false
|
|
|
},
|
|
|
rules() {
|
|
|
if (this.readonly || this.hidden) {
|
|
|
@@ -173,7 +183,8 @@ export default {
|
|
|
this.field.field_type === 'selector' ||
|
|
|
this.field.field_type === 'select' ||
|
|
|
this.field.field_type === 'customDialog' ||
|
|
|
- this.field.field_type === 'linkdata'
|
|
|
+ this.field.field_type === 'linkdata' ||
|
|
|
+ this.field.field_type === 'table'
|
|
|
) {
|
|
|
this.handleModels(this.field.name, val)
|
|
|
}
|