<template>
|
<div class="custom-scroll">
|
<v-header
|
title="群团组织"
|
></v-header>
|
<!-- 条件搜索 -->
|
<el-form :inline="true" class="demo-form-inline">
|
<el-form-item label="关键字" >
|
<el-input style="width:300px" size="small" v-model="search.keyWord" placeholder="请输入组织名、联系电话"></el-input>
|
</el-form-item>
|
<el-form-item label="状态">
|
<el-radio-group v-model="search.status" size="medium">
|
<el-radio-button label="">全部</el-radio-button>
|
<el-radio-button label="1">启用</el-radio-button>
|
<el-radio-button label="2">停用</el-radio-button>
|
</el-radio-group>
|
</el-form-item>
|
<el-form-item>
|
<el-button size="small" type="primary" @click="onSearch">查询</el-button>
|
<el-button @click="Reset" size="small">重置</el-button>
|
</el-form-item>
|
</el-form>
|
<!-- 操作按钮 -->
|
<div class="operation-btn">
|
<el-button type="primary" @click="addorg()">新增组织</el-button>
|
</div>
|
<!-- 表单 -->
|
<div class="tab">
|
<v-tool-table
|
:trs="trs"
|
:tds="tds"
|
>
|
<template v-slot:icon="{scope}">
|
<span class="icon-s">
|
<img @click="onScaleUploadImage(scope.logo)" :src="scope.logo">
|
</span>
|
</template>
|
<template v-slot:status="{scope}">
|
{{scope.status==1?'启用':'停用'}}
|
</template>
|
<template v-slot:btn="{scope}">
|
<div class="table_flex">
|
<span @click="addorg(scope.id)">编辑</span>
|
<span @click="clear(scope.id)">删除</span>
|
</div>
|
</template>
|
</v-tool-table>
|
</div>
|
<!-- 分页 -->
|
<div class="page">
|
<el-pagination
|
:current-page="paginationParams.currentPage"
|
:page-size="paginationParams.pageSize"
|
:page-sizes="[5, 10, 20, 50, 100]"
|
background
|
layout="total,prev,pager,next,sizes,jumper"
|
:total="paginationParams.total"
|
@size-change="onPageSizeChange"
|
@current-change="onPaginationChange">
|
</el-pagination>
|
</div>
|
</div>
|
</template>
|
<script>
|
|
export default {
|
props: [],
|
components: {},
|
data() {
|
return {
|
search: {
|
keyWord:'',
|
status:'',
|
},
|
trs: [
|
{ text: "序号", val: "index" },
|
{ text: "组织名", val: "name" },
|
{ text: "组织标识", val: "btn",slot:"icon" },
|
{ text: "联系电话", val: "phone" },
|
{ text: "详细地址", val: "address" },
|
{ text: "状态", val: "btn",slot:"status" },
|
{ text: "操作", val: "btn" ,slot:"btn"},
|
],
|
tds: [],
|
/** 分页参数 */
|
paginationParams: {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0
|
},
|
};
|
},
|
|
|
mounted() {
|
this.init();
|
},
|
|
methods: {
|
onScaleUploadImage(d) {
|
this.$store.dispatch("setImage", {
|
time: Date.now(),
|
pic: d,
|
tool: true,
|
});
|
},
|
|
clear(id){
|
//删除
|
this.$confirm('此操作将永久删除该组织, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
this.$api.get('cluster/delete?id='+id,'',e=>{
|
this.init()
|
})
|
})
|
|
},
|
addorg(id){
|
//新增 编辑
|
let o = {path:'/act_addOrg'}
|
if(id){//编辑
|
o.query = {id:id}
|
}
|
this.$router.push(o)
|
},
|
/** pageSize 改变时会触发 */
|
onPageSizeChange (pageSize) {
|
this.paginationParams.pageSize = pageSize;
|
this.init();
|
},
|
|
/** 分页 */
|
onPaginationChange (page) {
|
this.paginationParams.currentPage = page;
|
this.init();
|
},
|
|
//条件搜索
|
onSearch(v) {
|
this.paginationParams.currentPage = 1;
|
this.init();
|
},
|
|
/**搜索条件重置 */
|
Reset() {
|
this.search.keyWord = ''
|
this.search.status = ''
|
this.paginationParams.currentPage = 1
|
this.init()
|
},
|
|
/**
|
* 初始化数据获取
|
*/
|
init() {
|
let params = Object.assign(this.search,{
|
pageNum: this.paginationParams.currentPage,
|
pageSize: this.paginationParams.pageSize,
|
})
|
// let params = {
|
// pageNum: this.paginationParams.currentPage,
|
// pageSize: this.paginationParams.pageSize,
|
// }
|
this.$api.post("cluster/page", params, (e) => {
|
this.paginationParams.total = e.total;
|
e.records.map((item,index) => {
|
item.index = (this.paginationParams.currentPage-1) * this.paginationParams.pageSize + index + 1
|
})
|
this.tds = (e.records || []).map((v) => {
|
this.$set(v, 'che', false)
|
return v;
|
});
|
|
});
|
},
|
},
|
|
};
|
</script>
|
|
<style scoped lang="less">
|
.custom-scroll {
|
overflow: scroll;
|
.icon-s {
|
display: inline-block;
|
width: 50px;
|
height: 40px;
|
overflow: hidden;
|
img {
|
width: 100%;
|
object-fit: cover;
|
}
|
}
|
}
|
.operation-btn {
|
margin-bottom: 10px;
|
}
|
|
.page {
|
text-align: center;
|
padding: 20px 0;
|
}
|
|
|
</style>
|