901 lines
30 KiB
JavaScript
901 lines
30 KiB
JavaScript
/**
|
||
* isEmptyAndNull(str) 字符串非空判断 null,"null",'' 则返回true
|
||
* choseImgType(str) 判断图片类型
|
||
* getTypeImg(str) 判断文件类型并赋值统一图片
|
||
* reloading() 关闭弹窗
|
||
* openFile(filePaths, fileNames, fileTimes, fileDownloadName) filePaths必传,其他的不需要则传空
|
||
* openFileAndUpLoad(filePaths, fileNames, fileTimes, fileDownloadName) filePaths必传,其他的不需要则传空
|
||
* download(filepath) 下载功能 filepath为全路径
|
||
* checkPsidno(num) 身份证正则校验--若为X 必须填写大写
|
||
* phone_reg(num) 手机号正则校验
|
||
* isPositiveInteger(s) 验证是否为整数
|
||
* initLayDate(laydate) 加载时间控件--开始结束时间 div-elem: '#timeControl' input-id ['#startTime', '#endTime']
|
||
* getNowTime() 获取当前时间
|
||
*/
|
||
|
||
/**
|
||
* 字符串判空
|
||
* @param str
|
||
* @returns {boolean}
|
||
*/
|
||
function isEmptyAndNull(str) {
|
||
if (str != null && str != 'null' && str != '') {
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
function isEmpty(str) {
|
||
if (str == null || str == 'null' || str == '') {
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 新开页面展示文件
|
||
* @param url
|
||
*/
|
||
function openFileWindows(url) {
|
||
var data = lookFile + url;
|
||
var filePath = filePreviewPathAll + encodeURIComponent(Base64.encode(data));
|
||
window.open(filePath);
|
||
}
|
||
|
||
/**
|
||
* 判断图片类型
|
||
* @param str
|
||
* @returns {boolean}
|
||
*/
|
||
function choseImgType(str) {
|
||
if (str.toLowerCase().indexOf("jpg") > 0) {
|
||
return true;
|
||
} else if (str.toLowerCase().indexOf("png") > 0) {
|
||
return true;
|
||
} else if (str.toLowerCase().indexOf("jpeg") > 0) {
|
||
return true;
|
||
} else if (str.toLowerCase().indexOf("gif") > 0) {
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 判断文件类型并赋值统一图片
|
||
* @param str
|
||
* @returns {string}
|
||
*/
|
||
function getTypeImg(str) {
|
||
if (str.toLowerCase().indexOf("xlsx") > 0 || str.toLowerCase().indexOf("xls") > 0) {
|
||
return "../../../../img/login/filetype/excel.png";
|
||
} else if (str.toLowerCase().indexOf("pdf") > 0) {
|
||
return "../../../../img/login/filetype/pdf.png";
|
||
} else if (str.toLowerCase().indexOf("ppt") > 0) {
|
||
return "../../../../img/login/filetype/ppt.png";
|
||
} else if (str.toLowerCase().indexOf("txt") > 0) {
|
||
return "../../../../img/login/filetype/txt.png";
|
||
} else if (str.toLowerCase().indexOf("vsdx") > 0) {
|
||
return "../../../../img/login/filetype/visio.png";
|
||
} else if (str.toLowerCase().indexOf("doc") > 0 || str.toLowerCase().indexOf("docx") > 0) {
|
||
return "../../../../img/login/filetype/word.png";
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 设置弹窗关闭
|
||
*/
|
||
function reloading() {
|
||
var index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
||
parent.layer.close(index); //再执行关闭
|
||
window.parent.location.reload();
|
||
}
|
||
|
||
/**
|
||
* param1 filePaths 文件地址,多个用逗号隔开,必填字段
|
||
* param2 fileNames 文件名称,多个用逗号隔开,无传空
|
||
* param3 fileTimes 文件时间,多个用逗号隔开,无传空
|
||
* param4 fileDownloadName 下载时文件名,无传空
|
||
*/
|
||
function openFile(filePaths, fileNames, fileTimes, fileDownloadName) {
|
||
console.log("openFile----------")
|
||
var height = '80%';
|
||
var width = '60%';
|
||
var index = layer.open({
|
||
title: ["查看", 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: czl_ht_url + '/pages/work/preview/PublicFileView.html',
|
||
area: [width, height],
|
||
maxmin: false,
|
||
success: function (layero, index) {
|
||
console.log("PublicFileView----------")
|
||
var iframeWin = window[layero.find('iframe')[0]['name']];//获得iframe页的窗口对象,执行iframe页的方法:
|
||
iframeWin.setParam(filePaths, fileNames, fileTimes, fileDownloadName);//调用子页面的方法,页面锁定
|
||
},
|
||
});
|
||
}
|
||
|
||
/**
|
||
* param1 filePaths 文件地址,多个用逗号隔开,必填字段
|
||
* param2 fileNames 文件名称,多个用逗号隔开,无传空
|
||
* param3 fileTimes 文件时间,多个用逗号隔开,无传空
|
||
* param4 fileDownloadName 下载时文件名,无传空
|
||
*/
|
||
function openFileAndUpLoad(filePaths, fileNames, fileTimes, fileDownloadName) {
|
||
console.log("openFile----------")
|
||
var height = '98%';
|
||
var width = '98%';
|
||
var index = layer.open({
|
||
title: [fileNames, 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: czl_ht_url + '/pages/work/preview/FileView.html',//PublicFileView
|
||
area: [width, height],
|
||
maxmin: false,
|
||
success: function (layero, index) {
|
||
console.log("PublicFileView----------")
|
||
var iframeWin = window[layero.find('iframe')[0]['name']];//获得iframe页的窗口对象,执行iframe页的方法:
|
||
iframeWin.setParam(filePaths, fileNames, fileTimes, fileDownloadName);//调用子页面的方法,页面锁定
|
||
},
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 下载功能
|
||
* @param filepath
|
||
*/
|
||
function download(filepath) {
|
||
window.location.href = filepath;
|
||
}
|
||
|
||
/**
|
||
* @description : 身份证校验-- 校验身份证号是否合规(18位、15位)
|
||
* @param {String|Number} value
|
||
* @return {Boolean} true-合规 false-不合规
|
||
*/
|
||
function checkPsidno(value) {
|
||
const psidno = String(value)
|
||
// 1.校验身份证号格式和长度
|
||
const regPsidno = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[X])$)$/
|
||
if (!regPsidno.test(psidno)) {
|
||
return false
|
||
}
|
||
// 2.校验前两位的省份编码是否正确
|
||
const province = {
|
||
11: '北京',
|
||
12: '天津',
|
||
13: '河北',
|
||
14: '山西',
|
||
15: '内蒙古',
|
||
21: '辽宁',
|
||
22: '吉林',
|
||
23: '黑龙江 ',
|
||
31: '上海',
|
||
32: '江苏',
|
||
33: '浙江',
|
||
34: '安徽',
|
||
35: '福建',
|
||
36: '江西',
|
||
37: '山东',
|
||
41: '河南',
|
||
42: '湖北 ',
|
||
43: '湖南',
|
||
44: '广东',
|
||
45: '广西',
|
||
46: '海南',
|
||
50: '重庆',
|
||
51: '四川',
|
||
52: '贵州',
|
||
53: '云南',
|
||
54: '西藏 ',
|
||
61: '陕西',
|
||
62: '甘肃',
|
||
63: '青海',
|
||
64: '宁夏',
|
||
65: '新疆',
|
||
71: '台湾',
|
||
81: '香港',
|
||
82: '澳门',
|
||
91: '国外'
|
||
}
|
||
if (!province[Number(psidno.slice(0, 2))]) {
|
||
return false
|
||
}
|
||
// 3.校验出生日期
|
||
if (psidno.length === 15) {
|
||
// 15位号码 省(2位)市(2位)县(2位)年(2位)月(2位)日(2位)校验码(3位)
|
||
const reg = new RegExp(/^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/)
|
||
const arrSplit = psidno.match(reg)
|
||
// 15位号码在年份前补 19 或 20
|
||
const year = Number(arrSplit[2].charAt(0)) > 0 ? '19' + arrSplit[2] : '20' + arrSplit[2]
|
||
const month = arrSplit[3]
|
||
const day = arrSplit[4]
|
||
if (!validateBirthday(year, month, day)) {
|
||
return false
|
||
}
|
||
} else if (psidno.length === 18) {
|
||
// 18位号码 省(2位)市(2位)县(2位)年(4位)月(2位)日(2位)校验码(4位)
|
||
const reg = new RegExp(/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/)
|
||
const arrSplit = psidno.match(reg)
|
||
const year = arrSplit[2]
|
||
const month = arrSplit[3]
|
||
const day = arrSplit[4]
|
||
if (!validateBirthday(year, month, day)) {
|
||
return false
|
||
}
|
||
} else {
|
||
return false
|
||
}
|
||
|
||
// 校验出生日期是否合理
|
||
function validateBirthday(year, month, day) {
|
||
year = Number(year) // 年
|
||
month = Number(month) // 月
|
||
day = Number(day) // 日
|
||
const nowTime = new Date().getTime() // 当前时间戳
|
||
const birthTime = new Date(`${year}-${month}-${day}`).getTime() // 获取出生日期的时间戳
|
||
// 不能是明天出生的吧
|
||
if (birthTime > nowTime) {
|
||
return false
|
||
}
|
||
// 一般人活不到150岁吧
|
||
const nowYear = new Date().getFullYear()
|
||
if ((nowYear - year) > 150) {
|
||
return false
|
||
}
|
||
// 不能是13月出生的吧
|
||
if (month < 1 || month > 12) {
|
||
return false
|
||
}
|
||
// 不能是2月30号、4月31号、5月32号出生的吧
|
||
const date = new Date(year, month, 0) // 获取当月的最后一天
|
||
if (day < 1 || day > date.getDate()) {
|
||
return false
|
||
}
|
||
return true
|
||
}
|
||
|
||
// 4.18位号码校验生成的校验码
|
||
if (psidno.length === 18) {
|
||
const Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] // 加权因子
|
||
const parity = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'] // 校验码
|
||
let sum = 0
|
||
for (let i = 0; i < 17; i++) {
|
||
sum += Number(psidno.charAt(i)) * Wi[i]
|
||
}
|
||
if (parity[sum % 11] !== psidno[17]) {
|
||
return false
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
/**
|
||
* 手机号校验
|
||
*/
|
||
const phone_reg = function (num) {
|
||
var num_reg = /^13[0-9]{1}[0-9]{8}$|15[0-9]{1}[0-9]{8}$|16[0-9]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}|17[0-9]{1}[0-9]{8}$|19[0-9]{1}[0-9]{8}$|14[0-9]{1}[0-9]{8}/;
|
||
if (!num_reg.test(num)) {
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
/**
|
||
* 验证密码强度
|
||
* @param str
|
||
* @returns {boolean}
|
||
*/
|
||
const password_reg = function (str) {
|
||
var str_reg = new RegExp('(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[^a-zA-Z0-9]).{8,20}');
|
||
if (!str_reg.test(str)) {
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
/**
|
||
* 验证密码强度
|
||
* @param str
|
||
* @returns {boolean}
|
||
*/
|
||
function validatePassword(password) {
|
||
var passwordRegex = /(?=.*\d)(?=.*[a-z_A-Z])(?=.*[\W_])[^\s]{8,}$/;
|
||
return passwordRegex.test(password);
|
||
}
|
||
|
||
/**
|
||
* 是否为正整数
|
||
* @param s
|
||
* @returns {boolean}
|
||
*/
|
||
function isPositiveInteger(s) {
|
||
var re = /^[0-9]+$/;
|
||
return re.test(s)
|
||
}
|
||
|
||
/**
|
||
* 加载时间控件--开始结束时间
|
||
* @param laydate
|
||
*/
|
||
function initLayDate(laydate) {
|
||
laydate.render({
|
||
elem: '#timeControl'
|
||
//设置开始日期、日期日期的 input 选择器
|
||
//数组格式为 2.6.6 开始新增,之前版本直接配置 true 或任意分割字符即可
|
||
, range: ['#startTime', '#endTime']
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 获得当前时间 yyyy-MM-dd
|
||
* @returns {string}
|
||
*/
|
||
function getNowTime() {
|
||
var time = new Date();
|
||
var year = time.getFullYear();
|
||
var month = time.getMonth() + 1 >= 10 ? time.getMonth() + 1 : '0' + (time.getMonth() + 1);
|
||
var day = time.getDate() >= 10 ? time.getDate() : '0' + time.getDate();
|
||
return year + "-" + month + "-" + day;
|
||
}
|
||
|
||
|
||
function getNowDateTime() {
|
||
// 创建一个Date对象
|
||
var now = new Date();
|
||
// 获取年、月、日、时、分、秒
|
||
var year = now.getFullYear(); // 年
|
||
var month = now.getMonth() + 1; // 月,注意月份范围是0-11,需要加1
|
||
var date = now.getDate(); // 日
|
||
var hour = now.getHours(); // 时
|
||
var minute = now.getMinutes(); // 分
|
||
var second = now.getSeconds(); // 秒
|
||
return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
|
||
}
|
||
|
||
/**
|
||
* @param url 例:'/consRelation/recallConsById'
|
||
* @param data 例:{'consId': consId, 'proId': proId}
|
||
* @param success
|
||
* @param error
|
||
* @param type 1 父页面 2 子页面
|
||
*/
|
||
function ajaxCommonMethods(url, data, success, error, type) {
|
||
$.ajax({
|
||
type: 'POST',
|
||
async: false, // 默认异步true,false表示同步
|
||
url: czl_ht_url + url,// 请求地址
|
||
contentType: "application/x-www-form-urlencoded",
|
||
dataType: 'json', // 服务器返回数据类型
|
||
data: data, //获取提交的表单字段
|
||
success: function (data) {
|
||
var resMsg = data.resMsg;
|
||
if ("数据获取成功" == resMsg) {
|
||
layer.msg(success, {icon: 1, time: 2000}, function () { //延时跳转并提示
|
||
if (type == 1) {
|
||
layer.close(layer.index); //关闭窗口
|
||
window.location.reload(); //刷新父级窗口
|
||
} else {
|
||
var index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
||
parent.layer.close(index); //再执行关闭
|
||
window.parent.location.reload();
|
||
}
|
||
});
|
||
} else {
|
||
layer.msg(error, {icon: 2});
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
function ajaxCommonMethodsForPassword(url, data, success, error, type) {
|
||
$.ajax({
|
||
type: 'POST',
|
||
async: false, // 默认异步true,false表示同步
|
||
url: czl_ht_url + url,// 请求地址
|
||
contentType: "application/x-www-form-urlencoded",
|
||
dataType: 'json', // 服务器返回数据类型
|
||
data: data, //获取提交的表单字段
|
||
success: function (data) {
|
||
var resMsg = data.resMsg;
|
||
if ("数据获取成功" == resMsg) {
|
||
layer.msg(success, {icon: 1, time: 2000}, function () { //延时跳转并提示
|
||
if (type == 1) {
|
||
layer.close(layer.index); //关闭窗口
|
||
window.location.reload(); //刷新父级窗口
|
||
} else {
|
||
var index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
|
||
parent.layer.close(index); //再执行关闭
|
||
}
|
||
});
|
||
} else {
|
||
layer.msg(error, {icon: 2});
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
/**
|
||
* @param url 例:'/consRelation/recallConsById'
|
||
* @param data 例:{'consId': consId, 'proId': proId}
|
||
* @param type 返回类型 1 true or false
|
||
* 返回值 true or false or obj
|
||
*/
|
||
function ajaxCommonMethod(url, data) {
|
||
var tf = false;
|
||
$.ajax({
|
||
type: 'POST',
|
||
async: false, // 默认异步true,false表示同步
|
||
url: czl_ht_url + url,// 请求地址
|
||
contentType: "application/x-www-form-urlencoded",
|
||
dataType: 'json', // 服务器返回数据类型
|
||
data: data, //获取提交的表单字段
|
||
success: function (data) {
|
||
var resMsg = data.resMsg;
|
||
console.log(resMsg)
|
||
if ("数据获取成功" === resMsg) {
|
||
layer.closeAll('dialog');
|
||
tf = true;
|
||
}else if("设备未完全解绑" === resMsg){
|
||
layer.closeAll('dialog');
|
||
parent.layer.msg(resMsg, {icon: 1, time: 2000});
|
||
tf = true;
|
||
} else {
|
||
tf = false;
|
||
}
|
||
}
|
||
});
|
||
return tf;
|
||
}
|
||
|
||
function layerOpenFormForSencond(title, contentUrl) {
|
||
var index = layer.open({
|
||
title: [title, 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: contentUrl,
|
||
area: ['90%', '95%'],
|
||
maxmin: false,
|
||
btn: ['确定'],
|
||
success: function (layero, index) {
|
||
},
|
||
yes: function (index, layero) {
|
||
//提交子页面时执行
|
||
// 获取弹出层中的form表单元素
|
||
var formSubmit = layer.getChildFrame('form', index);
|
||
// 查找class样式为submitBtn的按钮
|
||
let submited = formSubmit.find('button.subBtn');
|
||
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||
submited.click();
|
||
}
|
||
,end:function (){
|
||
reloadTable(contentUrl, title, index)
|
||
}
|
||
, cancel: function (index, layero) {
|
||
var t = changeProTeam(contentUrl, title, index);
|
||
if (!t) {
|
||
return false;
|
||
}
|
||
var tf = changSubTeam(contentUrl, title, index);
|
||
if (!tf) {
|
||
return false;
|
||
}
|
||
var tff = changOwnTeam(contentUrl, title, index);
|
||
if (!tff) {
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
});
|
||
}
|
||
|
||
function toLeadInto(title, contentUrl) {
|
||
var index = layer.open({
|
||
title: [title, 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: contentUrl,
|
||
area: ['70%', '95%'],
|
||
maxmin: false,
|
||
success: function (layero, index) {
|
||
},
|
||
yes: function (index, layero) {
|
||
//提交子页面时执行
|
||
// 获取弹出层中的form表单元素
|
||
var formSubmit = layer.getChildFrame('form', index);
|
||
// 查找class样式为submitBtn的按钮
|
||
let submited = formSubmit.find('button.subBtn');
|
||
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||
submited.click();
|
||
}
|
||
,end:function (){
|
||
reloadTable(contentUrl, title, index)
|
||
}
|
||
, cancel: function (index, layero) {
|
||
var t = changeProTeam(contentUrl, title, index);
|
||
if (!t) {
|
||
return false;
|
||
}
|
||
var tf = changSubTeam(contentUrl, title, index);
|
||
if (!tf) {
|
||
return false;
|
||
}
|
||
var tff = changOwnTeam(contentUrl, title, index);
|
||
if (!tff) {
|
||
return false;
|
||
}
|
||
console.log(contentUrl)
|
||
if (contentUrl === "../toLeadInto/importForm.html"){
|
||
table.reload('menuTable', {
|
||
url: czl_ht_url + '/personnel/getSubsidiaryCompanyList'
|
||
, method: 'post' //方式默认是get
|
||
, page: true
|
||
, where: {
|
||
keyWord: "",
|
||
orgId: "",
|
||
voltageLevel: "",
|
||
} //设定异步数据接口的额外参数
|
||
});
|
||
}
|
||
if (contentUrl === "../toLeadInto/subcontractorImport.html"){
|
||
table.reload('menuTable', {
|
||
url: czl_ht_url + '/personnel/getSubcontractorList'
|
||
, method: 'post' //方式默认是get
|
||
, page: true
|
||
, where: {
|
||
keyWord: "",
|
||
subId: "",
|
||
dictKey: "",
|
||
} //设定异步数据接口的额外参数
|
||
});
|
||
}
|
||
if (contentUrl === "../toLeadInto/selfOwnedImportForm.html"){
|
||
table.reload('menuTable', {
|
||
url: czl_ht_url + '/personnel/getSelfOwnedList'
|
||
, method: 'post' //方式默认是get
|
||
, page: true
|
||
, where: {
|
||
keyWord: "",
|
||
orgId: "",
|
||
} //设定异步数据接口的额外参数
|
||
});
|
||
}
|
||
if (contentUrl === "../toLeadInto/towerProjectImportForm.html"){
|
||
table.reload('menuTable', {
|
||
url: czl_ht_url + '/towerPro/getFirmContentList'
|
||
, method: 'post' //方式默认是get
|
||
, page: true
|
||
, where: {
|
||
keyWord: '',
|
||
orgId: '',
|
||
volLevelIds: '',
|
||
statusId: '',
|
||
} //设定异步数据接口的额外参数
|
||
});
|
||
}
|
||
if (contentUrl === "../toLeadInto/machineToolImportForm.html"){
|
||
table.reload('menuTable', {
|
||
url: czl_ht_url + '/dataIndex/getToolList'
|
||
, method: 'post' //方式默认是get
|
||
, page: true
|
||
, where: {
|
||
keyWord: '',
|
||
dictKey: '',
|
||
deviceName: '',
|
||
} //设定异步数据接口的额外参数
|
||
})
|
||
}
|
||
|
||
return true;
|
||
}
|
||
});
|
||
}
|
||
|
||
function reloadTable(contentUrl, title, index){
|
||
localStorage.removeItem("id");
|
||
localStorage.removeItem("teamTypeId");
|
||
localStorage.removeItem("standardTeamTypeId");
|
||
localStorage.removeItem("subTeamTypeId");
|
||
localStorage.removeItem("subId");
|
||
localStorage.removeItem("voltageLevelId");
|
||
localStorage.removeItem("teamName");
|
||
if (contentUrl == "./proManageTeamForm.html" || contentUrl == "./personToTeamForm.html" || contentUrl == "./teamAndProBindForm.html"){
|
||
reloadProTeamData();
|
||
}
|
||
if (contentUrl == "./subTeamForm.html" || contentUrl == "./personToSubTeamForm.html" || contentUrl == "./subAndTeamBindForm.html") {
|
||
reloadSubTeamData()
|
||
}
|
||
if (contentUrl == "./ownTeamForm.html" || contentUrl == "./ownPersonToTeamForm.html" || contentUrl == "./teamBindOrgForm.html") {
|
||
reloadOwnTeamData();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 重载项目管理团队表格
|
||
*/
|
||
function reloadProTeamData(){
|
||
table.reload('menuTable', {
|
||
url: czl_ht_url + '/proManage/getProjectManagementTeamsList'
|
||
, method: 'post' //方式默认是get
|
||
, where: {
|
||
keyWord: $("#keyWord").val(),
|
||
status: $("#statusId").val(),
|
||
branchId: $("#orgId").val(),
|
||
} //设定异步数据接口的额外参数
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 重载分包商班组表格
|
||
*/
|
||
function reloadSubTeamData(){
|
||
table.reload('menuTable', {
|
||
url: czl_ht_url + '/subTeam/getSubTeamsList'
|
||
, method: 'post' //方式默认是get
|
||
, where: {
|
||
keyWord: $("#keyWord").val(),
|
||
status: $("#statusId").val(),
|
||
subTeamTypeId: $("#subTeamTypeId").val(),
|
||
} //设定异步数据接口的额外参数
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 重载自有班组表格
|
||
*/
|
||
function reloadOwnTeamData(){
|
||
table.reload('menuTable', {
|
||
url: czl_ht_url + '/owmTeams/getOwnTeamsList'
|
||
, method: 'post' //方式默认是get
|
||
, where: {
|
||
keyWord: $("#keyWord").val(),
|
||
status: $("#statusId").val(),
|
||
teamTypeId: $("#teamTypeId").val(),
|
||
} //设定异步数据接口的额外参数
|
||
});
|
||
}
|
||
|
||
function layerOpenFormForSencondss(title, contentUrl) {
|
||
var index = layer.open({
|
||
title: [title, 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: contentUrl,
|
||
area: ['50%', '95%'],
|
||
maxmin: false,
|
||
btn: ['确定'],
|
||
success: function (layero, index) {
|
||
},
|
||
yes: function (index, layero) {
|
||
//提交子页面时执行
|
||
// 获取弹出层中的form表单元素
|
||
var formSubmit = layer.getChildFrame('form', index);
|
||
// 查找class样式为submitBtn的按钮
|
||
let submited = formSubmit.find('button.subBtn');
|
||
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||
submited.click();
|
||
}
|
||
, cancel: function (index, layero) {
|
||
var t = changeProTeam(contentUrl, title, index);
|
||
if (!t) {
|
||
return false;
|
||
}
|
||
var tf = changSubTeam(contentUrl, title, index);
|
||
if (!tf) {
|
||
return false;
|
||
}
|
||
var tff = changOwnTeam(contentUrl, title, index);
|
||
if (!tff) {
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
});
|
||
}
|
||
|
||
function changeProTeam(contentUrl, title, index) {
|
||
var tf = true;
|
||
if (contentUrl == "./proManageTeamForm.html" || contentUrl == "./personToTeamForm.html") {
|
||
if (title == '修改') {
|
||
// 在弹出层关闭时执行
|
||
let iframeWin = window["layui-layer-iframe" + index];
|
||
tf = iframeWin.checkInfo();
|
||
if (!tf) {
|
||
return false;
|
||
} else {
|
||
iframeWin.addInfo("2");
|
||
}
|
||
}
|
||
}
|
||
if (contentUrl == "./proManageTeamForm.html" || contentUrl == "./personToTeamForm.html" || contentUrl == "./teamAndProBindForm.html") {
|
||
localStorage.removeItem("id");
|
||
localStorage.removeItem("teamTypeId");
|
||
localStorage.removeItem("voltageLevelId");
|
||
localStorage.removeItem("teamName");
|
||
reloadProTeamData();
|
||
}
|
||
return true;
|
||
}
|
||
|
||
function changSubTeam(contentUrl, title, index) {
|
||
var tf = true;
|
||
if (contentUrl == "./subTeamForm.html" || contentUrl == "./personToSubTeamForm.html") {
|
||
if (title == '修改') {
|
||
// 在弹出层关闭时执行
|
||
let iframeWin = window["layui-layer-iframe" + index];
|
||
tf = iframeWin.checkInfo();
|
||
if (!tf) {
|
||
return false;
|
||
} else {
|
||
iframeWin.addInfo("2");
|
||
}
|
||
}
|
||
}
|
||
if (contentUrl == "./subTeamForm.html" || contentUrl == "./personToSubTeamForm.html" || contentUrl == "./subAndTeamBindForm.html") {
|
||
localStorage.removeItem("id");
|
||
localStorage.removeItem("teamTypeId");
|
||
localStorage.removeItem("subTeamTypeId");
|
||
localStorage.removeItem("subId");
|
||
localStorage.removeItem("teamName");
|
||
reloadSubTeamData();
|
||
}
|
||
return true;
|
||
}
|
||
|
||
function changOwnTeam(contentUrl, title, index) {
|
||
var tf = true;
|
||
if (contentUrl == "./ownTeamForm.html" || contentUrl == "./ownPersonToTeamForm.html") {
|
||
if (title == '修改') {
|
||
// 在弹出层关闭时执行
|
||
let iframeWin = window["layui-layer-iframe" + index];
|
||
tf = iframeWin.checkInfo();
|
||
if (!tf) {
|
||
return false;
|
||
} else {
|
||
iframeWin.addInfo("2");
|
||
}
|
||
}
|
||
}
|
||
if (contentUrl == "./ownTeamForm.html" || contentUrl == "./ownPersonToTeamForm.html" || contentUrl == "./teamBindOrgForm.html") {
|
||
localStorage.removeItem("id");
|
||
localStorage.removeItem("teamTypeId");
|
||
localStorage.removeItem("standardTeamTypeId");
|
||
localStorage.removeItem("teamName");
|
||
reloadOwnTeamData();
|
||
}
|
||
return true;
|
||
}
|
||
|
||
function layerOpenForm(title, contentUrl, width, heigth) {
|
||
var index = layer.open({
|
||
title: [title, 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: contentUrl,
|
||
area: [width, heigth],
|
||
maxmin: false,
|
||
btn: ['确定', '关闭'],
|
||
success: function (layero, index) {
|
||
},
|
||
yes: function (index, layero) {
|
||
//提交子页面时执行
|
||
// 获取弹出层中的form表单元素
|
||
var formSubmit = layer.getChildFrame('form', index);
|
||
// 查找class样式为submitBtn的按钮
|
||
let submited = formSubmit.find('button.subBtn');
|
||
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||
submited.click();
|
||
}
|
||
});
|
||
}
|
||
|
||
function layerOpenForms(title, contentUrl, width, heigth) {
|
||
var index = layer.open({
|
||
title: [title, 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: contentUrl,
|
||
area: [width, heigth],
|
||
maxmin: false,
|
||
success: function (layero, index) {
|
||
},
|
||
yes: function (index, layero) {
|
||
//提交子页面时执行
|
||
// 获取弹出层中的form表单元素
|
||
var formSubmit = layer.getChildFrame('form', index);
|
||
// 查找class样式为submitBtn的按钮
|
||
let submited = formSubmit.find('button.subBtn');
|
||
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||
submited.click();
|
||
}
|
||
});
|
||
}
|
||
|
||
function layerOpenView(title, contentUrl) {
|
||
var index = layer.open({
|
||
title: [title, 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: contentUrl,
|
||
area: ['90%', '95%'],
|
||
maxmin: false,
|
||
});
|
||
}
|
||
|
||
function layerOpenView(title, contentUrl, width, heigth) {
|
||
var index = layer.open({
|
||
title: [title, 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: contentUrl,
|
||
area: [width, heigth],
|
||
maxmin: false,
|
||
btn: ['关闭'],
|
||
});
|
||
}
|
||
|
||
function layerOpenViewNoBtn(title, contentUrl, width, heigth) {
|
||
var index = layer.open({
|
||
title: [title, 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: contentUrl,
|
||
area: [width, heigth],
|
||
maxmin: false,
|
||
});
|
||
}
|
||
|
||
function layerOpenViewForSencond(title, contentUrl) {
|
||
var index = layer.open({
|
||
title: [title, 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: contentUrl,
|
||
area: ['90%', '95%'],
|
||
maxmin: false,
|
||
end: function () {
|
||
var t = changeProTeam(contentUrl, title, index);
|
||
if (!t) {
|
||
return false;
|
||
}
|
||
var tf = changSubTeam(contentUrl, title, index);
|
||
if (!tf) {
|
||
return false;
|
||
}
|
||
var tff = changOwnTeam(contentUrl, title, index);
|
||
if (!tff) {
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
});
|
||
}
|
||
|
||
function layerOpenFormTeamMember(title, contentUrl) {
|
||
var index = layer.open({
|
||
title: [title, 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: contentUrl,
|
||
area: ['90%', '95%'],
|
||
maxmin: false,
|
||
success: function (layero, index) {
|
||
},
|
||
yes: function (index, layero) {
|
||
//提交子页面时执行
|
||
// 获取弹出层中的form表单元素
|
||
var formSubmit = layer.getChildFrame('form', index);
|
||
// 查找class样式为submitBtn的按钮
|
||
let submited = formSubmit.find('button.subBtn');
|
||
// 触发点击事件,会对表单进行验证,验证成功则提交表单,失败则返回错误信息
|
||
submited.click();
|
||
}
|
||
, cancel: function (index, layero) {
|
||
var t = changeProTeam(contentUrl, title, index);
|
||
if (!t) {
|
||
return false;
|
||
}
|
||
var tf = changSubTeam(contentUrl, title, index);
|
||
if (!tf) {
|
||
return false;
|
||
}
|
||
var tff = changOwnTeam(contentUrl, title, index);
|
||
if (!tff) {
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
});
|
||
}
|