공지사항 삭제 기능 추가

This commit is contained in:
kimjhjjang
2022-11-02 17:51:40 +09:00
parent 9cf4c312e5
commit 39e11a5e13
12 changed files with 232 additions and 93 deletions

View File

@@ -98,16 +98,6 @@
</div>
</td>
</tr>
<tr>
<th style="width: 10%">
이미지셋 <br />
<button type="button" @click="setImg">이미지추가</button>
<button type="button" @click="testImg = ''">이미지클리어</button>
</th>
<td class="sender" colspan="5">
<p v-html="testImg"></p>
</td>
</tr>
</tbody>
</table>
</form>
@@ -133,7 +123,6 @@ export default {
mixins: [utils_mixin, chkPattern2],
data() {
return {
testImg: '',
props: {},
row: {},
rsnType: [],
@@ -177,11 +166,6 @@ export default {
ValidationConfirmPopup,
},
methods: {
setImg() {
///%7Cefs%7Chome%7CsendMessage%7C2022%7C09%7C20%7C10%7C2022092010000168664_1.jpg
this.testImg =
"<img src='/api/v1/bo/homeMgt/preview/%7Cefs%7Chome%7CsendMessage%7C2022%7C09%7C20%7C10%7C2022092010000168664_1.jpg' />";
},
handleImageAdded(file, Editor, cursorLocation, resetUploader) {
var fd = new FormData();
fd.append('files', file);
@@ -189,8 +173,9 @@ export default {
homeMgtApi
.getImageUrl(fd)
.then((response) => {
const url = '..' + response.data.data.replaceAll('\\', '/'); // Get url from response
console.log(url);
const url =
'/api/v1/bo/homeMgt/preview/' +
encodeURIComponent(response.data.data.replaceAll('\\', '/').replaceAll('/', '|')); // Get url from response
Editor.insertEmbed(cursorLocation, 'image', url);
resetUploader();
})

View File

@@ -188,8 +188,9 @@ export default {
homeMgtApi
.getImageUrl(fd)
.then((response) => {
const url = '..' + response.data.data.replaceAll('\\', '/'); // Get url from response
console.log(url);
const url =
'/api/v1/bo/homeMgt/preview/' +
encodeURIComponent(response.data.data.replaceAll('\\', '/').replaceAll('/', '|')); // Get url from response
Editor.insertEmbed(cursorLocation, 'image', url);
resetUploader();
})
@@ -502,7 +503,6 @@ export default {
this.row.fileTitle = fileTitle;
this.row.filePath = filePath;
this.row.fileNm = fileName;
console.log(this.row);
homeMgtApi.fileDownload(this.row);
},
},

View File

@@ -15,6 +15,11 @@ const updateNotice = (params) => {
return httpClient.post('/api/v1/bo/homeMgt/updateNotice', params, { withCredentials: false });
};
// 공지사항 삭제
const deleteNotice = (params) => {
return httpClient.post('/api/v1/bo/homeMgt/deleteNotice', params, { withCredentials: false });
};
const getImageUrl = (params) => {
return httpClient.post('/api/v1/bo/homeMgt/getImageUrl', params, {
headers: {
@@ -56,6 +61,7 @@ const fileDownload = (params) => {
export default {
insertNotice,
updateNotice,
deleteNotice,
fileDownload,
getImageUrl,
};

View File

@@ -45,6 +45,7 @@
</div>
<div class="button_group">
<button type="button" class="button blue admin add" @click="ModalOpen()">공지사항 등록</button>
<button type="button" class="button white del" @click="deleteNotice()">삭제</button>
</div>
</div>
<div class="table">
@@ -65,13 +66,16 @@
</div>
<NoticePop ref="NoticePop" />
<NoticeUpdatePop ref="NoticeUpdatePop" />
<common-modal ref="commmonModal"></common-modal>
</div>
</template>
<script>
import httpClient from '../../../common/http-client';
import customGrid from '@/components/CustomGrid';
import commonModal from '@/components/modal/commonModal';
import NoticePop from '../components/NoticePop.vue';
import NoticeUpdatePop from '../components/NoticeUpdatePop.vue';
import homeMgtApi from '../service/homeMgtApi';
class CustomATagRenderer {
constructor(props) {
@@ -98,9 +102,10 @@ class CustomATagRenderer {
export default {
name: 'notice',
components: { customGrid, NoticePop, NoticeUpdatePop },
components: { customGrid, NoticePop, NoticeUpdatePop, commonModal },
data() {
return {
row: {},
totalItems: 0,
perPageCnt: 50,
searchType1: '',
@@ -214,6 +219,48 @@ export default {
this.grid.pagePerRows = this.perPageCnt;
this.search(true);
},
deleteNotice() {
var chkList = this.$refs.table.checkedElementDatas();
if (chkList.length == 0) {
this.row.title = '공지사항 관리';
this.row.msg1 = '삭제 대상을 체크를 해주세요.';
this.$refs.commmonModal.alertModalOpen(this.row);
return false;
}
//const param = chkList.map((row)=>({regReqNo:row.regReqNo} ));
const param = chkList.map((row) => ({ ntNo: row.ntNo }));
this.row.list = param;
this.row.title = '공지사항 관리';
this.row.msg1 = '삭제 하시겠습니까?';
this.$refs.commmonModal.confirmModalOpen2(this.row);
console.log(typeof this.row.list[0].ntNo);
//this.$refs.commmonModal.confirmModalOpen2(this.row);
},
confirmCalbackFnc(props) {
if (props.result) {
this.noticeDelete();
}
},
async noticeDelete() {
try {
let response = await homeMgtApi.deleteNotice(this.row);
const result = response.data;
if (result != null && result.retCode == '0000') {
this.$refs.table.reloadData();
return;
} else {
this.row.title = '공지사항 관리';
this.row.msg1 = '실패 하였습니다.';
this.$refs.commmonModal.alertModalOpen(this.row);
}
} catch (err) {
this.row.title = '공지사항 관리';
this.row.msg1 = '실패 하였습니다.';
this.$refs.commmonModal.alertModalOpen(this.row);
}
},
},
};
</script>