SMMMD05300_MR색인관리.xrw 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960
  1. <?xml version="1.0" encoding="EUC-KR"?>
  2. <?xml-stylesheet type="text/css" href="../../../com/commonweb/css/common.css" ?>
  3. <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2002/01/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
  4. <xhtml:head>
  5. <xhtml:title>Medical Reference 색인관리</xhtml:title>
  6. <model id="model1">
  7. <instance id="instance1">
  8. <root xmlns="">
  9. <main>
  10. <formdata>
  11. <item>
  12. <status/>
  13. <indxno/>
  14. <indxnm/>
  15. <supindxno/>
  16. <indxrefseq/>
  17. <depth/>
  18. <indxhistseq/>
  19. <image/>
  20. <orddeptcd/>
  21. </item>
  22. <cpinfo>
  23. <appdd/>
  24. <cpgno/>
  25. <cpghistseq/>
  26. </cpinfo>
  27. </formdata>
  28. <indxlist>
  29. <itemlist>
  30. <item>
  31. <status/>
  32. <indxno/>
  33. <indxnm/>
  34. <supindxno/>
  35. <indxrefseq/>
  36. <depth/>
  37. <indxhistseq/>
  38. <image/>
  39. <orddeptcd/>
  40. </item>
  41. </itemlist>
  42. <popupmenu>
  43. <tree>
  44. <supmenu>
  45. <name>새폴더</name>
  46. <func>fFolderAdd</func>
  47. </supmenu>
  48. <supmenu>
  49. <name>이름바꾸기</name>
  50. <func>fFolderSet</func>
  51. </supmenu>
  52. <supmenu>
  53. <name>삭제</name>
  54. <func>fFolderDel</func>
  55. </supmenu>
  56. <supmenu>
  57. <name>-</name>
  58. <func/>
  59. </supmenu>
  60. <supmenu>
  61. <name>폴더순서변경</name>
  62. <func>fFolderOrderSet</func>
  63. </supmenu>
  64. <supmenu>
  65. <name>색인 추가</name>
  66. <func>fIndxAdd</func>
  67. </supmenu>
  68. <submenu>
  69. <name>새폴더</name>
  70. <func>fFolderAdd</func>
  71. </submenu>
  72. <submenu>
  73. <name>이름바꾸기</name>
  74. <func>fFolderSet</func>
  75. </submenu>
  76. <submenu>
  77. <name>삭제</name>
  78. <func>fFolderDel</func>
  79. </submenu>
  80. <submenu>
  81. <name>-</name>
  82. <func/>
  83. </submenu>
  84. <submenu>
  85. <name>폴더순서변경</name>
  86. <func>fFolderOrderSet</func>
  87. </submenu>
  88. <submenu>
  89. <name>색인 추가</name>
  90. <func>fIndxAdd</func>
  91. </submenu>
  92. <indxmenu>
  93. <name>파일다운로드</name>
  94. <func>fFileDown</func>
  95. </indxmenu>
  96. <indxmenu>
  97. <name>-</name>
  98. <func/>
  99. </indxmenu>
  100. <indxmenu>
  101. <name>삭제</name>
  102. <!--func>fIndxDel</func-->
  103. <func>fFolderDel</func>
  104. </indxmenu>
  105. </tree>
  106. </popupmenu>
  107. </indxlist>
  108. <indexinfo>
  109. <item/>
  110. </indexinfo>
  111. <srcindxinfo>
  112. <itemlist/>
  113. </srcindxinfo>
  114. <attfileinfo/>
  115. <drugdeptlist/>
  116. </main>
  117. <hidden>
  118. </hidden>
  119. <send>
  120. </send>
  121. <init>
  122. </init>
  123. <temp>
  124. <copysset>
  125. <copy>
  126. <item/>
  127. </copy>
  128. </copysset>
  129. <supindx>
  130. <supindxno/>
  131. </supindx>
  132. <reqdata>
  133. <selectIndxCd/>
  134. <selectIndxNm/>
  135. </reqdata>
  136. <selecedkind>
  137. <kind/>
  138. <newfolder/>
  139. </selecedkind>
  140. <savedfolder>
  141. <item>
  142. <indxno/>
  143. <indxhistseq/>
  144. <supindxno/>
  145. <indxrefseq/>
  146. <indxnm/>
  147. </item>
  148. </savedfolder>
  149. <openeruid/>
  150. </temp>
  151. </root>
  152. </instance>
  153. <script type="javascript" ev:event="xforms-ready">
  154. <![CDATA[
  155. // 각 기관별 약제팀 조회
  156. submit("TRMMD05201");
  157. fInitialize() ;
  158. ]]>
  159. </script>
  160. <submission id="TRMMD05001" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send/reqdata" resultref="/root/main/srcindxinfo/itemlist"/>
  161. <submission id="TXMMD05001" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send/reqdata" resultref="/root/temp/savedfolder"/>
  162. <!--submission id="TXMMD05002" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/main/attfileinfo" resultref="/root/main/attfileinfo"/-->
  163. <submission id="TXMMD05002" mediatype="multipart/form-data" method="form-data-post" ref="/root/main/attfileinfo" resultref="/root/temp/savedfolder"/>
  164. <submission id="TXMQP00601" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send" resultref="/root/temp/masterinfo"/>
  165. <submission id="TRMMD05201" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send/reqdata" resultref="/root/main/drugdeptlist"/>
  166. </model>
  167. <script type="javascript" src="../../../com/commonweb/js/common.js"/>
  168. <script type="javascript" src="../../../com/commonweb/js/tfHelper.js"/>
  169. <script type="javascript" src="../../../com/commonweb/js/utilHelper.js"/>
  170. <script type="javascript" src="../../../com/commonweb/js/dateHelper.js"/>
  171. <script type="javascript">
  172. <![CDATA[
  173. var folerImg = "../../../com/commonweb/images/icon_folder_close.gif";
  174. var fileImg = "../../../com/commonweb/images/icon_list.gif";
  175. var selectIndxCd = model.getValue("/root/temp/reqdata/selectIndxCd");
  176. var flagcd = "";
  177. var itemRef = "/root/main/indxlist/itemlist/item";
  178. var iFocusIndx;
  179. var preItem;
  180. var preindx;
  181. var sIndxNo = "";
  182. var tIndxNo = "";
  183. var appCpYN = "N";
  184. //초기화 및 색인을 조회한다.
  185. function fInitialize() {
  186. opener.browser1.Navigate("about:blank");
  187. fGetIndxList("A");
  188. }
  189. //색인을 조회한다.
  190. function fGetIndxList(flag) {
  191. var indxnmSch = opener.model.getValue("/root/main/search_cond/indxnm"); // 조회할 색인명
  192. var orddeptcd = opener.model.getValue("/root/main/search_cond/orddeptcd"); // 조회할 부서코드
  193. // 전체 조회할수 없다. 부서코드 없으면 실행 중단
  194. if ( orddeptcd == "" ) return;
  195. model.removeNodeset("/root/send/reqdata");
  196. model.makeNode("/root/send/reqdata");
  197. model.resetInstanceNode("/root/main/indxlist/itemlist");
  198. model.copyNode("/root/send/reqdata", "/root/temp/reqdata");
  199. model.makeValue("/root/send/reqdata/mode", "A" ); //all index list
  200. model.makeValue("/root/send/reqdata/indxnm", indxnmSch ); //all index list
  201. model.makeValue("/root/send/reqdata/orddeptcd", orddeptcd ); //all index list
  202. //model.makeValue("/root/send/reqdata/selectIndxCd", 0 ); //최상위색인번호
  203. if( submit("TRMMD05001") ){
  204. // 조회 결과를 /root/main/indxlist/itemlist 로 복사
  205. model.copyNode("/root/main/indxlist/itemlist", "/root/main/srcindxinfo/itemlist");
  206. treeview1.rebuild();
  207. fImageMapping();
  208. }
  209. }
  210. //아이템에 이미지를 매핑시킨다.
  211. function fImageMapping() {
  212. var indxCnt = treeview1.length;
  213. for(var i = 1; i <= indxCnt; i++){
  214. //말단 아이템이 아니라면 폴더 이미지를 설정한다.
  215. if( model.getValue(itemRef + "[" + i + "]/fileno") == 0 ){
  216. model.setValue(itemRef + "[" + i + "]/image", folerImg);
  217. }else {
  218. model.setValue(itemRef + "[" + i + "]/image", fileImg);
  219. }
  220. }
  221. treeview1.rebuild();
  222. }
  223. //폴더를 추가하는 메뉴그룹을 연다. ( '확인' 이벤트를 실행하면 DB에 저장한다.)
  224. function fFolderAdd() {
  225. // 진료부서 권한 체크 로직
  226. if ( !fchkFolderAuth("new") ) return;
  227. if(parseInt(event.clientY) > 590 ){
  228. group2.attribute("top") = "590px";
  229. } else{
  230. group2.attribute("top") = event.clientY;
  231. }
  232. group2.attribute("left") = 100;
  233. group2.attribute("height") = 55;
  234. //추가되는 색인의 조회순서는 Default로 선택한 아이템의 가장 마지막 차일드 아이템 조회순서(indxrefseq) + 1 이다.
  235. var prtIndx = iFocusIndx;
  236. var treeItemNodeSet = treeview1.itemset.attribute("nodeset");
  237. var srcLastChildItemIndex = getLastChildItemIndex( prtIndx , treeItemNodeSet );
  238. var lastNodeSeq = model.getValue(itemRef + "[" + (srcLastChildItemIndex+1) + "]/indxrefseq");
  239. model.setValue("/root/main/formdata/item/indxrefseq", (parseInt(lastNodeSeq) + 1) ); //마지막 노드의 조회순서+1
  240. model.setValue("/root/main/formdata/item/supindxno", model.getValue(itemRef + "[" + (prtIndx + 1) + "]/indxno"));
  241. model.setValue("/root/main/formdata/item/indxnm", "");
  242. model.setValue("/root/main/formdata/item/image", folerImg);
  243. //iFocusIndx = prtIndx; //전역변수 iFocusIndx에 포커스인덱스를 넣는다.
  244. cap_menu.attribute("text") = "폴더명";
  245. btn_ok.attribute("visibility") = "visible";
  246. btn_modify.attribute("visibility") = "hidden";
  247. btn_find.attribute("visibility") = "hidden";
  248. input2.attribute("visibility") = "hidden";
  249. inpt_srch.refresh();
  250. inpt_srch.disabled = false;
  251. model.setFocus("inpt_srch");
  252. model.setValue("/root/temp/selecedkind/kind", "F");
  253. }
  254. //색인 추가하는 메뉴그룹을 연다.
  255. function fIndxAdd() {
  256. if ( !fchkFolderAuth("indxnew") ) return;
  257. if(parseInt(event.clientY) > 590 ){
  258. group2.attribute("top") = "590px";
  259. } else{
  260. group2.attribute("top") = event.clientY;
  261. }
  262. group2.attribute("left") = 100;
  263. group2.attribute("height") = 55;
  264. model.removeNodeset("/root/main/attfileinfo/attach/file");
  265. //추가되는 색인의 조회순서는 Default로 선택한 아이템의 가장 마지막 차일드 아이템 조회순서(indxrefseq) + 1 이다.
  266. var prtIndx = iFocusIndx;
  267. var treeItemNodeSet = treeview1.itemset.attribute("nodeset");
  268. var srcLastChildItemIndex = getLastChildItemIndex( prtIndx , treeItemNodeSet );
  269. var lastNodeSeq = model.getValue(itemRef + "[" + (srcLastChildItemIndex+1) + "]/indxrefseq");
  270. model.setValue("/root/main/formdata/item/indxrefseq", (parseInt(lastNodeSeq) + 1) ); //마지막 노드의 조회순서+1
  271. model.setValue("/root/main/formdata/item/supindxno", model.getValue(itemRef + "[" + (prtIndx + 1) + "]/indxno"));
  272. model.setValue("/root/main/formdata/item/indxnm", "");
  273. //model.setValue("/root/main/formdata/item/cpgflagcd", model.getValue("/root/temp/reqdata/cpgflagcd"));
  274. model.setValue("/root/main/formdata/item/image", fileImg);
  275. //cpg 검색 그리드에서 cpg를 선택했다면, 그 cpgno를 셋팅
  276. /*
  277. if(opener.model.getValue("/root/main/search_cond/no") != ""){
  278. model.setValue("/root/temp/reqdata/cpgno", opener.model.getValue("/root/temp/selected/cpgno"));
  279. model.setValue("/root/main/formdata/item/cpghistseq", opener.window.javascript.fModifyCpgHistSeq(opener.model.getValue("/root/temp/selected/cpghistseq"))); //임시->9999
  280. model.setValue("/root/main/formdata/item/indxnm", opener.model.getValue("/root/temp/selected/cpgnm"));
  281. model.setValue("/root/main/formdata/cpinfo/cpgno", model.getValue("/root/temp/reqdata/cpgno"));
  282. model.setValue("/root/main/formdata/cpinfo/cpghistseq", model.getValue("/root/main/formdata/item/cpghistseq"));
  283. }
  284. */
  285. //if( !isNull(model.getValue("/root/temp/reqdata/cpgno")) ){
  286. //model.setValue("/root/main/formdata/item/cpgno", model.getValue("/root/temp/reqdata/cpgno"));
  287. cap_menu.attribute("text") = "색인명";
  288. btn_ok.attribute("visibility") = "visible";
  289. btn_modify.attribute("visibility") = "hidden";
  290. btn_find.attribute("visibility") = "visible";
  291. inpt_srch.refresh();
  292. inpt_srch.disabled = false;
  293. model.setValue("/root/temp/selecedkind/kind", "i");
  294. /*}else{
  295. messageBox("CP를 ", "C002");
  296. group2.attribute("height") = 0;
  297. return;
  298. }
  299. */
  300. }
  301. //폴더를 수정하는 동시에, DB에 저장한다.
  302. function fFolderSet(){
  303. // 폴더 수정권한 체크
  304. if ( !fchkFolderAuth("set") ) return;
  305. if( model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/supindxno") == "0" ){
  306. messageBox("최상위 폴더명은 수정", "E001");
  307. return;
  308. }
  309. if(parseInt(event.clientY) > 590 ){
  310. group2.attribute("top") = "590px";
  311. } else{
  312. group2.attribute("top") = event.clientY;
  313. }
  314. group2.attribute("left") = 100;
  315. group2.attribute("height") = 55;
  316. model.setValue("/root/main/formdata/item/indxnm", model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/indxnm"));
  317. model.setValue("/root/main/formdata/item/indxno", model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/indxno"));
  318. model.setValue("/root/main/formdata/item/indxhistseq", model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/indxhistseq"));
  319. model.setValue("/root/main/formdata/item/indxrefseq", model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/indxrefseq"));
  320. inpt_srch.refresh();
  321. cap_menu.attribute("text") = "폴더명";
  322. btn_ok.attribute("visibility") = "hidden";
  323. btn_modify.attribute("visibility") = "visible";
  324. btn_find.attribute("visibility") = "hidden";
  325. inpt_srch.disabled = false;
  326. model.setFocus("inpt_srch");
  327. model.setValue("/root/temp/selecedkind/kind", "F");
  328. }
  329. //색인을 수정한다.
  330. function fIndxSet(){
  331. /*
  332. //COPY SET을 뒤져서 해당 노드가 있다면 COPY SET 인스턴스 데이터 바로 수정, 없다면 Y일때는 'U'라는 플래그로 등록, 'N'이라면 트리에서만 수정
  333. //상태가 'I / U' 이면 COPY SET의 해당 인스턴스 데이터를 수정, 상태가 ' Y'이면 'U'라는 status로 COPY 셋에 등록
  334. if(parseInt(event.clientY) > 590 ){
  335. group2.attribute("top") = "590px";
  336. } else{
  337. group2.attribute("top") = event.clientY;
  338. }
  339. group2.attribute("left") = 100;
  340. group2.attribute("height") = 55;
  341. model.setValue("/root/main/formdata/item/indxnm", model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/indxnm"));
  342. inpt_srch.refresh();
  343. cap_menu.attribute("text") = "색인명";
  344. btn_ok.attribute("visibility") = "hidden";
  345. btn_modify.attribute("visibility") = "visible";
  346. inpt_srch.disabled = false;
  347. model.setFocus("inpt_srch");
  348. model.setValue("/root/temp/selecedkind/kind", "i");
  349. */
  350. }
  351. //현재 아이템 인덱스의 자식 아이템중 마지막 아이템 인덱스를 반환 한다
  352. function getLastChildItemIndex(itemIndex, treeItemNodeSet) {
  353. var curDepthValue = model.getValue(treeItemNodeSet + "[" + (itemIndex + 1) + "]/depth");
  354. var childDepthValue = model.getValue(treeItemNodeSet + "[" + (itemIndex + 2) + "]/depth");
  355. while(curDepthValue < childDepthValue) {
  356. itemIndex++;
  357. childDepthValue = model.getValue(treeItemNodeSet + "[" + (itemIndex + 2) + "]/depth");
  358. }
  359. return itemIndex;
  360. }
  361. //폴더 색인을 추가/수정/삭제한 경우 바로 저장한다
  362. function fSaveFolderIndx( indx, status ){
  363. model.removeNodeset("/root/send");
  364. model.resetInstanceNode("/root/temp/savedfolder/item");
  365. model.makeNode("/root/send/reqdata");
  366. model.copyNode("/root/send/reqdata", itemRef + "[" + parseInt(indx) +"]");
  367. model.makeValue("/root/send/reqdata/status", status );
  368. model.makeValue("/root/send/reqdata/filenm", model.getValue(itemRef + "[" + (iFocusIndx+1) + "]/filenm") );
  369. //model.makeValue("/root/send/reqdata/indxhistseq", model.getValue(itemRef + "[" + (iFocusIndx+1) + "]/indxhistseq") );
  370. model.makeValue("/root/send/reqdata/indxrefseq", model.getValue(itemRef + "[" + (iFocusIndx+1) + "]/indxrefseq") );
  371. // 차후 결정후 수정될 사항 (권한에 따른 처리를 할지 아직 미결정)
  372. model.makeValue("/root/send/reqdata/indxtypecd", "D" ); // 인텍스 타입 - 의사, 부서 등등 구분(미결정사항)
  373. model.makeValue("/root/send/reqdata/drid", getUserInfo("userid")); // 타입 구분에 따른 ID - 의사, 부서 등등 구분(미결정사항)
  374. model.makeValue("/root/send/reqdata/kind", model.getValue("/root/temp/selecedkind/kind"));
  375. if(model.getValue("/root/main/attfileinfo/attach/file") == "" && status == "i" && model.getValue("/root/send/reqdata/kind") != "F" ){
  376. messageBox("첨부할 파일을 선택하지", "E007");
  377. return;
  378. }
  379. if( submit("TXMMD05001", false) ){
  380. if(status == "i" && model.getValue("/root/send/reqdata/kind") != "F" ){
  381. if( submit("TXMMD05002", false) ){
  382. return true;
  383. } else {
  384. return false;
  385. }
  386. }
  387. } else {
  388. return false;
  389. }
  390. model.setValue(itemRef + "[" + parseInt(indx) +"]/indxno", model.getValue("/root/temp/savedfolder/item/indxno"));
  391. if( status == "u" || status == "i" ){
  392. model.setValue(itemRef + "[" + parseInt(indx) +"]/status", "");
  393. }
  394. }
  395. //폴더를 삭제한다.
  396. function fFolderDel() {
  397. var fileno = model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/fileno");
  398. var msg = "";
  399. if ( fileno == "0" ) {
  400. // 폴더삭제 권한을 체크
  401. if ( !fchkFolderAuth("del") ) return;
  402. msg = "선택하신 폴더를";
  403. } else {
  404. // 색인삭제 권한을 체크
  405. if ( !fchkFolderAuth("indxdel") ) return;
  406. msg = "선택하신 색인을";
  407. }
  408. // 삭제 확인
  409. var msgRtn = messageBox(msg, "Q001");
  410. if ( msgRtn != "6" ) return; // 삭제승인 버튼을 클릭하지않으면 중단한다.
  411. var focusIndex = iFocusIndx;
  412. var iRow = parseInt(focusIndex) + 1; //선택한 인스턴스의 인덱스
  413. //바로 데이터를 삭제하는 서브밋을 실행한다.
  414. fSaveFolderIndx( iRow , "d" );
  415. //화면에서 직접삭제
  416. var treeItemNodeSet = treeview1.itemset.attribute("nodeset");
  417. var srcLastChildItemIndex = getLastChildItemIndex( focusIndex , treeItemNodeSet );
  418. for(var i=focusIndex; i<= srcLastChildItemIndex ; i++){
  419. model.removenode(itemRef + "[" + iRow + "]");
  420. }
  421. var falg = opener.model.getValue("/root/main/search_cond/cpgflagcd");
  422. fGetIndxList(falg);
  423. treeview1.select(iRow-2);
  424. treeview1.expand(iRow-2, false);
  425. treeview1.rebuild();
  426. }
  427. function getParentItemIndex(itemIndex, treeItemNodeSet) {
  428. var curDepthValue = model.getValue(treeItemNodeSet + "[" + (itemIndex + 1) + "]/depth");
  429. var parentDepthValue = curDepthValue - 1;
  430. do {
  431. itemIndex--;
  432. curDepthValue = model.getValue(treeItemNodeSet + "[" + (itemIndex + 1) + "]/depth");
  433. } while(curDepthValue != parentDepthValue)
  434. return itemIndex;
  435. }
  436. function fFileDown(){
  437. model.makeNode("/root/temp/attachfile/filedata");
  438. var filepath = model.getValue("/root/main/srcindxinfo/itemlist/item"+"[" + (iFocusIndx+1) + "]/filepath");
  439. var filenm = model.getValue("/root/main/srcindxinfo/itemlist/item"+"[" + (iFocusIndx+1) + "]/filenm");
  440. var localfile = window.fileDialog("save","|",false,filenm,"","All Files(*.*)|*.*");
  441. if (localfile != "") {
  442. model.download(getActionURL("TRMMD05003")+"&filepath="+filepath,localfile, false);
  443. var rtn = messageBox("파일을", "Q004");
  444. if( rtn == 6 ) {
  445. window.exec(localfile);
  446. }
  447. }
  448. }
  449. function fNewFolder() {
  450. var indx = treeview1.focusIndex;
  451. var row = treeview1.mouseRow;
  452. if(indx == -1 && indx != row ){
  453. treeview1.select(row);
  454. indx = row;
  455. }
  456. iFocusIndx = indx;
  457. // 파일을 선택시 폴더를 선택하라고 alert 처리
  458. var fileno = model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/fileno");
  459. if ( fileno > 0 ) {
  460. messageBox("색인에는 폴더를 생성할 수", "I004");
  461. return;
  462. }
  463. // 해당부서 찾기(소속 부서코드가 없을 경우 일반부서 사용자는 폴더를 생성할 수 없다)
  464. if ( !fchkFolderAuth("new") ) return;
  465. group2.attribute("top") = "10px";
  466. group2.attribute("left") = 100;
  467. group2.attribute("height") = 55;
  468. var prtIndx = iFocusIndx;
  469. model.setValue("/root/main/formdata/item/supindxno", model.getValue(itemRef + "[" + (prtIndx + 1) + "]/indxno"));
  470. //iFocusIndx = prtIndx; //전역변수 iFocusIndx에 포커스인덱스를 넣는다.
  471. cap_menu.attribute("text") = "폴더명";
  472. btn_ok.attribute("visibility") = "visible";
  473. btn_modify.attribute("visibility") = "hidden";
  474. btn_find.attribute("visibility") = "hidden";
  475. model.setValue("/root/main/formdata/item/indxnm", "");
  476. inpt_srch.refresh();
  477. inpt_srch.disabled = false;
  478. model.setFocus("inpt_srch");
  479. model.setValue("/root/temp/selecedkind/kind", "F");
  480. model.setValue("/root/temp/selecedkind/newfolder", "Y");
  481. }
  482. // 확인버튼(색인추가) 클릭
  483. function fConfirm(){
  484. var iRow = iFocusIndx;
  485. var roc;
  486. var treeItemNodeSet = treeview1.itemset.attribute("nodeset");
  487. model.setValue("/root/main/formdata/item/status", "i");
  488. model.setValue("/root/main/formdata/item/orddeptcd", getUserInfo("dutplcecd"));
  489. if(model.getValue("/root/temp/selecedkind/newfolder") == "Y"){ // 새폴더
  490. roc = 1;// treeview1.length;
  491. if(treeview1.length == 0 ){ // 최초 신규일때
  492. model.makeValue("/root/main/indxlist/itemlist/item/indxno", "1");
  493. }
  494. } else {
  495. var srcLastChildItemIndex = getLastChildItemIndex( iFocusIndx , treeItemNodeSet );
  496. roc = parseInt(srcLastChildItemIndex) + 1;
  497. }
  498. //새로운 아이템을 추가한다
  499. var pDesNode = instance1.selectSingleNode("/root/main/indxlist/itemlist");
  500. var desNode = instance1.selectSingleNode(itemRef + "[" + parseInt(roc) +"]");
  501. var srcNode = instance1.selectSingleNode("/root/main/formdata/item");
  502. var cSrcNode = srcNode.cloneNode(true);
  503. pDesNode.insertAfter(cSrcNode, desNode);
  504. group2.attribute("height") = 0;
  505. //treeview1.rebuild();
  506. //treeview1.expand(roc, true);
  507. fSaveFolderIndx( parseInt(roc)+1, "i" );
  508. var falg = opener.model.getValue("/root/main/search_cond/cpgflagcd");
  509. fGetIndxList(falg);
  510. treeview1.select( parseInt(roc));
  511. treeview1.expand(parseInt(roc), false);
  512. treeview1.rebuild();
  513. }
  514. function fSetFolderName(){
  515. var iRow = parseInt(iFocusIndx) + 1; //선택한 인스턴스의 인덱스
  516. model.setValue(itemRef + "[" + iRow + "]/indxnm", model.getValue("/root/main/formdata/item/indxnm"));
  517. model.setValue(itemRef + "[" + iRow + "]/indxrefseq", model.getValue("/root/main/formdata/item/indxrefseq"));
  518. input2.attribute("visibility") = "hidden";
  519. inpt_srch.attribute("visibility") = "visible";
  520. group2.attribute("height") = 0;
  521. treeview1.rebuild();
  522. fSaveFolderIndx( parseInt(iRow), "u" );
  523. fGetIndxList("A");
  524. treeview1.rebuild();
  525. }
  526. function fchkFolderAuth(mode) {
  527. // 폴더아래로 신규폴더 생성시 폴더의 부서코드와 사용자 세션 부서 코드가 일치 해야 한다.
  528. var orddeptcd = model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/orddeptcd");
  529. var depth = model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/depth");
  530. var deptnm = "";
  531. var msg = "";
  532. var indxnm = "";
  533. var duplcecd = getUserInfo("dutplcecd");
  534. // 약제팀 부서 코드에 해당되는지 조사
  535. var drugdeptYn = "N";
  536. var drugdeptcd = "";
  537. var deptcnt = grd_drugdept.rows;
  538. for ( var i = 1 ; i<deptcnt ; i++ ) {
  539. drugdeptcd = model.getValue("/root/main/drugdeptlist/drugdept[" + i + "]/deptcd");
  540. if ( drugdeptcd == duplcecd ) {
  541. drugdeptYn = "Y";
  542. break;
  543. }
  544. }
  545. if ( drugdeptYn == "N" ) { // 일반 부서인 경우 권한 체크 로직
  546. if ( orddeptcd != duplcecd ) {
  547. var deptCnt = opener.cmb_orddept.length;
  548. for ( var i=1 ; i<deptCnt+1 ; i++ ) {
  549. if ( orddeptcd == opener.model.getValue("/root/init/orddept/dept[" + i + "]/deptcd") ) {
  550. if ( orddeptcd == "DRUGDEPT" ) {
  551. deptnm = "약제 공통";
  552. }
  553. else {
  554. deptnm = opener.model.getValue("/root/init/orddept/dept[" + i + "]/depthngnm");
  555. }
  556. break;
  557. }
  558. }
  559. if ( deptnm == "" ) {
  560. for ( var i = 1 ; i<deptcnt ; i++ ) {
  561. drugdeptcd = model.getValue("/root/main/drugdeptlist/drugdept[" + i + "]/deptcd");
  562. if ( drugdeptcd == orddeptcd || orddeptcd == "DRUGDEPT" ) {
  563. deptnm = "약제 공통";
  564. break;
  565. }
  566. }
  567. }
  568. indxnm = model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/indxnm");
  569. if ( mode == "new" ) {
  570. msg = indxnm + " 폴더는 [" + deptnm + "] 부서의 폴더입니다. 폴더 생성";
  571. }else if ( mode == "set" ) {
  572. msg = indxnm + " 폴더는 [" + deptnm + "] 부서의 폴더입니다. 폴더 수정";
  573. }else if ( mode == "del" ) {
  574. msg = indxnm + " 폴더는 [" + deptnm + "] 부서의 폴더입니다. 폴더 삭제";
  575. }else if ( mode == "del" ) {
  576. msg = indxnm + " 폴더는 [" + deptnm + "] 부서의 폴더입니다. 폴더 삭제";
  577. }else if ( mode == "indxdel" ) {
  578. msg = indxnm + " 색인은 [" + deptnm + "] 부서의 색인입니다. 색인 삭제";
  579. }else if ( mode == "indxnew" ) {
  580. msg = indxnm + " 폴더는 [" + deptnm + "] 부서의 폴더입니다. 색인 추가";
  581. }else if ( mode == "folderorder" ) {
  582. msg = indxnm + " 폴더는 [" + deptnm + "] 부서의 폴더입니다. 폴더순서정렬";
  583. }
  584. messageBox(msg, "E002");
  585. return false;
  586. }
  587. }
  588. else { // 소속부서가 약제팀 부서에 해당하는 경우
  589. drugdeptYn = "N";
  590. orddeptcd = model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/orddeptcd");
  591. for ( var i = 1 ; i<deptcnt ; i++ ) {
  592. drugdeptcd = model.getValue("/root/main/drugdeptlist/drugdept[" + i + "]/deptcd");
  593. if ( drugdeptcd == orddeptcd || orddeptcd == "DRUGDEPT" ) {
  594. drugdeptYn = "Y";
  595. break;
  596. }
  597. }
  598. //if ( orddeptcd == "DRUGDEPT" ) drugdeptYn = "Y";
  599. if ( drugdeptYn == "N" ) { // 선택한 폴더가 약제팀 폴더가 아닌 경우
  600. var deptCnt = opener.cmb_orddept.length;
  601. for ( var i=1 ; i<deptCnt+1 ; i++ ) {
  602. if ( orddeptcd == opener.model.getValue("/root/init/orddept/dept[" + i + "]/deptcd") ) {
  603. if ( orddeptcd == "DRUGDEPT" ) {
  604. deptnm = "약제 공통";
  605. }
  606. else {
  607. deptnm = opener.model.getValue("/root/init/orddept/dept[" + i + "]/depthngnm");
  608. }
  609. break;
  610. }
  611. }
  612. indxnm = model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/indxnm");
  613. if ( mode == "new" ) {
  614. msg = indxnm + " 폴더는 [" + deptnm + "] 부서의 폴더입니다. 폴더 생성";
  615. }else if ( mode == "set" ) {
  616. msg = indxnm + " 폴더는 [" + deptnm + "] 부서의 폴더입니다. 폴더 수정";
  617. }else if ( mode == "del" ) {
  618. msg = indxnm + " 폴더는 [" + deptnm + "] 부서의 폴더입니다. 폴더 삭제";
  619. }else if ( mode == "del" ) {
  620. msg = indxnm + " 폴더는 [" + deptnm + "] 부서의 폴더입니다. 폴더 삭제";
  621. }else if ( mode == "indxdel" ) {
  622. msg = indxnm + " 색인은 [" + deptnm + "] 부서의 색인입니다. 색인 삭제";
  623. }else if ( mode == "indxnew" ) {
  624. msg = indxnm + " 폴더는 [" + deptnm + "] 부서의 폴더입니다. 색인 추가";
  625. }else if ( mode == "folderorder" ) {
  626. msg = indxnm + " 폴더는 [" + deptnm + "] 부서의 폴더입니다. 폴더순서정렬";
  627. }
  628. messageBox(msg, "E002");
  629. return false;
  630. }
  631. }
  632. return true;
  633. }
  634. //폴더의 정렬순서를 수정하는 동시에, DB에 저장한다.
  635. function fFolderOrderSet() {
  636. if ( !fchkFolderAuth("folderorder") ) return;
  637. var param = "";
  638. param += "A" + "▦"; // 폴더, 색인 모두 조회
  639. param += opener.model.getValue("/root/main/search_cond/orddeptcd") + "▦";
  640. param += iFocusIndx + "▦";
  641. setParameter("SPMMD08300_param", param);
  642. modal("SPMMD08300");
  643. var rtnindx = getParameter("SPMMD08300_rtnparam");
  644. fGetIndxList("A");
  645. //fReqSetTreeView(setkindcd, setclscd, settypecd, procflag, deptcd, deptnm);
  646. if(rtnindx != ""){
  647. treeview1.select(rtnindx);
  648. treeview1.expand(rtnindx, false);
  649. }
  650. treeview1.rebuild();
  651. }
  652. // 정렬순서를 직접입력해서 수정하는 구버전 스크립트 함수
  653. function fFolderOrderSet_Old(){
  654. // 폴더 수정권한 체크
  655. if ( !fchkFolderAuth("set") ) return;
  656. if( model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/supindxno") == "0" ){
  657. messageBox("최상위 폴더명은 수정", "E001");
  658. return;
  659. }
  660. if(parseInt(event.clientY) > 590 ){
  661. group2.attribute("top") = "590px";
  662. } else{
  663. group2.attribute("top") = event.clientY - 50;
  664. }
  665. group2.attribute("left") = 100;
  666. group2.attribute("height") = 55;
  667. model.setValue("/root/main/formdata/item/indxnm", model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/indxnm"));
  668. model.setValue("/root/main/formdata/item/indxno", model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/indxno"));
  669. model.setValue("/root/main/formdata/item/indxhistseq", model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/indxhistseq"));
  670. model.setValue("/root/main/formdata/item/indxrefseq", model.getValue(itemRef + "[" + (iFocusIndx + 1) + "]/indxrefseq"));
  671. input2.refresh();
  672. input2.attribute("visibility") = "visible";
  673. cap_menu.attribute("text") = "폴더순서";
  674. cap_menu.attribute("width") = "60px";
  675. btn_ok.attribute("visibility") = "hidden";
  676. btn_modify.attribute("visibility") = "visible";
  677. btn_find.attribute("visibility") = "hidden";
  678. inpt_srch.attribute("visibility") = "hidden";
  679. input2.disabled = false;
  680. model.setFocus("input2");
  681. model.setValue("/root/temp/selecedkind/kind", "F");
  682. }
  683. ]]>
  684. </script>
  685. </xhtml:head>
  686. <xhtml:body guideline="2,590;" style="margin-left:0; margin-top:0; margin-right:0; margin-bottom:0; ">
  687. <treeview id="treeview1" ref="/root/temp/reqdata/selectIndxCd" dragmode="true" dropmode="true" expanddepth="0" hasimages="true" itemsettype="depth" style="left:0px; top:0px; width:345px; height:662px; ">
  688. <itemset nodeset="/root/main/indxlist/itemlist/item">
  689. <label ref="indxnm"/>
  690. <value ref="indxno"/>
  691. <depth ref="depth"/>
  692. <image ref="image"/>
  693. <selectedimage/>
  694. <expandedimage/>
  695. </itemset>
  696. <script type="javascript" ev:event="onmousedown">
  697. <![CDATA[
  698. if(treeview1.isCell(event.target)) {
  699. var indx = treeview1.focusIndex;
  700. var row = treeview1.mouseRow;
  701. if(indx == -1 || indx != row ){
  702. treeview1.select(row);
  703. indx = row;
  704. }
  705. iFocusIndx = indx;
  706. //if( opener.model.getValue("/root/main/search_cond/authflag") == "M" ){ // 부서 권한 체크
  707. if(event.button == 3){ // 마우스 우클릭시
  708. //DB에 저장되어 있는 인덱스의 삭제는 체크버튼으로 control한다. 트리상에서 추가된 아이템은 바로 삭제 가능하다.
  709. if(model.getValue(itemRef + "[" + (indx + 1) + "]/image") == fileImg) {
  710. model.resetInstanceNode("/root/main/formdata/item");
  711. setPopupMenu("treeview1", false, "/root/main/indxlist/popupmenu/tree/indxmenu", "name", "func", false);
  712. } else {
  713. if(model.getValue(itemRef + "[" + (indx + 1) + "]/supindxno") == "0" ) {
  714. setPopupMenu("treeview1", false, "/root/main/indxlist/popupmenu/tree/supmenu", "name", "func", false);
  715. } else {
  716. setPopupMenu("treeview1", false, "/root/main/indxlist/popupmenu/tree/submenu", "name", "func", false);
  717. }
  718. }
  719. var itemNode = instance1.selectSingleNode(itemRef + "[" + (indx + 1) + "]");
  720. var itemNodeDepth = itemNode.depth.text;
  721. model.resetInstanceNode("/root/main/formdata/item");
  722. model.setValue("/root/main/formdata/item/depth", parseInt(itemNodeDepth) + 1);
  723. }
  724. //}
  725. }else{
  726. window.setPopupMenu(false);
  727. }
  728. ]]>
  729. </script>
  730. <script type="javascript" ev:event="ondblclick">
  731. <![CDATA[
  732. var iRow = parseInt(iFocusIndx) + 1
  733. var filepath = model.getValue("/root/main/srcindxinfo/itemlist/item"+"[" + iRow + "]/filepath");
  734. var filenm = model.getValue("/root/main/srcindxinfo/itemlist/item"+"[" + iRow + "]/filenm");
  735. var fileno = model.getValue("/root/main/srcindxinfo/itemlist/item"+"[" + iRow + "]/fileno");
  736. if ( fileno == "0" ) {
  737. treeview1.dispatch("onmousedown");
  738. return;
  739. }
  740. //var localfile = window.fileDialog("save","|",false,filenm,"","All Files(*.*)|*.*");
  741. //var localfile = "C:/Temp/"+ filenm;
  742. //localfile = getLocalFile(); // 공통에서 로컬 파일저장 위치를 가저옴.
  743. //fs = new ActiveXObject("Scripting.FileSystemObject");
  744. if(filepath != ""){
  745. opener.browser1.Navigate(getActionURL("TRMMD05002")+"&filepath="+filepath);
  746. } else {
  747. messageBox("파일이 ", "I004");
  748. }
  749. /*
  750. if (localfile != "") {
  751. if( !fs.FileExists(localfile)){ // 로컬에 기존파일이 없을때 다운로드
  752. model.download(getActionURL("TRMMD05002")+"&filepath="+filepath,localfile, false);
  753. }
  754. opener.browser1.Navigate(localfile);
  755. } else {
  756. opener.browser1.Navigate("about:blank");
  757. }
  758. */
  759. ]]>
  760. </script>
  761. </treeview>
  762. <group id="group2" style="left:105px; top:30px; width:220px; height:0px; background-color:#ffffff; border-color:#000000; ">
  763. <input id="inpt_srch" ref="/root/main/formdata/item/indxnm" class="input_default" style="left:67px; top:5px; width:147px; height:19px; border-style:solid; ">
  764. <script type="javascript" ev:event="onkeyup">
  765. <![CDATA[
  766. /*
  767. if( event.keyCode == 13 ) {
  768. if(btn_modify.attribute("visibility") == "hidden"){
  769. fConfirm();
  770. } else {
  771. fSetFolderName();
  772. }
  773. }
  774. */
  775. ]]>
  776. </script>
  777. </input>
  778. <input id="input2" ref="/root/main/formdata/item/indxrefseq" class="input_default" visibility="hidden" style="left:67px; top:5px; width:147px; height:19px; border-style:solid; "/>
  779. <input id="input3" ref="/root/main/formdata/item/supindxno" class="input_default" visibility="hidden" style="left:9px; top:27px; width:55px; height:19px; border-style:solid; "/>
  780. <button id="btn_ok" class="btn2_letter2" style="left:127px; top:28px; width:42px; height:19px; ">
  781. <caption>확인</caption>
  782. <script type="javascript" ev:event="DOMActivate">
  783. <![CDATA[
  784. fConfirm();
  785. ]]>
  786. </script>
  787. </button>
  788. <button id="btn_modify" class="btn2_letter2" style="left:127px; top:28px; width:42px; height:19px; ">
  789. <caption>확인</caption>
  790. <script type="javascript" ev:event="DOMActivate">
  791. <![CDATA[
  792. //폴더명을 수정한다.
  793. fSetFolderName();
  794. ]]>
  795. </script>
  796. </button>
  797. <caption id="cap_menu" class="cell_1" style="left:5px; top:5px; width:60px; height:20px; font-weight:bold; vertical-align:middle; ">색인명</caption>
  798. <button id="btn_cancle" class="btn2_letter2" style="left:172px; top:28px; width:42px; height:19px; ">
  799. <caption>취소</caption>
  800. <script type="javascript" ev:event="DOMActivate">
  801. <![CDATA[
  802. group2.attribute("height") = 0;
  803. ]]>
  804. </script>
  805. </button>
  806. <shape id="roundrect2" class="roundrect_btnset" appearance="roundrect" style="left:1px; top:0px; width:219px; height:53px; "/>
  807. <button id="btn_find" class="btn2_letter2" navindex="18" style="left:82px; top:28px; width:42px; height:19px; ">
  808. <caption>찾기</caption>
  809. <script type="javascript" ev:event="DOMActivate">
  810. <![CDATA[
  811. var iRow = parseInt(iFocusIndx) + 1; //선택한 인스턴스의 인덱스
  812. var maxsize = upload1.attribute("filesize");
  813. //var files = window.fileDialog("open", "|", true);
  814. var files = window.fileDialog("open","|","true","","pdf","Adobe PDF 파일(*.pdf)|*.pdf");
  815. var filelist = files.split("|");
  816. if(isNull(filelist)){
  817. return;
  818. } else{
  819. for(var i = 0 ; i < filelist.length ; i++ ) {
  820. //파일 경로에서 이름을 자른다.
  821. var fileNM = filelist[i].split("\\");
  822. inpt_srch.value = fileNM[fileNM.length-1];
  823. model.makeValue("/root/main/attfileinfo/attach/attfilenm", fileNM[fileNM.length-1]);
  824. model.makeValue("/root/main/attfileinfo/attach/file", filelist[i]);
  825. //model.makeValue("/root/main/attfileinfo/attach/detlinfoseq", 0);
  826. //model.makeValue("/root/main/attfileinfo/attach/check", "false");
  827. //model.makeValue("/root/main/attfileinfo/attach/path", "");
  828. if (!checkFileSize(upload1)){
  829. //grd_attfile.removeItem();
  830. messageBox("파일 크기가 최대치("+maxsize+"Byte)를", "E003");
  831. }
  832. }
  833. }
  834. //model.setFocus("inpt_srch");
  835. ]]>
  836. </script>
  837. </button>
  838. <upload id="upload1" nodeset="/root/main/attfileinfo/attach/file" ext="zip" filecount="5" filesize="5242880" style="left:8px; top:28px; width:20px; height:20px; "/>
  839. </group>
  840. <datagrid id="grd_drugdept" nodeset="/root/main/drugdeptlist/drugdept" visibility="hidden" caption="부서코드^부서명" colsep="^" mergecellsfixedrows="bycolrec" rowsep="|" style="left:125px; top:150px; width:210px; height:55px; ">
  841. <col ref="deptcd"/>
  842. <col ref="depthngnm"/>
  843. </datagrid>
  844. </xhtml:body>
  845. </xhtml:html>