fix : 3단결제 체크 "최소 결재자는 본인 외 2명이상 필수"

마지막이 결재자 인지 "결재선의 마지막은 결재자이어야 함"
      결재자 있는지 "결재자는 필수입니다."
      관련 validation 처리 완료
This commit is contained in:
Yesol Choi
2025-06-06 12:24:57 +09:00
parent 1e5acf790c
commit 5283d34126
2 changed files with 139 additions and 80 deletions

View File

@@ -94,43 +94,73 @@ const cancel = () => {
router.push('/app/contractManagement') router.push('/app/contractManagement')
} }
const validation = () => {
notyf.dismissAll()
const resultGu = apprLine.value.filter((item,index)=> index != 0 && !item.lineclsf)
if(resultGu.length > 0){
console.log("resultGu",resultGu)
notyf.error("결재선 구분값을 입력해주세요")
return false
}
if(apprLine.value.length < 2){
notyf.error("결재선은 본인 외 2명이상 필수입니다.")
return false
}
const result = apprLine.value.filter((item)=> item.lineclsf === 'A' )
if(result.length > 1){
notyf.error("결재는 한 명입니다.")
return false
}
const resultLastItem = apprLine.value[apprLine.value.length-1].lineclsf
if(resultLastItem != 'A'){
notyf.error("결재선의 마지막은 결재자이어야 함")
return false
}
return true
}
const loading = ref(false) const loading = ref(false)
const createChit = async () => { const createChit = async () => {
let res = null let res = null
try{ try{
loading.value = true loading.value = true
if (validation()) {
const createParams = { const createParams = {
contNo : params.contNo, //"CONT-0000000005", contNo: params.contNo, //"CONT-0000000005",
bldat : '20250602',//params.regSdt.replace("-",""), // "20250501", bldat: '20250602',//params.regSdt.replace("-",""), // "20250501",
budat : '20250610',//params.regSdt2.replace("-",""), // "20250502", budat: '20250610',//params.regSdt2.replace("-",""), // "20250502",
waers : "KRW", //currencyCode.value, //"KRW", waers: "KRW", //currencyCode.value, //"KRW",
bktxt : params.bktxt,//"전표 생성 테스트1", bktxt: params.bktxt,//"전표 생성 테스트1",
lifnr : params.lifnr, //999-99-99999", lifnr: params.lifnr, //999-99-99999",
wrbtr : "1203", //formattedNumber.value, //!!!!!수정필요 "1203", wrbtr: "1203", //formattedNumber.value, //!!!!!수정필요 "1203",
mwskz : "V4", //taxCode.value, //"V4", mwskz: "V4", //taxCode.value, //"V4",
gsber : '1000', //affiliationCode.value, //무슨 값인지 모름 gsber bukrs bupla 같다고 함 1000 gsber: '1000', //affiliationCode.value, //무슨 값인지 모름 gsber bukrs bupla 같다고 함 1000
bupla : '1000', //affiliationCode.value, //1000 bupla: '1000', //affiliationCode.value, //1000
zterm : 'PF00', //params.zterm, //!!!!!!어떤 값인지 모름 PF00 zterm: 'PF00', //params.zterm, //!!!!!!어떤 값인지 모름 PF00
banks : 'KR', //params.banks , //어떤 값인지 모름 KR banks: 'KR', //params.banks , //어떤 값인지 모름 KR
bankl : '012', //params.bankl, //012 bankl: '012', //params.bankl, //012
bankn : '3510876657453', //params.bankn, //3510876657453 bankn: '3510876657453', //params.bankn, //3510876657453
hkont : '5366010', //params.hkont,//G/L 계정 5366010 hkont: '5366010', //params.hkont,//G/L 계정 5366010
wrbtrS : formattedNumber.value, //1102 wrbtrS: formattedNumber.value, //1102
kostl : "12330", //!!!!!!12330 kostl: "12330", //!!!!!!12330
projk : selectCostCode.value, //빈값 projk: selectCostCode.value, //빈값
trtGubun : '11', //params.trtGubun,//!!!!!!어떤 값인지 모름 11 trtGubun: '11', //params.trtGubun,//!!!!!!어떤 값인지 모름 11
txBillSeq : '202503231', //params.txBillSeq,//!!!!!!어떤 값인지 모름 202503231 txBillSeq: '202503231', //params.txBillSeq,//!!!!!!어떤 값인지 모름 202503231
slipAtts: pbAtts.value.map(req => ({ slipAtts: pbAtts.value.map(req => ({
logiFnm: req.logiFnm, logiFnm: req.logiFnm,
data: req.data})),//첨부파일 데이터, data: req.data
zwf0011t : { })),//첨부파일 데이터,
wkftx : "결재 테스트11", //!!!!!!어떤 값인지 모름 zwf0011t: {
apprs : [{ wkftx: "결재 테스트11", //!!!!!!어떤 값인지 모름
apprs: [{
label: '결재', label: '결재',
value: apprLine.value.map((req) => ({ value: apprLine.value.map((req) => ({
lineclsf : req.lineclsf, lineclsf: req.lineclsf,
bname : req.bname, bname: req.bname,
abscd : req.abscd abscd: req.abscd
})) }))
}] }]
} }
@@ -155,10 +185,11 @@ const createChit = async () => {
} }
notyf.dismissAll() notyf.dismissAll()
res = await saveTempSlip(createParams) res = await saveTempSlip(createParams)
if(res.request.status == '200'){ if (res.request.status == '200') {
notyf.primary('등록 되었습니다.') notyf.primary('전표가 등록 되었습니다.')
router.push({path: '/app/priceManagement'}) router.push({path: '/app/priceManagement'})
} }
}
}catch(e){ }catch(e){
notyf.error(e.message) notyf.error(e.message)
}finally { }finally {

View File

@@ -98,7 +98,7 @@ const getDetailList = (item) => {
params.slipAtts = item.slipAtts//첨부파일 params.slipAtts = item.slipAtts//첨부파일
console.log("params.slipAtts",params.slipAtts) console.log("params.slipAtts",params.slipAtts)
apprLine.value = item.zwf0011t.apprs[0].value apprLine.value = item.zwf0011t.apprs[0].value
console.log("apprsList.value",apprLine.value) console.log("apprsList.value 여기 결재선 들어옴",apprLine.value)
} }
function onInput(event) { function onInput(event) {
@@ -115,6 +115,33 @@ const router = useRouter()
const cancel = () => { const cancel = () => {
router.push('/app/contractManagement') router.push('/app/contractManagement')
} }
const validation = () => {
notyf.dismissAll()
const resultGu = apprLine.value.filter((item,index)=> index != 0 && !item.lineclsf)
if(resultGu.length > 0){
console.log("resultGu",resultGu)
notyf.error("결재선 구분값을 입력해주세요")
return false
}
if(apprLine.value.length < 2){
notyf.error("결재선은 본인 외 2명이상 필수입니다.")
return false
}
const result = apprLine.value.filter((item)=> item.lineclsf === 'A' )
if(result.length > 1){
notyf.error("결재는 한 명입니다.")
return false
}
const resultLastItem = apprLine.value[apprLine.value.length-1].lineclsf
if(resultLastItem != 'A'){
notyf.error("결재선의 마지막은 결재자이어야 함")
return false
}
return true
}
const loading = ref(false) const loading = ref(false)
@@ -122,6 +149,7 @@ const updateChit = async () => {
let res = null let res = null
try{ try{
loading.value = true loading.value = true
if (validation()){
const createParams = { const createParams = {
contNo : params.contNo, //"CONT-0000000005", contNo : params.contNo, //"CONT-0000000005",
zwf0011t : { zwf0011t : {
@@ -140,9 +168,10 @@ const updateChit = async () => {
notyf.dismissAll() notyf.dismissAll()
res = await updateTempSlip(createParams) res = await updateTempSlip(createParams)
if(res.request.status == '200'){ if(res.request.status == '200'){
notyf.primary('등록 되었습니다.') notyf.primary('결재선이 수정 되었습니다.')
router.push({path: '/app/priceManagement'}) router.push({path: '/app/priceManagement'})
} }
}
}catch(e){ }catch(e){
notyf.error(e.message) notyf.error(e.message)
}finally { }finally {
@@ -216,7 +245,6 @@ const isDuplicate = (person: Person) =>{
watch( watch(
selectUser, selectUser,
(newPersons) => { (newPersons) => {
console.log("newPersons",newPersons)
if (Array.isArray(newPersons) && newPersons.length > 0) { if (Array.isArray(newPersons) && newPersons.length > 0) {
const filtered = newPersons.filter((p) => !isDuplicate(p)) const filtered = newPersons.filter((p) => !isDuplicate(p))
apprLine.value = [...apprLine.value, ...filtered] apprLine.value = [...apprLine.value, ...filtered]
@@ -230,7 +258,7 @@ const onDocDelete = (index: number) => {
if(apprLine.value.length-1 !== params.flexColumn.length if(apprLine.value.length-1 !== params.flexColumn.length
|| (params.flexColumn.length == 8 && apprLine.value.length-1 == params.flexColumn.length)) || (params.flexColumn.length == 8 && apprLine.value.length-1 == params.flexColumn.length))
{ {console.log("삭제 index 접근함")
apprLine.value.splice(index, 1) apprLine.value.splice(index, 1)
} }
} }