|
|
@ -14,7 +14,7 @@ |
|
|
|
</div> |
|
|
|
<div class="d-flex align-center"> |
|
|
|
<a-input-search style="width: 260px" class="mr-4" placeholder="搜索部门/职位/角色" @change="onChange" /> |
|
|
|
<a-button type="primary" icon="plus">新建部门</a-button> |
|
|
|
<a-button type="primary" icon="plus" @click = "createDepartment">新建部门</a-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="right-box flex-1 hos-box hos-shadow white"> |
|
|
@ -29,11 +29,15 @@ |
|
|
|
@showEditMember="showEditMember" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
<a-modal :visible="visible" title="添加部门/职位" @cancel="visible = false" @ok="handleOk"> |
|
|
|
添加部门/职位 |
|
|
|
<a-modal :visible="visible" title="添加部门" @cancel="visible = false" @ok="addDepartment"> |
|
|
|
<a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> |
|
|
|
<a-form-item label="部门名称"> |
|
|
|
<a-input v-model="departmentName" placeholder="部门名称" /> |
|
|
|
</a-form-item> |
|
|
|
</a-form> |
|
|
|
{{ addId }} |
|
|
|
</a-modal> |
|
|
|
<a-modal :visible="visible2" title="修改部门信息" @cancel="visible2 = false" @ok="handleOk"> 修改部门信息 </a-modal> |
|
|
|
<a-modal :visible="visible2" title="修改部门信息" @cancel="visible2 = false" @ok="handleOk"> </a-modal> |
|
|
|
<a-modal :visible="visible1" title="添加成员" @cancel="visible1 = false" @ok="handleOk"> |
|
|
|
添加成员 |
|
|
|
{{ addId }} |
|
|
@ -65,11 +69,30 @@ |
|
|
|
</a-form-item> |
|
|
|
</a-form> |
|
|
|
</a-modal> |
|
|
|
|
|
|
|
<!-- 添加部门/职位 --> |
|
|
|
<a-modal :visible="visibleAddPosition" title="添加部门/职位" @cancel="visibleAddPosition = false" @ok="addPosition"> |
|
|
|
<a-form :form="form" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }"> |
|
|
|
<a-form-item label="添加类型"> |
|
|
|
<a-select :value="addType" placeholder="修改类型" allow-clear @change="selectAddType"> |
|
|
|
<a-select-option value="department">部门</a-select-option> |
|
|
|
<a-select-option value="position">职位</a-select-option> |
|
|
|
</a-select> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="部门名称" v-if="addType === 'department'" > |
|
|
|
<a-input v-model="departmentName" placeholder="部门名称" /> |
|
|
|
</a-form-item> |
|
|
|
<a-form-item label="职位名称" v-else> |
|
|
|
<a-input v-model="positionName" placeholder="职位名称" /> |
|
|
|
</a-form-item> |
|
|
|
</a-form> |
|
|
|
{{ addId }} |
|
|
|
</a-modal> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import { mapState } from 'vuex'; |
|
|
|
import { queryHospitalInfo, editHospitalInfo, queryHospitalById } from 'config/api'; |
|
|
|
import { queryHospitalInfo, editHospitalInfo, queryHospitalById, addDepartment , addPosition} from 'config/api'; |
|
|
|
import TreeNode from './TreeNode.vue'; |
|
|
|
|
|
|
|
export default { |
|
|
@ -85,6 +108,7 @@ export default { |
|
|
|
visible2: false, |
|
|
|
visible3: false, |
|
|
|
visible4: false, |
|
|
|
visibleAddPosition: false, |
|
|
|
addId: '', |
|
|
|
hospitalName: '', |
|
|
|
areaId: [], |
|
|
@ -93,6 +117,12 @@ export default { |
|
|
|
cityId: '', |
|
|
|
countyId: '', |
|
|
|
id: '', |
|
|
|
addType:'department', |
|
|
|
departmentName: '', |
|
|
|
oid:'', |
|
|
|
parentId:'', |
|
|
|
departmentId:'', |
|
|
|
positionName:'' |
|
|
|
}; |
|
|
|
}, |
|
|
|
computed: { ...mapState('home', ['hospitalInfo', 'level', 'area']) }, |
|
|
@ -105,6 +135,65 @@ export default { |
|
|
|
this.getHospitalInfo(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
//新建职位/子部门 |
|
|
|
async addPosition() { |
|
|
|
if (this.addType === 'department') { |
|
|
|
try { |
|
|
|
const params = {param: { oid: this.hospitalInfo.id ,departmentName: this.departmentName ,parentId: this.addId}}; |
|
|
|
const res = await addDepartment(params); |
|
|
|
const { code, msg, data} = res.data; |
|
|
|
if (code === 200) { |
|
|
|
this.$message.success('添加成功'); |
|
|
|
this.visibleAddPosition = false; |
|
|
|
this.getHospitalInfo(); |
|
|
|
}else { |
|
|
|
this.$message.warning(msg); |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
this.$message.warning(error); |
|
|
|
} |
|
|
|
}else { |
|
|
|
try { |
|
|
|
const params = {param: {departmentId: this.addId, positionName: this.positionName}}; |
|
|
|
const res = await addPosition(params); |
|
|
|
const { code, msg, data } = res.data; |
|
|
|
if (code === 200) { |
|
|
|
this.$message.success('添加成功'); |
|
|
|
this.visibleAddPosition = false; |
|
|
|
this.getHospitalInfo(); |
|
|
|
}else { |
|
|
|
this.$message.warning(msg); |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
this.$message.warning(error); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
//新建部门 |
|
|
|
createDepartment() { |
|
|
|
this.visible = true; |
|
|
|
}, |
|
|
|
async addDepartment() { |
|
|
|
try { |
|
|
|
const params = {param: { oid: this.hospitalInfo.id ,departmentName: this.departmentName}}; |
|
|
|
const res = await addDepartment(params); |
|
|
|
const { code, msg, data} = res.data; |
|
|
|
if (code === 200) { |
|
|
|
this.$message.success('添加成功'); |
|
|
|
this.visible = false; |
|
|
|
this.getHospitalInfo(); |
|
|
|
}else { |
|
|
|
this.$message.warning(msg); |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
this.$message.warning(error); |
|
|
|
} |
|
|
|
}, |
|
|
|
selectAddType(e) { |
|
|
|
console.log(e); |
|
|
|
this.addType = e; |
|
|
|
}, |
|
|
|
// 医院数据回显 |
|
|
|
async queryHospitalById() { |
|
|
|
try { |
|
|
@ -202,7 +291,7 @@ export default { |
|
|
|
// 添加部门/职位modal框 |
|
|
|
showAddItem(id) { |
|
|
|
this.addId = id; |
|
|
|
this.visible = true; |
|
|
|
this.visibleAddPosition = true; |
|
|
|
}, |
|
|
|
// 修改部门/职位modal框 |
|
|
|
showEditItem(item) { |
|
|
|