diff --git a/src/pages/app/priceUpdate.vue b/src/pages/app/priceUpdate.vue
index 308ab92..4b2844b 100644
--- a/src/pages/app/priceUpdate.vue
+++ b/src/pages/app/priceUpdate.vue
@@ -14,7 +14,7 @@ onBeforeMount(async ()=>{
const showTable = ref(false)
const detailActionsOpen = ref(false)
-const apprLine = defineModel
()
+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
+}
+
@@ -539,7 +587,7 @@ const onPrcsFileDownload = async (prcsNo: string, fileOrd: number, logiFnm: stri