
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-zone">
<div class="content">
<div class="scroll">
<div class="search-bar ">
<input
type="text"
class="form-control sm"
placeholder="경로를 입력하세요."
v-model="search.searchText"
@keyup.enter="findAll"
/>
<button class="btn sm ico-sch" @click="findAll">
검색
</button>
</div>
<div class="tbl-wrap">
<ListTable
:className="'data cursor'"
:colgroup="colgroup"
:thead="thead"
:tbody="tbody"
@listClick="fnView"
>
<template v-slot:button="{ row, idx }">
<button
class="btn-ico md ico-del"
@click.stop="fnDel(row, idx)"
v-if="pageAuth.delAuthrt == 'Y'"
>
</button>
</template>
</ListTable>
</div>
</div>
</div>
</div>
<div class="btn-wrap list">
<div></div>
<PaginationButton :className="'pagination'"
v-model:currentPage="search.currentPage"
:pagination="search"
:click="findAll"
/>
<button
class="btn sm primary"
@click="fnAdd"
v-if="pageAuth.regAuthrt == 'Y'"
>
등록
</button>
</div>
</template>
<script>
import ListTable from "../../../../component/table/ListTable.vue";
import PaginationButton from "../../../../component/pagination/PaginationButton.vue";
import { findAll, del } from "../../../../../resources/api/cntxtPth";
import queryParams from "../../../../../resources/js/queryParams";
import { toRaw } from "vue";
import { defaultSearchParams } from "../../../../../resources/js/defaultSearchParams";
export default {
mixins: [queryParams],
components: {
ListTable: ListTable,
PaginationButton: PaginationButton,
},
data() {
return {
// 페이지 컨텍스트 패스 객체
pageAuth: JSON.parse(localStorage.getItem("vuex")).pageAuth,
colgroup: ["4%", "20", "25%", "13%", "13%", "5%"],
thead: ["NO", "경로", "사용여부", "등록자", "등록일", "삭제"],
tbody: [],
search: { ...defaultSearchParams },
list: [], // 컨텍스트 패스 목록
listCnt: 0,
};
},
created() {
this.resotreQueryParams("queryParams");
this.findAll();
},
methods: {
// 목록 조회
async findAll() {
this.saveQueryParams("queryParams", this.search); // 검색조건 저장
try {
const res = await findAll(toRaw(this.search));
this.list = res.data.data.list;
this.listCnt = res.data.data.pagination.totalRecordCount;
this.search = res.data.data.pagination;
this.makeTbody();
console.log("this.list : ", this.list);
} catch (error) {
// console.log("error : ", error);
}
},
// 상세 조회
fnView(idx) {
this.saveQueryParams("queryParams", this.search); // 검색조건 저장
this.$router.push({
name: "admContextPathSelectListOne",
query: {
pageId: this.list[idx]["cntxtPthId"],
},
});
},
// 등록 페이지 이동
fnAdd() {
this.$router.push({
name: "admContextPathInsert",
});
},
// 삭제
async fnDel(row, idx) {
if (this.list[idx].sysPvsnYn == 0) {
alert("시스템에서 제공하는 정보는 삭제할수 없습니다.");
return;
}
if (!confirm("삭제하시겠습니까?")) {
return;
}
try {
const res = await del(this.list[idx]);
alert(res.data.message);
if (res.status == 200) {
this.findAll();
}
} catch (error) {
alert("에러가 발생했습니다.\n시스템관리자에게 문의하세요.");
}
},
// tbody 생성
makeTbody() {
this.tbody = []; // 초기화
this.tbody = this.list.map((cntxtPth, index) => {
let id =
this.listCnt -
index -
(this.search.currentPage - 1) * this.search.recordSize; // 번호
let path = cntxtPth.path; // 경로
let useYn = cntxtPth.useYn; // 사용여부
let writer; // 작성자
let writeDt; // 작성일
// 수정 이력 확인 후 수정된 경우가 없다면 최초 작성자로 등록
if (cntxtPth.mdfr == null || cntxtPth.mdfr === "") {
writer = cntxtPth.rgtrNm;
writeDt = cntxtPth.regDt;
} else {
writer = cntxtPth.mdfrNm;
writeDt = cntxtPth.mdfcnDt;
}
return { id, path, useYn, writer, writeDt };
});
},
},
watch: {},
computed: {},
mounted() {},
};
</script>