中扬CRM客户关系管理系统
#
Junjie
2023-09-07 9b170ef6438012f5679fc1ab352b408c13bf6f1d
src/main/webapp/static/js/cstmr/cstmr.js
@@ -265,6 +265,11 @@
            title: (mData ? '修改' : '添加') + '甲方单位',
            content: $('#editDialog').html(),
            success: function (layero, dIndex) {
                let loadNameXml = loadNameXmlSel()
                if (mData) {
                    $('#cascaderVal').val(mData.pcd);
                    if (mData.name) { loadNameXml.setValue([{name: mData.name, value: mData.name}]); }
                }
                form.verify({
                    name: function(value, item){
                        var min = item.getAttribute('lay-min');
@@ -280,6 +285,11 @@
                cascaderRender();
                form.val('detail', mData);
                form.on('submit(editSubmit)', function (data) {
                    data.field.name = loadNameXml.getValue()[0] ? loadNameXml.getValue()[0].name : null;
                    if (!data.field.name) {
                        layer.msg("客户名称不能为空", {icon: 2});
                        return false;
                    }
                    var loadIndex = layer.load(2);
                    $.ajax({
                        url: baseUrl+"/cstmr/"+(mData?'update':'add')+"/auth",
@@ -378,6 +388,34 @@
        });
    }
    window.loadNameXmlSel = function () {
        return xmSelect.render({
            el: '#nameXmlSel',
            autoRow: true,
            filterable: true,
            remoteSearch: true,
            radio: true,
            remoteMethod: function (val, cb, show) {
                $.ajax({
                    url: baseUrl + "/cstmrSearch/auth",
                    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});
                        }
                    }
                });
            }
        });
    }
});
// 关闭动作