| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- var id = helper.request.queryString("id");
- $(document).ready(function () {
- laydate.skin('blue');
- laydate({
- elem: '#publishTime',
- event: 'focus',
- istime: true,
- format: 'YYYY-MM-DD hh:mm:ss'
- });
- laydate({
- elem: '#effectiveTime',
- event: 'focus',
- istime: true,
- format: 'YYYY-MM-DD hh:mm:ss'
- });
- laydate({
- elem: '#invalidTime',
- event: 'focus',
- istime: true,
- format: 'YYYY-MM-DD hh:mm:ss'
- });
- laydate({
- elem: '#processingTime',
- event: 'focus',
- istime: true,
- format: 'YYYY-MM-DD hh:mm:ss'
- });
- $(".save").click(function () {
- saveCon();
- });
- //上传附件
- $("#scwj").click(function () {
- $("#upFile").trigger("click");
- });
- $("#upFile").change(function () {
- upload();
- });
- //保存
- function saveCon() {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "LawGuide/AddModel",
- async: true,
- dataType: "json",
- data: {
- token: $.cookie("token"),
- id: id, //知识库id
- key: $("#keyId").val(), // 关键词id
- fabudanwei: $("#publishUnit").val(), // 发布单位
- faburen: $("#publishPersonal").val(), // 发布人
- hangye: $("#industry").val(), // 所属行业
- diqu: $("#address").val(), // 地区
- fabushijian: $("#publishTime").val(), // 发布时间
- shengxiaoshijian: $("#effectiveTime").val(), // 生效时间
- shixiaoshijian: $("#invalidTime").val(), // 失效时间
- yewumingcheng: $("#businessName").val(), // 业务名称
- biaoshibianma: $("#identifyEncoding").val(), // 标识编码
- shenqingtiaojian: $("#applicationConditions").val(), // 申请条件
- zhengceyiju: $("#policyBased").val(), // 政策依据
- wangshangbanlilianjie: $("#onlineURL").val(), // 网上办理链接
- file: $("#file").val(), // 附件
- banlicailiao: $("#handlingMaterials").val(), // 办理材料
- banlishixian: $("#processingTimeLimit").val(), // 办理时限
- banlididian: $("#handlingPlace").val(), // 办理地点
- banlishijian: $("#processingTime").val(), // 办理时间
- banlidianhua: $("#telephone").val(), // 电话
- qitashuoming: $("#otherInstructions").val(), // 其他说明
- banliliucheng: $("#process").val(), // 办理流程
- beizhu: $("#remark").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.$("#tableList").bootstrapTable("refresh"); //再执行关闭
- }
- },
- });
- }
- //获取知识库详情
- if (id) {
- $(".addOrEditDisplay").show();
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "LawGuide/GetModel",
- async: true,
- dataType: "json",
- data: {
- token: $.cookie("token"),
- id: id,
- },
- success: function (result) {
- if (result.state.toLowerCase() == "success") {
- var model = result.data.model;
- var dtkey = result.data.dtkey;
- var dtfile = result.data.dtfile;
- $("#publishUnit").val(model.F_FaBuDanWei);
- $("#publishPersonal").val(model.F_FaBuRen);
- $("#industry").val(model.F_HangYe);
- $("#address").val(model.F_DiQu);
- $("#publishTime").val(model.F_FaBuShiJian);
- $("#effectiveTime").val(model.F_ShengXiaoShiJian);
- $("#invalidTime").val(model.F_ShiXiaoShiJian);
- $("#businessName").val(model.F_YeWuMingCheng);
- $("#identifyEncoding").val(model.F_BiaoShiBianMa);
- $("#applicationConditions").val(model.F_ShenQingTiaoJian);
- $("#policyBased").val(model.F_ZhengCeYiJu);
- $("#onlineURL").val(model.F_WangShangBanLiLianJie);
- $("#handlingMaterials").val(model.F_BanLiCaiLiao);
- $("#processingTimeLimit").val(model.F_BanLiShiXian);
- $("#handlingPlace").val(model.F_BanLiDiDian);
- $("#processingTime").val(model.F_BanLiShiJian);
- $("#telephone").val(model.F_BanLiDianHua);
- $("#otherInstructions").val(model.F_QiTaShuoMing);
- $("#process").val(model.F_BanLiLiuCheng);
- $("#remark").val(model.F_BeiZhu);
- $("#reflectCategory").val(dtkey[0].name);
- $("#keyId").val(dtkey[0].id);
- $(dtfile).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();
- });
- }
- },
- });
- } else {
- $(".addOrEditDisplay").hide();
- }
- });
- //上传文件
- 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]);
- }
- formData.append("token", $.cookie("token"));
- console.log(formData);
- console.log("123",formData.file0);
- 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 + "LawGuide/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);
- }
|