no message

This commit is contained in:
小陌 2023-09-13 18:43:36 +08:00
parent ae8d3f2714
commit 6155f74113
2 changed files with 33 additions and 26 deletions

View File

@ -85,7 +85,7 @@
<x-editor v-model="data[item.name]" v-bind="item.options"></x-editor> <x-editor v-model="data[item.name]" v-bind="item.options"></x-editor>
</template> </template>
<template v-else-if="item.component=='text'"> <template v-else-if="item.component=='text'">
<el-link type="info" :underline="false">{{ data[item.name] }}</el-link> <el-link type="info" :underline="false" v-copy="data[item.name]">{{ data[item.name] }}</el-link>
</template> </template>
<!-- avatar --> <!-- avatar -->
<template v-else-if="item.component=='avatar'"> <template v-else-if="item.component=='avatar'">

View File

@ -10,22 +10,23 @@
<div class="left-panel"> <div class="left-panel">
<el-date-picker v-model="date" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker> <el-date-picker v-model="date" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</div> </div>
<div class="right-panel">
<div class="right-panel-search">
<el-input v-model="search.keyword" placeholder="输入关键词" clearable></el-input>
<el-button type="primary" icon="el-icon-search" @click="upsearch"></el-button>
</div>
</div>
</el-header> </el-header>
<el-header style="height:120px;" v-if="typeof chartoption === 'object' && Object.keys(chartoption).length > 0"> <el-header style="height:120px;" v-if="typeof chartoption === 'object' && Object.keys(chartoption).length > 0">
<xEcharts height="100%" :option="chartoption"></xEcharts> <xEcharts height="100%" :option="chartoption"></xEcharts>
</el-header> </el-header>
<el-main class="nopadding"> <el-main class="nopadding">
<xTable ref="table" :api="api" :params="params" :tableColumn="tableColumn" stripe highlightCurrentRow @row-click="rowClick"> <xTable ref="table" :api="api" :params="search" :tableColumn="tableColumn" stripe highlightCurrentRow @row-click="rowClick">
<el-table-column type="index" width="60" align="center"> <el-table-column type="index" width="60" align="center">
<template #default="scope"> <template #default="scope">
<span>{{scope.$index+(currentPage - 1) * limit + 1}}</span> <span>{{scope.$index+(currentPage - 1) * limit + 1}}</span>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column v-bind="item" v-for="(item, index) in tableColumn" :key="index">
<template #default="scope">
<columnItem row="scope.row" :item="item"> </columnItem>
</template>
</el-table-column> -->
</xTable> </xTable>
</el-main> </el-main>
</el-container> </el-container>
@ -58,10 +59,10 @@
date: [], date: [],
data: [], data: [],
search: { search: {
keyword: "" keyword: this.$route.query.keyword || '',
type:this.$route.query.type || ''
}, },
api: '', api: '',
params: [],
current : '', current : '',
config : {}, config : {},
tableColumn : {}, tableColumn : {},
@ -77,23 +78,28 @@
//props //props
current(){ current(){
this.search.type = this.current;
this.getCurrent(); this.getCurrent();
}, },
}, },
methods: { methods: {
changeURLArg(url, arg, arg_val) {
changeURLArg(url,arg,arg_val){ var pattern = arg + '=([^&]*)';
var pattern=arg+'=([^&]*)'; if (arg_val === '') {
var replaceText=arg+'='+arg_val; url = url.replace(new RegExp('&?' + pattern, 'gi'), '');
if(url.match(pattern)){ url = url.replace(new RegExp('\\??' + pattern + '&?', 'gi'), '?');
var tmp='/('+ arg+'=)([^&]*)/gi'; return url;
tmp=url.replace(eval(tmp),replaceText); }
return tmp; var replaceText = arg + '=' + arg_val;
} if (url.match(pattern)) {
if (url.match('[?]')) { var tmp = '(' + arg + '=)([^&]*)';
return url+'&'+replaceText; tmp = url.replace(new RegExp(tmp, 'gi'), replaceText);
} return tmp;
return url+'?'+replaceText; }
if (url.match('[?]')) {
return url + '&' + replaceText;
}
return url + '?' + replaceText;
}, },
// //
nodeClick(data){ nodeClick(data){
@ -104,7 +110,7 @@
this.column = data.column || 'column'; this.column = data.column || 'column';
}, },
getType(){ getType(){
this.$http.get('log/admin/types', {type:this.$route.query.type||''}, { cacheparameters: true }).then((res) => { this.$http.get('log/admin/types', {type:this.search.type}, { cacheparameters: true }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
Object.assign(this.$data, res.data); Object.assign(this.$data, res.data);
} }
@ -115,13 +121,14 @@
if (!this.api) { if (!this.api) {
this.api = 'log/admin/lists' this.api = 'log/admin/lists'
} }
this.params = { type: this.current }
this.$refs.table.reload(this.params) this.$refs.table.reload(this.search)
var url = this.changeURLArg(window.location.href, 'type', this.current ) var url = this.changeURLArg(window.location.href, 'type', this.current )
url = this.changeURLArg(url, 'keyword', this.search.keyword )
history.replaceState(Object.assign({},window.history.state,{url: url}), 'null', url); history.replaceState(Object.assign({},window.history.state,{url: url}), 'null', url);
}, },
upsearch(){ upsearch(){
this.getCurrent()
}, },
rowClick(row){ rowClick(row){
this.infoDrawer = true this.infoDrawer = true