baichengfei 4 anos atrás
pai
commit
eda1822032

+ 56 - 41
src/dashoo.cn/backend/api/controllers/register/oilcorporateinfo.go

@@ -764,61 +764,76 @@ func (this *OilCorporateInfoController) GetCode() {
 	svcRegister := register.GetOilCorporateInfoService(utils.DBE)
 	var errinfo ErrorDataInfo
 	//得到用户名参数
-	userName := this.GetString("userName")
-	mobile := this.GetString("mobile")
-	//查出用户名的id
-	var sPerson userRole.Base_User
-	svcRegister.GetEntity(&sPerson, "UserName='"+userName+"'")
-	if sPerson.Username == "" {
-		errinfo.Message = "无此用户名"
+	userName := strings.Trim(this.GetString("userName"), " ")
+	mobile := strings.Trim(this.GetString("mobile"), " ")
+
+	var registerEntity register.OilCorporateInfo
+	svcRegister.GetEntity(registerEntity, "UserName='"+userName+"'")
+	if userName == "" || registerEntity.UserName == "" {
+		errinfo.Message = "用户名不存在,请重新确认!"
 		errinfo.Code = -1
 		this.Data["json"] = &errinfo
 		this.ServeJSON()
 	} else {
-		var entity supplier.OilSupplier
-		svcRegister.GetEntity(&entity, "SupplierName='"+sPerson.Realname+"'")
-		if entity.Id == 0 {
-			if mobile != sPerson.Telephone {
-				errinfo.Message = "请输入联系人手机号!"
+		if registerEntity.CheckStatus == -1 {
+			errinfo.Message = "该用户名注册审批未通过!请重新注册后再试!"
+			errinfo.Code = -1
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+		} else if registerEntity.CheckStatus == 0 {
+			errinfo.Message = "该用户名正在注册审批中,请稍后再试!"
+			errinfo.Code = -1
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+		} else if registerEntity.CheckStatus == 11 {
+			var userInfo userRole.Base_User
+			svcRegister.GetEntity(&userInfo, "Id='"+strconv.Itoa(registerEntity.UserId)+"'")
+			if userInfo.Id <= 0 || userName != userInfo.Username {
+				errinfo.Message = "用户不存在,请重新确认!"
 				errinfo.Code = -1
 				this.Data["json"] = &errinfo
 				this.ServeJSON()
-				return
 			}
-		} else {
-			if mobile != entity.Mobile {
-				errinfo.Message = "请输入联系人手机号!"
+			if mobile == "" || mobile != registerEntity.UserTelephone {
+				errinfo.Message = "您输入的联系人手机号不存在,请重新确认!"
 				errinfo.Code = -1
 				this.Data["json"] = &errinfo
 				this.ServeJSON()
 				return
-			}
-		}
-
-		//生成一个随机数
-		randomNumber := fmt.Sprintf("%06v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(1000000))
-		//将数据存入
-		err2 := svcRegister.DeleteEntityBytbl("Base_VCode", "UserName='"+userName+"'")
-		if err2 == nil {
-			var model oilrtx.Base_VCode
-			model.UserName = userName
-			model.UserId = strconv.Itoa(sPerson.Id)
-			model.Code = randomNumber
-			_, err := svcRegister.InsertEntityBytbl("Base_VCode", &model)
-			if err == nil {
-				//发短信
-				//编辑短信内容
-				msg := "验证码为: " + randomNumber + ",5分钟内有效"
-				//调用短信接口发送短信
-				msgService := msg2.GetMsgService(utils.DBE)
-				error := msgService.HandleMsg(mobile, msg, "2-1", userName, sPerson.Realname, strconv.Itoa(sPerson.Id), this.User.Username)
-				if error == nil {
-					errinfo.Message = "请等待接收验证码,5分钟内有效"
-					errinfo.Code = 0
-					this.Data["json"] = &errinfo
-					this.ServeJSON()
+			} else {
+				//生成一个随机数
+				randomNumber := fmt.Sprintf("%06v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(1000000))
+				//将数据存入
+				err2 := svcRegister.DeleteEntityBytbl("Base_VCode", "UserName='"+userName+"'")
+				if err2 == nil {
+					var model oilrtx.Base_VCode
+					model.UserName = userName
+					model.UserId = strconv.Itoa(registerEntity.UserId)
+					model.Code = randomNumber
+					_, err := svcRegister.InsertEntityBytbl("Base_VCode", &model)
+					if err == nil {
+						//发短信
+						//编辑短信内容
+						msg := "验证码为: " + randomNumber + ",5分钟内有效"
+						//调用短信接口发送短信
+						msgService := msg2.GetMsgService(utils.DBE)
+						// 企业名称暂时以注册表为准
+						errorMsg := msgService.HandleMsg(mobile, msg, "2-1", userName, registerEntity.SupplierName, strconv.Itoa(registerEntity.UserId), this.User.Username)
+						if errorMsg == nil {
+							errinfo.Message = "请等待接收验证码,5分钟内有效"
+							errinfo.Code = 0
+							this.Data["json"] = &errinfo
+							this.ServeJSON()
+						}
+					}
 				}
 			}
+		} else {
+			errinfo.Message = "用户状态错误,请联系系统管理员!"
+			errinfo.Code = -1
+			this.Data["json"] = &errinfo
+			this.ServeJSON()
+			return
 		}
 	}
 }

+ 1 - 1
src/dashoo.cn/frontend_web/src/components/samples/cellscollectiondialog.vue

@@ -179,7 +179,7 @@
             })
           })
       },
-      beforeAvatarUpload(file) {
+      beforeAvatarUpload (file) {
         let isLt50m = file.size / 1024 / 1024 / 50 < 1
         if (!isLt50m) {
           this.$message.error('上传文件大小不能超过 50MB!')

+ 1 - 1
src/dashoo.cn/frontend_web/src/components/samples/protocoldialog.vue

@@ -141,7 +141,7 @@
             })
           })
       },
