api_param_dialog.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=8;" />
  6. <link rel="stylesheet" href="../../js/xheditor-1.1.14/common.css" type="text/css"></link>
  7. <script language="javascript" src="../../easyui/all.js"></script>
  8. <script type="text/javascript" src="../../easyui/easyui-validate.js"></script>
  9. <script type="text/javascript" src="../../easyui/datagrid-detailview.js"></script>
  10. <script type="text/javascript" src="../../easyui/upload.js"></script>
  11. <script type="text/javascript" src="../../yihu_js/common.js"></script>
  12. <script type="text/javascript" src="../../commons/js/common.js"></script>
  13. <style>
  14. pre,html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,a,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,var,b,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td {
  15. margin: 0;
  16. padding: 0;
  17. border: 0;
  18. font-size: 100%
  19. }
  20. body {
  21. line-height: 1;
  22. color: #555;
  23. background:white;
  24. font: 12px/1.5 Helvetica,Arial,sans-serif
  25. }
  26. ul,ol,li {
  27. list-style: none outside
  28. }
  29. /*table {
  30. border-collapse: collapse;
  31. border-spacing: 0;
  32. }*/
  33. a {
  34. text-decoration: none;
  35. color: #39c;
  36. outline: 0 none
  37. }
  38. a:hover {
  39. text-decoration: underline
  40. }
  41. .colmain {
  42. width: 1000px;
  43. *width: auto;
  44. *float: left;
  45. padding: 25px 35px;
  46. display: table-cell;
  47. max-width: 1000px;
  48. /* width: auto; */
  49. }
  50. .pre_1{
  51. overflow-x: auto;
  52. margin: 0px;
  53. padding: 0px;
  54. }
  55. .pre_2{
  56. overflow-x: auto;
  57. max-width: 1000px;
  58. }
  59. .colmain .bd {
  60. padding: 15px 0 15px 15px
  61. }
  62. .doc {
  63. width: 98%;
  64. line-height: 20px;
  65. font-size: 13px/15
  66. }
  67. .doc .doc-tit h2 {
  68. font-weight: bold;
  69. padding: 0 0 10px 3px;
  70. font-size: 15px
  71. }
  72. .doc .part-tit h2 {
  73. font-weight: bold;
  74. font-size: 15px
  75. }
  76. .doc .doc-basic {
  77. border: 1px solid #dbdbdb;
  78. background-color: #f8f7f7;
  79. padding: 15px 0 15px 15px
  80. }
  81. .doc .part-tit {
  82. background-color: #fef1df;
  83. line-height: 35px;
  84. height: 35px;
  85. padding: 0 0 0 15px
  86. }
  87. .doc-part {
  88. /* padding-bottom: 20px */
  89. }
  90. .doc-part .bd li {
  91. padding-bottom: 5px
  92. }
  93. /*.doc-part th {
  94. text-align: center;
  95. font-weight: bolder;
  96. border: 1px solid #ccc;
  97. line-height: 20px;
  98. background-color: #f8f7f7
  99. }*/
  100. td pre {
  101. /* width: 95%; */
  102. /* padding: 1em; */
  103. /* border: 1px dashed #2f6fab; */
  104. /* color: black; */
  105. /* background-color: #f9f9f9; */
  106. /* line-height: 1.1em; */
  107. /* overflow-y: hidden; */
  108. overflow-x: auto;
  109. max-width: 400px;
  110. }
  111. .doc-footer .issue {
  112. border-top: 1px solid #e5e5e5;
  113. text-align: right;
  114. width: 100%
  115. }
  116. .doc-part .list-disc li {
  117. list-style: disc;
  118. margin-left: 15px
  119. }
  120. .box-wrap{
  121. z-index:1000000;
  122. background-color:#f7f7f7;
  123. padding-left: 30px;
  124. height: 20px;
  125. /* position: absolute; */
  126. border: 1px solid #e0e0e0;
  127. line-height: 20px
  128. }
  129. .box-wrap li{
  130. float: left;
  131. height: 20px;
  132. padding: 0 22px;
  133. *padding: 0 20px;
  134. margin-left: -1px;
  135. /* position: relative; */
  136. font-size: 14px;
  137. border-left: 1px solid #e0e0e0
  138. }
  139. .box-wrap li a{
  140. color:#ff8400;
  141. font-weight: bold;
  142. }
  143. .tr_json{
  144. /* background-color: #d4ecd3;//#bbeb71; */
  145. color: black;
  146. }
  147. .tr_json_body{
  148. /* background-color: #fdfdc9;//#fff6b1; */
  149. font-style: oblique;
  150. color: black;
  151. /* font-family: Times, TimesNR, 'New Century Schoolbook', Georgia, 'New York', serif; */
  152. font-weight: 500;
  153. }
  154. </style>
  155. </head>
  156. <script>
  157. var hosId = $.getUrlParam("hosId");
  158. var api = $.getUrlParam("api");
  159. var apiName = $.getUrlParam("apiName");
  160. var retDataType = $.getUrlParam("retDataType");
  161. var createTime = $.getUrlParam("createTime");
  162. var paramTypeData = [{id:'Int',text:'Int'},{id:'Boolean',text:'Boolean'},{id:'Object',text:'Object'},
  163. {id:'String',text:'String'},{id:'Long',text:'Long'},{id:'Double',text:'Double'},{id:'String_Json',text:'String_Json'}];
  164. var isData = [{id:'0',text:'否'},{id:'1',text:'是'}];
  165. var editIndex = undefined;
  166. $(function(){
  167. $("#apiName").html(apiName);
  168. $("#methodname").html(api);
  169. $("#methodresulttype").html(retDataType);
  170. $("#createdate").html(createTime);
  171. initWidget();
  172. });
  173. function initWidget(){
  174. $("#apiInParamGrid").datagrid({
  175. title : '',
  176. url:$.common.urlByBizAction("ApiAction_querySysMethodParam"),
  177. onBeforeLoad: function(param){
  178. param.api = api;
  179. param.hosId = hosId;
  180. param.isOut = 0;//入参
  181. },
  182. fitColumns : true,
  183. singleSelect: true,
  184. onClickRow:function(index){
  185. endEditing('apiInParamGrid');
  186. },
  187. onDblClickRow:function(index, rowData){
  188. if (editIndex != index){
  189. if (endEditing('apiInParamGrid')){
  190. $(this).datagrid('selectRow', index)
  191. .datagrid('beginEdit', index);
  192. editIndex = index;
  193. } else {
  194. $(this).datagrid('selectRow', editIndex);
  195. }
  196. }
  197. },
  198. onAfterEdit:function(rowIndex, rowData, changes){
  199. rowData.HosId = hosId;
  200. var retData = Commonjs.ajax("./ApiAction_saveSysMethodParam.action",rowData,false);
  201. //$('#apiInParamGrid').datagrid('reload');
  202. },
  203. columns:[[
  204. {field:'Pid',title:'父主键',hidden:true},
  205. {field:'ParamId',title:'主键',hidden:true},
  206. {field:'IsOut',title:'入参',hidden:true},
  207. {field:'Api',title:'api',hidden:true},
  208. {field:'ParamName',title:'参数',width:170,editor:{type:'validatebox',options:{required:true}}},
  209. {field:'ParamType',title:'类型',width:100,editor:{type:'combobox',
  210. options:{
  211. valueField:'id',
  212. textField:'text',
  213. required:true,
  214. editable:false,
  215. data:paramTypeData
  216. }}},
  217. {field:'ParamMeaning',title:'参数名称',width:230,editor:{type:'validatebox',options:{required:true}}},
  218. {field:'IsNeed',title:'必输',width:100,formatter:isNeedFormatter,editor:{type:'combobox',
  219. options:{
  220. valueField:'id',
  221. textField:'text',
  222. required:true,
  223. editable:false,
  224. data:isData
  225. }}},
  226. {field:'Remark',title:'备注',width:310,editor:'text'}
  227. ]],
  228. toolbar:[
  229. {
  230. text:'增加',
  231. iconCls:'icon-add',
  232. handler:function(){
  233. if (endEditing('apiInParamGrid')){
  234. $('#apiInParamGrid').datagrid('appendRow',{IsOut:0,Api:api,Pid:-1});
  235. editIndex = $('#apiInParamGrid').datagrid('getRows').length-1;
  236. $('#apiInParamGrid').datagrid('selectRow', editIndex)
  237. .datagrid('beginEdit', editIndex);
  238. }
  239. }
  240. },'-',{
  241. text:'删除',
  242. iconCls:'icon-remove',
  243. handler:function(){
  244. var selectedRow = $('#apiInParamGrid').datagrid('getSelected');
  245. if( selectedRow == null ){
  246. $.messager.alert('提示','请选择一条记录再删除!','info');
  247. }else{
  248. if( selectedRow.ParamId != null ){//删除
  249. $.messager.confirm('提示','是否确认删除该参数?',function(r){
  250. if (r){
  251. var param = {};
  252. param.paramId = selectedRow.ParamId;
  253. param.hosId = hosId;
  254. param.api = api;
  255. param.paramName = selectedRow.ParamName;
  256. var retData = Commonjs.ajax("./ApiAction_deleteSysMethodParam.action",param,false);
  257. $('#apiInParamGrid').datagrid('reload');
  258. }
  259. });
  260. }else{
  261. $.messager.confirm('提示','是否放弃新增记录?',function(r){
  262. if (r){
  263. $('#apiInParamGrid').datagrid('reload');
  264. }
  265. });
  266. }
  267. }
  268. }
  269. },'-',{
  270. text:'刷新',
  271. iconCls:'icon-reload',
  272. handler:function(){
  273. $('#apiInParamGrid').datagrid('reload');
  274. }
  275. },'-',{
  276. text:'保存',
  277. iconCls:'icon-save',
  278. handler:function(){
  279. endEditing('apiInParamGrid');
  280. }
  281. }
  282. ],
  283. });
  284. $("#apiOutParamGrid").datagrid({
  285. title : '',
  286. url:$.common.urlByBizAction("ApiAction_querySysMethodParam"),
  287. onBeforeLoad: function(param){
  288. param.api = api;
  289. param.hosId = hosId;
  290. param.isOut = 1;//入参
  291. },
  292. fitColumns : true,
  293. singleSelect: true,
  294. onClickRow:function(index){
  295. endEditing('apiOutParamGrid');
  296. },
  297. onDblClickRow:function(index, rowData){
  298. if (editIndex != index){
  299. if (endEditing('apiOutParamGrid')){
  300. $(this).datagrid('selectRow', index)
  301. .datagrid('beginEdit', index);
  302. editIndex = index;
  303. } else {
  304. $(this).datagrid('selectRow', editIndex);
  305. }
  306. }
  307. },
  308. onAfterEdit:function(rowIndex, rowData, changes){
  309. rowData.HosId = hosId;
  310. var retData = Commonjs.ajax("./ApiAction_saveSysMethodParam.action",rowData,false);
  311. //$('#apiInParamGrid').datagrid('reload');
  312. },
  313. columns:[[
  314. {field:'Pid',title:'父主键',hidden:true},
  315. {field:'ParamId',title:'主键',hidden:true},
  316. {field:'IsOut',title:'入参',hidden:true},
  317. {field:'Api',title:'api',hidden:true},
  318. {field:'ParamName',title:'参数',width:170,editor:{type:'validatebox',options:{required:true}}},
  319. {field:'ParamType',title:'类型',width:100,editor:{type:'combobox',
  320. options:{
  321. valueField:'id',
  322. textField:'text',
  323. required:true,
  324. editable:false,
  325. data:paramTypeData
  326. }}},
  327. {field:'ParamMeaning',title:'参数名称',width:230,editor:{type:'validatebox',options:{required:true}}},
  328. {field:'IsNeed',title:'必输',width:100,formatter:isNeedFormatter,editor:{type:'combobox',
  329. options:{
  330. valueField:'id',
  331. textField:'text',
  332. required:true,
  333. editable:false,
  334. data:isData
  335. }}},
  336. {field:'Remark',title:'备注',width:310,editor:'text'}
  337. ]],
  338. toolbar:[
  339. {
  340. text:'增加',
  341. iconCls:'icon-add',
  342. handler:function(){
  343. if (endEditing('apiOutParamGrid')){
  344. $('#apiOutParamGrid').datagrid('appendRow',{IsOut:1,Api:api,Pid:-1});
  345. editIndex = $('#apiOutParamGrid').datagrid('getRows').length-1;
  346. $('#apiOutParamGrid').datagrid('selectRow', editIndex)
  347. .datagrid('beginEdit', editIndex);
  348. }
  349. }
  350. },'-',{
  351. text:'删除',
  352. iconCls:'icon-remove',
  353. handler:function(){
  354. var selectedRow = $('#apiOutParamGrid').datagrid('getSelected');
  355. if( selectedRow == null ){
  356. $.messager.alert('提示','请选择一条记录再删除!','info');
  357. }else{
  358. if( selectedRow.ParamId != null ){//删除
  359. $.messager.confirm('提示','是否确认删除该参数?',function(r){
  360. if (r){
  361. var param = {};
  362. param.paramId = selectedRow.ParamId;
  363. param.hosId = hosId;
  364. param.api = api;
  365. param.paramName = selectedRow.ParamName;
  366. var retData = Commonjs.ajax("./ApiAction_deleteSysMethodParam.action",param,false);
  367. $('#apiOutParamGrid').datagrid('reload');
  368. }
  369. });
  370. }else{
  371. $.messager.confirm('提示','是否放弃新增记录?',function(r){
  372. if (r){
  373. $('#apiOutParamGrid').datagrid('reload');
  374. }
  375. });
  376. }
  377. }
  378. }
  379. },'-',{
  380. text:'刷新',
  381. iconCls:'icon-reload',
  382. handler:function(){
  383. $('#apiOutParamGrid').datagrid('reload');
  384. }
  385. },'-',{
  386. text:'保存',
  387. iconCls:'icon-add',
  388. handler:function(){
  389. endEditing('apiOutParamGrid');
  390. }
  391. }
  392. ],
  393. });
  394. }
  395. function isNeedFormatter(value,row,index){
  396. if (value == 1){
  397. return "是";
  398. } else {
  399. return "否";
  400. }
  401. }
  402. function endEditing(gridId){
  403. if (editIndex == undefined){return true}
  404. if ($('#'+gridId).datagrid('validateRow', editIndex)){
  405. $('#'+gridId).datagrid('endEdit', editIndex);
  406. editIndex = undefined;
  407. return true;
  408. } else {
  409. return false;
  410. }
  411. }
  412. </script>
  413. <body>
  414. <div class="colmain">
  415. <div class="doc">
  416. <div class="doc-part">
  417. <div class="doc-tit">
  418. <h2>API参数>> <span id="apiName"></span></h2>
  419. </div>
  420. <div class="doc-basic">
  421. <ul>
  422. <li>API名称:<span id="methodname"></span></li>
  423. <li>返回值数据格式:<span id="methodresulttype"></span></li>
  424. <li>创建时间:<span id="createdate"></span></li>
  425. </ul>
  426. </div>
  427. </div>
  428. <div id="J_tabcont" style="padding-top: 20px;">
  429. <a id="div_3" style="padding-top: 30px;"></a>
  430. <a id="div_1" style="padding-top: 30px;"></a>
  431. <div>
  432. <div class="doc-part">
  433. <div class="part-tit" >
  434. <h2>请求参数</h2>
  435. </div>
  436. <div class="bd">
  437. <table id="apiInParamGrid"></table>
  438. </div>
  439. </div>
  440. </div>
  441. <a id="div_2" style="padding-top: 30px;"></a>
  442. <div>
  443. <div class="doc-part">
  444. <div class="part-tit">
  445. <h2>返回结果</h2>
  446. </div>
  447. <div class="bd">
  448. <table id="apiOutParamGrid"></table>
  449. </div>
  450. </div>
  451. </div>
  452. <a id="div_6" style="padding-top: 30px;"></a>
  453. </div>
  454. </div>
  455. </div>
  456. </body>
  457. </html>