You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

359 lines
14 KiB

function tan(ty){
alert('确定添加?');
if(ty=='f'){
var p= document.getElementById('facility');
var newfacility='<div class="form-group">\n' +
' <div class="col-md-3">\n' +
' <label for="facilityno">作番号(必填)</label>\n' +
' <input class="form-control facilitynos" type="text" name="facilityno" id="facilityno" required>\n' +
' </div>\n' +
'\n' +
' <div class="col-md-3">\n' +
' <label for="weight">重量(必填)</label>\n' +
' <input class="form-control weights " type="text" name="weight" id="weight" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\\D*(\\d*(?:\\.\\d)?).*$/g, \'$1\')" required>\n' +
'\n' +
' </div>\n' +
'\n' +
' <div class="col-md-3">\n' +
' <label for="numberofstop">停数(必填)</label>\n' +
' <input class="form-control numberofstops" type="text" name="numberofstop" id="numberofstop" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\\D*(\\d*(?:\\.\\d)?).*$/g, \'$1\')" required>\n' +
'\n' +
' </div>\n' +
'\n' +
' <div class="col-md-3" >\n' +
' <label for="numberoffloor">楼层数(必填)</label>\n' +
' <input class="form-control numberoffloors" type="text" name="numberoffloor" id="numberoffloor" onkeyup="if(value<0)value=0;if(value.length>3)value=value.slice(0,3);value=value.replace(/^\\D*(\\d*(?:\\.\\d)?).*$/g, \'$1\')" required>\n' +
'\n' +
' </div>\n' +
' </div>\n' +
' <div class="form-group">\n' +
' <div class="col-md-3" >\n' +
' <label for="opentype">开门方式(必填)</label>\n' +
' <Select class="form-control opentypes" name="opentype" id="opentype" required>\n' +
' <option selected="selected" disabled="disabled" style="display: none" value=""></option>\n' +
' <Option Value="CO">CO</Option>\n' +
' <Option Value="SO">SO</Option>\n' +
' <Option Value="CO-SO">CO-SO</Option>\n' +
' </Select>\n' +
' </div>\n' +
'\n' +
' <div class="col-md-3">\n' +
' <label for="speed">速度(必填)</label>\n' +
' <input class="form-control speeds" type="text" name="speed" id="speed" onkeyup="if(value<0)value=0;if(value.length>4)value=value.slice(0,4);value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,1})?).*$/g, \'$1\')" required>\n' +
'\n' +
' </div class="col-md-3">\n' +
'\n' +
' <div class="col-md-3">\n' +
' <label for="repairtype">维修型态(必填)</label>\n' +
' <Select class="form-control repairtypes" name="repairtype" id="repairtype" required>\n' +
' <option selected="selected" disabled="disabled" style="display: none" value=""></option>\n' +
' <Option Value="A">定期保养</Option>\n' +
' <Option Value="B">单次保养</Option>\n' +
' <Option Value="C">单次维修</Option>\n' +
' </Select>\n' +
' </div>\n' +
'\n' +
' <div class="col-md-3">\n' +
' <label for="address">地址</label>\n' +
' <input class="form-control addresss" type="text" name="address" id="address" >\n' +
' </div>\n' +
'\n' +
' </div>\n' +
' <div class="form-group">\n' +
' <div class="col-md-3">\n' +
' <label for="longitude">经度(必填)</label>\n' +
' <input class="form-control longitudes" type="text" name="longitude" id="longitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,7})?).*$/g, \'$1\')" required>\n' +
'\n' +
' </div>\n' +
'\n' +
' <div class="col-md-3">\n' +
' <label for="latitude">纬度(必填)</label>\n' +
' <input class="form-control latitudes" type="latitude" name="latitude" id="latitude" onkeyup="if(value<0)value=0;if(value.length>11)value=value.slice(0,11);value=value.replace(/^\\D*(\\d*(?:\\.\\d{0,7})?).*$/g, \'$1\')" required>\n' +
'\n' +
' </div>\n' +
'\n' +
'\n' +
'\n' +
' <div class="col-md-3">\n' +
' <label for="repairerid">维修人员工号(必填)</label>\n' +
' <input class="form-control repairerids" type="text" name="repairerid" id="repairerid" required>\n' +
' </div>\n' +
'\n' +
' <div class="col-md-3">\n' +
' <label for="repairername">维修人员姓名(必填)</label>\n' +
' <input class="form-control repairernames" type="text" name="repairername" id="repairername" required>\n' +
' </div>\n' +
'\n' +
' </div>'
p.innerHTML+=newfacility;
}else if(ty=='s'){
var s= document.getElementById('schedule');
var newschedule='<div class="form-group" >\n' +
' <div class="col-md-3">\n' +
' <label for="facilityno">作番号(必填)</label>\n' +
' <input class="form-control facilitynos" type="text" id="facilityno" required>\n' +
' </div>\n' +
'\n' +
' <div class="col-md-2">\n' +
' <label for="combono">保养套餐编号(必填)</label>\n' +
' <input class="form-control combonos" type="text" id="combono" required>\n' +
' </div>\n' +
' <div class="col-md-2">\n' +
' <label for="duedate">应保养日期(必填)</label>\n' +
' <input class="form-control duedates" type="text " id="duedate" required>\n' +
'\n' +
' </div>\n' +
' <div class="col-md-2">\n' +
' <label for="repairerid">保养人员工号(必填)</label>\n' +
' <input class="form-control repairerids" type="text" id="repairerid" required>\n' +
' </div>\n' +
'\n' +
' <div class="col-md-3">\n' +
' <label for="repairername">保养人员姓名(必填)</label>\n' +
' <input class="form-control repairernames" type="text" id="repairername" required>\n' +
' </div>\n' +
'\n' +
' </div>'
s.innerHTML+=newschedule;
}else{
alert('非法操作')
}
}
function tijiao(){
//作番号
var facilitynoslist = [];
$(".facilitynos").each(function () {
facilitynoslist.push($(this).val());
});
console.log('11111');
console.log(facilitynoslist);
console.log('22222');
console.log('数据');
//重量
var weightslist = [];
$(".weights").each(function () {
weightslist.push($(this).val());
});
//停数
var numberofstopslist=[];
$(".numberofstops").each(function () {
numberofstopslist.push($(this).val());
});
//楼层数
var numberoffloorslist=[];
$(".numberoffloors").each(function () {
numberoffloorslist.push($(this).val());
});
//开门方式
var opentypeslist=[];
$(".opentypes").each(function () {
opentypeslist.push($(this).val());
});
//速度
var speedslist=[];
$(".speeds").each(function () {
speedslist.push($(this).val());
});
//维护形态
var repairtypeslist=[];
$(".repairtypes").each(function () {
repairtypeslist.push($(this).val());
});
//地址
var addressslist=[];
$(".addresss").each(function () {
addressslist.push($(this).val());
});
//经度
var longitudeslist=[];
$(".longitudes").each(function () {
longitudeslist.push($(this).val());
});
//维度
var latitudeslist=[];
$(".latitudes").each(function () {
latitudeslist.push($(this).val());
});
//维护工号
var repaireridslist=[];
$(".repairerids").each(function () {
repaireridslist.push($(this).val());
});
//维护人员姓名
var repairernameslist=[];
$(".repairernames").each(function () {
repairernameslist.push($(this).val());
});
//合约号
var contractno = $('.contractno').val();
//客户编号
var customerid = $('.customerid').val();
//建档人
var creater = $('.creater').val();
//创建时间
var create_at = $('.create_at').val();
var type = $('.type').val();
var url = "facilityapi.php";
//提交创建
$.ajax({
method: 'post',
url: url,
data: {
facilitynos: JSON.stringify(facilitynoslist),
weights: JSON.stringify(weightslist),
numberofstops:JSON.stringify(numberofstopslist),
numberoffloors:JSON.stringify(numberoffloorslist),
opentypes:JSON.stringify(opentypeslist),
speeds:JSON.stringify(speedslist),
repairtypes:JSON.stringify(repairtypeslist),
addresss:JSON.stringify(addressslist),
longitudes:JSON.stringify(longitudeslist),
latitudes:JSON.stringify(latitudeslist),
repairerids:JSON.stringify(repaireridslist),
repairernames:JSON.stringify(repairernameslist),
type:type,
contractno:contractno,
customerid:customerid,
creater:creater,
create_at:create_at
},
success: function (data) {
var res=eval('('+data+')');
if(res.code=='200'){
window.location.href='custom-create-schedule.php?accountid='+customerid+'&contractno='+contractno;
}else{
alert('添加失败');
}
}
});
}
function tijiaosch(){
//作番号
var facilitynoslist = [];
$(".facilitynos").each(function () {
facilitynoslist.push($(this).val());
});
//保养套餐
var combonoslist=[];
$(".combonos").each(function () {
combonoslist.push($(this).val());
});
//保养日期duedates
var duedateslist=[];
$(".duedates").each(function () {
duedateslist.push($(this).val());
});
//保养工号
var repaireridslist=[];
$(".repairerids").each(function () {
repaireridslist.push($(this).val());
});
//保养人姓名
var repairernameslist=[];
$(".repairernames").each(function () {
repairernameslist.push($(this).val());
});
//合约号
var contractno = $('.contractno').val();
//建档人
var creater = $('.creater').val();
//创建时间
var create_at = $('.create_at').val();
var type = $('.type').val();
var url = "scheduleapi.php";
//提交创建
$.ajax({
method: 'post',
url: url,
data: {
facilitynos: JSON.stringify(facilitynoslist),
combonos:JSON.stringify(combonoslist),
duedates:JSON.stringify(duedateslist),
repairerids:JSON.stringify(repaireridslist),
repairernames:JSON.stringify(repairernameslist),
type:type,
contractno:contractno,
creater:creater,
create_at:create_at
},
success: function (data) {
var res=eval('('+data+')');
if(res.code=='200'){
window.location.href='custom-create.php';
}else{
alert('添加失败,请检查数据');
}
}
});
}
function show(id){
//removeClass
var t = document.getElementById('account');//选取id为test的div元素
t.style.display = 'none';// 隐藏选择的元素
t.style.display = 'block';// 以块级样式显示
}
function login(){
var account = $('.account').val();
var password = $('.password').val();
var url = "loginapi.php";
$.ajax({
method: 'post',
url: url,
data: {
account:account,
password:password
},
success: function (data) {
console.log('返回的结果');
res=eval("("+data+")");
console.log(res);
console.log(window.location.host);
console.log(res.code);
if(res.code=='200'){
var token=res.token;
console.log(token);
window.localStorage.setItem("token",token);
window.location.href='pricereview-index.php?token='+token;
}else{
window.location.href='login.php?errno=1';
}
}
});
}
function settoken(v){
window.localStorage.setItem("token",v);
}
function gettoken(v){
window.localStorage.getItem("token");
}