-      beforeAvatarUpload(file) {
+      beforeAvatarUpload (file) {
         let isLt50m = file.size / 1024 / 1024 / 50 < 1
         if (!isLt50m) {
           this.$message.error('上传文件大小不能超过 50MB!')

+ 1 - 1
src/dashoo.cn/frontend_web/src/components/samples/uploadattachdialog.vue

@@ -173,7 +173,7 @@
             })
           })
       },
-      beforeAvatarUpload(file) {
+      beforeAvatarUpload (file) {
         let isLt50m = file.size / 1024 / 1024 / 50 < 1
         if (!isLt50m) {
           this.$message.error('上传打印模板大小不能超过 50MB!')

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/documentmanage/_opera/uploadnewdoc.vue

@@ -335,7 +335,7 @@
             console.log(error)
           })
       },
-      beforeAvatarUpload(file) {
+      beforeAvatarUpload (file) {
         let isLt50m = file.size / 1024 / 1024 / 50 < 1
         if (!isLt50m) {
           this.$message.error('上传文件大小不能超过 50MB!')

+ 2 - 2
src/dashoo.cn/frontend_web/src/pages/oilsupplier/qualchange/_opera/auditoperation.vue

@@ -398,7 +398,7 @@
         }
       },
 
-      beforeAvatarUpload(file) {
+      beforeAvatarUpload (file) {
         let isLt50m = file.size / 1024 / 1024 / 50 < 1
         if (!isLt50m) {
           this.$message.error('上传文件大小不能超过 50MB!')
@@ -406,7 +406,7 @@
         }
         return true
       },
-      uploadrequest(option) {
+      uploadrequest (option) {
         let _this = this
         axios.post(process.env.upfilehost, {})
           .then(function (res) {

+ 2 - 2
src/dashoo.cn/frontend_web/src/pages/setting/equipmentmodel/_opera/operation.vue

@@ -346,11 +346,11 @@
             })
           })
       },
-      handleAvatarSuccess(res, file) {
+      handleAvatarSuccess (res, file) {
         this.formmodel.Photo = `${this.uploadimg.url}/${this.uploadimg.fid}`
         this.imageUrl = URL.createObjectURL(file.raw)
       },
-      beforeAvatarUpload(file) {
+      beforeAvatarUpload (file) {
         const isJPG = (file.type.indexOf('image/') === 0)
         const isLt2M = file.size / 1024 / 1024 < 1
         if (!isJPG) {

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/setting/materialstorehouse/_opera/edit.vue

@@ -316,7 +316,7 @@
             })
           })
       },
