| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <script src="../Script/Common/huayi.load.js"></script>
- <script src="../Script/Common/huayi.config.js"></script>
- <link href="../css/Table/table1.css" rel="stylesheet" />
- <link href="../css/init.css" rel="stylesheet" />
- <link rel="stylesheet" href="../css/Quality/bootstrap-editable.css" />
- <script src="../js/Questions/bootstrap-editable.js"></script>
- <title></title>
- <style>
- table tr {
- margin-bottom: 20px;
- }
-
- table tr td {
- text-align: left;
- padding: 5px;
- }
-
- .Content {
- padding: 10px;
- }
-
- .btn {
- background: #1ab394;
- }
-
- .Btn_box {
- margin-top: 20px;
- color: #fff;
- }
-
- .inpBox select {
- width: 150px;
- padding: 3px 6px;
- }
-
- .F_Remark {
- width: 100%;
- }
-
- </style>
- </head>
- <body>
- <div>
- <div class="Content">
- <div class="tab">
- <table id="sqzx" style="width: 100%;" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <th>试题分类:</th>
- <td>
- <div class="inpBox">
- <select name="" id="Select">
- <option value="">请选择试题分类</option>
- </select>
- </div>
- </td>
- <th>试题题型:</th>
- <td>
- <div class="inpBox">
- <select name="" id="CheckQuestion">
- <option value="1">问答题</option>
- <option value="2">单选题</option>
- <option value="3">多选题</option>
- </select>
- </div>
- </td>
- </tr>
- <tr>
- <th>试题标题:</th>
- <td colspan="5">
- <textarea name="" rows="3" cols="20" class="F_Remark"></textarea>
- </td>
- </tr>
- </table>
- </div>
- <div style="text-align: center; margin-top: 50px;">
- <button class="btns add size-14">保存</button>
- </div>
- </div>
- </div>
- <script>
- var Cids = helper.request.queryString("Cids");
- var QuestionId;
- $(document).ready(function() {
- Select();
- //获取详情
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Questionnaire/GetQuestionModel",
- dataType: 'json',
- async: true,
- data: {
- id: Cids,
- token: $.cookie("token")
- },
- success: function(data) {
- /*验证请求*/
- if(data.state == "success") {
- $("#Select").val(data.data.F_CategoryId); //试题分类
- console.log(data.data.F_CategoryId);
- QuestionId=data.data.F_QuestionId;
- $("#CheckQuestion").val(data.data.F_Type); //问题类型F_Title
- $('.F_Remark').val(data.data.F_Title)//标题
- }
- }
- });
- //获取全部试题分类列表
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Questionnaire/GetQCategoryAlllist",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token")
- },
- success: function(data) {
- /*验证请求*/
- if(data.state == "success") {
- var html = ''
- for(var i = 0; i < data.data.length; i++) {
- html += '<option value="' + data.data[i].F_CategoryId + '">' + data.data[i].F_CategoryName + '</option>'
- }
- $(html).appendTo("#Select");
- }
- }
- });
- //切换效果
- $("#CheckQuestion").change(function() {
- var ss = $(this).val();
- if(ss == "1") {
- $(".Check_box").hide();
- } else {
- $(".Check_box").show();
- }
- });
- //列表
- function Select() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Questionnaire/GetQCategoryAlllist",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token")
- },
- success: function(data) {
- /*验证请求*/
- if(data.state == "success") {
- var html = ''
- for(var i = 0; i < data.data.length; i++) {
- html += '<option value="' + data.data[i].F_CategoryId + '">' + data.data[i].F_CategoryName + '</option>'
- }
- $(html).appendTo("#Select");
- }
- }
- });
- }
- });
- //序号
- function setCode(value, row, index) {
- return index + 1;
- }
- //修改
- function Check(value, row, index) {
- return '<a title="点击移入" class="username">' + value + '</a>'
- }
- //操作
- function Remove(value, row, index) {
- return '<div><a title="点击移入" ><i class="fa fa-remove size-14"></i></a></div>'
- }
- $("#Add").click(function() {
- var index = $tableLeft.bootstrapTable('getData').length;
- $tableLeft.bootstrapTable('insertRow', {
- index: index,
- row: {
- id: '测试',
- F_CategoryName: '测试测试'
- }
- });
- });
- ;
- //增加
- $(".add").click(function() {
- var CategoryId = $("#Select").val(); //试题分类
- var Title = $(".F_Remark").val(); //试题题型
- if(!CategoryId) {
- layer.msg("未选择分类");
- } else if(!Title) {
- layer.msg("标题不能为空");
- }
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "Questionnaire/CreateOrUpdateQuestion",
- async: true,
- dataType: "json",
- data: {
- F_QuestionId:QuestionId,//试题ID
- F_CategoryId: CategoryId, //分类ID
- F_Title: Title, //试题标题
- // F_Content://试题内容
- F_Type: $("#CheckQuestion").val(), //题型(1.问答题;2.单选题;3.多选题)
- token: $.cookie("token"),
- },
- success: function(data) {
- if(data.state.toLowerCase() == 'success') {
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.Finish();
- parent.layer.msg("修改成功");
- }
- }
- });
- })
- //清除 CLEAN
- function Clean() {
- }
- </script>
- </body>
- </html>
|