123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530 |
- var Enterprise = {
- id: "table", //表格id
- seItem: null, //选中的条目
- table: null,
- layerIndex: -1
- };
- Enterprise.initColumn = function () {
- var type = $("#type").val();
- var isShow = true;
- if (type == 2) {
- isShow = false;
- }
- ;
- return [
- {field: 'selectItem', radio: true},
- {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
- {title: '账号', field: 'username', visible: true, align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
- {title: '机构名称', field: 'name', visible: true, align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
- {title: '统一社会信用代码', field: 'idCard', visible: true, align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
- {title: '产业领域', field: 'industryFieldNewName', visible: isShow, align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
- {title: '机构类型', field: 'type', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip',
- formatter: function (value, row, index) {
- if (value == 1) {
- return "晋江市现代产业体系人才";
- }
- if (value == 2) {
- return "集成电路优秀人才";
- }
- }
- },
- {title: '单位标签', field: 'enterpriseTagName', visible: isShow, align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
- {title: '法人代表', field: 'legal', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
- {title: '单位电话', field: 'ephone', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
- {title: '人才联络员', field: 'agentName', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
- {title: '人才联络员电话', field: 'agentPhone', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
- {title: '审核状态', field: 'checkState', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip',
- formatter: function (value, row, index) {
- if (value == null || value == '') {
- return "";
- } else if (value == 1) {
- return "未审核";
- } else if (value == 2) {
- return "审核驳回";
- } else if (value == 3) {
- return "审核通过";
- } else if (value == 4) {
- return "重新提交";
- }
- },
- cellStyle: function (value, row, index) {
- if (value == null || value === '') {
- return {css: {}};
- } else if (value === 1) {
- return {css: {"background-color": "LightGrey"}};
- } else if (value === 3) {
- return {css: {'background-color': 'LightGreen'}};
- } else if (value === 2) {
- return {css: {"background-color": "Orange"}};
- } else {
- return {css: {}};
- }
- }
- },
- {title: '账号状态', field: 'active', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip',
- formatter: function (value, row, index) {
- if (value == null || value == '') {
- return "";
- } else if (value == 1) {
- return "账号有效";
- } else if (value == 2) {
- return "拉黑/冻结";
- }
- },
- cellStyle: function (value, row, index) {
- if (value == null || value === '') {
- return {css: {}};
- } else if (value === 1) {
- return {css: {'background-color': 'LightGreen'}};
- } else if (value === 2) {
- return {css: {"background-color": "Orange"}};
- } else {
- return {css: {}};
- }
- }
- },
- {title: '注册时间', field: 'createTime', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
- {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
- formatter: function (value, row, index) {
- return "<span class='label label-success' onclick=\"Enterprise.showLog('" + value + "')\" >" +
- "<i class=\"fa fa-book\"></i>日志" +
- "</span>";
- }
- }
- ];
- };
- Enterprise.formParam = function () {
- var queryData = {};
- queryData['name'] = $("#name").val();
- queryData['idCard'] = $("#idCard").val();
- queryData['legal'] = $("#legal").val();
- queryData['ephone'] = $("#ephone").val();
- queryData['agentName'] = $("#agentName").val();
- queryData['agentPhone'] = $("#agentPhone").val();
- queryData['checkState'] = $("#checkState").val();
- queryData['active'] = $("#active").val();
- queryData['street'] = $("#street").val();
- queryData['special'] = $("#special").val();
- queryData['agencyType'] = $("#agencyType").val();
- queryData['industryFieldNew'] = $("#industryFieldNew").val();
- queryData['industryFieldOld'] = $("#industryFieldOld").val();
- queryData['enterpriseTag'] = $("#enterpriseTag").val();
- queryData['enterpriseType'] = $("#enterpriseType").val();
- return queryData;
- }
- Enterprise.search = function () {
- Enterprise.table.refresh({"query": Enterprise.formParam()});
- };
- Enterprise.reset = function () {
- $("#name").val("");
- $("#idCard").val("");
- $("#legal").val("");
- $("#ephone").val("");
- $("#agentName").val("");
- $("#agentPhone").val("");
- $("#checkState").val("");
- $("#active").val("");
- $("#street").val("");
- $("#special").val("");
- $("#agencyType").val("");
- $("#industryFieldNew").val("");
- $("#industryFieldOld").val("");
- $("#enterpriseTag").val("");
- $("#enterpriseType").val("");
- };
- Enterprise.gotoEnterpriseDetailPage = function () {
- if (!Enterprise.check()) {
- return;
- }
- var index = layer.open({
- type: 2,
- title: '查看详情',
- area: ['830px', '450px'], //宽高
- fix: false, //不固定
- maxmin: true,
- content: Feng.ctxPath + '/admin/enterprise/gotoEnterpriseDetailPage?id=' + Enterprise.seItem.id,
- btn: ['<i class="fa fa-check"></i> 审核', '<i class="fa fa-eraser"></i> 关闭'],
- btnAlign: 'c',
- yes: function (index, layero) {
- Enterprise.doExamine();
- }
- });
- layer.full(index);
- Enterprise.layerIndex = index;
- };
- Enterprise.setActive = function () {
- if (!Enterprise.check()) {
- return;
- }
- var index = layer.open({
- type: 2,
- title: '设置冻结',
- area: ['830px', '500px'], //宽高
- fix: false, //不固定
- maxmin: true,
- content: Feng.ctxPath + '/admin/enterprise/gotoActivePage?id=' + Enterprise.seItem.id,
- btn: ['<i class="fa fa-check"></i> 提交', '<i class="fa fa-eraser"></i> 取消'],
- btnAlign: 'c',
- yes: function (index, layero) {
- //按钮【按钮一】的回调
- var iframeWin = window[layero.find('iframe')[0]['name']];
- iframeWin.EpActive.addSubmit();
- }
- });
- // layer.full(index);
- Enterprise.layerIndex = index;
- };
- Enterprise.doExamine = function () {
- if (!Enterprise.check()) {
- return;
- }
- if (Enterprise.seItem.checkState == null || (Enterprise.seItem.checkState != 1)) {
- Feng.info("不在审核范围内!");
- return;
- }
- var index = layer.open({
- type: 2,
- title: '审核',
- area: ['830px', '500px'], //宽高
- fix: false, //不固定
- maxmin: true,
- shade: 0,
- content: Feng.ctxPath + '/admin/enterprise/gotoExaminePage?id=' + Enterprise.seItem.id,
- btn: ['<i class="fa fa-check"></i> 提交', '<i class="fa fa-save"></i> 保存', '<i class="fa fa-eraser"></i> 取消'],
- btnAlign: 'c',
- yes: function (index, layero) {
- //按钮【按钮一】的回调
- layer.confirm("确认提交审核结果?", function () {
- var iframeWin = window[layero.find('iframe')[0]['name']];
- iframeWin.EpExam.submitToCheck();
- })
- },
- btn2: function (index, layero) {
- var iframeWin = window[layero.find('iframe')[0]['name']];
- iframeWin.EpExam.addSubmit();
- return false;
- }
- });
- // layer.full(index);
- };
- /**
- * 修改驳回的字段及附件
- */
- Enterprise.updateFieldsAndFiles = function () {
- if (this.check()) {
- var id = Enterprise.seItem.id;
- var ajax = new $ax("/admin/enterprise/findFieldsAndFiles?id=" + id, function (data) {
- if (data.code == 200) {
- layer.open({
- type: 1,
- id: "fieldCheckModalForm",
- title: '修改',
- area: ['800px', '450px'], //宽高
- fix: false, //不固定
- shade: 0,
- maxmin: true,
- content: Enterprise.creatFieldCheckModal(),
- btn: ['<i class="fa fa-save"></i> 提交', '<i class="fa fa-eraser"></i> 关闭'],
- btnAlign: 'c',
- zIndex: layer.zIndex,
- success: function (layero, index) {
- var fileList = data.files;
- var fieldList = data.fields;
- var html_field = '';
- var html_file = '';
- for (var key in fieldList) {
- html_field = html_field + '<li><input type="checkbox" ' + (fieldList[key].checked ? "checked" : "") + ' value="' + fieldList[key].field + '"><span>' + fieldList[key].name + '</span></li>';
- }
- for (var key in fileList) {
- html_file = html_file + '<li style="width: 100%"><input type="checkbox" ' + (fileList[key].checked ? "checked" : "") + ' value="' + fileList[key].field + '"><span>' + fileList[key].name + '</span></li>';
- }
- $("#field_info").empty().append("<ul>" + html_field + "</ul>");
- $("#field_file").empty().append("<ul>" + html_file + "</ul>");
- },
- yes: function (index, layero) {
- Enterprise.submitFieldsAndFiles(index, id);
- }
- });
- } else {
- Feng.error(data.msg);
- }
- }, function (data) {
- Feng.error("查询失败!" + data.responseJSON.message + "!");
- });
- ajax.start();
- }
- };
- /**
- * 修改提交
- * @param index
- * @param id
- */
- Enterprise.submitFieldsAndFiles = function (index, id) {
- var fields = '';
- var files = '';
- $("#field_info li input").each(function (index) {
- if ($(this).is(":checked")) {
- fields = fields + $(this).val() + ",";
- }
- });
- $("#field_file li input").each(function (index) {
- if ($(this).is(":checked")) {
- files = files + $(this).val() + ",";
- }
- });
- if (fields == '' && files == '') {
- Feng.info("请选择可修改的字段或附件!");
- return;
- }
- var ajax = new $ax("/admin/enterprise/updateFieldsAndFiles", function (data) {
- if (data.code == 200) {
- layer.close(index);
- Feng.success(data.msg);
- } else {
- Feng.error(data.msg);
- }
- }, function (data) {
- Feng.error("修改失败!" + data.responseJSON.message + "!");
- });
- ajax.setData({"id": id, "fields": fields, "files": files})
- ajax.start();
- };
- Enterprise.creatFieldCheckModal = function () {
- return '<form id="fieldCheckModalForm">\n' +
- ' <div class="form-group" style="margin: 10px;">\n' +
- ' <div >\n' +
- ' <label for="checkMsg" class="control-label">可修改字段</label>\n' +
- ' <div id="field_info">\n' +
- ' </div>\n' +
- ' <label for="checkMsg" class="control-label">可修改附件</label>\n' +
- ' <div id="field_file">\n' +
- ' </div>\n' +
- ' <div class="form-group" style="text-align: center">\n' +
- ' <button type="button" class="btn btn-primary" onclick="Enterprise.checkAll()">全选</button>\n' +
- ' <button type="button" class="btn btn-success" onclick="Enterprise.unCheckAll()">反选</button>\n' +
- ' </div>\n' +
- ' </div>\n' +
- ' </div>\n' +
- ' </form>';
- };
- Enterprise.checkAll = function () {
- $("#fieldCheckModalForm input[type=checkbox]").prop("checked", true);
- };
- Enterprise.unCheckAll = function () {
- $("#fieldCheckModalForm input[type=checkbox]").removeAttr("checked");
- };
- Enterprise.delEnterprise = function () {
- if (!Enterprise.check()) {
- return;
- }
- if (!Enterprise.check()) {
- return;
- }
- Feng.confirm(
- "确定删除吗?",
- function () {
- var ajax = new $ax(Feng.ctxPath + "/enterprise/delEnterprise?id=" + Enterprise.seItem.id, function (data) {
- Feng.info(data.msg);
- if (data.code == 200) {
- Enterprise.table.refresh();
- }
- }, function (data) {
- Feng.error("操作失败!");
- });
- ajax.set(null);
- ajax.start();
- }
- );
- };
- Enterprise.resetPassword = function () {
- if (!Enterprise.check()) {
- return;
- }
- Feng.confirm(
- "确定要重置密码吗?",
- function () {
- var ajax = new $ax(Feng.ctxPath + "/admin/enterprise/resetPassword?id=" + Enterprise.seItem.id, function (data) {
- Feng.info(data.msg);
- // if(data.code == 200){
- // Enterprise.table.refresh();
- // }
- }, function (data) {
- Feng.error("操作失败!");
- });
- ajax.set(null);
- ajax.start();
- }
- );
- };
- Enterprise.doExport = function () {
- var name = $("#name").val();
- var idCard = $("#idCard").val();
- var legal = $("#legal").val();
- var ephone = $("#ephone").val();
- var agentName = $("#agentName").val();
- var agentPhone = $("#agentPhone").val();
- var checkState = $("#checkState").val();
- var active = $("#active").val();
- var street = $("#street").val();
- var special = $("#special").val();
- var agencyType = $("#agencyType").val();
- var industryFieldNew = $("#industryFieldNew").val();
- var industryFieldOld = $("#industryFieldOld").val();
- var enterpriseTag = $("#enterpriseTag").val();
- var enterpriseType = $("#enterpriseType").val();
- var arr = {"name": name, "idCard": idCard, "legal": legal, "ephone": ephone, "agentName": agentName,
- "agentPhone": agentPhone, "checkState": checkState, "active": active, "street": street,
- "special": special, "agencyType": agencyType, "industryFieldNew": industryFieldNew, "industryFieldOld": industryFieldOld, "enterpriseTag": enterpriseTag, "enterpriseType": enterpriseType};
- window.location.href = Feng.setUrlParam(Feng.ctxPath + "/admin/enterprise/export", arr);
- }
- /**
- * 批量获取人才联络员手机号码
- */
- Enterprise.getPhones = function () {
- var ajax = new $ax(Feng.ctxPath + "/enterprise/getPhones", function (data) {
- if (data.code == 200) {
- layer.open({
- type: 1,
- title: "手机号码",
- area: ['830px', '500px'], //宽高
- fix: false, //不固定
- maxmin: true,
- content: "<span style='word-break:break-all'>" + data.obj + "</span>"
- });
- } else {
- Feng.info(data.msg);
- }
- }, function (data) {
- Feng.error("操作失败!");
- });
- ajax.setData(Enterprise.formParam());
- ajax.start();
- }
- Enterprise.check = function () {
- var selected = $('#' + Enterprise.id).bootstrapTable('getSelections');
- if (selected.length == 0) {
- Feng.info("请先选中表格中的某一记录!");
- return false;
- } else {
- Enterprise.seItem = selected[0];
- return true;
- }
- };
- Enterprise.showLog = function (id) {
- layer.open({
- type: 1,
- title: "日志",
- fixed: false,
- content: '<table id="' + id + '"></table>',
- area: ['80%', '80%'],
- maxmin: true,
- success: function (layero, index) {
- Feng.getCheckLog(id, {"type": 10, "enterpriseId": id, "typeFileId": "", "active": 1})
- }
- });
- };
- Enterprise.onSpecialChange = function () {
- var special = $("#special").val();
- var arr = [];
- $("#enterpriseTag").html("");
- switch (special) {
- case "0":
- $("#agencyType").parents(".hiddenElement").css("display", "block");
- $("#industryFieldNew").parents(".hiddenElement").css("display", "block");
- $("#industryFieldOld").parents(".hiddenElement").css("display", "block");
- $("#enterpriseType").parents(".hiddenElement").css("display", "block");
- var arr = [
- {"name": "agencyType", "code": "agency_type"},
- {"name": "industryFieldNew", "code": "industry_field"},
- ];
- Feng.findChildDictBatch(JSON.stringify(arr));
- break;
- case "1":
- $("#agencyType").val("").parents(".hiddenElement").css("display", "none");
- $("#industryFieldNew").val("").parents(".hiddenElement").css("display", "none");
- $("#industryFieldOld").val("").parents(".hiddenElement").css("display", "none");
- $("#enterpriseType").val("").parents(".hiddenElement").css("display", "none");
- var arr = [
- {"name": "enterpriseTag", "code": "institution_tag"}
- ];
- Feng.findChildDictBatch(JSON.stringify(arr));
- break;
- case "3":
- $("#agencyType").val("").parents(".hiddenElement").css("display", "none");
- $("#industryFieldNew").val("").parents(".hiddenElement").css("display", "none");
- $("#industryFieldOld").val("").parents(".hiddenElement").css("display", "none");
- $("#enterpriseType").val("").parents(".hiddenElement").css("display", "none");
- var arr = [
- {"name": "enterpriseTag", "code": "organization_tag"}
- ];
- Feng.findChildDictBatch(JSON.stringify(arr));
- break;
- }
- };
- Enterprise.onAgencyTypeChange = function () {
- var agencyType = $("#agencyType").val();
- if (agencyType == 1) {
- var arr = [
- {"name": "enterpriseTag", "code": "enterprise_tag"},
- {"name": "enterpriseType", "code": "enterprise_type"}
- ];
- Feng.findChildDictBatch(JSON.stringify(arr));
- } else {
- $("#enterpriseTag").val("");
- $("#enterpriseType").val("");
- $("#enterpriseTag").html("");
- $("#enterpriseType").html("");
- }
- }
- Enterprise.onIndustryFieldNewChange = function () {
- var industryNew = $("#industryFieldNew").val();
- var arr = [
- {"name": "industryFieldOld", "code": industryNew + "_field"}
- ];
- Feng.findChildDictBatch(JSON.stringify(arr));
- }
- $(function () {
- var defaultColunms = Enterprise.initColumn();
- var table = new BSTable(Enterprise.id, "/admin/enterprise/findEnterpriseByPage", defaultColunms);
- table.setPaginationType("server");
- Enterprise.table = table.init();
- var arr = [
- {"name": "street", "code": "street"}
- ];
- if ($("#special").val() != "") {
- Enterprise.onSpecialChange();
- if ($("#agencyType").val() != "") {
- Enterprise.onAgencyTypeChange();
- }
- if ($("#industryFieldNew").val() != "") {
- Enterprise.onIndustryFieldNewChange();
- }
- }
- Feng.findChildDictBatch(JSON.stringify(arr));
- // Feng.addAjaxSelect({
- // "id": "street",
- // "displayCode": "code",
- // "displayName": "name",
- // "type": "GET",
- // "url": Feng.ctxPath + "/dict/findChildDictByCode?code=un_street"
- // });
- });
|