文件分类命名规范修改

This commit is contained in:
cwchen 2025-09-12 16:48:03 +08:00
parent 60394f82c6
commit 3b8febe221
5 changed files with 338 additions and 374 deletions

View File

@ -0,0 +1,37 @@
import request from '@/utils/request'
// 新增文件分类命名规范识别
export function addClassifyNameStandardAPI(data) {
return request({
url: '/smartArchives/classifyNameStandard/add',
method: 'POST',
data: data,
})
}
// 修改文件分类命名规范识别
export function editClassifyNameStandardAPI(data) {
return request({
url: '/smartArchives/classifyNameStandard/edit',
method: 'POST',
data: data,
})
}
// 删除文件分类命名规范识别
export function delClassifyNameStandardAPI(data) {
return request({
url: '/smartArchives/classifyNameStandard/del',
method: 'POST',
data: data,
})
}
// 查询文件分类命名规范识别列表
export function getClassifyNameStandardListAPI(data) {
return request({
url: '/smartArchives/classifyNameStandard/list',
method: 'GET',
params: data,
})
}

View File

@ -0,0 +1,18 @@
export const formLabel = [
{
isShow: false, // 是否展示label
f_type: 'ipt',
f_label: '文件命名识别规范类型',
f_model: 'standardType',
f_max: 32,
f_width: '250px',
},
]
export const columnsList = [
{ t_props: 'standardType', t_label: '文件命名识别规范类型' },
{ t_props: 'standardName', t_label: '规范识别值' },
{ t_props: 'updateUserName', t_label: '更新人' },
{ t_props: 'updateTime', t_label: '更新时间' },
{ t_props: 'remark', t_label: '备注' }
]

View File

@ -1,395 +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="classifyNameStandardTableRef"
:columnsList="columnsList" :request-api="getClassifyNameStandardListAPI">
<template slot="btn">
<el-button plain size="mini" type="primary" icon="el-icon-plus" v-hasPermi="['classify:standard: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="namingConvention">
<el-select
v-model="dialogForm.namingConvention"
placeholder="请选择"
clearable
style="width: 100%"
>
<el-option
v-for="item in namingConventionList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="规范识别值" prop="conventionValue">
<el-input
v-model="dialogForm.conventionValue"
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="['classify:standard:edit']"
@click="handleUpdate(data)">
修改
</el-button>
<el-button plain size="mini" type="danger" icon="el-icon-delete" v-hasPermi="['classify:standard:del']"
@click="handleDelete(data)">
删除
</el-button>
</template>
</TableModel>
<!-- 新增/编辑 -->
<ClassifyNameStandardForm 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 { } from '@/api/'
import TableModel from '@/components/TableModel'
import { columnsList, formLabel } from './config'
import {
delClassifyNameStandardAPI,
getClassifyNameStandardListAPI,
} from '@/api/archivesManagement/classifyNameStandard'
import ClassifyNameStandardForm from './prop/classifyNameStandardForm.vue'
export default {
name: 'FileClassificationTags',
components: {
TableModel,
ClassifyNameStandardForm
},
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: 'namingConvention' },
{ label: '规范识别值', prop: 'conventionValue' },
{ label: '更新人', prop: 'updater' },
{ label: '更新时间', prop: 'updateTime' },
{ label: '备注', prop: 'remark' },
],
//
tableList: [
{
id: 1,
namingConvention: '测试',
conventionValue: '测试维度',
updater: '张三',
updateTime: '2024-06-20 12:00:00',
remark: '测试数据',
},
],
isOut: false, //
dialogTitle: '详情',
dialogVisible: false,
dialogForm: {
namingConvention: '',
remark: '',
},
dialogRules: {
namingConvention: [
{
required: true,
message: '请输入文件命名识别规范类型',
trigger: 'blur',
},
],
conventionValue: [
{
required: true,
message: '请输入规范识别值',
trigger: 'blur',
},
],
},
namingConventionList: [
{ label: '变电', value: 1 },
{ label: '线路', value: 2 },
{ label: '电缆', value: 3 },
],
formLabel,
columnsList,
getClassifyNameStandardListAPI,
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.classifyNameStandardTableRef.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.standardType}"的数据项?`).then(() => {
//
this.$modal.loading("正在删除,请稍候...");
delClassifyNameStandardAPI({ 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,193 @@
<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="180px">
<el-form-item label="文件命名识别规范类型" prop="standardType">
<el-select class="form-item" v-model="form.standardType" filterable clearable
placeholder="请选择文件命名识别规范类型">
<el-option v-for="item in dict.type.files_classify_name_standard_type" :key="item.value" :label="item.label"
:value="item.label"></el-option>
</el-select>
</el-form-item>
<el-form-item label="规范识别值" prop="standardName">
<el-input class="form-item" v-model="form.standardName" clearable show-word-limit
placeholder="请输入规范识别值" maxlength="32"></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="200"></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 {
addClassifyNameStandardAPI,
editClassifyNameStandardAPI ,
} from '@/api/archivesManagement/classifyNameStandard'
export default {
name: "ClassifyNameStandardForm",
props: ["width", "dataForm", "title", "disabled", "isAdd", "rowData"],
dicts: ['files_classify_name_standard_type'],
data() {
return {
lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true,
isDisabled: true,
form: {
standardType: null,
standardName: null,
remark: null,
},
loading: null,
rules: {
standardType: [
{ required: true, message: '请选择文件命名识别规范类型', trigger: 'change' }
],
standardName: [
{ required: true, message: '规范识别值不能为空', trigger: 'blur' }
],
},
};
},
created() {
this.initFormData();
},
methods: {
/** 初始化表单数据 */
initFormData() {
if (this.isAdd === 'edit' && this.rowData) {
//
this.form = {
id: this.rowData.id,
standardType: this.rowData.standardType || null,
standardName: this.rowData.standardName || null,
remark: this.rowData.remark || null,
};
} else {
//
this.form = {
standardType: null,
standardName: 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 = {
standardType: null,
standardName: null,
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') {
addClassifyNameStandardAPI(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 {
editClassifyNameStandardAPI(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>

View File

@ -4,18 +4,18 @@
<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']"
<el-button plain size="mini" type="primary" icon="el-icon-plus" v-hasPermi="['files:classify:add']"
@click="handleAdd">
新增
</el-button>
</template>
<template slot="handle" slot-scope="{ data }">
<el-button plain size="mini" type="primary" icon="el-icon-edit" v-hasPermi="['files:multi:update']"
<el-button plain size="mini" type="primary" icon="el-icon-edit" v-hasPermi="['files:classify:edit']"
@click="handleUpdate(data)">
修改
</el-button>
<el-button plain size="mini" type="danger" icon="el-icon-delete" v-hasPermi="['files:multi:del']"
<el-button plain size="mini" type="danger" icon="el-icon-delete" v-hasPermi="['files:classify:del']"
@click="handleDelete(data)">
删除
</el-button>