中扬CRM客户关系管理系统
Junjie
2023-08-31 7166110979799e03630cfeeef79aa4e9c1e774ed
src/main/webapp/static/js/reimburseOnline/reimburseOnline.js
@@ -89,6 +89,7 @@
            ,{field: 'checkData', align: 'center',title: '是否冲账',hide: false}
            ,{field: 'orderNum', align: 'center',title: '报销单号',width: 320, style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false}
            ,{field: 'planId$', align: 'center',title: '项目号',hide: false}
            ,{field: 'settle', align: 'center',title: '进度',hide: false}
            ,{field: 'createTime$', align: 'center',title: '创建时间',hide: false}
            ,{field: 'updateTime$', align: 'center',title: '更新时间',hide: false}
            ,{field: 'status$', align: 'center',title: '状态',hide: false}
@@ -236,6 +237,17 @@
    table.on('tool(reimburseOnline)', function(obj){
        var data = obj.data;
        switch (obj.event) {
            case 'approval2':
                layer.confirm('审批通过?', {
                    skin: 'layui-layer-admin',
                    shade: .1,
                    offset: '200px',
                    title: data.name
                }, function (i) {
                    layer.close(i);
                    approval2(data.id);
                });
                break;
            case 'more':
                top.reimburseOnlineByMore=data.id;
                console.log(top.reimburseOnlineByMore)
@@ -287,100 +299,6 @@
                break;
            case "edit":
                showEditForm(data);
                break;
            case "upload":
                $.ajax({
                    type:"get",
                    url: baseUrl+"/reimburseOnline/viewCheck/" + data.id + "/auth",
                    dataType:"json",
                    headers: {'token': localStorage.getItem('token')},
                    success:function(res) {
                        if (res.code == 200) {
                            layer.confirm('当前已存在数据,继续上传将会覆盖旧数据,是否上传?', function(){
                                $("#uploadQuote").click()
                            });
                        }else{
                            $("#uploadQuote").click()
                        }
                    }
                });
                $("#uploadQuote").on("change",(evt) => {
                    var files = evt.target.files;
                    if(files==null || files.length==0){
                        alert("No files wait for import");
                        return;
                    }
                    let name = files[0].name;
                    let suffixArr = name.split("."), suffix = suffixArr[suffixArr.length-1];
                    if(suffix!="xlsx"){
                        alert("Currently only supports the import of xlsx files");
                        return;
                    }
                    LuckyExcel.transformExcelToLucky(files[0], function(exportJson, luckysheetfile){
                        if(exportJson.sheets==null || exportJson.sheets.length==0){
                            alert("Failed to read the content of the excel file, currently does not support xls files!");
                            return;
                        }
                        let formData = new FormData($("#uploadFile")[0]);
                        formData.append("id", data.id);
                        formData.append("checkData", zip(exportJson.sheets));
                        $.ajax({
                            url: baseUrl+"/reimburseOnline/uploadCheck/auth",
                            headers: {'token': localStorage.getItem('token')},
                            data: formData,
                            // data: JSON.stringify({
                            //     id: data.id,
                            //     checkData: zip(exportJson.sheets)
                            // }),
                            // dataType: "json",
                            method: 'POST',
                            cache: false,
                            processData: false,
                            contentType: false,
                            // contentType:'application/json;charset=UTF-8',
                            success: function (res) {
                                if (res.code == 200) {
                                    layer.msg('上传成功',{time:1000},() => {
                                        parent.location.reload()
                                    })
                                }else{
                                    layer.msg(res.msg,{time:1000},() => {
                                        parent.location.reload()
                                    })
                                }
                            }
                        })
                    });
                })
                break;
            case "viewCheck":
                //查看询价
                $.ajax({
                    type:"get",
                    url: baseUrl+"/reimburseOnline/viewCheck/" + data.id + "/auth",
                    dataType:"json",
                    headers: {'token': localStorage.getItem('token')},
                    success:function(res) {
                        if (res.code == 200) {
                            layer.open({
                                type: 2,
                                title: '查看询价',
                                maxmin: true,
                                area: [top.detailWidth, top.detailHeight],
                                shadeClose: false,
                                content: 'reimburseOnline_check.html?id=' + data.id,
                                success: function(layero, index){
                                    // layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
                                }
                            });
                        }else{
                            layer.msg(res.msg,{time:1000})
                        }
                    }
                });
                break;
            case "look":
                var $a = $(obj.tr).find('a[lay-event="look"]');
@@ -712,10 +630,10 @@
        });
    }
    function approval(planId, plannerId, dIdx) {
    function approval2(planId, plannerId, dIdx) {
        let loadIndex = layer.load(2);
        $.ajax({
            url: baseUrl+"/reimburseOnline/approval/auth",
            url: baseUrl+"/reimburseOnline/approval2/auth",
            headers: {'token': localStorage.getItem('token')},
            data: {
                planId: planId,
@@ -772,7 +690,7 @@
    //     });
    // }
    //更新form
    // 更新form
    function showEditForm(mData) {
        admin.open({
            type: 1,