-      handleAvatarSuccess(res, file) {
+      handleAvatarSuccess (res, file) {
         this.formmodel.Photo = `${this.uploadimg.url}/${this.uploadimg.fid}`
         this.imageUrl = URL.createObjectURL(file.raw)
       },

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/setting/materialstorehouse/add.vue

@@ -271,7 +271,7 @@
         this.formmodel.Photo = `${this.uploadimg.url}/${this.uploadimg.fid}`
         this.imageUrl = URL.createObjectURL(file.raw)
       },
-      beforeAvatarUpload(file) {
+      beforeAvatarUpload (file) {
         const isJPG = (file.type.indexOf('image/') === 0)
         const isLt2M = file.size / 1024 / 1024 < 1
         if (!isJPG) {

+ 90 - 90
src/dashoo.cn/frontend_web/src/pages/setting/sampletype/_opera/sampletypeedit.vue

@@ -91,193 +91,193 @@
 </template>
 <script>
 export default {
-  name: "sampletypeedit",
-  data() {
+  name: 'sampletypeedit',
+  data () {
     return {
-      imghost: "",
+      imghost: '',
       rulessampletypeinfo: {
-        Code: [{ required: true, message: "请输入编码", trigger: "blur" }],
-        Name: [{ required: true, message: "请输入姓名", trigger: "blur" }]
+        Code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
+        Name: [{ required: true, message: '请输入姓名', trigger: 'blur' }]
       },
       validityhours: 0,
       currentItemCount: 0,
       currentPage: 1,
       size: 10,
       list: [],
-      keyword: "",
+      keyword: '',
       dialogFormVisible: false,
-      dialogtitle: "",
+      dialogtitle: '',
       operatingitem: 0,
       isIndeterminate: true,
       selectdevices: [],
       showquerydiv: false,
       systemqiguanimglist: [],
-      imgtype: "0",
+      imgtype: '0',
       selectsametyped: 0,
-      imageUrl: "",
+      imageUrl: '',
       SampleTypeForm: {
-        Name: "",
-        Code: "",
-        DefaultCapacity: "",
-        Unit: "",
+        Name: '',
+        Code: '',
+        DefaultCapacity: '',
+        Unit: '',
         ValidityHours: 0,
         Timelong: false,
         id: 0,
-        Remark: "",
+        Remark: '',
         Sensors: [],
-        Photo: "",
+        Photo: '',
         PhotoType: 0,
-        SubpackageCapacity: "", // 分装容量
+        SubpackageCapacity: '', // 分装容量
         SubpackageNum: 1
       },
       sampeunitlist: [] // 样本单位
-    };
+    }
   },
-  created() {
-    this.imghost = process.env.imgserverhost;
-    let pid = this.$route.params.opera;
+  created () {
+    this.imghost = process.env.imgserverhost
+    let pid = this.$route.params.opera
     // initial data
-    this.initData(pid);
+    this.initData(pid)
     // 加载单位
-    this.getsampetypeunit();
+    this.getsampetypeunit()
   },
   methods: {
-    initData(pid) {
-      let _this = this;
+    initData (pid) {
+      let _this = this
       // get 图片
       this.$axios
-        .get("sampletype/imglist", { _currentPage: -1 })
+        .get('sampletype/imglist', { _currentPage: -1 })
         .then(res => {
-          this.systemqiguanimglist = res.data;
+          this.systemqiguanimglist = res.data
         })
-        .catch(() => {});
+        .catch(() => {})
       this.$axios
-        .get("sampletype/getmodel/" + pid, {})
+        .get('sampletype/getmodel/' + pid, {})
         .then(res => {
           // response
-          this.SampleTypeForm = res.data;
+          this.SampleTypeForm = res.data
           // 有效期处理
           if (this.SampleTypeForm.ValidityHours === -100) {
-            this.SampleTypeForm.Timelong = true;
+            this.SampleTypeForm.Timelong = true
           }
           // 选中图片
-          _this.imgtype = _this.SampleTypeForm.PhotoType + "";
+          _this.imgtype = _this.SampleTypeForm.PhotoType + ''
           if (_this.SampleTypeForm.PhotoType === 1) {
-            _this.imageUrl = _this.imghost + _this.SampleTypeForm.Photo;
+            _this.imageUrl = _this.imghost + _this.SampleTypeForm.Photo
           } else {
             for (var i = 0; i < _this.systemqiguanimglist.length; i++) {
               if (
                 _this.systemqiguanimglist[i].ImgAddr ===
                 _this.SampleTypeForm.Photo
               ) {
-                _this.selectsametyped = _this.systemqiguanimglist[i].Id;
-                break;
+                _this.selectsametyped = _this.systemqiguanimglist[i].Id
+                break
               }
             }
           }
         })
         .catch(err => {
           // handle error
-          console.error(err);
-        });
+          console.error(err)
+        })
     },
-    getsampetypeunit() {
+    getsampetypeunit () {
       // 获取样本单位
-      let _this = this;
-      _this.$axios.get("sampletype/sunitajax", {}).then(res => {
-        _this.sampeunitlist = res.data;
-      });
+      let _this = this
+      _this.$axios.get('sampletype/sunitajax', {}).then(res => {
+        _this.sampeunitlist = res.data
+      })
     },
-    handleAvatarSuccess(res, file) {
-      this.SampleTypeForm.Photo = res;
-      this.imageUrl = URL.createObjectURL(file.raw);
+    handleAvatarSuccess (res, file) {
+      this.SampleTypeForm.Photo = res
+      this.imageUrl = URL.createObjectURL(file.raw)
     },
-    beforeAvatarUpload(file) {
-      const isimg = file.type.indexOf("image/") === 0;
-      const isLt50k = file.size / 1024 / 50 < 1;
+    beforeAvatarUpload (file) {
+      const isimg = file.type.indexOf('image/') === 0
+      const isLt50k = file.size / 1024 / 50 < 1
       if (!isimg) {
-        this.$message.error("上传图片只能是 图片 格式!");
-        return false;
+        this.$message.error('上传图片只能是 图片 格式!')
+        return false
       }
       if (!isLt50k) {
-        this.$message.error("上传图片大小不能超过 50kb!");
-        return false;
+        this.$message.error('上传图片大小不能超过 50kb!')
+        return false
       }
-      return true;
+      return true
     },
-    selectsampletype(v, imgpath) {
+    selectsampletype (v, imgpath) {
       if (v === this.selectsametyped) {
-        this.selectsametyped = 0;
-        this.SampleTypeForm.Photo = "";
+        this.selectsametyped = 0
+        this.SampleTypeForm.Photo = ''
       } else {
-        this.selectsametyped = v;
-        this.SampleTypeForm.Photo = imgpath;
+        this.selectsametyped = v
+        this.SampleTypeForm.Photo = imgpath
       }
     },
-    resetForm(formName) {
-      this.$refs[formName].resetFields();
+    resetForm (formName) {
+      this.$refs[formName].resetFields()
     },
-    savedata(formName) {
-      let _this = this;
+    savedata (formName) {
+      let _this = this
       this.$refs[formName].validate(valid => {
         if (valid) {
-          if (_this.SampleTypeForm.Photo === "") {
+          if (_this.SampleTypeForm.Photo === '') {
             _this.$message({
-              type: "warning",
-              message: "请选择样本图片!"
-            });
-            return;
+              type: 'warning',
+              message: '请选择样本图片!'
+            })
+            return
           }
-          this.SampleTypeForm.id = this.$route.params.opera;
-          _this.SampleTypeForm.PhotoType = parseInt(_this.imgtype);
+          this.SampleTypeForm.id = this.$route.params.opera
+          _this.SampleTypeForm.PhotoType = parseInt(_this.imgtype)
           _this.SampleTypeForm.DefaultCapacity = parseFloat(
             _this.SampleTypeForm.DefaultCapacity
-          );
+          )
           _this.SampleTypeForm.SubpackageCapacity = parseFloat(
             _this.SampleTypeForm.SubpackageCapacity
-          );
+          )
           _this.$axios
-            .put("sampletype/" + _this.SampleTypeForm.id, _this.SampleTypeForm)
+            .put('sampletype/' + _this.SampleTypeForm.id, _this.SampleTypeForm)
             .then(res => {
               // response
               if (res.data.code === 0) {
                 _this.$message({
-                  type: "success",
+                  type: 'success',
                   message: res.data.message
-                });
+                })
                 // 返回
-                window.history.go(-1);
+                window.history.go(-1)
               } else {
                 _this.$message({
-                  type: "warning",
+                  type: 'warning',
                   message: res.data.message
-                });
+                })
               }
             })
-            .catch(() => {});
+            .catch(() => {})
         } else {
-          return false;
+          return false
         }
-      });
+      })
     },
-    handleCheckedCitiesChange(value) {
-      let checkedCount = value.length;
-      this.checkAll = checkedCount === this.cities.length;
+    handleCheckedCitiesChange (value) {
+      let checkedCount = value.length
+      this.checkAll = checkedCount === this.cities.length
       this.isIndeterminate =
-        checkedCount > 0 && checkedCount < this.cities.length;
+        checkedCount > 0 && checkedCount < this.cities.length
     },
-    handleCheckAllChange(val) {
-      let _this = this;
-      _this.selectdevices = [];
+    handleCheckAllChange (val) {
+      let _this = this
+      _this.selectdevices = []
       if (val) {
         _this.devicelist.forEach((item, k) => {
-          _this.selectdevices.push(item.Id);
-        });
+          _this.selectdevices.push(item.Id)
+        })
       }
-      this.isIndeterminate = false;
+      this.isIndeterminate = false
     }
   }
-};
+}
 </script>
 
 <style>

