SMMRB00201.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. var indexnum = 1; //버튼과 case안에 고유한 ID를 만들어주기 위한 변수
  2. var htmlWin = null;
  3. var s = null;
  4. //var browserSrc = "file:///C:\\CMCOracle\\application\\webapps\\emr\\emrbrowserweb\\xrw\\init.html";
  5. var browserSrc = getDomain() + "/himed/webapps/cmc/web/xrw/.live?submit_id=TRMRB00201&business_id=emr&macaddr=0025b361dcd6&localurl=" + getDomain().setReplaceWord("http://", "");
  6. function fInit(){
  7. plusbrowser();
  8. }
  9. function browserInit(){
  10. indexnum = 1
  11. deleteBrowserAll();
  12. plusbrowser();
  13. }
  14. //탭 title 세팅
  15. function setTitle(){
  16. var index = switch1.selectedIndex;
  17. var caseid = switch1.children.item(index).attribute("id");
  18. var title = ""
  19. if(parent.btn_tab_favorite.selected){ //즐겨찾기선택
  20. title = "즐겨찾기";
  21. }
  22. else{
  23. if(parent.switch1.selectedIndex == 0){
  24. title = parent.grd_midindx.valueMatrix(parent.grd_midindx.row, parent.grd_midindx.col);
  25. }else if(parent.switch1.selectedIndex == 1){
  26. title = parent.grd_chart_midindx.valueMatrix(parent.model.getValue("/root/init/chartrow"), parent.grd_chart_midindx.col);
  27. }else if(parent.switch1.selectedIndex == 2){
  28. title = "북마크";
  29. }
  30. else{
  31. title = parent.grd_datemidindx.valueMatrix(parent.grd_datemidindx.row, parent.grd_datemidindx.col);
  32. }
  33. }
  34. var o = eval("button" +caseid.substring(4));
  35. o.attribute("text") = title;
  36. o.ellipsis = true;
  37. o.hint = title;
  38. o.refresh();
  39. }
  40. //현제 선택돤 브라우져 return
  41. function getBrowser(){
  42. //현재 선택된 case
  43. var caseid = switch1.children.item(switch1.selectedIndex).attribute("id");
  44. var browser = eval("browser" + caseid.substring(4));
  45. //var browser = "browser" + caseid.substring(4);
  46. return browser;
  47. }
  48. function plusbrowser(){
  49. //페이지부분 안보이게 세팅
  50. //cap_page.visible = false;
  51. btn_nextpage.visible = false;
  52. var caseLength = switch1.children.length;
  53. if(caseLength >= 9){
  54. messageBox("더 이상 추가 할수 없습니다.", "E");
  55. return;
  56. }
  57. createCase = switch1.createChild("xforms:case", "id:case" + indexnum + ";left:0px; top:0px; width:898px; height:905px; ");
  58. model.refresh();
  59. createbrowser = createCase.createChild("xforms:browser", "id:browser" + indexnum + ";left:5px; top:50px; width:888px; height:850px; border-top-style:solid;border-left-style:solid;border-bottom-style:solid;border-right-style:solid; border-color:#c0c0c0;");
  60. model.refresh();
  61. createbrowser.src = browserSrc;
  62. model.refresh();
  63. var w = 105;
  64. if(caseLength == 0 ){
  65. w = 20;
  66. }
  67. else if(caseLength == 1 ){
  68. w = 105;
  69. }
  70. else if(caseLength == 2 ){
  71. w = 190;
  72. }
  73. else if(caseLength == 3 ){
  74. w = 276;
  75. }
  76. else if(caseLength == 4){
  77. w = 362;
  78. }
  79. else if(caseLength == 5){
  80. w = 448;
  81. }
  82. else if(caseLength == 6){
  83. w = 534;
  84. }
  85. else if(caseLength == 7){
  86. w = 620;
  87. }
  88. else if(caseLength == 8){
  89. w = 706;
  90. }
  91. btn = body.createChild("xforms:button", "id:button" + indexnum + ";left:"+ w + "px;top:31px;width:87px; height:22px; text:Browser" + indexnum);
  92. model.refresh();
  93. btn.attribute("class") = "btn_sw";
  94. btn.attribute("group") = "tab";
  95. //btn.attribute("selected") = "true";
  96. btn.attribute("onclick") = "btnClick('case" + indexnum + "')";
  97. //model.toggle("case" + indexnum);
  98. btn.dispatch("onclick");
  99. model.refresh();
  100. indexnum = indexnum + 1;
  101. }
  102. function btnClick(c){
  103. model.toggle(c);
  104. viewPageInfo();
  105. model.refresh();
  106. }
  107. function deletebrowser(){
  108. var caseLength = switch1.children.length;
  109. var index = switch1.selectedIndex;
  110. if(caseLength == 1){
  111. messageBox("마지막 1개는 삭제 할 수 없습니다.", "E");
  112. return;
  113. }
  114. //현재 선택된 case
  115. var caseid = switch1.children.item(index).attribute("id");
  116. var buttonid = "button" + caseid.substring(4);
  117. //이전case
  118. if(index != 0){
  119. var prevCaseid = switch1.children.item(index-1).attribute("id");
  120. var prevButtonid = "button" + prevCaseid.substring(4);
  121. }
  122. //다음case
  123. //var nextCaseindex = fGetNextIndex();
  124. if(caseLength != (index+1)){
  125. var nextCaseid = switch1.children.item(index+1).attribute("id");
  126. var nextButtonid = "button" + nextCaseid.substring(4);
  127. }
  128. switch1.removeChild(caseid);
  129. body.removeChild(buttonid);
  130. //버튼 재배치
  131. if(caseLength != (index+1)){ //마지막탭을 지운게 아니라면
  132. for(i = 0; i < switch1.children.length; i++){
  133. var obid = switch1.children.item(i).attribute("id");
  134. var btnid = "button" + obid.substring(4);
  135. if(i >= index){
  136. if(i == 0){
  137. w = 20;
  138. }
  139. else if(i == 1 ){
  140. w = 106;
  141. }
  142. else if(i == 2 ){
  143. w = 190;
  144. }
  145. else if(i == 3 ){
  146. w = 276;
  147. }
  148. else if(i == 4){
  149. w = 362;
  150. }
  151. else if(i == 5){
  152. w = 448;
  153. }
  154. else if(i == 6){
  155. w = 534;
  156. }
  157. else if(i == 7){
  158. w = 620;
  159. }
  160. else if(i == 8){
  161. w = 706;
  162. }
  163. eval(btnid).attribute("left") = w;
  164. }
  165. }
  166. }
  167. if(index == 0){
  168. eval(nextButtonid).dispatch("onclick");
  169. }
  170. else{
  171. eval(prevButtonid).dispatch("onclick");
  172. }
  173. model.removeNodeSet("/root/initpage/pageinfo["+(index+1)+"]");
  174. model.makeValue("/root/initpage/pageinfo/page", "0");
  175. model.makeValue("/root/initpage/pageinfo/totpage", "0");
  176. model.makeValue("/root/initpage/pageinfo/reckind", "");
  177. model.makeValue("/root/initpage/pageinfo/pageyn", "");
  178. model.makeValue("/root/initpage/pageinfo/viewyn", "");
  179. model.refresh();
  180. }
  181. function deleteBrowserAll(){
  182. body.removeChild("switch1");
  183. model.refresh();
  184. body.createChild("xforms:switch", "id:switch1;left:5px; top:0px; width:898px; height:905px; background-color:transparent;");
  185. model.refresh();
  186. /*
  187. var len = switch1.children.length;
  188. for(i = (len-1) ; i >= 0 ; i--){
  189. if(len == 0) break;
  190. var cas = switch1.children.item(i);
  191. if(cas){
  192. var caseid = cas.attribute("id");
  193. var browserid = "browser" + caseid.substring(4);
  194. var buttonid = "button" + caseid.substring(4);
  195. switch1.children.item(i).removeChild(browserid);
  196. switch1.removeChild(caseid);
  197. body.removeChild(buttonid);
  198. len--;
  199. }
  200. }
  201. */
  202. }
  203. /*
  204. function goUrl(url){
  205. if(getBrowser().document){
  206. //browser 컨트롤의 html을 구한다.
  207. htmlWin = getBrowser().document.parentWindow;
  208. htmlWin.domain = getDomain();
  209. //browser의 컨트롤의 document의 TFWin의 변수에 부모창(T/F)의 객체를 넣어준다
  210. htmlWin.TFWin = window;
  211. if(htmlWin.lockyn == "N"){
  212. getBrowser().document.parentWindow.goLocation(url);
  213. var index = switch1.selectedIndex;
  214. var caseid = switch1.children.item(index).attribute("id");
  215. var tt = ""
  216. if(parent.btn_tab_favorite.selected){ //즐겨찾기선택
  217. tt = "즐겨찾기";
  218. }
  219. else{
  220. if(parent.switch1.selectedIndex == 0){
  221. tt = parent.grd_midindx.valueMatrix(parent.grd_midindx.row, parent.grd_midindx.col);
  222. }else if(parent.switch1.selectedIndex == 1){
  223. tt = parent.grd_chart_midindx.valueMatrix(parent.model.getValue("/root/init/chartrow"), parent.grd_chart_midindx.col);
  224. }else if(parent.switch1.selectedIndex == 2){
  225. tt = "북마크";
  226. }
  227. else{
  228. tt = "";
  229. }
  230. }
  231. setTitle(tt, caseid.substring(4));
  232. }
  233. else{
  234. alert("로딩중 입니다.");
  235. }
  236. }
  237. else{
  238. alert("브라우져 초기회중입니다. 잠시 기다려 주십시요.");
  239. indexnum = 0;
  240. fInit();
  241. }
  242. }
  243. */
  244. function goUrl(node){
  245. htmlWin = null;
  246. //노드복사
  247. if(node != null){
  248. var destNode = instance1.selectSingleNode("/root/send");
  249. model.copyNode(destNode, node);
  250. }
  251. if(getBrowser().document != null){
  252. if(s != null) window.clearInterval(s);
  253. //browser 컨트롤의 html을 구한다.
  254. htmlWin = getBrowser().document.parentWindow;
  255. htmlWin.domain = getDomain();
  256. //browser의 컨트롤의 document의 TFWin의 변수에 부모창(T/F)의 객체를 넣어준다
  257. htmlWin.TFWin = window;
  258. if(htmlWin.lockyn == null || htmlWin.lockyn == ""){
  259. alert("브라우져 준비중입니다.");
  260. htmlWin.domain = getDomain();
  261. htmlWin.TFWin = window;
  262. //htmlWin.execScript("alert(lockyn)","JavaScript")
  263. }
  264. if(htmlWin.lockyn == "N"){
  265. var sIndex = switch1.selectedIndex;
  266. sIndex = sIndex + 1;
  267. setTitle();
  268. var url = fGetURL();
  269. htmlWin.setLocation(url, model.getValue("/root/send/pageindex"), model.getValue("/root/initpage/pageinfo["+sIndex+"]/viewyn"));
  270. }
  271. else{
  272. alert("로딩중 입니다.");
  273. }
  274. }
  275. else{
  276. //alert("브라우져 초기회중입니다. 잠시 기다려 주십시요.");
  277. if(s == null){
  278. if(browser1 != null){
  279. browser1.Navigate(browserSrc);
  280. }
  281. else{
  282. getBrowser().Navigate(browserSrc);
  283. }
  284. }
  285. s = window.setInterval("goUrl()", 1000);
  286. //indexnum = 0;
  287. //fInit();
  288. }
  289. }
  290. function fGetURL()
  291. {
  292. var submit_id = model.getValue("/root/send/submit_id");
  293. if(submit_id == null ||submit_id == "") submit_id = "TRMRB00202";
  294. var scrollMenuDispYN = model.getValue("/root/send/scrollMenuDispYN");
  295. if(scrollMenuDispYN == "") scrollMenuDispYN = "Y";
  296. var displayflag = model.getValue("/root/send/displayflag");
  297. if(displayflag == "") displayflag = "Y";
  298. var url = getDomain() + "/himed/webapps/cmc/web/xrw/.live";
  299. url += "?submit_id=" + submit_id;
  300. url += "&business_id=" + model.getValue("/root/send/business_id");
  301. url += "&macaddr=" + model.getValue("/root/send/macaddr");
  302. url += "&pid=" + model.getValue("/root/send/pid");
  303. url += "&orddd=" + model.getValue("/root/send/orddd");
  304. url += "&cretno=" + model.getValue("/root/send/cretno");
  305. url += "&ioflag=" + model.getValue("/root/send/ioflag");
  306. url += "&reckind=" + model.getValue("/root/send/reckind");
  307. url += "&linkcd=" + model.getValue("/root/send/linkcd");
  308. url += "&midindxseq=" + model.getValue("/root/send/midindxseq");
  309. url += "&bfopentest=" + model.getValue("/root/send/bfopentest");
  310. //url += "&pageindex=" + model.getValue("/root/send/pageindex");
  311. url += "&pagepercnt=" + model.getValue("/root/send/pagepercnt");
  312. url += "&localurl=" + getDomain().setReplaceWord("http://", "");
  313. url += "&signno=" + model.getValue("/root/send/signno");
  314. url += "&examflag=" + model.getValue("/root/send/examflag");
  315. url += "&pidynhcd=" + model.getValue("/root/init/hardcd/hardcd");
  316. url += "&treatno=" + model.getValue("/root/send/treatno");
  317. url += "&formcode=" + model.getValue("/root/send/formcode");
  318. url += "&scrollMenuDispYN=" + scrollMenuDispYN; //Y일때 스크롤메뉴 보임
  319. url += "&displayflag=" + displayflag; //Y일때 스크롤메뉴 보임
  320. url += "&funcflag=" + model.getValue("/root/send/funcflag");
  321. url += "&srchfromdd=" + model.getValue("/root/send/srchfromdd");
  322. url += "&srchtodd=" + model.getValue("/root/send/srchtodd");
  323. url += "&dataflag=" + model.getValue("/root/send/dataflag");
  324. url += "&orddeptcd=" + model.getValue("/root/send/orddeptcd");
  325. url += "&acptcnclyn=" + model.getValue("/root/send/acptcnclyn");
  326. //북마크 폴더 클릭
  327. url += "&itemno=" + model.getValue("/root/send/itemno");
  328. url += "&itemflag=" + model.getValue("/root/send/itemflag");
  329. url += "&dataflag=" + model.getValue("/root/send/dataflag");
  330. return url;
  331. }
  332. function fWritePage(page, totpage, reckind, pageyn){
  333. var sIndex = switch1.selectedIndex;
  334. sIndex = sIndex + 1;
  335. model.setValue("/root/initpage/pageinfo["+sIndex+"]/page", page);
  336. model.setValue("/root/initpage/pageinfo["+sIndex+"]/totpage", totpage);
  337. model.setValue("/root/initpage/pageinfo["+sIndex+"]/reckind", reckind);
  338. model.setValue("/root/initpage/pageinfo["+sIndex+"]/pageyn", pageyn);
  339. viewPageInfo();
  340. }
  341. function viewPageInfo(){
  342. var sIndex = switch1.selectedIndex;
  343. sIndex = sIndex + 1;
  344. var page = model.getValue("/root/initpage/pageinfo["+sIndex+"]/page");
  345. var totpage = model.getValue("/root/initpage/pageinfo["+sIndex+"]/totpage");
  346. var reckind = model.getValue("/root/initpage/pageinfo["+sIndex+"]/reckind");
  347. var pageyn = model.getValue("/root/initpage/pageinfo["+sIndex+"]/pageyn");
  348. var viewyn = model.getValue("/root/initpage/pageinfo["+sIndex+"]/viewyn");
  349. if(viewyn != "Y"){ //연속보기가 아닐때
  350. btn_nextpage.visible = true;
  351. cap_page.visible = true;
  352. chk_continue.deselect(0);
  353. if(page == null || page == "" || page == "null") page = "0";
  354. if(totpage == null || totpage == "" || totpage == "null") totpage = "0";
  355. var txt = page;
  356. if(totpage != "0") txt += "/" + totpage;
  357. if(page == "0" && totpage == "0"){
  358. cap_page.text = "";
  359. }
  360. else{
  361. cap_page.text = txt + " Page";
  362. }
  363. //다음페이지 버튼
  364. var npage = parseInt(page) + 1;
  365. if(reckind == "PRCP"){
  366. if(pageyn == "Y"){
  367. btn_nextpage.visible = true;
  368. btn_nextpage.attribute("DOMActivate") = "getBrowser().document.parentWindow.nPage("+npage+")";
  369. }
  370. else{
  371. btn_nextpage.visible = false;
  372. }
  373. }
  374. else{
  375. if(page == parseInt(totpage)){
  376. btn_nextpage.visible = false;
  377. }
  378. else{
  379. btn_nextpage.visible = true;
  380. btn_nextpage.attribute("DOMActivate") = "getBrowser().document.parentWindow.nPage("+npage+")";
  381. }
  382. }
  383. }
  384. else{
  385. chk_continue.select(0);
  386. }
  387. }
  388. /*
  389. 연속보기 클릭
  390. */
  391. function fContinueView(){
  392. var c = model.getValue("/root/init/continueview");
  393. var sIndex = switch1.selectedIndex;
  394. sIndex = sIndex + 1;
  395. if(c == "Y"){
  396. btn_nextpage.visible = false;
  397. cap_page.visible = false;
  398. model.setValue("/root/initpage/pageinfo["+sIndex+"]/viewyn", "Y");
  399. }
  400. else{
  401. model.setValue("/root/initpage/pageinfo["+sIndex+"]/viewyn", "");
  402. }
  403. }
  404. /*
  405. Print
  406. */
  407. function fPrintPreview(tmppid, hngnm, rrgstno){
  408. var instcd = getUserInfo("dutplceinstcd");
  409. var instnm = getUserInfo("dutplceinstnm"); //근무지 기관명
  410. var plcenm = getUserInfo("dutplcenm"); //근무지 부서명
  411. var usernm = getUserInfo("usernm"); //사용자 이름
  412. var pTime = getNewDate().getDateFormat("YYYY/MM/DD hh:mm:ss"); //출력시간
  413. if(htmlWin != null){
  414. htmlWin.Preview(instcd, instnm, tmppid, hngnm, rrgstno, pTime, usernm, plcenm);
  415. }
  416. }