客户需求校验
This commit is contained in:
@ -8,10 +8,21 @@ enum Api {
|
||||
List = '/plan/planYearDemandHdr/list',
|
||||
Info = '/plan/planYearDemandHdr/info',
|
||||
LngPlanYearDemandHdr = '/plan/planYearDemandHdr',
|
||||
reject = '/plan/planYearDemandHdr/reject',
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
export async function rejectLngPlanYearDemandHdr(lngPlanYearDemandHdr: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.post<boolean>(
|
||||
{
|
||||
url: Api.reject,
|
||||
params: lngPlanYearDemandHdr,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -12,11 +12,47 @@ enum Api {
|
||||
save = '/plan/planYearDemandHdrEc/save',
|
||||
saveAndSubmit = '/plan/planYearDemandHdrEc/saveAndSubmit',
|
||||
toChange = '/plan/planYearDemandHdrEc/toChange',
|
||||
|
||||
CuPlanYear = '/magic-api/plan/planYearDemandHdrSelectCuPlanYear',
|
||||
CuPlanYearVerNo = '/magic-api/plan/planYearDemandHdrSelectCuPlanYearVerNo',
|
||||
CheckCuPlanState = '/magic-api/plan/planYearDemandHdrCheckCuPlanState',
|
||||
|
||||
Export = '/plan/planYearDemandHdrEc/export',
|
||||
|
||||
|
||||
}
|
||||
export async function checkCuPlanState(cuCode: string, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get<any>(
|
||||
{ url: Api.CheckCuPlanState, params: { cuCode } },
|
||||
{ errorMessageMode: mode },
|
||||
);
|
||||
}
|
||||
export async function getCuMaxPlanYear(cuCode: string, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get<any>(
|
||||
{ url: Api.CuPlanYear, params: { cuCode } },
|
||||
{ errorMessageMode: mode },
|
||||
);
|
||||
}
|
||||
export async function getCuPlanYearVerNo(cuCode: string, planYear: string, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get<any>(
|
||||
{
|
||||
url: Api.CuPlanYearVerNo,
|
||||
params: { cuCode, planYear },
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
export async function getCuPlanYear(cuCode: String, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get<LngPlanYearDemandHdrPageModel>(
|
||||
{
|
||||
url: Api.CuPlanYear,
|
||||
params: { cuCode },
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
export async function getUpdateLngPlanYearDemandHdr(id: String, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get<LngPlanYearDemandHdrPageModel>(
|
||||
|
||||
@ -18,7 +18,7 @@ export const searchFormSchema: FormSchema[] = [
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'cuName',
|
||||
field: 'cuSname',
|
||||
label: '客户',
|
||||
component: 'Input',
|
||||
},
|
||||
@ -58,7 +58,7 @@ export const columns: BasicColumn[] = [
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'cuName',
|
||||
dataIndex: 'cuSname',
|
||||
title: '客户',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
@ -180,11 +180,16 @@ import Index from '/@/views/sys/error-log/index.vue';
|
||||
dataList.value.forEach((v, idx)=> {
|
||||
// LNG(万方)=LNG(吨)*气化率/10000;
|
||||
v.lngNum = Number(v.lng || 0) * Number(rateTonM3.value || 0)/10000
|
||||
// v.lngNum = Number(v.lngNum) ? v.lngNum : ''
|
||||
// 小计=管道气(万方)+LNG(万方);
|
||||
v.total = Number(v.qty || 0) + Number(v.lngNum || 0)
|
||||
// v.total = Number(v.total) ? v.total : ''
|
||||
// console.log(Number(v.total), 52354)
|
||||
|
||||
let a = (v.lng==null || v.lng==undefined)
|
||||
let b = (v.qty==null || v.qty==undefined)
|
||||
v.lngNum = (a&&b) ? null: v.lngNum
|
||||
v.total = (a&&b) ? null: v.total
|
||||
v.lng = (v.lng==null || v.lng==undefined) ? null : v.lng
|
||||
v.qty = (v.qty==null || v.qty==undefined) ? null: v.qty
|
||||
|
||||
if (idx<12) {
|
||||
qytTotal+=(Number(v.qty)||0)
|
||||
lngTotal+=(Number(v.lng)||0)
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
import { ref, computed, onMounted, onUnmounted, } from 'vue';
|
||||
|
||||
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||
import { getLngPlanYearDemandHdrPage, deleteLngPlanYearDemandHdr} from '/@/api/plan/PlanYearDemandHdr';
|
||||
import { getLngPlanYearDemandHdrPage, deleteLngPlanYearDemandHdr, rejectLngPlanYearDemandHdr} from '/@/api/plan/PlanYearDemandHdr';
|
||||
import { PageWrapper } from '/@/components/Page';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
@ -128,39 +128,16 @@
|
||||
});
|
||||
|
||||
function dbClickRow(record) {
|
||||
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
|
||||
return;
|
||||
}
|
||||
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||
if (taskIds && taskIds.length) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||
query: {
|
||||
taskId: taskIds[0],
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
} else if (schemaId && !taskIds && processId) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||
query: {
|
||||
readonly: 1,
|
||||
taskId: '',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/PlanYearDemandHdr/' + record.id + '/viewForm',
|
||||
query: {
|
||||
formPath: 'plan/PlanYearDemandHdr',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
}
|
||||
router.push({
|
||||
path: '/plan/PlanYearDemandHdr/createForm',
|
||||
query: {
|
||||
formPath: 'plan/PlanYearDemandHdr',
|
||||
formName: '查看' + formName,
|
||||
formId: currentRoute.value.meta.formId,
|
||||
id: record.id,
|
||||
type: 'view',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function buttonClick(code) {
|
||||
@ -180,16 +157,7 @@
|
||||
}
|
||||
|
||||
function handleView(record: Recordable) {
|
||||
router.push({
|
||||
path: '/plan/PlanYearDemandHdr/createForm',
|
||||
query: {
|
||||
formPath: 'plan/PlanYearDemandHdr',
|
||||
formName: '查看' + formName,
|
||||
formId: currentRoute.value.meta.formId,
|
||||
id: record.id,
|
||||
type: 'view',
|
||||
},
|
||||
});
|
||||
dbClickRow(record);
|
||||
}
|
||||
function handleReject (record: Recordable) {
|
||||
curData.value = record
|
||||
@ -200,11 +168,10 @@
|
||||
}
|
||||
const handleRejectReply = async (val) => {
|
||||
let obj = {
|
||||
"result": "R",
|
||||
"remark": val.reply,
|
||||
"data": [{datePlan: curData.value.datePlan}]
|
||||
"reply": val.reply,
|
||||
"id": curData.value.id
|
||||
}
|
||||
await approveLngPngAppro(obj)
|
||||
await rejectLngPlanYearDemandHdr(obj)
|
||||
isOpen.value = false
|
||||
handleSuccess();
|
||||
notification.success({
|
||||
@ -233,27 +200,29 @@
|
||||
}
|
||||
});
|
||||
function getActions(record: Recordable):ActionItem[] {
|
||||
|
||||
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
|
||||
if (!record.workflowData?.processId) {
|
||||
return {
|
||||
let actionsList: ActionItem[] = []
|
||||
let rejectBtn: 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 (['reject'].includes(button.code)) {
|
||||
rejectBtn.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
});
|
||||
}
|
||||
});
|
||||
if (record.approCode == 'YTJ' && record.maxPlanYear == record.planYear && record.lastSign=='Y') {
|
||||
actionsList = actionsList.concat(rejectBtn);
|
||||
}
|
||||
actionsList = actionsList.concat(viewBtn);
|
||||
return actionsList;
|
||||
}
|
||||
async function mergeCustomListRenderConfig(){
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<a-row>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="年度" name="planYear">
|
||||
<a-date-picker v-if="!pageType" :inputReadOnly="true" v-model:value="formState.planYear" picker='year' style="width: 100%" :disabled="isDisable||pageType=='edit'" placeholder="请选择" @change="yearChange" />
|
||||
<a-date-picker v-if="!pageType" :inputReadOnly="true" v-model:value="formState.planYear" picker='year' style="width: 100%" :disabled="isDisable||pageType=='edit'" placeholder="请选择" @change="yearChange" :disabledDate="disabledYear" />
|
||||
<div v-else>{{ formState.planYear }}</div>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@ -34,9 +34,9 @@
|
||||
{{ (optionSelect.approCodeList.find(v=>v.code == formState.approCode) || {}).name }}
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="备注" name="note">
|
||||
{{ formState.note }}
|
||||
<a-col :span="24">
|
||||
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
|
||||
<a-textarea v-model:value="formState.note" :disabled="isDisable" placeholder="请输入备注,最多200字" :maxlength="200" :auto-size="{ minRows: 2, maxRows: 5 }"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@ -86,7 +86,7 @@
|
||||
import { getDictionary } from '/@/api/sales/Customer';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import ImportModal from '/@/components/Import/src/ImportModal.vue';
|
||||
import { saveLngPlanYearDemandHdr,saveAndSubmitLngPlanYearDemandHdr,getUpdateLngPlanYearDemandHdr, getLngPlanYearDemandHdr, exportLngPlanYearDemandHdr} from '/@/api/plan/PlanYearDemandHdrEc';
|
||||
import { saveLngPlanYearDemandHdr,saveAndSubmitLngPlanYearDemandHdr,getUpdateLngPlanYearDemandHdr, getLngPlanYearDemandHdr, exportLngPlanYearDemandHdr,getCuPlanYear, getCuPlanYearVerNo} from '/@/api/plan/PlanYearDemandHdrEc';
|
||||
import { downloadByData } from '/@/utils/file/download';
|
||||
import dayjs from 'dayjs';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
@ -126,7 +126,7 @@
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n()
|
||||
|
||||
const formState = reactive({
|
||||
const formState = reactive<Recordable>({
|
||||
approCode: 'WTJ'
|
||||
});
|
||||
const rateTonM3 = ref()
|
||||
@ -142,6 +142,7 @@
|
||||
{ title: t('小计(万方)'), dataIndex: 'total'},
|
||||
]);
|
||||
formState.cuCode = currentRoute.value.query?.cuCode
|
||||
const curYear = ref()
|
||||
const layout = {
|
||||
labelCol: { span: 8 },
|
||||
wrapperCol: { span: 16 },
|
||||
@ -186,7 +187,12 @@
|
||||
}
|
||||
getSysRate()
|
||||
getOption()
|
||||
getYear()
|
||||
});
|
||||
async function getYear () {
|
||||
let data = await getCuPlanYear(formState.cuCode)
|
||||
curYear.value = data?.planYear
|
||||
}
|
||||
async function getSysRate () {
|
||||
let a = await getParameter({code: 'RATE_TON_M3'})||[]
|
||||
rateTonM3.value = a[0]?.valueNum1
|
||||
@ -266,6 +272,13 @@
|
||||
if (!record) {
|
||||
v.lngNum = Number(v.lng || 0) * Number(rateTonM3.value || 0)/10000
|
||||
v.total = Number(v.qty || 0) + Number(v.lngNum || 0)
|
||||
|
||||
let a = (v.lng==null || v.lng==undefined)
|
||||
let b = (v.qty==null || v.qty==undefined)
|
||||
v.lngNum = (a&&b) ? '': v.lngNum
|
||||
v.total = (a&&b) ? '': v.total
|
||||
v.lng = (v.lng!=null || v.lng!=undefined) ? v.lng : ''
|
||||
v.qty = (v.qty!=null || v.qty!=undefined) ? v.qty : ''
|
||||
}
|
||||
if (idx<12) {
|
||||
qytTotal+=(Number(v.qty)||0)
|
||||
@ -306,8 +319,19 @@
|
||||
async function getOption() {
|
||||
optionSelect.approCodeList = await getDictionary('LNG_APPRO2')
|
||||
}
|
||||
const yearChange = (val) => {
|
||||
const disabledYear = (current: dayjs.Dayjs) => {
|
||||
const minYear = Math.max(
|
||||
curYear.value ? Number(curYear.value) : 0,
|
||||
dayjs().year()
|
||||
);
|
||||
return current && current.year() < minYear;
|
||||
}
|
||||
|
||||
const yearChange = async (val: dayjs.Dayjs) => {
|
||||
if (!val) return;
|
||||
const planYear = dayjs(val).format('YYYY');
|
||||
const data = await getCuPlanYearVerNo(formState.cuCode, planYear);
|
||||
formState.demandVerNo = data?.demandVerNo ?? null;
|
||||
}
|
||||
|
||||
function close() {
|
||||
@ -342,7 +366,7 @@
|
||||
let request = type == 'save' ? saveLngPlanYearDemandHdr : saveAndSubmitLngPlanYearDemandHdr
|
||||
let obj = {
|
||||
...formState,
|
||||
planYear: formState.planYear ? dayjs(formState.planYear).format('YYYY') : null,
|
||||
planYear: (formState.planYear&&!pageId.value) ? dayjs(formState.planYear).format('YYYY') : formState.planYear,
|
||||
lngPlanYearDemandList: arr
|
||||
}
|
||||
await request(obj)
|
||||
|
||||
@ -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