审批模板修改
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import { request } from '../request';
|
||||
|
||||
// 列表查询
|
||||
export function changeLedgerListApi(params:any) {
|
||||
return request({
|
||||
url: `/api/changes`,
|
||||
method: 'get',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { Icon } from '@iconify/vue'
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { useRouterPush } from '@/hooks/common/router';
|
||||
import { changeLedgerListApi } from '@/service/api/changeLedger';
|
||||
|
||||
const { routerPushByKey } = useRouterPush();
|
||||
const themeStore = useThemeStore();
|
||||
@@ -458,11 +459,66 @@ const revokeSave = () => {
|
||||
window.$message?.success(ledgerAct.value?.act === 'withdraw' ? `已撤回 ${ledgerAct.value?.id},申请退回草稿箱,审批记录保留可查` : `${ledgerAct.value?.id} 情况说明已提交,变更转入关闭流程(主管部门确认后记录关闭时间)`);
|
||||
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>
|
||||
|
||||
<template>
|
||||
<NSpace vertical :size="16">
|
||||
<!-- 我发起的变更 -->
|
||||
<NSpace vertical :size="16">
|
||||
<!-- 我发起的变更 -->
|
||||
<NSpin :show="loading" size="small">
|
||||
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
|
||||
<!-- 工具条 -->
|
||||
<div
|
||||
@@ -590,8 +646,17 @@ const revokeSave = () => {
|
||||
</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 class="text-xs text-slate-400 mt-3">
|
||||
共 {{ finalRows.length }} 条 · 台账以查看、下载为主(申请表 / 归档包);与"我"相关的待办流转请前往「我的任务」处理。点击变更名称可打开详情。
|
||||
<div class="flex justify-end mt-3">
|
||||
<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>
|
||||
<!-- 撤回/未实施情况说明/未投用情况说明弹框 -->
|
||||
<NModal
|
||||
@@ -674,7 +739,8 @@ const revokeSave = () => {
|
||||
</NDrawerContent>
|
||||
</NDrawer>
|
||||
</NCard>
|
||||
</NSpace>
|
||||
</NSpin>
|
||||
</NSpace>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@@ -682,7 +748,7 @@ const revokeSave = () => {
|
||||
</style>
|
||||
<style scoped lang="scss">
|
||||
.scroll {
|
||||
height: calc(100vh - 326px);
|
||||
height: calc(100vh - 338px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -6,7 +6,6 @@ import { useThemeStore } from '@/store/modules/theme';
|
||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||
import { tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common';
|
||||
import { templateListApi, systemConfigApi, peopleListApi, addTemplateApi, editTemplateApi, deleteTemplateApi } from '@/service/api/system';
|
||||
import { json } from 'node:stream/consumers';
|
||||
|
||||
const appStore = useAppStore();
|
||||
const themeStore = useThemeStore();
|
||||
@@ -17,20 +16,25 @@ const btnLoading = ref<boolean>(false);
|
||||
const currentType = ref<string>('add');
|
||||
const readonly = computed(() => currentType.value === "view");
|
||||
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,
|
||||
type: null,
|
||||
category: null,
|
||||
level: null,
|
||||
duration: null,
|
||||
steps: [],
|
||||
});
|
||||
const rules = ref({
|
||||
type: { type: 'number', required: true, message: '模板类型不能为空', trigger: ['blur', 'change'] },
|
||||
category: { required: true, message: '变更类别不能为空', trigger: ['blur', 'change'] },
|
||||
level: { required: true, message: '变更等级不能为空', trigger: ['blur', 'change'] },
|
||||
duration: { type: 'number', required: true, message: '变更时效不能为空', trigger: ['blur', 'change'] },
|
||||
})
|
||||
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 levelOptions = ref<{ label: string, value: string, color: string }[]>([])
|
||||
const durationOptions = ref<{ label: string, value: number }[]>([
|
||||
@@ -52,10 +56,22 @@ const peopleList = ref<{label: string, value: string,children: any[]}[]>([]);
|
||||
|
||||
// 根据value匹配label和color
|
||||
const getLabel = (type: string, value: number) => {
|
||||
if(!value){
|
||||
return null;
|
||||
}
|
||||
if(type=='level'){
|
||||
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([
|
||||
{
|
||||
@@ -67,6 +83,15 @@ const columns = ref([
|
||||
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: '变更类别',
|
||||
key: 'category',
|
||||
@@ -108,7 +133,7 @@ const columns = ref([
|
||||
return h(NTag, {
|
||||
size: 'small',
|
||||
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';
|
||||
currentTemplate.value = {
|
||||
id: 0,
|
||||
type: null,
|
||||
category: null,
|
||||
level: null,
|
||||
duration: null,
|
||||
@@ -198,6 +224,7 @@ const handleView = (row: any) => {
|
||||
currentType.value = 'view';
|
||||
currentTemplate.value = {
|
||||
id: row.id,
|
||||
type: row.type,
|
||||
category: row.category.toString(),
|
||||
level: row.level.toString(),
|
||||
duration: row.duration,
|
||||
@@ -210,6 +237,7 @@ const handleEdit = (row: any) => {
|
||||
currentType.value = 'edit';
|
||||
let obj = {
|
||||
id: row.id,
|
||||
type: row.type,
|
||||
category: row.category.toString(),
|
||||
level: row.level.toString(),
|
||||
duration: row.duration,
|
||||
@@ -455,13 +483,21 @@ onMounted(() => {
|
||||
preset="card"
|
||||
:title="currentType === 'add' ? '新增模板' : currentType === 'edit' ? '编辑模板':'查看模板'"
|
||||
:auto-focus="false"
|
||||
:style="{ width: '800px', height: 'auto' }"
|
||||
:style="{ width: '700px', height: 'auto' }"
|
||||
:segmented="{ content: true, footer: true }"
|
||||
>
|
||||
<template #default>
|
||||
<NForm class="w-full" ref="formRef" :model="currentTemplate" :rules="rules" label-placement="left" label-width="auto">
|
||||
<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
|
||||
v-model:value="currentTemplate.category"
|
||||
:options="categoryOptions"
|
||||
@@ -469,7 +505,9 @@ onMounted(() => {
|
||||
placeholder="请选择"
|
||||
/>
|
||||
</NFormItemGi>
|
||||
<NFormItemGi :span="8" label="变更等级" path="level">
|
||||
</NGrid>
|
||||
<NGrid :cols="24" :x-gap="24">
|
||||
<NFormItemGi :span="12" label="变更等级" path="level">
|
||||
<NSelect
|
||||
v-model:value="currentTemplate.level"
|
||||
:options="levelOptions"
|
||||
@@ -477,7 +515,7 @@ onMounted(() => {
|
||||
placeholder="请选择"
|
||||
/>
|
||||
</NFormItemGi>
|
||||
<NFormItemGi :span="8" label="变更时效" path="duration">
|
||||
<NFormItemGi :span="12" label="变更时效" path="duration">
|
||||
<NSelect
|
||||
v-model:value="currentTemplate.duration"
|
||||
:options="durationOptions"
|
||||
|
||||
Reference in New Issue
Block a user