Model.prototype.sendsmsbuttonClick = function(event) { // 通过Baas获取数据 // 验证手机号是否合法! var reg = /^[1][34578][0-9]{9}$/; var phoneNumber = this.comp("phonenumber").val(); if (reg.test(phoneNumber)) { this.comp("sendsmsbutton").mytimer(); justep.Baas.sendRequest({ "url" : "/work/Dx", "action" : "DuanXinCheck", "params" : { "fPhoneNumber" : this.comp("phonenumber").val() }, "success" : function(resultData) { if (resultData.backStr) { numbers = resultData.backStr; } else { justep.Util.hint('验证码发送失败', { 'type' : 'danger' }); } } }); } else { justep.Util.hint('手机号码格式不正确!', { 'type' : 'danger' }); } };
Model.prototype.personStatusRequestLoad = function(action,date) { var self = this; /* * 查询团队考勤进度条 * 需传入参数 * 1.strDeptID -- 部门ID * 2.strDate -- 日期 * 3.ognID -- 组织ID * 4.ognName -- 组织名称 */ justep.Baas.sendRequest({ "url" : "/work/attendance", "action" : action, "async" : false, "params" : { "strDate":self.date, "strDeptID":self.deptID, "ognID":con.ognID, "ognName":con.ognName }, "success" : function(data) { self.comp("detailStatusDlgData").clear(); self.comp("detailStatusDlgData").loadData(data); } }); };
Model.prototype.div1Click = function(event) { if ($(".username").val() == "") { swal("用户名不能为空!", "请输入用户名!", "warning"); return; } if ($(".password").val() == "") { swal("密码不能为空!", "请输入密码!", "warning") return; } justep.Baas.sendRequest({ "url" : "/medicine/med_action", "action" : "queryPassword", "async" : false, "params" : { "username" : $(".username").val(), "password" : $(".password").val() }, "success" : function(data) { if (data.result == "fail") { swal("登陆失败!", "请检查您的登陆信息!", "error") } else { sessionStorage.setItem("key", data.result); window.location.href = "../medicine/frame.w" } } }); };
Model.prototype.mainDataCustomRefresh = function(event) { var fPersonID =con.personID; var append = event.options && event.options.append; var time= con.getSysDateStr("yyyy-MM-dd"); justep.Baas.sendRequest({ "url" : "/work/Sign", "action" : "querySignCountAction", "async" : false, "params" : {"strDate":time,"fPersonID":fPersonID}, "success" : function(data) { event.source.loadData(data, append); } }); };
Model.prototype.okBtnClick = function(event) { var self = this; var userPassword = this.comp("userPassword").val(); var passWordAgain = this.comp("passwordAgain").val(); var userName = this.comp("nameInput").val(); var phoneNumber = this.comp("phonenumber").val(); if (phoneNumber === '' || userName === '' || passWordAgain === '' || userPassword === '') { justep.Util.hint('请将信息填写完整!', { 'type' : 'danger' }); } else { var pId = justep.UUID.createUUID(); var reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9a-zA-Z]{8,16}$/; if (userPassword === passWordAgain) { if (reg.test(userPassword)) { if (numbers === this.comp("verifyCode").val()&&this.comp("verifyCode").val() != '') { justep.Baas.sendRequest({ "url" : "/work/org", "action" : "queryIsActivation", "async" : false, "params" : { "phone" : this.comp("phonenumber").val(), "name" : this.comp("nameInput").val(), "password" : md5.hex_md5_salt(userPassword), "uuid" : pId }, "success" : function(data) { justep.Util.hint(data.status); if (data.status === "注册成功!") { self.close(); } } }); } else { justep.Util.hint('验证码输入错误', { 'type' : 'danger' }); } } else { justep.Util.hint('密码格式错误', { 'type' : 'danger' }); } } else { justep.Util.hint('密码输入不一致', { 'type' : 'danger' }); } } };
var loginByWex5 = function(params) { var ret; var userParams = {}; userParams.CurrentPersonID = ""; userParams.CurrentPersonName = ""; userParams.CurrentPersonFID = ""; userParams.CurrentPersonFName = ""; userParams.CurrentOgnID = ""; userParams.CurrentOgnName = ""; userParams.CurrentDeptID = ""; userParams.CurrentDeptName = ""; userParams.CurrentDeptFID = ""; userParams.CurrentDeptFName = ""; userParams.CurrentOgnFID = ""; userParams.CurrentOgnFName = ""; userParams.CurrentFunRole = "3";// 默认为3:普通员工。(1:公司领导;2:部门主管;3:普通员工) justep.Baas.sendRequest({ "url" : "/org/login", "action" : "loginAction", "async" : false, "params" : { "userName" : params.username, "password" : params.password }, "success" : function(data) { ret = data; if (ret.flag) { userParams.CurrentPersonID = ret.personID; userParams.CurrentPersonName = ret.personName; userParams.CurrentPersonFID = ret.CurrentFID; userParams.CurrentPersonFName = ret.CurrentFName; userParams.CurrentOgnID = ret.CurrentOgnID; userParams.CurrentOgnName = ret.CurrentOgnName; userParams.CurrentFunRole = ret.CurrentFunRole; userParams.CurrentOgnFID = "/" + ret.CurrentFID.split("/")[1]; userParams.CurrentOgnFName = "/" + ret.CurrentFName.split("/")[1]; if (ret.CurrentFID.indexOf("dpt") > 0) { userParams.CurrentDeptID = ret.CurrentDeptID; userParams.CurrentDeptName = ret.CurrentDeptName; userParams.CurrentDeptFID = ret.CurrentFID.substring(0, ret.CurrentFID.indexOf("dpt") + 3); userParams.CurrentDeptFName = ret.CurrentFName.substring(0, ret.CurrentFName.indexOf("/", ret.CurrentFName.indexOf("/", 2) + 1)); } saveLoginDataToStore(userParams); } } }); return ret; };
getOrgPersons : function(pid) { if (!_orgPersons) { justep.Baas.sendRequest({ "url" : "/org/loadPerson", "action" : "loadPerson", "async" : true, "params" : { "sPersonID" : pid }, "success" : function(data) { _orgPersons = data.persons; orgPersonsDeferred.resolve(_orgPersons); } }); } return orgPersonsDeferred.promise(); },
Model.prototype.getDepts = function(event) { var deferred = $.Deferred(); justep.Baas.sendRequest({ "url" : "/org/loadPerson", "action" : "getDepts", "async" : false, "params" : { "sPersonID" : IM.getCurrentPerson().id }, "success" : function(data) { var depts = data.depts; depts = ChineseFirstPY(depts); deferred.resolve(depts); } }); return deferred.promise(); };
Model.prototype.loadPerson = function(event) { var deferred = $.Deferred(); justep.Baas.sendRequest({ "url" : "/org/loadPerson", "action" : "loadPerson", "async" : false, "params" : { "sPersonID" : IM.getCurrentPerson().id }, "success" : function(data) { var persons = data.persons; persons = ChineseFirstPY(persons); persons = addCheckRow(persons); deferred.resolve(persons); } }); return deferred.promise(); };
success : function(res) { var serverId = res.serverId; // 返回图片的服务器端ID justep.Baas.sendRequest({ "url" : "/weixin/weixin", "action" : "weixin", "async" : false, "params" : { "id" : serverId }, "success" : function(data) { var data = self.comp("informationdata"); data.newData({ "defaultValues" : [ { "id" : justep.UUID.createUUID(), "userid" : self._userID, "username" : self._userDefaultName, "state" : "0", "picture" : serverId, "number" : $(".block.n").html(), "consignee" : $("#name").val(), "telephone" : $("#telephone").val(), "area" : $("#province").val() + $("#city").val(), "address" : $("#address").val(), "remarks" : $("#attention").val(), "ordertime" : new Date() } ] }) data.saveData({ "onSuccess" : function() { swal({ title : "下单成功", text : "我们会在第一时间处理您的订单", type : "success", showCancelButton : false, closeOnConfirm : false }, function() { wx.closeWindow(); }); } }) } }); }
updatePersonUid : function(uid, pid) { var self = this; var deferred = $.Deferred(); justep.Baas.sendRequest({ "url" : "/org/updatePersonUid", "action" : "updatePersonUid", "async" : true, "params" : { "uid" : uid, "pid" : pid }, "success" : function(data) { if (data.state) { var person = self._getPerson(pid); if (person) { person.uid = uid; } } deferred.resolve(); } }); return deferred.promise(); },
Model.prototype.AttendanceOrgDialogReceive = function(event){ var self = this; this.joinPeopleID=[]; this.joinPeopleName=[]; var personArr = event.data.data; for(var i = 0 ; i<personArr.length ; i++){ this.joinPeopleName.push(personArr[i].sName); this.joinPeopleID.push(personArr[i].sPersonID); } var result; var id = this.joinPeopleID.join(","); justep.Baas.sendRequest({ "url" : "/work/attendance", "action" : "queryPerson", "async" : false, "params" : {"orgID":con.ognID, 'person': id, 'rowID':self.rowID.get() }, "success" : function(data) { result = data.rows; } }); var resultArr=[]; if (result.length > 0) { var message = ""; var adminData = this.comp("mainData"); result.length==1 && (message=result[0].fPersonName) ; result.length>1 && (message=result[0].fPersonName+"等"+result.length+"人"); this.comp("replaceDialog").show({ message : message + "已在别的考勤组,是否移到此考勤组", callback : function(o) { if (o.button == "ok") { var row,nameValue,IDvalue; for(var i=0;i<result.length;i++){ row = adminData.getRowByID(result[i].fID); nameValue =adminData.getValue("fAttendancePersonName", row); IDvalue = adminData.getValue("fAttendancePersonID", row); if(IDvalue.indexOf(result[i].fPersonID) != 0){ IDvalue=IDvalue.replace(","+result[i].fPersonID,""); adminData.setValue("fAttendancePersonID", IDvalue, row); nameValue=nameValue.replace(","+result[i].fPersonName,""); adminData.setValue("fAttendancePersonName", nameValue, row); }else{ IDvalue=IDvalue.replace(result[i].fPersonID+"," ,""); adminData.setValue("fAttendancePersonID", IDvalue, row); self.openID=IDvalue; nameValue=nameValue.replace(result[i].fPersonName+",",""); adminData.setValue("fAttendancePersonName", nameValue, row); } } }else if(o.button=="cancel"){ for(var i=0;i<result.length;i++){ var index =self.joinPeopleID.indexOf(result[i].fPersonID); if(index != -1){ self.joinPeopleID.splice(index,1); self.joinPeopleName.splice(index,1); self.comp("AttendancePerson").val(self.joinPeopleID.length + "人"); } } } } }); } this.comp("AttendancePerson").val(this.joinPeopleName.length+"人"); };
Model.prototype.success = function(event) { var self = this; if ($(".success").html() == "发送(提示内容)") { $(".totalmoney").html(0); if ($(".sendcontent textarea").val() == "") { swal("请输入提示内容", "", "warning") } else { justep.Baas.sendRequest({ "url" : "/weixin/weixin", "action" : "ts", "async" : false, "params" : { "id" : self._userid, "medprice" : 0, "transportprice" : 0, "doctors_recommend" : $(".sendcontent textarea").val() }, "success" : function(data) { data = self.comp("meddata"); data.setValue("state", "5") data.saveData({ "onSuccess" : function() { window.location.href = "../medicine/frame.w" } }) } }); } } else { if ($("#transportprice").val() != parseFloat($("#transportprice").val()) || $("#medprice").val() != parseFloat($("#medprice").val())) { swal("请输入正确的金额", "", "warning") } else { var data = self.comp("meddata"); justep.Baas.sendRequest({ "url" : "/weixin/weixin", "action" : "ts", "async" : false, "params" : { "id" : self._userid, "orderid" : data.getCurrentRow().val("id"), "medprice" : ($("#medprice").val() * $(".number").html()).toFixed(2), "transportprice" : $("#transportprice").val(), "doctors_recommend" : "" }, "success" : function(data) { data = self.comp("meddata"); data.setValue("state", "1") data.setValue("medprice", ($("#medprice").val() * $(".number").html()).toFixed(2)) data.setValue("transportprice", parseFloat($("#transportprice").val())) data.saveData({ "onSuccess" : function() { window.location.href = "../medicine/frame.w" } }) } }); } } }