fix : 동작 위아래이동, 삭제 , 결제 2명 validation까지 완료

- VUser 오류 발생 중으로 수정 요함
This commit is contained in:
Yesol Choi
2025-05-29 20:35:31 +09:00
parent 9c8a7427d1
commit 70d9a9eb92
3 changed files with 758 additions and 72 deletions

View File

@@ -14,7 +14,7 @@ onBeforeMount(async ()=>{
const showTable = ref(false)
const detailActionsOpen = ref(false)
const apprLine = defineModel<Person[]>()
const apprLine = ref([])
const generalParams = reactive({
title: "",
@@ -30,6 +30,7 @@ const params = reactive({
cateSelect: '',
prcsNo: '',
stCd: '', //상태코드 등록 전 : 0000
defaultPricePerson:[],
prcsAttsColumn:[ //첨부파일 입력
{ key: 'logiFnm', label: '구분'},
{ key: 'data', label: '데이터'}
@@ -40,9 +41,10 @@ const params = reactive({
{ key: 'deptNm', label: '부서' },
{ key: 'sabun', label: '사번' },
{ key: 'name', label: '이름' },
{ key: 'attendCd', label: '비고'},
{ key: 'attendCd', label: '근태'},
{ key: 'apprStat', label: '결재상태'},
{ key: 'apprDt', label: '승인일자'},
{key:'actions', label: '동작'},
],
priceData:[],
prcsBizsColumn: [ //견적사 입력
@@ -90,10 +92,9 @@ function getDetailList(arg){
apprNo: req.apprNo,
apprOrd: req.apprOrd,
apprStat: req.apprStat,
apprDt: req.apprDt,
apprDt: req.apprDt ? req.apprDt : '-',
attendCd: req.attendCd
})) //비고 데이터 없음, 승인일자 없음 todo
console.log("apprLine.value",apprLine.value)
}))
params.prcsAtts = arg.prcsAtts
}
@@ -104,47 +105,72 @@ const changeButton = () => {
}
const validation = () => {
notyf.dismissAll() //todo
notyf.dismissAll()
if(generalParams.regSdat > generalParams.regEdat){
notyf.error("등록 종료일은 등록 시작일보다 빠를 수 없습니다.")
return
return false
}
const resultGu = apprLine.value.filter((item)=> !item.gubunCd)
if(resultGu.length > 0){
notyf.error("결재선 구분값을 입력해주세요")
return false
}
if(apprLine.value.length < 2){
notyf.error("결재선은 두 명이상 입력해주세요.")
return
return false
}
const result = apprLine.value.filter((item)=> item.gubunCd === '0200' )
if(result.length > 1){
notyf.error("결재는 한 명입니다.")
return false
}
return true
}
const selectUser = ref()
watch(selectUser,(newPersons)=>{
if (Array.isArray(newPersons)) {
apprLine.value = [...apprLine.value, ...newPersons]
}
})
const updatePriceOne = async () => {
let res = null
try{
loading.value = true
validation()
const paramsPrice ={
prcsNo : params.prcsNo,
cateCd : params.cateSelect,
title: generalParams.title,
content: generalParams.content,
regSdat: formatDatefromString(generalParams.regSdat),
regEdat: formatDatefromString(generalParams.regEdat),
prvYn: false,
prvRsn : "",
prvPwd : "",
aiYn: false,
prcsBizs: params.prcsBizs.map(({ num, ...rest }) => rest), //견적사 입력 데이터
dtlSpecs: [], //todo
// params.dtlSpecs.map(({ num, ...rest }) => rest), //상세 규격 입력 데이터
prcsAtts: pbAtts.value.map(req => ({
logiFnm: req.logiFnm,
data: req.data})),//첨부파일 데이터,
apprReqs: apprLine.value.map(({ deptNm, ...rest }) => rest), //결재선 데이터
}
res = await updatePrice(paramsPrice)
notyf.dismissAll()
if(res.request.status == '200'){
notyf.primary('수정 되었습니다.')
router.push({path: '/app/priceManagement'})
if (validation()){
const paramsPrice ={
prcsNo : params.prcsNo,
cateCd : params.cateSelect,
title: generalParams.title,
content: generalParams.content,
regSdat: formatDatefromString(generalParams.regSdat),
regEdat: formatDatefromString(generalParams.regEdat),
prvYn: false,
prvRsn : "",
prvPwd : "",
aiYn: false,
prcsBizs: params.prcsBizs.map(({ num, ...rest }) => rest), //견적사 입력 데이터
dtlSpecs: [], //todo
// params.dtlSpecs.map(({ num, ...rest }) => rest), //상세 규격 입력 데이터
prcsAtts: pbAtts.value.map(req => ({
logiFnm: req.logiFnm,
data: req.data})),//첨부파일 데이터,
apprReqs: apprLine.value.map(({ deptNm, ...rest }, index) => ({
...rest,
apprOrd: index + 1, // 결재 순서 1부터 시작
})), //결재선 데이터
}
res = await updatePrice(paramsPrice)
notyf.dismissAll()
if(res.request.status == '200'){
notyf.primary('수정 되었습니다.')
router.push({path: '/app/priceManagement'})
}
}
}catch(e){
notyf.error(e.message)
@@ -191,6 +217,14 @@ const onDetailDelete = (index: number) => {
}
}
const onPriceDelete = (index: number) => {
if(apprLine.value.length-1 !== params.felxColumn.length
|| (params.felxColumn.length == 8 && apprLine.value.length-1 == params.felxColumn.length))
{
apprLine.value.splice(index, 1)
}
}
function onInput(row, column){
if (column.key === 'bizNo') {
@@ -251,6 +285,20 @@ const onPrcsFileDownload = async (prcsNo: string, fileOrd: number, logiFnm: stri
link.click()
}
const moveUp = (index: number) => {
if (index <= 0) return
let temp = apprLine.value[index]
apprLine.value[index] = apprLine.value[index - 1]
apprLine.value[index - 1] = temp
}
const moveDown = (index: number) => {
if (index >= apprLine.value.length - 1) return
let temp = apprLine.value[index]
apprLine.value[index] = apprLine.value[index + 1]
apprLine.value[index + 1] = temp
}
</script>
<template>
@@ -539,7 +587,7 @@ const onPrcsFileDownload = async (prcsNo: string, fileOrd: number, logiFnm: stri
</table>
</div>
<div class="column is-12">
<VUser v-model="apprLine"/>
<VUser v-model="selectUser"/>
</div>
<div class="column is-12">
<VField class="pr-2">
@@ -548,6 +596,7 @@ const onPrcsFileDownload = async (prcsNo: string, fileOrd: number, logiFnm: stri
</VLabel>
</VField>
<ComVFlexTable
:key="apprLine.map(item => item.sabun).join(',')"
:data="apprLine"
:columns="params.felxColumn"
:separators="true"
@@ -569,14 +618,15 @@ const onPrcsFileDownload = async (prcsNo: string, fileOrd: number, logiFnm: stri
placeholder="재중"
cd_grp=6
v-model="row.attendCd">
<!-- <template #code>-->
<!-- <span v-if="!row.attendCd">{{"재중"}}</span>-->
<!-- </template>-->
</VDefaultCodeSelect>
</VField>
</span>
<span v-else
@click="onDetailDelete(index)">{{value}}</span>
<span v-else-if="column.key === 'actions'" class="flex gap-1">
<VCustomButton @click="moveUp(index)" icon="lucide:chevron-up" />
<VCustomButton @click="moveDown(index)" icon="lucide:chevron-down" />
<VCustomButton @click="onPriceDelete(index)" icon="lucide:x" />
</span>
<span v-else>{{value}}</span>
</div>
</template>
</ComVFlexTable>
@@ -584,7 +634,7 @@ const onPrcsFileDownload = async (prcsNo: string, fileOrd: number, logiFnm: stri
<div style="display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px;">
<VButton
color="primary"
@click.stop="updatePriceOne"
@click.stop="updatePriceOne()"
raised>
수정
</VButton>