smart_archives_web/src/views/archivesManagement/fileManager/components/rightTable.vue

169 lines
5.6 KiB
Vue
Raw Normal View History

2025-09-16 14:37:37 +08:00
<template>
<!-- 档案目录管理 -->
<div>
<el-card style="min-height: calc(100vh - 190px);">
<TableModel :formLabel="formLabel" :showOperation="true" :showRightTools="true" ref="tableRef"
2025-09-16 17:59:53 +08:00
:columnsList="columnsList" :request-api="getFileManageApi" :send-params="defaultParams">
2025-09-17 10:02:31 +08:00
<template slot="dataSource" slot-scope="{ data }">
<span>{{ data.dataSource === '1' ? '本系统上传' : '智慧现场' }}</span>
</template>
2025-09-16 14:37:37 +08:00
<template slot="btn">
2025-09-17 09:35:21 +08:00
<el-button plain size="mini" type="primary" icon="el-icon-plus" v-hasPermi="['file:manage:add']"
2025-09-16 14:37:37 +08:00
@click="handleAdd" :disabled="addBtnIsShow">
新增
</el-button>
</template>
<template slot="handle" slot-scope="{ data }">
2025-09-17 09:35:21 +08:00
<el-button plain size="mini" type="success" icon="el-icon-warning-outline" v-hasPermi="['file:manage:query']"
2025-09-16 14:37:37 +08:00
@click="handleDetail(data)">
详情
</el-button>
2025-09-17 09:35:21 +08:00
<el-button plain size="mini" type="primary" icon="el-icon-edit" v-hasPermi="['file:manage:update']"
2025-09-16 14:37:37 +08:00
@click="handleUpdate(data)">
修改
</el-button>
2025-09-17 09:35:21 +08:00
<el-button plain size="mini" type="danger" icon="el-icon-delete" v-hasPermi="['file:manage:del']"
2025-09-16 14:37:37 +08:00
@click="handleDelete(data)">
删除
</el-button>
</template>
</TableModel>
<!-- 新增/编辑 -->
<AddTableData v-if="isflag" :isAdd="isAdd" :rowData="row" @handleQuery="handleQuery" :title="title"
2025-09-17 10:02:31 +08:00
@closeDialog="closeDialog" @showColose="showColose" :dataForm="row" :width="600" :projectId="projectId" />
2025-09-16 14:37:37 +08:00
</el-card>
</div>
</template>
<script>
import TableModel from '@/components/TableModel'
import { columnsList, formLabel } from './config'
import {
2025-09-17 09:35:21 +08:00
delFileManageApi,
2025-09-16 17:59:53 +08:00
getFileManageApi,
2025-09-16 15:03:25 +08:00
} from '@/api/archivesManagement/fileManager/fileManager.js'
2025-09-16 14:37:37 +08:00
import AddTableData from './addTableData'
export default {
name: 'FileRightTable',
props:{
2025-09-17 10:02:31 +08:00
projectId:{
type:String,
default:''
},
2025-09-16 14:37:37 +08:00
selectedNode:{
type:Object,
default:null
}
},
components: {
TableModel,
AddTableData
},
data() {
return {
formLabel,
columnsList,
2025-09-16 17:59:53 +08:00
getFileManageApi,
2025-09-16 14:37:37 +08:00
title: "",
isflag: false,
isAdd: '',
row: {},
loading: false,
addBtnIsShow:true,
defaultParams: {}
}
},
created() {
},
methods: {
closeDialog() {
this.isflag = false;
},
showColose() {
this.isflag = false;
},
/** 新增按钮操作 */
handleAdd() {
2025-09-17 11:30:01 +08:00
console.log(this.selectedNode);
2025-09-16 14:37:37 +08:00
this.title = "新增";
this.isAdd = 'add';
this.isflag = true;
this.row = this.selectedNode;
this.row.detailStatus = false;
this.row.belongName = this.selectedNode.parentName + '/' + this.selectedNode.label
},
/** 修改操作 */
handleUpdate(row) {
this.title = "修改";
this.isAdd = 'edit';
this.row = row;
this.row.belongName = this.selectedNode.parentName + '/' + this.selectedNode.label
this.row.detailStatus = false;
this.isflag = true;
},
/** 详情操作 */
handleDetail(row) {
this.title = "详情";
this.isAdd = 'detail';
this.row = row;
this.row.belongName = this.selectedNode.label + '/' + this.selectedNode.parentName
this.row.detailStatus = true;
this.isflag = true;
},
/* 搜索操作 */
handleQuery() {
this.$refs.tableRef.getTableList()
},
/** 删除操作 */
handleDelete(row) {
this.$modal.confirm(`是否确认删除文件名称为"${row.contentName}"的数据项?`).then(() => {
// 显示加载遮罩
this.$modal.loading("正在删除,请稍候...");
2025-09-17 09:35:21 +08:00
delFileManageApi({ id: row.id }).then(res => {
2025-09-16 14:37:37 +08:00
this.$modal.closeLoading();
if (res.code === 200) {
this.$modal.msgSuccess("删除成功");
this.handleQuery();
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.$modal.closeLoading();
this.$modal.msgError("删除失败,请重试");
console.error('删除失败:', error);
});
}).catch(() => {
// 用户取消删除,不需要处理
});
},
},
// 监听选中的节点
watch: {
selectedNode: {
handler(newVal) {
console.log(newVal);
2025-09-17 09:35:21 +08:00
this.addBtnIsShow = !(newVal && Number(newVal.level) === 4)
2025-09-16 14:37:37 +08:00
// 更新并下发默认请求参数(例如 parentId
const parentId = newVal && newVal.id ? newVal.id : 0
this.defaultParams = { parentId }
if (this.$refs.tableRef) {
this.$refs.tableRef.queryTableList({ parentId })
}
},
immediate: true, // 表示立即执行
},
},
}
</script>