update 查询控件写入组件

This commit is contained in:
2021-04-30 17:26:03 +08:00
parent f6790ef78c
commit a41311327c
9 changed files with 138 additions and 144 deletions

View File

@@ -2,21 +2,16 @@
<container> <container>
<br /> <br />
<a-card :bordered="false"> <a-card :bordered="false">
<Auth auth="authCode:page"> <yo-table
<div class="yo-query-bar"> :columns="columns"
<a-form-model :model="query" layout="inline"> :load-data="loadData"
@query="onQuery"
@resetQuery="onResetQuery"
ref="table"
>
<Auth auth="authCode:page" slot="query">
<!-- 此处添加查询表单控件 --> <!-- 此处添加查询表单控件 -->
<a-form-model-item>
<a-button-group>
<a-button @click="onQuery" type="primary">查询</a-button>
<a-button @click="onResetQuery">重置</a-button>
</a-button-group>
</a-form-model-item>
</a-form-model>
</div>
</Auth> </Auth>
<yo-table :columns="columns" :load-data="loadData" ref="table">
<Auth auth="authCode:add" slot="operator"> <Auth auth="authCode:add" slot="operator">
<a-button @click="onOpen('add-form')" icon="plus">新增XX</a-button> <a-button @click="onOpen('add-form')" icon="plus">新增XX</a-button>
</Auth> </Auth>

View File

@@ -7,20 +7,16 @@
> >
<container> <container>
<a-card :bordered="false"> <a-card :bordered="false">
<Auth auth="authCode:page"> <yo-table
<div class="yo-query-bar"> :columns="columns"
<a-form-model :model="query" layout="inline"> :load-data="loadData"
@query="onQuery"
@resetQuery="onResetQuery"
ref="table"
>
<Auth auth="authCode:page" slot="query">
<!-- 此处添加查询表单控件 --> <!-- 此处添加查询表单控件 -->
<a-form-model-item> </Auth>
<a-button-group>
<a-button @click="onQuery" type="primary">查询</a-button>
<a-button @click="onReset">重置</a-button>
</a-button-group>
</a-form-model-item>
</a-form-model>
</div>
<yo-table :columns="columns" :load-data="loadData" ref="table">
<Auth auth="authCode:add" slot="operator"> <Auth auth="authCode:add" slot="operator">
<a-button @click="onOpen('add-form')" icon="plus">新增机构</a-button> <a-button @click="onOpen('add-form')" icon="plus">新增机构</a-button>
</Auth> </Auth>
@@ -40,7 +36,6 @@
</yo-table-actions> </yo-table-actions>
</span> </span>
</yo-table> </yo-table>
</Auth>
</a-card> </a-card>
</container> </container>
<add-form @ok="onReloadData" ref="add-form" /> <add-form @ok="onReloadData" ref="add-form" />

View File

