diff --git a/jero-web/src/components/tableCollection/historyTable.vue b/jero-web/src/components/tableCollection/historyTable.vue new file mode 100644 index 000000000..aac6eeaf3 --- /dev/null +++ b/jero-web/src/components/tableCollection/historyTable.vue @@ -0,0 +1,39 @@ + + + + + \ No newline at end of file diff --git a/jero-web/src/components/tableCollection/index.vue b/jero-web/src/components/tableCollection/index.vue index 8dafa8e93..93cdde5f7 100644 --- a/jero-web/src/components/tableCollection/index.vue +++ b/jero-web/src/components/tableCollection/index.vue @@ -3,6 +3,7 @@
- - - - - - - - - - {{text && text.length > 10?text.slice(0,9)+'...':text}} - - - + + + + + + + + + + + + + + + + + + + + + + +
{ - 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{ diff --git a/jero-web/src/mixins/header.js b/jero-web/src/mixins/header.js index 0671cd769..d7211c7ec 100644 --- a/jero-web/src/mixins/header.js +++ b/jero-web/src/mixins/header.js @@ -5,9 +5,10 @@ const events = { move: 'mousemove', stop: 'mouseup' } -let tableAll = [] +let tableAll = [] // 单个页面存放多个表格的columns var columnsAll = [] var columnsKey = '' +let minColumn = [] // 存放设置最小宽的列及宽度 const DragHandler = { name: 'nio-drag-handler', //获取混入的方法(重新设置表头宽度) @@ -86,9 +87,10 @@ const DragHandler = { return h('div', { class: 'nio-drag-handler', on: { mousedown: this.handleMouseDown } }, [line]) } } -const ResizeHeaderOne = function(val, name) { +const ResizeHeaderOne = function(val, name ,minWidths) { columnsAll = val columnsKey = name + minColumn = minWidths if(tableAll.indexOf(val) === -1){ tableAll.push(val) } @@ -96,16 +98,44 @@ const ResizeHeaderOne = function(val, name) { const { key, column, ...restProps } = props let col = {} // 处理多级表头 - col = getRenderCoL(key, val) + // col = getRenderCoL(key, val) + col = getRenderCoL(key, columnsAll) let content = [].concat(children) + console.log(col) if (col) { - const handlerVNode = h(DragHandler, { - props: { - width: col.width, - minWidth: Math.min(col.width, 100), - column: col + let handlerVNode; + if(minColumn && minColumn.length>0){ + // 存放所有需要手动设置最小宽度的列的dataIndex + let colsdataIndex = [] + minColumn.forEach((item)=>{ + colsdataIndex.push(item[0].dataIndex) + handlerVNode = h(DragHandler, { + props: { + width: col.width, + minWidth: Math.min(item[1]), + column: JSON.parse(JSON.stringify(item[0])) + } + }, []) + }) + // 不需要手动设置最小宽度的列 + if(colsdataIndex.indexOf(col.dataIndex) === -1){ + handlerVNode = h(DragHandler, { + props: { + width: col.width, + minWidth: Math.min(col.width, 100), + column: col + } + }, []) } - }, []) + }else{ + handlerVNode = h(DragHandler, { + props: { + width: col.width, + minWidth: Math.min(col.width, 100), + column: col + } + }, []) + } content = content.concat( handlerVNode ) @@ -119,10 +149,11 @@ const ResizeHeaderOne = function(val, name) { } export const ResizeHeader = { methods: { - drag(columns, name) { + drag(columns, name ,minWidths) { return { header: { - cell: ResizeHeaderOne(columns, name) + // minWidths : 最小宽度 => [[需要设置的列,最小宽],[需要设置的列,最小宽],...] + cell: ResizeHeaderOne(columns, name,minWidths) } } }