| | |
| | | > |
| | | </a-tree-select> |
| | | </a-form-model-item> |
| | | <a-form-model-item label="选择分组" prop="peerRecipientGroupId"> |
| | | <a-select v-model="form.peerRecipientGroupId" style="width: 100%"> |
| | | <a-select-option v-for="(item,index) in groupData" :value="item.id" :key="index">{{item.name}}</a-select-option> |
| | | </a-select> |
| | | </a-form-model-item> |
| | | </a-form-model> |
| | | </a-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import {addRecipient, addUser, updateRecipient, updateUser} from "@/api/user"; |
| | | |
| | | import {addRecipient, addUser, getSameLevelGroupList, 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, |
| | |
| | | labelCol: { span: 4 }, |
| | | wrapperCol: { span: 14 }, |
| | | areaData: [], |
| | | groupData: [], |
| | | replaceFields: { |
| | | children:'children', |
| | | title:'name', |
| | |
| | | company: '', |
| | | phone: '', |
| | | unittype: null, |
| | | districtId: null |
| | | districtId: null, |
| | | peerRecipientGroupId: '' |
| | | }, |
| | | 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'}], |
| | | } |
| | | } |
| | | }, |
| | |
| | | const t = this |
| | | }, |
| | | methods:{ |
| | | openDialog(type,data){ |
| | | openDialog(type,data,group){ |
| | | const t = this |
| | | group.forEach(item => { |
| | | if(item.name === '未分类'){ |
| | | item.id = '' |
| | | } |
| | | }) |
| | | t.groupData = group |
| | | console.log(t.groupData,'data222') |
| | | if(type == 'add'){ |
| | | t.title = '新增用户' |
| | | t.form = { |
| | |
| | | company: '', |
| | | phone: '', |
| | | unittype: null, |
| | | districtId: null |
| | | districtId: null, |
| | | peerRecipientGroupId: '' |
| | | } |
| | | }else{ |
| | | t.title = '编辑用户' |
| | |
| | | t.form[i] = data[i] |
| | | } |
| | | } |
| | | t.form.peerRecipientGroupId = data.peerRecipientGroupId ? data.peerRecipientGroupId: '' |
| | | } |
| | | t.visible = true |
| | | }, |
| | |
| | | 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 = '' |