mirror of
https://git.hmsn.ink/kospo/svcm/oa.git
synced 2026-03-20 01:22:33 +09:00
fix : 견적사입력 사업자번호 format 설정
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { savePrice } from '/src/service/priceApi'
|
||||
import { Person } from '/@src/utils/types'
|
||||
import {formatBizNum} from "/@src/utils/common/comfunc.ts";
|
||||
|
||||
const notyf = useNotyf()
|
||||
const showTable = ref(false)
|
||||
@@ -204,6 +205,13 @@ function onFileChange(event: Event) {
|
||||
// 예: emit('file-selected', target.files[0])
|
||||
}
|
||||
}
|
||||
|
||||
function onInput(row, column){
|
||||
if (column.key === 'bizNo') {
|
||||
const raw =row[column.key].replace(/\D/g, '')
|
||||
row[column.key] = formatBizNum(raw) // 실시간 포맷 적용
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -298,6 +306,7 @@ function onFileChange(event: Event) {
|
||||
v-model="row[column.key]"
|
||||
class="editable-input"
|
||||
ref="prcsBizsRef"
|
||||
@blur="onInput(row, column)"
|
||||
/>
|
||||
<span v-else-if="column.key=='num'">{{index + 1}}</span>
|
||||
<!-- readonly 출력 -->
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import {getDetailPrcs, updatePrice} from '/src/service/priceApi'
|
||||
import { type Person } from '/@src/utils/types'
|
||||
import {formatBizNum, formatDate} from "/@src/utils/common/comfunc.ts";
|
||||
|
||||
const notyf = useNotyf()
|
||||
const loading = ref(false)
|
||||
@@ -47,7 +48,14 @@ const params = reactive({
|
||||
prcsBizsColumn: [ //견적사 입력
|
||||
{ key: 'num', label: '구분', width: '10%' },
|
||||
{ key: 'email', label: '이메일', editable: true, width: '50px' },
|
||||
{ key: 'bizNo', label: '사업자번호', editable: true, width: '50px'},
|
||||
{ key: 'bizNo', label: '사업자번호', editable: true,
|
||||
format: (value: string) => {
|
||||
// '1234567890' -> '123-45-67890'
|
||||
console.log("value",value)
|
||||
if (!value) return ''
|
||||
return formatBizNum(value)
|
||||
}
|
||||
},
|
||||
{ key: 'actions', label: '동작', width: '100px'}
|
||||
],
|
||||
prcsBizs: [], //견적사 입력 데이터
|
||||
@@ -62,14 +70,11 @@ const params = reactive({
|
||||
{ key: '', label: '삭제', editable: false },
|
||||
],
|
||||
dtlSpecs: [], //상세 규격 입력 데이터
|
||||
detailData :[
|
||||
{ cateNm: '홍길동', age: 30, email: 'hong@example.com' },
|
||||
{ name: '김철수', age: 28, email: 'kim@example.com' },
|
||||
],
|
||||
btnChangeFlag: false
|
||||
})
|
||||
|
||||
function getDetailList(arg){
|
||||
console.log("arg",arg)
|
||||
params.prcsNo = arg.prcsNo
|
||||
params.stCd = arg.stCd
|
||||
params.cateSelect = arg.cateCd
|
||||
@@ -91,6 +96,7 @@ function getDetailList(arg){
|
||||
apprNo: req.apprNo,
|
||||
apprOrd: req.apprOrd,
|
||||
apprStat: req.apprStat,
|
||||
apprDt: req.apprDt,
|
||||
attendCd: req.attendCd
|
||||
})) //비고 데이터 없음, 승인일자 없음 todo
|
||||
}
|
||||
@@ -136,6 +142,7 @@ const updatePriceOne = async () => {
|
||||
prcsAtts: params.prcsAtts, //첨부파일 데이터
|
||||
apprReqs: apprLine.value.map(({ deptNm, ...rest }) => rest), //결재선 데이터
|
||||
}
|
||||
console.log("paramsPrice",paramsPrice)
|
||||
res = await updatePrice(paramsPrice)
|
||||
notyf.dismissAll()
|
||||
if(res.request.status == '200'){
|
||||
@@ -187,14 +194,11 @@ const onDetailDelete = (index: number) => {
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate(dateStr) {
|
||||
if (!dateStr) return ''
|
||||
const date = new Date(dateStr)
|
||||
return date.toLocaleDateString('ko-KR', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
}).replace(/\./g, '-').replace(/\s/g, '').replace(/-$/,'')
|
||||
function onInput(row, column){
|
||||
if (column.key === 'bizNo') {
|
||||
const raw =row[column.key].replace(/\D/g, '')
|
||||
row[column.key] = formatBizNum(raw) // 실시간 포맷 적용
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -412,6 +416,7 @@ function formatDate(dateStr) {
|
||||
v-if="column.editable"
|
||||
v-model="row[column.key]"
|
||||
class="editable-input"
|
||||
@blur="onInput(row, column)"
|
||||
/>
|
||||
<span v-else-if="column.key=='num'">{{index + 1}}</span>
|
||||
<!-- readonly 출력 -->
|
||||
@@ -463,8 +468,10 @@ function formatDate(dateStr) {
|
||||
<span v-else-if="column.key=='attendCd'" class="column">
|
||||
<VField class="pr-1">
|
||||
<VCodeSelect
|
||||
placeholder="재중"
|
||||
cd_grp=6
|
||||
v-model="row.attendCd"/>
|
||||
v-model="row.attendCd">
|
||||
</VCodeSelect>
|
||||
</VField>
|
||||
</span>
|
||||
<span v-else
|
||||
|
||||
@@ -5,3 +5,16 @@ export function formatDate(date) {
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
export function formatBizNum(num){
|
||||
if (!num) return ''
|
||||
|
||||
const raw = num.replace(/\D/g, '') // 숫자만 남김
|
||||
|
||||
// 123 -> 123
|
||||
if (raw.length <= 3) return raw
|
||||
// 12345 -> 123-45
|
||||
if (raw.length <= 5) return raw.replace(/^(\d{3})(\d{0,2})$/, '$1-$2')
|
||||
// 1234567890 -> 123-45-67890
|
||||
return raw.replace(/^(\d{3})(\d{2})(\d{0,5})$/, '$1-$2-$3')
|
||||
}
|
||||
Reference in New Issue
Block a user