| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- var keys;
- var Cids; //分类id
- var ids; //指标id
- var CategoryName; //分类名称
- var Sort; //排序
- var Score; //分数
- var Title; //标题
- var Remark; //备注
- var Pid; //父id
- var Left_Cids;
- var Left_Sort;
- var Left_Score;
- var Left_Pid;
- var $tableLeft = $('#tbr');
- var $tableLeft1 = $('#tb1');
- var token = $.cookie("token");
- IndexCategoryGe();
- //所有指标
- //$(".rightAll").click(function() {
- // Finish();
- //});
- //搜索功能
- $(".searchGo").click(function() {
- //Finish(keys);
- IndexCategoryGe();
- });
- //回车搜索
- $('#KeyWords').on('keypress',function(e){
- if(e.keyCode==13){
- IndexCategoryGe();
- }
- })
- //*删除*/
- $(".inpBox").hover(function(event) {
- $(this).children(".de_icon").show();
- event.stopPropagation();
- }, function() {
- $(this).children(".de_icon").hide();
- });
- $(".de_icon").click(function(event) {
- event.stopPropagation();
- $(this).siblings("input").eq(0).val("");
- $(this).siblings("input").eq(1).val("");
- if($(this).siblings("div").find("ul").attr("id") == "zrbmtree") {
- getRY($(".zrid"), $("#zrbm").val());
- }
- });
- $(".inpBox").mouseleave(function() {
- $(this).children(".addTree").hide();
- })
- $(".xl").click(function() {
- if($(this).parent().find(".addTree").is(":hidden")) {
- $(this).parent().find(".addTree").show();
- } else {
- $(this).parent().find(".addTree").hide();
- }
- });
- //清空选项
- function Clean() {
- $(".model").hide();
- $("._CategoryName").val("");
- $("._Score").val('');
- $("._Sort").val('');
- $(".F_Title").val('');
- $(".F_Remark").val('');
- }
- ///////////////////////////////////左边表格
- /*获取选中行对象*/
- $tableLeft1.on("click-row.bs.table", function(e, row, ele) {
- $('.success').removeClass('success'); //去除之前选中的行的,选中样式
- $(ele).addClass('success'); //添加当前选中的 success样式用于区别
- Left_Cids = row.F_PagerId; //问卷ID
- $(".IMG_content").hide();
- $('#tbr').show();
- XQ(Left_Cids); ///获取问卷
- });
- //z获取问卷列表
- function IndexCategoryGe() {
- //销毁表格
- $tableLeft1.bootstrapTable('destroy');
- //初始化表格,动态从服务器加载数据
- $tableLeft1.bootstrapTable({
- method: "get", //使用get请求到服务器获取数据
- url: huayi.config.callcenter_url + "Questionnaire/GetPagerInfoList",
- contentType: 'application/x-www-form-urlencoded',
- striped: true, //表格显示条纹
- pagination: true, //启动分页
- pageSize: 5, //每页显示的记录数
- pageNumber: 1, //当前第几页
- pageList: [5, 20, 50, 100], //记录数可选列表
- search: false, //是否启用查询
- showColumns: false, //显示下拉框勾选要显示的列
- showRefresh: false, //显示刷新按钮
- sidePagination: "server", //表示服务端请求
- //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
- //设置为limit可以获取limit, offset, search, sort, order
- queryParamsType: "undefined",
- queryParams: function queryParams(params) { //设置查询参数
- var param = {
- PageIndex: params.pageNumber,
- PageSize: params.pageSize,
- Key: $("#KeyWords").val(),
- token: token
- };
- return param;
- },
- onLoadSuccess: function() { //加载成功时执行
- // layer.msg("加载成功");
- },
- onLoadError: function() { //加载失败时执行
- //layer.msg("加载数据失败", { time: 1500, icon: 2 });
- }
- });
- }
- //编号
- function setCode(val, row, index) {
- return index + 1;
- }
- //操作
- function Code(val) {
- return '<a onclick="Add(' + val + ')">操作</a>'
- }
- //右边操作
- function Add(val) {
- layer.open({
- type: 2,
- content: "../Questionnaire/addSetting.html?str=" + val, //iframe的url,no代表不显示滚动条
- title: '问卷信息',
- area: ['80%', '75%'], //宽高
- });
- }
- //删除
- $('.leftDelete').click(function() {
- if(Left_Cids) {
- layer.confirm('确定删除当前记录?', {
- btn: ['是', '否'] //按钮
- }, function() {
- DelIndexCategory(Left_Cids);
- Left_Cids='';
- });
- } else {
- layer.msg('没有可删除的选项!');
- }
- })
- //删除功能
- function DelIndexCategory(Left_Cids) {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "/Questionnaire/DeletePagerInfo",
- //url: '//117.158.196.116:8878/IndexCategory/DelIndexCategory',
- dataType: 'json',
- data: {
- id: Left_Cids,
- token: $.cookie("token"),
- },
- async: true,
- success: function(data) {
- layer.msg("删除成功");
- IndexCategoryGe();
- }
- });
- }
- ///修改功能
- $(".leftChange ").click(function() {
- var Str = Left_Cids;
- if(Left_Cids) {
- layer.open({
- type: 2,
- content: "../Questionnaire/xgWenjuanxinxi.html?str=" + Str, //iframe的url,no代表不显示滚动条
- title: '修改问卷',
- area: ['50%', '60%'], //宽高
- });
- Left_Cids='';
- } else {
- layer.msg('没有可修改的选项!');
- Clean();
- }
- })
- //增加
- $(".leftAdd").click(function() {
- var Str = Left_Cids;
- console.log(Str);
- layer.open({
- type: 2,
- content: "../Questionnaire/addSWenjuanxinxi.html?", //iframe的url,no代表不显示滚动条
- title: '增加问卷',
- area: ['50%', '60%'], //宽高
- });
- });
- ////////////////////////////////////////////////////////////////右边表格
- //详情展示
- function XQ(Left_Cids) {
- $('.WJ_box').show();
- $(".Qus_box").empty();
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "/Questionnaire/GetPagerInfoQ",
- async: true,
- dataType: "json",
- data: {
- pid: Left_Cids,
- token: $.cookie("token"),
- },
- success: function(data) {
- if(data.state.toLowerCase() == 'success') {
- $('.Title').text(data.data.F_Title);
- $("#F_Remark").text(data.data.F_Remark);
- $("#startText").text(data.data.F_StartText);
- $("#endText").text(data.data.F_EndText);
- var Questions = data.data.F_Questions;
- var html = '';
- for(var i = 0; i < Questions.length; i++) {
- var questype = Questions[i].questype;
- var Quesid = Questions[i].quesid;
- var quesremark = Questions[i].quesremark;//试题说明
- if(quesremark){
- quesremark = ' 【' + quesremark +'】';
- }else{
- quesremark = "";
- }
- html += '<li >';
- html += '<div class="Back">';
- html += '<h3 class="size-14 QuesTitle" indexs="' + Questions[i].quesid + '">' + Questions[i].questitle + quesremark + ' </h3>';
- html += '</div>';
- //判断类型
- if(questype == 2) { //问答题
- //选项
- if(Questions[i].quesitems.length > 0) {
- html += '<div>';
- var quesitems = Questions[i].quesitems;
- for(var j = 0; j < quesitems.length; j++) {
- html += '<label style="font-weight: normal;">'
- html += '' + (j + 1) + '.';
- html += '<input type="radio" index_="' + quesitems[j].itemid + '" value="' + quesitems[j].itemname + '" name="ltype' + Quesid + '" style="margin-left:5px;"> ' + quesitems[j].itemname + '</label>'
- }
- html += '</div>'
- html += '</li>'
- }
- } else if(questype == 1) {
- html += '<div>';
- html += '<textarea index="' + Questions[i].quesid + '"name="" rows="" cols="" style="width: 100%;"></textarea>'
- html += '</div>'
- } else {
- if(Questions[i].quesitems.length > 0) {
- html += '<div>';
- var quesitems = Questions[i].quesitems;
- for(var j = 0; j < quesitems.length; j++) {
- html += '<label style="font-weight: normal;">'
- html += '' + (j + 1) + '.';
- html += '<input type="checkbox" value="' + quesitems[j].itemname + '" name="checks" > ' + quesitems[j].itemname + '</label>'
- }
- html += '</div>'
- html += '</li >';
- }
- }
- }
- $(html).appendTo(".Qus_box");
- }
- }
- });
- }
|