优化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",
"name" : "列表",
"createTime" : null,
"updateTime" : 1653129241574,
"updateTime" : 1653634268957,
"lock" : null,
"createBy" : 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
where is_del = 0
?{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
""")

View File

@ -3,22 +3,12 @@
<el-form :inline="true" @keyup.enter="search">
<span v-for="(it, i) in where">
<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" />
<mb-select v-else-if="it.type == 'select'" v-model="it.value" :placeholder="'请选择' + it.label" v-bind="it.props" />
<el-date-picker
v-else-if="it.type == 'date' || it.type == 'datetime' || it.type == 'daterange' || it.type == 'datetimerange'"
v-model="it.value"
align="right"
:format="it.type.startsWith('datetime') ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'"
: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" />
<component
:is="!it.component ? 'mb-input' : it.component.startsWith('el-') || $global.dynamicComponentNames.indexOf(it.component) != -1 ? it.component : 'mb-' + it.component"
v-model="it.value"
:item-label="it.label"
v-bind="it.props"
/>
</el-form-item>
</span>
<el-form-item>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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