mirror of
https://git.hmsn.ink/kospo/svcm/oa.git
synced 2026-03-19 19:35:11 +09:00
fix : type 에러 제거 , 가격조사 등록과 수정 VUser 컴포넌트 분리하여 사용
등록 결재선 삭제 이슈 -> 변화감지를 위해서는 key 값이 꼭 있어야 됨.(이동, 삭제)
This commit is contained in:
@@ -8,19 +8,6 @@ const dataUser = reactive({
|
||||
userSession: null,
|
||||
})
|
||||
|
||||
// onBeforeMount(() => {
|
||||
// dataUser.userSession = userSession.user.data
|
||||
// const sessioinData = [{
|
||||
// gubunCd: '0000', //구분
|
||||
// gubunNm: '입안',
|
||||
// deptNm: dataUser.userSession.dept.deptNm,
|
||||
// sabun: dataUser.userSession.sabun,
|
||||
// name: dataUser.userSession.name,
|
||||
// attendCd: '', // 비고
|
||||
//
|
||||
// }]
|
||||
// model.value = sessioinData
|
||||
// })
|
||||
const initiator = ref<Person | null>(null)
|
||||
const approvers = ref<Person[]>([])
|
||||
|
||||
@@ -69,27 +56,6 @@ const onKeyup = async (e: any) => {
|
||||
const res = await getUserList({params:{name : e.target.value}})
|
||||
|
||||
if (res.length > 0) {
|
||||
// res.forEach(u => { 2명으로 제한 로직 풀기 25.05.29
|
||||
// if (model.value?.length > 0) {
|
||||
// const ignore = model.value.reduce((a: Person, b: Person) => {
|
||||
// console.log("aaaaa",a.sabun)
|
||||
// console.log("bbbbbb",b.sabun)
|
||||
// return a.sabun + '|' + b.sabun
|
||||
// })
|
||||
//
|
||||
// if (typeof ignore !== 'object') {
|
||||
// if (ignore.includes(u.sabun)) {
|
||||
// console.log("ignore 처리",u.sabun)
|
||||
// u['disabled'] = true
|
||||
// }
|
||||
// } else {
|
||||
// if (ignore.sabun.includes(u.sabun)) {
|
||||
// console.log("ignore 처리222",u.sabun)
|
||||
// u['disabled'] = true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
tagsOptions.value = res
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@@ -1,40 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { type Person } from '/@src/utils/types'
|
||||
import { getUserList } from '/src/service/UserApi'
|
||||
|
||||
const model = defineModel<Person[]>()
|
||||
const userSession = useUserSession()
|
||||
const dataUser = reactive({
|
||||
userSession: null,
|
||||
})
|
||||
|
||||
// onBeforeMount(() => {
|
||||
// dataUser.userSession = userSession.user.data
|
||||
// const sessioinData = [{
|
||||
// gubunCd: '0000', //구분
|
||||
// gubunNm: '입안',
|
||||
// deptNm: dataUser.userSession.dept.deptNm,
|
||||
// sabun: dataUser.userSession.sabun,
|
||||
// name: dataUser.userSession.name,
|
||||
// attendCd: '', // 비고
|
||||
//
|
||||
// }]
|
||||
// model.value = sessioinData
|
||||
// })
|
||||
const initiator = ref<Person | null>(null)
|
||||
|
||||
onBeforeMount(() => {
|
||||
dataUser.userSession = userSession.user.data
|
||||
initiator.value = {
|
||||
gubunCd: '0000',
|
||||
gubunNm: '입안',
|
||||
deptNm: dataUser.userSession.dept.deptNm,
|
||||
sabun: dataUser.userSession.sabun,
|
||||
name: dataUser.userSession.name,
|
||||
attendCd: '',
|
||||
}
|
||||
})
|
||||
|
||||
import { getUserList } from '/@src/service/UserApi'
|
||||
|
||||
const props = defineProps({
|
||||
label: {
|
||||
@@ -58,8 +24,7 @@ export interface VUserEmits {
|
||||
}
|
||||
const emits = defineEmits<VUserEmits>()
|
||||
const tagsOptions = ref([])
|
||||
|
||||
const approvers = ref()
|
||||
const approvers = ref<Person[]>([])
|
||||
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
if (newVal.length > 0) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import {formatBizNum,formatDatefromString} from "/@src/utils/common/comfunc.ts";
|
||||
const notyf = useNotyf()
|
||||
const showTable = ref(false)
|
||||
const detailActionsOpen = ref(false)
|
||||
const apprLine = defineModel<Person[]>()
|
||||
const apprLine = ref<Person[]>([])
|
||||
const today = new Date()
|
||||
const loading = ref(false)
|
||||
//포커스 설정 변수 정리
|
||||
@@ -38,7 +38,7 @@ const params = reactive({
|
||||
{ key: 'deptNm', label: '부서' },
|
||||
{ key: 'sabun', label: '사번' },
|
||||
{ key: 'name', label: '이름' },
|
||||
{ key: 'attendCd', label: '비고' },
|
||||
{ key: 'attendCd', label: '근태' },
|
||||
{ key: 'actions', label: '동작'}
|
||||
],
|
||||
priceData:[],
|
||||
@@ -82,47 +82,60 @@ const validation = () => {
|
||||
return false
|
||||
}
|
||||
|
||||
if(params.prcsBizs==[]){
|
||||
notyf.error("견적요청을 입력해주세요")
|
||||
prcsBizsRef.value.focus()
|
||||
const resultGu = apprLine.value.filter((item,index)=> index != 0 && !item.gubunCd)
|
||||
|
||||
if(resultGu.length > 0){
|
||||
notyf.error("결재선 구분값을 입력해주세요")
|
||||
return false
|
||||
}
|
||||
|
||||
if(apprLine.value.length < 2){
|
||||
notyf.error("결재선은 두 명이상 입력해주세요.")
|
||||
if(apprLine.value.length <= 2){
|
||||
console.log("여기서 2명이상인지 체크")
|
||||
notyf.error("결재선은 본인 외 2명이상 필수입니다.")
|
||||
return false
|
||||
}
|
||||
const result = apprLine.value.filter((item)=> item.gubunCd === '0200' )
|
||||
|
||||
if(result.length > 1){
|
||||
notyf.error("결재는 한 명입니다.")
|
||||
return false
|
||||
}
|
||||
const resultLastItem = apprLine.value[apprLine.value.length-1].gubunCd
|
||||
if(resultLastItem != '0200'){
|
||||
notyf.error("결재선의 마지막은 결재자이어야 함")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
const savePriceOne = async () => {
|
||||
let res = null
|
||||
try{
|
||||
loading.value = true
|
||||
// if (!validation()) {
|
||||
// return;
|
||||
// }
|
||||
const paramsPrice ={
|
||||
cateCd : params.cateSelect,
|
||||
title: generalParams.title,
|
||||
content: generalParams.content,
|
||||
regSdat: formatDatefromString(generalParams.regSdat),
|
||||
regEdat: formatDatefromString(generalParams.regEdat),
|
||||
prvYn: true,
|
||||
prvRsn : "",
|
||||
prvPwd : "",
|
||||
aiYn: true,
|
||||
prcsBizs: params.prcsBizs.map(({ num, ...rest }) => rest), //견적사 입력 데이터
|
||||
dtlSpecs: params.dtlSpecs.map(({ num, ...rest }) => rest), //상세 규격 입력 데이터
|
||||
prcsAtts: params.prcsAtts, //첨부파일 데이터
|
||||
apprReqs: apprLine.value.map(({ deptNm, ...rest }) => rest), //결재선 데이터
|
||||
}
|
||||
if (validation()){
|
||||
const paramsPrice ={
|
||||
cateCd : params.cateSelect,
|
||||
title: generalParams.title,
|
||||
content: generalParams.content,
|
||||
regSdat: formatDatefromString(generalParams.regSdat),
|
||||
regEdat: formatDatefromString(generalParams.regEdat),
|
||||
prvYn: true,
|
||||
prvRsn : "",
|
||||
prvPwd : "",
|
||||
aiYn: true,
|
||||
prcsBizs: params.prcsBizs.map(({ num, ...rest }) => rest), //견적사 입력 데이터
|
||||
dtlSpecs: params.dtlSpecs.map(({ num, ...rest }) => rest), //상세 규격 입력 데이터
|
||||
prcsAtts: params.prcsAtts, //첨부파일 데이터
|
||||
apprReqs: apprLine.value.map(({ deptNm, ...rest }) => rest), //결재선 데이터
|
||||
}
|
||||
|
||||
res = await savePrice(paramsPrice)
|
||||
res = await savePrice(paramsPrice)
|
||||
|
||||
if(res.request.status == '200'){
|
||||
notyf.primary('등록 되었습니다.')
|
||||
router.push({path: '/app/priceManagement'})
|
||||
if(res.request.status == '200'){
|
||||
notyf.primary('등록 되었습니다.')
|
||||
router.push({path: '/app/priceManagement'})
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
notyf.error(e.message)
|
||||
@@ -223,6 +236,29 @@ function onInput(row, column){
|
||||
row[column.key] = formatBizNum(raw) // 실시간 포맷 적용
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
const onPriceDelete = (index: number) => {
|
||||
|
||||
if(apprLine.value.length-1 !== params.felxColumn.length
|
||||
|| (params.felxColumn.length == 6 && apprLine.value.length-1 == params.felxColumn.length))
|
||||
{
|
||||
apprLine.value.splice(index, 1)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -513,6 +549,7 @@ function onInput(row, column){
|
||||
</VLabel>
|
||||
</VField>
|
||||
<ComVFlexTable
|
||||
:key="apprLine.map(item => item.sabun).join(',')"
|
||||
:data="apprLine"
|
||||
:columns="params.felxColumn"
|
||||
:separators="true"
|
||||
@@ -521,16 +558,21 @@ function onInput(row, column){
|
||||
<template #body-cell="{ row, column, index, value }">
|
||||
<!-- 예: 특정 컬럼이면 input, 아니면 그냥 값 출력 -->
|
||||
<div>
|
||||
<!-- <span v-if="column.key=='gubunCd' && index == 0" class="column">-->
|
||||
<!-- {{row.gubunNm}}-->
|
||||
<!-- </span>-->
|
||||
<span v-if="column.key=='gubunCd'" class="column">
|
||||
<span v-if="(index==0 && column.key != 'gubunCd' && column.key != 'attendCd')" class="column">
|
||||
{{value}}
|
||||
</span>
|
||||
<span v-else-if="(index==0 && column.key == 'gubunCd')" class="column">
|
||||
{{"입안"}}
|
||||
</span>
|
||||
<span v-else-if="(index==0 && column.key == 'attendCd')" class="column">
|
||||
{{"재중"}}
|
||||
</span>
|
||||
<span v-else-if="column.key=='gubunCd'" class="column">
|
||||
<VField class="pr-1">
|
||||
<VCodeSelect
|
||||
cd_grp=7
|
||||
v-model="row.gubunCd"
|
||||
/>
|
||||
<!-- :disabled="index === 0"-->
|
||||
</VField>
|
||||
</span>
|
||||
<span v-else-if="column.key=='attendCd' && index != 0" class="column">
|
||||
@@ -541,8 +583,11 @@ function onInput(row, column){
|
||||
v-model="row.attendCd"/>
|
||||
</VField>
|
||||
</span>
|
||||
<span v-else-if="column.key=='actions'" class="lnil lnil-close"
|
||||
@click="onPayDelete(index)"/>
|
||||
<span v-else-if="column.key === 'actions'" class="flex gap-1">
|
||||
<VCustomButton v-if="index != 1" @click="moveUp(index)" icon="lucide:arrow-up" />
|
||||
<VCustomButton @click="moveDown(index)" icon="lucide:arrow-down" />
|
||||
<VCustomButton @click="onPriceDelete(index)">{{"삭제"}}</VCustomButton>
|
||||
</span>
|
||||
<span v-else>{{value}}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -114,12 +114,11 @@ const validation = () => {
|
||||
const resultGu = apprLine.value.filter((item,index)=> index != 0 && !item.gubunCd)
|
||||
|
||||
if(resultGu.length > 0){
|
||||
console.log("resultGu",resultGu)
|
||||
notyf.error("결재선 구분값을 입력해주세요")
|
||||
return false
|
||||
}
|
||||
|
||||
if(apprLine.value.length < 2){
|
||||
if(apprLine.value.length <= 2){
|
||||
notyf.error("결재선은 본인 외 2명이상 필수입니다.")
|
||||
return false
|
||||
}
|
||||
@@ -210,6 +209,7 @@ const onDelete = (index: number) => {
|
||||
if(params.prcsBizs.length-1 !== params.prcsBizsColumn.length
|
||||
|| (params.prcsBizsColumn.length == 4 && params.prcsBizs.length-1 == params.prcsBizsColumn.length))
|
||||
{
|
||||
|
||||
params.prcsBizs.splice(index, 1)
|
||||
}
|
||||
}
|
||||
@@ -239,6 +239,9 @@ const onPriceDelete = (index: number) => {
|
||||
if(apprLine.value.length-1 !== params.felxColumn.length
|
||||
|| (params.felxColumn.length == 8 && apprLine.value.length-1 == params.felxColumn.length))
|
||||
{
|
||||
console.log("index 삭제",index)
|
||||
console.log("params.felxColumn.length",params.felxColumn.length)
|
||||
console.log("params.felxColumn.length",apprLine.value.length)
|
||||
apprLine.value.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export type Person = {
|
||||
attend_nm: string
|
||||
attend_sta_ymd: string
|
||||
attend_end_ymd: string
|
||||
gubun_cd: string
|
||||
gubunCd: string
|
||||
}
|
||||
|
||||
export type SapPerson = {
|
||||
|
||||
Reference in New Issue
Block a user