| | |
| | | v-hasPermi="['system:dept:add']" |
| | | >新增</el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-location" |
| | | @click="handleManageRegion(scope.row)" |
| | | v-hasPermi="['system:dept:edit']" |
| | | >管理区域</el-button> |
| | | <el-button |
| | | v-if="scope.row.parentId != 0" |
| | | size="mini" |
| | | type="text" |
| | |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- 管理区域对话框 --> |
| | | <el-dialog title="管理区域" :visible.sync="regionDialogVisible" width="900px" append-to-body> |
| | | <div style="margin-bottom: 10px;"> |
| | | <el-button type="primary" icon="el-icon-plus" size="small" @click="handleAddRegion">新增区域</el-button> |
| | | </div> |
| | | |
| | | <el-table :data="regionList" border> |
| | | <el-table-column label="区域类型" align="center" width="120"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.regionType === 'AREA'" type="success">地域范围</el-tag> |
| | | <el-tag v-else-if="scope.row.regionType === 'HOSPITAL'" type="primary">指定医院</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="省份" prop="province" align="center" width="100" /> |
| | | <el-table-column label="城市" prop="city" align="center" width="100" /> |
| | | <el-table-column label="县/区" prop="area" align="center" width="100" /> |
| | | <el-table-column label="详细地址" prop="address" align="center" show-overflow-tooltip /> |
| | | <el-table-column label="指定医院" prop="hospitalName" align="center" show-overflow-tooltip /> |
| | | <el-table-column label="状态" align="center" width="80"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" align="center" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleEditRegion(scope.row)">编辑</el-button> |
| | | <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDeleteRegion(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="regionDialogVisible = false">关 闭</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!-- 添加或修改区域对话框 --> |
| | | <el-dialog :title="regionFormTitle" :visible.sync="regionFormVisible" width="600px" append-to-body> |
| | | <el-form ref="regionForm" :model="regionForm" :rules="regionRules" label-width="100px"> |
| | | <el-form-item label="区域类型" prop="regionType"> |
| | | <el-radio-group v-model="regionForm.regionType" @change="handleRegionTypeChange"> |
| | | <el-radio label="AREA">地域范围</el-radio> |
| | | <el-radio label="HOSPITAL">指定医院</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | |
| | | <!-- 地域范围配置 --> |
| | | <div v-if="regionForm.regionType === 'AREA'"> |
| | | <el-form-item label="省份" prop="province"> |
| | | <el-input v-model="regionForm.province" placeholder="请输入省份,如:广东省" /> |
| | | </el-form-item> |
| | | <el-form-item label="城市" prop="city"> |
| | | <el-input v-model="regionForm.city" placeholder="请输入城市,如:深圳市" /> |
| | | </el-form-item> |
| | | <el-form-item label="县/区" prop="area"> |
| | | <el-input v-model="regionForm.area" placeholder="请输入县/区,如:南山区" /> |
| | | </el-form-item> |
| | | <el-form-item label="详细地址" prop="address"> |
| | | <el-input v-model="regionForm.address" type="textarea" placeholder="请输入详细地址或关键词" :rows="3" /> |
| | | </el-form-item> |
| | | </div> |
| | | |
| | | <!-- 指定医院配置 --> |
| | | <div v-if="regionForm.regionType === 'HOSPITAL'"> |
| | | <el-form-item label="医院名称" prop="hospitalName"> |
| | | <el-input v-model="regionForm.hospitalName" placeholder="请输入医院名称或关键词" /> |
| | | </el-form-item> |
| | | </div> |
| | | |
| | | <el-form-item label="状态" prop="status"> |
| | | <el-radio-group v-model="regionForm.status"> |
| | | <el-radio label="0">正常</el-radio> |
| | | <el-radio label="1">停用</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="备注" prop="remark"> |
| | | <el-input v-model="regionForm.remark" type="textarea" placeholder="请输入备注" :rows="2" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitRegionForm">确 定</el-button> |
| | | <el-button @click="regionFormVisible = false">取 消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!-- 添加或修改部门对话框 --> |
| | | <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> |
| | |
| | | |
| | | <script> |
| | | import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"; |
| | | import { listDeptRegion, addDeptRegion, updateDeptRegion, delDeptRegion } from "@/api/system/deptRegion"; |
| | | import Treeselect from "@riophae/vue-treeselect"; |
| | | import "@riophae/vue-treeselect/dist/vue-treeselect.css"; |
| | | |
| | |
| | | }, |
| | | // 表单参数 |
| | | form: {}, |
| | | // 区域管理相关 |
| | | regionDialogVisible: false, |
| | | currentDept: null, |
| | | regionList: [], |
| | | regionFormVisible: false, |
| | | regionFormTitle: '', |
| | | regionForm: {}, |
| | | regionRules: { |
| | | regionType: [ |
| | | { required: true, message: "区域类型不能为空", trigger: "change" } |
| | | ], |
| | | status: [ |
| | | { required: true, message: "状态不能为空", trigger: "change" } |
| | | ] |
| | | }, |
| | | // 表单校验 |
| | | rules: { |
| | | parentId: [ |
| | |
| | | this.getList(); |
| | | this.$modal.msgSuccess("删除成功"); |
| | | }).catch(() => {}); |
| | | }, |
| | | /** 管理区域按钮操作 */ |
| | | handleManageRegion(row) { |
| | | this.currentDept = row; |
| | | this.regionDialogVisible = true; |
| | | this.loadRegionList(); |
| | | }, |
| | | /** 加载区域列表 */ |
| | | loadRegionList() { |
| | | if (!this.currentDept) return; |
| | | listDeptRegion(this.currentDept.deptId).then(response => { |
| | | this.regionList = response.data; |
| | | }); |
| | | }, |
| | | /** 新增区域 */ |
| | | handleAddRegion() { |
| | | this.resetRegionForm(); |
| | | this.regionFormTitle = "新增区域"; |
| | | this.regionFormVisible = true; |
| | | }, |
| | | /** 编辑区域 */ |
| | | handleEditRegion(row) { |
| | | this.regionForm = { ...row }; |
| | | this.regionFormTitle = "编辑区域"; |
| | | this.regionFormVisible = true; |
| | | }, |
| | | /** 删除区域 */ |
| | | handleDeleteRegion(row) { |
| | | this.$modal.confirm('是否确认删除该区域配置?').then(() => { |
| | | return delDeptRegion(row.regionId); |
| | | }).then(() => { |
| | | this.$modal.msgSuccess("删除成功"); |
| | | this.loadRegionList(); |
| | | }).catch(() => {}); |
| | | }, |
| | | /** 重置区域表单 */ |
| | | resetRegionForm() { |
| | | this.regionForm = { |
| | | regionId: undefined, |
| | | deptId: this.currentDept.deptId, |
| | | regionType: 'AREA', |
| | | province: '', |
| | | city: '', |
| | | area: '', |
| | | address: '', |
| | | hospitalName: '', |
| | | status: '0', |
| | | remark: '' |
| | | }; |
| | | this.resetForm("regionForm"); |
| | | }, |
| | | /** 区域类型切换 */ |
| | | handleRegionTypeChange(value) { |
| | | if (value === 'AREA') { |
| | | this.regionForm.hospitalName = ''; |
| | | } else if (value === 'HOSPITAL') { |
| | | this.regionForm.province = ''; |
| | | this.regionForm.city = ''; |
| | | this.regionForm.area = ''; |
| | | this.regionForm.address = ''; |
| | | } |
| | | }, |
| | | /** 提交区域表单 */ |
| | | submitRegionForm() { |
| | | this.$refs["regionForm"].validate(valid => { |
| | | if (valid) { |
| | | if (this.regionForm.regionId) { |
| | | updateDeptRegion(this.regionForm).then(response => { |
| | | this.$modal.msgSuccess("修改成功"); |
| | | this.regionFormVisible = false; |
| | | this.loadRegionList(); |
| | | }); |
| | | } else { |
| | | addDeptRegion(this.regionForm).then(response => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.regionFormVisible = false; |
| | | this.loadRegionList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }; |