폐기 이미지 선택 방식 변경(라디오버튼에서 체크박스로 변경)

dev
이범준 5 months ago
parent 3ae0c14712
commit 9f41848751

@ -113,10 +113,10 @@
</div> <!-- / Content <div class="container flex-grow-1 px-0"> --> </div> <!-- / Content <div class="container flex-grow-1 px-0"> -->
</div> <!-- / inner page html <div class="content-wrapper"> --> </div> <!-- / inner page html <div class="content-wrapper"> -->
<template id="imgRadioTemplate--${pageName}"> <template id="imgCheckboxTemplate--${pageName}">
<li class="d-flex"> <li class="d-flex">
<label class='mx-1 d-flex flex-row'> <label class='mx-1 d-flex flex-row'>
<input type="radio" name="{name}" class="form-check-input" value="{value}" checked="" /> <input type="checkbox" name="{name}" class="form-check-input" value="{value}" />
<div class="position-relative"> <div class="position-relative">
<img src="{src}" width='200' height='200' /> <img src="{src}" width='200' height='200' />
</div> </div>
@ -323,20 +323,17 @@
} }
// HTML 태그(img,radio) 문자열 생성 // HTML 태그(img,checkbox) 문자열 생성
$P.fnMakeImgTags = (fileArr) => { $P.fnMakeImgTags = (fileArr) => {
var tagsTextArr = []; var tagsTextArr = [];
for(var index = 0; index < fileArr.length; index++){ for(var index = 0; index < fileArr.length; index++){
var item = fileArr[index]; var item = fileArr[index];
var template = document.getElementById("imgRadioTemplate--${pageName}").innerHTML; var template = document.getElementById("imgCheckboxTemplate--${pageName}").innerHTML;
template = template.replace(/{name}/gi, "dsusePrdImgFilesSlector"); template = template.replace(/{name}/gi, "dsusePrdImgFilesSlector");
template = template.replace(/{value}/gi, item.id); template = template.replace(/{value}/gi, item.id);
if(index != 0){
template = template.replace("checked=\"\"", "");
}
template = template.replace(/{src}/gi, item.url); template = template.replace(/{src}/gi, item.url);
@ -380,11 +377,16 @@
//이미지 삭제 버튼 //이미지 삭제 버튼
$("#btnImageDel--${pageName}").on("click", function() { $("#btnImageDel--${pageName}").on("click", function() {
var key = $("#dragAndDrop--${pageName}").find(":radio[name='dsusePrdImgFilesSlector']:checked").val(); var checkeds = $("#dragAndDrop--${pageName}").find(":checkbox[name='dsusePrdImgFilesSlector']:checked");
if(checkeds.length > 0){
$P.fileArr = $P.fileArr.filter((element) => element.id != key); var keys = [];
checkeds.each(function(){
keys.push(this.value);
});
$P.fileArr = $P.fileArr.filter((element) => keys.indexOf(element.id) == -1);
$P.fnDisplay(); $P.fnDisplay();
}
}); });
// 버튼 이벤트 // 버튼 이벤트

Loading…
Cancel
Save