179 lines
4.4 KiB
JavaScript
179 lines
4.4 KiB
JavaScript
// var dataUrl ="http://140.210.209.102:1918/hnBmw/";
|
|
// var dataUrl ="http://127.0.0.1:1918/hnBmw/";
|
|
// var dataUrl ="http://192.168.0.14:19118/hnBmw/";
|
|
// var dataUrl ="http://172.16.0.235:1918/hnBmw/"; //线上正式环境--内网
|
|
var dataUrl ="http://116.63.172.211:1918/hnBmw/"; //线上正式环境--外网
|
|
var token=localStorage.getItem('token');
|
|
$(function() {
|
|
var headHTML = document.getElementsByTagName('head')[0].innerHTML;
|
|
headHTML += '<link rel="icon" href="../../img/favicon.ico" type="image/x-icon"/>';
|
|
document.getElementsByTagName('head')[0].innerHTML = headHTML;
|
|
if(token=="" || token==null){
|
|
window.location.href =dataUrl+ "login.html";
|
|
}
|
|
})
|
|
function isNull(str) {
|
|
if (str == null || str=="null") {
|
|
return "";
|
|
}
|
|
return str;
|
|
}
|
|
/**
|
|
* 获取当日时间
|
|
*/
|
|
function getNowTime() {
|
|
var nowDate = new Date();
|
|
var year = nowDate.getFullYear();
|
|
var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1) :
|
|
nowDate.getMonth() + 1;
|
|
var day = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate();
|
|
var dateStr = year + "-" + month + "-" + day;
|
|
return dateStr;
|
|
}
|
|
//公司选中事件
|
|
function companyChange(){
|
|
findPro();
|
|
}
|
|
//获取单位集合
|
|
function findCompany(){
|
|
$("#orgId").empty();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: dataUrl + 'map/findCompany',
|
|
data: {},
|
|
dataType: "json",
|
|
success: function(data) {
|
|
var html="";
|
|
html += '<option value="">请选择</option>';
|
|
for(var i=0;i<data.length;i++){
|
|
html += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
|
|
}
|
|
$("#orgId").append(html);
|
|
$("#orgId").select2();
|
|
}
|
|
});
|
|
};
|
|
|
|
//获取工程集合
|
|
function findPro(){
|
|
$("#proId").empty();
|
|
var orgId=$("#orgId").val();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: dataUrl + 'map/findPro',
|
|
data: {key:orgId},
|
|
dataType: "json",
|
|
async: false,
|
|
success: function(data) {
|
|
var html="";
|
|
html += '<option value="">请选择</option>';
|
|
for(var i=0;i<data.length;i++){
|
|
html += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
|
|
}
|
|
$("#proId").append(html);
|
|
$("#proId").select2();
|
|
},
|
|
error:function(data){
|
|
var html='<option value="">请选择</option>';
|
|
$("#proId").append(html);
|
|
}
|
|
});
|
|
};
|
|
|
|
//获取角色集合
|
|
function findRole(){
|
|
$("#roleId").empty();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: dataUrl + 'map/findRole',
|
|
data: {},
|
|
dataType: "json",
|
|
success: function(data) {
|
|
var html="";
|
|
html += '<option value="">请选择</option>';
|
|
for(var i=0;i<data.length;i++){
|
|
html += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
|
|
}
|
|
$("#roleId").append(html);
|
|
$("#roleId").select2();
|
|
},
|
|
error:function(data){
|
|
var html='<option value="">请选择</option>';
|
|
$("#roleId").append(html);
|
|
}
|
|
});
|
|
};
|
|
//获取岗位集合
|
|
function findPost(){
|
|
$("#postId").empty();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: dataUrl + 'map/findPost',
|
|
data: {},
|
|
dataType: "json",
|
|
success: function(data) {
|
|
var html="";
|
|
html += '<option value="">请选择</option>';
|
|
for(var i=0;i<data.length;i++){
|
|
html += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
|
|
}
|
|
$("#postId").append(html);
|
|
$("#postId").select2();
|
|
},
|
|
error:function(data){
|
|
var html='<option value="">请选择</option>';
|
|
$("#postId").append(html);
|
|
}
|
|
});
|
|
};
|
|
|
|
//获取单位类型
|
|
function findOrgType(){
|
|
$("#orgType").empty();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: dataUrl + 'company/findOrgType',
|
|
data: {},
|
|
dataType: "json",
|
|
success: function(data) {
|
|
var obj=data.obj;
|
|
var list=obj.bean;
|
|
var html="";
|
|
html += '<option value="">请选择</option>';
|
|
for(var i=0;i<list.length;i++){
|
|
html += '<option value="' + list[i].orgType + '">' + list[i].orgTypeName + '</option>';
|
|
}
|
|
$("#orgType").append(html);
|
|
$("#orgType").select2();
|
|
},
|
|
error:function(data){
|
|
var html='<option value="">请选择</option>';
|
|
$("#orgType").append(html);
|
|
}
|
|
});
|
|
}
|
|
|
|
//获取工种类型
|
|
function findWorkType(){
|
|
$("#workType").empty();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: dataUrl + 'map/findWorkType',
|
|
data: {},
|
|
dataType: "json",
|
|
async: false,
|
|
success: function(data) {
|
|
var html="";
|
|
html += '<option value="">请选择</option>';
|
|
for(var i=0;i<data.length;i++){
|
|
html += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
|
|
}
|
|
$("#workType").append(html);
|
|
$("#workType").select2();
|
|
},
|
|
error:function(data){
|
|
var html='<option value="">请选择</option>';
|
|
$("#workType").append(html);
|
|
}
|
|
});
|
|
}; |