|
|
|
|
@ -104,7 +104,7 @@ dirSet.onCurrentChange = (dataItem) => {
|
|
|
|
|
$C.$findn("dir-list").find("tbody").setCurrentRow(dataIndex);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
fileSet.onDatasetChange = () => {
|
|
|
|
|
fileSet.onDatasetChange = fileSet.onRemove = () => {
|
|
|
|
|
var t = $C.getGridTemplate("file-list"),
|
|
|
|
|
trs = Apply.fromDataset.getTbody(fileSet, t.found, t.notFound, t.replacer),
|
|
|
|
|
length = fileSet.length;
|
|
|
|
|
@ -131,50 +131,81 @@ $C.getFiles = dir => {
|
|
|
|
|
fileSet.setData([]);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$C.createCrdn = () => {
|
|
|
|
|
let current = dirSet.getCurrent("item"),
|
|
|
|
|
dir = current.data.name;
|
|
|
|
|
dialog.alert({
|
|
|
|
|
content: current.getValue("name") + " 디렉토리의 파일로 단속을 등록하시겠습니까?",
|
|
|
|
|
onOK: () => {
|
|
|
|
|
let cctv = {
|
|
|
|
|
dir: null,
|
|
|
|
|
doExempt: null,
|
|
|
|
|
upload: async (filenames) => {
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
ajax.post({
|
|
|
|
|
url : wctx.url("/crdn/crdn05/020/upload.do"),
|
|
|
|
|
silent: true,
|
|
|
|
|
data : {
|
|
|
|
|
taskSeCd: "${taskSeCd}",
|
|
|
|
|
doExempt: $C.findn('doExempt').checked,
|
|
|
|
|
dirs: dir
|
|
|
|
|
doExempt: cctv.doExempt,
|
|
|
|
|
dirs: cctv.dir,
|
|
|
|
|
filenames: filenames.join(",")
|
|
|
|
|
},
|
|
|
|
|
success : (resp) => {
|
|
|
|
|
let content = "<ul>" + [
|
|
|
|
|
"업로드 파일수: " + resp.received,
|
|
|
|
|
"분류 건수: " + resp.divided,
|
|
|
|
|
"정상: " + resp.normal,
|
|
|
|
|
"메타파일 누락: " + resp.malformed,
|
|
|
|
|
"",
|
|
|
|
|
"등록 단속건수: " + resp.success,
|
|
|
|
|
"중복 단속건수: " + resp.duplicates
|
|
|
|
|
]
|
|
|
|
|
.map(str => "<li>" + str + "</li>")
|
|
|
|
|
.join("") + "</ul>";
|
|
|
|
|
dialog.alert({
|
|
|
|
|
content: content,
|
|
|
|
|
onOK: () => {},
|
|
|
|
|
onClose: () => $C.getFiles(dir)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
if (resp.saved) {
|
|
|
|
|
$C.getFiles(dir);
|
|
|
|
|
if(resp.alertMessage)
|
|
|
|
|
dialog.alert(resp.alertMessage);
|
|
|
|
|
else
|
|
|
|
|
dialog.alert("등록이 완료됐습니다.");
|
|
|
|
|
} else {
|
|
|
|
|
dialog.alert(resp.failReason);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
success: resp => resolve(resp)
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
request: async () => {
|
|
|
|
|
let current = dirSet.getCurrent("item"),
|
|
|
|
|
keymapper = file => {
|
|
|
|
|
let str = file.name,
|
|
|
|
|
pos = str.lastIndexOf("_");
|
|
|
|
|
return str.substring(0, pos);
|
|
|
|
|
},
|
|
|
|
|
result = {
|
|
|
|
|
received: 0,
|
|
|
|
|
divided: 0,
|
|
|
|
|
normal: 0,
|
|
|
|
|
malformed: 0,
|
|
|
|
|
success: 0,
|
|
|
|
|
duplicates: 0
|
|
|
|
|
},
|
|
|
|
|
bundles = getBundles(fileSet.getDataset(), keymapper);
|
|
|
|
|
|
|
|
|
|
cctv.dir = current.data.name;
|
|
|
|
|
cctv.doExempt = $C.findn('doExempt').checked;
|
|
|
|
|
|
|
|
|
|
wait();
|
|
|
|
|
for (let i = 0; i < bundles.length; ++i) {
|
|
|
|
|
let filenames = bundles[i].map(info => info.name),
|
|
|
|
|
resp = await cctv.upload(filenames);
|
|
|
|
|
for (let key in result) {
|
|
|
|
|
result[key] += resp[key];
|
|
|
|
|
}
|
|
|
|
|
fileSet.erase(filenames);
|
|
|
|
|
}
|
|
|
|
|
wait(false);
|
|
|
|
|
|
|
|
|
|
let content = "<ul>" + [
|
|
|
|
|
"업로드 파일: " + result.received,
|
|
|
|
|
"처리 대상: " + result.divided,
|
|
|
|
|
"정상: " + result.normal,
|
|
|
|
|
"메타파일 누락: " + result.malformed,
|
|
|
|
|
"",
|
|
|
|
|
"단속 등록: " + result.success,
|
|
|
|
|
"중복 제외: " + result.duplicates
|
|
|
|
|
]
|
|
|
|
|
.map(str => "<li>" + str + "</li>")
|
|
|
|
|
.join("") + "</ul>";
|
|
|
|
|
dialog.alert({
|
|
|
|
|
content: content,
|
|
|
|
|
onOK: () => {},
|
|
|
|
|
onClose: () => $C.getFiles(cctv.dir)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$C.createCrdn = () => {
|
|
|
|
|
let current = dirSet.getCurrent("item"),
|
|
|
|
|
dir = current.data.name;
|
|
|
|
|
dialog.alert({
|
|
|
|
|
content: current.getValue("name") + " 디렉토리의 파일(들)로 단속을 등록하시겠습니까?",
|
|
|
|
|
onOK: () => {cctv.request();}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|