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"
<a-form-model-item> @resetQuery="onResetQuery"
<a-button-group> ref="table"
<a-button @click="onQuery" type="primary">查询</a-button> >
<a-button @click="onResetQuery">重置</a-button> <Auth auth="authCode:page" slot="query">
</a-button-group> <!-- 此处添加查询表单控件 -->
</a-form-model-item> </Auth>
</a-form-model>
</div>
</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,40 +7,35 @@
> >
<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"
<a-form-model-item> @resetQuery="onResetQuery"
<a-button-group> ref="table"
<a-button @click="onQuery" type="primary">查询</a-button> >
<a-button @click="onReset">重置</a-button> <Auth auth="authCode:page" slot="query">
</a-button-group> <!-- 此处添加查询表单控件 -->
</a-form-model-item> </Auth>
</a-form-model> <Auth auth="authCode:add" slot="operator">
</div> <a-button @click="onOpen('add-form')" icon="plus">新增机构</a-button>
</Auth>
<yo-table :columns="columns" :load-data="loadData" ref="table"> <!-- 格式化字段内容 -->
<Auth auth="authCode:add" slot="operator"> <!-- 添加操作控件 -->
<a-button @click="onOpen('add-form')" icon="plus">新增机构</a-button> <span slot="action" slot-scope="text, record">
</Auth> <yo-table-actions>
<!-- 格式化字段内容 --> <Auth auth="authCode:edit">
<!-- 添加操作控件 --> <a @click="onOpen('edit-form', record)">编辑</a>
<span slot="action" slot-scope="text, record"> </Auth>
<yo-table-actions> <Auth auth="authCode:delete">
<Auth auth="authCode:edit"> <a-popconfirm @confirm="onDelete(record)" placement="topRight" title="是否确认删除">
<a @click="onOpen('edit-form', record)">编辑</a> <a>删除</a>
</Auth> </a-popconfirm>
<Auth auth="authCode:delete"> </Auth>
<a-popconfirm @confirm="onDelete(record)" placement="topRight" title="是否确认删除"> <!-- 可在此处添加其他操作控件 -->
<a>删除</a> </yo-table-actions>
</a-popconfirm> </span>
</Auth> </yo-table>
<!-- 可在此处添加其他操作控件 -->
</yo-table-actions>
</span>
</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"
<a-form-model-item> @resetQuery="onResetQuery"
<a-button-group> ref="table"
<a-button @click="onQuery" type="primary">查询</a-button> >
<a-button @click="onResetQuery">重置</a-button> <Auth auth="authCode:page" slot="query">
</a-button-group> <!-- 此处添加查询表单控件 -->
</a-form-model-item> </Auth>
</a-form-model>
</div>
</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,40 +7,35 @@
> >
<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"
<a-form-model-item> @resetQuery="onResetQuery"
<a-button-group> ref="table"
<a-button @click="onQuery" type="primary">查询</a-button> >
<a-button @click="onReset">重置</a-button> <Auth auth="authCode:page" slot="query">
</a-button-group> <!-- 此处添加查询表单控件 -->
</a-form-model-item> </Auth>
</a-form-model> <Auth auth="authCode:add" slot="operator">
</div> <a-button @click="onOpen('add-form')" icon="plus">新增机构</a-button>
</Auth>
<yo-table :columns="columns" :load-data="loadData" ref="table"> <!-- 格式化字段内容 -->
<Auth auth="authCode:add" slot="operator"> <!-- 添加操作控件 -->
<a-button @click="onOpen('add-form')" icon="plus">新增机构</a-button> <span slot="action" slot-scope="text, record">
</Auth> <yo-table-actions>
<!-- 格式化字段内容 --> <Auth auth="authCode:edit">
<!-- 添加操作控件 --> <a @click="onOpen('edit-form', record)">编辑</a>
<span slot="action" slot-scope="text, record"> </Auth>
<yo-table-actions> <Auth auth="authCode:delete">
<Auth auth="authCode:edit"> <a-popconfirm @confirm="onDelete(record)" placement="topRight" title="是否确认删除">
<a @click="onOpen('edit-form', record)">编辑</a> <a>删除</a>
</Auth> </a-popconfirm>
<Auth auth="authCode:delete"> </Auth>
<a-popconfirm @confirm="onDelete(record)" placement="topRight" title="是否确认删除"> <!-- 可在此处添加其他操作控件 -->
<a>删除</a> </yo-table-actions>
</a-popconfirm> </span>
</Auth> </yo-table>
<!-- 可在此处添加其他操作控件 -->
</yo-table-actions>
</span>
</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"
<a-form-model-item label="文本"> @resetQuery="onResetQuery"
<a-input placeholder="请输入文本" v-model="query.value" /> ref="table"
</a-form-model-item> >
<a-form-model-item label="字典值"> <Auth auth="sysDictData:page" slot="query">
<a-input placeholder="请输入字典值" v-model="query.code" /> <a-form-model-item label="文本">
</a-form-model-item> <a-input placeholder="请输入文本" v-model="query.value" />
<a-form-model-item> </a-form-model-item>
<a-button-group> <a-form-model-item label="字典值">
<a-button @click="onQuery" type="primary">查询</a-button> <a-input placeholder="请输入字典值" v-model="query.code" />
<a-button @click="onResetQuery">重置</a-button> </a-form-model-item>
</a-button-group> </Auth>
</a-form-model-item>
</a-form-model>
</div>
</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"
<a-form-model-item label="类型名称"> @resetQuery="onResetQuery"
<a-input placeholder="请输入类型名称" v-model="query.name" /> ref="table"
</a-form-model-item> >
<a-form-model-item label="唯一编码"> <Auth auth="sysDictType:page" slot="query">
<a-input placeholder="请输入唯一编码" v-model="query.code" /> <a-form-model-item label="类型名称">
</a-form-model-item> <a-input placeholder="请输入类型名称" v-model="query.name" />
<a-form-model-item> </a-form-model-item>
<a-button-group> <a-form-model-item label="唯一编码">
<a-button @click="onQuery" type="primary">查询</a-button> <a-input placeholder="请输入唯一编码" v-model="query.code" />
<a-button @click="onResetQuery">重置</a-button> </a-form-model-item>
</a-button-group> </Auth>
</a-form-model-item>
</a-form-model>
</div>
</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>