|
|
|
|
@ -108,6 +108,8 @@
|
|
|
|
|
font-size: 17px;
|
|
|
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height:49px;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -220,6 +222,7 @@
|
|
|
|
|
type="tel"
|
|
|
|
|
id="phone"
|
|
|
|
|
name="phone"
|
|
|
|
|
onblur="phoneChange(this)"
|
|
|
|
|
placeholder="请输入手机号"
|
|
|
|
|
required
|
|
|
|
|
/>
|
|
|
|
|
@ -255,17 +258,31 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="form-item" id="inreason-item">
|
|
|
|
|
<label for="inreasonSelect">进山原因</label>
|
|
|
|
|
<div class="selectreason" onclick="openReasonItem()" id="form-reason">
|
|
|
|
|
选择
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="form-item" id="projectname-item">
|
|
|
|
|
<label for="projectname">项目名称*</label>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
id="projectname"
|
|
|
|
|
name="projectname"
|
|
|
|
|
placeholder="请输入项目名称"
|
|
|
|
|
required
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- <div class="form-item" id="inreason">
|
|
|
|
|
<label for="reason">进山原因</label>
|
|
|
|
|
<input type="text" id="reason" name="reason" placeholder="请输入进山原因">
|
|
|
|
|
</div> -->
|
|
|
|
|
<button class="submit" onclick="submit">登记</button>
|
|
|
|
|
|
|
|
|
|
<div class="submit" onclick="submit()">登记</div>
|
|
|
|
|
</form>
|
|
|
|
|
<div
|
|
|
|
|
class="reason-box hidden"
|
|
|
|
|
@ -291,31 +308,40 @@
|
|
|
|
|
url: `${URL}/api/Categorys/LoadList?typeid=PERSONAL_TYPE`,
|
|
|
|
|
contentType: "application/json;charset=utf-8",
|
|
|
|
|
success: function (response) {
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
if (response.code === 200 && response.result) {
|
|
|
|
|
let reasons = response.result;
|
|
|
|
|
var reasonBox = $("#reasonBox");
|
|
|
|
|
reasons.forEach((item, index) => {
|
|
|
|
|
console.log("item::: ", item);
|
|
|
|
|
let option = `<div onclick="selectReason('${item.name}')">${item.name}</div>`;
|
|
|
|
|
reasonBox.append(option);
|
|
|
|
|
});
|
|
|
|
|
initFormData();
|
|
|
|
|
// if(localStorage.getItem("phone")){
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getReason();
|
|
|
|
|
|
|
|
|
|
let registrationData = 0; //默认的上下山,不选
|
|
|
|
|
let reasonData = ""; //默认的进山原因
|
|
|
|
|
$("#inreason-item").hide();
|
|
|
|
|
$("#projectname-item").hide(); // 隐藏项目名称
|
|
|
|
|
//选择上下山原因
|
|
|
|
|
function selectRegistration(registration, _this) {
|
|
|
|
|
registrationData = registration;
|
|
|
|
|
if (registration == 1) {
|
|
|
|
|
$("#inreason-item").show();
|
|
|
|
|
} else {
|
|
|
|
|
// 项目名称
|
|
|
|
|
document.getElementById("projectname").value = "";
|
|
|
|
|
$("#projectname-item").hide();
|
|
|
|
|
localStorage.setItem("projectname","");
|
|
|
|
|
|
|
|
|
|
$("#inreason-item").hide();
|
|
|
|
|
reasonData = "";
|
|
|
|
|
$("#form-reason").text("选择");
|
|
|
|
|
@ -330,6 +356,15 @@
|
|
|
|
|
function selectReason(name) {
|
|
|
|
|
reasonData = name;
|
|
|
|
|
$("#form-reason").text(name);
|
|
|
|
|
|
|
|
|
|
if(reasonData == "项目施工"){
|
|
|
|
|
document.getElementById("projectname").value = "";
|
|
|
|
|
$("#projectname-item").show();
|
|
|
|
|
}else{
|
|
|
|
|
document.getElementById("projectname").value = "";
|
|
|
|
|
$("#projectname-item").hide();
|
|
|
|
|
localStorage.setItem("projectname","");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 初始化表单数据
|
|
|
|
|
@ -339,30 +374,61 @@
|
|
|
|
|
const phoneInput = document.getElementById("phone");
|
|
|
|
|
const idCardInput = document.getElementById("idCard");
|
|
|
|
|
const addressInput = document.getElementById("address");
|
|
|
|
|
const projectNameInput = document.getElementById("projectname");
|
|
|
|
|
|
|
|
|
|
// 从localStorage里读取数据
|
|
|
|
|
const name = localStorage.getItem("name");
|
|
|
|
|
const phone = localStorage.getItem("phone");
|
|
|
|
|
const idCard = localStorage.getItem("idCard");
|
|
|
|
|
const address = localStorage.getItem("address");
|
|
|
|
|
const projectname = localStorage.getItem("projectname")
|
|
|
|
|
// 将数据填充到表单里
|
|
|
|
|
nameInput.value = name;
|
|
|
|
|
phoneInput.value = phone;
|
|
|
|
|
idCardInput.value = idCard;
|
|
|
|
|
addressInput.value = address;
|
|
|
|
|
projectNameInput.value = projectname;
|
|
|
|
|
}
|
|
|
|
|
// 当phone值发生改变时
|
|
|
|
|
function phoneChange(input){
|
|
|
|
|
getUserInfoByPhone(input.value);
|
|
|
|
|
}
|
|
|
|
|
// 如果localStorage中没有存储,则在用户输入完手机号码之后查询用户信息并显示
|
|
|
|
|
function getUserInfoByPhone(phone){
|
|
|
|
|
$.ajax({
|
|
|
|
|
method: "GET",
|
|
|
|
|
url: `${URL}/api/FireCodeH/LoadNameInfoByPhone?phone=${phone}`,
|
|
|
|
|
success: function (response) {
|
|
|
|
|
if (response.code === 200 && response.data != null) {
|
|
|
|
|
// 将查询信息添加到本地localStorage中
|
|
|
|
|
localStorage.setItem("name", response.data.userName);
|
|
|
|
|
localStorage.setItem("phone", response.data.phone);
|
|
|
|
|
localStorage.setItem("idCard", response.data.cardNo);
|
|
|
|
|
localStorage.setItem("address", response.data.userAddress);
|
|
|
|
|
// 初始化表单
|
|
|
|
|
initFormData();
|
|
|
|
|
} else {
|
|
|
|
|
message("未知错误");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 监听表单提交事件
|
|
|
|
|
function submit() {
|
|
|
|
|
// 获取填写的数据
|
|
|
|
|
const name = nameInput.value;
|
|
|
|
|
const phone = phoneInput.value;
|
|
|
|
|
const idCard = idCardInput.value;
|
|
|
|
|
const address = addressInput.value;
|
|
|
|
|
const name = document.getElementById("name").value;
|
|
|
|
|
const phone = document.getElementById("phone").value;
|
|
|
|
|
const idCard = document.getElementById("idCard").value;
|
|
|
|
|
const address = document.getElementById("address").value;
|
|
|
|
|
const projectname = document.getElementById("projectname").value;
|
|
|
|
|
|
|
|
|
|
// 存储到localStorage
|
|
|
|
|
localStorage.setItem("name", name);
|
|
|
|
|
localStorage.setItem("phone", phone);
|
|
|
|
|
localStorage.setItem("idCard", idCard);
|
|
|
|
|
localStorage.setItem("address", address);
|
|
|
|
|
localStorage.setItem("projectname",projectname);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 表单验证
|
|
|
|
|
let IDCardReg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
|
|
|
|
|
@ -384,6 +450,10 @@
|
|
|
|
|
message("请输入正确身份证号");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!address) {
|
|
|
|
|
message("请输入联系地址");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (registrationData == 0) {
|
|
|
|
|
message("请选择登记类型");
|
|
|
|
|
return false;
|
|
|
|
|
@ -392,6 +462,10 @@
|
|
|
|
|
message("请选择进山原因");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (registrationData == 1 && reasonData=="项目施工" && !projectname) {
|
|
|
|
|
message("请输入项目名称");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 提交
|
|
|
|
|
postMessage({
|
|
|
|
|
@ -404,6 +478,7 @@
|
|
|
|
|
siteId: urlParams.siteId,
|
|
|
|
|
registrationType: registrationData,
|
|
|
|
|
reason: registrationData == 1 ? reasonData : null,
|
|
|
|
|
projectName:registrationData == 1 && reasonData == '项目施工' ? projectname : null
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -423,5 +498,6 @@
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
</html>
|
|
|
|
|
|