审批模板修改

This commit is contained in:
2026-09-18 16:08:51 +08:00
parent 683e3187ac
commit f97e137f85
3 changed files with 131 additions and 16 deletions
+11
View File
@@ -0,0 +1,11 @@
import { request } from '../request';
// 列表查询
export function changeLedgerListApi(params:any) {
return request({
url: `/api/changes`,
method: 'get',
params,
});
}
+73 -7
View File
@@ -1,8 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from 'vue'; import { ref, computed, onMounted } from 'vue';
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue'
import { useThemeStore } from '@/store/modules/theme'; import { useThemeStore } from '@/store/modules/theme';
import { useRouterPush } from '@/hooks/common/router'; import { useRouterPush } from '@/hooks/common/router';
import { changeLedgerListApi } from '@/service/api/changeLedger';
const { routerPushByKey } = useRouterPush(); const { routerPushByKey } = useRouterPush();
const themeStore = useThemeStore(); const themeStore = useThemeStore();
@@ -458,11 +459,66 @@ const revokeSave = () => {
window.$message?.success(ledgerAct.value?.act === 'withdraw' ? `已撤回 ${ledgerAct.value?.id},申请退回草稿箱,审批记录保留可查` : `${ledgerAct.value?.id} 情况说明已提交,变更转入关闭流程(主管部门确认后记录关闭时间)`); window.$message?.success(ledgerAct.value?.act === 'withdraw' ? `已撤回 ${ledgerAct.value?.id},申请退回草稿箱,审批记录保留可查` : `${ledgerAct.value?.id} 情况说明已提交,变更转入关闭流程(主管部门确认后记录关闭时间)`);
revokeCancel(); revokeCancel();
} }
const loading = ref<boolean>(false);
// 筛选条件
const formInfo = ref<any>({
kw: '',
type: 0,
level: 0,
duration: 0,
status: [],
org_id: 1,
apply_time_start: null,
apply_time_end: null,
self: 1,
});
const pagination = ref<{page: number, pageSize: number, itemCount: number}>({
page: 1,
pageSize: 3,
itemCount: 0,
})
// 列表
const list = ref<any[]>([]);
// 分页改变
const pageChange = (page: number) => {
pagination.value.page = page;
getList();
}
// 列表查询
const getList = async () => {
loading.value = true;
const {error, data} = await changeLedgerListApi({
kw: formInfo.value.kw,
type: formInfo.value.type,
level: formInfo.value.level,
duration: formInfo.value.duration,
status: formInfo.value.status,
org_id: formInfo.value.org_id,
apply_time_start: formInfo.value.apply_time_start,
apply_time_end: formInfo.value.apply_time_end,
self: formInfo.value.self,
page_num: pagination.value.page,
page_size: pagination.value.pageSize,
});
if (!error) {
console.log(data)
list.value = data?.list ?? [];
pagination.value.itemCount = data?.total ?? 0;
}
loading.value = false;
}
onMounted(() => {
getList();
});
</script> </script>
<template> <template>
<NSpace vertical :size="16"> <NSpace vertical :size="16">
<!-- 我发起的变更 --> <!-- 我发起的变更 -->
<NSpin :show="loading" size="small">
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }"> <NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<!-- 工具条 --> <!-- 工具条 -->
<div <div
@@ -590,8 +646,17 @@ const revokeSave = () => {
</div> </div>
<div v-if="finalRows.length === 0" class="rounded-lg border border-dashed bg-white py-12 text-center text-sm text-slate-400">当前筛选条件下暂无变更记录</div> <div v-if="finalRows.length === 0" class="rounded-lg border border-dashed bg-white py-12 text-center text-sm text-slate-400">当前筛选条件下暂无变更记录</div>
</div> </div>
<div class="text-xs text-slate-400 mt-3"> <div class="flex justify-end mt-3">
{{ finalRows.length }} · 台账以查看下载为主申请表 / 归档包"我"相关的待办流转请前往我的任务处理点击变更名称可打开详情 <NPagination
v-model:page="pagination.page"
:page-size="pagination.pageSize"
:item-count="pagination.itemCount"
:on-update:page="pageChange"
>
<template #prefix="{ itemCount }">
{{ itemCount }}
</template>
</NPagination>
</div> </div>
<!-- 撤回/未实施情况说明/未投用情况说明弹框 --> <!-- 撤回/未实施情况说明/未投用情况说明弹框 -->
<NModal <NModal
@@ -674,7 +739,8 @@ const revokeSave = () => {
</NDrawerContent> </NDrawerContent>
</NDrawer> </NDrawer>
</NCard> </NCard>
</NSpace> </NSpin>
</NSpace>
</template> </template>
<style scoped> <style scoped>
@@ -682,7 +748,7 @@ const revokeSave = () => {
</style> </style>
<style scoped lang="scss"> <style scoped lang="scss">
.scroll { .scroll {
height: calc(100vh - 326px); height: calc(100vh - 338px);
overflow-y: auto; overflow-y: auto;
} }
</style> </style>
+47 -9
View File
@@ -6,7 +6,6 @@ import { useThemeStore } from '@/store/modules/theme';
import { NButton, NPopconfirm, NTag } from 'naive-ui'; import { NButton, NPopconfirm, NTag } from 'naive-ui';
import { tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common'; import { tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common';
import { templateListApi, systemConfigApi, peopleListApi, addTemplateApi, editTemplateApi, deleteTemplateApi } from '@/service/api/system'; import { templateListApi, systemConfigApi, peopleListApi, addTemplateApi, editTemplateApi, deleteTemplateApi } from '@/service/api/system';
import { json } from 'node:stream/consumers';
const appStore = useAppStore(); const appStore = useAppStore();
const themeStore = useThemeStore(); const themeStore = useThemeStore();
@@ -17,20 +16,25 @@ const btnLoading = ref<boolean>(false);
const currentType = ref<string>('add'); const currentType = ref<string>('add');
const readonly = computed(() => currentType.value === "view"); const readonly = computed(() => currentType.value === "view");
const formRef = ref<any>(null); const formRef = ref<any>(null);
const currentTemplate = ref<{ id: number, category: string | null, level: string | null, duration: number | null, steps: any[] }>({ const currentTemplate = ref<{ id: number,type: number | null, category: string | null, level: string | null, duration: number | null, steps: any[] }>({
id: 0, id: 0,
type: null,
category: null, category: null,
level: null, level: null,
duration: null, duration: null,
steps: [], steps: [],
}); });
const rules = ref({ const rules = ref({
type: { type: 'number', required: true, message: '模板类型不能为空', trigger: ['blur', 'change'] },
category: { required: true, message: '变更类别不能为空', trigger: ['blur', 'change'] }, category: { required: true, message: '变更类别不能为空', trigger: ['blur', 'change'] },
level: { required: true, message: '变更等级不能为空', trigger: ['blur', 'change'] }, level: { required: true, message: '变更等级不能为空', trigger: ['blur', 'change'] },
duration: { type: 'number', required: true, message: '变更时效不能为空', trigger: ['blur', 'change'] }, duration: { type: 'number', required: true, message: '变更时效不能为空', trigger: ['blur', 'change'] },
}) })
const templateModal = ref<boolean>(false); const templateModal = ref<boolean>(false);
const typeOptions = ref<{ label: string, value: number }[]>([
{ label: '变更申请', value: 1 },
{ label: '处置申请', value: 2 },
])
const categoryOptions = ref<{ label: string, value: string, color: string }[]>([]) const categoryOptions = ref<{ label: string, value: string, color: string }[]>([])
const levelOptions = ref<{ label: string, value: string, color: string }[]>([]) const levelOptions = ref<{ label: string, value: string, color: string }[]>([])
const durationOptions = ref<{ label: string, value: number }[]>([ const durationOptions = ref<{ label: string, value: number }[]>([
@@ -52,10 +56,22 @@ const peopleList = ref<{label: string, value: string,children: any[]}[]>([]);
// 根据value匹配label和color // 根据value匹配label和color
const getLabel = (type: string, value: number) => { const getLabel = (type: string, value: number) => {
if(!value){
return null;
}
if(type=='level'){ if(type=='level'){
return levelOptions.value.find((item: { label: string, value: string, color: string }) => item.value === value.toString()) || null; return levelOptions.value.find((item: { label: string, value: string, color: string }) => item.value === value.toString()) || null;
} }
return categoryOptions.value.find((item: { label: string, value: string, color: string }) => item.value === value.toString()) || null; if(type==='category'){
return categoryOptions.value.find((item: { label: string, value: string, color: string }) => item.value === value.toString()) || null;
}
if(type=='mode'){
return typeOptions.value.find((item: { label: string, value: number }) => item.value === value) || null;
}
if(type==='duration'){
return durationOptions.value.find((item: { label: string, value: number }) => item.value === value) || null;
}
return null;
} }
const columns = ref([ const columns = ref([
{ {
@@ -67,6 +83,15 @@ const columns = ref([
return h('span', {}, { default: () => index + 1 }) return h('span', {}, { default: () => index + 1 })
} }
}, },
{
title: '模板类型',
key: 'type',
width: 10,
align: 'center',
render: (row: any) => {
return h('span', {}, { default: () => `${getLabel('mode', row.type)?.label || ''}` })
}
},
{ {
title: '变更类别', title: '变更类别',
key: 'category', key: 'category',
@@ -108,7 +133,7 @@ const columns = ref([
return h(NTag, { return h(NTag, {
size: 'small', size: 'small',
type: `${row.duration===2?'warning':'info'}` type: `${row.duration===2?'warning':'info'}`
}, { default: () => `${row.duration===2?'临时':'永久'}` }) }, { default: () => `${getLabel('duration', row.duration)?.label || ''}` })
} }
}, },
{ {
@@ -186,6 +211,7 @@ const addTemplate = () => {
currentType.value = 'add'; currentType.value = 'add';
currentTemplate.value = { currentTemplate.value = {
id: 0, id: 0,
type: null,
category: null, category: null,
level: null, level: null,
duration: null, duration: null,
@@ -198,6 +224,7 @@ const handleView = (row: any) => {
currentType.value = 'view'; currentType.value = 'view';
currentTemplate.value = { currentTemplate.value = {
id: row.id, id: row.id,
type: row.type,
category: row.category.toString(), category: row.category.toString(),
level: row.level.toString(), level: row.level.toString(),
duration: row.duration, duration: row.duration,
@@ -210,6 +237,7 @@ const handleEdit = (row: any) => {
currentType.value = 'edit'; currentType.value = 'edit';
let obj = { let obj = {
id: row.id, id: row.id,
type: row.type,
category: row.category.toString(), category: row.category.toString(),
level: row.level.toString(), level: row.level.toString(),
duration: row.duration, duration: row.duration,
@@ -455,13 +483,21 @@ onMounted(() => {
preset="card" preset="card"
:title="currentType === 'add' ? '新增模板' : currentType === 'edit' ? '编辑模板':'查看模板'" :title="currentType === 'add' ? '新增模板' : currentType === 'edit' ? '编辑模板':'查看模板'"
:auto-focus="false" :auto-focus="false"
:style="{ width: '800px', height: 'auto' }" :style="{ width: '700px', height: 'auto' }"
:segmented="{ content: true, footer: true }" :segmented="{ content: true, footer: true }"
> >
<template #default> <template #default>
<NForm class="w-full" ref="formRef" :model="currentTemplate" :rules="rules" label-placement="left" label-width="auto"> <NForm class="w-full" ref="formRef" :model="currentTemplate" :rules="rules" label-placement="left" label-width="auto">
<NGrid :cols="24" :x-gap="24"> <NGrid :cols="24" :x-gap="24">
<NFormItemGi :span="8" label="变更类别" path="category"> <NFormItemGi :span="12" label="模板类型" path="type">
<NSelect
v-model:value="currentTemplate.type"
:options="typeOptions"
:disabled="readonly"
placeholder="请选择"
/>
</NFormItemGi>
<NFormItemGi :span="12" label="变更类别" path="category">
<NSelect <NSelect
v-model:value="currentTemplate.category" v-model:value="currentTemplate.category"
:options="categoryOptions" :options="categoryOptions"
@@ -469,7 +505,9 @@ onMounted(() => {
placeholder="请选择" placeholder="请选择"
/> />
</NFormItemGi> </NFormItemGi>
<NFormItemGi :span="8" label="变更等级" path="level"> </NGrid>
<NGrid :cols="24" :x-gap="24">
<NFormItemGi :span="12" label="变更等级" path="level">
<NSelect <NSelect
v-model:value="currentTemplate.level" v-model:value="currentTemplate.level"
:options="levelOptions" :options="levelOptions"
@@ -477,7 +515,7 @@ onMounted(() => {
placeholder="请选择" placeholder="请选择"
/> />
</NFormItemGi> </NFormItemGi>
<NFormItemGi :span="8" label="变更时效" path="duration"> <NFormItemGi :span="12" label="变更时效" path="duration">
<NSelect <NSelect
v-model:value="currentTemplate.duration" v-model:value="currentTemplate.duration"
:options="durationOptions" :options="durationOptions"