yantian yue
2023-10-18 69fbaaa1a5fd16b05953e750ea7fcc3e18e3a27c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
 * 详情对话框
 */
var ExcelExportDeployInfoDlg = {
    data: {
        name: "",
        title: "",
        nid: "",
        template: "",
        dataSource: "",
        status: ""
    }
};
 
layui.use(['form', 'admin', 'ax', 'upload'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var upload = layui.upload;
    // 执行上传实例
    var uploadInst = upload.render({
        elem : '#templateUplod', // 绑定元素
        url : 'uploadTemplate', // 上传接口
        accept : 'file', // 只允许上传图片
        acceptMime : 'file/xls', // 只筛选图片
        done : function(res) {
            // 上传完毕回调
            if (res.code == 200) {
                $("#template").val(res.data);
                Feng.success("上传成功!");
                $("#src").text(res.data);
                $("#templateUplod").text("重新上传");
            } else {
                Feng.error("上传失败!" + res.message)
            }
        },
        error : function() {
            // 请求异常回调
            Feng.error("上传失败!")
        }
    });
 
    //获取详情信息,填充表单
    var ajax = new $ax(Feng.ctxPath + "/excelExportDeploy/detail?id=" + Feng.getUrlParam("id"));
    var result = ajax.start();
    form.val('excelExportDeployForm', result.data);
    $("#src").text(result.data.template);
    //表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var ajax = new $ax(Feng.ctxPath + "/excelExportDeploy/editItem", function (data) {
            Feng.success("更新成功!");
 
            //传给上个页面,刷新table用
            admin.putTempData('formOk', true);
 
            //关掉对话框
            admin.closeThisDialog();
 
        }, function (data) {
            Feng.error("更新失败!" + data.responseJSON.message)
        });
        ajax.set(data.field);
        ajax.start();
 
        return false;
    });
 
});