
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
<template>
<div
:class="{
content: true,
'admin-style overflow-y': pageRole == 'adm',
'pt50 pb50': pageRole == 'government',
}"
>
<div
:class="{
'w1200 ': pageRole == 'government',
}"
>
<div
:class="{
'admin-page-title point-font2 mb30': pageRole == 'adm',
'page-title point-font mb30': pageRole == 'government',
}"
>
<p>기업관리</p>
</div>
<!-- 기본정보 -->
<details open class="form-table-style mb30">
<summary
:class="{
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
<p class="summary-style pl10">기본정보</p>
</summary>
<div class="pt10 pb10">
<table class="form-table">
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>
<tr>
<td>
<div class="gd-12 pl0">
<label
:class="{
'form-title mb10': true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
기업명
</label>
<div class="flex">
<div class="gd-9 pl0">
<input
type="text"
class="full-input"
ref="entNm"
v-model="entInfoVO.entNm"
placeholder="기업명을 입력하세요."
/>
</div>
<div class="gd-3 pr0">
<button
type="button"
:class="{
'large-btn': true,
'blue-border-btn': pageRole == 'adm',
'green-border-btn': pageRole == 'government',
}"
@click="fnSearch"
>
조회
</button>
</div>
</div>
</div>
</td>
<td>
<div class="gd-12 pr0">
<label
:class="{
'form-title mb10': true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
사업자번호
</label>
<input
type="text"
class="full-input"
ref="brno"
v-model.trim="entInfoVO.brno"
maxlength="10"
placeholder="사업자번호를 입력하세요."
oninput="this.value = this.value.replace(/[^0-9]/g, '')"
/>
</div>
</td>
</tr>
<tr>
<td>
<div class="gd-12 pl0">
<label
:class="{
'form-title mb10': true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
대표자명
</label>
<input
type="text"
class="full-input"
ref="rprsvNm"
v-model="entInfoVO.rprsvNm"
placeholder="대표자명을 입력하세요."
/>
</div>
</td>
<td>
<div class="gd-12 pr0">
<label
:class="{
'form-title mb10': true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
소재지
</label>
<div class="flex">
<div class="gd-6 pl0">
<select class="full-input" v-model="entInfoVO.lctnAdmdsp">
<option value="">행정구역을 선택하세요.</option>
<option
v-for="(code, index) of lctnCodeList"
:key="index"
:value="code.cd"
>
{{ code.cdNm }}
</option>
</select>
</div>
<div class="gd-6 pr0">
<input
type="text"
class="full-input"
ref="lctnSsg"
v-model="entInfoVO.lctnSsg"
placeholder="시, 군, 구를 입력하세요. ex)영주시"
/>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="gd-12 pl0">
<label
:class="{
'form-title mb10': true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
대지면적
</label>
<div class="flex">
<div class="gd-6 pl0">
<input
type="text"
class="full-input"
ref="bplcSiar"
v-model="entInfoVO.bplcSiar"
placeholder="대지면적을 입력하세요."
oninput="this.value = this.value.replace(/[^0-9]/g, '')"
/>
</div>
<div class="gd-6 pr0">
<select
class="full-input"
ref="bplcSiarUnit"
v-model="entInfoVO.bplcSiarUnit"
>
<option value="">대지면적단위를 선택하세요</option>
<option
v-for="(item, idx) in bplcCodeList"
:key="idx"
:value="item.cd"
>
{{ item.cdNm }}
</option>
</select>
</div>
</div>
</div>
</td>
<td>
<div class="gd-12 pr0">
<label
:class="{
'form-title mb10': true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
공장면적
</label>
<div class="flex">
<div class="gd-6 pl0">
<input
type="text"
class="full-input"
ref="fctryArea"
v-model="entInfoVO.fctryArea"
placeholder="공장면적을 입력하세요."
oninput="this.value = this.value.replace(/[^0-9]/g, '')"
/>
</div>
<div class="gd-6 pr0">
<select
class="full-input"
ref="fctryAreaUnit"
v-model="entInfoVO.fctryAreaUnit"
>
<option value="">공장면적단위를 선택하세요</option>
<option
v-for="(item, idx) in bplcCodeList"
:key="idx"
:value="item.cd"
>
{{ item.cdNm }}
</option>
</select>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="gd-12 pl0">
<label
:class="{
'form-title mb10': true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
표준산업분류 코드
</label>
<div class="flex">
<div class="gd-6 pl0">
<input
type="text"
class="full-input"
ref="ksicUpCd"
v-model.trim="entInfoVO.ksicUpCd"
placeholder="상위분류를 입력하세요."
/>
</div>
<div class="gd-6 pr0">
<input
type="text"
class="full-input"
ref="ksicCd"
v-model.trim="entInfoVO.ksicCd"
placeholder="하위분류를 입력하세요."
/>
</div>
</div>
</div>
</td>
<td>
<div class="gd-12 pr0">
<label
:class="{
'form-title mb10': true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
표준산업분류
</label>
<input
type="text"
class="full-input"
ref="ksicNm"
v-model="entInfoVO.ksicNm"
placeholder="표준사업분류를 입력하세요."
/>
</div>
</td>
</tr>
<tr>
<td>
<div class="gd-12 pl0">
<label
:class="{
'form-title mb10': true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
주요제품
</label>
<input
type="text"
class="full-input"
ref="mainPrdct"
v-model="entInfoVO.mainPrdct"
placeholder="주요제품을 입력하세요."
/>
</div>
</td>
<td>
<div class="flex gd-12 pr0">
<div class="gd-6 pl0">
<label
for=""
:class="{
'form-title mb10': true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
기업신용
</label>
<input
type="text"
class="full-input"
ref="entCrdt"
v-model="entInfoVO.entCrdt"
placeholder="기업신용을 입력하세요."
/>
</div>
<div class="gd-6 pr0">
<label
for=""
:class="{
'form-title mb10': true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
설립일
</label>
<input
type="date"
class="full-input"
ref="fndnDt"
v-model="entInfoVO.fndnDt"
/>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="gd-12 pl0">
<label
:class="{
'form-title mb10': true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
고용인원수
</label>
<input
type="text"
class="full-input"
ref="wrkrCnt"
v-model="entInfoVO.wrkrCnt"
placeholder="고용인원수를 입력하세요."
/>
</div>
</td>
<td>
<div class="gd-12 pr0"></div>
</td>
</tr>
</table>
</div>
</details>
<!-- 기업명 조회 -->
<Modal className="small-modal" :showModal="isOpen">
<template v-slot:header>
<div
:class="{
'box-title': true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
<p>기업정보 조회</p>
</div>
<button class="close-btn" @click="fnModalClose">X</button>
</template>
<!-- 검색 -->
<div class="search-bar flex mb15">
<div class="border gd-9 pl0">
<input
type="text"
class="full-input border-none"
v-model="search.searchText"
v-on:keyup.enter="fnViewList"
placeholder="기업명을 입력하세요."
/>
</div>
<div class="gd-3 pr0">
<button
:class="{
'large-btn': true,
'blue-border-btn': pageRole == 'adm',
'green-border-btn': pageRole == 'government',
}"
@click="fnViewList"
>
검색
</button>
</div>
</div>
<!-- 목록 -->
<table class="form-table2 mb10">
<colgroup>
<col style="width: 70%" />
<col />
</colgroup>
<thead>
<tr>
<th>기업명</th>
<th>비고</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) of list" :key="index">
<td>{{ item.entNm }}</td>
<td class="text-ct">
<button
type="button"
:class="{
'large-btn': true,
'blue-border-btn': pageRole == 'adm',
'green-border-btn': pageRole == 'government',
}"
@click="fnMove(item)"
>
이동
</button>
</td>
</tr>
</tbody>
</table>
<template v-slot:footer>
<div class="gd-2"></div>
<div class="gd-8">
<PaginationButton
v-model:currentPage="search.currentPage"
:pagination="search"
:click="fnViewList"
:className="pageRole == 'adm' ? 'admin-pagination' : null"
/>
</div>
<div class="gd-2"></div>
</template>
</Modal>
<!-- 세부정보 -->
<details open class="form-table-style mb30">
<summary
:class="{
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
<p class="summary-style pl10">세부정보</p>
</summary>
<div class="pt10 pb10">
<table class="form-table">
<tr>
<td>
<div class="gd-12 pl0 pr0">
<label
for=""
:class="{
mb10: true,
'point-font2': pageRole == 'adm',
'point-font': pageRole == 'government',
}"
>
비고
</label>
<textarea
name=""
id=""
class="content"
v-model="entInfoVO.rmrk"
placeholder="내용을 입력하세요."
></textarea>
</div>
</td>
</tr>
<!-- 재무제표 -->
<FnstmInsert
:data="entInfoVO.fileList"
:pageRole="pageRole"
@fnFileModify="fnFileModify"
/>
</table>
</div>
</details>
<!-- 관내사업장 -->
<BplcInsert
:pageId="pageId"
:data="entInfoVO.bplcList"
:codeList="bplcCodeList"
:pageRole="pageRole"
ref="bplcInput"
/>
<!-- 하단버튼 -->
<div class="flex justify-end align-center no-gutters">
<div class="gd-1 mr10">
<button
:class="{
'large-btn': true,
'blue-btn': pageRole == 'adm',
'green-btn': pageRole == 'government',
}"
@click="fnUpsert"
>
{{ pageId == null ? "등록" : "수정" }}
</button>
</div>
<div class="gd-1">
<button class="large-btn gray-btn" @click="fnPrev">취소</button>
</div>
</div>
</div>
</div>
</template>
<script>
import defaultAxios from "../../../../../../resources/js/defaultAxios";
// COMPONENT
import Modal from "../../../../../component/modal/Modal.vue";
import BplcInsert from "../../../../../component/companyInfo/BplcInsert.vue";
import FnstmInsert from "../../../../../component/companyInfo/FnstmInsert.vue";
import PaginationButton from "../../../../../component/pagination/PaginationButton.vue";
// JS
import { defaultSearchParams } from "../../../../../../resources/js/defaultSearchParams";
// API
import { entInfoDetailProc } from "../../../../../../resources/api/entInfo";
import { entInfoListProc } from "../../../../../../resources/api/entInfo";
export default {
components: {
BplcInsert: BplcInsert,
FnstmInsert: FnstmInsert,
PaginationButton: PaginationButton,
Modal: Modal,
},
data() {
return {
pageId: this.$route.query.pageId, // 페이지 아이디
pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth, // 페이지 권한
pageRole: this.$store.state.userType, // 유저 권한
// 기업명 조회 모달
isOpen: false,
list: [],
search: { ...defaultSearchParams },
entInfoVO: {},
bplcCodeList: [],
lctnCodeList: [],
// 파일 업로드
fileList: [],
insertFileList: [],
deleteFileList: [],
brno: null,
};
},
computed: {
routerPaths() {
return {
list: this.$store.state.path + "/list.page",
view: this.$store.state.path + "/view.page",
insert: this.$store.state.path + "/insert.page",
};
},
},
created() {
this.fnViewDetail();
},
methods: {
// axios: 조회(상세)
async fnViewDetail() {
// 데이터 세팅
const data = { entId: this.pageId };
// 실행
try {
const response = await entInfoDetailProc(data);
this.entInfoVO = response.data.data.entInfoVO;
this.bplcCodeList = response.data.data.bplcCodeList;
this.lctnCodeList = response.data.data.lctnCodeList;
this.fileList = response.data.data.entInfoVO.fileList;
this.brno = this.entInfoVO.brno;
// 설립일 기본값 추가
let today = new Date().toISOString().substring(0, 10);
if (this.entInfoVO.fndnDt == null) {
this.entInfoVO.fndnDt = today;
}
} catch (error) {
alert("에러가 발생했습니다.\n관리자에게 문의해주세요.");
}
},
// 파일 목록 수정
fnFileModify(key, file) {
if (key == "cre") {
this.insertFileList = [...this.insertFileList, ...Array.from(file)];
} else if (key == "del") {
this.deleteFileList.push(file);
}
},
// 등록 및 수정
fnUpsert() {
// 기업정보 유효성 검사
if (this.valiadtion() == false) {
return;
}
// 관내사업장 유효성 검사
if (this.bplcValiadtion() == false) {
return;
}
// 데이터 세팅
this.entInfoVO.deleteFileList = this.deleteFileList;
let formData = new FormData();
const paramsToBlob = new Blob([JSON.stringify(this.entInfoVO)], {
type: "application/json; charset=UTF-8",
});
formData.append("entInfoVO", paramsToBlob);
if (this.insertFileList.length > 0) {
for (const file of this.insertFileList) {
formData.append("insertFileList", file);
}
}
defaultAxios({
url:
this.pageId == null
? "/government/entInfo/insertProc.file"
: "/government/entInfo/updateProc.file",
method: "post",
headers: {
"Content-Type": "multipart/form-data; charset=UTF-8",
Authorization: this.$store.state.authorization,
},
data: formData,
})
.then((response) => {
alert(response.data["message"]);
this.$router.push({
path: this.routerPaths["view"],
query: {
pageId:
this.pageId == null ? response.data.data.entId : this.pageId,
},
});
})
.catch((error) => {
const errorData = error.response.data;
if (errorData.message != null && errorData.message != "") {
alert(error.response.data.message);
} else {
alert("에러가 발생했습니다.\n관리자에게 문의해주세요.");
}
});
},
// 기업정보 유효성 검사
valiadtion() {
if (this.entInfoVO["entNm"] == null || this.entInfoVO["entNm"] == "") {
alert("기업명을 입력해주세요.");
this.$refs.entNm.focus();
return false;
}
if (this.entInfoVO["brno"] == null || this.entInfoVO["brno"] == "") {
alert("사업자번호를 입력해주세요.");
this.$refs.brno.focus();
return false;
}
if (this.entInfoVO["brno"].length < 10) {
alert("사업자번호는 10자리로 입력해주세요.");
this.$refs.brno.focus();
return false;
}
if (
this.entInfoVO["rprsvNm"] == null ||
this.entInfoVO["rprsvNm"] == ""
) {
alert("대표자명을 입력해주세요.");
this.$refs.rprsvNm.focus();
return false;
}
if (
this.entInfoVO["lctnAdmdsp"] == null ||
this.entInfoVO["lctnAdmdsp"] == ""
) {
alert("소재지 행정구역을 선택해주세요.");
return false;
}
if (
this.entInfoVO["lctnSsg"] == null ||
this.entInfoVO["lctnSsg"] == ""
) {
alert("소재지 시, 군, 구를 입력해주세요.");
this.$refs.lctnSsg.focus();
return false;
}
if (
this.entInfoVO["bplcSiar"] == null ||
this.entInfoVO["bplcSiar"] == "" ||
this.entInfoVO["bplcSiar"] < 1
) {
alert("대지면적을 입력해주세요.");
this.$refs.bplcSiar.focus();
return false;
}
if (
this.entInfoVO["bplcSiarUnit"] == null ||
this.entInfoVO["bplcSiarUnit"] == "" ||
this.entInfoVO["bplcSiarUnit"] < 1
) {
alert("대지면적단위를 선택해주세요.");
return false;
}
if (
this.entInfoVO["fctryArea"] == null ||
this.entInfoVO["fctryArea"] == "" ||
this.entInfoVO["fctryArea"] < 1
) {
alert("공장면적을 입력해주세요.");
this.$refs.fctryArea.focus();
return false;
}
if (
this.entInfoVO["fctryAreaUnit"] == null ||
this.entInfoVO["fctryAreaUnit"] == "" ||
this.entInfoVO["fctryAreaUnit"] < 1
) {
alert("공장면적단위를 선택해주세요.");
return false;
}
if (
this.entInfoVO["ksicUpCd"] == null ||
this.entInfoVO["ksicUpCd"] == ""
) {
alert("표준산업분류 코드를 입력해주세요.");
this.$refs.ksicUpCd.focus();
return false;
}
if (this.entInfoVO["ksicCd"] == null || this.entInfoVO["ksicCd"] == "") {
alert("표준산업분류 코드를 입력해주세요.");
this.$refs.ksicCd.focus();
return false;
}
if (this.entInfoVO["ksicNm"] == null || this.entInfoVO["ksicNm"] == "") {
alert("표준산업분류를 입력해주세요.");
this.$refs.ksicNm.focus();
return false;
}
if (
this.entInfoVO["mainPrdct"] == null ||
this.entInfoVO["mainPrdct"] == ""
) {
alert("주요제품을 입력해주세요.");
this.$refs.mainPrdct.focus();
return false;
}
if (
this.entInfoVO["entCrdt"] == null ||
this.entInfoVO["entCrdt"] == ""
) {
alert("기업신용을 입력해주세요.");
this.$refs.entCrdt.focus();
return false;
}
if (this.entInfoVO["fndnDt"] == null || this.entInfoVO["fndnDt"] == "") {
alert("설립일을 입력해주세요.");
this.$refs.fndnDt.focus();
return false;
}
if (
this.entInfoVO["wrkrCnt"] == null ||
this.entInfoVO["wrkrCnt"] == "" ||
this.entInfoVO["wrkrCnt"] < 1
) {
alert("고용인원수를 입력해주세요.");
this.$refs.wrkrCnt.focus();
return false;
}
return true;
},
// 관내사업장 유효성 검사
bplcValiadtion() {
const bplcRefs = this.$refs.bplcInput;
for (let i = 0; i < this.entInfoVO.bplcList.length; i++) {
if (this.entInfoVO.bplcList[i].useYn == "Y") {
if (
this.entInfoVO.bplcList[i]["bplcNm"] == null ||
this.entInfoVO.bplcList[i]["bplcNm"] == ""
) {
alert("사업장명을 입력해주세요.");
bplcRefs.$refs.bplcNm[i].focus();
return false;
}
if (
this.entInfoVO.bplcList[i]["mainPrdt"] == null ||
this.entInfoVO.bplcList[i]["mainPrdt"] == ""
) {
alert("주생산품을 입력해주세요.");
bplcRefs.$refs.mainPrdt[i].focus();
return false;
}
if (
this.entInfoVO.bplcList[i]["bplcAddr"] == null ||
this.entInfoVO.bplcList[i]["bplcAddr"] == ""
) {
alert("주소를 입력해주세요.");
bplcRefs.$refs.bplcAddr[i].focus();
return false;
}
if (
this.entInfoVO.bplcList[i]["bplcSiar"] == null ||
this.entInfoVO.bplcList[i]["bplcSiar"] == ""
) {
alert("대지면적을 입력해주세요.");
bplcRefs.$refs.bplcSiar[i].focus();
return false;
}
if (
this.entInfoVO.bplcList[i]["bplcSiarUnit"] == null ||
this.entInfoVO.bplcList[i]["bplcSiarUnit"] == ""
) {
alert("대지면적 단위를 입력해주세요.");
bplcRefs.$refs.bplcSiarUnit[i].focus();
return false;
}
if (
this.entInfoVO.bplcList[i]["fctryArea"] == null ||
this.entInfoVO.bplcList[i]["fctryArea"] == ""
) {
alert("공장면적을 입력해주세요.");
bplcRefs.$refs.fctryArea[i].focus();
return false;
}
if (
this.entInfoVO.bplcList[i]["fctryAreaUnit"] == null ||
this.entInfoVO.bplcList[i]["fctryAreaUnit"] == ""
) {
alert("공장면적 단위를 입력해주세요.");
bplcRefs.$refs.fctryAreaUnit[i].focus();
return false;
}
if (
this.entInfoVO.bplcList[i]["wrkrCnt"] == null ||
(this.entInfoVO.bplcList[i]["wrkrCnt"] == "" &&
typeof this.entInfoVO.bplcList[i]["wrkrCnt"] != "number")
) {
alert("종업원수를 입력해주세요.");
bplcRefs.$refs.wrkrCnt[i].focus();
return false;
}
}
}
},
// 취소
fnPrev() {
let isCheck = confirm("작성을 취소하시겠습니까?");
if (!isCheck) {
return;
}
if (this.pageId) {
this.$router.push({
path: this.routerPaths["view"],
query: {
pageId: this.pageId,
},
});
} else {
this.$router.push({
path: this.routerPaths["list"],
});
}
},
// 기업명 조회
fnSearch() {
this.search.searchType = "ent_nm";
this.search.searchText = this.entInfoVO.entNm;
this.fnViewList();
this.isOpen = true;
},
// 모달 닫기
fnModalClose() {
this.isOpen = false;
this.search = { ...defaultSearchParams };
},
// axios: 조회(목록)
async fnViewList() {
// 데이터 세팅
let data = this.search;
// 실행
try {
const response = await entInfoListProc(data);
this.list = response.data.data.list;
this.search = response.data.data.pagination;
} catch (error) {
alert("에러가 발생했습니다.\n시스템관리자에게 문의하세요.");
}
},
// 이동
fnMove(data) {
let isCheck = confirm("작성을 취소하시겠습니까?");
if (!isCheck) {
return;
}
this.$router.push({
path: this.routerPaths["view"],
query: {
pageId: data["entId"],
},
});
},
},
watch: {
"entInfoVO.brno"(newValue) {
if (this.pageId != null) {
if (this.brno != newValue) {
this.entInfoVO.isBrnoChange = true;
}
}
},
},
};
</script>