|  |  | 
 |  |  |           <el-button type="primary" style="flex-shrink: 0; margin-left: 15px;" v-else>{{num}}s</el-button> | 
 |  |  |         </div> | 
 |  |  |       </el-form-item> | 
 |  |  |       <el-form-item label="部门" prop="departmentId"> | 
 |  |  |         <el-cascader | 
 |  |  |           :options="organization" | 
 |  |  |           v-model="form.departmentId" | 
 |  |  |           placeholder="请选择" | 
 |  |  |           :props="{ label: 'name', value: 'id', checkStrictly: true }" | 
 |  |  |           clearable /> | 
 |  |  |       </el-form-item> | 
 |  |  |       <el-form-item label="抄送文件邮箱" prop="email"> | 
 |  |  |         <el-input v-model="form.email" placeholder="请输入" v-trim /> | 
 |  |  |       </el-form-item> | 
 |  |  | 
 |  |  | import PositionSelect from '@/components/common/PositionSelect' | 
 |  |  | import { checkMobile, checkEmail } from '@/utils/form' | 
 |  |  | import { sendSms } from '@/api/business/smsEmail' | 
 |  |  |  | 
 |  |  | import { tree } from '@/api/business/companyDepartment' | 
 |  |  | export default { | 
 |  |  |   name: 'OperaUserWindow', | 
 |  |  |   extends: BaseOpera, | 
 |  |  | 
 |  |  |         realname: '', // 姓名 | 
 |  |  |         mobile: '', // 手机号码 | 
 |  |  |         email: '', | 
 |  |  |         captcha: '' | 
 |  |  |         captcha: '', | 
 |  |  |         departmentId: '' | 
 |  |  |       }, | 
 |  |  |       num: 0, | 
 |  |  |       timer: null, | 
 |  |  |       organization: [], | 
 |  |  |       // 验证规则 | 
 |  |  |       rules: { | 
 |  |  |         username: [ | 
 |  |  | 
 |  |  |         mobile: [ | 
 |  |  |           { required: true, validator: checkMobile } | 
 |  |  |         ], | 
 |  |  |         departmentId: [ | 
 |  |  |           { required: true, message: '请选择部门' } | 
 |  |  |         ], | 
 |  |  |         email: [ | 
 |  |  |           { required: true, message: '请输入邮箱' } | 
 |  |  |         ] | 
 |  |  | 
 |  |  |     } | 
 |  |  |   }, | 
 |  |  |   methods: { | 
 |  |  |     __confirmCreate () { | 
 |  |  |       this.$refs.form.validate((valid) => { | 
 |  |  |         if (!valid) { | 
 |  |  |           return | 
 |  |  |         } | 
 |  |  |         let obj = JSON.parse(JSON.stringify(this.form)) | 
 |  |  |         obj.departmentId = obj.departmentId[0] | 
 |  |  |         // 调用新建接口 | 
 |  |  |         this.isWorking = true | 
 |  |  |         this.api.create(obj) | 
 |  |  |           .then(() => { | 
 |  |  |             this.visible = false | 
 |  |  |             this.$tip.apiSuccess('新建成功') | 
 |  |  |             this.$emit('success') | 
 |  |  |           }) | 
 |  |  |           .catch(e => { | 
 |  |  |             this.$tip.apiFailed(e) | 
 |  |  |           }) | 
 |  |  |           .finally(() => { | 
 |  |  |             this.isWorking = false | 
 |  |  |           }) | 
 |  |  |       }) | 
 |  |  |     }, | 
 |  |  |     __confirmEdit () { | 
 |  |  |       this.$refs.form.validate((valid) => { | 
 |  |  |         if (!valid) { | 
 |  |  |           return | 
 |  |  |         } | 
 |  |  |         let obj = JSON.parse(JSON.stringify(this.form)) | 
 |  |  |         obj.departmentId = obj.departmentId[0] | 
 |  |  |         // 调用新建接口 | 
 |  |  |         this.isWorking = true | 
 |  |  |         this.api.updateById(obj) | 
 |  |  |           .then(() => { | 
 |  |  |             this.visible = false | 
 |  |  |             this.$tip.apiSuccess('修改成功') | 
 |  |  |             this.$emit('success') | 
 |  |  |           }) | 
 |  |  |           .catch(e => { | 
 |  |  |             this.$tip.apiFailed(e) | 
 |  |  |           }) | 
 |  |  |           .finally(() => { | 
 |  |  |             this.isWorking = false | 
 |  |  |           }) | 
 |  |  |       }) | 
 |  |  |     }, | 
 |  |  |     send() { | 
 |  |  |       if (!this.form.mobile) { | 
 |  |  |         this.$message.warning('请输入手机号') | 
 |  |  | 
 |  |  |         .then(res => { | 
 |  |  |           this.num = 60 | 
 |  |  |           this.setTime() | 
 |  |  |         }) | 
 |  |  |     }, | 
 |  |  |     getTree() { | 
 |  |  |       tree() | 
 |  |  |         .then(records => { | 
 |  |  |           this.organization = records | 
 |  |  |         }) | 
 |  |  |     }, | 
 |  |  |     setTime() { | 
 |  |  | 
 |  |  |     open (title, target) { | 
 |  |  |       this.title = title | 
 |  |  |       this.visible = true | 
 |  |  |       this.getTree() | 
 |  |  |       clearInterval(this.timer) | 
 |  |  |       this.num = 0 | 
 |  |  |       // 新建 | 
 |  |  | 
 |  |  |         this.$nextTick(() => { | 
 |  |  |           this.$refs.form.resetFields() | 
 |  |  |           this.form.id = null | 
 |  |  |           this.form.departmentId = null | 
 |  |  |           this.form.positionIds = [] | 
 |  |  |           // this.form.departmentId = null | 
 |  |  |           // this.form.positionIds = [] | 
 |  |  |         }) | 
 |  |  |         return | 
 |  |  |       } | 
 |  |  | 
 |  |  |         for (const key in this.form) { | 
 |  |  |           this.form[key] = target[key] | 
 |  |  |         } | 
 |  |  |         this.form.departmentId = target.department == null ? null : target.department.id | 
 |  |  |         this.form.positionIds = target.positions == null ? [] : target.positions.map(p => p.id) | 
 |  |  |         // this.form.departmentId = target.department == null ? null : target.department.id | 
 |  |  |         // this.form.positionIds = target.positions == null ? [] : target.positions.map(p => p.id) | 
 |  |  |       }) | 
 |  |  |     } | 
 |  |  |   }, |