装备配置率配置

This commit is contained in:
jiang 2026-01-25 20:02:26 +08:00
parent 116378469d
commit 70ea17331f
4 changed files with 1671 additions and 982 deletions

View File

@ -10,6 +10,46 @@ export function listUser(query) {
})
}
export function selectResourceList(query) {
return request({
url: '/material-mall/deptConfig/selectResourceList',
method: 'get',
params: query
})
}
export function selectInventoryList(query) {
return request({
url: '/material-mall/deptConfig/selectInventoryList',
method: 'get',
params: query
})
}
export function insertResource(data) {
return request({
url: '/material-mall/deptConfig/insertResource',
method: 'post',
data: data
})
}
export function getCategoryList(query) {
return request({
url: '/material-mall/deptConfig/getCategoryList',
method: 'get',
params: query
})
}
// 删除用户
export function deleteResource(userId) {
return request({
url: '/material-mall/deptConfig/deleteResourceById/' + userId,
method: 'post'
})
}
export function addUser(data) {
return request({
url: '/material-mall/deptConfig/add',
@ -26,7 +66,6 @@ export function selectConfigList(data) {
})
}
// 查询用户详细
export function getUser(userId) {
return request({
@ -149,7 +188,7 @@ export function updateEquipmentConfig(data) {
// 查询部门下拉树结构
export function deptTreeSelect() {
return request({
url: '/material-mall/deptConfig/deptTree',
url: '/material-mall/deptConfig/deptTree',
method: 'get'
})
}
@ -178,7 +217,7 @@ export function confirmPassword(password) {
return request({
url: '/system/user/confirmPassword',
method: 'post',
data:data
data: data
})
}

View File

@ -0,0 +1,292 @@
<template>
<div class="tab-table-wrapper">
<!-- 表格头部标题自定义 + 新增按钮显隐可控 -->
<div class="table-header">
<!-- 标题父组件传递默认空 -->
<h3>{{ tableTitle }}</h3>
<!-- 新增按钮通过showAddBtn控制显隐 -->
<div>
<el-button
v-if="showAddBtn"
size="small"
type="primary"
icon="el-icon-plus"
@click="handleAddClick"
>
新增
</el-button>
<el-button
v-if="showOwnBtn"
size="small"
type="primary"
icon="el-icon-plus"
@click="handleOwnClick"
>
自用新增
</el-button>
<el-button
v-if="showSharingBtn"
size="small"
type="primary"
icon="el-icon-plus"
@click="handleSharingClick"
>
共享新增
</el-button>
<el-button
v-if="showRentalBtn"
size="small"
type="primary"
icon="el-icon-plus"
@click="handleRentalClick"
>
外租新增
</el-button>
</div>
</div>
<!-- 表格滚动容器独立滚动表头固定 -->
<div class="table-content" v-loading="loading">
<el-table
class="project-table"
:data="tableData"
highlight-current-row
border
stripe
:empty-text="emptyText"
>
<el-table-column
type="index"
width="55"
label="序号"
align="center"
:index="calcTableIndex"
/>
<!-- 改造后完整表格列代码兼容Vue2/Vue3 -->
<el-table-column
v-for="(column, index) in tableColumns"
:key="index"
:label="column.label"
:prop="column.prop"
:min-width="column.minWidth"
align="center"
show-overflow-tooltip
>
<!-- 作用域插槽获取当前行数据scope.row当前列配置column -->
<template slot-scope="scope"> <!-- Vue3可写v-slot="scope"效果一致 -->
<!-- 判断当前列有dictMap映射 渲染映射文字无则渲染原始值 -->
<span v-if="column.dictMap">
<!-- 若字段值可能为null/undefined添加兜底显示 -->
{{ column.dictMap[scope.row[column.prop]] || '未知' }}
</span>
<span v-else>
{{ scope.row[column.prop] || '-' }} <!-- 原始值兜底空值显示- -->
</span>
</template>
</el-table-column>
<!-- 操作列通过showActionCol控制显隐 -->
<el-table-column
v-if="showActionCol"
label="操作"
align="center"
width="100"
>
<template slot-scope="scope">
<el-button type="text" text-color="danger" @click="handleDeleteClick(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页组件无数据时隐藏 -->
<div class="pagination-wrapper" v-if="total > 0">
<pagination
:total="total"
:page.sync="pageNum"
:limit.sync="pageSize"
@pagination="handlePageChange"
background
layout="total, sizes, prev, pager, next"
/>
</div>
</div>
</template>
<script>
export default {
name: 'EquipmentTable',
//
props: {
//
tableTitle: {
type: String,
default: ''
},
// true/false
showAddBtn: {
type: Boolean,
default: true
},
showOwnBtn: {
type: Boolean,
default: true
},
showSharingBtn: {
type: Boolean,
default: true
},
showRentalBtn: {
type: Boolean,
default: true
},
// true/false
showActionCol: {
type: Boolean,
default: true
},
//
tableData: {
type: Array,
required: true,
default: () => []
},
tableColumns: {
type: Array,
required: true,
default: () => []
},
loading: {
type: Boolean,
default: false
},
total: {
type: Number,
default: 0
},
pageNum: {
type: Number,
required: true,
default: 1
},
pageSize: {
type: Number,
required: true,
default: 10
},
emptyText: {
type: String,
default: '暂无数据'
}
},
methods: {
//
calcTableIndex(index) {
return (this.pageNum - 1) * this.pageSize + index + 1
},
//
handleAddClick() {
this.$emit('add')
},
handleOwnClick() {
this.$emit('own')
},
handleSharingClick() {
this.$emit('sharing')
},
handleRentalClick() {
this.$emit('rental')
},
//
handleDeleteClick(row) {
this.$emit('delete', row)
},
//
handlePageChange() {
this.$emit('pagination', {
pageNum: this.pageNum,
pageSize: this.pageSize
})
}
}
}
</script>
<style scoped lang="scss">
// /
.tab-table-wrapper {
display: flex;
flex-direction: column;
padding: 16px;
box-sizing: border-box;
.table-header {
display: flex;
align-items: center;
margin-bottom: 12px;
flex-shrink: 0;
justify-content: space-between;
//
h3 {
margin: 0;
white-space: nowrap;
}
}
.table-content {
flex: 1;
overflow: auto;
-ms-overflow-style: none;
scrollbar-width: none;
position: relative;
&::-webkit-scrollbar {
display: none;
}
}
.pagination-wrapper {
margin-top: 12px;
text-align: right;
flex-shrink: 0;
padding-right: 4px;
}
}
.project-table {
width: 100%;
--el-table-row-height: 56px;
--el-table-header-text-color: #333;
--el-table-header-background-color: #fafafa;
--el-table-row-hover-bg-color: #f6fbfa;
:deep(.el-table__header-wrapper) {
position: sticky;
top: 0;
z-index: 10;
background-color: var(--el-table-header-background-color) !important;
}
:deep(.el-table__header th) {
border-bottom: 1px solid #ebeef5;
border-right: 1px solid #ebeef5;
white-space: nowrap;
font-weight: 600;
}
:deep(.el-table__body tr:hover > td) {
background-color: var(--el-table-row-hover-bg-color) !important;
}
:deep(.el-table__fixed-right) {
box-shadow: -2px 0 6px rgba(0, 0, 0, 0.02);
}
}
//
:deep(.el-table__empty-text) {
color: #909399;
font-size: 14px;
padding: 20px 0;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,210 @@
<template>
<div class="tab-table-wrapper">
<!-- 表格头部新增按钮 -->
<div class="table-header">
<el-button type="primary" icon="el-icon-plus" @click="handleAddClick">
新增
</el-button>
</div>
<!-- 表格滚动容器独立滚动表头固定 -->
<div class="table-content" v-loading="loading">
<el-table
class="project-table"
:data="tableData"
highlight-current-row
border
stripe
:empty-text="emptyText"
>
<el-table-column
type="index"
width="55"
label="序号"
align="center"
:index="calcTableIndex"
/>
<el-table-column
v-for="(column, index) in tableColumns"
:key="index"
:label="column.label"
:prop="column.prop"
:min-width="column.minWidth"
align="center"
show-overflow-tooltip
/>
<el-table-column label="操作" align="center" width="200">
<template slot-scope="scope">
<el-button type="text" @click="handleRelateClick(scope.row)">关联</el-button>
<el-button type="text" @click="handleEditClick(scope.row)">编辑</el-button>
<el-button type="text" text-color="danger" @click="handleDeleteClick(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页组件无数据时隐藏 -->
<div class="pagination-wrapper" v-if="total > 0">
<pagination
:total="total"
:page.sync="pageNum"
:limit.sync="pageSize"
@pagination="handlePageChange"
background
layout="total, sizes, prev, pager, next"
/>
</div>
</div>
</template>
<script>
export default {
name: 'EquipmentTable',
//
props: {
//
tableData: {
type: Array,
required: true,
default: () => []
},
//
tableColumns: {
type: Array,
required: true,
default: () => []
},
//
loading: {
type: Boolean,
default: false
},
//
total: {
type: Number,
default: 0
},
//
pageNum: {
type: Number,
required: true,
default: 1
},
//
pageSize: {
type: Number,
required: true,
default: 10
},
//
emptyText: {
type: String,
default: '暂无数据'
}
},
methods: {
//
calcTableIndex(index) {
return (this.pageNum - 1) * this.pageSize + index + 1
},
//
handleAddClick() {
this.$emit('add')
},
//
handleRelateClick(row) {
this.$emit('relate', row)
},
//
handleEditClick(row) {
this.$emit('edit', row)
},
//
handleDeleteClick(row) {
this.$emit('delete', row)
},
//
handlePageChange() {
this.$emit('pagination', {
pageNum: this.pageNum,
pageSize: this.pageSize
})
}
}
}
</script>
<style scoped lang="scss">
//
.tab-table-wrapper {
height: calc(99vh - 84px);
display: flex;
flex-direction: column;
padding: 16px;
box-sizing: border-box;
.table-header {
display: flex;
align-items: center;
margin-bottom: 12px;
flex-shrink: 0;
justify-content: flex-end;
}
.table-content {
flex: 1;
overflow: auto;
-ms-overflow-style: none;
scrollbar-width: none;
position: relative;
&::-webkit-scrollbar {
display: none;
}
}
.pagination-wrapper {
margin-top: 12px;
text-align: right;
flex-shrink: 0;
padding-right: 4px;
}
}
.project-table {
width: 100%;
--el-table-row-height: 56px;
--el-table-header-text-color: #333;
--el-table-header-background-color: #fafafa;
--el-table-row-hover-bg-color: #f6fbfa;
:deep(.el-table__header-wrapper) {
position: sticky;
top: 0;
z-index: 10;
background-color: var(--el-table-header-background-color) !important;
}
:deep(.el-table__header th) {
border-bottom: 1px solid #ebeef5;
border-right: 1px solid #ebeef5;
white-space: nowrap;
font-weight: 600;
}
:deep(.el-table__body tr:hover > td) {
background-color: var(--el-table-row-hover-bg-color) !important;
}
:deep(.el-table__fixed-right) {
box-shadow: -2px 0 6px rgba(0, 0, 0, 0.02);
}
}
//
:deep(.el-table__empty-text) {
color: #909399;
font-size: 14px;
padding: 20px 0;
}
</style>