bonus-ui/src/views/company-manage/index.vue

113 lines
2.8 KiB
Vue
Raw Normal View History

2024-12-30 18:07:53 +08:00
<template>
2024-12-31 17:49:45 +08:00
<!-- 公司管理 -->
2024-12-30 18:07:53 +08:00
<div class="app-container">
<el-form ref="queryForm" size="small" :inline="true">
<el-form-item>
2024-12-31 17:49:45 +08:00
<el-input placeholder="请输入搜索关键词">
<i
slot="suffix"
class="el-icon-search"
style="cursor: pointer"
@click="getCompanyList"
/>
</el-input>
2024-12-30 18:07:53 +08:00
</el-form-item>
<el-form-item>
<el-button
size="mini"
type="primary"
2024-12-31 17:49:45 +08:00
icon="el-icon-plus"
2024-12-30 18:07:53 +08:00
@click="onRegisterCompany"
>
注册公司
</el-button>
</el-form-item>
</el-form>
<div class="company-list">
2024-12-31 17:49:45 +08:00
<div
:key="index"
class="company-items"
v-for="(item, index) in companyList"
>
<CompanyCard @openAddForm="openAddForm" :companyInfo="item" />
</div>
2024-12-30 18:07:53 +08:00
</div>
2024-12-31 17:49:45 +08:00
<pagination
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getCompanyList"
/>
<AddForm
:formType="formType"
v-if="formDialogVisible"
:formDialogVisible.sync="formDialogVisible"
@updateTableList="getCompanyList"
/>
2024-12-30 18:07:53 +08:00
</div>
</template>
<script>
import AddForm from './components/add-form'
import CompanyCard from './components/company-card'
2024-12-31 17:49:45 +08:00
import { getDeptListAPI } from '@/api/company-manage/index.js'
2024-12-30 18:07:53 +08:00
export default {
components: {
AddForm,
CompanyCard,
},
data() {
return {
2024-12-31 17:49:45 +08:00
total: 0,
formType: 3,
companyList: [],
2024-12-30 18:07:53 +08:00
formDialogVisible: false,
2024-12-31 17:49:45 +08:00
queryParams: {
pageNum: 1,
pageSize: 10,
},
2024-12-30 18:07:53 +08:00
}
},
methods: {
onRegisterCompany() {
this.formDialogVisible = true
},
2024-12-31 17:49:45 +08:00
async getCompanyList() {
const res = await getDeptListAPI()
this.companyList = res.rows
this.total = res.total
},
openAddForm(type) {
this.formType = type
this.formDialogVisible = true
},
},
mounted() {
this.getCompanyList()
2024-12-30 18:07:53 +08:00
},
}
</script>
<style scoped lang="scss">
.company-list {
display: flex;
2024-12-31 17:49:45 +08:00
flex: 1;
2025-01-03 09:43:29 +08:00
height: 100%;
2024-12-30 18:07:53 +08:00
flex-wrap: wrap;
2024-12-31 17:49:45 +08:00
overflow-y: auto;
2024-12-30 18:07:53 +08:00
.company-items {
width: calc((100% - 30px) / 3);
margin-right: 15px;
2024-12-31 17:49:45 +08:00
margin-bottom: 15px;
2024-12-30 18:07:53 +08:00
}
& .company-items:nth-child(3n) {
margin-right: 0;
}
}
</style>