ZZDianXin_UI - 郑州电信 演示

QuestionSetting.js 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. var keys;
  2. var Cids; //分类id
  3. var ids; //指标id
  4. var CategoryName; //分类名称
  5. var Sort; //排序
  6. var Score; //分数
  7. var Title; //标题
  8. var Remark; //备注
  9. var Pid; //父id
  10. var Left_Cids;
  11. var Left_Sort;
  12. var Left_Score;
  13. var Left_Pid;
  14. var $tableLeft = $('#tbr');
  15. var $tableLeft1 = $('#tb1');
  16. var token = $.cookie("token");
  17. IndexCategoryGe();
  18. //所有指标
  19. //$(".rightAll").click(function() {
  20. // Finish();
  21. //});
  22. //搜索功能
  23. $(".searchGo").click(function() {
  24. //Finish(keys);
  25. IndexCategoryGe();
  26. });
  27. //回车搜索
  28. $('#KeyWords').on('keypress',function(e){
  29. if(e.keyCode==13){
  30. IndexCategoryGe();
  31. }
  32. })
  33. //*删除*/
  34. $(".inpBox").hover(function(event) {
  35. $(this).children(".de_icon").show();
  36. event.stopPropagation();
  37. }, function() {
  38. $(this).children(".de_icon").hide();
  39. });
  40. $(".de_icon").click(function(event) {
  41. event.stopPropagation();
  42. $(this).siblings("input").eq(0).val("");
  43. $(this).siblings("input").eq(1).val("");
  44. if($(this).siblings("div").find("ul").attr("id") == "zrbmtree") {
  45. getRY($(".zrid"), $("#zrbm").val());
  46. }
  47. });
  48. $(".inpBox").mouseleave(function() {
  49. $(this).children(".addTree").hide();
  50. })
  51. $(".xl").click(function() {
  52. if($(this).parent().find(".addTree").is(":hidden")) {
  53. $(this).parent().find(".addTree").show();
  54. } else {
  55. $(this).parent().find(".addTree").hide();
  56. }
  57. });
  58. //清空选项
  59. function Clean() {
  60. $(".model").hide();
  61. $("._CategoryName").val("");
  62. $("._Score").val('');
  63. $("._Sort").val('');
  64. $(".F_Title").val('');
  65. $(".F_Remark").val('');
  66. }
  67. ///////////////////////////////////左边表格
  68. /*获取选中行对象*/
  69. $tableLeft1.on("click-row.bs.table", function(e, row, ele) {
  70. $('.success').removeClass('success'); //去除之前选中的行的,选中样式
  71. $(ele).addClass('success'); //添加当前选中的 success样式用于区别
  72. Left_Cids = row.F_PagerId; //问卷ID
  73. $(".IMG_content").hide();
  74. $('#tbr').show();
  75. XQ(Left_Cids); ///获取问卷
  76. });
  77. //z获取问卷列表
  78. function IndexCategoryGe() {
  79. //销毁表格
  80. $tableLeft1.bootstrapTable('destroy');
  81. //初始化表格,动态从服务器加载数据
  82. $tableLeft1.bootstrapTable({
  83. method: "get", //使用get请求到服务器获取数据
  84. url: huayi.config.callcenter_url + "Questionnaire/GetPagerInfoList",
  85. contentType: 'application/x-www-form-urlencoded',
  86. striped: true, //表格显示条纹
  87. pagination: true, //启动分页
  88. pageSize: 5, //每页显示的记录数
  89. pageNumber: 1, //当前第几页
  90. pageList: [5, 20, 50, 100], //记录数可选列表
  91. search: false, //是否启用查询
  92. showColumns: false, //显示下拉框勾选要显示的列
  93. showRefresh: false, //显示刷新按钮
  94. sidePagination: "server", //表示服务端请求
  95. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  96. //设置为limit可以获取limit, offset, search, sort, order
  97. queryParamsType: "undefined",
  98. queryParams: function queryParams(params) { //设置查询参数
  99. var param = {
  100. PageIndex: params.pageNumber,
  101. PageSize: params.pageSize,
  102. Key: $("#KeyWords").val(),
  103. token: token
  104. };
  105. return param;
  106. },
  107. onLoadSuccess: function() { //加载成功时执行
  108. // layer.msg("加载成功");
  109. },
  110. onLoadError: function() { //加载失败时执行
  111. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  112. }
  113. });
  114. }
  115. //编号
  116. function setCode(val, row, index) {
  117. return index + 1;
  118. }
  119. //操作
  120. function Code(val) {
  121. return '<a onclick="Add(' + val + ')">操作</a>'
  122. }
  123. //右边操作
  124. function Add(val) {
  125. layer.open({
  126. type: 2,
  127. content: "../Questionnaire/addSetting.html?str=" + val, //iframe的url,no代表不显示滚动条
  128. title: '问卷信息',
  129. area: ['80%', '75%'], //宽高
  130. });
  131. }
  132. //删除
  133. $('.leftDelete').click(function() {
  134. if(Left_Cids) {
  135. layer.confirm('确定删除当前记录?', {
  136. btn: ['是', '否'] //按钮
  137. }, function() {
  138. DelIndexCategory(Left_Cids);
  139. Left_Cids='';
  140. });
  141. } else {
  142. layer.msg('没有可删除的选项!');
  143. }
  144. })
  145. //删除功能
  146. function DelIndexCategory(Left_Cids) {
  147. $.ajax({
  148. type: "get",
  149. url: huayi.config.callcenter_url + "/Questionnaire/DeletePagerInfo",
  150. //url: '//117.158.196.116:8878/IndexCategory/DelIndexCategory',
  151. dataType: 'json',
  152. data: {
  153. id: Left_Cids,
  154. token: $.cookie("token"),
  155. },
  156. async: true,
  157. success: function(data) {
  158. layer.msg("删除成功");
  159. IndexCategoryGe();
  160. }
  161. });
  162. }
  163. ///修改功能
  164. $(".leftChange ").click(function() {
  165. var Str = Left_Cids;
  166. if(Left_Cids) {
  167. layer.open({
  168. type: 2,
  169. content: "../Questionnaire/xgWenjuanxinxi.html?str=" + Str, //iframe的url,no代表不显示滚动条
  170. title: '修改问卷',
  171. area: ['50%', '60%'], //宽高
  172. });
  173. Left_Cids='';
  174. } else {
  175. layer.msg('没有可修改的选项!');
  176. Clean();
  177. }
  178. })
  179. //增加
  180. $(".leftAdd").click(function() {
  181. var Str = Left_Cids;
  182. console.log(Str);
  183. layer.open({
  184. type: 2,
  185. content: "../Questionnaire/addSWenjuanxinxi.html?", //iframe的url,no代表不显示滚动条
  186. title: '增加问卷',
  187. area: ['50%', '60%'], //宽高
  188. });
  189. });
  190. ////////////////////////////////////////////////////////////////右边表格
  191. //详情展示
  192. function XQ(Left_Cids) {
  193. $('.WJ_box').show();
  194. $(".Qus_box").empty();
  195. $.ajax({
  196. type: "get",
  197. url: huayi.config.callcenter_url + "/Questionnaire/GetPagerInfoQ",
  198. async: true,
  199. dataType: "json",
  200. data: {
  201. pid: Left_Cids,
  202. token: $.cookie("token"),
  203. },
  204. success: function(data) {
  205. if(data.state.toLowerCase() == 'success') {
  206. $('.Title').text(data.data.F_Title);
  207. $("#F_Remark").text(data.data.F_Remark);
  208. $("#startText").text(data.data.F_StartText);
  209. $("#endText").text(data.data.F_EndText);
  210. var Questions = data.data.F_Questions;
  211. var html = '';
  212. for(var i = 0; i < Questions.length; i++) {
  213. var questype = Questions[i].questype;
  214. var Quesid = Questions[i].quesid;
  215. var quesremark = Questions[i].quesremark;//试题说明
  216. if(quesremark){
  217. quesremark = ' 【' + quesremark +'】';
  218. }else{
  219. quesremark = "";
  220. }
  221. html += '<li >';
  222. html += '<div class="Back">';
  223. html += '<h3 class="size-14 QuesTitle" indexs="' + Questions[i].quesid + '">' + Questions[i].questitle + quesremark + ' </h3>';
  224. html += '</div>';
  225. //判断类型
  226. if(questype == 2) { //问答题
  227. //选项
  228. if(Questions[i].quesitems.length > 0) {
  229. html += '<div>';
  230. var quesitems = Questions[i].quesitems;
  231. for(var j = 0; j < quesitems.length; j++) {
  232. html += '<label style="font-weight: normal;">'
  233. html += '' + (j + 1) + '.';
  234. html += '<input type="radio" index_="' + quesitems[j].itemid + '" value="' + quesitems[j].itemname + '" name="ltype' + Quesid + '" style="margin-left:5px;"> ' + quesitems[j].itemname + '</label>'
  235. }
  236. html += '</div>'
  237. html += '</li>'
  238. }
  239. } else if(questype == 1) {
  240. html += '<div>';
  241. html += '<textarea index="' + Questions[i].quesid + '"name="" rows="" cols="" style="width: 100%;"></textarea>'
  242. html += '</div>'
  243. } else {
  244. if(Questions[i].quesitems.length > 0) {
  245. html += '<div>';
  246. var quesitems = Questions[i].quesitems;
  247. for(var j = 0; j < quesitems.length; j++) {
  248. html += '<label style="font-weight: normal;">'
  249. html += '' + (j + 1) + '.';
  250. html += '<input type="checkbox" value="' + quesitems[j].itemname + '" name="checks" > ' + quesitems[j].itemname + '</label>'
  251. }
  252. html += '</div>'
  253. html += '</li >';
  254. }
  255. }
  256. }
  257. $(html).appendTo(".Qus_box");
  258. }
  259. }
  260. });
  261. }