
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="container">
<div class="page-titleZone flex justify-between align-center align-center">
<p class="main-title flex80">공지사항 상세</p>
<PageNavigation />
</div>
<div class="content-wrap">
<div class="content">
<div class="flex100">
<div class="table-zone">
<table class="form-table">
<colgroup>
<col width="10%" />
<col width="40%" />
<col width="10%" />
<col width="40%" />
</colgroup>
<tbody>
<tr>
<th>제목</th>
<td colspan="3">{{ item.noticeTitle }}</td>
</tr>
<tr>
<th>등록자</th>
<td>{{ item.noticeInsertUserId }}</td>
<th>등록일시</th>
<td>
{{
!$isEmpty(item.noticeInsertDatetime)
? $getFullTime(item.noticeInsertDatetime)
: ""
}}
</td>
</tr>
<tr>
<th>수정자</th>
<td>{{ item.noticeUpdateUserId }}</td>
<th>수정일시</th>
<td>
{{
!$isEmpty(item.noticeUpdateDatetime)
? $getFullTime(item.noticeUpdateDatetime)
: ""
}}
</td>
</tr>
<tr>
<th>상단고정여부</th>
<td>{{ item.noticeIsFix == 1 ? "고정" : "미고정" }}</td>
<th>조회수</th>
<td>{{ item.noticeHits }}</td>
</tr>
<tr>
<th>내용</th>
<td colspan="3">
<quill-editor
style="height: 130px"
:value="item.noticeContent"
contentType="html"
:options="editorOption"
ref="quillEditorA"
disabled
/>
</td>
</tr>
<tr>
<th>첨부파일목록</th>
<td colspan="3">
<ul>
<li v-for="(item, idx) in fileList" :key="idx">
<span>{{ item.name }}</span>
<button
@click="downloadFile(item)"
class="green-border-btn small-btn"
>
파일 다운로드
</button>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<div class="flex justify-end">
<button class="blue-btn small-btn" @click="fnUpdate">수정</button>
<button class="red-border-btn small-btn" @click="fnDelete">
삭제
</button>
<button class="blue-border-btn small-btn" @click="fnMoveToList">
목록
</button>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import axios from "axios";
export default {
name: "NoticeView",
components: {},
data() {
return {
noticeId: this.$route.query.noticeId,
item: {},
fileList: [],
};
},
mounted() {
this.fnUpdateNoticeHits();
},
methods: {
// 조회수
fnUpdateNoticeHits() {
const vm = this;
// 실행
axios({
url: "/notice/hits",
method: "patch",
data: { noticeId: vm.noticeId },
})
.then((response) => {
if (response.data.checkMessage.status == 200) {
vm.fnSelectDetail();
} else {
vm.$showAlert("에러 발생", response.data.checkMessage.message);
vm.$router.push({ path: "/noticeList.page" });
}
})
.catch((error) => {
vm.$showAlert(
"에러 발생",
"에러가 발생했습니다. 관리자에게 문의해 주세요."
);
vm.$router.push({ path: "/noticeList.page" });
});
},
// 상세 조회
fnSelectDetail() {
const vm = this;
// 실행
axios({
url: "/notice",
method: "get",
params: { noticeId: vm.noticeId },
})
.then((response) => {
if (response.data.checkMessage.status == 200) {
vm.item = response.data.resultData.vo;
vm.fileList = response.data.resultData.fileList;
} else {
vm.$showAlert("에러 발생", response.data.checkMessage.message);
vm.$router.push({ path: "/noticeList.page" });
}
})
.catch((error) => {
vm.$showAlert(
"에러 발생",
"에러가 발생했습니다. 관리자에게 문의해 주세요."
);
vm.$router.push({ path: "/noticeList.page" });
});
},
// 파일 다운로드
downloadFile(file) {
axios({
url: "/fileManage/download",
method: "post",
headers: { "Content-Type": "application/json; charset=UTF-8" },
data: { fileManagerId: file.fileManagerId },
responseType: "blob",
})
.then(function (response) {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", file.name);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
})
.catch(function (error) {
vm.$showAlert(
"에러 발생",
"에러가 발생했습니다. 관리자에게 문의해 주세요."
);
});
},
// 수정
fnUpdate() {
this.$router.push({
path: "/noticeInsert.page",
query: { noticeId: this.noticeId },
});
},
// 삭제
fnDelete() {
const vm = this;
// 실행
axios({
url: "/notice",
method: "patch",
data: { noticeId: vm.noticeId },
})
.then((response) => {
if (response.data.checkMessage.status == 200) {
vm.$showAlert("삭제", "공지사항 삭제에 성공했습니다.");
vm.$router.push({ path: "/noticeList.page" });
} else {
vm.$showAlert("에러 발생", response.data.checkMessage.message);
vm.$router.push({ path: "/noticeList.page" });
}
})
.catch((error) => {
vm.$showAlert(
"에러 발생",
"에러가 발생했습니다. 관리자에게 문의해 주세요."
);
vm.$router.push({ path: "/noticeList.page" });
});
},
// 목록
fnMoveToList() {
this.$router.push({ path: "/noticeList.page" });
},
},
};
</script>