listSubject.jsp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <%@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK"%>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html;charset=GBK">
  6. <title>科目列表</title>
  7. <link href="${pageContext.request.contextPath }/liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  8. <script src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  9. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  10. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
  11. <link href="${pageContext.request.contextPath}/main.css" rel="stylesheet" type="text/css" />
  12. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/ligerui.all.js"
  13. type="text/javascript"></script>
  14. <script type="text/javascript" src="/shares/js/constant.js"></script>
  15. <script type="text/javascript" src="/shares/js/common.js"></script>
  16. <script type="text/javascript" src="/shares/js/yw/fm/subject/subjectTree.js"></script>
  17. <script type="text/javascript">
  18. var grid = null;
  19. var height=400;
  20. $(document).ready(function(){
  21. $("#layout1").ligerLayout({
  22. leftWidth : 250,
  23. height : '99%'
  24. });
  25. initSubjectGrid();
  26. $("#leftTree").height(height);
  27. });
  28. var grid = null;
  29. var checkValue = new Array(); //定义一个数组
  30. var i = 0;
  31. function initSubjectGrid(params) {
  32. var checkbox = false;
  33. if ("true" == 'false' || "true" == '') {
  34. checkbox = false;
  35. } else {
  36. checkbox = true;
  37. }
  38. var columns = [
  39. {
  40. display : '上级科目',
  41. name : 'pid_name',
  42. width : 100
  43. }, {
  44. display : '科目编号',
  45. name : 'subject_number',
  46. width : 160
  47. }, {
  48. display : '科目名称',
  49. name : 'subject_name',
  50. width : 160
  51. }, {
  52. display : '收支类型',
  53. name : 'balance_dire_name',
  54. width : 160
  55. },{
  56. display : '状态',
  57. name : 'state_name',
  58. width : 100
  59. } ];
  60. columns
  61. .push({
  62. display : '操作',
  63. width : 120,
  64. isAllowHide : false,
  65. render : function(row) {
  66. var html = '<a href=\"#\" onclick=\"editSubject('+ row.universalid +','+ row.pid +')\">编辑</a>&nbsp;';
  67. html += '<a href=\"#\" onclick=\"delSubject('+ row.universalid+','+ row.pid +')\">删除</a>&nbsp;';
  68. return html;
  69. }
  70. });
  71. grid = $("#maingrid4")
  72. .ligerGrid(
  73. {
  74. columns : columns,
  75. pageSize : 20,
  76. url : 'fmSubjectAction.do?task=subjectList&time=' + new Date().getTime() + params,
  77. pageParmName : 'p', //页索引参数名,(提交给服务器)
  78. pagesizeParmName : 'pSize', //页记录数参数名,(提交给服务器)
  79. width : '99.9%',
  80. checkbox:checkbox,
  81. // single :true,
  82. // allowHideColumn: false, rownumbers: true, colDraggable: true, rowDraggable: true,
  83. height : '98%',
  84. isChecked: f_isChecked,
  85. onCheckRow: function(checked, rowdata, rowindex) {
  86. for (var rowid in this.records){
  87. this.unselect(rowid);
  88. }
  89. if(checked){
  90. this.select(rowindex);
  91. }else{
  92. this.unselect(rowindex);
  93. }
  94. }
  95. });
  96. $("#pageloading").hide();
  97. $(".l-grid-hd-cell-btn-checkbox").css("display", "none"); //隱藏checkAll
  98. }
  99. //默认选中
  100. function f_isChecked(rowdata){
  101. if(checkValue != "" && typeof (checkValue) != "undefined"){
  102. if(checkValue[i]==rowdata.sid){
  103. i++;
  104. return true;
  105. }
  106. return false;
  107. }
  108. }
  109. //查询
  110. function searchByKword(tree) {
  111. var s = "";
  112. var universalid ="";
  113. if(tree=="tree"){
  114. universalid = $("#universalid").val();
  115. }else{
  116. universalid = $("#_universalid").val();
  117. }
  118. universalid= $("#universalid").val()
  119. if (universalid != "" && typeof (universalid) != "undefined") {
  120. s += "&universalid=" + universalid;
  121. }
  122. //alert(universalid);
  123. var subject_name2 = $("#subject_name2").val();//规则名称
  124. if (subject_name2 != "" && typeof (subject_name2) != "undefined") {
  125. s += "&subject_name=" + encodeURI(encodeURI(subject_name2));
  126. }
  127. //alert(subject_name2);
  128. var state = $("#state").val();
  129. // alert(state);
  130. if (state != "" && typeof (state) != "undefined") {
  131. s += "&state=" + state;
  132. }
  133. grid.set("newPage","1");
  134. initSubjectGrid(s);
  135. }
  136. function f_select() {
  137. var rows = grid.getCheckedRows();
  138. return rows;
  139. }
  140. //删除科目信息
  141. function delSubject(universalid,pid){
  142. // if (window.confirm("确定要删除科目信息吗?")){
  143. // addTab('delSubject' + getCurrentTabId(), '删除科目信息', '${pageContext.request.contextPath }/hrSubjectAction.do?task=delCourse&universalid='
  144. // + universalid + '&tabid=' + getCurrentTabId(),true,true);
  145. // }
  146. var param={'universalid':universalid,
  147. 'pid':pid
  148. };
  149. //alert(universalid);
  150. // alert(pid);
  151. if (window.confirm("确定要删除科目分类信息吗?")){
  152. sendAjaxParam(param,"fmSubjectAction.do?task=delSubjectType",'json',delTypeProcess);
  153. }
  154. }
  155. function delTypeProcess(data){
  156. //alert(data.result);
  157. if(data.result>0){
  158. $.ligerDialog.success("删除科目分类信息成功");
  159. // universalid="";
  160. // $("#universalid").val("");
  161. // initSubjectGrid();
  162. searchByKword();
  163. }else if(data.result==0){
  164. $.ligerDialog.warn("科目分类已被引用,不可删除");
  165. }else if(data.result==-1){
  166. $.ligerDialog.error("删除科目分类信息失败");
  167. }
  168. loadTree();
  169. }
  170. //编辑科目信息
  171. function editSubject(universalid,pid){
  172. var s=$("#status").val();
  173. // alert(s);
  174. if(s=='2'){
  175. alert("该科目父类已被停用,请先启用!")
  176. return;
  177. }
  178. // alert(pid);
  179. // addTab('editCourse' + getCurrentTabId(), '编辑科目信息', '${pageContext.request.contextPath }/hrTrainCourseAction.do?task=toEditCourse&universalid='
  180. // + universalid + '&tabid=' + getCurrentTabId(),true,true);
  181. dialog = $.ligerDialog.open({ height: 260,
  182. width:500,
  183. url: 'fmSubjectAction.do?task=toEditSubject&universalid='+universalid+'&pid='+pid+'&status='+s,
  184. allowClose:false,
  185. title:'编辑科目分类',
  186. buttons : [ {
  187. text : '保存',
  188. onclick : function(item,dialog){
  189. dialog.frame.editSubjectType();
  190. }
  191. },{
  192. text : '关闭',
  193. onclick : addSubjectCloseOk
  194. }]
  195. });
  196. }
  197. function addSubjectCloseOk(item,dialog){
  198. dialog.close();
  199. loadTree();
  200. }
  201. function addTabe(){
  202. var universalid=$("#universalid").val();
  203. if(universalid=="" || universalid==null ){
  204. alert("请先选择科目子类别!");
  205. return ;
  206. }
  207. if(universalid=="1"){
  208. alert("是根目录,请选择科目子类别!");
  209. return;
  210. }
  211. addTab('addCourse'+getCurrentTabId(), '新增科目', '${pageContext.request.contextPath }/hrTrainCourseAction.do?task=toAddCourse&tabid=' + getCurrentTabId()+'&universalid='+universalid,true,true);
  212. }
  213. function up()
  214. {
  215. var row = grid.getSelected();
  216. if(row=="undefined" || row==null || row==""){
  217. alert("请先选中科目分类!")
  218. }
  219. grid.up(row);
  220. // alert(row.universalid+"dd:"+row.pid);
  221. }
  222. function down()
  223. {
  224. var row = grid.getSelected();
  225. if(row=="undefined" || row==null || row==""){
  226. alert("请先选中科目分类!")
  227. }
  228. grid.down(row);
  229. }
  230. function endEdit()
  231. {
  232. grid.endEdit();
  233. var subject=JSON.stringify(grid.getData());
  234. $("#subject_data").val(subject);
  235. $("#addSubjectOrder").submit();
  236. }
  237. // 导入
  238. var importDlg;
  239. function importExcel(){
  240. var type="fmSubject";
  241. importDlg = $.ligerDialog.open({
  242. height: 120,
  243. width:440,
  244. url: 'fmSubjectImportAction.do?task=toImport&type='+type,
  245. allowClose:false,
  246. title:'导入科目数据',
  247. buttons : [ {
  248. text : '导入',
  249. onclick : function(item,dialog){
  250. dialog.frame.importExcel(window);
  251. }
  252. },{
  253. text : '关闭',
  254. onclick : function(item,dialog){
  255. importDlg.close();
  256. refreshWindow();
  257. window.parent.loadTree();
  258. grid.loadData();
  259. }
  260. }]
  261. });
  262. }
  263. // //新增科目表单配置
  264. // function addSubjectConfig(){
  265. // dialog = $.ligerDialog.open({ height: 340,width:700, title:"科目表单配置",url: 'fmSubjectAction.do?task=toSubjectConfigList'});
  266. // }
  267. </script>
  268. <style type="text/css">
  269. body {
  270. padding: 5px;
  271. margin: 0;
  272. }
  273. #layout1 {
  274. width: 99.5%;
  275. margin: 0;
  276. padding: 0;
  277. }
  278. .l-button {
  279. margin-left: 1px;
  280. }
  281. /* #deptBtn { */
  282. /* /* width: 100%; */ */
  283. /* background: #e5ecf9; */
  284. /* text-align: center; */
  285. /* height: 25px; */
  286. /* padding-top: 3px */
  287. /* } */
  288. .l-layout-left {
  289. overflow-y: auto;
  290. }
  291. </style>
  292. </head>
  293. <BODY>
  294. <%@ include file="/include/button.jsp"%>
  295. <%@ include file="/include/message.jsp"%>
  296. <div class="l-content">
  297. <div id="layout1">
  298. <form action="fmSubjectAction.do?task=addSubjectOrder" id="addSubjectOrder" method="post">
  299. <input type="hidden" name="subject_data" id="subject_data" />
  300. <input type="hidden" name="tabid" id="tabid" value="fmSubjectAction.do?task=toList" />
  301. </form>
  302. <input type="hidden" name="typeRootId" id="typeRootId" value="${typeRootId }"/>
  303. <input type="hidden" name="asset_search_type" id="asset_search_type" value=""/>
  304. <div position="left" title="科目分类" class="user-tree-style">
  305. <div id="deptBtn">
  306. <!-- <input type="button" value="修改" class="l-button" onclick="editSubjectType()" id="editSubjectTypeBtn" style="width:50px;" /> -->
  307. <!-- <input type="button" value="删除" class="l-button" onclick="delSubjectType()" id="delSubjectTypeBtn" style="width:50px;"/> -->
  308. </div>
  309. <div id="leftTree" style="overflow:auto;position:relative;">
  310. <ul id="subjectTree" class="tree" style="margin-top: 3px;"></ul>
  311. </div>
  312. </div>
  313. <div position="center" id="assetList" title="科目列表">
  314. <div id="deptBtn" style="text-align:left;">
  315. <input type="button" value="新增科目" class="l-button" onclick="addSubjectType()" id="addSubjectTypeBtn" style="width:90px;margin-left:10px;"/>
  316. <!-- <a class="l-button" onclick="up()">上移</a> -->
  317. <!-- <a class="l-button" onclick="down()" >下移</a> -->
  318. <input id="l-button" type="button" value="上移" class="l-button" onclick="up()" style="width: 50px;margin-left:30px;"/>
  319. <input id="l-button" type="button" value="下移" class="l-button" onclick="down()" style="width: 50px;"/>
  320. <input type="button" class="l-button" value="保存" onclick="endEdit()" />
  321. <!-- <input type="button" class="l-button" value="科目表单配置" onclick="addSubjectConfig()" style="width:90px;margin-left:30px;"/> -->
  322. <input type="button" value="导入" class="l-button" onclick="importExcel()" id="importExcelBtn" style="margin-left:60px;"/>
  323. <!-- <input id="menuUp" type="button" value="上移" class="l-button" onclick="saveUp()"/> -->
  324. <!-- <input id="menuDown" type="button" value="下移" class="l-button" onclick="saveDown()"/> -->
  325. </div>
  326. <div class="default_search" style="margin: 0;">
  327. <!-- <ul class="list_search"> -->
  328. <!-- <li class="title">类别:</li> -->
  329. <!-- <li class="text"> -->
  330. <!-- <select id="_universalid" name="_universalid" style="width:100px;"> -->
  331. <!-- <option value="" selected="selected">-请选择-</option> -->
  332. <%-- <c:forEach items="${courseClass }" var="item"> --%>
  333. <%-- <option value="${item.universalid }" >${item.class_name }</option> --%>
  334. <%-- </c:forEach> --%>
  335. <!-- </select> -->
  336. <!-- </li> -->
  337. <!-- </ul> -->
  338. <ul class="list_search">
  339. <li class="title"> 科目名称:</li>
  340. <li class="text">
  341. <input type="text" style="width:130px;"name="subject_name2" id="subject_name2"> </input>
  342. <input type="hidden" name="universalid" id="universalid" value="${universalid}"/>
  343. <input type="hidden" name="status" id="status" value="${status}"/>
  344. </li>
  345. </ul>
  346. <ul style="width: 250px;">
  347. <li class="title" >状态:</li>
  348. <li class="text" >
  349. <select id="state" name="state" style="width:100px;">
  350. <option value="" selected="selected">-请选择-</option>
  351. <c:forEach items="${statusList}" var="item">
  352. <option value="${item.dvalue }" >${item.dname}</option>
  353. </c:forEach>
  354. </select>
  355. </li>
  356. </ul>
  357. <ul>
  358. <li class="search-button"><input type="button" class='l-button'
  359. name="search" onclick="searchByKword()" value="查询" /></li>
  360. </ul>
  361. </div>
  362. <div style="overflow: hidden; clear: both;">
  363. <div id="maingrid4" style="margin: 0; padding: 0"></div>
  364. </div>
  365. </div>
  366. </div>
  367. </div>
  368. </BODY>
  369. </HTML>