no message

This commit is contained in:
小陌 2023-08-08 15:40:11 +08:00
parent 37456883e6
commit 0fa943544c
3 changed files with 31 additions and 22 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<x-avatar v-if="item.columntype=='avatar' || item.component=='avatar'" :name="item.name" :options="item.options" v-model="row"></x-avatar> <x-avatar v-if="item.columntype=='avatar' || item.component=='avatar'" :name="item.name" :options="item.options"></x-avatar>
<el-badge v-else-if="item.columntype=='badge' || item.columntype=='imagegroup'" :value="getType(row[item.name])" :type="item.options.type || 'warning'"></el-badge> <el-badge v-else-if="item.columntype=='badge' || item.columntype=='imagegroup'" :value="getType(row[item.name])" :type="item.options.type || 'warning'"></el-badge>
<el-image v-else-if="item.columntype=='image'" :preview-src-list="[getImg(row[item.name])]" :preview-teleported="true" hide-on-click-modal="true" lazy="true" style="max-width: 60px; height: 26px; border-radius: 2px;" fit="cover" :src="getImg(row[item.name])"> <el-image v-else-if="item.columntype=='image'" :preview-src-list="[getImg(row[item.name])]" :preview-teleported="true" hide-on-click-modal="true" lazy="true" style="max-width: 60px; height: 26px; border-radius: 2px;" fit="cover" :src="getImg(row[item.name])">
<template #error> <template #error>
@ -39,27 +39,26 @@
<script> <script>
export default { export default {
name: 'xTablecolumnitem', name: 'XTableColumnItem',
props: { props: {
item: { type: Object, default: () => {} }, item: { type: Object, default: () => {} },
modelValue: { type: Array, default: () => [] }, row: { type: Object, default: () => {} },
}, },
watch: { // watch: {
// modelValue(newValue) {
// this.row = newValue;
// },
// },
// data() {
// return {
// row : this.modelValue,
// }
// },
// mounted() {
}, // },
computed: {
},
data() {
return {
row : this.modelValue,
}
},
mounted() {
},
methods: { methods: {
handleClick(row, item){ handleClick(row, item){
// //
if (item.update && (item.update.url || item.update.name)) { if (item.update && (item.update.url || item.update.name)) {
this.$emit('xtableupdate', row, { this.$emit('xtableupdate', row, {

View File

@ -8,14 +8,14 @@
<el-table-column :align="item.align || 'left'" :label="item.label" v-if="item.column && item.column.length>0"> <el-table-column :align="item.align || 'left'" :label="item.label" v-if="item.column && item.column.length>0">
<el-table-column v-for="(items, indexs) in item.column" :key="indexs" :align="items.align || 'left'" :column-key="items.prop||items.name" :label="items.label" :prop="items.prop||items.name" :width="items.width || 'auto'" :min-width="items.minWidth || 'auto'" :sortable="items.sortable" :fixed="items.fixed" :filters="items.filters" :filter-method="remoteFilter||!items.filters?null:filterHandler" :show-overflow-tooltip="items.showOverflowTooltip"> <el-table-column v-for="(items, indexs) in item.column" :key="indexs" :align="items.align || 'left'" :column-key="items.prop||items.name" :label="items.label" :prop="items.prop||items.name" :width="items.width || 'auto'" :min-width="items.minWidth || 'auto'" :sortable="items.sortable" :fixed="items.fixed" :filters="items.filters" :filter-method="remoteFilter||!items.filters?null:filterHandler" :show-overflow-tooltip="items.showOverflowTooltip">
<template #default="scope"> <template #default="scope">
<columnItem v-model="scope.row" :item="items" @xtableupdate="xtableupdate"> </columnItem> <columnItem :row="scope.row" :item="items" @xtableupdate="xtableupdate"> </columnItem>
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column v-else-if="!item.hide && (item.name || item.prop)" :align="item.align || 'left'" :column-key="item.prop||item.name" :label="item.label" :prop="item.prop||item.name" :width="item.width || 'auto'" :min-width="item.minWidth || 'auto'" :sortable="item.sortable" :fixed="item.fixed" :filters="item.filters" :filter-method="remoteFilter||!item.filters?null:filterHandler" :show-overflow-tooltip="item.showOverflowTooltip"> <el-table-column v-else-if="!item.hide && (item.name || item.prop)" :align="item.align || 'left'" :column-key="item.prop||item.name" :label="item.label" :prop="item.prop||item.name" :width="item.width || 'auto'" :min-width="item.minWidth || 'auto'" :sortable="item.sortable" :fixed="item.fixed" :filters="item.filters" :filter-method="remoteFilter||!item.filters?null:filterHandler" :show-overflow-tooltip="item.showOverflowTooltip">
<template #default="scope"> <template #default="scope">
<columnItem v-model="scope.row" :item="item" @xtableupdate="xtableupdate"> </columnItem> <columnItem :row="scope.row" :item="item" @xtableupdate="xtableupdate"> </columnItem>
</template> </template>
</el-table-column> </el-table-column>
</template> </template>
@ -224,8 +224,7 @@
this.summary = response.summary || {}; this.summary = response.summary || {};
this.loading = false; this.loading = false;
} }
this.$refs.xTable.setScrollTop(0)
// this.$refs.xTable.setScrollTop(0)
// //
this.$emit('dataChange', res, this.tableData) this.$emit('dataChange', res, this.tableData)
}); });

View File

@ -21,6 +21,11 @@
<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>
@ -36,11 +41,13 @@
<script> <script>
import info from './info' import info from './info'
import xEcharts from '@/components/xEcharts' import xEcharts from '@/components/xEcharts'
import columnItem from '@/components/xTable/columnItem'
export default { export default {
name: 'log', name: 'log',
components: { components: {
info, info,
columnItem,
xEcharts xEcharts
}, },
data() { data() {
@ -90,9 +97,13 @@
}); });
}, },
getCurrent(){ getCurrent(){
this.tableColumn = this.config[this.column] || this.config.default; if (Object.keys(this.tableColumn).length==0) {
this.tableColumn = this.config[this.column] || this.config.default;
}
if (!this.api) {
this.api = 'log/admin/lists'
}
this.params = { type: this.current } this.params = { type: this.current }
this.api = 'log/admin/lists'
this.$refs.table.reload(this.params) this.$refs.table.reload(this.params)
}, },
upsearch(){ upsearch(){