<script>
    layui.use(['table', 'form', 'element', 'table', 'layer', 'admin'], function () {
        let admin = layui.admin;
        let form = layui.form;
        let table = layui.table
        let element = layui.element;
        table.render({
            elem: '#logList'
            , url: '/api/log/GetLogList'
            , method: 'post'
            , size: 'sm'
            , limit: 10
            , cellMinWidth: 80 //全局定义常规单元格的最小宽度
            , where: {
                supplier_id:{{$supplier['supplier_id']}},
                action: '分配渠道开发员',
            }
            , loading: true
            , first: true //不显示首页
            , last: false //不显示尾页
            , cols: [[
                {field: 'add_time', title: '日志时间', width: 150, align: 'center'},
                {
                    field: 'content', title: '日志内容', align: 'center', templet: function (data) {
                        return data.admin_name + data.content;
                    }
                },
            ]]
            , id: 'logList'
            , page: {}
        });
        form.on('submit(auditSupplier)', function (data) {
            admin.btnLoading('.submit-loading');
            let supplierId = getQueryVariable('supplier_id');
            let url = '/api/supplier/AllocatePurchaseUser?supplier_id=' + supplierId;
            let res = ajax(url, data.field);
            if (!res) {
                layer.msg('网络错误,请重试', {icon: 6});
            } else {
                if (res.err_code === 0) {
                    admin.closeThisDialog();
                    //修改罗盘显示数量(cao)
                    parent.layer.msg(res.err_msg, {icon: 6});
                } else {
                    admin.btnLoading('.submit-loading',false);
                    parent.layer.msg(res.err_msg, {icon: 5});
                }
            }
            return false;
        });
        form.on('submit(cancel)', function (data) {
            admin.closeThisDialog();
        });
    });
</script>