| | |
| | | <br> |
| | | </div> |
| | | <el-dialog :title="title" :visible.sync="unitFormVisible" :modal-append-to-body="false" :close-on-click-modal="false" width="40%"> |
| | | <el-form ref="dataForm" :rules="unitFormRules" :model="unitForm" label-position="right" label-width="100px" style="margin-left:50px;width:500px;"> |
| | | <el-form-item label="单位名称"> |
| | | <el-form ref="unitForm" :rules="unitFormRules" :model="unitForm" label-position="right" label-width="100px" style="margin-left:50px;width:500px;"> |
| | | <el-form-item label="单位名称" prop="company"> |
| | | <el-input v-model="unitForm.company"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="单位代码"> |
| | | <el-form-item label="单位代码" prop="code"> |
| | | <el-input v-model="unitForm.code"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="是否为主体单位:" prop="ismain"> |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="联系人"> |
| | | <el-form-item label="联系人" prop="contactname"> |
| | | <el-input v-model="unitForm.contactname"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="联系电话"> |
| | | <el-form-item label="联系电话" prop="contactphone"> |
| | | <el-input v-model="unitForm.contactphone"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="省"> |
| | |
| | | company:'', |
| | | code:'', |
| | | unitFormVisible:false, |
| | | unitFormRules:{}, |
| | | unitForm:{ |
| | | id:'', |
| | | company:'', |
| | |
| | | town:'', |
| | | committee:'', |
| | | isbanned:'', |
| | | }, |
| | | unitFormRules:{ |
| | | company: [{ required: true, message: '单位名称不能为空', trigger: 'change' }], |
| | | code: [{ required: true, message: '单位代码不能为空', trigger: 'change' }], |
| | | ismain: [{ required: true, message: '是否为主体单位不能为空', trigger: 'blur' }], |
| | | contactname: [{ required: true, message: '联系人不能为空', trigger: 'change' }], |
| | | contactphone: [{ required: true, message: '联系电话不能为空', trigger: 'blur' }], |
| | | }, |
| | | provinceList:[], |
| | | cityList:[], |
| | |
| | | }, |
| | | showUnitForm(value,type){ |
| | | this.unitFormVisible = true |
| | | this.$nextTick(() =>{ |
| | | this.$refs["unitForm"].clearValidate() |
| | | }) |
| | | if(type === '新增'){ |
| | | this.title = '新增' |
| | | this.unitForm = { |
| | |
| | | } |
| | | }, |
| | | submitUnit(){ |
| | | if(this.title === '新增'){ |
| | | addUnit(this.unitForm).then((res)=>{ |
| | | if(res.data.code === '200'){ |
| | | this.unitFormVisible = false |
| | | this.getUnitData() |
| | | this.$notify({ |
| | | type:'success', |
| | | duration:2000, |
| | | message:'新增成功', |
| | | title:'成功' |
| | | this.$refs["unitForm"].validate(valid =>{ |
| | | if(valid){ |
| | | if(this.title === '新增'){ |
| | | addUnit(this.unitForm).then((res)=>{ |
| | | if(res.data.code === '200'){ |
| | | this.unitFormVisible = false |
| | | this.getUnitData() |
| | | this.$notify({ |
| | | type:'success', |
| | | duration:2000, |
| | | message:'新增成功', |
| | | title:'成功' |
| | | }) |
| | | }else{ |
| | | this.$message({ |
| | | type:'warning', |
| | | message:res.data.message |
| | | }) |
| | | } |
| | | }) |
| | | }else{ |
| | | this.$message({ |
| | | type:'warning', |
| | | message:res.data.message |
| | | updateUnit(this.unitForm).then((res)=>{ |
| | | if(res.data.code === '200'){ |
| | | this.unitFormVisible = false |
| | | this.getUnitData() |
| | | this.$notify({ |
| | | type:'success', |
| | | duration:2000, |
| | | title:'成功', |
| | | message:'编辑成功' |
| | | }) |
| | | }else{ |
| | | this.$message({ |
| | | type:'warning', |
| | | message:res.data.message |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }else{ |
| | | updateUnit(this.unitForm).then((res)=>{ |
| | | if(res.data.code === '200'){ |
| | | this.unitFormVisible = false |
| | | this.getUnitData() |
| | | this.$notify({ |
| | | type:'success', |
| | | duration:2000, |
| | | title:'成功', |
| | | message:'编辑成功' |
| | | }) |
| | | }else{ |
| | | this.$message({ |
| | | type:'warning', |
| | | message:res.data.message |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }else{ |
| | | this.$message({ |
| | | type:'warning', |
| | | message:'请完善基本信息' |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | deleteById(val){ |
| | | this.$confirm('删除此条信息,是否继续','提示',{ |