wtbj.js 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903
  1. $(function(){
  2. jQuery("#one").validationEngine();
  3. });
  4. var fl1=0;
  5. var fl2=0;
  6. var fl3=0;
  7. var fl4=0;
  8. var fl5=0;
  9. var fl6=0;
  10. var fl7=0;
  11. var fl8=0;
  12. var fl9=0;
  13. var fl10=0;
  14. var fl11=0;
  15. var fl12=0;
  16. var fl13=0;
  17. function getnewquestion()
  18. {
  19. showpop('addQuestion');
  20. juzhong();
  21. }
  22. //居中
  23. function juzhong()
  24. {
  25. /*设置弹窗垂直居中*/
  26. popbox=$(".popbox");
  27. for(i=0;i<popbox.length;i++)
  28. {
  29. popbox.eq(i).css("margin-top",function(){
  30. return "-"+$(this).height()/2+"px";
  31. })
  32. }
  33. }
  34. function querySubjectsByOrgId()
  35. {
  36. var params={};
  37. var session=getSession();
  38. params.OrgId=session.orgid;
  39. $.post('/WbjUI/wbj2/business/web/wtbj_querySubjectsByOrgId.do', params, function (result) {
  40. var str='<option value="">-请选择-</option>';
  41. if(result.Code==10000)
  42. {
  43. $.each(result.Result,function(i,item)
  44. {
  45. str+='<option value='+item.SubjectId+'>'+item.SubjectTitle+'</option>';
  46. })
  47. $('#myzoneselect').empty();
  48. $('#myzoneselect').append(str);
  49. }else
  50. {
  51. YihuUtil.dialog({
  52. id: 'testID',
  53. content: result.Message,
  54. lock: true,
  55. button: [
  56. {
  57. name: '确定',
  58. callback: function () {
  59. return true;
  60. },
  61. focus: true
  62. }
  63. ]
  64. });
  65. }
  66. }, "json");
  67. }
  68. //获取平台跟题库
  69. function getquestroom()
  70. {
  71. querySubjectsByOrgId();
  72. myZone();
  73. queryPlatformQuestion();
  74. showpop('chooseQuestion');
  75. var $popTabMenu1=$("#popTabMenu1");
  76. var $popTabCon1=$("#popTabCon1");
  77. $popTabMenu1.find("li").removeClass("on").end().find("li:first-child").addClass("on");
  78. $popTabCon1.find(".pop-tab-con").hide().end().find(".pop-tab-con:first-child").show();
  79. $popTabMenu1.delegate("li","click",function(){
  80. var i=$(this).index();
  81. $popTabMenu1.find("li").removeClass("on");
  82. $(this).addClass("on");
  83. $popTabCon1.find(".pop-tab-con").hide().end().find(".pop-tab-con:eq("+i+")").show();
  84. })
  85. juzhong();
  86. }
  87. //设置选项不同是的颜色变化
  88. function SetContentType(id)
  89. {
  90. $("#ContentTypetd").find("a").removeClass("c-007");
  91. $("#ContentTypetd").delegate("a","click",function(){
  92. $(this).addClass("c-007");
  93. })
  94. $("#QContentType").val(id);
  95. queryPlatformQuestion();
  96. }
  97. function SetObjType(id)
  98. {
  99. $("#ObjTypetd").find("a").removeClass("c-007");
  100. $("#ObjTypetd").delegate("a","click",function(){
  101. $(this).addClass("c-007");
  102. })
  103. $("#QObjType").val(id);
  104. queryPlatformQuestion();
  105. }
  106. function delQuest(id)
  107. {
  108. YihuUtil.dialog({
  109. id: 'testID',
  110. width: '245px',
  111. height: '109px',
  112. content: '确认要删除?',
  113. lock: true,
  114. button: [
  115. {
  116. name: '确定',
  117. callback: function () {
  118. var params={};
  119. params.QuestId=id;
  120. $.post('/WbjUI/wbj2/business/web/wtbj_delQuest.do', params, function (result) {
  121. if(result.Code==10000)
  122. {
  123. getCore();
  124. }
  125. else
  126. {
  127. YihuUtil.dialog({
  128. id: 'testID',
  129. content: result.Message,
  130. lock: true,
  131. button: [
  132. {
  133. name: '确定',
  134. callback: function () {
  135. return true;
  136. },
  137. focus: true
  138. }
  139. ]
  140. });
  141. }
  142. }, "json");
  143. return true;
  144. },
  145. focus: true
  146. },
  147. {
  148. name: '取消'
  149. }
  150. ]
  151. });
  152. }
  153. function updateSubjectend(obj)
  154. {
  155. if(uniteMessage($(obj).html(),200))
  156. {
  157. return;
  158. }
  159. var params={};
  160. var session=getSession();
  161. params.SubjectId=$('#onlySubjectId').val();
  162. params.EndingIntro=$(obj).html();
  163. params.OperatorId=session.userId;
  164. params.OperatorName=session.operatorname;
  165. $.post('/WbjUI/wbj2/business/web/wtbj_updateSubjectend.do', params, function (result) {
  166. if(result.Code==10000)
  167. {
  168. $('#end').append(result.EndingIntro);
  169. $(obj).removeClass('cont-editable').attr('contenteditable',false);
  170. }else
  171. {
  172. YihuUtil.dialog({
  173. id: 'testID',
  174. content: result.Message,
  175. lock: true,
  176. button: [
  177. {
  178. name: '确定',
  179. callback: function () {
  180. return true;
  181. },
  182. focus: true
  183. }
  184. ]
  185. });
  186. }
  187. }, "json");
  188. }
  189. function updateSubjectbegin(obj)
  190. {
  191. if(uniteMessage($(obj).html(),200))
  192. {
  193. return;
  194. }
  195. var params={};
  196. var session=getSession();
  197. params.SubjectId=$('#onlySubjectId').val();
  198. params.BeginIntro=$(obj).html();
  199. params.OperatorId=session.userId;
  200. params.OperatorName=session.operatorname;
  201. $.post('/WbjUI/wbj2/business/web/wtbj_updateSubjectbegin.do', params, function (result) {
  202. if(result.Code==10000)
  203. {
  204. $('#begin').append(result.BeginIntro);
  205. $(obj).removeClass('cont-editable').attr('contenteditable',false);
  206. }else
  207. {
  208. YihuUtil.dialog({
  209. id: 'testID',
  210. content: result.Message,
  211. lock: true,
  212. button: [
  213. {
  214. name: '确定',
  215. callback: function () {
  216. return true;
  217. },
  218. focus: true
  219. }
  220. ]
  221. });
  222. }
  223. }, "json");
  224. }
  225. function updateQuest(obj,id)
  226. {
  227. if(uniteMessage($(obj).html(),30))
  228. {
  229. return;
  230. }
  231. var params={};
  232. var session=getSession();
  233. params.QuestId=id;
  234. params.Question=$(obj).html();
  235. params.OperatorId=session.userId;
  236. params.OperatorName=session.operatorname;
  237. $(obj).removeClass('tit-editable').attr('contenteditable',false);
  238. $.post('/WbjUI/wbj2/business/web/wtbj_updateQuest.do', params, function (result) {
  239. if(result.Code==10000)
  240. {
  241. getCore();
  242. }else
  243. {
  244. YihuUtil.dialog({
  245. id: 'testID',
  246. content: result.Message,
  247. lock: true,
  248. button: [
  249. {
  250. name: '确定',
  251. callback: function () {
  252. return true;
  253. },
  254. focus: true
  255. }
  256. ]
  257. });
  258. }
  259. }, "json");
  260. }
  261. function upateItem(obj,id)
  262. {
  263. if(uniteMessage($(obj).html(),30))
  264. {
  265. return;
  266. }
  267. var params={};
  268. var session=getSession();
  269. params.ItemId=id;
  270. params.ItemCont=$(obj).html();
  271. params.OperatorId=session.userId;
  272. params.OperatorName=session.operatorname;
  273. $(obj).removeClass('answer-editable').attr('contenteditable',false);
  274. $.post('/WbjUI/wbj2/business/web/wtbj_upateItem.do', params, function (result) {
  275. if(result.Code==10000)
  276. {
  277. getCore();
  278. }else
  279. {
  280. YihuUtil.dialog({
  281. id: 'testID',
  282. content: result.Message,
  283. lock: true,
  284. button: [
  285. {
  286. name: '确定',
  287. callback: function () {
  288. return true;
  289. },
  290. focus: true
  291. }
  292. ]
  293. });
  294. }
  295. }, "json");
  296. }
  297. function getNewItem(id)
  298. {
  299. $('#'+id).show();
  300. }
  301. function newchilditem(id)
  302. {
  303. $('#'+id).show();
  304. }
  305. function addItem(obj,id)
  306. {
  307. if(uniteMessage($(obj).parent().find("input").val(),30))
  308. {
  309. return;
  310. }
  311. var params={};
  312. var session=getSession();
  313. params.QuestId=id;
  314. params.ItemCont=$(obj).parent().find("input").val();
  315. params.OperatorId=session.userId;
  316. params.OperatorName=session.operatorname;
  317. $.post('/WbjUI/wbj2/business/web/wtbj_addItem.do', params, function (result) {
  318. if(result.Code==10000)
  319. {
  320. getCore();
  321. }else
  322. {
  323. YihuUtil.dialog({
  324. id: 'testID',
  325. content: result.Message,
  326. lock: true,
  327. button: [
  328. {
  329. name: '确定',
  330. callback: function () {
  331. return true;
  332. },
  333. focus: true
  334. }
  335. ]
  336. });
  337. }
  338. }, "json");
  339. }
  340. function dellogical(obj,id)
  341. {
  342. if(id==null||id=="")
  343. {
  344. $(obj).parent().remove();
  345. }
  346. if(id!=null||id!="")
  347. {
  348. var params={};
  349. var session=getSession();
  350. params.ItemId=id;
  351. params.OperatorId=session.userId;
  352. params.OperatorName=session.operatorname;
  353. $.post('/WbjUI/wbj2/business/web/wtbj_delQuestionFlow.do', params, function (result) {
  354. if(result.Code==10000)
  355. {
  356. $(obj).parent().remove();
  357. }else
  358. {
  359. YihuUtil.dialog({
  360. id: 'testID',
  361. content: result.Message,
  362. lock: true,
  363. button: [
  364. {
  365. name: '确定',
  366. callback: function () {
  367. return true;
  368. },
  369. focus: true
  370. }
  371. ]
  372. });
  373. }
  374. }, "json");
  375. }
  376. }
  377. function getlogicalSetting(obj,Questid)
  378. {
  379. $('#logicalQuestid').val(Questid);
  380. // 清除缓存
  381. $("div").removeData("keyitem");
  382. $("div").removeData("keyvalue");
  383. $('#jumpdiv').empty();
  384. $('#jumpbutton').empty();
  385. getquestItemforlogical(Questid);
  386. getnextQuestforlogical(obj);
  387. showpop('logicalSetting');
  388. //alert($(obj).parent().parent().parent().find("span:first").html());
  389. //alert($(obj).parent().parent().parent().attr("sortquestid"));
  390. var Qparams={};
  391. Qparams.QuestId=Questid;
  392. str='';
  393. $.ajax({url:'/WbjUI/wbj2/business/web/wtbj_queryQuestionFlow.do',async:false,type:"post", data: Qparams, success:function (result) {
  394. if(result.Code==10000)
  395. {
  396. $.each(result.Result,function(i,item)
  397. {
  398. str+='<div class="mt25"><label style="width:45px;">选中:</label>';
  399. str+='<select onchange="nextQuest()" class="pop-sel" style="width:140px">';
  400. var p={};
  401. p.QuestId=Questid;
  402. $.ajax({url:'/WbjUI/wbj2/business/web/wtbj_queryQuestionItem.do',async:false,type:"post", data: Qparams, success:function (result) {
  403. if(result.Code==10000)
  404. {
  405. $.each(result.Result,function(k,it)
  406. {
  407. //跳转选项
  408. if(item.ItemId==it.ItemId)
  409. {
  410. str+='<option selected value='+it.ItemId+'>'+it.ItemCont+'</option>';
  411. }else
  412. {
  413. str+='<option value='+it.ItemId+'>'+it.ItemCont+'</option>';
  414. }
  415. });
  416. }
  417. else
  418. {
  419. YihuUtil.dialog({
  420. id: 'testID',
  421. content: result.Message,
  422. lock: true,
  423. button: [
  424. {
  425. name: '确定',
  426. callback: function () {
  427. return true;
  428. },
  429. focus: true
  430. }
  431. ]
  432. });
  433. }
  434. }, dataType:"json"});
  435. str+='</select>';
  436. str+='<label style="width:60px;">跳转至:</label>';
  437. str+='<select class="pop-sel" style="width:140px">';
  438. var divs=$(obj).parent().parent().parent().parent().children('div'),
  439. len=$(obj).parent().parent().parent().parent().children('div').length;
  440. objdiv=$(obj).parent().parent().parent(),
  441. objindex=divs.index(objdiv);
  442. for(var m=0;m<len;m++)
  443. {
  444. if(m>objindex)
  445. {
  446. //跳转问题
  447. if(item.NextQuestId==divs.eq(m).attr("sortquestid"))
  448. {
  449. str+='<option selected value='+divs.eq(m).attr("sortquestid")+'>'+divs.eq(m).find("span:first").html()+'</option>';
  450. }
  451. else
  452. {
  453. str+='<option value='+divs.eq(m).attr("sortquestid")+'>'+divs.eq(m).find("span:first").html()+'</option>';
  454. }
  455. }
  456. }
  457. if(item.NextQuestId=="10")
  458. {
  459. str+='<option selected value="10">结束(计入结果)</option>';
  460. }else
  461. {
  462. str+='<option value="10">结束(计入结果)</option>';
  463. }
  464. if(item.NextQuestId=="11")
  465. {
  466. str+=' <option selected value="11">结束(不计入结果)</option>';
  467. }else
  468. {
  469. str+=' <option value="11">结束(不计入结果)</option>';
  470. }
  471. str+='</select><a class="ml10" onclick=dellogical(this,"'+item.ItemId+'") href="javascript:;"><img src="../../common/themes/default/images/nav-gb.png" /></a></div>';
  472. })
  473. $('#jumpdiv').append(str);
  474. $('#jumpbutton').append('<div class="mt25"><a href="javascript:;" onclick=getJump() class="c-007">添加跳转条件</a></div>');
  475. juzhong();
  476. }else
  477. {
  478. YihuUtil.dialog({
  479. id: 'testID',
  480. content: result.Message,
  481. lock: true,
  482. button: [
  483. {
  484. name: '确定',
  485. callback: function () {
  486. return true;
  487. },
  488. focus: true
  489. }
  490. ]
  491. });
  492. }
  493. }, dataType:"json"});
  494. }
  495. //获取逻辑跳转的前面选项
  496. function getquestItemforlogical(Questid)
  497. {
  498. var itemQ='';
  499. var p={};
  500. p.QuestId=Questid;
  501. $.post('/WbjUI/wbj2/business/web/wtbj_queryQuestionItem.do', p, function (result) {
  502. if(result.Code==10000)
  503. {
  504. $.each(result.Result,function(i,it)
  505. {
  506. itemQ+='<option value='+it.ItemId+'>'+it.ItemCont+'</option>';
  507. });
  508. // alert(itemQ);
  509. $("div").data("keyitem",itemQ);
  510. var a='aa';
  511. }else
  512. {
  513. YihuUtil.dialog({
  514. id: 'testID',
  515. content: result.Message,
  516. lock: true,
  517. button: [
  518. {
  519. name: '确定',
  520. callback: function () {
  521. return true;
  522. },
  523. focus: true
  524. }
  525. ]
  526. });
  527. }
  528. }, "json");
  529. }
  530. //获取逻辑跳转的后面选项
  531. function getnextQuestforlogical(obj)
  532. {
  533. var valueQ='';
  534. var divs=$(obj).parent().parent().parent().parent().children('div'),
  535. len=$(obj).parent().parent().parent().parent().children('div').length;
  536. objdiv=$(obj).parent().parent().parent(),
  537. objindex=divs.index(objdiv);
  538. for(var m=0;m<len;m++)
  539. {
  540. if(m>objindex)
  541. {
  542. valueQ+='<option value='+divs.eq(m).attr("sortquestid")+'>'+divs.eq(m).find("span:first").html()+'</option>';
  543. }
  544. }
  545. valueQ+='<option value="10">结束(计入结果)</option><option value="11">结束(不计入结果)</option>';
  546. // alert(valueQ);
  547. $("div").data("keyvalue",valueQ);
  548. }
  549. //显示逻辑跳转页面
  550. function getJump()
  551. {
  552. if($("div").data("keyitem")==null||$("div").data("keyitem")==undefined)
  553. {
  554. }
  555. str='';
  556. str+='<div class=""><label style="width:45px;">选中:</label>';
  557. str+='<select class="pop-sel" style="width:140px">';
  558. str+=$("div").data("keyitem");
  559. str+='</select>';
  560. str+='<label style="width:60px;">跳转至:</label>';
  561. str+='<select class="pop-sel" style="width:140px">';
  562. str+=$("div").data("keyvalue")
  563. str+='</select><a class="ml10" onclick=dellogical(this,"") href="javascript:;"><img src="../../common/themes/default/images/nav-gb.png" /></a></div>';
  564. $("#jumpdiv").append(str);
  565. }
  566. //添加逻辑跳转
  567. function addJump()
  568. {
  569. var divs=$("#jumpdiv").children('div');
  570. var len=$("#jumpdiv").children('div').length;
  571. var ids = [];
  572. var tag=false;
  573. for(var i=0;i<len;i++)
  574. {
  575. ids.push(divs.eq(i).find("select:first").val());
  576. }
  577. var str=ids.join(",")+",";
  578. for(var i = 0; i < ids.length; i++)
  579. {
  580. if(str.replace(ids[i] + ",", "").indexOf(ids[i] +",") > -1)
  581. {
  582. tag=true;
  583. break;
  584. }
  585. }
  586. if(tag)
  587. {
  588. var msg="选项有重复!!"
  589. Commonjs.alert(msg);
  590. return;
  591. }
  592. for(var i=0;i<len;i++)
  593. {
  594. var delparams={};
  595. delparams.ItemId=divs.eq(i).find("select:first").val();
  596. $.ajax({url:'/WbjUI/wbj2/business/web/wtbj_delQuestionFlow.do',async:false,type:"post", data: delparams, success:function (result) {
  597. if(result.Code==10000)
  598. {
  599. }
  600. else
  601. {
  602. YihuUtil.dialog({
  603. id: 'testID',
  604. content: result.Message,
  605. lock: true,
  606. button: [
  607. {
  608. name: '确定',
  609. callback: function () {
  610. return true;
  611. },
  612. focus: true
  613. }
  614. ]
  615. });
  616. }
  617. }, dataType:"json"});
  618. }
  619. for(var i=0;i<len;i++)
  620. {
  621. //alert(divs.eq(i).find("select:eq(0)").val());
  622. //alert(divs.eq(i).find("select:eq(1)").val());
  623. var p={};
  624. var session=getSession();
  625. p.ItemId=divs.eq(i).find("select:eq(0)").val();
  626. p.NextQuestId=divs.eq(i).find("select:eq(1)").val();
  627. p.OperatorId=session.userId;
  628. p.OperatorName=session.operatorname;
  629. $.ajax({url:'/WbjUI/wbj2/business/web/wtbj_addQuestionFlow.do',async:false,type:"post", data: p, success:function (result) {
  630. if(result.Code==10000)
  631. {
  632. }else
  633. {
  634. YihuUtil.dialog({
  635. id: 'testID',
  636. content: result.Message,
  637. lock: true,
  638. button: [
  639. {
  640. name: '确定',
  641. callback: function () {
  642. return true;
  643. },
  644. focus: true
  645. }
  646. ]
  647. });
  648. }
  649. },dataType:"json"});
  650. }
  651. getCore();
  652. closepop('logicalSetting');
  653. }
  654. //增加一行
  655. function addMatrQuest(obj,id)
  656. {
  657. if(uniteMessage($(obj).parent().find("input").val(),30))
  658. {
  659. return;
  660. }
  661. var Qparams={};
  662. Qparams.QuestId=id;
  663. $.post('/WbjUI/wbj2/business/web/wtbj_queryQuestion.do', Qparams, function (result) {
  664. if(result.Code==10000)
  665. {
  666. var params={};
  667. var session=getSession();
  668. params.SubjectId=result.SubjectId;
  669. params.ObjType=result.ObjType;
  670. params.ContentType=result.ContentType;
  671. params.QuestType=result.QuestType;
  672. params.MatrixQuestId=id;
  673. params.Question=$(obj).parent().find("input").val();
  674. params.OperatorId=session.userId;
  675. params.OperatorName=session.operatorname;
  676. var a= $(obj).parent().parent().find('table').first().find('tbody').find('tr').first().find('td').length;
  677. var b=$(obj).parent().parent().find('table').first().find('tbody').find('tr').first().find('td');
  678. $.post('/WbjUI/wbj2/business/web/wtbj_addQuestion.do', params, function (result) {
  679. if(result.Code==10000)
  680. {
  681. for(var i=1;i<a;i++)
  682. {
  683. var par={};
  684. par.QuestId=result.QuestId;
  685. par.ItemCont=b.eq(i).find("span").html();
  686. par.OperatorId=session.userId;
  687. par.OperatorName=session.operatorname;
  688. $.post('/WbjUI/wbj2/business/web/wtbj_addItem.do', par, function (result) {
  689. if(result.Code==10000)
  690. {
  691. }
  692. else
  693. {
  694. YihuUtil.dialog({
  695. id: 'testID',
  696. content: result.Message,
  697. lock: true,
  698. button: [
  699. {
  700. name: '确定',
  701. callback: function () {
  702. return true;
  703. },
  704. focus: true
  705. }
  706. ]
  707. });
  708. }
  709. }, "json");
  710. }
  711. getCore();
  712. }else
  713. {
  714. YihuUtil.dialog({
  715. id: 'testID',
  716. content: result.Message,
  717. lock: true,
  718. button: [
  719. {
  720. name: '确定',
  721. callback: function () {
  722. return true;
  723. },
  724. focus: true
  725. }
  726. ]
  727. });
  728. }
  729. }, "json");
  730. }else
  731. {
  732. YihuUtil.dialog({
  733. id: 'testID',
  734. content: result.Message,
  735. lock: true,
  736. button: [
  737. {
  738. name: '确定',
  739. callback: function () {
  740. return true;
  741. },
  742. focus: true
  743. }
  744. ]
  745. });
  746. }
  747. }, "json");
  748. }
  749. //增加一列
  750. function addMatrItem(obj)
  751. {
  752. if(uniteMessage($(obj).parent().find("input").val(),30))
  753. {
  754. return;
  755. }
  756. var t= $(obj).parent().parent().find('table').first().find('tr');
  757. var a= $(obj).parent().parent().find('table').first().find('tr').length;
  758. for(var i=1;i<a;i++)
  759. {
  760. var params={};
  761. var session=getSession();
  762. params.QuestId=t.eq(i).find('td:first').find("a[quesid]").attr("quesid");
  763. params.ItemCont=$(obj).parent().find("input").val();
  764. params.OperatorId=session.userId;
  765. params.OperatorName=session.operatorname;
  766. $.ajax({url:'/WbjUI/wbj2/business/web/wtbj_addItem.do',async:false,type:"post", data: params, success:function (result) {
  767. if(result.Code==10000)
  768. {
  769. }
  770. else
  771. {
  772. YihuUtil.dialog({
  773. id: 'testID',
  774. content: result.Message,
  775. lock: true,
  776. button: [
  777. {
  778. name: '确定',
  779. callback: function () {
  780. return true;
  781. },
  782. focus: true
  783. }
  784. ]
  785. });
  786. }
  787. }, dataType:"json"});
  788. }
  789. getCore();
  790. }
  791. //删除一列
  792. function delcol(v)
  793. {
  794. var trlen=$(v).parent().parent().parent().find('tr').length;
  795. var trlist=$(v).parent().parent().parent().find('tr');
  796. var thistd=$(v).parent();
  797. var tdlist=$(v).parent().parent().find('td');
  798. _tdindex=tdlist.index(thistd);
  799. for (var i = 0; i < trlen; i++)
  800. {
  801. if(i>0)
  802. {
  803. var itemid=trlist.eq(i).find("td").eq(_tdindex).find("input[itemid]").attr("itemid");
  804. // trlist.eq(i).find("td").eq(_tdindex).remove();
  805. var params={};
  806. params.ItemId=itemid;
  807. $.post('/WbjUI/wbj2/business/web/wtbj_deleteQuestionItem.do', params, function (result) {
  808. if(result.Code==10000)
  809. {
  810. }
  811. else
  812. {
  813. YihuUtil.dialog({
  814. id: 'testID',
  815. content: result.Message,
  816. lock: true,
  817. button: [
  818. {
  819. name: '确定',
  820. callback: function () {
  821. return true;
  822. },
  823. focus: true
  824. }
  825. ]
  826. });
  827. }
  828. }, "json");
  829. }
  830. }
  831. getCore();
  832. }
  833. //删除一行
  834. function delrow(v)
  835. {
  836. var trlen=$(v).parent().parent().parent().find('tr').length;
  837. if(trlen<=2)
  838. {
  839. var msg="至少得有一项";
  840. Commonjs.alert(msg);
  841. return;
  842. }
  843. var quesid=$(v).parent().find("a[quesid]").attr("quesid");
  844. // alert(quesid);
  845. // $(v).parent().parent().remove();
  846. var params={};
  847. params.QuestId=quesid;
  848. $.post('/WbjUI/wbj2/business/web/wtbj_deleteQuestion.do', params, function (result) {
  849. if(result.Code==10000)
  850. {
  851. getCore();
  852. }
  853. else
  854. {
  855. YihuUtil.dialog({
  856. id: 'testID',
  857. content: result.Message,
  858. lock: true,
  859. button: [
  860. {
  861. name: '确定',
  862. callback: function () {
  863. return true;
  864. },
  865. focus: true
  866. }
  867. ]
  868. });
  869. }
  870. }, "json");
  871. }
  872. function delMatrixQuest(id)
  873. {
  874. YihuUtil.dialog({
  875. id: 'testID',
  876. width: '245px',
  877. height: '109px',
  878. content: '确认要删除?',
  879. lock: true,
  880. button: [
  881. {
  882. name: '确定',
  883. callback: function () {
  884. var params={};
  885. params.QuestId=id;
  886. $.post('/WbjUI/wbj2/business/web/wtbj_matdeleteQuestion.do', params, function (result) {
  887. if(result.Code==10000)
  888. {
  889. getCore();
  890. }
  891. else
  892. {
  893. YihuUtil.dialog({
  894. id: 'testID',
  895. content: result.Message,
  896. lock: true,
  897. button: [
  898. {
  899. name: '确定',
  900. callback: function () {
  901. return true;
  902. },
  903. focus: true
  904. }
  905. ]
  906. });
  907. }
  908. }, "json");
  909. return true;
  910. },
  911. focus: true
  912. },
  913. {
  914. name: '取消'
  915. }
  916. ]
  917. });
  918. }
  919. function Qup(obj,id)
  920. {
  921. var _divs=$(obj).parent().parent().parent().parent().children("div"),
  922. _div=$(obj).parent().parent().parent(),
  923. _divindex = _divs.index(_div);
  924. if(_divindex>0)
  925. {
  926. var session=getSession();
  927. var params={};
  928. params.OperatorName=session.operatorname;
  929. params.OperatorId=session.userId;
  930. params.QuestId1=id;
  931. params.QuestId2= _divs.eq(_divindex-1).attr("sortquestid");
  932. $.post('/WbjUI/wbj2/business/web/wtbj_exchangeQuestionSort.do', params, function (result) {
  933. if(result.Code==10000)
  934. {
  935. getCore();
  936. }
  937. else
  938. {
  939. YihuUtil.dialog({
  940. id: 'testID',
  941. content: result.Message,
  942. lock: true,
  943. button: [
  944. {
  945. name: '确定',
  946. callback: function () {
  947. return true;
  948. },
  949. focus: true
  950. }
  951. ]
  952. });
  953. }
  954. }, "json");
  955. }
  956. }
  957. function Qdown(obj,id)
  958. {
  959. var _divs=$(obj).parent().parent().parent().parent().children("div"),
  960. _div=$(obj).parent().parent().parent(),
  961. _divindex = _divs.index(_div);
  962. if(_divindex<_divs.length-1)
  963. {
  964. var session=getSession();
  965. var params={};
  966. params.OperatorName=session.operatorname;
  967. params.OperatorId=session.userId;
  968. params.QuestId1=id;
  969. params.QuestId2= _divs.eq(_divindex+1).attr("sortquestid");
  970. $.post('/WbjUI/wbj2/business/web/wtbj_exchangeQuestionSort.do', params, function (result) {
  971. if(result.Code==10000)
  972. {
  973. getCore();
  974. }
  975. else
  976. {
  977. YihuUtil.dialog({
  978. id: 'testID',
  979. content: result.Message,
  980. lock: true,
  981. button: [
  982. {
  983. name: '确定',
  984. callback: function () {
  985. return true;
  986. },
  987. focus: true
  988. }
  989. ]
  990. });
  991. }
  992. }, "json");
  993. }
  994. }
  995. function delItem(id)
  996. {
  997. var params={};
  998. params.ItemId=id;
  999. $.post('/WbjUI/wbj2/business/web/wtbj_deleteQuestionItem.do', params, function (result) {
  1000. if(result.Code==10000)
  1001. {
  1002. getCore();
  1003. }
  1004. else
  1005. {
  1006. YihuUtil.dialog({
  1007. id: 'testID',
  1008. content: result.Message,
  1009. lock: true,
  1010. button: [
  1011. {
  1012. name: '确定',
  1013. callback: function () {
  1014. return true;
  1015. },
  1016. focus: true
  1017. }
  1018. ]
  1019. });
  1020. }
  1021. }, "json");
  1022. }
  1023. function hiddenItem(obj,id)
  1024. {
  1025. $(obj).parent().find("input:first").val('');
  1026. closepop(id);
  1027. }
  1028. function getCore()
  1029. {
  1030. fl1=0;
  1031. fl2=0;
  1032. fl3=0;
  1033. fl4=0;
  1034. fl5=0;
  1035. fl6=0;
  1036. fl7=0;
  1037. fl8=0;
  1038. fl9=0;
  1039. fl10=0;
  1040. fl11=0;
  1041. fl12=0;
  1042. fl13=0;
  1043. $('#zhibiaoul').empty();
  1044. $('#core').empty();
  1045. $('#begin').empty();
  1046. $('#end').empty();
  1047. var params={};
  1048. params.SubjectId=$('#onlySubjectId').val();
  1049. $.post('/WbjUI/wbj2/business/web/wtbj_querySubjectById.do', params, function (result) {
  1050. if(result.Code==10000)
  1051. {
  1052. $('#begin').append(result.BeginIntro);
  1053. $('#end').append(result.EndingIntro);
  1054. if(result.SubjectTitle.length<15)
  1055. {
  1056. $('#twosubjecttitle').html(result.SubjectTitle);
  1057. $('#foursubjecttitle').html(result.SubjectTitle);
  1058. }else
  1059. {
  1060. $('#twosubjecttitle').html(result.SubjectTitle.substring(0,15)+'...');
  1061. $('#foursubjecttitle').html(result.SubjectTitle.substring(0,15)+'...');
  1062. }
  1063. if(result.Result.length>0)
  1064. {
  1065. var str='';
  1066. $.each(result.Result,function(i,item)
  1067. {
  1068. countContentType(item.ContentType);
  1069. if(item.QuestType==1)
  1070. {
  1071. var count=i+1;
  1072. str+='<div SortQuestId="'+item.QuestId+'" class="myd-box-gray mt15"> <div class="pl15 myd-gray-tit relative hidden"><strong class="fl"><span>Q'+count+'</span><span class="c-org">【'+zhibiao(item.ContentType)+'】</span></strong>';
  1073. str+='<span id="q'+count+'Tit" class=" fl q-tit" contenteditable="false" onblur=updateQuest(this,"'+item.QuestId+'")>'+item.Question+'</span>';
  1074. str+='<div class="absolute" style="right:13px; top:8px; font-size:0;"><a href="javascript:;" onclick=Qup(this,"'+item.QuestId+'") class="sort-up"></a><a href="javascript:;" onclick=Qdown(this,"'+item.QuestId+'") class="ml10 sort-down"></a><a href="javascript:;" class="ml10 btn-edit" onclick="$(\'#q'+count+'Tit\').attr(\'contenteditable\',true).focus().select().addClass(\'tit-editable\')"></a></div></div>';
  1075. str+='<div class="myd-gray-con"><div class="mt5"><ul>';
  1076. $.each(item.SvQuestionItems,function(i,qitem)
  1077. {
  1078. str+='<li><span class="valign-m w100"><input type="radio" name="q2answer" class="valign-m" style="width:13px;" /><span id="item'+qitem.ItemId+'" class="answer-txt" contenteditable="false"';
  1079. str+='onblur=upateItem(this,"'+qitem.ItemId+'")>'+qitem.ItemCont+'</span></span>';
  1080. str+='<a href="javascript:;" class="ml25 btn-edit" onclick="$(\'#item'+qitem.ItemId+'\').attr(\'contenteditable\',true).focus().select().addClass(\'answer-editable\')"></a> <a class="ml10" onclick=delItem("'+qitem.ItemId+'") href="javascript:;"><img src="../../common/themes/default/images/nav-gb.png" /></a></li>';
  1081. })
  1082. str+=' </ul></div>';
  1083. str+='<div id="newitem'+item.QuestId+'" style="display:none" class="mt15"><input type="text" class="inp-txt" style="width:300px;" placeholder="请输入选项内容" /><input type="button" class="ml10 btn-blue" onclick=addItem(this,'+item.QuestId+') value="确认" /><a href="javascript:;" onclick=hiddenItem(this,"newitem'+item.QuestId+'") class="ml5 btn-gray-s">取消</a></div>';
  1084. str+='<div class="mt20"><a href="javascript:;" onclick=getNewItem("newitem'+item.QuestId+'") class="btn-gray-l">增加选项</a><a href="javascript:;" onclick=getlogicalSetting(this,"'+item.QuestId+'") class="ml15 btn-gray-l">设置逻辑</a><a href="javascript:;" onclick=delQuest("'+item.QuestId+'") class="ml15 btn-gray-l c-org">删除题目</a></div>';
  1085. str+='</div></div>';
  1086. }
  1087. if(item.QuestType==2)
  1088. {
  1089. var count=i+1;
  1090. str+='<div SortQuestId="'+item.QuestId+'" class="myd-box-gray mt15"> <div class="pl15 myd-gray-tit relative hidden"><strong class="fl"><span>Q'+count+'</span><span class="c-org">【'+zhibiao(item.ContentType)+'】</span></strong>';
  1091. str+='<span id="q'+count+'Tit" class=" fl q-tit" contenteditable="false" onblur=updateQuest(this,"'+item.QuestId+'")>'+item.Question+'</span>';
  1092. str+='<div class="absolute" style="right:13px; top:8px; font-size:0;"><a href="javascript:;" onclick=Qup(this,"'+item.QuestId+'") class="sort-up"></a><a href="javascript:;" onclick=Qdown(this,"'+item.QuestId+'") class="ml10 sort-down"></a><a href="javascript:;" class="ml10 btn-edit" onclick="$(\'#q'+count+'Tit\').attr(\'contenteditable\',true).focus().select().addClass(\'tit-editable\')"></a></div></div>';
  1093. str+='<div class="myd-gray-con"><div class="mt5"><ul>';
  1094. $.each(item.SvQuestionItems,function(i,qitem)
  1095. {
  1096. str+='<li><span class="valign-m w100"><input type="checkbox" name="q2answer" class="valign-m" style="width:13px;" /><span id="item'+qitem.ItemId+'" class="answer-txt" contenteditable="false"';
  1097. str+='onblur=upateItem(this,"'+qitem.ItemId+'")>'+qitem.ItemCont+'</span></span>';
  1098. str+='<a href="javascript:;" class="ml25 btn-edit" onclick="$(\'#item'+qitem.ItemId+'\').attr(\'contenteditable\',true).focus().select().addClass(\'answer-editable\')"></a><a class="ml10" style="margin-top:5px" onclick=delItem("'+qitem.ItemId+'") href="javascript:;"><img src="../../common/themes/default/images/nav-gb.png" /></a> </li>';
  1099. })
  1100. str+=' </ul></div>';
  1101. str+='<div id="newitem'+item.QuestId+'" style="display:none" class="mt15"><input type="text" class="inp-txt" style="width:300px;" placeholder="请输入选项内容" /><input type="button" class="ml10 btn-blue" onclick=addItem(this,'+item.QuestId+') value="确认" /><a href="javascript:;" onclick=hiddenItem(this,"newitem'+item.QuestId+'") class="ml5 btn-gray-s">取消</a></div>';
  1102. str+='<div class="mt20"><a href="javascript:;" onclick=getNewItem("newitem'+item.QuestId+'") class="ml5 btn-gray-s">增加选项</a><a href="javascript:;" onclick=delQuest("'+item.QuestId+'") class="ml15 btn-gray-l c-org">删除题目</a></div>';
  1103. str+='</div></div>';
  1104. }
  1105. if(item.QuestType==3)
  1106. {
  1107. var count=i+1;
  1108. str+='<div SortQuestId="'+item.QuestId+'" class="myd-box-gray mt15"> <div class="pl15 myd-gray-tit relative hidden"><strong class="fl"><span>Q'+count+'</span><span class="c-org">【'+zhibiao(item.ContentType)+'】</span></strong>';
  1109. str+='<span id="q'+count+'Tit" class=" fl q-tit" contenteditable="false" onblur=updateQuest(this,"'+item.QuestId+'")>'+item.Question+'</span>';
  1110. str+='<div class="absolute" style="right:13px; top:8px; font-size:0;"><a href="javascript:;" onclick=Qup(this,"'+item.QuestId+'") class="sort-up"></a><a href="javascript:;" onclick=Qdown(this,"'+item.QuestId+'") class="ml10 sort-down"></a><a href="javascript:;" class="ml10 btn-edit" onclick="$(\'#q'+count+'Tit\').attr(\'contenteditable\',true).focus().select().addClass(\'tit-editable\')"></a></div></div>';
  1111. str+='<div class="myd-gray-con"><div class="mt5"><textarea class="p5 inp-txtarea" style="width:520px;"></textarea></div><div class="mt20"><a href="javascript:;" onclick=delQuest("'+item.QuestId+'") class="ml15 btn-gray-l c-org">删除题目</a></div>';
  1112. str+='</div></div>';
  1113. }
  1114. if(item.QuestType==4)
  1115. {
  1116. var count=i+1;
  1117. str+='<div SortQuestId="'+item.QuestId+'" class="myd-box-gray mt15"> <div class="pl15 myd-gray-tit relative hidden"><strong class="fl"><span>Q'+count+'</span><span class="c-org">【'+zhibiao(item.ContentType)+'】</span></strong>';
  1118. str+='<span id="q'+count+'Tit" class=" fl q-tit" contenteditable="false" onblur=updateQuest(this,"'+item.QuestId+'")>'+item.Question+'</span>';
  1119. str+='<div class="absolute" style="right:13px; top:8px; font-size:0;"><a href="javascript:;" onclick=Qup(this,"'+item.QuestId+'") class="sort-up"></a><a href="javascript:;" onclick=Qdown(this,"'+item.QuestId+'") class="ml10 sort-down"></a><a href="javascript:;" class="ml10 btn-edit" onclick="$(\'#q'+count+'Tit\').attr(\'contenteditable\',true).focus().select().addClass(\'tit-editable\')"></a></div></div>';
  1120. str+='<div class="myd-gray-con"><table class="tb-sjtj" width="100%">';
  1121. str+='<tr><td class="thead-1">子项</td>';
  1122. $.each(item.ChildrenMatrixQuestion[0].MatrixQuestItems,function(i,marxitem)
  1123. {
  1124. str+='<td class="thead-1"><span>'+marxitem.ItemCont+'</span> <a href="javascript:;" onclick="delcol(this)"><img src="../../common/themes/default/images/nav-gb.png" /></a></td>';
  1125. })
  1126. str+='</tr>';
  1127. $.each(item.ChildrenMatrixQuestion,function(i,mquest)
  1128. {
  1129. str+='<tr><td>'+mquest.Question+' <a href="javascript:;" quesid='+mquest.QuestId+' onclick="delrow(this)"><img src="../../common/themes/default/images/nav-gb.png" /></a></td>';
  1130. $.each(mquest.MatrixQuestItems,function(i,cmarxitem)
  1131. {
  1132. str+='<td><input type="radio" itemid='+cmarxitem.ItemId+' name="fwtd" /></td>';
  1133. });
  1134. str+='</tr>';
  1135. })
  1136. str+='</table>';
  1137. str+='<div id="newitem'+item.QuestId+'" style="display:none" class="mt15"><input type="text" class="inp-txt" style="width:300px;" placeholder="请输入子项内容" /><input type="button" class="ml10 btn-blue" onclick=addMatrQuest(this,"'+item.QuestId+'") value="确认" /><a href="javascript:;" onclick=hiddenItem(this,"newitem'+item.QuestId+'") class="ml5 btn-gray-s">取消</a></div>';
  1138. str+='<div id="newchilditem'+item.QuestId+'" style="display:none" class="mt15"><input type="text" class="inp-txt" style="width:300px;" placeholder="请输入选项内容" /><input type="button" class="ml10 btn-blue" onclick=addMatrItem(this,"'+item.QuestId+'") value="确认" /><a href="javascript:;" onclick=hiddenItem(this,"newchilditem'+item.QuestId+'") class="ml5 btn-gray-s">取消</a></div>';
  1139. str+=' <div class="mt20"><a href="javascript::" onclick=getNewItem("newitem'+item.QuestId+'") class="ml5 btn-gray-s">增加子项</a><a href="javascript:;"onclick=newchilditem("newchilditem'+item.QuestId+'") class="ml15 btn-gray-l">增加选项</a><a href="javascript:;" onclick=delMatrixQuest("'+item.QuestId+'") class="ml15 btn-gray-l c-org">删除题目</a></div></div></div>';
  1140. }
  1141. if(item.QuestType==5)
  1142. {
  1143. var count=i+1;
  1144. str+='<div SortQuestId="'+item.QuestId+'" class="myd-box-gray mt15"> <div class="pl15 myd-gray-tit relative hidden"><strong class="fl"><span>Q'+count+'</span><span class="c-org">【'+zhibiao(item.ContentType)+'】</span></strong>';
  1145. str+='<span id="q'+count+'Tit" class=" fl q-tit" contenteditable="false" onblur=updateQuest(this,"'+item.QuestId+'")>'+item.Question+'</span>';
  1146. str+='<div class="absolute" style="right:13px; top:8px; font-size:0;"><a href="javascript:;" onclick=Qup(this,"'+item.QuestId+'") class="sort-up"></a><a href="javascript:;" onclick=Qdown(this,"'+item.QuestId+'") class="ml10 sort-down"></a><a href="javascript:;" class="ml10 btn-edit" onclick="$(\'#q'+count+'Tit\').attr(\'contenteditable\',true).focus().select().addClass(\'tit-editable\')"></a></div></div>';
  1147. str+='<div class="myd-gray-con"><table class="tb-sjtj" width="100%">';
  1148. str+='<tr><td class="thead-1">子项</td>';
  1149. $.each(item.ChildrenMatrixQuestion[0].MatrixQuestItems,function(i,marxitem)
  1150. {
  1151. str+='<td class="thead-1"><span>'+marxitem.ItemCont+'</span> <a href="javascript:;" onclick="delcol(this)"><img src="../../common/themes/default/images/nav-gb.png" /></a></td>';
  1152. })
  1153. str+='</tr>';
  1154. $.each(item.ChildrenMatrixQuestion,function(i,mquest)
  1155. {
  1156. str+='<tr><td>'+mquest.Question+' <a href="javascript:;" quesid='+mquest.QuestId+' onclick="delrow(this)"><img src="../../common/themes/default/images/nav-gb.png" /></a></td>';
  1157. $.each(mquest.MatrixQuestItems,function(i,cmarxitem)
  1158. {
  1159. str+='<td><input type="checkbox" itemid='+cmarxitem.ItemId+' name="fwtd" /></td>';
  1160. });
  1161. str+='</tr>';
  1162. })
  1163. str+='</table>';
  1164. str+='<div id="newitem'+item.QuestId+'" style="display:none" class="mt15"><input type="text" class="inp-txt" style="width:300px;" placeholder="请输入子项内容" /><input type="button" class="ml10 btn-blue" onclick=addMatrQuest(this,"'+item.QuestId+'") value="确认" /><a href="javascript:;" onclick=hiddenItem(this,"newitem'+item.QuestId+'") class="ml5 btn-gray-s">取消</a></div>';
  1165. str+='<div id="newchilditem'+item.QuestId+'" style="display:none" class="mt15"><input type="text" class="inp-txt" style="width:300px;" placeholder="请输入选项内容" /><input type="button" class="ml10 btn-blue" onclick=addMatrItem(this,"'+item.QuestId+'") value="确认" /><a href="javascript:;" onclick=hiddenItem(this,"newchilditem'+item.QuestId+'") class="ml5 btn-gray-s">取消</a></div>';
  1166. str+=' <div class="mt20"><a href="javascript::" onclick=getNewItem("newitem'+item.QuestId+'") class="ml5 btn-gray-s">增加子项</a><a href="javascript:;"onclick=newchilditem("newchilditem'+item.QuestId+'") class="ml15 btn-gray-l">增加选项</a><a href="javascript:;" onclick=delMatrixQuest("'+item.QuestId+'") class="ml15 btn-gray-l c-org">删除题目</a></div></div></div>';
  1167. }
  1168. });
  1169. $('#ifnoQuest').hide();
  1170. showContentType();
  1171. $('#core').append(str);
  1172. }else
  1173. {
  1174. $('#ifnoQuest').show();
  1175. }
  1176. }else
  1177. {
  1178. YihuUtil.dialog({
  1179. id: 'testID',
  1180. content: result.Message,
  1181. lock: true,
  1182. button: [
  1183. {
  1184. name: '确定',
  1185. callback: function () {
  1186. return true;
  1187. },
  1188. focus: true
  1189. }
  1190. ]
  1191. });
  1192. }
  1193. }, "json");
  1194. }
  1195. function myZone()
  1196. {
  1197. $('#getmyzone').empty();
  1198. var params={};
  1199. var session=getSession();
  1200. params.OrgID=session.orgid;
  1201. $.post('/WbjUI/wbj2/business/web/wtbj_myZone.do', params, function (result) {
  1202. if(result.Code==10000)
  1203. {
  1204. var str='';
  1205. $.each(result.Result,function(i,item)
  1206. {
  1207. str+='<li><input name="myzonecheckbox" type="checkbox" value='+item.QuestId+' />'+item.Question+'</li>';
  1208. });
  1209. $('#getmyzone').append(str);
  1210. }else
  1211. {
  1212. YihuUtil.dialog({
  1213. id: 'testID',
  1214. content: result.Message,
  1215. lock: true,
  1216. button: [
  1217. {
  1218. name: '确定',
  1219. callback: function () {
  1220. return true;
  1221. },
  1222. focus: true
  1223. }
  1224. ]
  1225. });
  1226. }
  1227. }, "json");
  1228. }
  1229. function insertQuest()
  1230. {
  1231. var params={};
  1232. var session=getSession();
  1233. params.ContentType=$('#ContentType').val();
  1234. params.ObjType=$('#ObjType').val();
  1235. params.QuestType=$('#QuestType').val();
  1236. params.SubjectId=$('#onlySubjectId').val();
  1237. params.OperatorID=session.userId;
  1238. params.OperatorName=session.operatorname;
  1239. $.post('/WbjUI/wbj2/business/web/wtbj_addDetailQuestion.do', params, function (result) {
  1240. if(result.Code==10000)
  1241. {
  1242. closepop('addQuestion');
  1243. getCore();
  1244. }else
  1245. {
  1246. YihuUtil.dialog({
  1247. id: 'testID',
  1248. content: result.Message,
  1249. lock: true,
  1250. button: [
  1251. {
  1252. name: '确定',
  1253. callback: function () {
  1254. return true;
  1255. },
  1256. focus: true
  1257. }
  1258. ]
  1259. });
  1260. }
  1261. }, "json");
  1262. }
  1263. function getmyquestbyid()
  1264. {
  1265. var sbid=$('#myzoneselect').val();
  1266. if(sbid==null||sbid==''||sbid==undefined)
  1267. {
  1268. myZone();
  1269. return;
  1270. }
  1271. if(sbid==0)
  1272. {
  1273. myzone();
  1274. }
  1275. else
  1276. {
  1277. var params={};
  1278. params.SubjectId=sbid;
  1279. $.post('/WbjUI/wbj2/business/web/wtbj_myZoneQuestbySubjectId.do', params, function (result) {
  1280. if(result.Code==10000)
  1281. {
  1282. var str='';
  1283. $.each(result.Result,function(i,item)
  1284. {
  1285. str+='<li><input name="myzonecheckbox" type="checkbox" value='+item.QuestId+' />'+item.Question+'</li>';
  1286. });
  1287. $('#getmyzone').empty();
  1288. $('#getmyzone').append(str);
  1289. }else
  1290. {
  1291. YihuUtil.dialog({
  1292. id: 'testID',
  1293. content: result.Message,
  1294. lock: true,
  1295. button: [
  1296. {
  1297. name: '确定',
  1298. callback: function () {
  1299. return true;
  1300. },
  1301. focus: true
  1302. }
  1303. ]
  1304. });
  1305. }
  1306. }, "json");
  1307. }
  1308. }
  1309. function queryPlatformQuestion()
  1310. {
  1311. $('#getPlatform').empty();
  1312. var params={};
  1313. params.ContentType=$('#QContentType').val();
  1314. params.ObjType=$('#QObjType').val();
  1315. $.post('/WbjUI/wbj2/business/web/wtbj_queryPlatformQuestion.do', params, function (result) {
  1316. if(result.Code==10000)
  1317. {
  1318. var str='';
  1319. $.each(result.Result,function(i,item)
  1320. {
  1321. str+='<li><input name="platformcheckbox" type="checkbox" value='+item.QuestId+' />'+item.Question+'</li>';
  1322. });
  1323. $('#getPlatform').append(str);
  1324. }else
  1325. {
  1326. YihuUtil.dialog({
  1327. id: 'testID',
  1328. content: result.Message,
  1329. lock: true,
  1330. button: [
  1331. {
  1332. name: '确定',
  1333. callback: function () {
  1334. return true;
  1335. },
  1336. focus: true
  1337. }
  1338. ]
  1339. });
  1340. }
  1341. }, "json");
  1342. }
  1343. function optionmyZoneQuestion()
  1344. {
  1345. var params={};
  1346. var session=getSession();
  1347. params.SubjectId=$('#onlySubjectId').val();
  1348. params.OperatorId=session.userId;
  1349. params.OperatorName=session.operatorname;
  1350. var str='';
  1351. $("input[name='myzonecheckbox']:checked").each(function(){
  1352. str+=$(this).val()+",";
  1353. });
  1354. if(str==null||str==''||str==undefined)
  1355. {
  1356. var z="请勾选";
  1357. Commonjs.alert(z);
  1358. return;
  1359. }
  1360. params.OptionQuestionid=str;
  1361. $.post('/WbjUI/wbj2/business/web/wtbj_optionQuestion.do', params, function (result) {
  1362. if(result.Code==10000)
  1363. {
  1364. getCore();
  1365. closepop('chooseQuestion');
  1366. }else
  1367. {
  1368. YihuUtil.dialog({
  1369. id: 'testID',
  1370. content: result.Message,
  1371. lock: true,
  1372. button: [
  1373. {
  1374. name: '确定',
  1375. callback: function () {
  1376. return true;
  1377. },
  1378. focus: true
  1379. }
  1380. ]
  1381. });
  1382. }
  1383. }, "json");
  1384. }
  1385. function optionPlatQuestion()
  1386. {
  1387. var params={};
  1388. var session=getSession();
  1389. params.SubjectId=$('#onlySubjectId').val();
  1390. params.OperatorId=session.userId;
  1391. params.OperatorName=session.operatorname;
  1392. var str='';
  1393. $("input[name='platformcheckbox']:checked").each(function(){
  1394. str+=$(this).val()+",";
  1395. });
  1396. if(str==null||str==''||str==undefined)
  1397. {
  1398. var z="请勾选";
  1399. Commonjs.alert(z);
  1400. return;
  1401. }
  1402. params.OptionQuestionid=str;
  1403. $.post('/WbjUI/wbj2/business/web/wtbj_optionQuestion.do', params, function (result) {
  1404. if(result.Code==10000)
  1405. {
  1406. getCore();
  1407. closepop('chooseQuestion');
  1408. }else
  1409. {
  1410. YihuUtil.dialog({
  1411. id: 'testID',
  1412. content: result.Message,
  1413. lock: true,
  1414. button: [
  1415. {
  1416. name: '确定',
  1417. callback: function () {
  1418. return true;
  1419. },
  1420. focus: true
  1421. }
  1422. ]
  1423. });
  1424. }
  1425. }, "json");
  1426. }
  1427. function closepop(id){
  1428. document.getElementById(id).style.display="none"
  1429. }
  1430. /*显示弹窗*/
  1431. function showpop(id){
  1432. document.getElementById(id).style.display="block"
  1433. }
  1434. function alertMessage(msg,action){
  1435. YihuUtil.dialog({
  1436. title:"提示",
  1437. content: msg,
  1438. button : [{
  1439. name : '确定',
  1440. callback : action
  1441. }]
  1442. });
  1443. }
  1444. function zhibiao(id)
  1445. {
  1446. str='';
  1447. switch (parseInt(id)) {
  1448. case 1:
  1449. str='医生服务';
  1450. break;
  1451. case 2:
  1452. str='护士服务';
  1453. break;
  1454. case 3:
  1455. str='医技服务';
  1456. break;
  1457. case 4:
  1458. str='药房服务';
  1459. break;
  1460. case 5:
  1461. str='收费服务';
  1462. break;
  1463. case 6:
  1464. str='就诊环境';
  1465. break;
  1466. case 7:
  1467. str='后勤保障';
  1468. break;
  1469. case 8:
  1470. str='导医导诊';
  1471. break;
  1472. case 9:
  1473. str='就诊流程';
  1474. break;
  1475. case 10:
  1476. str='医风医德';
  1477. break;
  1478. case 11:
  1479. str='忠诚指数';
  1480. break;
  1481. case 12:
  1482. str='其他问题';
  1483. break;
  1484. case 13:
  1485. str='通用指标';
  1486. break;
  1487. default:
  1488. str='未知指标';
  1489. }
  1490. return str;
  1491. }
  1492. function countContentType(id)
  1493. {
  1494. if(id==1)
  1495. {
  1496. fl1++;
  1497. }
  1498. if(id==2)
  1499. {
  1500. fl2++;
  1501. }
  1502. if(id==3)
  1503. {
  1504. fl3++;
  1505. }
  1506. if(id==4)
  1507. {
  1508. fl4++;
  1509. }
  1510. if(id==5)
  1511. {
  1512. fl5++;
  1513. }
  1514. if(id==6)
  1515. {
  1516. fl6++;
  1517. }
  1518. if(id==7)
  1519. {
  1520. fl7++;
  1521. }
  1522. if(id==8)
  1523. {
  1524. fl8++;
  1525. }
  1526. if(id==9)
  1527. {
  1528. fl9++;
  1529. }
  1530. if(id==10)
  1531. {
  1532. fl10++;
  1533. }
  1534. if(id==11)
  1535. {
  1536. fl11++;
  1537. }
  1538. if(id==12)
  1539. {
  1540. fl12++;
  1541. }
  1542. if(id==13)
  1543. {
  1544. fl13++;
  1545. }
  1546. }
  1547. function showContentType()
  1548. {
  1549. if(fl1==0&&fl2==0&&fl3==0&&fl4==0&&fl5==0&&fl6==0&&fl7==0&&fl8==0&&fl9==0&&fl10==0&&fl11==0&&fl12==0&&fl13==0)
  1550. {
  1551. $('#zhibiaoul').append('<li>暂无指标</li>');
  1552. }else
  1553. {
  1554. if(fl1>0)
  1555. {
  1556. $('#zhibiaoul').append('<li>医生服务('+fl1+')</li>');
  1557. }
  1558. if(fl2>0)
  1559. {
  1560. $('#zhibiaoul').append('<li>护士服务('+fl2+')</li>');
  1561. }
  1562. if(fl3>0)
  1563. {
  1564. $('#zhibiaoul').append('<li>医技服务('+fl3+')</li>');
  1565. }
  1566. if(fl4>0)
  1567. {
  1568. $('#zhibiaoul').append('<li>药房服务('+fl4+')</li>');
  1569. }
  1570. if(fl5>0)
  1571. {
  1572. $('#zhibiaoul').append('<li>收费服务('+fl5+')</li>');
  1573. }
  1574. if(fl6>0)
  1575. {
  1576. $('#zhibiaoul').append('<li>就诊环境('+fl6+')</li>');
  1577. }
  1578. if(fl7>0)
  1579. {
  1580. $('#zhibiaoul').append('<li>后勤保障('+fl7+')</li>');
  1581. }
  1582. if(fl8>0)
  1583. {
  1584. $('#zhibiaoul').append('<li>导医导诊('+fl8+')</li>');
  1585. }
  1586. if(fl9>0)
  1587. {
  1588. $('#zhibiaoul').append('<li>就诊流程('+fl9+')</li>');
  1589. }
  1590. if(fl10>0)
  1591. {
  1592. $('#zhibiaoul').append('<li>医风医德('+fl10+')</li>');
  1593. }
  1594. if(fl11>0)
  1595. {
  1596. $('#zhibiaoul').append('<li>忠诚指数('+fl11+')</li>');
  1597. }
  1598. if(fl12>0)
  1599. {
  1600. $('#zhibiaoul').append('<li>其他问题('+fl12+')</li>');
  1601. }
  1602. if(fl13>0)
  1603. {
  1604. $('#zhibiaoul').append('通用指标('+fl13+')</li>');
  1605. }
  1606. }
  1607. }
  1608. function getSession(){
  1609. var session = YihuUtil.getSession();
  1610. return session;
  1611. }
  1612. function uniteMessage(value,alertchar)
  1613. {
  1614. var tag=false;
  1615. if(value==null||value==''||value==undefined)
  1616. {
  1617. var str="不能为空!!";
  1618. tag=true;
  1619. Commonjs.alert(str);
  1620. return true;
  1621. }
  1622. value=trim(value);
  1623. //alert("xx"+value);
  1624. //alert(value.replace(/([^\x00-\xff])/g,'**').length);
  1625. //if(value.replace(/([^\x00-\xff])/g,'**').length>alertchar)
  1626. if(value.length>alertchar)
  1627. {
  1628. var str="请勿超过"+alertchar+"个字符";
  1629. Commonjs.alert(str);
  1630. tag=true;
  1631. return true;
  1632. }
  1633. return false;
  1634. }
  1635. //前后空格
  1636. function trim(str){
  1637. return str.replace(/^(\s|\xA0)+|(\s|\xA0)+$/g, '');
  1638. }
  1639. /**
  1640. * 清空特殊字符
  1641. */
  1642. function stripscriptName(value) {
  1643. var val=value;
  1644. var containSpecial = RegExp(/[(\ )(\~)(\!)(\@)(\#)(\$)(\¥)(\……)(\*)(\&)(\【)(\】)(\。)(\,)(\%)(\^)(\&)(\*)(\-)(\_)(\+)(\=)(\|)(\\)(\;)(\:)(\')(\")(\,)(\.)(\/)(\?)]+/);
  1645. var rs = "";
  1646. for (var i = 0; i < val.length; i++) {
  1647. rs = rs + val.substr(i, 1).replace(containSpecial, '');
  1648. }
  1649. return rs
  1650. }