You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
141 lines
5.7 KiB
141 lines
5.7 KiB
11 months ago
|
|
||
|
KindEditor.ready(function (K) {
|
||
|
|
||
|
layui.use(['form', 'layer', 'table', 'laytpl', 'laydate', 'upload','element'], function () {
|
||
|
var form = layui.form,
|
||
|
layer = parent.layer === undefined ? layui.layer : top.layer,
|
||
|
$ = layui.jquery,
|
||
|
laytpl = layui.laytpl,
|
||
|
table = layui.table,
|
||
|
element = layui.element;
|
||
|
laydate = layui.laydate,
|
||
|
upload = layui.upload;
|
||
|
var OrgId = JSON.parse(window.sessionStorage.getItem("userInfo")).OrgID;
|
||
|
var OrgName = JSON.parse(window.sessionStorage.getItem("userInfo")).OrgName;
|
||
|
var UID = JSON.parse(window.sessionStorage.getItem("userInfo")).UserCode;
|
||
|
var UName = JSON.parse(window.sessionStorage.getItem("userInfo")).USERS_NAME;
|
||
|
|
||
|
var loading;
|
||
|
upload.render({
|
||
|
elem: "#uploadFile",
|
||
|
//url: "http://192.168.31.205:5055/political/mobile/yqlayuiFileUtils",
|
||
|
url: "http://56g0f0734.nat123.fun:53113/political/mobile/yqlayuiFileUtils",
|
||
|
accept: "file", //普通文件
|
||
|
// exts: 'xls|doc|xlsx|docx|pdf|pptx|ppt', //允许的上传文件格式
|
||
|
before: function (obj) {
|
||
|
this.data = { "dir": "file" };
|
||
|
},
|
||
|
progress: function (n) {//上传进度回调 n进度值
|
||
|
var percent = n + '%'; //计算出进度
|
||
|
$("#uploadFile").attr("lay-percent", percent);
|
||
|
element.render();
|
||
|
loading = layer.load(2, {
|
||
|
shade: [0.1, '#000'],
|
||
|
content: '后台处理中,请耐心等待......',
|
||
|
success: function (layerContentStyle) { // 设置loading样式
|
||
|
layerContentStyle.find('.layui-layer-iframe').css({
|
||
|
'padding-left': '45px',
|
||
|
'text-align': 'left',
|
||
|
'width': '200px',
|
||
|
'line-height': '30px'
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
done: function (data) {
|
||
|
$("#file_url").val(data.url);
|
||
|
//if ("pptx" == data.fileExt || "pdf" == data.fileExt || "doc" == data.fileExt || "docx" == data.fileExt) {
|
||
|
// $("#totalPage").val(data.totalPage);
|
||
|
//}
|
||
|
layer.close(loading);
|
||
|
layer.msg("上传成功");
|
||
|
$("#checkFile").show();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
//初始化下拉菜单,绑定通知公告类型
|
||
|
$.ajax({
|
||
|
type: "post",
|
||
|
url: "../../ashx/ZYOaKnolageHandler.ashx",
|
||
|
data: { Action: "getDicdetail", mod_code: "XFJY_BType", dic_fid: "" },
|
||
|
dataType: "json",
|
||
|
success: function (res) {
|
||
|
if (res.code == 0) {
|
||
|
var arr = res.data;
|
||
|
var optionhtml = '<option value="">--请选择模块--</option>';
|
||
|
arr.forEach(function (item) {
|
||
|
optionhtml += '<option data-idx="' + item.ID + '" value="' + item.DIC_VALUE + '">' + item.DIC_TEXT + '</option>';
|
||
|
});
|
||
|
$("#cls").html(optionhtml);
|
||
|
form.render();
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
form.on('select(cls)', function (data) {
|
||
|
var dic_fid = "";
|
||
|
dic_fid = data.elem[data.elem.selectedIndex].dataset.idx
|
||
|
if (data.value == "") {
|
||
|
$("#ntype").html("");
|
||
|
form.render();
|
||
|
}
|
||
|
|
||
|
//初始化下拉菜单,绑定通知公告类型ANN_TYPE
|
||
|
$.ajax({
|
||
|
type: "post",
|
||
|
url: "../../ashx/ZYOaKnolageHandler.ashx",
|
||
|
data: { Action: "getDicdetail", mod_code: "XFJY_BType", dic_fid: dic_fid },
|
||
|
dataType: "json",
|
||
|
success: function (res) {
|
||
|
if (res.code == 0) {
|
||
|
var arr = res.data;
|
||
|
var optionhtml = '<option value="">--请选择类型--</option>';
|
||
|
arr.forEach(function (item) {
|
||
|
optionhtml += '<option value="' + item.DIC_VALUE + '">' + item.DIC_TEXT + '</option>';
|
||
|
});
|
||
|
$("#ntype").html(optionhtml);
|
||
|
form.render();
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
|
||
|
form.on("submit(AddEdit)", function (data) {
|
||
|
|
||
|
//load提交
|
||
|
var index = layer.msg('数据提交中,请稍候', { icon: 16, time: false, shade: 0.8 });
|
||
|
$.post("../../ashx/ZYOaKnolageHandler.ashx", {
|
||
|
Action: $(".Action").val(),
|
||
|
id: $(".ID").val(), //ID
|
||
|
cls: $("#cls").val(), //类别
|
||
|
ntype: $("#ntype").val(), //类型
|
||
|
art_title: $("#art_title").val(), //标题
|
||
|
art_come: $("#art_come").val(), //来源
|
||
|
file_type: $("#file_type").val(), //文件类型
|
||
|
file_url: $("#file_url").val(), //文件地址
|
||
|
|
||
|
org_id: OrgId, //机构id
|
||
|
org_name: OrgName, //机构名称
|
||
|
uid: UID, //
|
||
|
uname: UName, //
|
||
|
|
||
|
random: new Date().getTime() //随机参数
|
||
|
}, function (res) {
|
||
|
console.log(res);
|
||
|
layer.close(index);
|
||
|
res = $.parseJSON(res);
|
||
|
if (res.code == 1) {
|
||
|
top.layer.msg(res.msg);
|
||
|
parent.location.reload();
|
||
|
} else {
|
||
|
layer.close(index);
|
||
|
layer.msg(res.msg);
|
||
|
}
|
||
|
});
|
||
|
layer.close(index);
|
||
|
return false;
|
||
|
})
|
||
|
})
|
||
|
});
|