|
@ -1,7 +1,13 @@ |
|
|
<template> |
|
|
<template> |
|
|
<div> |
|
|
<div> |
|
|
<span style="color:red">搜索时如果条件为LIKE只支持字符串</span> |
|
|
<span style="color:red">搜索时如果条件为LIKE只支持字符串</span> |
|
|
<el-form :model="dialogMiddle" ref="fieldDialogFrom" label-width="120px" label-position="left" :rules="rules"> |
|
|
|
|
|
|
|
|
<el-form |
|
|
|
|
|
:model="dialogMiddle" |
|
|
|
|
|
ref="fieldDialogFrom" |
|
|
|
|
|
label-width="120px" |
|
|
|
|
|
label-position="left" |
|
|
|
|
|
:rules="rules" |
|
|
|
|
|
> |
|
|
<el-form-item label="Field名称" prop="fieldName"> |
|
|
<el-form-item label="Field名称" prop="fieldName"> |
|
|
<el-col :span="6"> |
|
|
<el-col :span="6"> |
|
|
<el-input v-model="dialogMiddle.fieldName" autocomplete="off"></el-input> |
|
|
<el-input v-model="dialogMiddle.fieldName" autocomplete="off"></el-input> |
|
@ -29,26 +35,36 @@ |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="Field数据类型" prop="fieldType"> |
|
|
<el-form-item label="Field数据类型" prop="fieldType"> |
|
|
<el-col :span="8"> |
|
|
<el-col :span="8"> |
|
|
<el-select v-model="dialogMiddle.fieldType" placeholder="请选择field数据类型" @change="getDbfdOptions" clearable > |
|
|
|
|
|
|
|
|
<el-select |
|
|
|
|
|
v-model="dialogMiddle.fieldType" |
|
|
|
|
|
placeholder="请选择field数据类型" |
|
|
|
|
|
@change="getDbfdOptions" |
|
|
|
|
|
clearable |
|
|
|
|
|
> |
|
|
<el-option |
|
|
<el-option |
|
|
v-for="item in typeOptions" |
|
|
v-for="item in typeOptions" |
|
|
:key="item.value" |
|
|
:key="item.value" |
|
|
:label="item.label" |
|
|
:label="item.label" |
|
|
:value="item.value"> |
|
|
|
|
|
</el-option> |
|
|
|
|
|
|
|
|
:value="item.value" |
|
|
|
|
|
></el-option> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
<el-form-item label="数据库字段类型" prop="dataType"> |
|
|
<el-form-item label="数据库字段类型" prop="dataType"> |
|
|
<el-col :span="8"> |
|
|
<el-col :span="8"> |
|
|
<el-select :disabled="!dialogMiddle.fieldType" v-model="dialogMiddle.dataType" placeholder="请选择数据库字段类型" clearable > |
|
|
|
|
|
|
|
|
<el-select |
|
|
|
|
|
:disabled="!dialogMiddle.fieldType" |
|
|
|
|
|
v-model="dialogMiddle.dataType" |
|
|
|
|
|
placeholder="请选择数据库字段类型" |
|
|
|
|
|
clearable |
|
|
|
|
|
> |
|
|
<el-option |
|
|
<el-option |
|
|
v-for="item in dbfdOptions" |
|
|
v-for="item in dbfdOptions" |
|
|
:key="item.label" |
|
|
:key="item.label" |
|
|
:label="item.label" |
|
|
:label="item.label" |
|
|
:value="item.label"> |
|
|
|
|
|
</el-option> |
|
|
|
|
|
|
|
|
:value="item.label" |
|
|
|
|
|
></el-option> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -64,8 +80,21 @@ |
|
|
v-for="item in typeSearchOptions" |
|
|
v-for="item in typeSearchOptions" |
|
|
:key="item.value" |
|
|
:key="item.value" |
|
|
:label="item.label" |
|
|
:label="item.label" |
|
|
:value="item.value"> |
|
|
|
|
|
</el-option> |
|
|
|
|
|
|
|
|
:value="item.value" |
|
|
|
|
|
></el-option> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
|
|
<el-form-item label="关联字典" prop="dictType"> |
|
|
|
|
|
<el-col :span="8"> |
|
|
|
|
|
<el-select :disabled="dialogMiddle.fieldType!='int'" v-model="dialogMiddle.dictType" placeholder="请选择字典" clearable> |
|
|
|
|
|
<el-option |
|
|
|
|
|
v-for="item in dictOptions" |
|
|
|
|
|
:key="item.type" |
|
|
|
|
|
:label="`${item.type}(${item.name})`" |
|
|
|
|
|
:value="item.type" |
|
|
|
|
|
></el-option> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -73,14 +102,15 @@ |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
<script> |
|
|
<script> |
|
|
import {getDict} from '@/utils/dictionary' |
|
|
|
|
|
|
|
|
import { getDict } from "@/utils/dictionary"; |
|
|
|
|
|
import { getSysDictionaryList } from "@/api/sysDictionary"; |
|
|
export default { |
|
|
export default { |
|
|
name: "FieldDialog", |
|
|
name: "FieldDialog", |
|
|
props: { |
|
|
props: { |
|
|
dialogMiddle: { |
|
|
dialogMiddle: { |
|
|
type: Object, |
|
|
type: Object, |
|
|
default: function() { |
|
|
default: function() { |
|
|
return {} |
|
|
|
|
|
|
|
|
return {}; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
@ -88,6 +118,7 @@ export default { |
|
|
return { |
|
|
return { |
|
|
dbfdOptions: [], |
|
|
dbfdOptions: [], |
|
|
visible: false, |
|
|
visible: false, |
|
|
|
|
|
dictOptions: [], |
|
|
typeSearchOptions: [ |
|
|
typeSearchOptions: [ |
|
|
{ |
|
|
{ |
|
|
label: "=", |
|
|
label: "=", |
|
@ -108,7 +139,7 @@ export default { |
|
|
{ |
|
|
{ |
|
|
label: "LIKE", |
|
|
label: "LIKE", |
|
|
value: "LIKE" |
|
|
value: "LIKE" |
|
|
}, |
|
|
|
|
|
|
|
|
} |
|
|
], |
|
|
], |
|
|
typeOptions: [ |
|
|
typeOptions: [ |
|
|
{ |
|
|
{ |
|
@ -130,31 +161,49 @@ export default { |
|
|
{ |
|
|
{ |
|
|
label: "时间", |
|
|
label: "时间", |
|
|
value: "time.Time" |
|
|
value: "time.Time" |
|
|
}, |
|
|
|
|
|
|
|
|
} |
|
|
], |
|
|
], |
|
|
rules: { |
|
|
rules: { |
|
|
fieldName:[ { required: true, message: '请输入field英文名', trigger: 'blur' }], |
|
|
|
|
|
fieldDesc:[ { required: true, message: '请输入field中文名', trigger: 'blur' }], |
|
|
|
|
|
fieldJson:[ { required: true, message: '请输入field格式化json', trigger: 'blur' }], |
|
|
|
|
|
columnName:[{ required: true, message: '请输入数据库字段', trigger: 'blur' }], |
|
|
|
|
|
fieldType:[ { required: true, message: '请选择field数据类型', trigger: 'blur' }] |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fieldName: [ |
|
|
|
|
|
{ required: true, message: "请输入field英文名", trigger: "blur" } |
|
|
|
|
|
], |
|
|
|
|
|
fieldDesc: [ |
|
|
|
|
|
{ required: true, message: "请输入field中文名", trigger: "blur" } |
|
|
|
|
|
], |
|
|
|
|
|
fieldJson: [ |
|
|
|
|
|
{ required: true, message: "请输入field格式化json", trigger: "blur" } |
|
|
|
|
|
], |
|
|
|
|
|
columnName: [ |
|
|
|
|
|
{ required: true, message: "请输入数据库字段", trigger: "blur" } |
|
|
|
|
|
], |
|
|
|
|
|
fieldType: [ |
|
|
|
|
|
{ required: true, message: "请选择field数据类型", trigger: "blur" } |
|
|
|
|
|
] |
|
|
} |
|
|
} |
|
|
|
|
|
}; |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
async getDbfdOptions() { |
|
|
async getDbfdOptions() { |
|
|
|
|
|
this.dialogMiddle.dataType = "" |
|
|
|
|
|
this.dialogMiddle.dataTypeLong = "" |
|
|
|
|
|
this.dialogMiddle.fieldSearchType = "" |
|
|
|
|
|
this.dialogMiddle.dictType = "" |
|
|
if (this.dialogMiddle.fieldType) { |
|
|
if (this.dialogMiddle.fieldType) { |
|
|
const res = await getDict(this.dialogMiddle.fieldType) |
|
|
|
|
|
this.dbfdOptions = res |
|
|
|
|
|
|
|
|
const res = await getDict(this.dialogMiddle.fieldType); |
|
|
|
|
|
this.dbfdOptions = res; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
created() { |
|
|
|
|
|
this.getDbfdOptions() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
async created() { |
|
|
|
|
|
this.getDbfdOptions(); |
|
|
|
|
|
const dictRes = await getSysDictionaryList({ |
|
|
|
|
|
page: 1, |
|
|
|
|
|
pageSize: 999999 |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.dictOptions = dictRes.data.list |
|
|
} |
|
|
} |
|
|
|
|
|
}; |
|
|
</script> |
|
|
</script> |
|
|
<style lang="scss"> |
|
|
<style lang="scss"> |
|
|
|
|
|
|
|
|
</style> |
|
|
</style> |