主页
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<!--<div class="table-page-search-wrapper">-->
<!--<a-form layout="inline" @keyup.enter.native="searchQuery">-->
<!--<a-row :gutter="24">-->
<!--</a-row>-->
<!--</a-form>-->
<!--</div>-->
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="姓名">
<a-input placeholder="请输入姓名" v-model="queryParam.name"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="父亲姓名">
<a-input placeholder="请输入父亲姓名" v-model="queryParam.fatherName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="母亲姓名">
<a-input placeholder="请输入母亲姓名" v-model="queryParam.motherName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="性别">
<j-dict-select-tag type="radio" placeholder="请选则性别" dictCode="sb" v-model="queryParam.sex"></j-dict-select-tag>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="班级">
<j-search-select-tag type="list" placeholder="请选择班级" :dictOptions="ipdata" v-model="queryParam.banji"></j-search-select-tag>
</a-form-item>
</a-col>
<!--<a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!--<a-form-item label="年龄">-->
<!--<j-input placeholder="请输入年龄" v-model="queryParam.age"></j-input>-->
<!--</a-form-item>-->
<!--</a-col>-->
<a-col :md="6" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="findByif" icon="search">查询t</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button @click="fffdzzz" type="primary" icon="plus">新增2</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('人')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
:scroll="{x:true}"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑 </a>
<a @click="myhandleEdit(record)"> 编辑t</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => myhandleDelete(record.id)">
<a>删除t</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<people-modal ref="modalForm" @ok="modalFormOk" @haha="aahaha"></people-modal>
<people-modalt ref="pmt" @ok="modalFormOk" ></people-modalt>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import PeopleModal from './modules/PeopleModal'
import PeopleModalt from './modules/PeopleModal'
import JSuperQuery from '@/components/jeecg/JSuperQuery.vue'
import AFormItem from 'ant-design-vue/es/form/FormItem'
import { deleteAction, getAction,postAction,downFile,getFileAccessHttpUrl } from '@/api/manage'
import ACol from 'ant-design-vue/es/grid/Col'
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
import JDate from '@/components/jeecg/JDate'
import PeopleForm from './modules/PeopleForm'
export default {
name: 'PeopleList',
mixins:[JeecgListMixin, mixinDevice],
components: {
PeopleForm,
ACol,
AFormItem,
PeopleModal,
JSuperQuery,
JDate,
PeopleModalt,
JDictSelectTag
},
data () {
return {
description: '人管理页面',
// 表头
ipdata:[],
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'名称',
align:"center",
dataIndex: 'name'
},
{
title:'爱好',
align:"center",
dataIndex: 'likeWhat'
},
{
title:'父亲名称',
align:"center",
dataIndex: 'fatherName'
},
{
title:'母亲名称',
align:"center",
dataIndex: 'motherName'
},
{
title:'性别',
align:"center",
dataIndex: 'sex_dictText'
},
{
title:'班级',
align:"center",
dataIndex: 'banji_dictText'
},
{
title:'入学时间',
align:"center",
dataIndex: 'rxsj'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/people/people/list",
delete: "/people/people/deleteById",
deleteBatch: "/people/people/deleteBatch",
exportXlsUrl: "/people/people/exportXls",
importExcelUrl: "people/people/importExcel",
lister:"/people/people/lister",
ipList:"/peoBanji/banji/lister",
},
dictOptions:{},
superFieldList:[],
queryParam:{
sex: '2'
},
}
},
created() {
this.getSuperFieldList();
this.getIpData();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
findByif(arg) {
if(!this.url.list){
this.$message.error("请设置url.list属性!")
return
}
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1;
}
var params = this.getQueryParams();//查询条件
this.loading = true;
getAction(this.url.lister, params).then((res) => {
if (res.success) {
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
this.dataSource = res.result.records||res.result;
if(res.result.total)
{
this.ipagination.total = res.result.total;
}else{
this.ipagination.total = 0;
}
//update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
}
if(res.code===510){
this.$message.warning(res.message)
}
this.loading = false;
})
},
myhandleDelete: function (id) {
var that = this;
deleteAction(that.url.delete, {id: id}).then((res) => {
if (res.success) {
that.$message.success(res.message);
that.loadData();
} else {
that.$message.warning(res.message);
}
});
},
myhandleEdit(record) {
this.$refs.pmt.edit(record);
this.$refs.pmt.title = "编辑";
this.$refs.pmt.disableSubmit = false;
},
fffdzzz(){
this.$refs.pmt.add();
this.$refs.title="添加新人"
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'string',value:'name',text:'名称',dictCode:''})
fieldList.push({type:'string',value:'likeWhat',text:'爱好',dictCode:''})
fieldList.push({type:'string',value:'fatherName',text:'父亲姓名',dictCode:''})
fieldList.push({type:'string',value:'motherName',text:'母亲姓名',dictCode:''})
this.superFieldList = fieldList
},
aahaha(){
console.log("我是通过子调父实现的方法")
},
getIpData(){
getAction(this.url.ipList).then((res)=>{
if(res.success){
const result = res.result.records||res.result;
result.forEach((r)=>{
this.ipdata.push({
value:r.id,
text:r.bjmc
})
})
}
})
}
}
}
</script>
<style scoped>
/*@import '~@assets/less/common.less';*/
</style>
form页面
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<!--<div class="table-page-search-wrapper">-->
<!--<a-form layout="inline" @keyup.enter.native="searchQuery">-->
<!--<a-row :gutter="24">-->
<!--</a-row>-->
<!--</a-form>-->
<!--</div>-->
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="姓名">
<a-input placeholder="请输入姓名" v-model="queryParam.name"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="父亲姓名">
<a-input placeholder="请输入父亲姓名" v-model="queryParam.fatherName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="母亲姓名">
<a-input placeholder="请输入母亲姓名" v-model="queryParam.motherName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="性别">
<j-dict-select-tag type="radio" placeholder="请选则性别" dictCode="sb" v-model="queryParam.sex"></j-dict-select-tag>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="班级">
<j-search-select-tag type="list" placeholder="请选择班级" :dictOptions="ipdata" v-model="queryParam.banji"></j-search-select-tag>
</a-form-item>
</a-col>
<!--<a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!--<a-form-item label="年龄">-->
<!--<j-input placeholder="请输入年龄" v-model="queryParam.age"></j-input>-->
<!--</a-form-item>-->
<!--</a-col>-->
<a-col :md="6" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="findByif" icon="search">查询t</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button @click="fffdzzz" type="primary" icon="plus">新增2</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('人')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
:scroll="{x:true}"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑 </a>
<a @click="myhandleEdit(record)"> 编辑t</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => myhandleDelete(record.id)">
<a>删除t</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<people-modal ref="modalForm" @ok="modalFormOk" @haha="aahaha"></people-modal>
<people-modalt ref="pmt" @ok="modalFormOk" ></people-modalt>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import PeopleModal from './modules/PeopleModal'
import PeopleModalt from './modules/PeopleModal'
import JSuperQuery from '@/components/jeecg/JSuperQuery.vue'
import AFormItem from 'ant-design-vue/es/form/FormItem'
import { deleteAction, getAction,postAction,downFile,getFileAccessHttpUrl } from '@/api/manage'
import ACol from 'ant-design-vue/es/grid/Col'
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
import JDate from '@/components/jeecg/JDate'
import PeopleForm from './modules/PeopleForm'
export default {
name: 'PeopleList',
mixins:[JeecgListMixin, mixinDevice],
components: {
PeopleForm,
ACol,
AFormItem,
PeopleModal,
JSuperQuery,
JDate,
PeopleModalt,
JDictSelectTag
},
data () {
return {
description: '人管理页面',
// 表头
ipdata:[],
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'名称',
align:"center",
dataIndex: 'name'
},
{
title:'爱好',
align:"center",
dataIndex: 'likeWhat'
},
{
title:'父亲名称',
align:"center",
dataIndex: 'fatherName'
},
{
title:'母亲名称',
align:"center",
dataIndex: 'motherName'
},
{
title:'性别',
align:"center",
dataIndex: 'sex_dictText'
},
{
title:'班级',
align:"center",
dataIndex: 'banji_dictText'
},
{
title:'入学时间',
align:"center",
dataIndex: 'rxsj'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/people/people/list",
delete: "/people/people/deleteById",
deleteBatch: "/people/people/deleteBatch",
exportXlsUrl: "/people/people/exportXls",
importExcelUrl: "people/people/importExcel",
lister:"/people/people/lister",
ipList:"/peoBanji/banji/lister",
},
dictOptions:{},
superFieldList:[],
queryParam:{
sex: '2'
},
}
},
created() {
this.getSuperFieldList();
this.getIpData();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
findByif(arg) {
if(!this.url.list){
this.$message.error("请设置url.list属性!")
return
}
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1;
}
var params = this.getQueryParams();//查询条件
this.loading = true;
getAction(this.url.lister, params).then((res) => {
if (res.success) {
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
this.dataSource = res.result.records||res.result;
if(res.result.total)
{
this.ipagination.total = res.result.total;
}else{
this.ipagination.total = 0;
}
//update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
}
if(res.code===510){
this.$message.warning(res.message)
}
this.loading = false;
})
},
myhandleDelete: function (id) {
var that = this;
deleteAction(that.url.delete, {id: id}).then((res) => {
if (res.success) {
that.$message.success(res.message);
that.loadData();
} else {
that.$message.warning(res.message);
}
});
},
myhandleEdit(record) {
this.$refs.pmt.edit(record);
this.$refs.pmt.title = "编辑";
this.$refs.pmt.disableSubmit = false;
},
fffdzzz(){
this.$refs.pmt.add();
this.$refs.title="添加新人"
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'string',value:'name',text:'名称',dictCode:''})
fieldList.push({type:'string',value:'likeWhat',text:'爱好',dictCode:''})
fieldList.push({type:'string',value:'fatherName',text:'父亲姓名',dictCode:''})
fieldList.push({type:'string',value:'motherName',text:'母亲姓名',dictCode:''})
this.superFieldList = fieldList
},
aahaha(){
console.log("我是通过子调父实现的方法")
},
getIpData(){
getAction(this.url.ipList).then((res)=>{
if(res.success){
const result = res.result.records||res.result;
result.forEach((r)=>{
this.ipdata.push({
value:r.id,
text:r.bjmc
})
})
}
})
}
}
}
</script>
<style scoped>
/*@import '~@assets/less/common.less';*/
</style>
model页面
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<people-form ref="realForm" @ok="submitCallback" @haha="whaha" :disabled="disableSubmit"></people-form>
</j-modal>
</template>
<script>
import PeopleForm from './PeopleForm'
export default {
name: 'PeopleModal',
components: {
PeopleForm
},
data () {
return {
title:'',
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
whaha(){
this.$emit("haha");
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>
最后 style
<template>
<a-drawer
:title="title"
:width="width"
placement="right"
:closable="false"
@close="close"
:visible="visible">
<people-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></people-form>
<div class="drawer-footer">
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
</div>
</a-drawer>
</template>
<script>
import PeopleForm from './PeopleForm'
export default {
name: 'PeopleModal',
components: {
PeopleForm
},
data () {
return {
title:"操作",
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
});
},
close () {
this.$emit('close');
this.visible = false;
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: -8px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>