SMMRT01300.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. /*
  2. 과색인 관리(SMMRT01300.xfm - JScript )
  3. - Version :
  4. 1) : Ver.1.00.01
  5. */
  6. var xCondPath = "/root/hidden/condition"; // 조회조건
  7. var xIndxInfoPath = "/root/main/indxinfo/deptindx"; // 색인정보
  8. var xIndxInfoBKPath = "/root/hidden/main/indxinfo/deptindx"; // 색인정보
  9. var xDeptIndxPath = "/root/main/deptindxlist/item"; // 과색인정보
  10. /**
  11. * @group :
  12. * @ver : 2007.04.09
  13. * @by : 이은영
  14. * @---------------------------------------------------
  15. * @type : function
  16. * @access : public
  17. * @desc : 과색인 조회
  18. * @param :
  19. * @return :
  20. * @---------------------------------------------------
  21. */
  22. function fSrchDeptIndxList(){
  23. var sIndxFlag = model.getValue(xCondPath+"/indxflag");
  24. if(sIndxFlag == "0"){ // 진단
  25. cap_indxinfo.value = "진단 색인 정보";
  26. }else if(sIndxFlag == "9"){ // 수술
  27. cap_indxinfo.value = "수술 색인 정보";
  28. }else if(sIndxFlag == "2"){ // 주호소
  29. cap_indxinfo.value = "주호소 색인 정보";
  30. }
  31. if(model.getValue(xCondPath+"/srcheddeptcd") == ""){
  32. return;
  33. }
  34. model.removenodeset(xDeptIndxPath);
  35. //model.resetInstanceNode(xCondPath);
  36. model.removenode("/root/send");
  37. model.makeValue("/root/send/indxflag", model.getValue(xCondPath+"/indxflag"));
  38. model.makeValue("/root/send/deptcd", model.getValue(xCondPath+"/srcheddeptcd"));
  39. if(submit("TRMRT01301")){
  40. model.setValue(xCondPath+"/selectedindxcd","");
  41. trv_deptindx.rebuild();
  42. }
  43. }
  44. /**
  45. * @group :
  46. * @ver : 2007.04.09
  47. * @by : 이은영
  48. * @---------------------------------------------------
  49. * @type : function
  50. * @access : public
  51. * @desc : 과색인 상세 조회
  52. * @param :
  53. * @return :
  54. * @---------------------------------------------------
  55. */
  56. function fSrchIndxInfo(){
  57. ipt_deptindxcd.disabled = true;
  58. model.removenode("/root/send");
  59. model.makeValue("/root/send/deptindxcd", model.getValue(xCondPath+"/selectedindxcd"));
  60. model.makeValue("/root/send/deptcd", model.getValue(xCondPath+"/srcheddeptcd"));
  61. model.makeValue("/root/send/indxflag", model.getValue(xCondPath+"/indxflag"));
  62. if(submit("TRMRT01302")){
  63. model.makeValue(xCondPath+"/highestlvel","");
  64. model.copyNode("/root/hidden/main","/root/main");
  65. model.makeValue(xIndxInfoPath + "/deptnm", model.getValue(xCondPath + "/srcheddeptnm"));
  66. model.refresh();
  67. }
  68. }
  69. /**
  70. * @group :
  71. * @ver : 2007.04.09
  72. * @by : 이은영
  73. * @---------------------------------------------------
  74. * @type : function
  75. * @access : public
  76. * @desc : 과색인 조회
  77. * @param :
  78. * @return :
  79. * @---------------------------------------------------
  80. */
  81. function fInit(){
  82. model.makeValue(xIndxInfoPath+"/status","I");
  83. var sIndxflag = model.getValue(xCondPath+"/getdata/indxflag");
  84. if(sIndxflag != ""){
  85. model.setValue(xCondPath+"/indxflag", sIndxflag);
  86. model.setValue(xCondPath+"/srcheddeptnm", model.getValue(xCondPath+"/getdata/deptnm"));
  87. model.setValue(xCondPath+"/srcheddeptcd", model.getValue(xCondPath+"/getdata/deptcd"));
  88. fSrchDeptIndxList();
  89. opener.javascript.setParameter("saveyn","");
  90. }
  91. }
  92. /**
  93. * @group :
  94. * @ver : 2007.04.09
  95. * @by : 이은영
  96. * @---------------------------------------------------
  97. * @type : function
  98. * @access : public
  99. * @desc : 색인 추가
  100. * @param :
  101. * @return :
  102. * @---------------------------------------------------
  103. */
  104. function fAddIndx(){
  105. var sIndxFlag = model.getValue(xCondPath+"/indxflag");
  106. var sDeptCd = model.getValue(xCondPath+"/srcheddeptcd");
  107. var sUpIndxCd = model.getValue(xCondPath+"/selectedindxcd");
  108. if((trv_deptindx.focusIndex < 0) && (getNodesetCount(xDeptIndxPath) > 0)){
  109. messageBox("색인을 선택하지", "E007");
  110. }
  111. if(sIndxFlag == ""){
  112. messageBox("색인구분을","C002");
  113. return;
  114. }
  115. if(sDeptCd == ""){
  116. messageBox("부서를","C002");
  117. return;
  118. }
  119. fIndxClear();
  120. model.setValue(xCondPath+"/highestlvel","");
  121. model.makeValue(xIndxInfoPath+"/deptupindxcd", sUpIndxCd); // 상위색인코드
  122. model.makeValue(xIndxInfoPath+"/deptupindxnm", model.getValue(xDeptIndxPath+"[deptindxcd = '"+sUpIndxCd+"']/deptindxnm")); // 상위색인명
  123. if(getNodesetCount(xDeptIndxPath) == 0){
  124. model.makeValue(xIndxInfoPath+"/deptseqno", "0");
  125. }
  126. model.refresh();
  127. }
  128. /**
  129. * @group :
  130. * @ver : 2007.04.09
  131. * @by : 이은영
  132. * @---------------------------------------------------
  133. * @type : function
  134. * @access : public
  135. * @desc : 색인 정보 Clear
  136. * @param :
  137. * @return :
  138. * @---------------------------------------------------
  139. */
  140. function fIndxClear(){
  141. ipt_deptindxcd.disabled = false;
  142. var iIndx = trv_deptindx.focusIndex + 1;
  143. model.setValue("/root/hidden/condition/highestlvel","Y");
  144. model.makeValue(xIndxInfoPath+"/deptindxcd","");
  145. model.makeValue(xIndxInfoPath+"/deptindxflag", model.getValue(xCondPath+"/indxflag"));
  146. model.makeValue(xIndxInfoPath+"/deptindxnm","");
  147. model.makeValue(xIndxInfoPath+"/deptupindxcd","-");
  148. model.makeValue(xIndxInfoPath+"/deptupindxnm","");
  149. model.makeValue(xIndxInfoPath+"/deptnm",model.getValue(xCondPath+"/srcheddeptnm"));
  150. model.makeValue(xIndxInfoPath+"/deptcd",model.getValue(xCondPath+"/srcheddeptcd"));
  151. /*
  152. if(model.getValue("/root/hidden/condition/highestlvel") == "Y"){
  153. model.makeValue(xIndxInfoPath+"/deptindxcd","");
  154. model.makeValue(xIndxInfoPath+"/deptindxflag", model.getValue(xCondPath+"/indxflag"));
  155. model.makeValue(xIndxInfoPath+"/deptindxnm","");
  156. model.makeValue(xIndxInfoPath+"/deptupindxcd","-");
  157. model.makeValue(xIndxInfoPath+"/deptupindxnm","");
  158. model.makeValue(xIndxInfoPath+"/deptnm",model.getValue(xCondPath+"/srcheddeptnm"));
  159. model.makeValue(xIndxInfoPath+"/deptcd",model.getValue(xCondPath+"/srcheddeptcd"));
  160. } else if(model.getValue("/root/hidden/condition/highestlvel") == "N"){
  161. model.makeValue(xIndxInfoPath+"/deptindxflag", model.getValue(xCondPath+"/indxflag"));
  162. model.makeValue(xIndxInfoPath+"/deptupindxcd", model.getValue(xDeptIndxPath + "[" + iIndx + "]/deptupindxcd"));
  163. model.makeValue(xIndxInfoPath+"/deptupindxnm", model.getValue(xDeptIndxPath + "[" + iIndx + "]/deptindxnm"));
  164. model.makeValue(xIndxInfoPath+"/deptnm",model.getValue(xCondPath+"/srcheddeptnm"));
  165. model.makeValue(xIndxInfoPath+"/deptcd",model.getValue(xCondPath+"/srcheddeptcd"));
  166. }
  167. */
  168. model.makeValue(xIndxInfoPath+"/status","I"); // 상태
  169. model.refresh();
  170. }
  171. /**
  172. * @group :
  173. * @ver : 2007.04.09
  174. * @by : 이은영
  175. * @---------------------------------------------------
  176. * @type : function
  177. * @access : public
  178. * @desc : 색인 정보 저장
  179. * @param :
  180. * @return :
  181. * @---------------------------------------------------
  182. */
  183. function fSaveIndxInfo(){
  184. var sStatus = model.getValue(xIndxInfoPath+"/status");
  185. var sIndxCd = model.getValue(xIndxInfoPath+"/deptindxcd");
  186. var rtn = 0;
  187. var sNodeInfo ="deptindxcd▦deptindxnm▩색인코드▦색인명";
  188. if(fChkValueEmpty(xIndxInfoPath,sNodeInfo)){
  189. return;
  190. }
  191. if(model.getValue(xDeptIndxPath+"[deptindxcd ='"+sIndxCd+"']/deptindxcd") != ""){
  192. if(sStatus == "I" || (sStatus == "U" && sIndxCd != model.getValue(xIndxInfoPath+"/srchdeptindxcd"))){
  193. messageBox("이미 등록된 색인코드","E008");
  194. return;
  195. }
  196. }
  197. if(sStatus == "U"){
  198. if( instance1.selectSingleNode(xIndxInfoPath).xml == instance1.selectSingleNode(xIndxInfoBKPath).xml){
  199. messageBox("변경된 데이터가","I004");
  200. return;
  201. }
  202. }
  203. if(sStatus != "D") {
  204. rtn = messageBox("","Q002");
  205. }else{
  206. rtn = messageBox("","Q001");
  207. }
  208. if(rtn != 6){
  209. if(sStatus == "D"){
  210. if( instance1.selectSingleNode(xIndxInfoPath).xml == instance1.selectSingleNode(xIndxInfoBKPath).xml){
  211. model.setValue(xIndxInfoPath+"/status", "-");
  212. }else{
  213. model.setValue(xIndxInfoPath+"/status", "U");
  214. }
  215. }
  216. return;
  217. }
  218. /*
  219. if(sStatus == "I" && model.getValue(xIndxInfoPath+"/deptupindxcd") == ""){
  220. model.setValue(xIndxInfoPath+"/deptupindxcd", model.getValue(xIndxInfoPath+"/deptindxcd"));
  221. }*/
  222. model.removenode("/root/send");
  223. model.makeValue("/root/send/srchedindxflag",model.getValue(xCondPath+"/indxflag"));
  224. model.makeValue("/root/send/srcheddeptcd", model.getValue(xCondPath+"/srcheddeptcd"));
  225. model.makeNode("/root/send/deptindxinfo");
  226. model.copyNode("/root/send/deptindxinfo", xIndxInfoPath);
  227. if(submit("TXMRT01301")){
  228. fIndxClear();
  229. if(model.getValue(xCondPath+"/getdata/indxflag") != "" &&
  230. model.getValue(xCondPath+"/getdata/deptcd") == model.getValue(xCondPath+"/srcheddeptcd")){
  231. opener.javascript.setParameter("saveyn","Y");
  232. }
  233. //model.refresh();
  234. //이윤주 수정(20130312)
  235. fSrchDeptIndxList();
  236. }
  237. }
  238. /**
  239. * @group :
  240. * @ver : 2007.04.09
  241. * @by : 이은영
  242. * @---------------------------------------------------
  243. * @type : function
  244. * @access : public
  245. * @desc : 빈 공백 check
  246. * @param :
  247. * @return :
  248. * @---------------------------------------------------
  249. */
  250. function fChkValueEmpty(pRef, pNodeInfo){
  251. var sNodeInfo = pNodeInfo.split("▩");
  252. var sNode = sNodeInfo[0].split("▦");
  253. var sNodeNm = sNodeInfo[1].split("▦");
  254. for(var i=0; i<sNode.length; i++){
  255. if(model.getValue(pRef+"/"+sNode[i]) == ""){
  256. messageBox(sNodeNm[i]+"는 ","I003");
  257. return true;
  258. }
  259. }
  260. return false;
  261. }
  262. /**
  263. * @desc : Drag & Drop
  264. *
  265. * @param : srcNodePos : 기존 색인위치
  266. * : targetNodePos : 바뀔 색인위치
  267. * @return :
  268. * @author : HIT EMR Team
  269. * @---------------------------------------------------
  270. */
  271. function fDragDropIndx(){
  272. if(model.getValue("/root/hidden/condition/selectedindxcd") == ""){
  273. return;
  274. }
  275. var treePath = "/root/main/deptindxlist/item";
  276. var node = root.main.deptindxlist.item;
  277. var ins = document.models(0).instances(0);
  278. var srcValue = trv_deptindx.item(trv_deptindx.mouseRow).value;
  279. //alert("drop=" + srcValue);
  280. var targetNode = ins.selectSingleNode(treePath + "[deptindxcd='"+srcValue+"']" );
  281. //alert(targetNode.xml);
  282. //alert("drag=" + trv_deptindx.value);
  283. var srcNode = ins.selectSingleNode(treePath + "[deptindxcd='"+trv_deptindx.value+"']");
  284. //alert(srcNode.xml);
  285. //alert(model.getValue(treePath + "[deptindxcd='"+srcValue+"']/deptseqno")+","+ model.getValue(treePath + "[deptindxcd='"+trv_deptindx.value+"']/deptseqno"));
  286. if(model.getValue(treePath + "[deptindxcd='"+srcValue+"']/deptindxcd") != model.getValue(treePath + "[deptindxcd='"+trv_deptindx.value+"']/deptindxcd")){
  287. var rtn = messageBox("색인 순서 변경을", "Q004");
  288. if((model.getValue(treePath + "[deptindxcd='"+srcValue+"']/deptupindxcd") == model.getValue(treePath + "[deptindxcd='"+trv_deptindx.value+"']/deptupindxcd")) && (rtn == 6)){
  289. // 값은 level에서만 순서변경이 가능하다
  290. // indxseqno 값을 변경
  291. if(parseInt(model.getValue(treePath + "[deptindxcd='"+srcValue+"']/deptseqno")) < parseInt(model.getValue(treePath + "[deptindxcd='"+trv_deptindx.value+"']/deptseqno"))){
  292. //alert("위로");
  293. model.makeValue("/root/send/reqdata/dragdrop/status", "PLUS");
  294. model.makeValue("/root/send/reqdata/dragdrop/deptindxcd", model.getValue(treePath + "[deptindxcd='"+trv_deptindx.value+"']/deptindxcd"));
  295. model.makeValue("/root/send/reqdata/dragdrop/deptseqno", model.getValue(treePath + "[deptindxcd='"+srcValue+"']/deptseqno"));
  296. model.makeValue("/root/send/reqdata/dragdrop/predeptseqno", model.getValue(treePath + "[deptindxcd='"+trv_deptindx.value+"']/deptseqno"));
  297. model.makeValue("/root/send/reqdata/dragdrop/deptcd", model.getValue(xCondPath+"/srcheddeptcd"));
  298. model.makeValue("/root/send/reqdata/dragdrop/indxflag", model.getValue("/root/hidden/condition/indxflag"));
  299. } else {
  300. //alert("아래로");
  301. model.makeValue("/root/send/reqdata/dragdrop/status", "MINUS");
  302. model.makeValue("/root/send/reqdata/dragdrop/deptindxcd", model.getValue(treePath + "[deptindxcd='"+trv_deptindx.value+"']/deptindxcd"));
  303. model.makeValue("/root/send/reqdata/dragdrop/deptseqno", model.getValue(treePath + "[deptindxcd='"+srcValue+"']/deptseqno"));
  304. model.makeValue("/root/send/reqdata/dragdrop/predeptseqno", model.getValue(treePath + "[deptindxcd='"+trv_deptindx.value+"']/deptseqno"));
  305. model.makeValue("/root/send/reqdata/dragdrop/deptcd", model.getValue(xCondPath+"/srcheddeptcd"));
  306. model.makeValue("/root/send/reqdata/dragdrop/indxflag", model.getValue("/root/hidden/condition/indxflag"));
  307. }
  308. node.insertBefore(srcNode, targetNode);
  309. if(submit("TXMRT01302")){
  310. messageBox("색인변경이 ", "I001");
  311. }
  312. } else if(rtn == 6){
  313. messageBox("다른 Level로 색인변경을", "E001");
  314. }
  315. }
  316. fIndxClear();
  317. trv_deptindx.rebuild();
  318. }