@@ -151,6 +151,15 @@ export default {
}) })
return data return data
}, },
onQuery() {
this.$emit('query')
},
onResetQuery() {
this.$emit('resetQuery')
this.$emit('reset-query')
}
}, },
render() { render() {
@@ -169,16 +178,33 @@ export default {
change: this.onTableChange, change: this.onTableChange,
...this.$listeners ...this.$listeners
} }
const queryOn = {
'submit.native.prevent': () => { }
}
return ( return (
<section> <section>
<a-alert type="warning" closable> <a-alert type="warning" closable>
<template slot="message"> <template slot="message">
后端没有排序参数
<br />
字段固定应该遵循左侧固定到最左,右侧固定到最右(此逻辑难以实现) 字段固定应该遵循左侧固定到最左,右侧固定到最右(此逻辑难以实现)
</template> </template>
</a-alert> </a-alert>
<br /> <br />
{
this.$scopedSlots.query &&
<div class="yo-query-bar">
<a-form-model layout="inline" {...{ on: queryOn }}>
{this.$scopedSlots.query()}
<a-form-model-item>
<a-button-group>
<a-button onClick={this.onQuery} html-type="submit" type="primary">查询</a-button>
<a-button onClick={this.onResetQuery}>重置</a-button>
</a-button-group>
</a-form-model-item>
</a-form-model>
</div>
}
<div class="yo-action-bar"> <div class="yo-action-bar">
<div class="yo-action-bar--actions"> <div class="yo-action-bar--actions">
{this.$scopedSlots.operator && this.$scopedSlots.operator()} {this.$scopedSlots.operator && this.$scopedSlots.operator()}

View File

@@ -2,21 +2,16 @@
<container> <container>
<br /> <br />
<a-card :bordered="false"> <a-card :bordered="false">
<Auth auth="authCode:page"> <yo-table
<div class="yo-query-bar"> :columns="columns"
<a-form-model :model="query" layout="inline"> :load-data="loadData"
@query="onQuery"
@resetQuery="onResetQuery"
ref="table"
>
<Auth auth="authCode:page" slot="query">
<!-- 此处添加查询表单控件 --> <!-- 此处添加查询表单控件 -->
<a-form-model-item>
<a-button-group>
<a-button @click="onQuery" type="primary">查询</a-button>
<a-button @click="onResetQuery">重置</a-button>
</a-button-group>
</a-form-model-item>
</a-form-model>
</div>
</Auth> </Auth>
<yo-table :columns="columns" :load-data="loadData" ref="table">
<Auth auth="authCode:add" slot="operator"> <Auth auth="authCode:add" slot="operator">
<a-button @click="onOpen('add-form')" icon="plus">新增XX</a-button> <a-button @click="onOpen('add-form')" icon="plus">新增XX</a-button>
</Auth> </Auth>

View File

@@ -7,20 +7,16 @@
> >
<container> <container>
<a-card :bordered="false"> <a-card :bordered="false">
<Auth auth="authCode:page"> <yo-table
<div class="yo-query-bar"> :columns="columns"
<a-form-model :model="query" layout="inline"> :load-data="loadData"
@query="onQuery"
@resetQuery="onResetQuery"
ref="table"
>
<Auth auth="authCode:page" slot="query">
<!-- 此处添加查询表单控件 --> <!-- 此处添加查询表单控件 -->
<a-form-model-item> </Auth>
<a-button-group>
<a-button @click="onQuery" type="primary">查询</a-button>
<a-button @click="onReset">重置</a-button>
</a-button-group>
</a-form-model-item>
</a-form-model>
</div>
<yo-table :columns="columns" :load-data="loadData" ref="table">
<Auth auth="authCode:add" slot="operator"> <Auth auth="authCode:add" slot="operator">
<a-button @click="onOpen('add-form')" icon="plus">新增机构</a-button> <a-button @click="onOpen('add-form')" icon="plus">新增机构</a-button>
</Auth> </Auth>
@@ -40,7 +36,6 @@
</yo-table-actions> </yo-table-actions>
</span> </span>
</yo-table> </yo-table>
</Auth>
</a-card> </a-card>
</container> </container>
<add-form @ok="onReloadData" ref="add-form" /> <add-form @ok="onReloadData" ref="add-form" />

View File

@@ -1,26 +1,20 @@
<template> <template>
<a-card> <a-card>
<Auth auth="sysDictData:page"> <yo-table
<div class="yo-query-bar"> :columns="columns"
<a-form-model :model="query" layout="inline"> :load-data="loadData"
<!-- 此处添加查询表单控件 --> @query="onQuery"
@resetQuery="onResetQuery"
ref="table"
>
<Auth auth="sysDictData:page" slot="query">
<a-form-model-item label="文本"> <a-form-model-item label="文本">
<a-input placeholder="请输入文本" v-model="query.value" /> <a-input placeholder="请输入文本" v-model="query.value" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="字典值"> <a-form-model-item label="字典值">
<a-input placeholder="请输入字典值" v-model="query.code" /> <a-input placeholder="请输入字典值" v-model="query.code" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item>
<a-button-group>
<a-button @click="onQuery" type="primary">查询</a-button>
<a-button @click="onResetQuery">重置</a-button>
</a-button-group>
</a-form-model-item>
</a-form-model>
</div>
</Auth> </Auth>
<yo-table :columns="columns" :load-data="loadData" ref="table">
<Auth auth="sysDictData:add" slot="operator"> <Auth auth="sysDictData:add" slot="operator">
<a-button @click="onOpen('add-form')" icon="plus">新增字典数据</a-button> <a-button @click="onOpen('add-form')" icon="plus">新增字典数据</a-button>
</Auth> </Auth>

View File

@@ -2,27 +2,21 @@
<container> <container>
<br /> <br />
<a-card :bordered="false"> <a-card :bordered="false">
<Auth auth="sysDictType:page"> <yo-table
<div class="yo-query-bar"> :columns="columns"
<a-form-model :model="query" layout="inline"> :load-data="loadData"
<!-- 此处添加查询表单控件 --> @query="onQuery"
@resetQuery="onResetQuery"
ref="table"
>
<Auth auth="sysDictType:page" slot="query">
<a-form-model-item label="类型名称"> <a-form-model-item label="类型名称">
<a-input placeholder="请输入类型名称" v-model="query.name" /> <a-input placeholder="请输入类型名称" v-model="query.name" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="唯一编码"> <a-form-model-item label="唯一编码">
<a-input placeholder="请输入唯一编码" v-model="query.code" /> <a-input placeholder="请输入唯一编码" v-model="query.code" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item>
<a-button-group>
<a-button @click="onQuery" type="primary">查询</a-button>
<a-button @click="onResetQuery">重置</a-button>
</a-button-group>
</a-form-model-item>
</a-form-model>
</div>
</Auth> </Auth>
<yo-table :columns="columns" :load-data="loadData" ref="table">
<Auth auth="sysDictType:add" slot="operator"> <Auth auth="sysDictType:add" slot="operator">
<a-button @click="onOpen('add-form')" icon="plus">新增字典类型</a-button> <a-button @click="onOpen('add-form')" icon="plus">新增字典类型</a-button>
</Auth> </Auth>

View File

@@ -2,7 +2,7 @@
<section> <section>
<p> <p>
当前版本 当前版本
<a-tag>1.1</a-tag> <a-tag>1.2</a-tag>
</p> </p>
<Highlight :code="codes['/seed/query.vue']" language="html" /> <Highlight :code="codes['/seed/query.vue']" language="html" />
</section> </section>

View File

@@ -2,7 +2,7 @@
<section> <section>
<p> <p>
当前版本 当前版本
<a-tag>1.0</a-tag> <a-tag>1.1</a-tag>
</p> </p>
<Highlight :code="codes['/seed/treeLayout.vue']" language="html" /> <Highlight :code="codes['/seed/treeLayout.vue']" language="html" />
</section> </section>