修改下载文件类型的备份

This commit is contained in:
chabai 2025-07-30 15:58:23 +08:00
parent 1dc321ba5c
commit 64a82a6775
7 changed files with 444 additions and 30 deletions

View File

@ -54,5 +54,38 @@ export const regulationApi = {
// 确认制度知晓
confirmRegulation: (regulationId: string) => {
return http.post(`/regulation/${regulationId}/confirm`)
},
// 获取制度类型列表
getRegulationTypes: (params?: {
page?: number
size?: number
typeName?: string
remark?: string
}) => {
return http.get('/regulation/types', params)
},
// 创建制度类型
createRegulationType: (data: {
typeName: string
sortOrder?: number
isEnabled?: string
}) => {
return http.post('/regulation/types', data)
},
// 更新制度类型
updateRegulationType: (typeId: string, data: {
typeName: string
sortOrder?: number
isEnabled?: string
}) => {
return http.put(`/regulation/types/${typeId}`, data)
},
// 删除制度类型
deleteRegulationType: (typeId: string) => {
return http.del(`/regulation/types/${typeId}`)
}
}

View File

@ -22,8 +22,6 @@ export interface Regulation {
content: string
regulationType: string
status: RegulationStatus
publisherId: string
publisherName: string
publishTime: string
effectiveTime: string
expireTime: string
@ -38,6 +36,7 @@ export interface Regulation {
page: number
pageSize: number
delFlag: string
confirmStatus?: string
}
// 创建提案请求接口
@ -54,4 +53,34 @@ export interface CreateProposalRequest {
export interface PaginationParams {
page: number
size: number
}
// 制度类型接口
export interface RegulationType {
typeId: string
typeName: string
sortOrder: number
isEnabled: string
remark?: string
createBy: string
createTime: string
updateBy: string
updateTime: string
delFlag: string
}
// 创建制度类型请求接口
export interface CreateRegulationTypeRequest {
typeName: string
sortOrder?: number
isEnabled?: string
remark?: string
}
// 更新制度类型请求接口
export interface UpdateRegulationTypeRequest {
typeName: string
sortOrder?: number
isEnabled?: string
remark?: string
}

View File

@ -37,7 +37,13 @@ export const systemRoutes: RouteRecordRaw[] = [
path: '/regulation/system-regulation',
name: 'SystemRegulation',
component: () => import('@/views/regulation/repository.vue'),
meta: { title: '制度确认', icon: 'file-text', hidden: false },
meta: { title: '制度公示', icon: 'file-text', hidden: false },
},
{
path: '/regulation/type',
name: 'RegulationType',
component: () => import('@/views/regulation/type/index.vue'),
meta: { title: '制度类型', icon: 'tag', hidden: false },
},
{
path: '/regulation/process-management',

View File

@ -88,12 +88,14 @@
<a-col :span="12">
<a-form-item label="提案类型" field="regulationType">
<a-select v-model="formData.regulationType" placeholder="请选择提案类型">
<a-option value="人事制度">人事制度</a-option>
<a-option value="财务制度">财务制度</a-option>
<a-option value="安全制度">安全制度</a-option>
<a-option value="设备制度">设备制度</a-option>
<a-option value="工作流程">工作流程</a-option>
<a-option value="其他制度">其他制度</a-option>
<a-option
v-for="type in regulationTypes"
:key="type.typeId"
:value="type.typeName"
:disabled="type.isEnabled === '0'"
>
{{ type.typeName }}
</a-option>
</a-select>
</a-form-item>
</a-col>
@ -149,7 +151,7 @@
<div class="detail-header">
<h3>{{ currentProposal.title }}</h3>
<div class="detail-meta">
<span>提案人: {{ currentProposal.publisherName }}</span>
<span>提案人: {{ currentProposal.createBy }}</span>
<span>提案类型: {{ currentProposal.regulationType }}</span>
<span>适用范围: {{ currentProposal.scope }}</span>
<span>级别: <a-tag :color="getLevelColor(currentProposal.level)">{{ getLevelText(currentProposal.level) }}</a-tag></span>
@ -191,7 +193,8 @@ import { regulationApi } from '@/apis/regulation'
import {
RegulationStatus,
RegulationLevel,
type Regulation
type Regulation,
type RegulationType
} from '@/apis/regulation/type'
defineOptions({ name: 'ProcessManagement' })
@ -199,7 +202,7 @@ defineOptions({ name: 'ProcessManagement' })
//
const columns = [
{ title: '提案标题', dataIndex: 'title', key: 'title' },
{ title: '提案人', dataIndex: 'publisherName', key: 'publisherName' },
{ title: '提案人', dataIndex: 'createBy', key: 'createBy' },
{ title: '提案类型', dataIndex: 'regulationType', key: 'regulationType' },
{ title: '状态', dataIndex: 'status', key: 'status', slotName: 'status' },
{ title: '级别', dataIndex: 'level', key: 'level', slotName: 'level' },
@ -238,12 +241,15 @@ const currentProposal = ref<Regulation | null>(null)
//
const detailModalVisible = ref(false)
// -
const currentUser = ref('') // TODO: ID
//
const currentUser = ref('admin') // ID
// store
const regulationStore = useRegulationStore()
//
const regulationTypes = ref<RegulationType[]>([])
//
const rules = {
title: [{ required: true, message: '请输入提案标题' }],
@ -311,6 +317,18 @@ const getLevelText = (level: RegulationLevel) => {
return texts[level] || '中'
}
//
const getRegulationTypes = async () => {
try {
const response = await regulationApi.getRegulationTypes()
if (response.status === 200) {
regulationTypes.value = response.data.records || response.data
}
} catch (error) {
console.error('获取制度类型列表失败:', error)
}
}
//
const getTableData = async () => {
loading.value = true
@ -450,6 +468,7 @@ const handlePageSizeChange = (pageSize: number) => {
onMounted(() => {
getTableData()
getRegulationTypes()
})
</script>

View File

@ -36,17 +36,19 @@
<script setup lang="tsx">
import { useRoute, useRouter } from 'vue-router'
import SystemRegulation from './system-regulation/index.vue'
import ProcessManagement from './process-management/index.vue'
import SystemRegulation from './repository.vue'
import RegulationType from './type/index.vue'
import ProcessManagement from './confirm.vue'
import { useDevice } from '@/hooks'
defineOptions({ name: 'ZhiduManagement' })
defineOptions({ name: 'RegulationManagement' })
const { isDesktop } = useDevice()
const data = [
{ name: '制度规范', key: 'system-regulation', icon: 'file-text', value: SystemRegulation, path: '/zhidu/system-regulation' },
{ name: '流程管理', key: 'process-management', icon: 'workflow', value: ProcessManagement, path: '/zhidu/process-management' },
{ name: '制度公示', key: 'system-regulation', icon: 'file-text', value: SystemRegulation, path: '/regulation/system-regulation' },
{ name: '制度类型', key: 'type', icon: 'tag', value: RegulationType, path: '/regulation/type' },
{ name: '流程管理', key: 'process-management', icon: 'workflow', value: ProcessManagement, path: '/regulation/process-management' },
]
const menuList = computed(() => {

View File

@ -22,14 +22,6 @@
<a-button type="text" size="small" @click="handleView(record)">
查看详情
</a-button>
<a-button
v-if="record.confirmStatus !== 'confirmed'"
type="text"
size="small"
@click="handleConfirm(record)"
>
确认知晓
</a-button>
<a-button type="text" size="small" @click="handleDownload(record)">
下载
</a-button>
@ -49,7 +41,7 @@
<div class="detail-header">
<h3>{{ currentRegulation.title }}</h3>
<div class="detail-meta">
<span>发布人: {{ currentRegulation.publisherName }}</span>
<span>发布人: {{ currentRegulation.createBy }}</span>
<span>发布时间: {{ currentRegulation.publishTime }}</span>
<span>生效日期: {{ currentRegulation.effectiveTime }}</span>
</div>
@ -121,7 +113,7 @@ defineOptions({ name: 'SystemRegulation' })
const columns = [
{ title: '制度名称', dataIndex: 'title', key: 'title' },
{ title: '制度类型', dataIndex: 'regulationType', key: 'regulationType' },
{ title: '发布人', dataIndex: 'publisherName', key: 'publisherName' },
{ title: '发布人', dataIndex: 'createBy', key: 'createBy' },
{ title: '发布时间', dataIndex: 'publishTime', key: 'publishTime' },
{ title: '生效日期', dataIndex: 'effectiveTime', key: 'effectiveTime' },
{ title: '确认状态', dataIndex: 'confirmStatus', key: 'confirmStatus', slotName: 'confirmStatus' },
@ -207,7 +199,7 @@ const handleDownload = (record: any) => {
const content = `
制度名称${record.title}
制度类型${record.regulationType}
发布人${record.publisherName}
发布人${record.createBy}
发布时间${record.publishTime}
生效日期${record.effectiveTime}

View File

@ -0,0 +1,333 @@
<template>
<GiPageLayout>
<GiTable
row-key="typeId"
title="制度类型管理"
:data="dataList"
:columns="tableColumns"
:loading="loading"
:scroll="{ x: '100%', y: '100%', minWidth: 1000 }"
:pagination="pagination"
@page-change="onPageChange"
@page-size-change="onPageSizeChange"
@refresh="search"
>
<template #top>
<GiForm
v-model="searchForm"
search
:columns="queryFormColumns"
size="medium"
@search="search"
@reset="reset"
/>
</template>
<template #toolbar-left>
<a-space>
<a-button type="primary" @click="openAddModal">
<template #icon><icon-plus /></template>
<template #default>新增类型</template>
</a-button>
</a-space>
</template>
<!-- 启用状态 -->
<template #isEnabled="{ record }">
<a-tag :color="record.isEnabled === '1' ? 'green' : 'red'">
{{ record.isEnabled === '1' ? '启用' : '禁用' }}
</a-tag>
</template>
<!-- 操作列 -->
<template #action="{ record }">
<a-space>
<a-link @click="editRecord(record)">编辑</a-link>
<a-popconfirm
content="确定要删除这个制度类型吗?"
@ok="deleteRecord(record)"
>
<a-link status="danger">删除</a-link>
</a-popconfirm>
</a-space>
</template>
</GiTable>
<!-- 新增/编辑弹窗 -->
<a-modal
v-model:visible="modalVisible"
:title="modalTitle"
width="600px"
@ok="handleSubmit"
@cancel="handleCancel"
>
<a-form
ref="formRef"
:model="formData"
:rules="rules"
layout="vertical"
>
<a-form-item label="类型名称" field="typeName">
<a-input v-model="formData.typeName" placeholder="请输入制度类型名称" />
</a-form-item>
<a-form-item label="排序" field="sortOrder">
<a-input-number
v-model="formData.sortOrder"
placeholder="请输入排序值"
:min="0"
:max="999"
style="width: 100%"
/>
</a-form-item>
<a-form-item label="状态" field="isEnabled">
<a-radio-group v-model="formData.isEnabled">
<a-radio value="1">启用</a-radio>
<a-radio value="0">禁用</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="备注" field="remark">
<a-textarea
v-model="formData.remark"
placeholder="请输入备注信息"
:rows="3"
/>
</a-form-item>
</a-form>
</a-modal>
</GiPageLayout>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { Message } from '@arco-design/web-vue'
import { regulationApi } from '@/apis/regulation'
import {
type RegulationType,
type CreateRegulationTypeRequest,
type UpdateRegulationTypeRequest
} from '@/apis/regulation/type'
defineOptions({ name: 'RegulationType' })
//
const tableColumns = [
{ title: '类型名称', dataIndex: 'typeName', key: 'typeName', width: 150 },
{ title: '备注', dataIndex: 'remark', key: 'remark', width: 200 },
{ title: '状态', dataIndex: 'isEnabled', key: 'isEnabled', slotName: 'isEnabled', width: 100 },
{ title: '创建人', dataIndex: 'createBy', key: 'createBy', width: 120 },
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime', width: 180 },
{ title: '排序', dataIndex: 'sortOrder', key: 'sortOrder', width: 100 },
{ title: '操作', key: 'action', slotName: 'action', width: 150, fixed: 'right' }
]
//
const queryFormColumns = [
{
label: '类型名称',
field: 'typeName',
component: 'a-input',
componentProps: {
placeholder: '请输入类型名称'
}
},
{
label: '备注',
field: 'remark',
component: 'a-input',
componentProps: {
placeholder: '请输入备注内容'
}
}
]
//
const dataList = ref<RegulationType[]>([])
const loading = ref(false)
const pagination = reactive({
current: 1,
pageSize: 10,
total: 0,
showTotal: true,
showJumper: true,
showPageSize: true
})
//
const searchForm = reactive({
typeName: '',
remark: ''
})
//
const modalVisible = ref(false)
const modalTitle = ref('新增制度类型')
const formRef = ref()
const formData = reactive({
typeId: '',
typeName: '',
sortOrder: 0,
isEnabled: '1',
remark: ''
})
//
const rules = {
typeName: [{ required: true, message: '请输入制度类型名称' }],
sortOrder: [{ required: true, message: '请输入排序值' }],
isEnabled: [{ required: true, message: '请选择状态' }]
}
//
const getTableData = async () => {
loading.value = true
try {
const response = await regulationApi.getRegulationTypes({
page: pagination.current,
size: pagination.pageSize,
typeName: searchForm.typeName || undefined,
remark: searchForm.remark || undefined
})
if (response.status === 200) {
dataList.value = response.data.records || response.data
pagination.total = response.data.total || response.data.length
pagination.current = response.data.current || 1
} else {
Message.error('获取数据失败')
}
} catch (error) {
console.error('获取制度类型列表失败:', error)
Message.error('获取数据失败')
} finally {
loading.value = false
}
}
//
const search = () => {
pagination.current = 1
getTableData()
}
//
const reset = () => {
Object.assign(searchForm, {
typeName: '',
remark: ''
})
pagination.current = 1
getTableData()
}
//
const onPageChange = (page: number) => {
pagination.current = page
getTableData()
}
const onPageSizeChange = (pageSize: number) => {
pagination.pageSize = pageSize
pagination.current = 1
getTableData()
}
//
const openAddModal = () => {
modalTitle.value = '新增制度类型'
modalVisible.value = true
resetForm()
}
//
const editRecord = (record: RegulationType) => {
modalTitle.value = '编辑制度类型'
modalVisible.value = true
Object.assign(formData, {
typeId: record.typeId,
typeName: record.typeName,
sortOrder: record.sortOrder,
isEnabled: record.isEnabled,
remark: record.remark || ''
})
}
//
const deleteRecord = async (record: RegulationType) => {
try {
await regulationApi.deleteRegulationType(record.typeId)
Message.success('删除成功')
getTableData()
} catch (error) {
console.error('删除失败:', error)
Message.error('删除失败')
}
}
//
const handleSubmit = async () => {
try {
await formRef.value.validate()
if (formData.typeId) {
//
const updateData: UpdateRegulationTypeRequest = {
typeName: formData.typeName,
sortOrder: formData.sortOrder,
isEnabled: formData.isEnabled,
remark: formData.remark
}
await regulationApi.updateRegulationType(formData.typeId, updateData)
Message.success('更新成功')
} else {
//
const createData: CreateRegulationTypeRequest = {
typeName: formData.typeName,
sortOrder: formData.sortOrder,
isEnabled: formData.isEnabled,
remark: formData.remark
}
await regulationApi.createRegulationType(createData)
Message.success('新增成功')
}
modalVisible.value = false
getTableData()
} catch (error) {
console.error('操作失败:', error)
Message.error('操作失败')
}
}
//
const handleCancel = () => {
modalVisible.value = false
resetForm()
}
//
const resetForm = () => {
Object.assign(formData, {
typeId: '',
typeName: '',
sortOrder: 0,
isEnabled: '1',
remark: ''
})
formRef.value?.resetFields()
}
onMounted(() => {
getTableData()
})
</script>
<style scoped lang="scss">
.regulation-type {
.arco-card {
margin-bottom: 16px;
}
}
</style>