Commit a4b89b0b by 蒋勇

d

parent 56837163
......@@ -3,7 +3,7 @@
<div v-if="searchable && searchPlace === 'top'" class="search-con search-con-top">
<Select v-model="searchKey" class="search-col">
<Option
v-for="item in columns"
v-for="item in searchcols"
v-if="item.key !== 'handle'"
:value="item.key"
:key="`search-col-${item.key}`"
......@@ -54,7 +54,7 @@
<div v-if="searchable && searchPlace === 'bottom'" class="search-con search-con-top">
<Select v-model="searchKey" class="search-col">
<Option
v-for="item in columns"
v-for="item in searchcols"
v-if="item.key !== 'handle'"
:value="item.key"
:key="`search-col-${item.key}`"
......@@ -271,19 +271,22 @@ export default {
},
setDefaultSearchKey() {
this.searchKey =
this.columns[0].key !== "handle"
? this.columns[0].key
: this.columns.length > 1
? this.columns[1].key
this.searchcols[0].key !== "handle"
? this.searchcols[0].key
: this.searchcols.length > 1
? this.searchcols[1].key
: "";
},
handleClear(e) {
if (e.target.value === "") this.insideTableData = this.value;
},
handleSearch() {
this.insideTableData = this.value.filter(
item => item[this.searchKey].indexOf(this.searchValue) > -1
);
// this.insideTableData = this.value.filter(
// item => item[this.searchKey].indexOf(this.searchValue) > -1
// );
let eobj={};
eobj[this.searchKey]=this.searchValue
this.$emit("on-rapid-query",eobj)
},
handleTableData() {
this.insideTableData = this.value.map((item, index) => {
......@@ -343,6 +346,11 @@ export default {
this.handleColumns(this.columns);
this.setDefaultSearchKey();
this.handleTableData();
},
computed:{
searchcols:function(){
return this.columns?this.columns.filter(item=>item.insearch):[]
}
}
};
</script>
......@@ -6,8 +6,23 @@ const { title, cookieExpires, useI18n } = config
export const TOKEN_KEY = 'token'
export const btnAuthFilter=(metainfo,access)=>{
console.log(".................................................",metainfo.list)
export const btnAuthFilter=(metainfo,user)=>{
// console.log(".................................................",metainfo.list)
// let authbtns=[]
// let keyswithauth=Object.keys(metainfo.auths).filter(authname=>{
// let hasAuth=user.access.some(authitem=>{
// return authitem.auths.indexOf(authname)>=0
// })
// return hasAuth
// })
// if(keyswithauth){
// keyswithauth.forEach(k=>{
// metainfo.auths[k].forEach(bt=>{
// authbtns.push(bt)
// })
// })
// }
// metainfo.auths=authbtns
return metainfo
}
......
export default {
bizCode:"userinfo",
name:"用户信息维护",
list: [
{ title: 'Name', key: 'name', sortable: true },
{ title: 'Email', key: 'email', editable: true },
{ title: 'Create-Time', key: 'createTime' },
{ title: '姓名', key: 'name', sortable: true ,insearch:true},
{ title: '邮件', key: 'email', editable: true,insearch:true},
{ title: '创建时间', key: 'createTime' },
{
title: 'Handle',
key: 'handle',
......@@ -48,7 +49,7 @@ export default {
]
},
],
"auth":{
"auths":{
"add":[
{"icon":"el-icon-plus","title":"新增","type":"default","key":"new","isOnGrid":true},
{"icon":"el-icon-save","title":"保存","type":"default","key":"save","isOnForm":true},
......
......@@ -6,7 +6,7 @@
<script>
import { refQuery } from "@/api/meta";
export default {
name: "rediogroups",
name: "radiogroups",
components: {},
model: {
prop: "value",
......
<template>
<div>
<Card>
<tables ref="tables" editable searchable search-place="top" v-model="tableData" :columns="columns" @on-exec="doexec"/>
<tables
ref="tables"
editable
searchable
search-place="top"
v-model="tableData"
:columns="columns"
@on-rapid-query="doquery"
@on-exec="doexec"
/>
<Button style="margin: 10px 0;" type="primary" @click="exportExcel">导出为Csv文件</Button>
<Forms :fminfo="forminfo"></Forms>
</Card>
......@@ -9,45 +18,67 @@
</template>
<script>
import Tables from '_c/tables'
import Forms from './forms/forms'
import { getTableData } from '@/api/data'
import Tables from "_c/tables";
import Forms from "./forms/forms";
import { getTableData } from "@/api/data";
export default {
name: 'tables_page',
name: "tables_page",
components: {
Tables,
Forms
},
props:{
metaName:String,
default:"user_info"
props: {
metaName: String,
default: "user_info"
},
data () {
this.metaName="user_info"
data() {
this.metaName = "user_info";
return {
forminfo:this.metaName?this.$store.getters[this.metaName]["form"]:{},
columns: this.metaName?this.$store.getters[this.metaName]["list"]:[],
forminfo: this.metaName ? this.$store.getters[this.metaName]["form"] : {},
columns: this.metaName ? this.$store.getters[this.metaName]["list"] : [],
authbtns: this.metaName
? this.$store.getters[this.metaName]["auths"]
: [],
tableData: []
}
};
},
methods: {
doexec (key,row) {
console.log(key,row)
doexec(key, row) {
console.log(key, row);
},
doquery(q) {
console.log(q);
},
exportExcel () {
exportExcel() {
this.$refs.tables.exportCsv({
filename: `table-${(new Date()).valueOf()}.csv`
})
filename: `table-${new Date().valueOf()}.csv`
});
}
},
mounted () {
mounted() {
getTableData().then(res => {
this.tableData = res.data
})
this.tableData = res.data;
});
},
computed: {
formbtns() {
return this.authbtns.filter(bt => {
return bt.isOnForm;
});
},
onlistbtns() {
return this.authbtns.filter(bt => {
return bt.isOnGrid;
});
},
inrowbtns() {
return this.authbtns.filter(bt => {
return bt.isInRow;
});
}
}
}
};
</script>
<style>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment