拖拽-可设置最小宽度
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<a-table
|
||||
:components="drag(columnshistory,'columns')"
|
||||
class="table"
|
||||
:columns="columnshistory"
|
||||
:pagination="false"
|
||||
:scroll="{y: 400}"
|
||||
:data-source="dataSourcehistory"
|
||||
:loading="loading"
|
||||
>
|
||||
<span slot="content" slot-scope="text,record">
|
||||
<a-tooltip placement="topLeft">
|
||||
<template slot="title">
|
||||
<span v-html="text"></span>
|
||||
</template>
|
||||
<span v-html="text"></span>
|
||||
</a-tooltip>
|
||||
</span>
|
||||
<span slot="detailText" slot-scope="text,record">
|
||||
<span class="text" :title="text">
|
||||
{{text && text.length > 10?text.slice(0,9)+'...':text}}
|
||||
</span>
|
||||
</span>
|
||||
</a-table>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
|
||||
export default {
|
||||
name: 'historyTable.vue',
|
||||
props:['columnshistory','dataSourcehistory'],
|
||||
mixins:[ResizeHeader, ResizeColumnProvide],
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -3,6 +3,7 @@
|
||||
<div class="box">
|
||||
<!-- -->
|
||||
<a-table
|
||||
:components="drag(columns,'columns',JSON.parse(JSON.stringify([[columns[3],500]])))"
|
||||
class="table"
|
||||
rowKey="id"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
||||
@@ -179,28 +180,29 @@
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<a-table
|
||||
class="table"
|
||||
:columns="columnshistory"
|
||||
:pagination="false"
|
||||
:scroll="{y: 400}"
|
||||
:data-source="dataSourcehistory"
|
||||
:loading="loading"
|
||||
>
|
||||
<span slot="content" slot-scope="text,record">
|
||||
<a-tooltip placement="topLeft">
|
||||
<template slot="title">
|
||||
<span v-html="text"></span>
|
||||
</template>
|
||||
<span v-html="text"></span>
|
||||
</a-tooltip>
|
||||
</span>
|
||||
<span slot="detailText" slot-scope="text,record">
|
||||
<span class="text" :title="text">
|
||||
{{text && text.length > 10?text.slice(0,9)+'...':text}}
|
||||
</span>
|
||||
</span>
|
||||
</a-table>
|
||||
<historyTable :columnshistory='columnshistory' :dataSourcehistory='dataSourcehistory'></historyTable>
|
||||
<!-- <a-table-->
|
||||
<!-- class="table"-->
|
||||
<!-- :columns="columnshistory"-->
|
||||
<!-- :pagination="false"-->
|
||||
<!-- :scroll="{y: 400}"-->
|
||||
<!-- :data-source="dataSourcehistory"-->
|
||||
<!-- :loading="loading"-->
|
||||
<!-- >-->
|
||||
<!-- <span slot="content" slot-scope="text,record">-->
|
||||
<!-- <a-tooltip placement="topLeft">-->
|
||||
<!-- <template slot="title">-->
|
||||
<!-- <span v-html="text"></span>-->
|
||||
<!-- </template>-->
|
||||
<!-- <span v-html="text"></span>-->
|
||||
<!-- </a-tooltip>-->
|
||||
<!-- </span>-->
|
||||
<!-- <span slot="detailText" slot-scope="text,record">-->
|
||||
<!-- <span class="text" :title="text">-->
|
||||
<!-- {{text && text.length > 10?text.slice(0,9)+'...':text}}-->
|
||||
<!-- </span>-->
|
||||
<!-- </span>-->
|
||||
<!-- </a-table>-->
|
||||
<div class="page" v-if="dataSourcehistory.length > 0">
|
||||
<a-pagination
|
||||
:show-total="total => $t('total')+` ${total} `+$t('strip')"
|
||||
@@ -271,11 +273,14 @@
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import axios from 'axios'
|
||||
import Vue from 'vue'
|
||||
import VueDraggableResizable from 'vue-draggable-resizable'
|
||||
// import VueDraggableResizable from 'vue-draggable-resizable'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
|
||||
import historyTable from './historyTable.vue'
|
||||
|
||||
export default {
|
||||
name: 'index',
|
||||
mixins:[ResizeHeader, ResizeColumnProvide],
|
||||
props: {
|
||||
//接口
|
||||
url: {
|
||||
@@ -304,47 +309,48 @@
|
||||
},
|
||||
components: {
|
||||
CollectionType,
|
||||
VueDraggableResizable
|
||||
// VueDraggableResizable
|
||||
historyTable
|
||||
},
|
||||
data() {
|
||||
this.components = {
|
||||
header: {
|
||||
cell: (h, props, children) => {
|
||||
const { key, ...restProps } = props
|
||||
|
||||
// 此处的this.columns 是定义的table的表头属性变量
|
||||
|
||||
const col = this.columns.find((col) => {
|
||||
const k = col.dataIndex || col.key
|
||||
return k === key
|
||||
})
|
||||
|
||||
if (!col || !col.width) {
|
||||
return h('th', { ...restProps }, [...children])
|
||||
}
|
||||
|
||||
const dragProps = {
|
||||
key: col.dataIndex || col.key,
|
||||
class: 'table-draggable-handle',
|
||||
attrs: {
|
||||
w: 10,
|
||||
x: col.width,
|
||||
z: 1,
|
||||
axis: 'x',
|
||||
draggable: false,
|
||||
resizable: false
|
||||
},
|
||||
on: {
|
||||
dragging: (x, y) => {
|
||||
col.width = Math.max(x, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
const drag = h('vue-draggable-resizable', { ...dragProps })
|
||||
return h('th', { ...restProps, class: 'resize-table-th' }, [...children, drag])
|
||||
}
|
||||
}
|
||||
}
|
||||
// this.components = {
|
||||
// header: {
|
||||
// cell: (h, props, children) => {
|
||||
// const { key, ...restProps } = props
|
||||
//
|
||||
// // 此处的this.columns 是定义的table的表头属性变量
|
||||
//
|
||||
// const col = this.columns.find((col) => {
|
||||
// const k = col.dataIndex || col.key
|
||||
// return k === key
|
||||
// })
|
||||
//
|
||||
// if (!col || !col.width) {
|
||||
// return h('th', { ...restProps }, [...children])
|
||||
// }
|
||||
//
|
||||
// const dragProps = {
|
||||
// key: col.dataIndex || col.key,
|
||||
// class: 'table-draggable-handle',
|
||||
// attrs: {
|
||||
// w: 10,
|
||||
// x: col.width,
|
||||
// z: 1,
|
||||
// axis: 'x',
|
||||
// draggable: false,
|
||||
// resizable: false
|
||||
// },
|
||||
// on: {
|
||||
// dragging: (x, y) => {
|
||||
// col.width = Math.max(x, 1)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// const drag = h('vue-draggable-resizable', { ...dragProps })
|
||||
// return h('th', { ...restProps, class: 'resize-table-th' }, [...children, drag])
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return {
|
||||
token: Vue.ls.get(ACCESS_TOKEN),
|
||||
jsonBody: [],
|
||||
@@ -411,14 +417,15 @@
|
||||
{
|
||||
title: this.$t('OperationDetails'),
|
||||
dataIndex: 'logContent',
|
||||
align: 'center',
|
||||
align: 'left',
|
||||
width: 320,
|
||||
ellipsis: true,
|
||||
scopedSlots: { customRender: 'content' }
|
||||
},
|
||||
{
|
||||
title: this.$t('OperationTime'),
|
||||
dataIndex: 'createTime',
|
||||
align: 'center',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
width: 180
|
||||
}
|
||||
@@ -767,10 +774,10 @@
|
||||
let num = 0
|
||||
this.content = []
|
||||
jsonHead.forEach((res, index) => {
|
||||
console.log(res)
|
||||
// console.log(res)
|
||||
// 配置列
|
||||
if (res.type) {
|
||||
console.log('配置')
|
||||
// console.log('配置')
|
||||
this.columns.push({
|
||||
dataIndex: res.db_field_name,
|
||||
align: 'left',
|
||||
@@ -965,7 +972,7 @@
|
||||
Object.keys(Obj).forEach((item) => {
|
||||
if (Obj[item] instanceof Object && Obj[item].controlType !== undefined) {
|
||||
Obj[item].list.forEach((itemLi) => {
|
||||
console.log(item)
|
||||
// console.log(item)
|
||||
if((this.currentPersonRole == 'homo' || this.currentPersonRole == 'admin') && item == 'referencesCol'){
|
||||
itemLi.isLock = 0
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user