|
|
@ -1,7 +1,11 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="AccountPeriod.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search |
|
|
|
:schema="AccountPeriod.allSchemas.searchSchema" |
|
|
|
@search="setSearchParams" |
|
|
|
@reset="setSearchParams" |
|
|
|
/> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
@ -54,17 +58,22 @@ |
|
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="AccountPeriod.allSchemas" /> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/eam/account-period/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|
|
|
<SYMonthImportForm |
|
|
|
ref="importFormRef" |
|
|
|
url="/eam/account-period/import" |
|
|
|
:importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { AccountPeriod, AccountPeriodRules } from './accountPeriod.data' |
|
|
|
import * as AccountPeriodApi from '@/api/eam/accountPeriod' |
|
|
|
import * as AccountPeriodApi from '@/api/eam/basic/accountPeriod' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
|
import Detail from '@/components/Detail/src/Detail.vue' |
|
|
|
import SYMonthImportForm from '@/components/ImportForm/src/SYMonthImportForm.vue' |
|
|
|
|
|
|
|
defineOptions({ name: 'AccountPeriod' }) |
|
|
|
|
|
|
@ -99,12 +108,12 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn({hasPermi:'eam:accountPeriod:create'}), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({hasPermi:'eam:accountPeriod:import'}), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'eam:accountPeriod:export'}), // 导出 |
|
|
|
defaultButtons.defaultAddBtn(null), // 新增 |
|
|
|
defaultButtons.defaultImportBtn(null), // 导入 |
|
|
|
// defaultButtons.defaultExportBtn(null), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
|
// { |
|
|
|
// label: '自定义扩展按钮', |
|
|
|
// name: 'zdy', |
|
|
@ -117,31 +126,39 @@ const HeadButttondata = [ |
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
if (val == 'add') { // 新增 |
|
|
|
if (val == 'add') { |
|
|
|
// 新增 |
|
|
|
openForm('create') |
|
|
|
} else if (val == 'import') { // 导入 |
|
|
|
} else if (val == 'import') { |
|
|
|
// 导入 |
|
|
|
handleImport() |
|
|
|
} else if (val == 'export') { // 导出 |
|
|
|
} else if (val == 'export') { |
|
|
|
// 导出 |
|
|
|
handleExport() |
|
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
|
} else if (val == 'refresh') { |
|
|
|
// 刷新 |
|
|
|
getList() |
|
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
|
} else { // 其他按钮 |
|
|
|
} else if (val == 'filtrate') { |
|
|
|
// 筛选 |
|
|
|
} else { |
|
|
|
// 其他按钮 |
|
|
|
console.log('其他按钮', item) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = [ |
|
|
|
defaultButtons.mainListEditBtn({hasPermi:'eam:accountPeriod:update'}), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn({hasPermi:'eam:accountPeriod:delete'}), // 删除 |
|
|
|
defaultButtons.mainListEditBtn(null), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn(null) // 删除 |
|
|
|
] |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { // 编辑 |
|
|
|
if (val == 'edit') { |
|
|
|
// 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
} else if (val == 'delete') { |
|
|
|
// 删除 |
|
|
|
handleDelete(row.id) |
|
|
|
} |
|
|
|
} |
|
|
@ -155,16 +172,54 @@ const openForm = (type: string, row?: any) => { |
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType, data) => { |
|
|
|
var isHave = AccountPeriod.allSchemas.formSchema.some(function (item) { |
|
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
|
}); |
|
|
|
return item.field === 'activeTime' || item.field === 'expireTime' |
|
|
|
}) |
|
|
|
if (isHave) { |
|
|
|
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) { |
|
|
|
message.error('失效时间要大于生效时间') |
|
|
|
return; |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if(data.activeTime==0)data.activeTime = null; |
|
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
|
|
|
|
|
const year = data.year; |
|
|
|
const month = data.month; |
|
|
|
const day = data.day; |
|
|
|
const hour = data.hour; |
|
|
|
const minute = data.minute; |
|
|
|
if (!/^\d+$/.test(year)) { |
|
|
|
message.error('账期年值为大于等于0的整数') |
|
|
|
return |
|
|
|
} |
|
|
|
if (!/^(1[0-2]|[1-9])$/.test(month)) { |
|
|
|
message.error('账期月值1-12') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 创建一个Date对象,注意月份是从0开始的,所以需要减1 |
|
|
|
const date = new Date(year, month - 1, day); |
|
|
|
|
|
|
|
// 获取该月的总天数 |
|
|
|
const totalDaysInMonth = new Date(year, month, 0).getDate(); |
|
|
|
|
|
|
|
// 检查年月是否正确 |
|
|
|
const isCorrectMonth = date.getMonth() === (month - 1); |
|
|
|
// 检查天数是否在有效范围内 |
|
|
|
const isDayInRange = day >= 1 && day <= totalDaysInMonth; |
|
|
|
if (!isCorrectMonth || !isDayInRange) { |
|
|
|
message.error('账期日期不在当前月的范围内') |
|
|
|
return |
|
|
|
} |
|
|
|
if (!/^(2[0-4]|[01]?[0-9])$/.test(hour)) { |
|
|
|
message.error('账期时值为大于等于0-24的整数') |
|
|
|
return |
|
|
|
} |
|
|
|
if (!/^(60|[0-5]?[0-9])$/.test(minute)) { |
|
|
|
message.error('账期分值为大于等于0-60的整数') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (data.activeTime == 0) data.activeTime = null |
|
|
|
if (data.expireTime == 0) data.expireTime = null |
|
|
|
if (formType === 'create') { |
|
|
|
await AccountPeriodApi.createAccountPeriod(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
@ -240,5 +295,4 @@ onMounted(async () => { |
|
|
|
getList() |
|
|
|
importTemplateData.templateUrl = await AccountPeriodApi.importTemplate() |
|
|
|
}) |
|
|
|
|
|
|
|
</script> |
|
|
|