| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 |
- var ids=helper.request.queryString("ids");
- var depId=helper.request.queryString("depId");
- var demandsid=helper.request.queryString("wid");
- //编辑器配置
- KindEditor.ready(function(K) {
- window.baseon = K.create('#baseon', {
- uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
- fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
- allowFileManager: true
- }); //添加弹出框编辑器
- });
- KindEditor.ready(function(K) {
- window.process = K.create('#process', {
- uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
- fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
- allowFileManager: true
- }); //添加弹出框编辑器
- });
- KindEditor.ready(function(K) {
- window.material = K.create('#material', {
- uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
- fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
- allowFileManager: true
- }); //添加弹出框编辑器
- });
- KindEditor.ready(function(K) {
- window.template = K.create('#template', {
- uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
- fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
- allowFileManager: true
- }); //添加弹出框编辑器
- });
- KindEditor.ready(function(K) {
- window.payinfo = K.create('#payinfo', {
- uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
- fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
- allowFileManager: true
- }); //添加弹出框编辑器
- });
-
- $(document).ready(function() {
- if(depId==99999){
- var isurgent=1
- // $('.radio-inline input').attr('checked','false');
- // $('.radio-inline input:first').attr('checked','true');
- }else{
- var isurgent=0
- }
- $('.tab_list li').click(function() {
- var index = $(this).index();
- $(this).addClass('active').siblings().removeClass('active');
- $('.tab_content>div').eq(index).show().siblings().hide();
- })
-
- $('.save').click(function(){
- issubmit=0;
- saveCon(issubmit);
- })
- $('.savetj').click(function(){
- issubmit=1;
- saveCon(issubmit);
- })
- //上传附件
- $("#scwj").click(function() {
- $("#upFile").trigger("click");
- })
- $("#upFile").change(function() {
- upload();
- })
-
- //保存
- function saveCon(){
- if(!demandsid){
- demandsid=''
- }
- var paymoney=$('#paymoney').val()*1;
- var a=paymoney.toFixed(2)
- // var reg=/^([+-]?)\d*\.?\d+$/;
- // if($("#publicphone1").val()!==''){
- // if(!reg.test($.trim($("#publicphone1").val()))) {
- // layer.confirm('请输入有效的公开电话!', {
- // btn: ['确定'] //按钮
- // });
- // $("#publicphone1").val('');
- // $("#publicphone1").focus();
- // return;
- // }
- // }if($("#publicphone2").val()!==''){
- // if(!reg.test($.trim($("#publicphone2").val()))){
- // layer.confirm('请输入有效的公开电话!', {
- // btn: ['确定'] //按钮
- // });
- // $("#publicphone2").val('');
- // $("#publicphone2").focus();
- // return;
- // }
- // }if($("#privatephone1").val()!==''){
- // if(!reg.test($.trim($("#privatephone1").val()))){
- // layer.confirm('请输入有效的内部电话!', {
- // btn: ['确定'] //按钮
- // });
- // $("#privatephone1").val('');
- // $("#privatephone1").focus();
- // return;
- // }
- // }if($("#privatephone2").val()!==''){
- // if(!reg.test($.trim($("#privatephone2").val()))){
- // layer.confirm('请输入有效的内部电话!', {
- // btn: ['确定'] //按钮
- // });
- // $("#privatephone2").val('');
- // $("#privatephone2").focus();
- // return;
- // }
- // }if($("#otherpublicphone").val()!==''){
- // if(!reg.test($.trim($("#otherpublicphone").val()))){
- // layer.confirm('请输入有效的协办单位公开电话!', {
- // btn: ['确定'] //按钮
- // });
- // $("#otherpublicphone").val('');
- // $("#otherpublicphone").focus();
- // return;
- // }
- // }if($("#otherprivatephone").val()!==''){
- // if(!reg.test($.trim($("#otherprivatephone").val()))){
- // layer.confirm('请输入有效的协办单位内部电话!', {
- // btn: ['确定'] //按钮
- // });
- // $("#otherprivatephone").val('');
- // $("#otherprivatephone").focus();
- // return;
- // }
- // }
- $.ajax({
- type:'post',
- url:huayi.config.callcenter_url +'Repository/SaveRepository',
- async:true,
- dataType:'json',
- data:{
- token:$.cookie("token"),
- demandsid:demandsid,//索要记录添加到知识库id
- deptid:depId,//单位id
- id:ids,//知识库id
- key:$('#key').val(),//关键字
- title:$('#title').val(),//事件名称
- maindept:$('#maindept').val(),//主办单位
- publicphone1:$('#publicphone1').val(),//公开电话1
- publicphone2:$('#publicphone2').val(),//公开电话2
- privatephone1:$('#privatephone1').val(),//内部电话1
- privatephone2:$('#privatephone2').val(),//内部电话2
- points:$('#points').val(),//询问要点
- baseanswer:$('#baseanswer').val(),//标准话术
- endanswer:$('#endanswer').val(),//参考答案
- dealtype:$('#dealtype').val(),//办理方式
- legallimittime:$('#legallimittime').val(),//法定办结时限
- promiselimittime:$('#promiselimittime').val(),//承诺办结时限
- // ispay: $('input[name="ispay"]:checked ').val(),//是否收费
- issubmit: issubmit,//是否审核
- // isurgent: $('input[name="isUrgency"]:checked ').val(),//是否紧急事项
- isurgent: isurgent,//是否紧急事项 1是 0 否
- paymoney: a,//收费标准
- officeaddress: $('#officeaddress').val(),//办公地点
- serobject: $('#serobject').val(),//办理对象
- busline: $('#busline').val(),//乘车路线
- officetime: $('#officetime').val(),//办公时间
- otherdept: $('#otherdept').val(),// 协办单位
- otherpublicphone: $('#otherpublicphone').val(),// 协办单位公开电话
- otherprivatephone: $('#otherprivatephone').val(),//协办单位内部电话
- remark: $('#remark').val(),//备注
- baseon: encodeURIComponent(baseon.html()),//设定依据
- process: encodeURIComponent(process.html()),//办理流程
- material: encodeURIComponent(material.html()),//办理材料
- template: encodeURIComponent(template.html()),//办理结果样本
- payinfo: encodeURIComponent(payinfo.html()),//收费标准及依据
- files: $('#file').val() //收费标准及依据
- },
- success:function(data){
- if(data.state.toLowerCase()=='success'){
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.layer.msg(data.message); //再执行关闭
- parent.$('#table1').bootstrapTable('refresh'); //再执行关闭
- parent.$('#orderlist').bootstrapTable('refresh'); //再执行关闭
- }
-
- }
- });
- }
-
- if(depId&&depId!=99999&&depId!=0){
- $.ajax({
- type:"get",
- url:huayi.config.callcenter_url +"Department/GetDept",
- async:true,
- dataType:'json',
- data:{
- token: $.cookie("token"),
- id:depId
- },
- success:function(result){
- if(result.state.toLowerCase()=='success'){
- var con=result.data;
- $('#mechanism').val(con.F_Remark);
- }
-
- }
- });
- }else{
- $('.mechanism').css('display','none')
- }
- //获取知识库详情
- if(ids){
- $.ajax({
- type:"get",
- url:huayi.config.callcenter_url +"Repository/GetInfo",
- async:true,
- dataType:'json',
- data:{
- token: $.cookie("token"),
- id:ids
- },
- success:function(result){
- if(result.state.toLowerCase()=='success'){
- var con=result.data.data;
- $('#key').val(con.F_Key);//关键字
- $('#title').val(con.F_Title);//事件名称
- $('#maindept').val(con.F_MainDept);//主办单位
- $('#publicphone1').val(con.F_PublicPhone1);//公开电话1
- $('#publicphone2').val(con.F_PublicPhone2);//公开电话2
- $('#privatephone1').val(con.F_PrivatePhone1);//内部电话1
- $('#privatephone2').val(con.F_PrivatePhone2);//内部电话2
- $('#points').val(con.F_Points);//询问要点
- $('#baseanswer').val(con.F_BaseAnswer);//标准话术
- $('#endanswer').val(con.F_EndAnswer);//结案参考
- $('#dealtype').val(con.F_DealType);//办理方式
- $('#legallimittime').val(con.F_LegalLimitTime);//法定办结时限
- $('#promiselimittime').val(con.F_PromiseLimitTime);//承诺办结时限
- // $('input[name="ispay"]:checked ').val(F_PayMoney);//是否收费
- // $('input[name="ispay"][value="'+con.F_IsPay+'"]').prop("checked","checked"),//是否收费
- $('input[name="isUrgency"][value="'+con.F_IsPay+'"]').prop("checked","checked"),//是否紧急事项
- $('#paymoney').val(con.F_PayMoney);//收费标准
- $('#officeaddress').val(con.F_OfficeAddress);//办公地点
- $('#serobject').val(con.F_Object);//办理对象
- $('#busline').val(con.F_BusLine);//乘车路线
- $('#officetime').val(con.F_OfficeTime);//办公时间
- $('#otherdept').val(con.F_OtherDept);// 协办单位
- $('#otherpublicphone').val(con.F_OtherPublicPhone);// 协办单位公开电话
- $('#otherprivatephone').val(con.F_OtherPrivatePhone);//协办单位内部电话
- $('#remark').val(con.F_Remark);//备注
- baseon.html(con.F_BaseOn);
- process.html(con.F_Process);
- material.html(con.F_Material);
- template.html(con.F_Template);
- payinfo.html(con.F_PayInfo);
- depId=con.F_DeptId;
- $(result.data.file).each(function(k,q){
- var strs='<span class="files" fiel-num="'+ q.F_FileId +'">'+ q.F_FileName.substring(19) +'<i class="fa fa-remove del_file"></i></span>'
- $(strs).appendTo($('.fileBox')).find('.del_file').click(function(event){
- event.stopPropagation();
- $(this).parent().remove();
- file_num()
- console.log($('.fileBox').find('.del_file'))
- })
- file_num()
- })
-
- }
-
- }
- });
-
- }
-
-
- })
-
- //上传文件
- function upload() {
- var Files = document.getElementById("upFile").files;
- if(Files.length > 0) {
- var formData = new FormData();
- for(var i = 0; i < Files.length; i++) {
- formData.append('file' + i, Files[i]);;
- }
- console.log(formData)
- formData.append("token", $.cookie("token"));
- var typeName=Files[0].name.split('.')[1];
- if (typeName=="png"||typeName=='jpg'||typeName=='mp4'||typeName=='mp3'||typeName=='pdf'||typeName=='doc'||typeName=='docx'||typeName=='xls'||typeName=='xlsx') {
- $.ajax({
- url: huayi.config.callcenter_url + "/WorkOrder/UploadFile",
- type: "POST",
- data: formData,
- /**
- *必须false才会自动加上正确的Content-Type
- */
- contentType: false,
- /**
- * 必须false才会避开jQuery对 formdata 的默认处理
- * XMLHttpRequest会对 formdata 进行正确的处理
- */
- processData: false,
- success: function(result) {
- document.getElementById("upFile").outerHTML = document.getElementById("upFile").outerHTML;
- $("#upFile").change(function() {
- upload();
- });
- var r = $.parseJSON(result);
- if(r.state.toLowerCase() == "success") {
- // $(".fjnr").text(r.data[0].F_FileName);
- var a = r.data;
- $(a).each(function(i, n) {
- var strs = '<span class="files" fiel-num="' + n.F_FileId + '">' + n.F_FileName.substring(19) + '<i class="fa fa-remove del_file"></i></span>'
- $(strs).appendTo($('.fileBox')).find('.del_file').click(function(event) {
- event.stopPropagation();
- $(this).parent().remove();
- file_num()
- })
- })
- file_num()
- }
- }
- });
- }else{
- layer.msg("格式不正确");
- }
- } else {
- layer.confirm('请上传文件!', {
- btn: ['确定']
- });
- }
- }
- //上传文件隐藏域值
- function file_num() {
- var str = '';
- var Str;
- $('.fileBox .files').each(function(j, m) {
- var aa = $(m).attr("fiel-num")
- console.log(aa);
- str += aa + ",";
- Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
- })
- $("#file").val(Str);
- }
-
|