| <template> | 
|   <GlobalWindow :title="param.id ? '编辑公司' : '新建公司'" :confirmWorking="subLoading" :visible.sync="isShowModal" | 
|     width="600px" @close="close" @confirm="handleSub"> | 
|     <el-form :model="param" ref="paramRef" :rules="rules"> | 
|       <el-form-item label="收支条目" prop="name"> | 
|         <el-input v-model="param.name" placeholder="请输入" v-trim /> | 
|       </el-form-item> | 
|       <el-form-item label="收款公司" prop="name"> | 
|         <el-select v-model="param.realName" filterable clearable> | 
|           <el-option value="0" label="xxx"></el-option> | 
|         </el-select> | 
|       </el-form-item> | 
|       <el-form-item label="收款类型" prop="name"> | 
|         <el-radio-group v-model="param.radio"> | 
|           <el-radio :label="0">对公</el-radio> | 
|           <el-radio :label="1">个人</el-radio> | 
|         </el-radio-group> | 
|       </el-form-item> | 
|       <el-form-item label="账户名称" prop="desc"> | 
|         <el-input v-model="param.desc" placeholder="请输入" v-trim /> | 
|       </el-form-item> | 
|       <el-form-item label="开户名称"> | 
|         <el-input v-model="param.code" placeholder="请输入" v-trim /> | 
|       </el-form-item> | 
|       <el-form-item label="银行账号"> | 
|         <el-input v-model="param.addr" placeholder="请输入" v-trim /> | 
|       </el-form-item> | 
|       <el-form-item label="状态" prop="code"> | 
|         <el-switch v-model="param.status" active-value="0" inactive-value="1"> | 
|         </el-switch> | 
|       </el-form-item> | 
|     </el-form> | 
|   </GlobalWindow> | 
| </template> | 
|   | 
| <script> | 
| import GlobalWindow from '@/components/common/GlobalWindow' | 
| import UploadAvatarImage from '@/components/common/UploadAvatarImage' | 
| import { create, updateById } from '@/api/business/company' | 
| import { Message } from 'element-ui' | 
| export default { | 
|   components: { GlobalWindow, UploadAvatarImage }, | 
|   data() { | 
|     return { | 
|       isShowModal: false, | 
|       subLoading: false, | 
|       param: { | 
|         type: 2, | 
|         status: '0' | 
|       }, | 
|       cateList: [], | 
|       rules: { | 
|         name: [{ required: true, message: '请输入' }], | 
|         desc: [{ required: true, message: '请输入' }] | 
|       }, | 
|   | 
|     } | 
|   }, | 
|   created() { | 
|   }, | 
|   methods: { | 
|     handleSub() { | 
|       const { param, subLoading } = this | 
|       this.$refs['paramRef'].validate((valid) => { | 
|         if (valid) { | 
|           let fn = param.id ? updateById : create | 
|           this.subLoading = true | 
|           fn(param).then(res => { | 
|             this.subLoading = false | 
|             this.$emit('success') | 
|             Message.success('保存成功') | 
|             this.close() | 
|           }).catch(() => { | 
|             this.subLoading = false | 
|           }) | 
|         } | 
|       }) | 
|     }, | 
|     changeSel(e) { | 
|       if (e && e.length == 1) { | 
|         this.$set(this.param, 'catePId', e[0]) | 
|         this.$set(this.param, 'cateId', '') | 
|       } else if (e && e.length == 2) { | 
|         this.$set(this.param, 'catePId', e[0]) | 
|         this.$set(this.param, 'cateId', e[1]) | 
|       } else { | 
|         this.$set(this.param, 'catePId', '') | 
|         this.$set(this.param, 'cateId', '') | 
|       } | 
|       this.search() | 
|     }, | 
|     uploadAvatarSuccess(file) { | 
|       this.$set(this.param, 'imgurl', file.imgurl) | 
|       this.$set(this.param, 'imgurlfull', file.imgurlfull) | 
|     }, | 
|     close() { | 
|       this.isShowModal = false | 
|       this.$emit('close') | 
|     } | 
|   } | 
| } | 
| </script> | 
|   | 
| <style lang="scss" scoped></style> |