|
@@ -76,11 +76,13 @@
|
|
|
|
|
|
<script>
|
|
|
import { listONLINE, getONLINE, delONLINE, addONLINE, updateONLINE } from '@/api/portal/ONLINE/ONLINE';
|
|
|
+import { validEmail } from "@/utils/validate.js"
|
|
|
|
|
|
export default {
|
|
|
name: 'ONLINE',
|
|
|
data() {
|
|
|
return {
|
|
|
+ validEmail,
|
|
|
// 根路径
|
|
|
baseURL: process.env.VUE_APP_BASE_API,
|
|
|
// 遮罩层
|
|
@@ -123,11 +125,15 @@ export default {
|
|
|
rules: {
|
|
|
id: [{ required: true, message: '主键不能为空', trigger: 'blur' }],
|
|
|
delFlag: [{ required: true, message: '删除标志不能为空', trigger: 'blur' }],
|
|
|
- deptId: [{ required: true, message: '部门id不能为空', trigger: 'blur' }],
|
|
|
+ deptId: [{ required: true, message: '单位编码不能为空', trigger: 'blur' },
|
|
|
+ { pattern: /^[1-9a-zA-Z]{1,}$/, message: '单位编码只能输入数字和字母', trigger: 'blur' }
|
|
|
+ ],
|
|
|
depName: [{ required: true, message: '单位名称不能为空', trigger: 'blur' }],
|
|
|
- telphone: [{ required: true, message: '单位电话不能为空', trigger: 'blur' }],
|
|
|
+ telphone: [{ required: true, message: '单位电话不能为空', trigger: 'blur' },
|
|
|
+ {validator: this.validateMobile, trigger: "blur"}],
|
|
|
location: [{ required: true, message: '单位地址不能为空', trigger: 'blur' }],
|
|
|
- email: [{ required: true, message: '单位邮箱不能为空', trigger: 'blur' }],
|
|
|
+ email: [{ required: true, message: '单位邮箱不能为空', trigger: 'blur' },
|
|
|
+ { validator: this.validEmailFun, trigger: 'blur' }],
|
|
|
introduction:[{ required: true, message: '简介不能为空', trigger: 'blur' }]
|
|
|
}
|
|
|
};
|
|
@@ -136,6 +142,28 @@ export default {
|
|
|
this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ validEmailFun(rule, value, callback) {
|
|
|
+ if(this.validEmail(value)) {
|
|
|
+ callback()
|
|
|
+ }else {
|
|
|
+ callback(new Error('邮件格式不正确!'));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ validateMobile(rule, value, callback) {
|
|
|
+ let reg1 = /^1[3|4|5|7|8][0-9]\d{8}$/;//11位手机号
|
|
|
+ let reg2 = /^(\d{3,4}-)?\d{6,8}$/;//座机和传真格式是一样的:区号-号码
|
|
|
+ console.log(!reg1.test(value) , !reg2.test(value));
|
|
|
+ if(!value && value!=='0'){
|
|
|
+ callback()
|
|
|
+ }else{
|
|
|
+ if (reg1.test(value) || reg2.test(value)) {
|
|
|
+ callback()
|
|
|
+ } else {
|
|
|
+ callback(new Error('请输入正确手机号!'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
/** 查询网上办事列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|