| | |
| | | > |
| | | </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 in groupData" :value="item.id" :key="item.id">{{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', |
| | |
| | | labelCol: { span: 4 }, |
| | | wrapperCol: { span: 14 }, |
| | | areaData: [], |
| | | groupData: [ |
| | | { |
| | | id: '', |
| | | name: '未分类' |
| | | } |
| | | ], |
| | | replaceFields: { |
| | | children:'children', |
| | | title:'name', |
| | |
| | | company: '', |
| | | phone: '', |
| | | unittype: null, |
| | | districtId: null |
| | | districtId: null, |
| | | peerRecipientGroupId: null |
| | | }, |
| | | rules: { |
| | | recipientName: [{ required: true, message: '请输入姓名或称呼', trigger: 'blur'}], |
| | | company: [{ required: true, message: '请输入单位名称(备注)', trigger: 'blur'}], |
| | | phone: [{ required: true, validator: validatePhone, trigger: 'blur'}] |
| | | phone: [{ required: true, validator: validatePhone, trigger: 'blur'}], |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | const t = this |
| | | t.getGroupList(); |
| | | }, |
| | | methods:{ |
| | | openDialog(type,data){ |
| | |
| | | company: '', |
| | | phone: '', |
| | | unittype: null, |
| | | districtId: null |
| | | districtId: null, |
| | | peerRecipientGroupId: null |
| | | } |
| | | }else{ |
| | | t.title = '编辑用户' |
| | |
| | | t.form[i] = data[i] |
| | | } |
| | | } |
| | | t.form.peerRecipientGroupId = data.peerRecipientGroupId ? data.peerRecipientGroupId: '' |
| | | } |
| | | t.visible = true |
| | | }, |
| | |
| | | isValidKey(key, object){ |
| | | return key in object; |
| | | }, |
| | | |
| | | async getGroupList () { |
| | | const t = this |
| | | const res = await getSameLevelGroupList(); |
| | | if(res.data.code == 100){ |
| | | t.groupData = t.groupData.concat(res.data.data) |
| | | }else{ |
| | | this.$message.error(res.data.msg) |
| | | } |
| | | }, |
| | | clearMod(){ |
| | | this.$refs.ruleForm.clearValidate() |
| | | this.$refs.ruleForm.resetFields() |