Commit db92d332 by cwq0219

表格组件修改

1 parent abf0afd7
<!-- 表格+分页 -->
<template>
<div>
<el-table
<!-- v-loading="$store.state.d2admin.loading.value" -->
<el-table
:data="getListApi ? data : tableData"
v-loading="$store.state.d2admin.loading.value"
v-loading="loading"
border
:highlight-current-row="true"
:stripe="true"
......@@ -26,23 +27,23 @@
>
<template slot-scope="scope">
<template v-if="item.tagLabel">
<el-tag v-if="!item.tagName"
<el-tag
v-if="!item.tagName"
:type="tableParams.tag.type[scope.row[item.prop]]"
>{{tableParams.tag.label[scope.row[item.prop]]}}
v-text="tableParams.tag.label[scope.row[item.prop]]"
>
</el-tag>
<el-tag v-else
<el-tag
v-else
:type="tableParams[item.tagName].type[scope.row[item.prop]]"
>{{tableParams[item.tagName].label[scope.row[item.prop]]}}
</el-tag>
</template>
<template v-else-if="item.formatter">
{{item.formatter(scope.row)}}
v-text="tableParams[item.tagName].label[scope.row[item.prop]]"
></el-tag>
</template>
<template v-else-if="getListApi">
{{data[scope.$index][item.prop]}}
<p v-text="data[scope.$index][item.prop]"></p>
</template>
<template v-else>
{{tableData[scope.$index][item.prop]}}
<p v-text="tableData[scope.$index][item.prop]"></p>
</template>
</template>
</el-table-column>
......@@ -54,7 +55,10 @@
fixed="right"
>
<template slot-scope="scope">
<slot name="auth-button" :scope="scope.row"></slot>
<slot
name="auth-button"
:scope="scope.row"
></slot>
</template>
</el-table-column>
</el-table>
......@@ -79,6 +83,7 @@ export default {
name: 'd2-table',
data() {
return {
loading: false,
oldValue: {},
data: [],
// 页码
......@@ -160,6 +165,7 @@ export default {
},
deep: true
},
// 调用其他接口,导致表格刷新-标识
'$store.state.d2admin.refreshtable.value'(val) {
this.refreshTable()
}
......@@ -174,15 +180,17 @@ export default {
methods: {
refreshTable() {
this.loading = true
const params = {
...this.page,
...this.searchForm
}
// console.log(params)
this.getListApi(params).then(res => {
this.data = res[this.tableParams.listName]
res.pagination && (this.total = res.pagination.totalCount)
this.loading = false
}).catch(() => {
this.loading = false
notice.errorTips()
})
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!