
--- client/views/pages/adm/departmentManagement/DepartmentManagement.vue
+++ client/views/pages/adm/departmentManagement/DepartmentManagement.vue
... | ... | @@ -185,6 +185,7 @@ |
185 | 185 |
</template> |
186 | 186 |
|
187 | 187 |
<script> |
188 |
+import _ from "lodash"; |
|
188 | 189 |
import draggable from "vuedraggable"; |
189 | 190 |
import Hierachy from "../../../component/hierachy/HierachyDraggable.vue"; |
190 | 191 |
import ListTable from "../../../component/table/ListTable.vue"; |
... | ... | @@ -232,9 +233,9 @@ |
232 | 233 |
selectedDeptId: null, // 선택된 부서 |
233 | 234 |
selectedAuthrt: "", // 부서 권한 |
234 | 235 |
newDept: {}, // 신규 부서 등록 |
235 |
- viewDept: {}, // 사용자에게 보여질 부서정보 |
|
236 |
+ viewDept: { authrtList:[ { authrtCd: "" } ] }, // 사용자에게 보여질 부서정보 |
|
237 |
+ originDept: { authrtList:[ { authrtCd: "" } ] }, // 변경전 부서 정보 |
|
236 | 238 |
searchText: "", // 사용자 정보 검색 |
237 |
- originDept: null, // 변경전 부서 정보 |
|
238 | 239 |
|
239 | 240 |
submitStts: true, |
240 | 241 |
topBoxHeight: 0, |
... | ... | @@ -276,6 +277,7 @@ |
276 | 277 |
this.fnReset(); // 초기화 |
277 | 278 |
this.mblTelnoSplit(res.data.data.deptMbr); |
278 | 279 |
this.viewDept = res.data.data.dept; // 부서 정보 |
280 |
+ this.originDept = _.cloneDeep(this.viewDept); // 변경전 부서 |
|
279 | 281 |
this.deptMbr = res.data.data.deptMbr; // 부서에 등록된 사용자 목록 |
280 | 282 |
this.selectedDeptId = this.viewDept.deptId; |
281 | 283 |
if (this.viewDept.authrtList.length > 0) { |
... | ... | @@ -295,11 +297,20 @@ |
295 | 297 |
}, |
296 | 298 |
// 부서 선택 |
297 | 299 |
fnViewDetail(deptId) { |
300 |
+ // 내용이 변경된 경우 |
|
301 |
+ if(this.isChanged()) { |
|
302 |
+ return; |
|
303 |
+ } |
|
298 | 304 |
this.selectedDeptId = deptId; |
299 | 305 |
this.findByDept(); |
300 | 306 |
}, |
301 | 307 |
// 저장 |
302 | 308 |
async fnSave() { |
309 |
+ // 변경전 코드와 비교 |
|
310 |
+ if(_.isEqual(this.viewDept, this.originDept)) { |
|
311 |
+ alert("변경할 내용이 없습니다."); |
|
312 |
+ return false; |
|
313 |
+ } |
|
303 | 314 |
// 유효성 검사 |
304 | 315 |
if (this.validation() == false) { |
305 | 316 |
return false; |
... | ... | @@ -356,6 +367,7 @@ |
356 | 367 |
alert(res.data.message); |
357 | 368 |
if (res.status == 200) { |
358 | 369 |
this.fnReset(); // 초기화 |
370 |
+ this.originDept = _.cloneDeep(this.newDept); // 변경전 부서 |
|
359 | 371 |
this.viewDept = {}; |
360 | 372 |
this.findAll(); // 목록 재조회 |
361 | 373 |
} |
... | ... | @@ -370,12 +382,17 @@ |
370 | 382 |
}, |
371 | 383 |
// 최상위 신규 객체 생성 |
372 | 384 |
topAdd() { |
373 |
- if (this.selectedDeptId != null) { |
|
374 |
- if (!confirm("작성 중인 부서정보는 저장되지 않습니다.\n계속 하시겠습니까?")) { |
|
375 |
- return; |
|
376 |
- } |
|
385 |
+ // 내용이 변경된 경우 |
|
386 |
+ if(this.isChanged()) { |
|
387 |
+ return; |
|
377 | 388 |
} |
389 |
+ // if (this.selectedDeptId != null) { |
|
390 |
+ // if (!confirm("작성 중인 부서정보는 저장되지 않습니다.\n계속 하시겠습니까?")) { |
|
391 |
+ // return; |
|
392 |
+ // } |
|
393 |
+ // } |
|
378 | 394 |
this.fnReset(); // 초기화 |
395 |
+ this.originDept = _.cloneDeep(this.newDept); // 변경전 부서 |
|
379 | 396 |
this.submitStts = true; |
380 | 397 |
}, |
381 | 398 |
// 하위 신규 객체 생성 |
... | ... | @@ -387,25 +404,29 @@ |
387 | 404 |
alert("상위 부서를 지정하세요."); |
388 | 405 |
return; |
389 | 406 |
} else { |
390 |
- if (!confirm("작성 중인 부서정보는 저장되지 않습니다.\n계속 하시겠습니까?")) { |
|
407 |
+ // 내용이 변경된 경우 |
|
408 |
+ if(this.isChanged()) { |
|
391 | 409 |
return; |
392 | 410 |
} |
411 |
+ // if (!confirm("작성 중인 부서정보는 저장되지 않습니다.\n계속 하시겠습니까?")) { |
|
412 |
+ // return; |
|
413 |
+ // } |
|
393 | 414 |
} |
394 |
- const upDeptId = this.viewDept.deptId; // 상위 부서 아이디 |
|
395 |
- const upDeptNm = this.viewDept.deptNm; // 상위 부서명 |
|
415 |
+ const upDeptId = this.originDept.deptId; // 상위 부서 아이디 |
|
416 |
+ const upDeptNm = this.originDept.deptNm; // 상위 부서명 |
|
396 | 417 |
this.fnReset(); // 초기화 |
397 | 418 |
this.viewDept.upDeptId = upDeptId; |
398 | 419 |
this.viewDept.upDeptNm = upDeptNm; |
420 |
+ this.originDept = _.cloneDeep(this.viewDept); // 변경전 부서 |
|
399 | 421 |
this.submitStts = true; |
400 | 422 |
}, |
401 | 423 |
// 초기화 |
402 | 424 |
fnReset() { |
403 |
- this.viewDept = JSON.parse(JSON.stringify(this.newDept)); // 신규 객체 생성 |
|
425 |
+ this.viewDept = _.cloneDeep(this.newDept); |
|
404 | 426 |
this.selectedDeptId = null; // 선택된 부서 객체 아이디 초기화 |
405 | 427 |
this.selectedAuthrt = ""; |
406 | 428 |
this.mbrList = []; // 부서에 등록되지 않은 사용자 정보 초기화 |
407 | 429 |
this.deptMbr = []; // 부서에 등록된 사용자 정보 초기화 |
408 |
- this.originDept = this.viewDept.deptId; // null |
|
409 | 430 |
this.makeTbody(); |
410 | 431 |
this.makeMbrTobdy(); |
411 | 432 |
}, |
... | ... | @@ -538,9 +559,15 @@ |
538 | 559 |
// axios: 목록 수정 |
539 | 560 |
async fnListUpdate() { |
540 | 561 |
try { |
541 |
- if (!confirm("부서 목록을 저장하시겠습니까?\n 작성 중인 부서정보는 저장되지 않습니다.")) { |
|
542 |
- return; |
|
562 |
+ // 내용이 변경된 경우 |
|
563 |
+ if(!_.isEqual(this.viewDept, this.originDept)) { |
|
564 |
+ if (!confirm("부서 목록을 저장하시겠습니까?\n 작성 중인 부서정보는 저장되지 않습니다.")) { |
|
565 |
+ return; |
|
566 |
+ } |
|
543 | 567 |
} |
568 |
+ // if (!confirm("부서 목록을 저장하시겠습니까?\n 작성 중인 부서정보는 저장되지 않습니다.")) { |
|
569 |
+ // return; |
|
570 |
+ // } |
|
544 | 571 |
const res = await updateListProc(this.deptList); |
545 | 572 |
alert(res.data.message); |
546 | 573 |
if (res.status == 200) { |
... | ... | @@ -572,6 +599,16 @@ |
572 | 599 |
item["mblTelno"] = start + "-" + middle + "-" + end; |
573 | 600 |
} |
574 | 601 |
}, |
602 |
+ |
|
603 |
+ // 변경 감지 |
|
604 |
+ isChanged() { |
|
605 |
+ if(!_.isEqual(this.viewDept, this.originDept) || this.selectedAuthrt != this.viewDept.authrtList[0]?.authrtCd) { |
|
606 |
+ if (!confirm("작성 중인 부서정보는 저장되지 않습니다.\n계속 하시겠습니까?")) { |
|
607 |
+ return true; |
|
608 |
+ } |
|
609 |
+ } |
|
610 |
+ return false; |
|
611 |
+ } |
|
575 | 612 |
}, |
576 | 613 |
watch: { |
577 | 614 |
topBoxHeight() { |
--- client/views/pages/adm/preferences/commonCodeManagement/CommonCodeManagement.vue
+++ client/views/pages/adm/preferences/commonCodeManagement/CommonCodeManagement.vue
... | ... | @@ -280,8 +280,8 @@ |
280 | 280 |
// return; |
281 | 281 |
// } |
282 | 282 |
} |
283 |
- const upCd = this.viewCode.cd; |
|
284 |
- const upCdNm = this.viewCode.cdNm; |
|
283 |
+ const upCd = this.originCode.cd; |
|
284 |
+ const upCdNm = this.originCode.cdNm; |
|
285 | 285 |
this.viewCode = _.cloneDeep(this.newCode); |
286 | 286 |
this.viewCode.upCd = upCd; |
287 | 287 |
this.viewCode.upCdNm = upCdNm; |
... | ... | @@ -310,8 +310,10 @@ |
310 | 310 |
async fnListUpdate() { |
311 | 311 |
try { |
312 | 312 |
// 내용이 변경된 경우 |
313 |
- if(this.isChanged()) { |
|
314 |
- return; |
|
313 |
+ if(!_.isEqual(this.viewCode, this.originCode)) { |
|
314 |
+ if (!confirm("공통코드 목록을 저장하시겠습니까?\n 작성 중인 공통코드정보는 저장되지 않습니다.")) { |
|
315 |
+ return; |
|
316 |
+ } |
|
315 | 317 |
} |
316 | 318 |
const res = await updateListProc(this.codeList); |
317 | 319 |
alert(res.data.message); |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?