upquest.js 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904
  1. $(function(){
  2. getCore();
  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=$('#SubjectId').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=$('#SubjectId').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. return;
  346. }
  347. if(id!=null||id!="")
  348. {
  349. var params={};
  350. var session=getSession();
  351. params.ItemId=id;
  352. params.OperatorId=session.userId;
  353. params.OperatorName=session.operatorname;
  354. $.post('/WbjUI/wbj2/business/web/wtbj_delQuestionFlow.do', params, function (result) {
  355. if(result.Code==10000)
  356. {
  357. $(obj).parent().remove();
  358. }else
  359. {
  360. YihuUtil.dialog({
  361. id: 'testID',
  362. content: result.Message,
  363. lock: true,
  364. button: [
  365. {
  366. name: '确定',
  367. callback: function () {
  368. return true;
  369. },
  370. focus: true
  371. }
  372. ]
  373. });
  374. }
  375. }, "json");
  376. }
  377. }
  378. function getlogicalSetting(obj,Questid)
  379. {
  380. $('#logicalQuestid').val(Questid);
  381. // 清除缓存
  382. $("div").removeData("keyitem");
  383. $("div").removeData("keyvalue");
  384. $('#jumpdiv').empty();
  385. $('#jumpbutton').empty();
  386. getquestItemforlogical(Questid);
  387. getnextQuestforlogical(obj);
  388. showpop('logicalSetting');
  389. //alert($(obj).parent().parent().parent().find("span:first").html());
  390. //alert($(obj).parent().parent().parent().attr("sortquestid"));
  391. var Qparams={};
  392. Qparams.QuestId=Questid;
  393. str='';
  394. $.ajax({url:'/WbjUI/wbj2/business/web/wtbj_queryQuestionFlow.do',async:false,type:"post", data: Qparams, success:function (result) {
  395. if(result.Code==10000)
  396. {
  397. $.each(result.Result,function(i,item)
  398. {
  399. str+='<div class="mt25"><label style="width:45px;">选中:</label>';
  400. str+='<select onchange="nextQuest()" class="pop-sel" style="width:140px">';
  401. var p={};
  402. p.QuestId=Questid;
  403. $.ajax({url:'/WbjUI/wbj2/business/web/wtbj_queryQuestionItem.do',async:false,type:"post", data: Qparams, success:function (result) {
  404. if(result.Code==10000)
  405. {
  406. $.each(result.Result,function(k,it)
  407. {
  408. //跳转选项
  409. if(item.ItemId==it.ItemId)
  410. {
  411. str+='<option selected value='+it.ItemId+'>'+it.ItemCont+'</option>';
  412. }else
  413. {
  414. str+='<option value='+it.ItemId+'>'+it.ItemCont+'</option>';
  415. }
  416. });
  417. }
  418. else
  419. {
  420. YihuUtil.dialog({
  421. id: 'testID',
  422. content: result.Message,
  423. lock: true,
  424. button: [
  425. {
  426. name: '确定',
  427. callback: function () {
  428. return true;
  429. },
  430. focus: true
  431. }
  432. ]
  433. });
  434. }
  435. }, dataType:"json"});
  436. str+='</select>';
  437. str+='<label style="width:60px;">跳转至:</label>';
  438. str+='<select class="pop-sel" style="width:140px">';
  439. var divs=$(obj).parent().parent().parent().parent().children('div'),
  440. len=$(obj).parent().parent().parent().parent().children('div').length;
  441. objdiv=$(obj).parent().parent().parent(),
  442. objindex=divs.index(objdiv);
  443. for(var m=0;m<len;m++)
  444. {
  445. if(m>objindex)
  446. {
  447. //跳转问题
  448. if(item.NextQuestId==divs.eq(m).attr("sortquestid"))
  449. {
  450. str+='<option selected value='+divs.eq(m).attr("sortquestid")+'>'+divs.eq(m).find("span:first").html()+'</option>';
  451. }
  452. else
  453. {
  454. str+='<option value='+divs.eq(m).attr("sortquestid")+'>'+divs.eq(m).find("span:first").html()+'</option>';
  455. }
  456. }
  457. }
  458. if(item.NextQuestId=="10")
  459. {
  460. str+='<option selected value="10">结束(计入结果)</option>';
  461. }else
  462. {
  463. str+='<option value="10">结束(计入结果)</option>';
  464. }
  465. if(item.NextQuestId=="11")
  466. {
  467. str+=' <option selected value="11">结束(不计入结果)</option>';
  468. }else
  469. {
  470. str+=' <option value="11">结束(不计入结果)</option>';
  471. }
  472. str+='</select><a class="ml10" onclick=dellogical(this,"'+item.ItemId+'") href="javascript:;"><img src="../../common/themes/default/images/nav-gb.png" /></a></div>';
  473. })
  474. $('#jumpdiv').append(str);
  475. $('#jumpbutton').append('<div class="mt25"><a href="javascript:;" onclick=getJump() class="c-007">添加跳转条件</a></div>');
  476. juzhong();
  477. }else
  478. {
  479. YihuUtil.dialog({
  480. id: 'testID',
  481. content: result.Message,
  482. lock: true,
  483. button: [
  484. {
  485. name: '确定',
  486. callback: function () {
  487. return true;
  488. },
  489. focus: true
  490. }
  491. ]
  492. });
  493. }
  494. }, dataType:"json"});
  495. }
  496. //获取逻辑跳转的前面选项
  497. function getquestItemforlogical(Questid)
  498. {
  499. var itemQ='';
  500. var p={};
  501. p.QuestId=Questid;
  502. $.post('/WbjUI/wbj2/business/web/wtbj_queryQuestionItem.do', p, function (result) {
  503. if(result.Code==10000)
  504. {
  505. $.each(result.Result,function(i,it)
  506. {
  507. itemQ+='<option value='+it.ItemId+'>'+it.ItemCont+'</option>';
  508. });
  509. // alert(itemQ);
  510. $("div").data("keyitem",itemQ);
  511. var a='aa';
  512. }else
  513. {
  514. YihuUtil.dialog({
  515. id: 'testID',
  516. content: result.Message,
  517. lock: true,
  518. button: [
  519. {
  520. name: '确定',
  521. callback: function () {
  522. return true;
  523. },
  524. focus: true
  525. }
  526. ]
  527. });
  528. }
  529. }, "json");
  530. }
  531. //获取逻辑跳转的后面选项
  532. function getnextQuestforlogical(obj)
  533. {
  534. var valueQ='';
  535. var divs=$(obj).parent().parent().parent().parent().children('div'),
  536. len=$(obj).parent().parent().parent().parent().children('div').length;
  537. objdiv=$(obj).parent().parent().parent(),
  538. objindex=divs.index(objdiv);
  539. for(var m=0;m<len;m++)
  540. {
  541. if(m>objindex)
  542. {
  543. valueQ+='<option value='+divs.eq(m).attr("sortquestid")+'>'+divs.eq(m).find("span:first").html()+'</option>';
  544. }
  545. }
  546. valueQ+='<option value="10">结束(计入结果)</option><option value="11">结束(不计入结果)</option>';
  547. // alert(valueQ);
  548. $("div").data("keyvalue",valueQ);
  549. }
  550. //显示逻辑跳转页面
  551. function getJump()
  552. {
  553. if($("div").data("keyitem")==null||$("div").data("keyitem")==undefined)
  554. {
  555. }
  556. str='';
  557. str+='<div class=""><label style="width:45px;">选中:</label>';
  558. str+='<select class="pop-sel" style="width:140px">';
  559. str+=$("div").data("keyitem");
  560. str+='</select>';
  561. str+='<label style="width:60px;">跳转至:</label>';
  562. str+='<select class="pop-sel" style="width:140px">';
  563. str+=$("div").data("keyvalue")
  564. str+='</select><a class="ml10" onclick=dellogical(this,"") href="javascript:;"><img src="../../common/themes/default/images/nav-gb.png" /></a></div>';
  565. $("#jumpdiv").append(str);
  566. }
  567. //添加逻辑跳转
  568. function addJump()
  569. {
  570. var divs=$("#jumpdiv").children('div');
  571. var len=$("#jumpdiv").children('div').length;
  572. var ids = [];
  573. var tag=false;
  574. for(var i=0;i<len;i++)
  575. {
  576. ids.push(divs.eq(i).find("select:first").val());
  577. }
  578. var str=ids.join(",")+",";
  579. for(var i = 0; i < ids.length; i++)
  580. {
  581. if(str.replace(ids[i] + ",", "").indexOf(ids[i] +",") > -1)
  582. {
  583. tag=true;
  584. break;
  585. }
  586. }
  587. if(tag)
  588. {
  589. var msg="选项有重复!!"
  590. Commonjs.alert(msg);
  591. return;
  592. }
  593. for(var i=0;i<len;i++)
  594. {
  595. var delparams={};
  596. delparams.ItemId=divs.eq(i).find("select:first").val();
  597. $.ajax({url:'/WbjUI/wbj2/business/web/wtbj_delQuestionFlow.do',async:false,type:"post", data: delparams, success:function (result) {
  598. if(result.Code==10000)
  599. {
  600. }
  601. else
  602. {
  603. YihuUtil.dialog({
  604. id: 'testID',
  605. content: result.Message,
  606. lock: true,
  607. button: [
  608. {
  609. name: '确定',
  610. callback: function () {
  611. return true;
  612. },
  613. focus: true
  614. }
  615. ]
  616. });
  617. }
  618. }, dataType:"json"});
  619. }
  620. for(var i=0;i<len;i++)
  621. {
  622. //alert(divs.eq(i).find("select:eq(0)").val());
  623. //alert(divs.eq(i).find("select:eq(1)").val());
  624. var p={};
  625. var session=getSession();
  626. p.ItemId=divs.eq(i).find("select:eq(0)").val();
  627. p.NextQuestId=divs.eq(i).find("select:eq(1)").val();
  628. p.OperatorId=session.userId;
  629. p.OperatorName=session.operatorname;
  630. $.ajax({url:'/WbjUI/wbj2/business/web/wtbj_addQuestionFlow.do',async:false,type:"post", data: p, success:function (result) {
  631. if(result.Code==10000)
  632. {
  633. }else
  634. {
  635. YihuUtil.dialog({
  636. id: 'testID',
  637. content: result.Message,
  638. lock: true,
  639. button: [
  640. {
  641. name: '确定',
  642. callback: function () {
  643. return true;
  644. },
  645. focus: true
  646. }
  647. ]
  648. });
  649. }
  650. },dataType:"json"});
  651. }
  652. getCore();
  653. closepop('logicalSetting');
  654. }
  655. //增加一行
  656. function addMatrQuest(obj,id)
  657. {
  658. if(uniteMessage($(obj).parent().find("input").val(),30))
  659. {
  660. return;
  661. }
  662. var Qparams={};
  663. Qparams.QuestId=id;
  664. $.post('/WbjUI/wbj2/business/web/wtbj_queryQuestion.do', Qparams, function (result) {
  665. if(result.Code==10000)
  666. {
  667. var params={};
  668. var session=getSession();
  669. params.SubjectId=result.SubjectId;
  670. params.ObjType=result.ObjType;
  671. params.ContentType=result.ContentType;
  672. params.QuestType=result.QuestType;
  673. params.MatrixQuestId=id;
  674. params.Question=$(obj).parent().find("input").val();
  675. params.OperatorId=session.userId;
  676. params.OperatorName=session.operatorname;
  677. var a= $(obj).parent().parent().find('table').first().find('tbody').find('tr').first().find('td').length;
  678. var b=$(obj).parent().parent().find('table').first().find('tbody').find('tr').first().find('td');
  679. $.post('/WbjUI/wbj2/business/web/wtbj_addQuestion.do', params, function (result) {
  680. if(result.Code==10000)
  681. {
  682. for(var i=1;i<a;i++)
  683. {
  684. var par={};
  685. par.QuestId=result.QuestId;
  686. par.ItemCont=b.eq(i).find("span").html();
  687. par.OperatorId=session.userId;
  688. par.OperatorName=session.operatorname;
  689. $.post('/WbjUI/wbj2/business/web/wtbj_addItem.do', par, function (result) {
  690. if(result.Code==10000)
  691. {
  692. }
  693. else
  694. {
  695. YihuUtil.dialog({
  696. id: 'testID',
  697. content: result.Message,
  698. lock: true,
  699. button: [
  700. {
  701. name: '确定',
  702. callback: function () {
  703. return true;
  704. },
  705. focus: true
  706. }
  707. ]
  708. });
  709. }
  710. }, "json");
  711. }
  712. getCore();
  713. }else
  714. {
  715. YihuUtil.dialog({
  716. id: 'testID',
  717. content: result.Message,
  718. lock: true,
  719. button: [
  720. {
  721. name: '确定',
  722. callback: function () {
  723. return true;
  724. },
  725. focus: true
  726. }
  727. ]
  728. });
  729. }
  730. }, "json");
  731. }else
  732. {
  733. YihuUtil.dialog({
  734. id: 'testID',
  735. content: result.Message,
  736. lock: true,
  737. button: [
  738. {
  739. name: '确定',
  740. callback: function () {
  741. return true;
  742. },
  743. focus: true
  744. }
  745. ]
  746. });
  747. }
  748. }, "json");
  749. }
  750. //增加一列
  751. function addMatrItem(obj)
  752. {
  753. if(uniteMessage($(obj).parent().find("input").val(),30))
  754. {
  755. return;
  756. }
  757. var t= $(obj).parent().parent().find('table').first().find('tr');
  758. var a= $(obj).parent().parent().find('table').first().find('tr').length;
  759. for(var i=1;i<a;i++)
  760. {
  761. var params={};
  762. var session=getSession();
  763. params.QuestId=t.eq(i).find('td:first').find("a[quesid]").attr("quesid");
  764. params.ItemCont=$(obj).parent().find("input").val();
  765. params.OperatorId=session.userId;
  766. params.OperatorName=session.operatorname;
  767. $.ajax({url:'/WbjUI/wbj2/business/web/wtbj_addItem.do',async:false,type:"post", data: params, success:function (result) {
  768. if(result.Code==10000)
  769. {
  770. }
  771. else
  772. {
  773. YihuUtil.dialog({
  774. id: 'testID',
  775. content: result.Message,
  776. lock: true,
  777. button: [
  778. {
  779. name: '确定',
  780. callback: function () {
  781. return true;
  782. },
  783. focus: true
  784. }
  785. ]
  786. });
  787. }
  788. }, dataType:"json"});
  789. }
  790. getCore();
  791. }
  792. //删除一列
  793. function delcol(v)
  794. {
  795. var trlen=$(v).parent().parent().parent().find('tr').length;
  796. var trlist=$(v).parent().parent().parent().find('tr');
  797. var thistd=$(v).parent();
  798. var tdlist=$(v).parent().parent().find('td');
  799. _tdindex=tdlist.index(thistd);
  800. for (var i = 0; i < trlen; i++)
  801. {
  802. if(i>0)
  803. {
  804. var itemid=trlist.eq(i).find("td").eq(_tdindex).find("input[itemid]").attr("itemid");
  805. // trlist.eq(i).find("td").eq(_tdindex).remove();
  806. var params={};
  807. params.ItemId=itemid;
  808. $.post('/WbjUI/wbj2/business/web/wtbj_deleteQuestionItem.do', params, function (result) {
  809. if(result.Code==10000)
  810. {
  811. }
  812. else
  813. {
  814. YihuUtil.dialog({
  815. id: 'testID',
  816. content: result.Message,
  817. lock: true,
  818. button: [
  819. {
  820. name: '确定',
  821. callback: function () {
  822. return true;
  823. },
  824. focus: true
  825. }
  826. ]
  827. });
  828. }
  829. }, "json");
  830. }
  831. }
  832. getCore();
  833. }
  834. //删除一行
  835. function delrow(v)
  836. {
  837. var trlen=$(v).parent().parent().parent().find('tr').length;
  838. if(trlen<=2)
  839. {
  840. var msg="至少得有一项";
  841. Commonjs.alert(msg);
  842. return;
  843. }
  844. var quesid=$(v).parent().find("a[quesid]").attr("quesid");
  845. // alert(quesid);
  846. // $(v).parent().parent().remove();
  847. var params={};
  848. params.QuestId=quesid;
  849. $.post('/WbjUI/wbj2/business/web/wtbj_deleteQuestion.do', params, function (result) {
  850. if(result.Code==10000)
  851. {
  852. getCore();
  853. }
  854. else
  855. {
  856. YihuUtil.dialog({
  857. id: 'testID',
  858. content: result.Message,
  859. lock: true,
  860. button: [
  861. {
  862. name: '确定',
  863. callback: function () {
  864. return true;
  865. },
  866. focus: true
  867. }
  868. ]
  869. });
  870. }
  871. }, "json");
  872. }
  873. function delMatrixQuest(id)
  874. {
  875. YihuUtil.dialog({
  876. id: 'testID',
  877. width: '245px',
  878. height: '109px',
  879. content: '确认要删除?',
  880. lock: true,
  881. button: [
  882. {
  883. name: '确定',
  884. callback: function () {
  885. var params={};
  886. params.QuestId=id;
  887. $.post('/WbjUI/wbj2/business/web/wtbj_matdeleteQuestion.do', params, function (result) {
  888. if(result.Code==10000)
  889. {
  890. getCore();
  891. }
  892. else
  893. {
  894. YihuUtil.dialog({
  895. id: 'testID',
  896. content: result.Message,
  897. lock: true,
  898. button: [
  899. {
  900. name: '确定',
  901. callback: function () {
  902. return true;
  903. },
  904. focus: true
  905. }
  906. ]
  907. });
  908. }
  909. }, "json");
  910. return true;
  911. },
  912. focus: true
  913. },
  914. {
  915. name: '取消'
  916. }
  917. ]
  918. });
  919. }
  920. function Qup(obj,id)
  921. {
  922. var _divs=$(obj).parent().parent().parent().parent().children("div"),
  923. _div=$(obj).parent().parent().parent(),
  924. _divindex = _divs.index(_div);
  925. if(_divindex>0)
  926. {
  927. var session=getSession();
  928. var params={};
  929. params.OperatorName=session.operatorname;
  930. params.OperatorId=session.userId;
  931. params.QuestId1=id;
  932. params.QuestId2= _divs.eq(_divindex-1).attr("sortquestid");
  933. $.post('/WbjUI/wbj2/business/web/wtbj_exchangeQuestionSort.do', params, function (result) {
  934. if(result.Code==10000)
  935. {
  936. getCore();
  937. }
  938. else
  939. {
  940. YihuUtil.dialog({
  941. id: 'testID',
  942. content: result.Message,
  943. lock: true,
  944. button: [
  945. {
  946. name: '确定',
  947. callback: function () {
  948. return true;
  949. },
  950. focus: true
  951. }
  952. ]
  953. });
  954. }
  955. }, "json");
  956. }
  957. }
  958. function Qdown(obj,id)
  959. {
  960. var _divs=$(obj).parent().parent().parent().parent().children("div"),
  961. _div=$(obj).parent().parent().parent(),
  962. _divindex = _divs.index(_div);
  963. if(_divindex<_divs.length-1)
  964. {
  965. var session=getSession();
  966. var params={};
  967. params.OperatorName=session.operatorname;
  968. params.OperatorId=session.userId;
  969. params.QuestId1=id;
  970. params.QuestId2= _divs.eq(_divindex+1).attr("sortquestid");
  971. $.post('/WbjUI/wbj2/business/web/wtbj_exchangeQuestionSort.do', params, function (result) {
  972. if(result.Code==10000)
  973. {
  974. getCore();
  975. }
  976. else
  977. {
  978. YihuUtil.dialog({
  979. id: 'testID',
  980. content: result.Message,
  981. lock: true,
  982. button: [
  983. {
  984. name: '确定',
  985. callback: function () {
  986. return true;
  987. },
  988. focus: true
  989. }
  990. ]
  991. });
  992. }
  993. }, "json");
  994. }
  995. }
  996. function delItem(id)
  997. {
  998. var params={};
  999. params.ItemId=id;
  1000. $.post('/WbjUI/wbj2/business/web/wtbj_deleteQuestionItem.do', params, function (result) {
  1001. if(result.Code==10000)
  1002. {
  1003. getCore();
  1004. }
  1005. else
  1006. {
  1007. YihuUtil.dialog({
  1008. id: 'testID',
  1009. content: result.Message,
  1010. lock: true,
  1011. button: [
  1012. {
  1013. name: '确定',
  1014. callback: function () {
  1015. return true;
  1016. },
  1017. focus: true
  1018. }
  1019. ]
  1020. });
  1021. }
  1022. }, "json");
  1023. }
  1024. function hiddenItem(obj,id)
  1025. {
  1026. $(obj).parent().find("input:first").val('');
  1027. closepop(id);
  1028. }
  1029. function getCore()
  1030. {
  1031. fl1=0;
  1032. fl2=0;
  1033. fl3=0;
  1034. fl4=0;
  1035. fl5=0;
  1036. fl6=0;
  1037. fl7=0;
  1038. fl8=0;
  1039. fl9=0;
  1040. fl10=0;
  1041. fl11=0;
  1042. fl12=0;
  1043. fl13=0;
  1044. $('#zhibiaoul').empty();
  1045. $('#core').empty();
  1046. $('#begin').empty();
  1047. $('#end').empty();
  1048. var id=YihuUtil.queryString('subjectid');
  1049. $('#SubjectId').val(id);
  1050. var params={};
  1051. params.SubjectId=id;
  1052. $.post('/WbjUI/wbj2/business/web/wtbj_querySubjectById.do', params, function (result) {
  1053. if(result.Code==10000)
  1054. {
  1055. $('#begin').append(result.BeginIntro);
  1056. $('#end').append(result.EndingIntro);
  1057. if(result.SubjectTitle.length<15)
  1058. {
  1059. $('#subjecttitle').html(result.SubjectTitle);
  1060. }else
  1061. {
  1062. $('#subjecttitle').html(result.SubjectTitle.substring(0,15)+'...');
  1063. }
  1064. if(result.Result.length>0)
  1065. {
  1066. var str='';
  1067. $.each(result.Result,function(i,item)
  1068. {
  1069. countContentType(item.ContentType);
  1070. if(item.QuestType==1)
  1071. {
  1072. var count=i+1;
  1073. 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>';
  1074. str+='<span id="q'+count+'Tit" class=" fl q-tit" contenteditable="false" onblur=updateQuest(this,"'+item.QuestId+'")>'+item.Question+'</span>';
  1075. 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>';
  1076. str+='<div class="myd-gray-con"><div class="mt5"><ul>';
  1077. $.each(item.SvQuestionItems,function(i,qitem)
  1078. {
  1079. 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"';
  1080. str+='onblur=upateItem(this,"'+qitem.ItemId+'")>'+qitem.ItemCont+'</span></span>';
  1081. 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>';
  1082. })
  1083. str+=' </ul></div>';
  1084. 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>';
  1085. 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>';
  1086. str+='</div></div>';
  1087. }
  1088. if(item.QuestType==2)
  1089. {
  1090. var count=i+1;
  1091. 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>';
  1092. str+='<span id="q'+count+'Tit" class=" fl q-tit" contenteditable="false" onblur=updateQuest(this,"'+item.QuestId+'")>'+item.Question+'</span>';
  1093. 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>';
  1094. str+='<div class="myd-gray-con"><div class="mt5"><ul>';
  1095. $.each(item.SvQuestionItems,function(i,qitem)
  1096. {
  1097. 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"';
  1098. str+='onblur=upateItem(this,"'+qitem.ItemId+'")>'+qitem.ItemCont+'</span></span>';
  1099. 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>';
  1100. })
  1101. str+=' </ul></div>';
  1102. 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>';
  1103. 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>';
  1104. str+='</div></div>';
  1105. }
  1106. if(item.QuestType==3)
  1107. {
  1108. var count=i+1;
  1109. 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>';
  1110. str+='<span id="q'+count+'Tit" class=" fl q-tit" contenteditable="false" onblur=updateQuest(this,"'+item.QuestId+'")>'+item.Question+'</span>';
  1111. 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>';
  1112. 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>';
  1113. str+='</div></div>';
  1114. }
  1115. if(item.QuestType==4)
  1116. {
  1117. var count=i+1;
  1118. 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>';
  1119. str+='<span id="q'+count+'Tit" class=" fl q-tit" contenteditable="false" onblur=updateQuest(this,"'+item.QuestId+'")>'+item.Question+'</span>';
  1120. 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>';
  1121. str+='<div class="myd-gray-con"><table class="tb-sjtj" width="100%">';
  1122. str+='<tr><td class="thead-1">子项</td>';
  1123. $.each(item.ChildrenMatrixQuestion[0].MatrixQuestItems,function(i,marxitem)
  1124. {
  1125. 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>';
  1126. })
  1127. str+='</tr>';
  1128. $.each(item.ChildrenMatrixQuestion,function(i,mquest)
  1129. {
  1130. 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>';
  1131. $.each(mquest.MatrixQuestItems,function(i,cmarxitem)
  1132. {
  1133. str+='<td><input type="radio" itemid='+cmarxitem.ItemId+' name="fwtd" /></td>';
  1134. });
  1135. str+='</tr>';
  1136. })
  1137. str+='</table>';
  1138. 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>';
  1139. 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>';
  1140. 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>';
  1141. }
  1142. if(item.QuestType==5)
  1143. {
  1144. var count=i+1;
  1145. 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>';
  1146. str+='<span id="q'+count+'Tit" class=" fl q-tit" contenteditable="false" onblur=updateQuest(this,"'+item.QuestId+'")>'+item.Question+'</span>';
  1147. 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>';
  1148. str+='<div class="myd-gray-con"><table class="tb-sjtj" width="100%">';
  1149. str+='<tr><td class="thead-1">子项</td>';
  1150. $.each(item.ChildrenMatrixQuestion[0].MatrixQuestItems,function(i,marxitem)
  1151. {
  1152. 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>';
  1153. })
  1154. str+='</tr>';
  1155. $.each(item.ChildrenMatrixQuestion,function(i,mquest)
  1156. {
  1157. 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>';
  1158. $.each(mquest.MatrixQuestItems,function(i,cmarxitem)
  1159. {
  1160. str+='<td><input type="checkbox" itemid='+cmarxitem.ItemId+' name="fwtd" /></td>';
  1161. });
  1162. str+='</tr>';
  1163. })
  1164. str+='</table>';
  1165. 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>';
  1166. 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>';
  1167. 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>';
  1168. }
  1169. });
  1170. $('#ifnoQuest').hide();
  1171. showContentType();
  1172. $('#core').append(str);
  1173. }else
  1174. {
  1175. $('#ifnoQuest').show();
  1176. }
  1177. }else
  1178. {
  1179. YihuUtil.dialog({
  1180. id: 'testID',
  1181. content: result.Message,
  1182. lock: true,
  1183. button: [
  1184. {
  1185. name: '确定',
  1186. callback: function () {
  1187. return true;
  1188. },
  1189. focus: true
  1190. }
  1191. ]
  1192. });
  1193. }
  1194. }, "json");
  1195. }
  1196. function myZone()
  1197. {
  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').empty();
  1210. $('#getmyzone').append(str);
  1211. }else
  1212. {
  1213. YihuUtil.dialog({
  1214. id: 'testID',
  1215. content: result.Message,
  1216. lock: true,
  1217. button: [
  1218. {
  1219. name: '确定',
  1220. callback: function () {
  1221. return true;
  1222. },
  1223. focus: true
  1224. }
  1225. ]
  1226. });
  1227. }
  1228. }, "json");
  1229. }
  1230. function insertQuest()
  1231. {
  1232. var params={};
  1233. var session=getSession();
  1234. params.ContentType=$('#ContentType').val();
  1235. params.ObjType=$('#ObjType').val();
  1236. params.QuestType=$('#QuestType').val();
  1237. params.SubjectId=$('#SubjectId').val();
  1238. params.OperatorID=session.userId;
  1239. params.OperatorName=session.operatorname;
  1240. $.post('/WbjUI/wbj2/business/web/wtbj_addDetailQuestion.do', params, function (result) {
  1241. if(result.Code==10000)
  1242. {
  1243. closepop('addQuestion');
  1244. getCore();
  1245. }else
  1246. {
  1247. YihuUtil.dialog({
  1248. id: 'testID',
  1249. content: result.Message,
  1250. lock: true,
  1251. button: [
  1252. {
  1253. name: '确定',
  1254. callback: function () {
  1255. return true;
  1256. },
  1257. focus: true
  1258. }
  1259. ]
  1260. });
  1261. }
  1262. }, "json");
  1263. }
  1264. function getmyquestbyid()
  1265. {
  1266. var sbid=$('#myzoneselect').val();
  1267. if(sbid==null||sbid==''||sbid==undefined)
  1268. {
  1269. myZone();
  1270. return;
  1271. }
  1272. if(sbid==0)
  1273. {
  1274. myzone();
  1275. }
  1276. else
  1277. {
  1278. var params={};
  1279. params.SubjectId=sbid;
  1280. $.post('/WbjUI/wbj2/business/web/wtbj_myZoneQuestbySubjectId.do', params, function (result) {
  1281. if(result.Code==10000)
  1282. {
  1283. var str='';
  1284. $.each(result.Result,function(i,item)
  1285. {
  1286. str+='<li><input name="myzonecheckbox" type="checkbox" value='+item.QuestId+' />'+item.Question+'</li>';
  1287. });
  1288. $('#getmyzone').empty();
  1289. $('#getmyzone').append(str);
  1290. }else
  1291. {
  1292. YihuUtil.dialog({
  1293. id: 'testID',
  1294. content: result.Message,
  1295. lock: true,
  1296. button: [
  1297. {
  1298. name: '确定',
  1299. callback: function () {
  1300. return true;
  1301. },
  1302. focus: true
  1303. }
  1304. ]
  1305. });
  1306. }
  1307. }, "json");
  1308. }
  1309. }
  1310. function queryPlatformQuestion()
  1311. {
  1312. $('#getPlatform').empty();
  1313. var params={};
  1314. params.ContentType=$('#QContentType').val();
  1315. params.ObjType=$('#QObjType').val();
  1316. $.post('/WbjUI/wbj2/business/web/wtbj_queryPlatformQuestion.do', params, function (result) {
  1317. if(result.Code==10000)
  1318. {
  1319. var str='';
  1320. $.each(result.Result,function(i,item)
  1321. {
  1322. str+='<li><input name="platformcheckbox" type="checkbox" value='+item.QuestId+' />'+item.Question+'</li>';
  1323. });
  1324. $('#getPlatform').append(str);
  1325. }else
  1326. {
  1327. YihuUtil.dialog({
  1328. id: 'testID',
  1329. content: result.Message,
  1330. lock: true,
  1331. button: [
  1332. {
  1333. name: '确定',
  1334. callback: function () {
  1335. return true;
  1336. },
  1337. focus: true
  1338. }
  1339. ]
  1340. });
  1341. }
  1342. }, "json");
  1343. }
  1344. function optionmyZoneQuestion()
  1345. {
  1346. var params={};
  1347. var session=getSession();
  1348. params.SubjectId=$('#SubjectId').val();
  1349. params.OperatorId=session.userId;
  1350. params.OperatorName=session.operatorname;
  1351. var str='';
  1352. $("input[name='myzonecheckbox']:checked").each(function(){
  1353. str+=$(this).val()+",";
  1354. });
  1355. if(str==null||str==''||str==undefined)
  1356. {
  1357. var z="请勾选";
  1358. Commonjs.alert(z);
  1359. return;
  1360. }
  1361. params.OptionQuestionid=str;
  1362. $.post('/WbjUI/wbj2/business/web/wtbj_optionQuestion.do', params, function (result) {
  1363. if(result.Code==10000)
  1364. {
  1365. getCore();
  1366. closepop('chooseQuestion');
  1367. }else
  1368. {
  1369. YihuUtil.dialog({
  1370. id: 'testID',
  1371. content: result.Message,
  1372. lock: true,
  1373. button: [
  1374. {
  1375. name: '确定',
  1376. callback: function () {
  1377. return true;
  1378. },
  1379. focus: true
  1380. }
  1381. ]
  1382. });
  1383. }
  1384. }, "json");
  1385. }
  1386. function optionPlatQuestion()
  1387. {
  1388. var params={};
  1389. var session=getSession();
  1390. params.SubjectId=$('#SubjectId').val();
  1391. params.OperatorId=session.userId;
  1392. params.OperatorName=session.operatorname;
  1393. var str='';
  1394. $("input[name='platformcheckbox']:checked").each(function(){
  1395. str+=$(this).val()+",";
  1396. });
  1397. if(str==null||str==''||str==undefined)
  1398. {
  1399. var z="请勾选";
  1400. Commonjs.alert(z);
  1401. return;
  1402. }
  1403. params.OptionQuestionid=str;
  1404. $.post('/WbjUI/wbj2/business/web/wtbj_optionQuestion.do', params, function (result) {
  1405. if(result.Code==10000)
  1406. {
  1407. getCore();
  1408. closepop('chooseQuestion');
  1409. }else
  1410. {
  1411. YihuUtil.dialog({
  1412. id: 'testID',
  1413. content: result.Message,
  1414. lock: true,
  1415. button: [
  1416. {
  1417. name: '确定',
  1418. callback: function () {
  1419. return true;
  1420. },
  1421. focus: true
  1422. }
  1423. ]
  1424. });
  1425. }
  1426. }, "json");
  1427. }
  1428. function closepop(id){
  1429. document.getElementById(id).style.display="none"
  1430. }
  1431. /*显示弹窗*/
  1432. function showpop(id){
  1433. document.getElementById(id).style.display="block"
  1434. }
  1435. function alertMessage(msg,action){
  1436. YihuUtil.dialog({
  1437. title:"提示",
  1438. content: msg,
  1439. button : [{
  1440. name : '确定',
  1441. callback : action
  1442. }]
  1443. });
  1444. }
  1445. function zhibiao(id)
  1446. {
  1447. str='';
  1448. switch (parseInt(id)) {
  1449. case 1:
  1450. str='医生服务';
  1451. break;
  1452. case 2:
  1453. str='护士服务';
  1454. break;
  1455. case 3:
  1456. str='医技服务';
  1457. break;
  1458. case 4:
  1459. str='药房服务';
  1460. break;
  1461. case 5:
  1462. str='收费服务';
  1463. break;
  1464. case 6:
  1465. str='就诊环境';
  1466. break;
  1467. case 7:
  1468. str='后勤保障';
  1469. break;
  1470. case 8:
  1471. str='导医导诊';
  1472. break;
  1473. case 9:
  1474. str='就诊流程';
  1475. break;
  1476. case 10:
  1477. str='医风医德';
  1478. break;
  1479. case 11:
  1480. str='忠诚指数';
  1481. break;
  1482. case 12:
  1483. str='其他问题';
  1484. break;
  1485. case 13:
  1486. str='通用指标';
  1487. break;
  1488. default:
  1489. str='未知指标';
  1490. }
  1491. return str;
  1492. }
  1493. function countContentType(id)
  1494. {
  1495. if(id==1)
  1496. {
  1497. fl1++;
  1498. }
  1499. if(id==2)
  1500. {
  1501. fl2++;
  1502. }
  1503. if(id==3)
  1504. {
  1505. fl3++;
  1506. }
  1507. if(id==4)
  1508. {
  1509. fl4++;
  1510. }
  1511. if(id==5)
  1512. {
  1513. fl5++;
  1514. }
  1515. if(id==6)
  1516. {
  1517. fl6++;
  1518. }
  1519. if(id==7)
  1520. {
  1521. fl7++;
  1522. }
  1523. if(id==8)
  1524. {
  1525. fl8++;
  1526. }
  1527. if(id==9)
  1528. {
  1529. fl9++;
  1530. }
  1531. if(id==10)
  1532. {
  1533. fl10++;
  1534. }
  1535. if(id==11)
  1536. {
  1537. fl11++;
  1538. }
  1539. if(id==12)
  1540. {
  1541. fl12++;
  1542. }
  1543. if(id==13)
  1544. {
  1545. fl13++;
  1546. }
  1547. }
  1548. function showContentType()
  1549. {
  1550. 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)
  1551. {
  1552. $('#zhibiaoul').append('<li>暂无指标</li>');
  1553. }else
  1554. {
  1555. if(fl1>0)
  1556. {
  1557. $('#zhibiaoul').append('<li>医生服务('+fl1+')</li>');
  1558. }
  1559. if(fl2>0)
  1560. {
  1561. $('#zhibiaoul').append('<li>护士服务('+fl2+')</li>');
  1562. }
  1563. if(fl3>0)
  1564. {
  1565. $('#zhibiaoul').append('<li>医技服务('+fl3+')</li>');
  1566. }
  1567. if(fl4>0)
  1568. {
  1569. $('#zhibiaoul').append('<li>药房服务('+fl4+')</li>');
  1570. }
  1571. if(fl5>0)
  1572. {
  1573. $('#zhibiaoul').append('<li>收费服务('+fl5+')</li>');
  1574. }
  1575. if(fl6>0)
  1576. {
  1577. $('#zhibiaoul').append('<li>就诊环境('+fl6+')</li>');
  1578. }
  1579. if(fl7>0)
  1580. {
  1581. $('#zhibiaoul').append('<li>后勤保障('+fl7+')</li>');
  1582. }
  1583. if(fl8>0)
  1584. {
  1585. $('#zhibiaoul').append('<li>导医导诊('+fl8+')</li>');
  1586. }
  1587. if(fl9>0)
  1588. {
  1589. $('#zhibiaoul').append('<li>就诊流程('+fl9+')</li>');
  1590. }
  1591. if(fl10>0)
  1592. {
  1593. $('#zhibiaoul').append('<li>医风医德('+fl10+')</li>');
  1594. }
  1595. if(fl11>0)
  1596. {
  1597. $('#zhibiaoul').append('<li>忠诚指数('+fl11+')</li>');
  1598. }
  1599. if(fl12>0)
  1600. {
  1601. $('#zhibiaoul').append('<li>其他问题('+fl12+')</li>');
  1602. }
  1603. if(fl13>0)
  1604. {
  1605. $('#zhibiaoul').append('通用指标('+fl13+')</li>');
  1606. }
  1607. }
  1608. }
  1609. function goreturn()
  1610. {
  1611. var url="../survey/wdwj_execute.do";
  1612. location.href=url;
  1613. }
  1614. function getSession(){
  1615. var session = YihuUtil.getSession();
  1616. return session;
  1617. }
  1618. function uniteMessage(value,alertchar)
  1619. {
  1620. var tag=false;
  1621. if(value==null||value==''||value==undefined)
  1622. {
  1623. var str="不能为空!!";
  1624. tag=true;
  1625. Commonjs.alert(str);
  1626. return true;
  1627. }
  1628. value=trim(value);
  1629. //alert("xx"+value);
  1630. //alert(value.replace(/([^\x00-\xff])/g,'**').length);
  1631. //if(value.replace(/([^\x00-\xff])/g,'**').length>alertchar)
  1632. if(value.length>alertchar)
  1633. {
  1634. var str="请勿超过"+alertchar+"个字符";
  1635. Commonjs.alert(str);
  1636. tag=true;
  1637. return true;
  1638. }
  1639. return false;
  1640. }
  1641. //前后空格
  1642. function trim(str){
  1643. return str.replace(/^(\s|\xA0)+|(\s|\xA0)+$/g, '');
  1644. }