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(/-$/,'')
}
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 fileName = ref('')

View File

@@ -1,5 +1,5 @@
<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'
const notyf = useNotyf()
@@ -87,6 +87,7 @@ function getDetailList(arg){
apprStat: req.apprStat,
attendNm: req.attendNm
})) //비고 데이터 없음, 승인일자 없음 todo
console.log(" apprLine.value", apprLine.value)
}
const updateState = async () => {
@@ -119,6 +120,22 @@ function formatDate(dateStr) {
}).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>
<template>
@@ -185,12 +202,12 @@ function formatDate(dateStr) {
<td>규격입력</td>
<td colspan="2">
<VButton
:color="params.btnChangeFlag? 'success':'primary'"
color='success'
icon="fas fa-plus"
elevated
@click="detailActionsOpen = true"
>
<span> 상세 규격 입력</span>
<span> 상세 규격 등록 완료</span>
</VButton>
<VModal
:open="detailActionsOpen"
@@ -316,14 +333,24 @@ function formatDate(dateStr) {
<tr>
<td>견적요청</td>
<td colspan="6">
<div style="display: flex; justify-content: flex-end; gap: 8px;">
<VButton
color="primary"
icon="fas fa-plus"
elevated
@click="showTable = !showTable"
>
견적사 입력
견적사 확인
</VButton>
<VButton
color="primary"
icon="fas fa-plus"
elevated
@click="onChangeFinal"
>
가격조사 완료
</VButton>
</div>
<div v-if="showTable" class="mt-2">
<ComVFlexTable
:key="params.prcsBizs.length"
@@ -369,7 +396,8 @@ function formatDate(dateStr) {
<template #body-cell="{ row, column, index, value }">
<!-- : 특정 컬럼이면 input, 아니면 그냥 출력 -->
<div>
<span>{{value}}</span>
<span v-if="column.key=='attendNm' && !value">{{'재중'}}</span>
<span v-else>{{value}}</span>
</div>
</template>
</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){
if (column.key === 'bizNo') {
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%;">
</colgroup>
<tbody>
<tr>
@@ -260,6 +279,55 @@ function onInput(row, column){
</div>
</td>
</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>
<td>규격입력</td>
<td colspan="2">
@@ -268,6 +336,7 @@ function onInput(row, column){
icon="fas fa-plus"
elevated
@click="detailActionsOpen = true"
style="width: 100%;"
>
<span v-if="params.btnChangeFlag == false"> 상세 규격 입력</span>
<span v-else-if="params.btnChangeFlag"> 상세 규격 등록 완료</span>
@@ -372,71 +441,21 @@ function onInput(row, column){
<tr>
<td>첨부파일</td>
<td colspan="3">
<VField class="file has-name is-right">
<div class="file-label">
<input
class="file-input"
type="file"
name="resume">
<span class="file-cta">
<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 class="file has-name is-left">
<VButton @click="openFileDialog">
파일 첨부
</VButton>
<input
ref="fileInput"
type="file"
style="display: none"
@change="onFileChange"
/>
<span v-if="fileName" class="file-name">{{ fileName }}</span>
</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-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>
</tbody>
</table>
</div>

View File

@@ -233,7 +233,16 @@ export async function putSurveyPrcsNo(params = {}) {
const result = await axios.put(`/api/prcs/survey${params}`)
return result.data
} 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;
}
}