diff --git a/src/service/api/changeLedger.ts b/src/service/api/changeLedger.ts new file mode 100644 index 0000000..f2d7417 --- /dev/null +++ b/src/service/api/changeLedger.ts @@ -0,0 +1,11 @@ +import { request } from '../request'; + +// 列表查询 +export function changeLedgerListApi(params:any) { + return request({ + url: `/api/changes`, + method: 'get', + params, + }); +} + diff --git a/src/views/changeLedger/myChanges/index.vue b/src/views/changeLedger/myChanges/index.vue index 325a754..0607aa2 100644 --- a/src/views/changeLedger/myChanges/index.vue +++ b/src/views/changeLedger/myChanges/index.vue @@ -1,8 +1,9 @@ diff --git a/src/views/systemManage/template/index.vue b/src/views/systemManage/template/index.vue index b34e349..4013b49 100644 --- a/src/views/systemManage/template/index.vue +++ b/src/views/systemManage/template/index.vue @@ -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(false); const currentType = ref('add'); const readonly = computed(() => currentType.value === "view"); const formRef = ref(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(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 }" >