客户需求校验
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
|
||||
<template #toolbar>
|
||||
<template v-for="button in tableButtonConfig" :key="button.code">
|
||||
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
|
||||
<a-button v-if="button.isDefault" :type="button.type" :disabled="button.code === 'add' && addDisabled" @click="buttonClick(button.code)">
|
||||
<template #icon><Icon :icon="button.icon" /></template>
|
||||
{{ button.name }}
|
||||
</a-button>
|
||||
@ -35,7 +35,7 @@
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||
import { getLngPlanYearDemandHdrPage, deleteLngPlanYearDemandHdr, exportLngPlanYearDemandHdr,getPlanYearTip} from '/@/api/plan/PlanYearDemandHdrEc';
|
||||
import { getLngPlanYearDemandHdrPage, deleteLngPlanYearDemandHdr, exportLngPlanYearDemandHdr,getPlanYearTip, checkCuPlanState, getCuMaxPlanYear} from '/@/api/plan/PlanYearDemandHdrEc';
|
||||
import { PageWrapper } from '/@/components/Page';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
@ -58,6 +58,8 @@
|
||||
const userInfo = userStore.getUserInfo;
|
||||
const curCuCode = ref('')
|
||||
const yearTip = ref()
|
||||
const addDisabled = ref(false)
|
||||
const cuMaxPlanYear = ref<number | null>(null)
|
||||
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
@ -109,6 +111,7 @@
|
||||
fieldMapToTime: [],
|
||||
showResetButton: true,
|
||||
},
|
||||
immediate: false,
|
||||
beforeFetch: (params) => {
|
||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id', page: params.limit, cuCode: curCuCode.value };
|
||||
},
|
||||
@ -244,6 +247,12 @@
|
||||
onMounted(async() => {
|
||||
const res = await getCompDept(userInfo.id)
|
||||
curCuCode.value = res?.comp?.cuCode
|
||||
reload({searchInfo:{'limit':1,'size':10,'page':1, cuCode: curCuCode.value}});
|
||||
const checkRes = await checkCuPlanState(curCuCode.value)
|
||||
addDisabled.value = (checkRes?.count ?? 0) !== 0
|
||||
|
||||
const maxYearRes = await getCuMaxPlanYear(curCuCode.value)
|
||||
cuMaxPlanYear.value = maxYearRes?.planYear ? Number(maxYearRes.planYear) : null
|
||||
|
||||
const data = await getPlanYearTip()
|
||||
yearTip.value = data?.msg
|
||||
@ -267,26 +276,44 @@
|
||||
});
|
||||
function getActions(record: Recordable):ActionItem[] {
|
||||
|
||||
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
|
||||
if (!record.workflowData?.processId) {
|
||||
return {
|
||||
let actionsList: ActionItem[] = []
|
||||
let editBtn: ActionItem[] = []
|
||||
let updateBtn: ActionItem[] = []
|
||||
let viewBtn: ActionItem[] = [];
|
||||
actionButtonConfig.value?.map((button) => {
|
||||
if (['view', 'copyData','compare', 'datalog', 'export'].includes(button.code)) {
|
||||
viewBtn.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
color: button.code === 'delete' ? 'error' : undefined,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
};
|
||||
} else {
|
||||
if (button.code === 'view') {
|
||||
return {
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
});
|
||||
}
|
||||
if (['edit','delete'].includes(button.code)) {
|
||||
editBtn.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
color: button.code === 'delete' ? 'error' : undefined,
|
||||
});
|
||||
}
|
||||
if (['update'].includes(button.code)) {
|
||||
updateBtn.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
});
|
||||
}
|
||||
});
|
||||
if (record.approCode == 'WTJ' || record.approCode == 'YBH') {
|
||||
actionsList = actionsList.concat(editBtn);
|
||||
}
|
||||
const curYear = new Date().getFullYear();
|
||||
const planYear = Number(record.planYear);
|
||||
const canUpdate = cuMaxPlanYear.value !== null && planYear === cuMaxPlanYear.value && planYear >= curYear && record.approCode === 'YTJ' && record.lastSign === 'Y';
|
||||
if (canUpdate) {
|
||||
actionsList = actionsList.concat(updateBtn);
|
||||
}
|
||||
actionsList = actionsList.concat(viewBtn);
|
||||
return actionsList;
|
||||
}
|
||||
async function mergeCustomListRenderConfig(){
|
||||
|
||||
Reference in New Issue
Block a user