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

166 lines
4.7 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">
<span> {{ companyInfo.deptName }} </span>
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>
2024-12-31 17:49:45 +08:00
<p> {{ 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">
2024-12-31 17:49:45 +08:00
<el-button
type="text"
:key="index"
:icon="item.icon"
v-for="(item, index) in btnList"
@click="onClickButton(item.type)"
>
{{ item.btn_name }}
</el-button>
2024-12-30 18:07:53 +08:00
</div>
</div>
</template>
<script>
2025-01-03 15:03:10 +08:00
import { editCompanyAPI } from '@/api/company-manage/index.js'
2024-12-31 17:49:45 +08:00
export default {
props: {
companyInfo: {
type: Object,
default: () => {},
},
},
data() {
return {
userList: [
{ title_name: '用户', count: 20 },
{ title_name: '项目', count: 20 },
{ title_name: '设备', count: 20 },
],
btnList: [
{ 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 },
],
}
},
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 {
this.$modal
.confirm('是否确认注销')
2025-01-03 15:03:10 +08:00
.then(async () => {
// 组装参数
const { deptId, parentId, deptName, orderNum } =
this.companyInfo
const params = {
deptId,
parentId,
status: '2',
deptName,
orderNum,
}
const res = await editCompanyAPI(params)
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;
& span:first-child {
font-weight: bold;
}
}
p {
font-size: 14px;
color: #abafb3;
}
}
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>