//所属行业子类
function loadIndustry() {
    var html = "";
    $.ajax({
        url: '/common/dict/list/data_industry',
        success: function (data) {
            //加载数据
            for (var i = 0; i < data.length; i++) {
                html += '<option value="' + data[i].value + '">' + data[i].name + '</option>'
            }
            $(".chosen-select").append(html);
            $(".chosen-select").chosen({
                maxHeight: 200
            });
            //点击事件
            $('.chosen-select').on('change', function (e, params) {
                console.log(params.selected);
                var opt = {
                    query: {
                        type: params.selected,
                    }
                }
                // $('#exampleTable').bootstrapTable('refresh', opt);
            });
        }
    });
}

//数据类别
function loadType() {
    var html = "";
    var parentId = '1' //数据分类 根目录
    $.ajax({
        // url : '/common/dict/list/data_industry',
        url: '/datas/dataPart/list/' + parentId,
        success: function (data) {
            //加载数据
            for (var i = 0; i < data.length; i++) {
                // html += '<option value="' + data[i].value + '">' + data[i].name + '</option>'
                html += '<option value="' + data[i].partId + '">' + data[i].partName + '</option>'
            }
            if (html != '') {
                html += '<option value="other">其它</option>'
            }
            $(".chosen-selectType").append(html);
            $(".chosen-selectType").chosen({
                maxHeight: 200
            });
            //点击事件
            $('.chosen-selectType').on('change', function (e, params) {
                console.log(params.selected);
                var opt = {
                    query: {
                        type: params.selected,
                    }
                }
                // $('#exampleTable').bootstrapTable('refresh', opt);
            });
        }
    });
}

//审核阶段
function loadAuditStage() {
    var html = "";
    $.ajax({
        url: '/common/dict/list/audit_stage',
        success: function (data) {
            //加载数据
            for (var i = 0; i < data.length; i++) {
                html += '<option value="' + data[i].value + '">' + data[i].name + '</option>'
            }
            $(".chosen-select-auditStage").append(html);
            $(".chosen-select-auditStage").chosen({
                maxHeight: 200
            });
            //点击事件
            $('.chosen-select-auditStage').on('change', function (e, params) {
                console.log(params.selected);
                var opt = {
                    query: {
                        type: params.selected,
                    }
                }
                // $('#exampleTable').bootstrapTable('refresh', opt);
            });
        }
    });
}
//数据级别
function loadLevel() {
    var html = "";
    $.ajax({
        url: '/common/dict/list/data_level_0',
        success: function (data) {
            //加载数据
            for (var i = 0; i < data.length; i++) {
                html += '<option value="' + data[i].value + '">' + data[i].name + '</option>'
            }
            $(".chosen-select-level").append(html);
            $(".chosen-select-level").chosen({
                maxHeight: 200
            });
            //点击事件
            $('.chosen-select-level').on('change', function (e, params) {
                console.log(params.selected);
                var opt = {
                    query: {
                        type: params.selected,
                    }
                }
                // $('#exampleTable').bootstrapTable('refresh', opt);
            });
        }
    });
}

//初始化省份
function loadProvince() {
    var html = "";
    $.ajax({
        url: '/common/dict/list/data_province',
        success: function (data) {
            //加载数据
            for (var i = 0; i < data.length; i++) {
                html += '<option value="' + data[i].value + '">' + data[i].name + '</option>'
            }
            $(".chosen-select-pro").append(html);
            $(".chosen-select-pro").chosen({
                maxHeight: 200
            });
            // "font-size: 14px;color: #9b9ea3;"
            $(".chosen-select-pro").css("font-size","14px");
            $(".chosen-select-pro").css("color",'#9b9ea3');
            //点击事件
            $('.chosen-select-pro').on('change', function (e, params) {
                console.log(params.selected);
                var opt = {
                    query: {
                        type: params.selected,
                    }
                }
                // $('#exampleTable').bootstrapTable('refresh', opt);
            });
        }
    });
}

//地市信息
function loadCity() {
    var html = "";
    $.ajax({
        url: '/common/dict/listCity',
        success: function (data) {
            //加载数据
            for (var i = 0; i < data.length; i++) {
                html += '<option value="' + data[i].value + '">' + data[i].name + '</option>'
            }
            $(".chosen-select-city").append(html);
            $(".chosen-select-city").chosen({
                maxHeight: 200
            });
            //点击事件
            $('.chosen-select-city').on('change', function (e, params) {
                console.log(params.selected);
                var opt = {
                    query: {
                        type: params.selected,
                    }
                }
                $('#unitCity').val(params.selected)
                //$('#exampleTable').bootstrapTable('refresh', opt);
            });
        }
    });
}


/**
 * 填充 联合审批部门
 */
function load_direct_select() {
    var selectValue = "";
    $.ajax({
        url: '/system/sysDept/list/queryDept',
        success: function (data) {
            //加载数据
            for (var i = 0; i < data.length; i++) {
                // html += '<option value="' + data[i].value + '">' + data[i].name + '</option>'
                // οnclick='nextVerify(\"" + data[i].deptId + "\",\"" + data[i].name + "\")'
                selectValue = $("<li><a href=\"#\" onclick='nextVerify(\"" + data[i].deptId + "\")')>" + data[i].name + "</a></li>");
                $(".direct").append(selectValue);
            }

        }
    });

}


//所属行业
function loadIndustryType() {
    var html = "";
    $.ajax({
        url: '/common/dict/list/industry_type',
        success: function (data) {
            //加载数据
            for (var i = 0; i < data.length; i++) {
                html += '<option value="' + data[i].value + '">' + data[i].name + '</option>'
            }
            $(".chosen-select-industryType").append(html);
            $(".chosen-select-industryType").chosen({
                maxHeight: 200
            });
            //点击事件
            $('.chosen-select').on('change', function (e, params) {
                console.log(params.selected);
                var opt = {
                    query: {
                        type: params.selected,
                    }
                }
                // $('#exampleTable').bootstrapTable('refresh', opt);
            });
        }
    });
}