SMMQK00110.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. var acptno = "";
  2. /**
  3. * @---------------------------------------------------
  4. * @desc : SMMQK00100_QI활동계획서가 load될때 실행되는 function
  5. * @param :
  6. * @return :
  7. * @---------------------------------------------------
  8. */
  9. function fInitialize(){
  10. var ano = "";
  11. if(isPopup() == true){
  12. acptno = opener.javascript.getParameter("ano");
  13. model.setValue("/root/main/cond/acptno", acptno);
  14. }
  15. /*+++++++++++++++++++++++권한별 화면 설정+++++++++++++++++++++++*/
  16. groupRevitalize("grp_plan", "D", "N"); //모든 콘트롤 활성화로 초기화
  17. var userAuth = "";
  18. //최초등록일 경우
  19. if(acptno == ""){
  20. model.setValue("/root/main/cond/prcsstagecd", "100");
  21. var rgstrid = getUserId();
  22. var rgstrhngnm = getUserInfo("usernm");
  23. var rgstrdeptcd = getUserInfo("dutplcecd");
  24. var rgstrdeptnm = getUserInfo("dutplcenm");
  25. var rgstdd = getCurrentDate();
  26. model.setValue("/root/main/cond/rgstrid", rgstrid);
  27. model.setValue("/root/main/cond/rgstrhngnm", rgstrhngnm);
  28. model.setValue("/root/main/cond/rgstrdeptcd", rgstrdeptcd);
  29. model.setValue("/root/main/cond/rgstrdeptnm", rgstrdeptnm);
  30. model.setValue("/root/main/cond/rgstrdd", rgstdd);
  31. model.setValue("/root/main/cond/prizyn", "N"); //포상유무
  32. btn_fbreflt.disabled = true;
  33. btn_fbreq.disabled = true;
  34. btn_end.disabled = true;
  35. }
  36. //조회일 경우
  37. else if(acptno != ""){
  38. submit("TRMQK00100");
  39. copyNodeType("/root/main/cond", "/root/tmp/cond", "replace");
  40. model.refresh();
  41. var prcsstatcd = model.getValue("/root/main/cond/prcsstatcd");
  42. userAuth = fchkUser(); //사용자별 권한정보 가져오기
  43. // alert("prcsstatcd : "+prcsstatcd);
  44. // alert("userAuth : "+userAuth);
  45. //1. 현재상태가 저장인 경우
  46. if(prcsstatcd == "1"){
  47. tar_feedbackcnts.disabled = true;
  48. btn_fbreflt.disabled = true; //>F/B 반영
  49. btn_fbreq.disabled = true; //F/B 요청
  50. btn_end.disabled = true; //마감
  51. }
  52. //2. 현재상태가 전송인 경우
  53. if(prcsstatcd == "2"){
  54. groupRevitalize("grp_plan", "D", "Y");
  55. btn_filedown.disabled = false;
  56. if(userAuth == "U"){
  57. btn_fbreq.disabled = true;
  58. btn_end.disabled = true;
  59. }
  60. if(userAuth == "Q"){
  61. btn_fbreq.disabled = false;
  62. btn_end.disabled = false;
  63. }
  64. }
  65. //3. 현재상태가 F/B요청 경우
  66. if(prcsstatcd == "3"){
  67. if(userAuth == "U"){
  68. btn_save.disabled = true;
  69. btn_tran.disabled = true;
  70. btn_fbreq.disabled = true;
  71. btn_end.disabled = true;
  72. }
  73. else if(userAuth == "Q"){
  74. groupRevitalize("grp_plan", "D", "Y");
  75. btn_filedown.disabled = false;
  76. btn_fbreq.disabled = true;
  77. btn_end.disabled = true;
  78. //QI팀이라도 등록자, 팀장,간사에 속해있으면 F/B반영을 할수잇다.
  79. var loginID = getUserId();
  80. var rgstID = model.getValue("/root/main/cond/rgstrid");
  81. var chfID = model.getValue("/root/main/cond/chfid");
  82. var staffid = model.getValue("/root/main/cond/staffid");
  83. if(loginID == rgstID || loginID == chfID || loginID == staffid){
  84. groupRevitalize("grp_plan", "D", "N");
  85. btn_save.disabled = true;
  86. btn_tran.disabled = true;
  87. }
  88. }
  89. }
  90. //4. 현재상태가 F/B반영 경우
  91. if(prcsstatcd == "4"){
  92. if(userAuth == "U"){
  93. groupRevitalize("grp_plan", "D", "Y");
  94. btn_filedown.disabled = false;
  95. btn_save.disabled = true;
  96. btn_tran.disabled = true;
  97. btn_fbreflt.disabled = true;
  98. btn_fbreq.disabled = true;
  99. btn_end.disabled = true;
  100. }
  101. else if(userAuth == "Q"){
  102. groupRevitalize("grp_plan", "D", "Y");
  103. btn_filedown.disabled = false;
  104. btn_fbreq.disabled = false;
  105. btn_end.disabled = false;
  106. }
  107. }
  108. //5. 현재상태가 마감인 경우
  109. if(prcsstatcd == "5"){
  110. groupRevitalize("grp_plan", "D", "Y");
  111. btn_filedown.disabled = false;
  112. btn_fbreq.disabled = true;
  113. btn_end.disabled = true;
  114. }
  115. }
  116. //첨부파일 유무에따른 버튼활성화 상태 설정
  117. if(model.getValue("/root/main/cond/attfile") == ""){
  118. btn_filedel.disabled = true;
  119. btn_filedown.disabled = true;
  120. }
  121. //Qi팀 여부에따른 FeedBack입력란 활성화
  122. if(userAuth == "Q" && prcsstatcd != "5" && prcsstatcd != "1" && prcsstatcd != "3"){
  123. tar_feedbackcnts.disabled = false;
  124. }
  125. else{
  126. tar_feedbackcnts.disabled = true;
  127. }
  128. //Other이면 조회만 되게끔 설정
  129. if(userAuth == "O"){
  130. groupRevitalize("grp_plan", "D", "Y");
  131. btn_fbreq.disabled = true;
  132. btn_end.disabled = true;
  133. tar_feedbackcnts.disabled = true;
  134. btn_filedown.disabled = false;
  135. }
  136. if(userAuth == "Q"){
  137. btn_exe.visible = true;
  138. btn_search.disabled = false;
  139. btn_filedel.disabled = false;
  140. btn_exe.disabled = false;
  141. }
  142. //양식 저장경로 가져오기
  143. submit("TRMQK00103");
  144. btn_fileform.disabled = false;
  145. //항상
  146. btn_del.disabled = false;
  147. /*+++++++++++++++++++++++권한별 화면 설정 끝+++++++++++++++++++++++*/
  148. mmbfGetDeptCodeComboList("/root/send/reqdata", "/root/init/dept", "I");
  149. model.refresh();
  150. }
  151. /**
  152. * @---------------------------------------------------
  153. * @desc : 팀장, 간사 세부정보 조회 function
  154. * @param : kind : 팀장간사구분
  155. * @return :
  156. * @---------------------------------------------------
  157. */
  158. function getUserPopInfo(kind){
  159. model.resetInstanceNode("/root/main/userpopupinfo");
  160. model.removeNodeset("/root/main/tempuserinfo");
  161. model.makeNode("/root/main/tempuserinfo");
  162. model.removeNode("/root/send/userinfo/userid");
  163. model.makeNode("/root/send/userinfo/userid");
  164. model.setValue("/root/main/userpopupinfo/param", "_OneS_DD");
  165. modal("SPZSU10103_사용자부서선택조회", "", "200", "200", "SPZSU10103","/root/main/userpopupinfo","/root/main/temp");
  166. var iParam = getParameter("SPZSU10103_");
  167. setCSVToNode("/root/main/tempuserinfo", iParam);
  168. clearParameter("SPZSU10103_");
  169. var emplno = model.getValue("/root/main/tempuserinfo/list/userid");
  170. var empInm = model.getValue("/root/main/tempuserinfo/list/usernm");
  171. //2017.02.28 팀장 및 간사 소속부서를 근무지부서로 수정
  172. //var empdeptcd = model.getValue("/root/main/tempuserinfo/list/posdeptcd");
  173. //var empdeptnm = model.getValue("/root/main/tempuserinfo/list/posdeptnm");
  174. var empdeptcd = model.getValue("/root/main/tempuserinfo/list/dutplcecd");
  175. var empdeptnm = model.getValue("/root/main/tempuserinfo/list/dutplcenm");
  176. model.setValue("/root/send/userinfo/userid", emplno);
  177. submit("TRMQK00101");
  178. var empemail = model.getValue("/root/tmp/userinfo/email");
  179. var emptel = model.getValue("/root/tmp/userinfo/tel");
  180. var empmpphonno = model.getValue("/root/tmp/userinfo/mpphonno");
  181. if(kind == "1"){
  182. model.setValue("/root/main/cond/chfid", emplno);
  183. model.setValue("/root/main/cond/chfhngnm", empInm);
  184. model.setValue("/root/main/cond/chfdeptcd", empdeptcd);
  185. model.setValue("/root/main/cond/chfdeptnm", empdeptnm);
  186. model.setValue("/root/main/cond/chfemail", empemail);
  187. model.setValue("/root/main/cond/chfcntctel", emptel);
  188. model.setValue("/root/main/cond/chfceltel", empmpphonno);
  189. }
  190. else if(kind == "2"){
  191. model.setValue("/root/main/cond/staffid", emplno);
  192. model.setValue("/root/main/cond/staffhngnm", empInm);
  193. model.setValue("/root/main/cond/staffdeptcd", empdeptcd);
  194. model.setValue("/root/main/cond/staffdeptnm", empdeptnm);
  195. model.setValue("/root/main/cond/staffemail", empemail);
  196. model.setValue("/root/main/cond/staffcntctel", emptel);
  197. model.setValue("/root/main/cond/staffceltel", empmpphonno);
  198. }
  199. model.refresh();
  200. }
  201. /**
  202. * @---------------------------------------------------
  203. * @desc : QI활동 계획서 저장 function
  204. * @param :
  205. * @return :
  206. * @---------------------------------------------------
  207. */
  208. function fSave(){
  209. /*+++++++++++++++++++++++필수 입력란 체크+++++++++++++++++++++++*/
  210. if(!isRequiredGroup("grp_plan")){
  211. return false;
  212. }
  213. if(fChkSave() == false ){
  214. return false;
  215. }
  216. /*+++++++++++++++++++++++끝+++++++++++++++++++++++*/
  217. model.removenode("/root/send/cond/condition");
  218. model.makeNode("/root/send/cond/condition");
  219. copyNodeType("/root/send/cond/condition", "/root/main/cond", "replace");
  220. submit("TXMQK00100");
  221. model.removenode("/root/send/cond/attach/file");
  222. model.makeNode("/root/send/cond/attach/file");
  223. acptno = model.getValue("/root/main/cond/acptno");
  224. model.setValue("/root/main/cond/prcsstagecd" , "100");
  225. fInitialize();
  226. }
  227. /**
  228. * @---------------------------------------------------
  229. * @desc : Login User 권한 조회
  230. * @param :
  231. * @return : userAuth(사용자권한) U:사용자 Q:QI관리자 O:Other
  232. * @---------------------------------------------------
  233. */
  234. function fchkUser(){
  235. var userAuth = ""
  236. var loginID = getUserId();
  237. var rgstID = model.getValue("/root/main/cond/rgstrid");
  238. var chfID = model.getValue("/root/main/cond/chfid");
  239. var staffid = model.getValue("/root/main/cond/staffid");
  240. //테스트를위해 생성한 하드코딩
  241. var TestQI = "DEVB03";
  242. //Test 용
  243. //if(loginID == TestQI){
  244. // userAuth = "Q";
  245. //}
  246. //원래이거다 테스트를위해 막아놨음
  247. if(checkUserGroup("UGE_QIO") || checkUserGroup("UGE_QIT")){
  248. userAuth = "Q";
  249. }
  250. else if(loginID == rgstID || loginID == chfID || loginID == staffid){
  251. userAuth = "U";
  252. }
  253. else if(loginID != rgstID && loginID != chfID && loginID != staffid){
  254. userAuth = "O";
  255. }
  256. return userAuth;
  257. }
  258. function fChkSave()
  259. {
  260. if (model.getValue("/root/main/cond/majrdeptnm") == "")
  261. {
  262. messageBox("주무부서는","I003");
  263. return false;
  264. }
  265. if (model.getValue("/root/main/cond/chfhngnm") == "" | model.getValue("/root/main/cond/chfdeptnm") == "")
  266. {
  267. messageBox("팀장은","I003");
  268. return false;
  269. }
  270. if (model.getValue("/root/main/cond/staffhngnm") == "" || model.getValue("/root/main/cond/staffdeptnm") == "")
  271. {
  272. messageBox("간사는","I003");
  273. return false;
  274. }
  275. }
  276. function fDel()
  277. {
  278. var prcsstatcd = model.getValue("/root/main/cond/prcsstatcd");
  279. var prcsstagecd = model.getValue("/root/main/cond/prcsstagecd");
  280. var planrgstrid = model.getValue("/root/main/cond/planrgstrid");
  281. var planrgstrhngnm = model.getValue("/root/main/cond/planrgstrhngnm");
  282. var userAuth = "";
  283. userAuth = fchkUser(); //사용자별 권한정보 가져오기
  284. if (userAuth != "Q"){
  285. if (prcsstatcd != "1") {
  286. messageBox("삭제할 수 없는 상태입니다","I999");
  287. return false;
  288. }
  289. if (planrgstrid != getUserInfo("userid")) {
  290. messageBox("삭제할 수 있는 사용자가 아닙니다. 등록자:"+planrgstrhngnm,"I999");
  291. return false;
  292. }
  293. }
  294. if ( messageBox ( "삭제 하시겠습니까?","Q") != "6" )
  295. return false;
  296. model.removenode("/root/send/cond/condition");
  297. model.makeNode("/root/send/cond/condition");
  298. copyNodeType("/root/send/cond/condition", "/root/main/cond", "replace");
  299. submit("TXMQK00200");
  300. var delcnt = model.getValue("/root/hidden/cnt/delcnt");
  301. if (delcnt > 0){
  302. messageBox("정상","I002");
  303. window.close();
  304. }
  305. else {
  306. messageBox("삭제오류","");
  307. }
  308. }