优化mb-search

修复代码生成查询列字典类型
修改mb-table:where属性 type -> component
This commit is contained in:
吕金泽 2022-05-27 15:02:27 +08:00
parent 2aca3f0e78
commit f58c3c0787
13 changed files with 52 additions and 62 deletions

View File

@ -5,7 +5,7 @@
"groupId" : "0295f2b4af9145f5a0ea29fa4b797214", "groupId" : "0295f2b4af9145f5a0ea29fa4b797214",
"name" : "列表", "name" : "列表",
"createTime" : null, "createTime" : null,
"updateTime" : 1653129241574, "updateTime" : 1653634268957,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : null, "updateBy" : null,
@ -110,6 +110,7 @@ return db.page("""
select id,configure_condition,configure_key,configure_value,configure_name,configure_type,configure_desc_ribe,remarks,create_date from sys_configure select id,configure_condition,configure_key,configure_value,configure_name,configure_type,configure_desc_ribe,remarks,create_date from sys_configure
where is_del = 0 where is_del = 0
?{configureCondition, and configure_condition like concat('%',#{configureCondition},'%')} ?{configureCondition, and configure_condition like concat('%',#{configureCondition},'%')}
?{configureKey, and configure_key = #{configureKey}} ?{configureKey, and configure_key like concat('%',#{configureKey},'%')}
?{configureValue, and configure_value like concat('%',#{configureValue},'%')}
order by create_date desc order by create_date desc
""") """)

View File

@ -3,22 +3,12 @@
<el-form :inline="true" @keyup.enter="search"> <el-form :inline="true" @keyup.enter="search">
<span v-for="(it, i) in where"> <span v-for="(it, i) in where">
<el-form-item v-if="it && it.label" :label="it.label" :key="i"> <el-form-item v-if="it && it.label" :label="it.label" :key="i">
<el-input v-if="!it.type || it.type == 'input'" @input="input(it.input)" v-model="it.value" :placeholder="it.placeholder || ('请输入' + it.label)" style="width: 200px;" class="filter-item" /> <component
<mb-select v-else-if="it.type == 'select'" v-model="it.value" :placeholder="'请选择' + it.label" v-bind="it.props" /> :is="!it.component ? 'mb-input' : it.component.startsWith('el-') || $global.dynamicComponentNames.indexOf(it.component) != -1 ? it.component : 'mb-' + it.component"
<el-date-picker
v-else-if="it.type == 'date' || it.type == 'datetime' || it.type == 'daterange' || it.type == 'datetimerange'"
v-model="it.value" v-model="it.value"
align="right" :item-label="it.label"
:format="it.type.startsWith('datetime') ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'" v-bind="it.props"
:value-format="it.type.startsWith('datetime') ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'" />
:type="it.type"
start-placeholder="开始时间"
end-placeholder="结束时间"
:placeholder="it.type.startsWith('datetime') ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'"
>
</el-date-picker>
<mb-inputrange v-model="it.value" v-else-if="it.type == 'inputrange'" />
<component v-else :is="it.type" v-model="it.value" v-bind="it.props" />
</el-form-item> </el-form-item>
</span> </span>
<el-form-item> <el-form-item>

View File

@ -105,12 +105,10 @@ onMounted(() => {
}) })
function setValue(value){ function setValue(value){
if(value){
if(props.multiple && props.join){ if(props.multiple && props.join){
selectValue.value = value.split(',') selectValue.value = value ? value.split(',') : []
}else{ }else{
selectValue.value = value.toString() selectValue.value = value ? value.toString() : ''
}
} }
} }

View File

@ -30,9 +30,17 @@ function gen(groupPath, data){
for(var i in data){ for(var i in data){
var d = data[i] var d = data[i]
if(d.query){ if(d.query){
var props = ''
if(d.dictType){
props = `,
props: {
type: '${d.dictType}'
}`
}
html += ` html += `
${d.columnName}: { ${d.columnName}: {
label: '${d.columnComment}' label: '${d.columnComment}',
${d.component}${props}
},` },`
} }
} }

View File

@ -40,7 +40,7 @@ const listOptions = reactive({
label: '姓名/昵称', label: '姓名/昵称',
}, },
roleId: { roleId: {
type: 'select', component: 'select',
label: '角色', label: '角色',
props: { props: {
url: '/system/role/all', url: '/system/role/all',

View File

@ -33,9 +33,12 @@
label: '描述' label: '描述'
}, },
createDate: { createDate: {
component: 'date',
label: '创建时间', label: '创建时间',
props: {
type: 'daterange' type: 'daterange'
} }
}
}, },
cols: [ cols: [
{ {

View File

@ -92,14 +92,13 @@ const tableOptions = reactive({
page: true, page: true,
where: { where: {
configureCondition: { configureCondition: {
type: 'input', label: '查询条件'
label: '条件',
value: ''
}, },
configureKey: { configureKey: {
type: 'input', label: '配置键值'
label: '键值', },
value: '' configureValue: {
label: '配置数据'
} }
}, },
cols: [ cols: [

View File

@ -63,21 +63,17 @@ const tableOptions = reactive({
page: true, page: true,
where: { where: {
label: { label: {
type: 'input', label: '标签'
label: '标签',
value: ''
}, },
value: { value: {
type: 'input', label: '值'
label: '值',
value: ''
}, },
dictId: props.dictId dictId: props.dictId
}, },
cols: [ cols: [
{ {
field: 'label', field: 'label',
label: '类型' label: '标签'
}, },
{ {
field: 'value', field: 'value',

View File

@ -63,14 +63,11 @@ const tableOptions = reactive({
page: true, page: true,
where: { where: {
type: { type: {
type: 'input', label: '类型'
label: '类型',
value: ''
}, },
dictType: { dictType: {
type: 'select', component: 'select',
label: '字典类型', label: '字典类型',
value: '',
props: { props: {
'all-option': true, 'all-option': true,
type: 'dict_type' type: 'dict_type'

View File

@ -12,9 +12,11 @@
url: '/system/log/login/list', url: '/system/log/login/list',
where: { where: {
createDate: { createDate: {
type: 'datetimerange', component: 'date',
label: '创建时间', label: '创建时间',
value: '' props: {
type: 'datetimerange'
}
} }
}, },
cols: [ cols: [

View File

@ -30,12 +30,15 @@
label: '路径' label: '路径'
}, },
costTime: { costTime: {
label: '耗时区间', component: 'inputrange',
type: 'inputrange' label: '耗时区间'
}, },
createDate: { createDate: {
type: 'datetimerange', component: 'date',
label: '创建时间' label: '创建时间',
props: {
type: 'datetimerange'
}
} }
}, },
cols: [ cols: [

View File

@ -92,9 +92,7 @@ const tableOptions = reactive({
url: '/system/role/list', url: '/system/role/list',
where: { where: {
name: { name: {
type: 'input', label: '角色名称'
label: '角色名称',
value: ''
} }
}, },
cols: [ cols: [

View File

@ -115,19 +115,14 @@ const tableOptions = reactive({
selection: true, selection: true,
where: { where: {
username: { username: {
type: 'input', label: '登录名称'
label: '登录名称',
value: ''
}, },
name: { name: {
type: 'input', label: '姓名/昵称'
label: '姓名/昵称',
value: ''
}, },
roleId: { roleId: {
type: 'select', component: 'select',
label: '角色', label: '角色',
value: '',
props: { props: {
url: '/system/role/all', url: '/system/role/all',
multiple: true multiple: true