中扬CRM客户关系管理系统
#
LSH
2023-10-17 fabb29dfd7fdcc19727c459c8ef309a86d73ed09
src/main/webapp/static/js/contract/contract.js
@@ -1,7 +1,7 @@
var pageCurr;
layui.config({
    base: baseUrl + "/static/layui/lay/modules/"
}).use(['table', 'laydate', 'form', 'admin', 'tree', 'dropdown'], function () {
}).use(['table', 'laydate', 'form', 'admin','xmSelect', 'tree', 'dropdown'], function () {
    var table = layui.table;
    var $ = layui.jquery;
    var layer = layui.layer;
@@ -88,11 +88,12 @@
            , {field: 'status$', align: 'center', title: '状态'}
            , {field: 'userId$', align: 'center', title: '添加人员'}
            , {field: 'createTime$', align: 'center', title: '添加时间'}
            , {field: 'settle$', align: 'center',title: '进度', style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false}
            , {field: 'updateBy$', align: 'center', title: '修改人员'}
            , {field: 'updateTime$', align: 'center', title: '修改时间'}
            , {field: 'memo', align: 'center', title: '备注'}
            , {fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 400}
            , {fixed: 'right', title: '操作', align: 'center', toolbar: '#operate', width: 500}
        ]],
        request: {
            pageName: 'curr',
@@ -193,6 +194,29 @@
    table.on('tool(contract)', function (obj) {
        var data = obj.data;
        switch (obj.event) {
            case 'approval':
                layer.confirm('审批通过?', {
                    skin: 'layui-layer-admin',
                    shade: .1,
                    offset: '200px',
                    title: data.name
                }, function (i) {
                    layer.close(i);
                    approval(data.id);
                });
                break;
            case 'more':
                top.contractByMore = data.id;
                admin.popupRight({
                    type: 1,
                    window: "top",
                    area: "1250px",
                    url: "contract_more.html",
                    end: function () {
                        // $(".layui-laypage-btn")[0].click();
                    }
                })
                break;
            case 'edit':
                showEditModel(data);
                break;
@@ -226,9 +250,12 @@
            title: (mData ? '修改' : '添加') + '合同',
            content: $('#editDialog').html(),
            success: function (layero, dIndex) {
                let loadNameXml = loadNameXmlSel()
                console.log(loadNameXml)
                layDateRender(mData);
                form.val('detail', mData);
                form.on('submit(editSubmit)', function (data) {
                    data.field.customer = loadNameXml.getValue()[0] ? loadNameXml.getValue()[0].name : null;
                    var loadIndex = layer.load(2);
                    $.ajax({
                        url: baseUrl + "/contract/" + (mData ? 'update' : 'add') + "/auth",
@@ -472,6 +499,62 @@
    layDateRender();
    function approval(contractId, plannerId, dIdx) {
        let loadIndex = layer.load(2);
        $.ajax({
            url: baseUrl+"/contract/approval/auth",
            headers: {'token': localStorage.getItem('token')},
            data: {
                contractId: contractId,
                plannerId: plannerId
            },
            method: 'POST',
            success: function (res) {
                if (dIdx) {
                    layer.close(dIdx);
                }
                layer.close(loadIndex);
                if (res.code === 200){
                    layer.msg(res.msg, {icon: 1});
                    tableReload();
                } else if (res.code === 403){
                    top.location.href = baseUrl+"/";
                } else {
                    layer.msg(res.msg, {icon: 2});
                }
            }
        })
    }
    window.loadNameXmlSel = function () {
        return xmSelect.render({
            el: '#nameXmlSel',
            autoRow: true,
            filterable: true,
            remoteSearch: true,
            clickClose: true,
            radio: true,
            remoteMethod: function (val, cb, show) {
                $.ajax({
                    url: baseUrl + "/cstmr/all/get/kv",
                    headers: {'token': localStorage.getItem('token')},
                    data: {
                        condition: val
                    },
                    method: 'POST',
                    success: function (res) {
                        if (res.code === 200) {
                            cb(res.data)
                        } else {
                            cb([]);
                            layer.msg(res.msg, {icon: 2});
                        }
                    }
                });
            },
        });
    }
});
// 关闭动作