Commit 7df316df authored by 何虹's avatar 何虹 💬

升级表格组件

parent 118ef195
...@@ -49,8 +49,8 @@ ...@@ -49,8 +49,8 @@
:row-style='setRowStyle' :row-style='setRowStyle'
> >
<template v-for='(column,index) in tableColumns'> <template v-for='(columnItem,index) in tableColumns'>
<template v-if="!column.childs"> <template v-if="!columnItem.childs">
<u-table-column <u-table-column
v-if='tableConfig.expandChild' v-if='tableConfig.expandChild'
:key="index" :key="index"
...@@ -61,20 +61,20 @@ ...@@ -61,20 +61,20 @@
</template> </template>
</u-table-column> </u-table-column>
<u-table-column <u-table-column
v-else-if="column.showType==='index'" v-else-if="columnItem.showType==='index'"
:key="index" :key="index"
type="index" type="index"
width="55" width="55"
/> />
<u-table-column <u-table-column
v-else-if="column.showType==='selection'" v-else-if="columnItem.showType==='selection'"
:key="index" :key="index"
type="selection" type="selection"
width="55" width="55"
:selectable="selectable" :selectable="selectable"
/> />
<u-table-column <u-table-column
v-else-if='column.showType==="handleColumn"' v-else-if='columnItem.showType==="handleColumn"'
:key="index" :key="index"
fixed="right" fixed="right"
label="操作" label="操作"
...@@ -93,43 +93,49 @@ ...@@ -93,43 +93,49 @@
<u-table-column <u-table-column
v-else v-else
:key="index" :key="index"
:resizable="column.resizable" :resizable="columnItem.resizable"
:show-overflow-tooltip="column.showOverflow" :show-overflow-tooltip="columnItem.showOverflow"
:prop="column.prop" :prop="columnItem.prop"
:label="column.label" :label="columnItem.label"
:fixed="column.fixed" :fixed="columnItem.fixed"
:min-width="column.width||80" :min-width="columnItem.width||80"
:sortable="column.isSort?'custom':false" :sortable="columnItem.isSort?'custom':false"
> >
<template v-slot:header>
<span v-if="columnItem.isRequired" :class="{'is-isRequired': columnItem.isRequired}">
*
</span>
<span>{{ columnItem.label }}</span>
</template>
<template slot-scope="scope"> <template slot-scope="scope">
<i <i
v-if="column.type==='checkBox'" v-if="columnItem.type==='checkBox'"
:class="rowCellBoolean(scope.row[column.prop])" :class="rowCellBoolean(scope.row[columnItem.prop])"
></i> ></i>
<childItem <childItem
v-else v-else
:editable='editable' :editable='editable'
v-bind="$attrs" v-bind="$attrs"
v-on="$listeners" v-on="$listeners"
:item='column' :item='columnItem'
:prop="column.prop" :prop="columnItem.prop"
:formParms='scope.row' :formParms='scope.row'
> >
</childItem> </childItem>
</template> </template>
</u-table-column> </u-table-column>
</template> </template>
<template v-else-if='column.childs'> <template v-else-if='columnItem.childs'>
<u-table-column <u-table-column
:label="column.label" :label="columnItem.label"
:key="index" :key="index"
> >
<template v-for="item in column.childs"> <template v-for="item in columnItem.childs">
<u-table-column <u-table-column
:prop="item.prop" :prop="item.prop"
:label="item.label" :label="item.label"
:key="item.label" :key="item.label"
:min-width="column.width||80" :min-width="item.width||80"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<childItem <childItem
...@@ -230,6 +236,12 @@ ...@@ -230,6 +236,12 @@
:min-width="column.width||80" :min-width="column.width||80"
:sortable="column.isSort" :sortable="column.isSort"
> >
<template v-slot:header>
<span v-if="column.isRequired" :class="{'is-isRequired': column.isRequired}">
*
</span>
<span>{{ column.label }}</span>
</template>
<template slot-scope="scope"> <template slot-scope="scope">
<i <i
v-if="column.type==='checkBox'" v-if="column.type==='checkBox'"
...@@ -432,6 +444,10 @@ export default { ...@@ -432,6 +444,10 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
getRequired(item) {
console.log(item)
return true
},
tableDoLayout() { tableDoLayout() {
this.$refs.plTable.doLayout() this.$refs.plTable.doLayout()
}, },
...@@ -1067,5 +1083,8 @@ export default { ...@@ -1067,5 +1083,8 @@ export default {
td { td {
height: 35px !important; height: 35px !important;
} }
.is-isRequired{
color: red;
}
</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