pub_svc_platform_web/src/views/dataManage/docs-center/index.vue

299 lines
8.6 KiB
Vue
Raw Normal View History

2025-09-10 16:38:48 +08:00
<template>
<!-- 文档中心管理 -->
<div class="app-container">
<el-form
size="small"
:inline="true"
ref="queryForm"
:model="queryParams"
>
2025-11-03 16:20:39 +08:00
<el-form-item prop="folderName">
2025-09-10 16:38:48 +08:00
<el-input
clearable
placeholder="请输入名称"
2025-11-03 16:20:39 +08:00
v-model="queryParams.folderName"
2025-09-10 16:38:48 +08:00
@keyup.enter.native="onHandleQuery"
/>
</el-form-item>
2025-11-03 16:20:39 +08:00
<el-form-item prop="fileType">
2025-09-10 16:38:48 +08:00
<el-select
clearable
filterable
2025-11-03 16:20:39 +08:00
style="width: 100%"
placeholder="请选择类型"
v-model="queryParams.fileType"
2025-09-10 16:38:48 +08:00
>
2025-11-03 16:20:39 +08:00
<el-option
:key="item.value"
:label="item.label"
:value="item.label"
v-for="item in dict.type.document_type"
/>
2025-09-10 16:38:48 +08:00
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
size="mini"
@click="onHandleQuery"
icon="el-icon-search"
>
查询
</el-button>
<el-button
size="mini"
icon="el-icon-refresh"
@click="onResetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
plain
size="mini"
type="primary"
icon="el-icon-plus"
@click="onHandleAdd"
>
新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
plain
size="mini"
type="primary"
icon="el-icon-upload"
@click="onHandleImport"
>
导入
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
plain
size="mini"
type="primary"
icon="el-icon-download"
@click="onHandleExport"
>
导出
</el-button>
</el-col>
</el-row>
<!-- 表格 -->
<el-table :data="tableData" border>
<el-table-column
type="index"
label="序号"
width="50"
align="center"
/>
<el-table-column
align="center"
:key="column.prop"
:prop="column.prop"
:label="column.label"
v-for="column in columns"
>
<template slot-scope="scope">
<template v-if="column.prop === 'file'"> 附件 </template>
<template v-else>
{{ scope.row[column.prop] }}
</template>
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button
plain
size="mini"
type="success"
style="padding: 4px 8px"
@click="onHandleEdit(scope.row)"
>
编辑
</el-button>
<el-button
plain
size="mini"
type="danger"
style="padding: 4px 8px"
@click="onHandleDelete(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
2025-11-03 16:20:39 +08:00
<!-- 分页 -->
<pagination
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getDocsCenterListFun"
/>
2025-09-10 16:38:48 +08:00
<!-- 新增和编辑表单 -->
<DialogModel
:dialogConfig="dialogConfig"
@closeDialogOuter="handleCloseDialogOuter"
>
<template #outerContent>
2025-11-03 16:20:39 +08:00
<AddAndEditForm :editRow="editRow" @closeDialog="closeDialog" />
2025-09-10 16:38:48 +08:00
</template>
</DialogModel>
</div>
</template>
<script>
import AddAndEditForm from './components/addAndEditForm.vue'
import DialogModel from '@/components/DialogModel'
2025-11-03 16:20:39 +08:00
import {
getDocsCenterListAPI,
deleteDocsCenterAPI,
} from '@/api/dataManage/docs-center'
2025-09-10 16:38:48 +08:00
export default {
name: 'DocsCenter',
2025-11-03 16:20:39 +08:00
dicts: ['document_type'],
2025-09-10 16:38:48 +08:00
components: {
AddAndEditForm,
DialogModel,
},
data() {
return {
2025-11-03 16:20:39 +08:00
total: 0,
editRow: null,
tableData: [],
2025-09-10 16:38:48 +08:00
queryParams: {
2025-11-03 16:20:39 +08:00
pageNum: 1,
pageSize: 10,
folderName: undefined,
fileType: undefined,
2025-09-10 16:38:48 +08:00
},
columns: [
{
2025-11-03 16:20:39 +08:00
prop: 'folderName',
2025-09-10 16:38:48 +08:00
label: '名称',
},
{
2025-11-03 16:20:39 +08:00
prop: 'fileType',
2025-09-10 16:38:48 +08:00
label: '类型',
},
{
2025-11-03 16:20:39 +08:00
prop: 'isAdmin',
2025-09-10 16:38:48 +08:00
label: '管理员',
},
{
2025-11-03 16:20:39 +08:00
prop: 'remark',
2025-09-10 16:38:48 +08:00
label: '描述',
},
{
2025-11-03 16:20:39 +08:00
prop: 'createUser',
2025-09-10 16:38:48 +08:00
label: '创建人',
},
{
prop: 'createTime',
label: '创建时间',
},
],
dialogConfig: {
outerTitle: '新增',
outerVisible: false,
outerWidth: '70%',
minHeight: '50vh',
maxHeight: '90vh',
},
}
},
methods: {
onHandleQuery() {
console.log(this.queryParams)
2025-11-03 16:20:39 +08:00
this.getDocsCenterListFun()
2025-09-10 16:38:48 +08:00
},
onResetQuery() {
this.queryParams = {
2025-11-03 16:20:39 +08:00
folderName: undefined,
fileType: undefined,
pageNum: 1,
pageSize: 10,
2025-09-10 16:38:48 +08:00
}
2025-11-03 16:20:39 +08:00
this.getDocsCenterListFun()
2025-09-10 16:38:48 +08:00
},
onHandleAdd() {
console.log('新增')
2025-11-03 16:20:39 +08:00
this.editRow = null
2025-09-10 16:38:48 +08:00
this.dialogConfig.outerTitle = '新增'
this.dialogConfig.outerVisible = true
},
onHandleImport() {
console.log('导入')
},
onHandleExport() {
console.log('导出')
},
onHandleEdit(row) {
console.log('编辑', row)
2025-11-03 16:20:39 +08:00
this.editRow = row
2025-09-10 16:38:48 +08:00
this.dialogConfig.outerTitle = '编辑'
this.dialogConfig.outerVisible = true
},
onHandleDelete(row) {
2025-11-03 16:20:39 +08:00
// console.log('删除', row)
this.$confirm('确定删除该文档中心吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
const res = await deleteDocsCenterAPI(row.id)
if (res.code === 200) {
this.$modal.msgSuccess('删除成功')
this.onHandleQuery()
}
})
2025-09-10 16:38:48 +08:00
},
// 关闭弹框
handleCloseDialogOuter() {
this.dialogConfig.outerVisible = false
},
// 关闭弹框 由子组件调用
closeDialog(isSuccess) {
this.dialogConfig.outerVisible = false
if (isSuccess) {
this.onHandleQuery()
}
},
2025-11-03 16:20:39 +08:00
// 获取列表
async getDocsCenterListFun() {
const res = await getDocsCenterListAPI(this.queryParams)
console.log(res, '9966699')
this.tableData = res?.rows
this.total = res?.total
},
2025-09-10 16:38:48 +08:00
},
created() {
2025-11-03 16:20:39 +08:00
this.getDocsCenterListFun()
2025-09-10 16:38:48 +08:00
},
}
</script>
<style scoped>
.link-text {
color: #409eff;
text-decoration: none;
}
.link-text:hover {
color: #409eff;
text-decoration: underline;
}
</style>