fix : 코드 정리 및 가격조사 기능 추가 완료

This commit is contained in:
Yesol Choi
2025-05-26 11:12:10 +09:00
parent 2673aa7dc7
commit 0f4272ed48
4 changed files with 124 additions and 77 deletions

View File

@@ -181,15 +181,6 @@ function formatDate(dateStr) {
}).replace(/\./g, '-').replace(/\s/g, '').replace(/-$/,'') }).replace(/\./g, '-').replace(/\s/g, '').replace(/-$/,'')
} }
const onPayDelete = (index: number) => {
if(params.dtlSpecs.length-1 !== params.dtlSpecsColumn.length
|| (params.dtlSpecsColumn.length == 8 && params.dtlSpecs.length-1 == params.dtlSpecsColumn.length))
{
params.dtlSpecs.splice(index, 1)
}
}
const fileInput = ref<HTMLInputElement | null>(null) const fileInput = ref<HTMLInputElement | null>(null)
const fileName = ref('') const fileName = ref('')

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import {getDetailPrcs, updatePrcsNo} from '/src/service/priceApi' import {getDetailPrcs, updatePrcsNo, putSurveyPrcsNo} from '/src/service/priceApi'
import { type Person } from '/@src/utils/types' import { type Person } from '/@src/utils/types'
const notyf = useNotyf() const notyf = useNotyf()
@@ -87,6 +87,7 @@ function getDetailList(arg){
apprStat: req.apprStat, apprStat: req.apprStat,
attendNm: req.attendNm attendNm: req.attendNm
})) //비고 데이터 없음, 승인일자 없음 todo })) //비고 데이터 없음, 승인일자 없음 todo
console.log(" apprLine.value", apprLine.value)
} }
const updateState = async () => { const updateState = async () => {
@@ -119,6 +120,22 @@ function formatDate(dateStr) {
}).replace(/\./g, '-').replace(/\s/g, '').replace(/-$/,'') }).replace(/\./g, '-').replace(/\s/g, '').replace(/-$/,'')
} }
const onChangeFinal = async () => {
let res = null
try {
loading.value = true
res = await putSurveyPrcsNo(params.prcsNo)
notyf.dismissAll()
if (res.request.status === 200) {
notyf.primary('가격조사 완료 되었습니다.')
router.push({path: '/app/contractManagement'})
}
} catch (e) {
notyf.error(e.message)
} finally {
loading.value = false
}
}
</script> </script>
<template> <template>
@@ -185,12 +202,12 @@ function formatDate(dateStr) {
<td>규격입력</td> <td>규격입력</td>
<td colspan="2"> <td colspan="2">
<VButton <VButton
:color="params.btnChangeFlag? 'success':'primary'" color='success'
icon="fas fa-plus" icon="fas fa-plus"
elevated elevated
@click="detailActionsOpen = true" @click="detailActionsOpen = true"
> >
<span> 상세 규격 입력</span> <span> 상세 규격 등록 완료</span>
</VButton> </VButton>
<VModal <VModal
:open="detailActionsOpen" :open="detailActionsOpen"
@@ -316,14 +333,24 @@ function formatDate(dateStr) {
<tr> <tr>
<td>견적요청</td> <td>견적요청</td>
<td colspan="6"> <td colspan="6">
<div style="display: flex; justify-content: flex-end; gap: 8px;">
<VButton <VButton
color="primary" color="primary"
icon="fas fa-plus" icon="fas fa-plus"
elevated elevated
@click="showTable = !showTable" @click="showTable = !showTable"
> >
견적사 입력 견적사 확인
</VButton> </VButton>
<VButton
color="primary"
icon="fas fa-plus"
elevated
@click="onChangeFinal"
>
가격조사 완료
</VButton>
</div>
<div v-if="showTable" class="mt-2"> <div v-if="showTable" class="mt-2">
<ComVFlexTable <ComVFlexTable
:key="params.prcsBizs.length" :key="params.prcsBizs.length"
@@ -369,7 +396,8 @@ function formatDate(dateStr) {
<template #body-cell="{ row, column, index, value }"> <template #body-cell="{ row, column, index, value }">
<!-- : 특정 컬럼이면 input, 아니면 그냥 출력 --> <!-- : 특정 컬럼이면 input, 아니면 그냥 출력 -->
<div> <div>
<span>{{value}}</span> <span v-if="column.key=='attendNm' && !value">{{'재중'}}</span>
<span v-else>{{value}}</span>
</div> </div>
</template> </template>
</ComVFlexTable> </ComVFlexTable>

View File

@@ -194,6 +194,22 @@ const onDetailDelete = (index: number) => {
} }
} }
const fileInput = ref<HTMLInputElement | null>(null)
const fileName = ref('')
function openFileDialog() {
fileInput.value?.click()
}
function onFileChange(event: Event) {
const target = event.target as HTMLInputElement
if (target.files && target.files.length > 0) {
fileName.value = target.files[0].name
// 여기서 파일 업로드 로직을 추가할 수 있습니다.
// 예: emit('file-selected', target.files[0])
}
}
function onInput(row, column){ function onInput(row, column){
if (column.key === 'bizNo') { if (column.key === 'bizNo') {
const raw =row[column.key].replace(/\D/g, '') const raw =row[column.key].replace(/\D/g, '')
@@ -216,6 +232,9 @@ function onInput(row, column){
<col style="width: 10%;"> <col style="width: 10%;">
<col style="width: 10%;"> <col style="width: 10%;">
<col style="width: 10%;"> <col style="width: 10%;">
<col style="width: 10%;">
<col style="width: 10%;">
<col style="width: 10%;">
</colgroup> </colgroup>
<tbody> <tbody>
<tr> <tr>
@@ -260,6 +279,55 @@ function onInput(row, column){
</div> </div>
</td> </td>
</tr> </tr>
<tr>
<td>견적요청</td>
<td colspan="9">
<VButton
color="primary"
icon="fas fa-plus"
elevated
@click="showTable = !showTable"
style="width: 19%;"
>
견적사 입력
</VButton>
<div v-if="showTable" class="mt-2">
<ComVFlexTable
:key="params.prcsBizs.length"
:data="params.prcsBizs"
:columns="params.prcsBizsColumn"
:compact="true"
:separators="true"
:clickable="true"
>
<template #body-cell="{ row, column, index, value }">
<div>
<!-- 다른 editable 컬럼은 input -->
<input
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 출력 -->
<span v-else class="lnil lnil-close"
@click="onDelete(index)">{{ value }}</span>
</div>
</template>
</ComVFlexTable>
<div class="mt-2">
<VButton
color="primary"
icon="fas fa-plus"
@click="addNewEstimateRow"
>
추가
</VButton>
</div>
</div>
</td>
</tr>
<tr> <tr>
<td>규격입력</td> <td>규격입력</td>
<td colspan="2"> <td colspan="2">
@@ -268,6 +336,7 @@ function onInput(row, column){
icon="fas fa-plus" icon="fas fa-plus"
elevated elevated
@click="detailActionsOpen = true" @click="detailActionsOpen = true"
style="width: 100%;"
> >
<span v-if="params.btnChangeFlag == false"> 상세 규격 입력</span> <span v-if="params.btnChangeFlag == false"> 상세 규격 입력</span>
<span v-else-if="params.btnChangeFlag"> 상세 규격 등록 완료</span> <span v-else-if="params.btnChangeFlag"> 상세 규격 등록 완료</span>
@@ -372,69 +441,19 @@ function onInput(row, column){
<tr> <tr>
<td>첨부파일</td> <td>첨부파일</td>
<td colspan="3"> <td colspan="3">
<VField class="file has-name is-right"> <VField class="file has-name is-left">
<div class="file-label"> <VButton @click="openFileDialog">
파일 첨부
</VButton>
<input <input
class="file-input" ref="fileInput"
type="file" type="file"
name="resume"> style="display: none"
<span class="file-cta"> @change="onFileChange"
<span class="file-icon">
<i class="fas fa-cloud-upload-alt"/>
</span>
<span class="file-label">첨부파일</span>
</span>
<span class="file-name light-text">2022.xls</span>
</div>
</VField>
</td>
</tr>
<tr>
<td>견적요청</td>
<td colspan="6">
<VButton
color="primary"
icon="fas fa-plus"
elevated
@click="showTable = !showTable"
>
견적사 입력
</VButton>
<div v-if="showTable" class="mt-2">
<ComVFlexTable
:key="params.prcsBizs.length"
:data="params.prcsBizs"
:columns="params.prcsBizsColumn"
:compact="true"
:separators="true"
:clickable="true"
>
<template #body-cell="{ row, column, index, value }">
<div>
<!-- 다른 editable 컬럼은 input -->
<input
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 출력 --> <span v-if="fileName" class="file-name">{{ fileName }}</span>
<span v-else class="lnil lnil-close" </VField>
@click="onDelete(index)">{{ value }}</span>
</div>
</template>
</ComVFlexTable>
<div class="mt-2">
<VButton
color="primary"
icon="fas fa-plus"
@click="addNewEstimateRow"
>
추가
</VButton>
</div>
</div>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@@ -233,7 +233,16 @@ export async function putSurveyPrcsNo(params = {}) {
const result = await axios.put(`/api/prcs/survey${params}`) const result = await axios.put(`/api/prcs/survey${params}`)
return result.data return result.data
} catch (e) { } catch (e) {
throw new Error(e) const serverError = e.response?.data;
const message = typeof serverError?.body === 'string'
? serverError.body
: 'Unknown error occurred';
const error = new Error(message); // ✅ 반드시 string만 넣기! 아니면 객체가 문자열로 나옴
error.code = serverError?.code;
error.errTime = serverError?.errTime;
throw error;
} }
} }