永城市12345 (县级市)- 来源于虞城县12345 - 所有县级统一API

newRepositoryAdd20200110.js 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. var ids=helper.request.queryString("ids");
  2. var depId=helper.request.queryString("depId");
  3. var demandsid=helper.request.queryString("wid");
  4. //编辑器配置
  5. KindEditor.ready(function(K) {
  6. window.baseon = K.create('#baseon', {
  7. uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
  8. fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
  9. allowFileManager: true
  10. }); //添加弹出框编辑器
  11. });
  12. KindEditor.ready(function(K) {
  13. window.process = K.create('#process', {
  14. uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
  15. fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
  16. allowFileManager: true
  17. }); //添加弹出框编辑器
  18. });
  19. KindEditor.ready(function(K) {
  20. window.material = K.create('#material', {
  21. uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
  22. fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
  23. allowFileManager: true
  24. }); //添加弹出框编辑器
  25. });
  26. KindEditor.ready(function(K) {
  27. window.template = K.create('#template', {
  28. uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
  29. fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
  30. allowFileManager: true
  31. }); //添加弹出框编辑器
  32. });
  33. KindEditor.ready(function(K) {
  34. window.payinfo = K.create('#payinfo', {
  35. uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
  36. fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
  37. allowFileManager: true
  38. }); //添加弹出框编辑器
  39. });
  40. $(document).ready(function() {
  41. $('.tab_list li').click(function() {
  42. var index = $(this).index();
  43. $(this).addClass('active').siblings().removeClass('active');
  44. $('.tab_content>div').eq(index).show().siblings().hide();
  45. })
  46. $('.save').click(function(){
  47. saveCon();
  48. })
  49. //上传附件
  50. $("#scwj").click(function() {
  51. $("#upFile").trigger("click");
  52. })
  53. $("#upFile").change(function() {
  54. upload();
  55. })
  56. //保存
  57. function saveCon(){
  58. var paymoney=$('#paymoney').val()*1;
  59. var a=paymoney.toFixed(2)
  60. // var reg=/^([+-]?)\d*\.?\d+$/;
  61. // if($("#publicphone1").val()!==''){
  62. // if(!reg.test($.trim($("#publicphone1").val()))) {
  63. // layer.confirm('请输入有效的公开电话!', {
  64. // btn: ['确定'] //按钮
  65. // });
  66. // $("#publicphone1").val('');
  67. // $("#publicphone1").focus();
  68. // return;
  69. // }
  70. // }if($("#publicphone2").val()!==''){
  71. // if(!reg.test($.trim($("#publicphone2").val()))){
  72. // layer.confirm('请输入有效的公开电话!', {
  73. // btn: ['确定'] //按钮
  74. // });
  75. // $("#publicphone2").val('');
  76. // $("#publicphone2").focus();
  77. // return;
  78. // }
  79. // }if($("#privatephone1").val()!==''){
  80. // if(!reg.test($.trim($("#privatephone1").val()))){
  81. // layer.confirm('请输入有效的内部电话!', {
  82. // btn: ['确定'] //按钮
  83. // });
  84. // $("#privatephone1").val('');
  85. // $("#privatephone1").focus();
  86. // return;
  87. // }
  88. // }if($("#privatephone2").val()!==''){
  89. // if(!reg.test($.trim($("#privatephone2").val()))){
  90. // layer.confirm('请输入有效的内部电话!', {
  91. // btn: ['确定'] //按钮
  92. // });
  93. // $("#privatephone2").val('');
  94. // $("#privatephone2").focus();
  95. // return;
  96. // }
  97. // }if($("#otherpublicphone").val()!==''){
  98. // if(!reg.test($.trim($("#otherpublicphone").val()))){
  99. // layer.confirm('请输入有效的协办单位公开电话!', {
  100. // btn: ['确定'] //按钮
  101. // });
  102. // $("#otherpublicphone").val('');
  103. // $("#otherpublicphone").focus();
  104. // return;
  105. // }
  106. // }if($("#otherprivatephone").val()!==''){
  107. // if(!reg.test($.trim($("#otherprivatephone").val()))){
  108. // layer.confirm('请输入有效的协办单位内部电话!', {
  109. // btn: ['确定'] //按钮
  110. // });
  111. // $("#otherprivatephone").val('');
  112. // $("#otherprivatephone").focus();
  113. // return;
  114. // }
  115. // }
  116. $.ajax({
  117. type:'post',
  118. url:huayi.config.callcenter_url +'Repository/AddRepository',
  119. async:true,
  120. dataType:'json',
  121. data:{
  122. token:$.cookie("token"),
  123. deptid:depId,//单位id
  124. id:ids,//知识库id
  125. key:$('#key').val(),//关键字
  126. title:$('#title').val(),//事件名称
  127. maindept:$('#maindept').val(),//主办单位
  128. publicphone1:$('#publicphone1').val(),//公开电话1
  129. publicphone2:$('#publicphone2').val(),//公开电话2
  130. privatephone1:$('#privatephone1').val(),//内部电话1
  131. privatephone2:$('#privatephone2').val(),//内部电话2
  132. points:$('#points').val(),//询问要点
  133. baseanswer:$('#baseanswer').val(),//标准话术
  134. endanswer:$('#endanswer').val(),//结案参考
  135. dealtype:$('#dealtype').val(),//办理方式
  136. legallimittime:$('#legallimittime').val(),//法定办结时限
  137. promiselimittime:$('#promiselimittime').val(),//承诺办结时限
  138. ispay: $('input[name="ispay"]:checked ').val(),//是否收费
  139. paymoney: a,//收费标准
  140. officeaddress: $('#officeaddress').val(),//办公地点
  141. serobject: $('#serobject').val(),//办理对象
  142. busline: $('#busline').val(),//乘车路线
  143. officetime: $('#officetime').val(),//办公时间
  144. otherdept: $('#otherdept').val(),// 协办单位
  145. otherpublicphone: $('#otherpublicphone').val(),// 协办单位公开电话
  146. otherprivatephone: $('#otherprivatephone').val(),//协办单位内部电话
  147. remark: $('#remark').val(),//备注
  148. baseon: encodeURIComponent(baseon.html()),//设定依据
  149. process: encodeURIComponent(process.html()),//办理流程
  150. material: encodeURIComponent(material.html()),//办理材料
  151. template: encodeURIComponent(template.html()),//办理结果样本
  152. payinfo: encodeURIComponent(payinfo.html()),//收费标准及依据
  153. files: $('#file').val() //收费标准及依据
  154. },
  155. success:function(data){
  156. if(data.state.toLowerCase()=='success'){
  157. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  158. parent.layer.close(index); //再执行关闭
  159. parent.layer.msg(data.message); //再执行关闭
  160. parent.$('#table1').bootstrapTable('refresh'); //再执行关闭
  161. }
  162. }
  163. });
  164. }
  165. if(depId&&depId!=99999&&depId!=0){
  166. $.ajax({
  167. type:"get",
  168. url:huayi.config.callcenter_url +"Department/GetDept",
  169. async:true,
  170. dataType:'json',
  171. data:{
  172. token: $.cookie("token"),
  173. id:depId
  174. },
  175. success:function(result){
  176. if(result.state.toLowerCase()=='success'){
  177. var con=result.data;
  178. $('#mechanism').val(con.F_Remark);
  179. }
  180. }
  181. });
  182. }else{
  183. $('.mechanism').css('display','none')
  184. }
  185. //获取知识库详情
  186. if(ids){
  187. $.ajax({
  188. type:"get",
  189. url:huayi.config.callcenter_url +"Repository/GetRepository",
  190. async:true,
  191. dataType:'json',
  192. data:{
  193. token: $.cookie("token"),
  194. id:ids
  195. },
  196. success:function(result){
  197. if(result.state.toLowerCase()=='success'){
  198. var con=result.data.data;
  199. $('#key').val(con.F_Key);//关键字
  200. $('#title').val(con.F_Title);//事件名称
  201. $('#maindept').val(con.F_MainDept);//主办单位
  202. $('#publicphone1').val(con.F_PublicPhone1);//公开电话1
  203. $('#publicphone2').val(con.F_PublicPhone2);//公开电话2
  204. $('#privatephone1').val(con.F_PrivatePhone1);//内部电话1
  205. $('#privatephone2').val(con.F_PrivatePhone2);//内部电话2
  206. $('#points').val(con.F_Points);//询问要点
  207. $('#baseanswer').val(con.F_BaseAnswer);//标准话术
  208. $('#endanswer').val(con.F_EndAnswer);//结案参考
  209. $('#dealtype').val(con.F_DealType);//办理方式
  210. $('#legallimittime').val(con.F_LegalLimitTime);//法定办结时限
  211. $('#promiselimittime').val(con.F_PromiseLimitTime);//承诺办结时限
  212. // $('input[name="ispay"]:checked ').val(F_PayMoney);//是否收费
  213. $('input[name="ispay"][value="'+con.F_IsPay+'"]').prop("checked","checked");//是否收费
  214. $('#paymoney').val(con.F_PayMoney);//收费标准
  215. $('#officeaddress').val(con.F_OfficeAddress);//办公地点
  216. $('#serobject').val(con.F_Object);//办理对象
  217. $('#busline').val(con.F_BusLine);//乘车路线
  218. $('#officetime').val(con.F_OfficeTime);//办公时间
  219. $('#otherdept').val(con.F_OtherDept);// 协办单位
  220. $('#otherpublicphone').val(con.F_OtherPublicPhone);// 协办单位公开电话
  221. $('#otherprivatephone').val(con.F_OtherPrivatePhone);//协办单位内部电话
  222. $('#remark').val(con.F_Remark);//备注
  223. baseon.html(con.F_BaseOn);
  224. process.html(con.F_Process);
  225. material.html(con.F_Material);
  226. template.html(con.F_Template);
  227. payinfo.html(con.F_PayInfo);
  228. depId=con.F_DeptId;
  229. // $('#baseon').val(con.F_BaseOn);//设定依据
  230. // $('#process').val(con.F_Process);//办理流程
  231. // $('#material').val(con.F_Material);//办理材料
  232. // $('#template').val(con.F_Template);//办理结果样本
  233. // $('#payinfo').val(con.F_PayInfo);//收费标准及依据
  234. // $('#files').val() //收费标准及依据
  235. $(result.data.file).each(function(k,q){
  236. var strs='<span class="files" fiel-num="'+ q.F_FileId +'">'+ q.F_FileName.substring(19) +'<i class="fa fa-remove del_file"></i></span>'
  237. $(strs).appendTo($('.fileBox')).find('.del_file').click(function(event){
  238. event.stopPropagation();
  239. $(this).parent().remove();
  240. file_num()
  241. console.log($('.fileBox').find('.del_file'))
  242. })
  243. file_num()
  244. })
  245. }
  246. }
  247. });
  248. }
  249. })
  250. //上传文件
  251. function upload() {
  252. var Files = document.getElementById("upFile").files;
  253. if(Files.length > 0) {
  254. var formData = new FormData();
  255. for(var i = 0; i < Files.length; i++) {
  256. formData.append('file' + i, Files[i]);;
  257. }
  258. console.log(formData)
  259. formData.append("token", $.cookie("token"));
  260. var typeName=Files[0].name.split('.')[1];
  261. if (typeName=="png"||typeName=='jpg'||typeName=='mp4'||typeName=='mp3'||typeName=='pdf'||typeName=='doc'||typeName=='docx'||typeName=='xls'||typeName=='xlsx') {
  262. $.ajax({
  263. url: huayi.config.callcenter_url + "/WorkOrder/UploadFile",
  264. type: "POST",
  265. data: formData,
  266. /**
  267. *必须false才会自动加上正确的Content-Type
  268. */
  269. contentType: false,
  270. /**
  271. * 必须false才会避开jQuery对 formdata 的默认处理
  272. * XMLHttpRequest会对 formdata 进行正确的处理
  273. */
  274. processData: false,
  275. success: function(result) {
  276. document.getElementById("upFile").outerHTML = document.getElementById("upFile").outerHTML;
  277. $("#upFile").change(function() {
  278. upload();
  279. });
  280. var r = $.parseJSON(result);
  281. if(r.state.toLowerCase() == "success") {
  282. // $(".fjnr").text(r.data[0].F_FileName);
  283. var a = r.data;
  284. $(a).each(function(i, n) {
  285. var strs = '<span class="files" fiel-num="' + n.F_FileId + '">' + n.F_FileName.substring(19) + '<i class="fa fa-remove del_file"></i></span>'
  286. $(strs).appendTo($('.fileBox')).find('.del_file').click(function(event) {
  287. event.stopPropagation();
  288. $(this).parent().remove();
  289. file_num()
  290. })
  291. })
  292. file_num()
  293. }
  294. }
  295. });
  296. }else{
  297. layer.msg("格式不正确");
  298. }
  299. } else {
  300. layer.confirm('请上传文件!', {
  301. btn: ['确定']
  302. });
  303. }
  304. }
  305. //上传文件隐藏域值
  306. function file_num() {
  307. var str = '';
  308. var Str;
  309. $('.fileBox .files').each(function(j, m) {
  310. var aa = $(m).attr("fiel-num")
  311. console.log(aa);
  312. str += aa + ",";
  313. Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
  314. })
  315. $("#file").val(Str);
  316. }