questionnaire.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="renderer" content="webkit|ie-comp|ie-stand">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="Cache-Control" content="no-siteapp" />
  9. <!--[if lt IE 9]>
  10. <script type="text/javascript" src="${ctx}/assets/lib/html5.js"></script>
  11. <script type="text/javascript" src="${ctx}/assets/lib/respond.min.js"></script>
  12. <script type="text/javascript" src="${ctx}/assets/lib/PIE_IE678.js"></script>
  13. <![endif]-->
  14. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui/css/H-ui.min.css" />
  15. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/H-ui.admin.css" />
  16. <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/Hui-iconfont/1.0.7/iconfont.css" />
  17. <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/icheck/icheck.css" />
  18. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/skin/default/skin.css" id="skin" />
  19. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/style.css" />
  20. <script type="text/ecmascript" src="${ctx}/assets/lib/jquery/1.9.1/jquery.js"></script>
  21. <script type="text/javascript" src="${ctx}/assets/static/h-ui/js/H-ui.js"></script>
  22. <script type="text/javascript" src="${ctx}/assets/lib/layer/3.0.3/layer.js"></script>
  23. <link type="text/css" href="${ctx}/assets/lib/codemirror/lib/codemirror.css" rel="stylesheet" />
  24. <script type="text/javascript" src="${ctx}/assets/lib/codemirror/lib/codemirror.js"></script>
  25. <script src="${ctx}/assets/lib/codemirror/mode/xml/xml.js"></script>
  26. <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/webuploader/0.1.5/webuploader.css">
  27. <script type="text/javascript" src="${ctx}/assets/lib/webuploader/0.1.5/webuploader.js"></script>
  28. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqueryui/jquery-ui.css" />
  29. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqgrid/css/ui.jqgrid.css" />
  30. <script type="text/ecmascript" src="${ctx}/assets/lib/jqueryui/jquery-ui.js"></script>
  31. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/i18n/grid.locale-cn.js"></script>
  32. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/jquery.jqGrid.min.js"></script>
  33. <script type="text/javascript" src="${ctx}/assets/js/base.js"></script>
  34. <!--[if IE 6]>
  35. <script type="text/javascript" src="${ctx}/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
  36. <script>DD_belatedPNG.fix('*');</script>
  37. <![endif]-->
  38. <style type="text/css">
  39. .CodeMirror {
  40. border: 1px solid #eee;
  41. height: auto;
  42. }
  43. </style>
  44. <script type="text/javascript">
  45. $(function() {
  46. $(window).resize(function(){
  47. $("#jqGridGroup").setGridWidth($(window).width()-40); 
  48. $("#jqGrid").setGridWidth($(window).width()-40);
  49. $("#jqGridSkin").setGridWidth($(window).width()-40);
  50. });
  51. $("#jqGridGroup").jqGrid({
  52. url : '${ctx}/myconsole/questionnaire/getByPage',
  53. editurl:"${ctx}/myconsole/questionnaire/saveOrUpdate2",
  54. mtype : "POST",
  55. datatype : "json",
  56. caption:'调查问卷管理',
  57. prmNames : {
  58. id: "keyid", 
  59. oper:"oper",    
  60. addoper:"add",
  61. editoper:"edit",
  62. deloper:"del" 
  63. },
  64. colModel : [ {
  65. label : '调查问卷编号',
  66. name : 'keyid',
  67. editable: false,
  68. key : true,
  69. width : 80
  70. }, {
  71. label : '问卷名称',
  72. name : 'questionnairename',
  73. editable: true,
  74. width : 80,
  75. formoptions:{
  76. elmsuffix:'*'
  77. },
  78. editoptions: {
  79. maxlength: 15
  80. },
  81. editrules:{required:true}
  82. }, {
  83. label : '问卷描述',
  84. name : 'questionnairedesc',
  85. editable: true,
  86. width : 80,
  87. edittype : "textarea",
  88. editoptions: {
  89. size:50,
  90. maxlength: 500,
  91. rows:"5",
  92. cols:"40"
  93. }
  94. }, {
  95. label : '更新时间',
  96. name : 'updatetime',
  97. editable: false,
  98. width : 50
  99. } , {
  100. label : '是否发布',
  101. name : 'tstate',
  102. align:'center',
  103. formoptions:{
  104. elmsuffix: '*'
  105. },
  106. editrules:{required: true},
  107. editable: true,
  108. formatter:"select",
  109. edittype: "select",
  110. editoptions: {
  111. value: "false:否;true:是"
  112. },
  113. stype:"select",
  114. searchoptions:{
  115. value: "false :否;true:是"
  116. },
  117. width : 20
  118. },{
  119. label : '选择栏目',
  120. name : 'columnid',
  121. editable: true,
  122. hidden : true,
  123. width : 50,
  124. editrules:{required:true,edithidden:true},
  125. edittype :"select",
  126. formatter:"select",
  127. editoptions: {
  128. dataInit: function(elem){
  129. $(elem).width(225);
  130. },
  131. value:"${columnModel}",
  132. maxlength: 17,
  133. },
  134. formoptions:{
  135. elmsuffix:'*'
  136. }
  137. },{
  138. label : '操作',
  139. name:'operMod',
  140. index:'operMod',
  141. align:"center",
  142. width:"80",
  143. formatter: function (cellvalue, options, rowdata) {
  144. var html = "<button class='btn btn-success radius size-S' onclick=query('"+rowdata.keyid+"')>试卷作答 </button>";
  145. html += "&nbsp;<button class='btn btn-success radius size-S' onclick=analysis('"+rowdata.keyid+"')>结果分析 </button>";
  146. html += "&nbsp;<button class='btn btn-success radius size-S' onclick=exl('"+rowdata.keyid+"')>数据导出</button>";
  147. return html;
  148. }
  149. }],
  150. rownumbers : true,//添加左侧行号
  151. viewrecords : true,//是否在浏览导航栏显示记录总数
  152. rowNum : 10,//每页显示记录数
  153. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  154. autowidth : true,
  155. height : 'auto',
  156. onSelectRow : function( rowid ) {
  157. if(rowid.length>10){
  158. var row = $(this).getRowData(rowid);
  159. $("#jqGrid").setColProp('questionnairekeyid',{editoptions:{value:rowid+":a"}});
  160. $("#jqGrid").setCaption("试题管理--"+row.questionnairename);
  161. $("#jqGrid").jqGrid('setGridParam',{url: "${ctx}/myconsole/question/getByPage?questionnairekeyid="+rowid});
  162. $("#jqGrid").trigger("reloadGrid");
  163. uploader.options.formData.questionnairekeyid= rowid;
  164. }
  165. },
  166. pager : "#jqGridPagerGroup"
  167. });
  168. $('#jqGridGroup').navGrid('#jqGridPagerGroup',
  169. // the buttons to appear on the toolbar of the grid
  170. {
  171. edit : true,
  172. add : true,
  173. del : true,
  174. search : true,
  175. refresh : true,
  176. view : false,
  177. position : "left",
  178. cloneToTop : true
  179. },
  180. // options for the Edit Dialog
  181. {
  182. recreateForm : true,
  183. checkOnUpdate : true,
  184. checkOnSubmit : true,
  185. closeAfterEdit : true,
  186. onInitializeForm:function(formid) {
  187. },
  188. serializeEditData: function(postdata) {
  189. //myconsole.log(postdata);
  190. $.each(postdata,function (index, value) {
  191. //myconsole.log(index);
  192. if(index!="jqGridGroup_id" && index!="oper" && index!="id"){
  193. modifyJosnKey(postdata,index,"questionNaire."+index);
  194. }
  195. if(index=="id"){
  196. postdata["questionNaire."+index]=value;
  197. }
  198. })
  199. //myconsole.log(postdata);
  200. return postdata;
  201. },
  202. afterSubmit: function(r, data) {
  203. var messageString = r.responseText;
  204. var mesObj = eval('(' + messageString + ')');
  205. return [mesObj.state, mesObj.msg];
  206. },
  207. errorTextFormat : function(data) {
  208. return 'Error: ' + data.responseText;
  209. }
  210. },
  211. // options for the Add Dialog
  212. {
  213. closeAfterAdd : true,
  214. recreateForm : true,
  215. beforeSubmit: function(postdata, formid){
  216. $.each(postdata,function (index, value) {
  217. if(index!="jqGridGroup_id" && index!="oper"){
  218. modifyJosnKey(postdata,index,"questionNaire."+index);
  219. }
  220. })
  221. return[true,''];
  222. },
  223. afterSubmit: function(r, data) {
  224. var messageString = r.responseText;
  225. var mesObj = eval('(' + messageString + ')');
  226. return [mesObj.state, mesObj.msg];
  227. },
  228. errorTextFormat : function(data) {
  229. return 'Error: ' + data.responseText;
  230. }
  231. },
  232. // options for the Delete Dailog
  233. {
  234. errorTextFormat : function(data) {
  235. return 'Error: ' + data.responseText;
  236. }
  237. },{
  238. // search options 这里支持多条件查询
  239. multipleSearch: true,
  240. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  241. afterSubmit: function(r, data) {
  242. var messageString = r.responseText;
  243. var mesObj = eval('(' + messageString + ')');
  244. return [mesObj.state, mesObj.message];
  245. }
  246. }
  247. );
  248. ///////////////////////////////////////////
  249. $("#jqGrid").jqGrid({
  250. url : '${ctx}/myconsole/question/getByPage',
  251. editurl:"${ctx}/myconsole/question/saveOrUpdate2",
  252. mtype : "POST",
  253. datatype : "json",
  254. caption:'试题管理',
  255. prmNames : {
  256. id: "keyid", 
  257. oper:"oper",    
  258. addoper:"add",
  259. editoper:"edit",
  260. deloper:"del" 
  261. },
  262. colModel : [ {
  263. label : '试题编号',
  264. name : 'keyid',
  265. hidden : true,
  266. key : true,
  267. width : 50
  268. }, {
  269. label : '调查问卷编号',
  270. name : 'questionnairekeyid',
  271. hidden : true,
  272. editable : true,
  273. edittype :"select",
  274. editoptions:{value:"a:a"}
  275. }, {
  276. label : '试题名称',
  277. name : 'questionname',
  278. editable: true,
  279. width : 80,
  280. formoptions:{
  281. elmsuffix:'*'
  282. },
  283. editoptions: {
  284. maxlength: 500
  285. },
  286. editrules:{required:true}
  287. }, {
  288. label : '试题类型 ',
  289. name : 'questiontype',
  290. editable: true,
  291. formatter:"select",
  292. edittype: "select",
  293. editoptions: {
  294. value: "单选 :单选 ;多选 :多选 ;填空:填空;问答 :问答 "
  295. },
  296. stype:"select",
  297. searchoptions:{
  298. value: "单选 :单选 ;多选 :多选 ;填空:填空;问答 :问答"
  299. },
  300. width : 80,
  301. } , {
  302. label : '更新时间',
  303. name : 'updatetime',
  304. editable: false,
  305. width : 80
  306. }, {
  307. label : '排序编号',
  308. name : 'sortid',
  309. formoptions:{
  310. elmsuffix: '*'
  311. },
  312. editrules:{required: true},
  313. editable: true,
  314. width : 80
  315. } ],
  316. rownumbers : true,//添加左侧行号
  317. viewrecords : true,//是否在浏览导航栏显示记录总数
  318. rowNum : 10,//每页显示记录数
  319. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  320. autowidth : true,
  321. height : 'auto',
  322. onSelectRow : function( rowid ) {
  323. if(rowid.length>10){
  324. var row = $(this).getRowData(rowid);
  325. $("#jqGridSkin").setColProp('questionkeyid',{editoptions:{value:rowid+":b"}});
  326. $("#jqGridSkin").setCaption("选项管理--"+row.questionname);
  327. $("#jqGridSkin").jqGrid('setGridParam',{url: "${ctx}/myconsole/questionoption/getByPage?questionkeyid="+rowid});
  328. $("#jqGridSkin").trigger("reloadGrid");
  329. uploader.options.formData.questionnairekeyid= rowid;
  330. }
  331. },
  332. pager : "#jqGridPager"
  333. });
  334. $('#jqGrid').navGrid('#jqGridPager',
  335. //the buttons to appear on the toolbar of the grid
  336. {
  337. edit : true,
  338. add : true,
  339. del : true,
  340. search : true,
  341. refresh : true,
  342. view : false,
  343. position : "left",
  344. cloneToTop : true
  345. },
  346. //options for the Edit Dialog
  347. {
  348. recreateForm : true,
  349. checkOnUpdate : true,
  350. checkOnSubmit : true,
  351. closeAfterEdit : true,
  352. onInitializeForm:function(formid) {
  353. },
  354. serializeEditData: function(postdata) {
  355. //myconsole.log(postdata);
  356. $.each(postdata,function (index, value) {
  357. //myconsole.log(index);
  358. if(index!="jqGrid_id" && index!="oper" && index!="id"){
  359. modifyJosnKey(postdata,index,"question."+index);
  360. }
  361. if(index=="id"){
  362. postdata["question."+index]=value;
  363. }
  364. })
  365. //myconsole.log(postdata);
  366. return postdata;
  367. },
  368. afterSubmit: function(r, data) {
  369. var messageString = r.responseText;
  370. var mesObj = eval('(' + messageString + ')');
  371. return [mesObj.state, mesObj.msg];
  372. },
  373. errorTextFormat : function(data) {
  374. return 'Error: ' + data.responseText;
  375. }
  376. },
  377. //options for the Add Dialog
  378. {
  379. closeAfterAdd : true,
  380. recreateForm : true,
  381. beforeSubmit: function(postdata, formid){
  382. $.each(postdata,function (index, value) {
  383. if(index!="jqGrid_id" && index!="oper"){
  384. modifyJosnKey(postdata,index,"question."+index);
  385. }
  386. })
  387. return[true,''];
  388. },
  389. afterSubmit: function(r, data) {
  390. var messageString = r.responseText;
  391. var mesObj = eval('(' + messageString + ')');
  392. return [mesObj.state, mesObj.msg];
  393. },
  394. errorTextFormat : function(data) {
  395. return 'Error: ' + data.responseText;
  396. }
  397. },
  398. //options for the Delete Dailog
  399. {
  400. errorTextFormat : function(data) {
  401. return 'Error: ' + data.responseText;
  402. }
  403. },{
  404. // search options 这里支持多条件查询
  405. multipleSearch: true,
  406. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  407. afterSubmit: function(r, data) {
  408. var messageString = r.responseText;
  409. var mesObj = eval('(' + messageString + ')');
  410. return [mesObj.state, mesObj.message];
  411. }
  412. }
  413. );
  414. ///////////////////////////////////////////
  415. $("#jqGridSkin").jqGrid({
  416. url : '${ctx}/myconsole/questionoption/getByPage',
  417. editurl:"${ctx}/myconsole/questionoption/saveOrUpdate2",
  418. mtype : "POST",
  419. datatype : "json",
  420. caption:'试题选项管理',
  421. prmNames : {
  422. id: "keyid", 
  423. oper:"oper",    
  424. addoper:"add",
  425. editoper:"edit",
  426. deloper:"del" 
  427. },
  428. colModel : [ {
  429. label : '编号',
  430. name : 'keyid',
  431. hidden : true,
  432. key : true,
  433. width : 50
  434. }, {
  435. label : '试题编号',
  436. name : 'questionkeyid',
  437. hidden : true,
  438. editable : true,
  439. edittype :"select" ,
  440. editoptions:{value:"b:b"}
  441. }, {
  442. label : '选项内容',
  443. name : 'questionoptionvalue',
  444. editable: true,
  445. width : 80,
  446. formoptions:{
  447. elmsuffix:'*'
  448. },
  449. editoptions: {
  450. maxlength: 15
  451. },
  452. editrules:{required:true}
  453. },{
  454. label : '排序编号',
  455. name : 'sortid',
  456. formoptions:{
  457. elmsuffix: '*'
  458. },
  459. editrules:{required: true},
  460. editable: true,
  461. width : 80
  462. }, {
  463. label : '更新时间',
  464. name : 'updatetime',
  465. editable: false,
  466. width : 80
  467. } ],
  468. rownumbers : true,//添加左侧行号
  469. viewrecords : true,//是否在浏览导航栏显示记录总数
  470. rowNum : 10,//每页显示记录数
  471. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  472. autowidth : true,
  473. height : 'auto',
  474. pager : "#jqGridPagerSkin"
  475. });
  476. $('#jqGridSkin').navGrid('#jqGridPagerSkin',
  477. //the buttons to appear on the toolbar of the grid
  478. {
  479. edit : true,
  480. add : true,
  481. del : true,
  482. search : true,
  483. refresh : true,
  484. view : false,
  485. position : "left",
  486. cloneToTop : true
  487. },
  488. //options for the Edit Dialog
  489. {
  490. recreateForm : true,
  491. checkOnUpdate : true,
  492. checkOnSubmit : true,
  493. closeAfterEdit : true,
  494. onInitializeForm:function(formid) {
  495. },
  496. serializeEditData: function(postdata) {
  497. //myconsole.log(postdata);
  498. $.each(postdata,function (index, value) {
  499. //myconsole.log(index);
  500. if(index!="jqGridSkin_id" && index!="oper" && index!="id"){
  501. modifyJosnKey(postdata,index,"questionOption."+index);
  502. }
  503. if(index=="id"){
  504. postdata["questionOption."+index]=value;
  505. }
  506. })
  507. //myconsole.log(postdata);
  508. return postdata;
  509. },
  510. afterSubmit: function(r, data) {
  511. var messageString = r.responseText;
  512. var mesObj = eval('(' + messageString + ')');
  513. return [mesObj.state, mesObj.msg];
  514. },
  515. errorTextFormat : function(data) {
  516. return 'Error: ' + data.responseText;
  517. }
  518. },
  519. //options for the Add Dialog
  520. {
  521. closeAfterAdd : true,
  522. recreateForm : true,
  523. beforeSubmit: function(postdata, formid){
  524. $.each(postdata,function (index, value) {
  525. if(index!="jqGridSkin_id" && index!="oper"){
  526. modifyJosnKey(postdata,index,"questionOption."+index);
  527. }
  528. })
  529. return[true,''];
  530. },
  531. afterSubmit: function(r, data) {
  532. var messageString = r.responseText;
  533. var mesObj = eval('(' + messageString + ')');
  534. return [mesObj.state, mesObj.msg];
  535. },
  536. errorTextFormat : function(data) {
  537. return 'Error: ' + data.responseText;
  538. }
  539. },
  540. //options for the Delete Dailog
  541. {
  542. errorTextFormat : function(data) {
  543. return 'Error: ' + data.responseText;
  544. }
  545. },{
  546. // search options 这里支持多条件查询
  547. multipleSearch: true,
  548. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  549. afterSubmit: function(r, data) {
  550. var messageString = r.responseText;
  551. var mesObj = eval('(' + messageString + ')');
  552. return [mesObj.state, mesObj.message];
  553. }
  554. }
  555. );
  556. })
  557. function query(keyid){
  558. window.open("${ctx}/myconsole/questionhtml/publish?keyid="+keyid);
  559. }
  560. function analysis(keyid){
  561. window.open("${ctx}/myconsole/questionhtml/analysis?keyid="+keyid);
  562. }
  563. function exl(keyid){
  564. /* $.post("${ctx}/myconsole/questionnaire/export?keyid="+keyid,function(data){
  565. layer.alert("导出成功 ! ");
  566. }) */
  567. window.location.href="${ctx}/myconsole/questionnaire/export?keyid="+keyid;
  568. }
  569. </script>
  570. <title>我的桌面</title>
  571. </head>
  572. <body>
  573. <div class="page-container">
  574. <table id="jqGridGroup"></table>
  575. <div id="jqGridPagerGroup"></div>
  576. <div>&nbsp;</div>
  577. <table id="jqGrid"></table>
  578. <div id="jqGridPager"></div>
  579. <div>&nbsp;</div>
  580. <table id="jqGridSkin"></table>
  581. <div id="jqGridPagerSkin"></div>
  582. </div>
  583. <footer class="footer mt-20">
  584. <div class="container">
  585. <p></p>
  586. </div>
  587. </footer>
  588. </body>
  589. </html>