+ 12 - 12
src/dashoo.cn/frontend_web/src/pages/system/businessusers.vue

@@ -291,25 +291,25 @@
             console.error(err)
           })
       },
-      handleAvatarSuccess(res, file) {
+      handleAvatarSuccess (res, file) {
         this.userform.sign = res
-        this.imageUrl = URL.createObjectURL(file.raw);
+        this.imageUrl = URL.createObjectURL(file.raw)
       },
-      beforeAvatarUpload(file) {
-        console.log(file);
-        const isimg = file.type.indexOf("image/") === 0;
-        const isLt50k = file.size / 1024 / 50 < 1;
+      beforeAvatarUpload (file) {
+        console.log(file)
+        const isimg = file.type.indexOf('image/') === 0
+        const isLt50k = file.size / 1024 / 50 < 1
         if (!isimg) {
-          this.$message.error("上传图片只能是 图片 格式!");
-          return false;
+          this.$message.error('上传图片只能是 图片 格式!')
+          return false
         }
         if (!isLt50k) {
-          this.$message.error("上传图片大小不能超过 50kb!");
-          return false;
+          this.$message.error('上传图片大小不能超过 50kb!')
+          return false
         }
-        return true;
+        return true
       },
-      roleset(val) {
+      roleset (val) {
         this.rolesettitle = '用户(' + val.Realname + ')-角色管理'
         this.rolesetVisible = true
         this.selecteduserid = val.Id + ''

+ 3 - 3
src/dashoo.cn/frontend_web/src/pages/system/usersetting.vue

@@ -144,11 +144,11 @@
       }
     },
     methods: {
-      handleAvatarSuccess(res, file) {
+      handleAvatarSuccess (res, file) {
         this.form.Photo = res
         this.imageUrl = URL.createObjectURL(file.raw)
       },
-      beforeAvatarUpload(file) {
+      beforeAvatarUpload (file) {
         const isJPG = (file.type.indexOf('image/') === 0)
         const isLt2M = file.size / 1024 / 1024 < 1
         if (!isJPG) {
@@ -161,7 +161,7 @@
         }
         return true
       },
-      savedata(formName) {
+      savedata (formName) {
         let _this = this
         this.$refs[formName].validate((valid) => {
           if (valid) {