bonus-ui/src/views/company-manage/components/company-card.vue

212 lines
5.9 KiB
Vue
Raw Normal View History

2024-12-30 18:07:53 +08:00
<template>
<div class="company-card">
<div class="company-info">
2024-12-30 18:14:06 +08:00
<div>
2025-01-03 15:03:10 +08:00
<el-avatar size="large" :src="companyInfo.logo" />
2024-12-30 18:14:06 +08:00
</div>
2024-12-31 17:49:45 +08:00
<div style="flex: 1; padding-left: 14px">
<div class="company-title">
2025-01-03 17:24:15 +08:00
<div> {{ companyInfo.deptName }} </div>
2025-01-03 15:03:10 +08:00
<el-tag
type="success"
effect="dark"
size="mini"
v-if="companyInfo.status == 0"
>
2024-12-31 17:49:45 +08:00
启用中
</el-tag>
2025-01-03 15:03:10 +08:00
<el-tag
type="warning"
effect="dark"
size="mini"
v-if="companyInfo.status == 1"
>
停用
</el-tag>
<el-tag
type="danger"
effect="dark"
size="mini"
v-if="companyInfo.status == 2"
>
注销
</el-tag>
2024-12-30 18:07:53 +08:00
</div>
2025-01-03 17:24:15 +08:00
<p class="company-remark"> {{ companyInfo.remark }} </p>
2024-12-30 18:07:53 +08:00
</div>
</div>
2024-12-30 18:14:06 +08:00
<div class="items-card">
2024-12-31 17:49:45 +08:00
<div
:key="index"
class="items-center"
v-for="(item, index) in userList"
>
<div>{{ item.title_name }}</div>
<div>{{ item.count }}</div>
2024-12-30 18:07:53 +08:00
</div>
</div>
2024-12-30 18:14:06 +08:00
<div class="items-card">
2025-01-03 17:24:15 +08:00
<!-- <el-button
2024-12-31 17:49:45 +08:00
type="text"
:key="index"
:icon="item.icon"
v-for="(item, index) in btnList"
@click="onClickButton(item.type)"
>
{{ item.btn_name }}
2025-01-03 17:24:15 +08:00
</el-button> -->
<el-button
type="text"
icon="el-icon-chat-dot-round"
@click="onClickButton(1)"
>
详情
</el-button>
<el-button
type="text"
icon="el-icon-edit"
@click="onClickButton(2)"
>
编辑
</el-button>
<el-button
type="text"
icon="el-icon-delete"
@click="onClickButton(3)"
v-if="companyInfo.status != 2"
>
注销
2024-12-31 17:49:45 +08:00
</el-button>
2024-12-30 18:07:53 +08:00
</div>
</div>
</template>
<script>
2025-01-03 17:24:15 +08:00
import { editDeptLogoutAPI } from '@/api/company-manage/index.js'
2024-12-31 17:49:45 +08:00
export default {
props: {
companyInfo: {
type: Object,
default: () => {},
},
},
data() {
return {
userList: [
2025-01-03 17:24:15 +08:00
{ title_name: '用户', count: 0 },
{ title_name: '项目', count: 0 },
{ title_name: '设备', count: 0 },
2024-12-31 17:49:45 +08:00
],
btnList: [
2025-01-03 17:24:15 +08:00
{
btn_name: '详情',
icon: 'el-icon-chat-dot-round',
type: 1,
},
{
btn_name: '编辑',
icon: 'el-icon-edit',
type: 2,
},
{
btn_name: '注销',
icon: 'el-icon-delete',
type: 3,
},
2024-12-31 17:49:45 +08:00
],
}
},
methods: {
onClickButton(type) {
if (type === 1 || type === 2) {
2025-01-03 15:03:10 +08:00
this.$emit('openAddForm', type, this.companyInfo.deptId)
2024-12-31 17:49:45 +08:00
} else {
2025-01-03 17:24:15 +08:00
if (this.companyInfo.status == 2) {
this.$modal.msgError('该公司已注销,无法重复注销')
return
}
2024-12-31 17:49:45 +08:00
this.$modal
.confirm('是否确认注销')
2025-01-03 15:03:10 +08:00
.then(async () => {
// 组装参数
2025-01-03 17:24:15 +08:00
const { deptId } = this.companyInfo
2025-01-03 15:03:10 +08:00
const params = {
deptId,
}
2025-01-03 17:24:15 +08:00
const res = await editDeptLogoutAPI(params)
2025-01-03 15:03:10 +08:00
if (res.code === 200) {
this.$modal.msgSuccess('注销成功')
this.$emit('updateTableList')
}
})
2024-12-31 17:49:45 +08:00
.catch(() => {})
}
},
},
}
2024-12-30 18:07:53 +08:00
</script>
<style lang="scss" scoped>
.company-card {
2024-12-30 18:14:06 +08:00
padding: 12px 10px;
border-radius: 6px;
2024-12-31 17:49:45 +08:00
background-color: #f7f8fc;
2025-01-03 15:03:10 +08:00
min-height: 220px;
max-height: 220px;
display: flex;
flex-direction: column;
justify-content: space-around;
2024-12-30 18:07:53 +08:00
.company-info {
display: flex;
align-items: center;
2024-12-30 18:14:06 +08:00
2024-12-31 17:49:45 +08:00
.company-title {
width: 100%;
display: flex;
justify-content: space-between;
2025-01-03 17:24:15 +08:00
& div:first-child {
2024-12-31 17:49:45 +08:00
font-weight: bold;
2025-01-03 17:24:15 +08:00
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
-webkit-line-clamp: 1;
text-overflow: ellipsis;
2024-12-31 17:49:45 +08:00
}
}
p {
font-size: 14px;
color: #abafb3;
}
2025-01-03 17:24:15 +08:00
.company-remark {
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
-webkit-line-clamp: 2;
text-overflow: ellipsis;
}
2024-12-31 17:49:45 +08:00
}
2024-12-30 18:14:06 +08:00
.items-card {
margin-top: 16px;
display: flex;
justify-content: space-around;
2024-12-31 17:49:45 +08:00
color: #454545;
2024-12-30 18:14:06 +08:00
.items-center {
display: flex;
flex-direction: column;
align-items: center;
2024-12-31 17:49:45 +08:00
& div:last-child {
margin-top: 14px;
font-weight: bold;
}
2024-12-30 18:14:06 +08:00
}
}
2024-12-30 18:07:53 +08:00
}
</style>