| | |
| | | <script> |
| | | |
| | | import {addRecipient, addUser, updateRecipient, updateUser} from "@/api/user"; |
| | | |
| | | import {verifySimplePhone} from "@/util/validate"; |
| | | export default { |
| | | name: 'userMod', |
| | | props: [], |
| | | data () { |
| | | let validatePhone = (rule, value, callback)=>{ |
| | | if(value === ''){ |
| | | callback(new Error('请输入手机号')) |
| | | }else{ |
| | | if(!verifySimplePhone(value)){ |
| | | callback(new Error('手机号格式有误')) |
| | | }else{ |
| | | callback() |
| | | } |
| | | } |
| | | } |
| | | return { |
| | | title: '新增用户', |
| | | visible: false, |
| | |
| | | rules: { |
| | | recipientName: [{ required: true, message: '请输入姓名或称呼', trigger: 'blur'}], |
| | | company: [{ required: true, message: '请输入单位名称(备注)', trigger: 'blur'}], |
| | | phone: [{ required: true, message: '请输入手机号', trigger: 'blur'}] |
| | | phone: [{ required: true, validator: validatePhone, trigger: 'blur'}] |
| | | } |
| | | } |
| | | }, |
| | |
| | | if (valid) { |
| | | if(this.title == '新增用户'){ |
| | | const { id,...data } = this.form |
| | | console.log(data,'data') |
| | | addRecipient(data).then((res)=>{ |
| | | if(res.data.code == 100){ |
| | | this.$message.success('新增平级接收人成功') |
| | |
| | | t.form.districtId = value |
| | | const code = t.findCodeById(t.areaData,value).code |
| | | if(code.length == 2){ |
| | | t.form.company = '自治区自然灾害预警中心' |
| | | t.form.company = '自治区自然灾害综合监测预警中心' |
| | | // t.form.province = t.findNodeByCode(t.areaData,code).name |
| | | // t.form.city = '' |
| | | // t.form.area = '' |