|
@@ -10,12 +10,13 @@
|
|
:stripe="attrs.stripe"
|
|
:stripe="attrs.stripe"
|
|
:border="attrs.border"
|
|
:border="attrs.border"
|
|
:align="attrs.align"
|
|
:align="attrs.align"
|
|
|
|
+ :tree-config="{transform: attrs.transform, rowField: attrs.rowField, parentField: attrs.parentField}"
|
|
:row-config="{isHover: true}"
|
|
:row-config="{isHover: true}"
|
|
style="width: 100%">
|
|
style="width: 100%">
|
|
|
|
|
|
<vxe-column v-if="attrs.checkbox" type="checkbox" width="50" fixed="left" />
|
|
<vxe-column v-if="attrs.checkbox" type="checkbox" width="50" fixed="left" />
|
|
<vxe-column v-if="attrs.radio" type="radio" width="50" fixed="left" />
|
|
<vxe-column v-if="attrs.radio" type="radio" width="50" fixed="left" />
|
|
- <vxe-column v-if="attrs.seq" type="seq" title="序号" width="50" fixed="left" />
|
|
|
|
|
|
+ <vxe-column v-if="attrs.seq" type="seq" title="序号" :width="attrs.seqWidth?attrs.seqWidth:50" fixed="left" :tree-node="attrs.treeNodeSeq" />
|
|
<template v-for="(item,index) in columns">
|
|
<template v-for="(item,index) in columns">
|
|
<vxe-column
|
|
<vxe-column
|
|
v-if="item.action"
|
|
v-if="item.action"
|
|
@@ -30,6 +31,7 @@
|
|
v-for="(pluginsItem,_index) of item.plugins"
|
|
v-for="(pluginsItem,_index) of item.plugins"
|
|
:key="'plu'+_index"
|
|
:key="'plu'+_index"
|
|
@click="pluginClick(pluginsItem,row)">
|
|
@click="pluginClick(pluginsItem,row)">
|
|
|
|
+ <i v-if="pluginsItem.icon" :class="pluginsItem.icon" ></i>
|
|
{{ pluginsItem.name }}
|
|
{{ pluginsItem.name }}
|
|
</span>
|
|
</span>
|
|
</template>
|
|
</template>
|
|
@@ -43,6 +45,7 @@
|
|
:width="item.width"
|
|
:width="item.width"
|
|
:fixed="item.fixed"
|
|
:fixed="item.fixed"
|
|
:align="item.align"
|
|
:align="item.align"
|
|
|
|
+ :tree-node="item.treeNode"
|
|
>
|
|
>
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
<slot v-if="item.slot" :name='item.field' :row='row'></slot>
|
|
<slot v-if="item.slot" :name='item.field' :row='row'></slot>
|
|
@@ -64,9 +67,14 @@
|
|
stripe: true/false //是否为斑马纹
|
|
stripe: true/false //是否为斑马纹
|
|
border: true/false //是否带有纵向边框
|
|
border: true/false //是否带有纵向边框
|
|
seq:true/false //显示序号
|
|
seq:true/false //显示序号
|
|
|
|
+ seqWidth:'' //序号宽度
|
|
checkbox: true/false //显示复选框
|
|
checkbox: true/false //显示复选框
|
|
radio:true/false //显示单选框
|
|
radio:true/false //显示单选框
|
|
align: left/center/right //对齐方式
|
|
align: left/center/right //对齐方式
|
|
|
|
+ transform: true/false //开启自动将列表转成树结构
|
|
|
|
+ rowField:'' row对应id
|
|
|
|
+ parentField:'' row父id
|
|
|
|
+
|
|
},
|
|
},
|
|
columns:[{
|
|
columns:[{
|
|
title:'' //标题
|
|
title:'' //标题
|
|
@@ -75,32 +83,23 @@
|
|
fixed: true, left, right // 固定列
|
|
fixed: true, left, right // 固定列
|
|
action: true/false 是否操作列
|
|
action: true/false 是否操作列
|
|
plugins:操作列执行
|
|
plugins:操作列执行
|
|
|
|
+ tree-node: true/false //展开节点
|
|
}],
|
|
}],
|
|
request:{}
|
|
request:{}
|
|
}
|
|
}
|
|
|
|
|
|
*/
|
|
*/
|
|
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
|
|
+import VueViews from '@/benyun/utils/VueViews'
|
|
|
|
+
|
|
@Component
|
|
@Component
|
|
-export default class ByTable extends Vue {
|
|
|
|
|
|
+export default class ByTable extends VueViews {
|
|
value:Array<any>=[];
|
|
value:Array<any>=[];
|
|
- config:any={}
|
|
|
|
-
|
|
|
|
- get requestConfig(){
|
|
|
|
- return this.config?.request ? this.config.request : null;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- get attrs(){
|
|
|
|
- return this.config?.attr ? this.config.attr : {};
|
|
|
|
- }
|
|
|
|
|
|
|
|
get columns(){
|
|
get columns(){
|
|
return this.config?.columns ? this.config.columns : [];
|
|
return this.config?.columns ? this.config.columns : [];
|
|
}
|
|
}
|
|
|
|
|
|
- @Prop()
|
|
|
|
- propConfig: any
|
|
|
|
-
|
|
|
|
created(){
|
|
created(){
|
|
if(this.propConfig){
|
|
if(this.propConfig){
|
|
this.setConfig(this.propConfig)
|
|
this.setConfig(this.propConfig)
|
|
@@ -151,34 +150,27 @@ export default class ByTable extends Vue {
|
|
return d;
|
|
return d;
|
|
}
|
|
}
|
|
|
|
|
|
- //设置表单配置
|
|
|
|
- setConfig(c:any){
|
|
|
|
- if(c){
|
|
|
|
- this.config = c;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //获取表单配置
|
|
|
|
- getConfig(){
|
|
|
|
- return (this as any).$lodash.cloneDeep(this.config)
|
|
|
|
- }
|
|
|
|
|
|
|
|
request(){
|
|
request(){
|
|
if(!this.requestConfig || !this.requestConfig.url){
|
|
if(!this.requestConfig || !this.requestConfig.url){
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- (this as any).$request(this.requestConfig).then((res:any) => {
|
|
|
|
|
|
+
|
|
|
|
+ let parame = (this as any).$lodash.cloneDeep(this.requestConfig);
|
|
|
|
+ parame.success = (res:any) => {
|
|
if(res.data){
|
|
if(res.data){
|
|
this.setValue(res.data);
|
|
this.setValue(res.data);
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ }
|
|
|
|
+ parame.fail = (err:any) => {}
|
|
|
|
+ this.requestHandle(parame);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
.col-action{
|
|
.col-action{
|
|
- color: blue;
|
|
|
|
|
|
+ color: #0089ff;
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
padding: 0 4px;
|
|
padding: 0 4px;
|
|
}
|
|
}
|