文件分类标记管理

This commit is contained in:
cwchen 2025-09-12 16:13:06 +08:00
parent 53d74048a1
commit 60394f82c6
5 changed files with 324 additions and 349 deletions

View File

@ -1,6 +1,6 @@
import request from '@/utils/request'
// 新增数据类型
// 新增自定义分类
export function addKyFilesCustomizeClassifyAPI(data) {
return request({
url: '/smartArchives/files/customize/addKyFilesCustomizeClassify',
@ -9,7 +9,7 @@ export function addKyFilesCustomizeClassifyAPI(data) {
})
}
// 修改数据类型
// 修改自定义分类
export function updateKyFilesCustomizeClassifyAPI(data) {
return request({
url: '/smartArchives/files/customize/updateKyFilesCustomizeClassify',
@ -18,7 +18,7 @@ export function updateKyFilesCustomizeClassifyAPI(data) {
})
}
// 删除数据类型
// 删除自定义分类
export function delKyFilesCustomizeClassifyAPI(data) {
return request({
url: '/smartArchives/files/customize/delKyFilesCustomizeClassify',
@ -27,7 +27,7 @@ export function delKyFilesCustomizeClassifyAPI(data) {
})
}
// 查询数据类型列表
// 查询自定义分类列表
export function getKyFilesCustomizeClassifyListAPI(data) {
return request({
url: '/smartArchives/files/customize/getKyFilesCustomizeClassifyList',

View File

@ -0,0 +1,37 @@
import request from '@/utils/request'
// 新增文件分类标记
export function addArchivalCatalogueAPI(data) {
return request({
url: '/smartArchives/filesClassifyMark/addArchivalCatalogue',
method: 'POST',
data: data,
})
}
// 修改文件分类标记
export function editArchivalCatalogueAPI(data) {
return request({
url: '/smartArchives/filesClassifyMark/editArchivalCatalogue',
method: 'POST',
data: data,
})
}
// 删除文件分类标记
export function delArchivalCatalogueAPI(data) {
return request({
url: '/smartArchives/filesClassifyMark/delArchivalCatalogue',
method: 'POST',
data: data,
})
}
// 查询文件分类标记列表
export function getFilesClassifyMarkListAPI(data) {
return request({
url: '/smartArchives/filesClassifyMark/list',
method: 'GET',
params: data,
})
}

View File

@ -0,0 +1,17 @@
export const formLabel = [
{
isShow: false, // 是否展示label
f_type: 'ipt',
f_label: '文件分类标记名称',
f_model: 'classifyMarkName',
f_max: 32,
f_width: '200px',
},
]
export const columnsList = [
{ t_props: 'classifyMarkName', t_label: '文件分类标记名称' },
{ t_props: 'updateUserName', t_label: '更新人' },
{ t_props: 'updateTime', t_label: '更新时间' },
{ t_props: 'remark', t_label: '备注' }
]

View File

@ -1,369 +1,111 @@
<template>
<!-- 基础页面 -->
<!-- 档案多维度管理 -->
<div class="app-container">
<el-form
v-show="showSearch"
:model="queryParams"
ref="queryForm"
size="small"
inline
@submit.native.prevent
>
<el-form-item label="" prop="name">
<el-input
v-model="queryParams.name"
placeholder="文件分类标记名称"
clearable
@keyup.enter.native="handleQuery"
style="width: 240px"
/>
</el-form-item>
<TableModel :formLabel="formLabel" :showOperation="true" :showRightTools="true" ref="fileClassificationTagsTableRef"
:columnsList="columnsList" :request-api="getFilesClassifyMarkListAPI">
<template slot="btn">
<el-button plain size="mini" type="primary" icon="el-icon-plus" v-hasPermi="['files:multi:add']"
@click="handleAdd">
新增
</el-button>
</template>
<!-- 表单按钮 -->
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
>查询</el-button
>
<el-button icon="el-icon-refresh" @click="handleReset"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleDialog(null, 'add')"
>新增</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
/>
</el-row>
<el-table
:data="tableList"
fit
highlight-current-row
style="width: 100%"
v-loading="isLoading"
:max-height="650"
border
>
<el-table-column
type="index"
width="55"
label="序号"
align="center"
:index="
(index) =>
(queryParams.pageNum - 1) * queryParams.pageSize +
index +
1
"
/>
<el-table-column
v-for="(column, index) in tableColumns"
show-overflow-tooltip
:key="index"
:label="column.label"
:prop="column.prop"
align="center"
/>
<!-- 操作 -->
<el-table-column label="操作" align="center" width="300">
<template slot-scope="{ row }">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleDialog(row, 'edit')"
>
编辑
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(row)"
style="color: #f56c6c"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 弹框 -->
<el-dialog
:title="dialogTitle"
:visible.sync="dialogVisible"
width="40%"
v-loading="isLoading"
>
<el-form
ref="dialogForm"
:model="dialogForm"
:rules="dialogRules"
label-width=""
size="small"
@submit.native.prevent
>
<el-form-item label="文件分类标记名称" prop="fileName">
<el-input
v-model="dialogForm.fileName"
placeholder="请输入"
clearable
maxlength="50"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="dialogForm.remark"
placeholder="请输入"
clearable
type="textarea"
:autosize="{ minRows: 2, maxRows: 4 }"
maxlength="200"
show-word-limit
style="width: 100%"
/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="handleSubmit"
> </el-button
>
</span>
</el-dialog>
<template slot="handle" slot-scope="{ data }">
<el-button plain size="mini" type="primary" icon="el-icon-edit" v-hasPermi="['files:multi:update']"
@click="handleUpdate(data)">
修改
</el-button>
<el-button plain size="mini" type="danger" icon="el-icon-delete" v-hasPermi="['files:multi:del']"
@click="handleDelete(data)">
删除
</el-button>
</template>
</TableModel>
<!-- 新增/编辑 -->
<ClassifiyMarkForm v-if="isflag" :isAdd="isAdd" :rowData="row" @handleQuery="handleQuery" :title="title"
@closeDialog="closeDialog" @showColose="showColose" :dataForm="row" :disabled="loading" :width="600" />
</div>
</template>
<script>
// import {
// getInventoryLogListApi,
// getInventoryLogDetailsApi,
// } from '@/api/operationsManagement'
import TableModel from '@/components/TableModel'
import { columnsList, formLabel } from './config'
import {
delArchivalCatalogueAPI,
getFilesClassifyMarkListAPI,
} from '@/api/archivesManagement/fileClassificationTags'
import ClassifiyMarkForm from './prop/classifiyMarkForm.vue'
export default {
name: 'FileClassificationTags',
components: {
TableModel,
ClassifiyMarkForm
},
data() {
return {
isLoading: false,
showSearch: true,
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now()
},
},
queryParams: {
pageNum: 1,
pageSize: 10,
name: '', //
},
total: 0, //
//
tableColumns: [
{ label: '文件分类标记名称', prop: 'fileName' },
{ label: '更新人', prop: 'updater' },
{ label: '更新时间', prop: 'updateTime' },
{ label: '备注', prop: 'remark' },
],
//
tableList: [
{
id: 1,
fileName: '测试',
updater: '张三',
updateTime: '2024-06-20 12:00:00',
remark: '测试数据',
},
],
isOut: false, //
dialogTitle: '详情',
dialogVisible: false,
dialogForm: {
fileName: '',
remark: '',
},
dialogRules: {
fileName: [
{
required: true,
message: '请输入文件分类标记名称',
trigger: 'blur',
},
],
},
formLabel,
columnsList,
getFilesClassifyMarkListAPI,
title: "",
isflag: false,
isAdd: '',
row: {},
loading: false,
}
},
created() {
this.getList()
},
methods: {
//
/** 新增按钮操作 */
handleAdd() {
this.title = "新增";
this.isAdd = 'add';
this.isflag = true;
},
closeDialog() {
this.isflag = false;
},
showColose() {
this.isflag = false;
},
/** 修改操作 */
handleUpdate(row) {
this.title = "修改";
this.isAdd = 'edit';
this.row = row;
this.isflag = true;
},
/* 搜索操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
this.$refs.fileClassificationTagsTableRef.getTableList()
},
//
handleReset() {
this.$refs.queryForm.resetFields()
this.queryParams.pageNum = 1
this.queryParams.pageSize = 10
this.getList()
},
//
async getList() {
console.log('列表-查询', this.queryParams)
this.isLoading = true
try {
const params = {
...this.queryParams,
}
console.log('🚀 ~ getList ~ params:', params)
// const res = await (params)
// console.log('🚀 ~ ~ res:', res)
// this.tableList = res.data.rows || []
// this.total = res.data.total || 0
} catch (error) {
console.log('🚀 ~ 获取列表 ~ error:', error)
this.tableList = []
this.total = 0
} finally {
this.isLoading = false
}
},
handleDialog(row, type) {
console.log('🚀 ~ handleDialog ~ row:', row)
this.dialogTitle = type == 'add' ? '新增' : '编辑'
this.dialogVisible = true
setTimeout(() => {
this.$refs.dialogForm.resetFields()
if (type == 'edit') {
this.dialogForm.fileName = row.fileName
this.dialogForm.remark = row.remark
this.getDialogInfo()
}
}, 100)
},
//
/** 删除操作 */
handleDelete(row) {
console.log('删除', row)
this.$confirm('是否确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
try {
if (this.isLoading) return
this.isLoading = true
const params = { id: row.id }
console.log('🚀 ~ handleDelete ~ params:', params)
// const res = await (params)
// console.log('🚀 ~ ~ res:', res)
this.$message({
type: 'success',
message: '删除成功',
})
} catch (error) {
console.log('🚀 ~ handleDelete ~ error:', error)
} finally {
this.isLoading = false
this.getList()
this.$modal.confirm(`是否确认删除文件分类标记名称为"${row.classifyName}"的数据项?`).then(() => {
//
this.$modal.loading("正在删除,请稍候...");
delArchivalCatalogueAPI({ id: row.id }).then(res => {
this.$modal.closeLoading();
if (res.code === 200) {
this.$modal.msgSuccess("删除成功");
this.handleQuery();
} else {
this.$modal.msgError(res.msg);
}
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除',
})
})
},
//
async getDialogInfo() {
try {
this.isLoading = true
const params = { ...this.dialogForm }
console.log('🚀 ~ getDialogInfo ~ params:', params)
// const res = await (params)
// console.log('🚀 ~ ~ res:', res)
} catch (error) {
console.log('🚀 ~ 获取弹框信息 ~ error:', error)
} finally {
this.isLoading = false
}
},
//
handleSubmit() {
this.$refs.dialogForm.validate((valid) => {
console.log('🚀 ~ handleSubmit ~ valid:', valid)
if (!valid) return
try {
if (this.isLoading) return
this.isLoading = true
const params = { ...this.dialogForm }
console.log('🚀 ~ handleSubmit ~ params:', params)
} catch (error) {
console.log('🚀 ~ handleSubmit ~ error:', error)
} finally {
this.isLoading = false
this.dialogVisible = false
this.getList()
}
})
},
//
formatTime(date) {
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}${month}${day}_${hours}${minutes}${seconds}`
},
//
handleExport() {
//
this.$message({
type: 'warning',
message: '导出功能开发中,敬请期待!',
})
try {
let fileName = `导出_${this.formatTime(new Date())}.xLsx`
let url = '/material/backstage/costPush/exportPushCheck'
const params = { ...this.queryParams }
console.log('🚀 ~ 导出 ~ params:', params)
// this.derive(url, params, fileName)
// this.download(url, params, fileName)
} catch (error) {
console.log('导出数据失败', error)
}
}).catch(error => {
this.$modal.closeLoading();
this.$modal.msgError("删除失败,请重试");
console.error('删除失败:', error);
});
}).catch(() => {
//
});
},
},
}
</script>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,179 @@
<template>
<!-- 小型弹窗用于完成删除保存等操作 -->
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
<div>
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="140px">
<el-form-item label="文件分类标记名称" prop="classifyMarkName">
<el-input class="form-item" v-model="form.classifyMarkName" clearable show-word-limit
placeholder="请输入文件分类标记名称" maxlength="64"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" class="form-item"
v-model="form.remark" clearable show-word-limit placeholder="请输入备注" maxlength="255"></el-input>
</el-form-item>
</el-form>
</div>
<span slot="footer" class="dialog-footer">
<el-button class="clear-btn" @click="handleClose" :disabled="disabled">取消</el-button>
<el-button type="primary" class="search-btn" :disabled="disabled"
@click="submitForm('ruleForm')">确认</el-button>
</span>
</el-dialog>
</template>
<script>
import _ from 'lodash'
import {
addArchivalCatalogueAPI,
editArchivalCatalogueAPI ,
} from '@/api/archivesManagement/fileClassificationTags'
export default {
name: "ClassifiyMarkForm",
props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData"],
dicts: ['dimension'],
data() {
return {
lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true,
isDisabled: true,
form: {
classifyMarkName: '',
remark: '',
},
loading: null,
rules: {
classifyMarkName: [
{ required: true, message: '文件分类标记名称不能为空', trigger: 'blur' }
],
},
};
},
created() {
this.initFormData();
},
methods: {
/** 初始化表单数据 */
initFormData() {
if (this.isAdd === 'edit' && this.rowData) {
//
this.form = {
id: this.rowData.id,
classifyMarkName: this.rowData.classifyMarkName || null,
remark: this.rowData.remark || null,
};
} else {
//
this.form = {
classifyMarkName: null,
remark: null,
};
}
},
/*关闭弹窗 */
handleClose() {
this.dialogVisible = false;
this.$emit("closeDialog");
setTimeout(() => {
this.dialogVisible = true;
});
},
/**确认弹窗 */
sureBtnClick() {
this.dialogVisible = false;
this.$emit("closeDialog");
setTimeout(() => {
this.dialogVisible = true;
});
},
/**重置表单*/
reset() {
this.form = {
classifyMarkName: '',
remark: null,
};
this.resetForm("ruleForm");
},
handleReuslt(res) {
this.$modal.msgSuccess(res.msg);
this.reset();
this.$emit('handleQuery');
this.handleClose();
},
/**验证 */
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
//
this.loading = this.$loading({
lock: true,
text: "数据提交中,请稍候...",
background: 'rgba(0,0,0,0.5)',
target: this.$el.querySelector('.el-dialog') || document.body
})
let params = _.cloneDeep(this.form);
if (this.isAdd === 'add') {
addArchivalCatalogueAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
// this.$modal.msgError('');
});
} else {
editArchivalCatalogueAPI(params).then(res => {
this.loading.close();
if (res.code === 200) {
this.handleReuslt(res);
} else {
this.$modal.msgError(res.msg);
}
}).catch(error => {
this.loading.close();
// this.$modal.msgError('');
});
}
}
});
}
}
};
</script>
<style lang="scss">
.w700 .el-dialog {
width: 700px;
}
.w500 .el-dialog {
width: 500px;
}
.w500 .el-dialog__header,
.w700 .el-dialog__header {
// background: #eeeeee;
.el-dialog__title {
font-size: 16px;
}
}
.yxq .el-range-separator {
margin-right: 7px !important;
}
.el-date-editor--daterange.el-input__inner {
width: 260px;
}
.form-item {
width: 100%;
}
.select-style {
display: flex;
justify-content: space-between;
}
</style>