contractDictionaryList.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. var dataDictionaryTable;
  2. function searchList() {
  3. var dName = document.getElementById("dName"); //标准名称
  4. // var isValid = document.getElementById("isValid"); // 是否有效
  5. var jsonObject = {"dName":""};
  6. if (dName.value) {
  7. jsonObject.dName = encodeURI(dName.value);
  8. }
  9. if(dataDictionaryTable == undefined){
  10. $(function() {
  11. dataDictionaryTable = $("#dataDictionaryTable").ligerGrid({
  12. columns : [
  13. {
  14. display : '标准项名称',
  15. name : 'dname',
  16. align : 'center',
  17. width : 220
  18. },{
  19. display : '摘要',
  20. name : 'remark',
  21. width : 220,
  22. align : 'center'
  23. },{
  24. display : '类型',
  25. name : 'type',
  26. width : 180,
  27. align : 'center',
  28. render : function(rowdata, rowindex, value) {return getTypeText(value);}
  29. }, {
  30. display : '更新时间',
  31. name : 'update_date',
  32. width : 120,
  33. align : 'center'
  34. }, {
  35. display : '操作',
  36. name : 'projtypename',
  37. width : 120,
  38. align : 'center',
  39. isSort: false,
  40. render : function(rowdata, rowindex, value) {
  41. var h = "";
  42. h += "<a href='javascript:getDataDictionaryDetail("+ rowdata.universalid + ")'>查看</a> ";
  43. if(rowdata.type == 'U' || rowdata.type == 'S'){
  44. h += "<a href='javascript:editDataDictionary("+ rowdata.universalid + ")'>修改</a> ";
  45. }
  46. return h;
  47. }
  48. }],
  49. pageSize : 20,
  50. url : 'contractDataDictionaryAction.do?task=getDataDictionaryList&time='+ new Date().getTime(),
  51. width : "99.8%",
  52. height : "99%",
  53. parms :jsonObject,
  54. pageParmName : 'curPage',
  55. pagesizeParmName : 'pageSize',
  56. onError:function(err){
  57. alert("获取数据失败,请刷新页面后重试!");
  58. }
  59. });
  60. });
  61. }else{
  62. dataDictionaryTable.set("parms",jsonObject);
  63. dataDictionaryTable.loadData();
  64. }
  65. }
  66. var childDataDictionaryTable;
  67. function searchChildList() {
  68. var jsonObject = {"parentId":parentId};
  69. if(childDataDictionaryTable == undefined){
  70. childDataDictionaryTable = $("#childDataDictionaryTable").ligerGrid({
  71. columns : [
  72. {
  73. display : '标准项名称',
  74. name : 'dname',
  75. align : 'center',
  76. width : 220
  77. },{
  78. display : '设定值',
  79. name : 'dvalue',
  80. width : 180,
  81. align : 'center'
  82. },{
  83. display : '排序号',
  84. name : 'dorder',
  85. width : 100,
  86. align : 'center',
  87. type: 'int'
  88. },{
  89. display : '是否默认',
  90. name : 'is_default',
  91. width : 80,
  92. align : 'center',
  93. type:'int',
  94. render: function (item){
  95. if (parseInt(item.is_default) == 0) return '否';
  96. return '是';
  97. }
  98. },{
  99. display : '是否有效',
  100. name : 'is_valid',
  101. width : 80,
  102. align : 'center',
  103. type:'int',
  104. render : function(rowdata, rowindex, value) {
  105. var h = "";
  106. if(value == 0){
  107. h += "<font style='color:#ff0000'>否</font> ";
  108. }else{
  109. h += "是";
  110. }
  111. return h;
  112. }
  113. }
  114. ],
  115. url : 'contractDataDictionaryAction.do?task=getDataDictionaryList&time=' + new Date().getTime(),
  116. width : "99.8%",
  117. height : "99%",
  118. parms :jsonObject,
  119. enabledEdit: true,
  120. clickToEdit: false,
  121. pageParmName : 'curPage',
  122. usePager:false,
  123. pagesizeParmName : 'pageSize',
  124. onError:function(err){
  125. alert("获取数据失败,请刷新页面后重试!");
  126. }
  127. });
  128. }else{
  129. childDataDictionaryTable.set("parms", jsonObject);
  130. childDataDictionaryTable.loadData();
  131. }
  132. }
  133. function getTypeText(type){
  134. if(type == "U"){
  135. return "普通";
  136. }else if(type == "S"){
  137. return "系统";
  138. }else if(type == "C"){
  139. return "内置";
  140. }else{
  141. return "未知";
  142. }
  143. }
  144. function editDataDictionary(dataDictionaryId) {
  145. var uri = "contractDataDictionaryAction.do?task=editDataDictionary&dataDictionaryId=" + dataDictionaryId;
  146. addTab(uri, "编辑标准", uri, true);
  147. }
  148. function getDataDictionaryDetail(dataDictionaryId) {
  149. var uri = "contractDataDictionaryAction.do?task=getDataDictionaryDetail&dataDictionaryId=" + dataDictionaryId;
  150. addTab(uri, "查看标准", uri, true);
  151. }
  152. function initDataDictionary(){
  153. $.ajax({
  154. type:"POST",
  155. url:"contractDataDictionaryAction.do?task=cloneTmsDataDictionary",
  156. timeout:10000,
  157. cache:false,
  158. dataType:"json",
  159. beforeSend:function(){
  160. if(initDialog){
  161. initDialog.close();
  162. }
  163. showWaittingDialog("正在初始化,请稍后……");
  164. },
  165. success:function(data){
  166. if(data.success){
  167. if(dataDictionaryTable){
  168. dataDictionaryTable.loadData();
  169. }
  170. $.ligerDialog.success("初始化完成!");
  171. }else{
  172. showAjaxError(null, data.error);
  173. }
  174. },
  175. error:showAjaxError,
  176. complete:closeWaittingDialog
  177. });
  178. }
  179. function refreshCache(){
  180. $.ajax({
  181. type:"POST",
  182. url:"contractDataDictionaryAction.do?task=refreshCache",
  183. timeout:10000,
  184. cache:false,
  185. dataType:"json",
  186. beforeSend:function(){
  187. if(initDialog){
  188. initDialog.close();
  189. }
  190. showWaittingDialog("正在刷新,请稍后……");
  191. },
  192. success:function(data){
  193. if(data.success){
  194. $.ligerDialog.success("刷新完成!");
  195. }else{
  196. showAjaxError(null, data.error);
  197. }
  198. },
  199. error:showAjaxError,
  200. complete:closeWaittingDialog
  201. });
  202. }