中扬CRM客户关系管理系统
LSH
2023-08-22 e89a0bdd6041774d77408744993ba3b98a1e1c97
src/main/webapp/static/js/priOnline/priOnline.js
@@ -1,5 +1,6 @@
var pageCurr;
var admin;
var treeCond;
layui.config({
    base: baseUrl + "/static/layui/lay/modules/"
}).extend({
@@ -9,8 +10,66 @@
    var $ = layui.jquery;
    var layer = layui.layer;
    var layDate = layui.laydate;
    var tree = layui.tree;
    var form = layui.form;
    var dropdown = layui.dropdown;
    admin = layui.admin;
    $('#organization').html(localStorage.getItem('nickname') + ' <i class="layui-icon">&#xe61a;</i>');
    // 部门人员 筛选
    dropdown.render({
        elem: '#organization'
        ,content: ['<div id="organizationTree" style="height: calc(100vh - 525px);border: none"></div>'].join('')
        ,style: 'width: 370px; height: 350px; padding: 0 15px; box-shadow: 1px 1px 30px rgb(0 0 0 / 12%);'
        ,ready: function(){
            loadTree();
        }
    });
    // 树形图
    var organizationTree;
    window.loadTree = function(condition){
        var loadIndex = layer.load(2);
        $.ajax({
            url: baseUrl+"/dept/user/tree/auth",
            headers: {'token': localStorage.getItem('token')},
            data: {
                'condition': condition
            },
            method: 'POST',
            success: function (res) {
                layer.close(loadIndex);
                if (res.code === 200){
                    organizationTree = tree.render({
                        elem: '#organizationTree',
                        id: 'organizationTree',
                        onlyIconControl: true,
                        data: res.data,
                        click: function (obj) {
                            treeCond = {
                                key: obj.data.key,
                                val: obj.data.id
                            }
                            $('#organization').html(obj.data.title + ' <i class="layui-icon">&#xe61a;</i>');
                            $('#organizationTree').find('.ew-tree-click').removeClass('ew-tree-click');
                            $(obj.elem).children('.layui-tree-entry').addClass('ew-tree-click');
                            clearFormVal($('#search-box'));
                            tableIns.reload({
                                where: {[obj.data.key]: obj.data.id},
                                page: {curr: 1}
                            });
                        }
                    });
                    treeData = res.data;
                } else if (res.code === 403){
                    top.location.href = baseUrl+"/";
                } else {
                    layer.msg(res.msg)
                }
            }
        })
    }
    // 数据渲染
    tableIns = table.render({
@@ -24,10 +83,10 @@
        cellMinWidth: 150,
        cols: [[
            {type: 'checkbox', fixed: 'left'}
            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
            ,{field: 'templateName', align: 'center',title: '模板名'}
            ,{field: 'orderNum', align: 'center',title: '订单号'}
            ,{field: 'itemId$', align: 'center',title: '项目名'}
            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80,hide: true}
            ,{field: 'templateName', align: 'center',title: '核价名',hide: false}
            ,{field: 'orderNum', align: 'center',title: '核价单号'}
            ,{field: 'planId$', align: 'center',title: '规划单号'}
            ,{field: 'createTime$', align: 'center',title: '创建时间'}
            ,{field: 'updateTime$', align: 'center',title: '更新时间'}
            ,{field: 'status$', align: 'center',title: '状态'}
@@ -215,7 +274,7 @@
            case "upload":
                $.ajax({
                    type:"get",
                    url: "/priOnline/viewCheck/" + data.id + "/auth",
                    url: baseUrl+"/priOnline/viewCheck/" + data.id + "/auth",
                    dataType:"json",
                    headers: {'token': localStorage.getItem('token')},
                    success:function(res) {
@@ -248,16 +307,23 @@
                            return;
                        }
                        let formData = new FormData($("#uploadFile")[0]);
                        formData.append("id", data.id);
                        formData.append("checkData", zip(exportJson.sheets));
                        $.ajax({
                            url: "/priOnline/uploadCheck/auth",
                            url: baseUrl+"/priOnline/uploadCheck/auth",
                            headers: {'token': localStorage.getItem('token')},
                            data: JSON.stringify({
                                id: data.id,
                                checkData: zip(exportJson.sheets)
                            }),
                            data: formData,
                            // data: JSON.stringify({
                            //     id: data.id,
                            //     checkData: zip(exportJson.sheets)
                            // }),
                            // dataType: "json",
                            method: 'POST',
                            dataType: "json",
                            contentType:'application/json;charset=UTF-8',
                            cache: false,
                            processData: false,
                            contentType: false,
                            // contentType:'application/json;charset=UTF-8',
                            success: function (res) {
                                if (res.code == 200) {
                                    layer.msg('上传成功',{time:1000},() => {
@@ -277,7 +343,7 @@
                //查看询价
                $.ajax({
                    type:"get",
                    url: "/priOnline/viewCheck/" + data.id + "/auth",
                    url: baseUrl+"/priOnline/viewCheck/" + data.id + "/auth",
                    dataType:"json",
                    headers: {'token': localStorage.getItem('token')},
                    success:function(res) {
@@ -328,7 +394,7 @@
                        maxmin: true,
                        area: [top.detailWidth, top.detailHeight],
                        shadeClose: false,
                        content: 'priOnline_detail.html?item_id=' + data.field.itemId + "&pri_id=" + data.field.priId,
                        content: 'priOnline_detail.html?item_id=' + data.field.planId + "&pri_id=" + data.field.priId,
                        success: function(layero, index){
                            clearFormVal(layer.getChildFrame('#detail', index));
                            // layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});