机构修改

This commit is contained in:
Zhang.YC
2025-02-27 15:45:51 +08:00
parent be0d9bc987
commit f2b5f8a0b4
2 changed files with 72 additions and 34 deletions

View File

@@ -41,14 +41,21 @@ export function getOrgDetail(id) {
export function initOrgTypeOption() { export function initOrgTypeOption() {
return request({ return request({
url: '/basedatamanage/organization/organization', url: '/basedatamanage/organization/init',
method: 'get', method: 'get',
}) })
} }
export function disableOrg(id) { export function disableOrg(id) {
return request({ return request({
url: '/basedatamanage/organization/organization?orgId=' + id, url: '/basedatamanage/organization/organization-inactive?orgId=' + id,
method: 'put',
})
}
export function enableOrg(id) {
return request({
url: '/basedatamanage/organization/organization-active?orgId=' + id,
method: 'put', method: 'put',
}) })
} }

View File

@@ -44,11 +44,10 @@
row-key="id" row-key="id"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" :selectable="selectable" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column label="科室名称" align="left" prop="name" /> <el-table-column label="科室名称" align="left" prop="name" />
<el-table-column label="科室类型" align="center" prop="typeEnum" /> <el-table-column label="科室类型" align="center" prop="typeEnum" />
<el-table-column label="科室主任" align="center" prop="dictId" /> <el-table-column label="状态" align="center" prop="activeFlag" />
<el-table-column label="状态" align="center" prop="status" />
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template #default="scope"> <template #default="scope">
<el-button <el-button
@@ -61,26 +60,26 @@
<el-button <el-button
link link
type="primary" type="primary"
@click="handleDisabled(scope.row)" @click="handleDisabled(scope.row.id)"
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
v-if="scope.row.status == '启用'" v-if="scope.row.activeFlag == '1'"
>停用</el-button >停用</el-button
> >
<el-button <el-button
link link
type="primary" type="primary"
@click="handleDisabled(scope.row)" @click="handleDisabled(scope.row.id)"
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
v-else v-else
>启用</el-button >启用</el-button
> >
<el-button <!-- <el-button
link link
type="primary" type="primary"
@click="handleAdd(scope.row)" @click="handleAddInferior(scope.row)"
v-hasPermi="['system:dict:edit']" v-hasPermi="['system:dict:edit']"
>添加下级</el-button >添加下级</el-button
> > -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -109,18 +108,18 @@
style="width: 100%" style="width: 100%"
> >
<el-option <el-option
v-for="dict in org_type" v-for="item in orgTypeOption"
:key="dict.value" :key="item.value"
:label="dict.label" :label="item.code"
:value="dict.value" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-col> <el-col>
<el-form-item label="上级科室" prop="deptId"> <el-form-item label="上级科室" prop="busNoParent">
<el-tree-select <el-tree-select
style="width: 100%" style="width: 100%"
v-model="form.deptId" v-model="form.busNoParent"
:data="organization" :data="organization"
:props="{ value: 'busNo', label: 'name', children: 'children' }" :props="{ value: 'busNo', label: 'name', children: 'children' }"
value-key="id" value-key="id"
@@ -156,6 +155,7 @@ import {
disableOrg, disableOrg,
initOrgTypeOption, initOrgTypeOption,
getOrgDetail, getOrgDetail,
enableOrg,
} from "./components/api"; } from "./components/api";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
@@ -166,8 +166,9 @@ const queryParams = ref({});
const open = ref(false); const open = ref(false);
const form = ref({}); const form = ref({});
const orgTableRef = ref(); const orgTableRef = ref();
const orgTypeOption = ref([{}]); const orgTypeOption = ref([]);
const selectRowIds = ref([]); const selectRowIds = ref([]);
const total = ref(0);
const rules = ref({ const rules = ref({
busNo: [{ required: true, message: "请输入科室编号", trigger: "change" }], busNo: [{ required: true, message: "请输入科室编号", trigger: "change" }],
name: [ name: [
@@ -180,49 +181,66 @@ const rules = ref({
getPageList(); getPageList();
function initOption() { function initOption() {
if (!orgTypeOption.value) { if (orgTypeOption.value.length == 0) {
initOrgTypeOption().then((res) => { initOrgTypeOption().then((res) => {
orgTypeOption.value = res.data.records; orgTypeOption.value = res.data;
}); });
} }
} }
function reset() {
form.value.busNo = undefined;
form.value.name = undefined;
form.value.typeEnum = undefined;
form.value.busNoParent = undefined;
proxy.resetForm("orgRef");
}
function getPageList() { function getPageList() {
loading.value = false; loading.value = false;
getList(queryParams.value).then((res) => { getList(queryParams.value).then((res) => {
organization.value = res.data.records; organization.value = res.data.records;
console.log(res.data.records); total.value = res.data.total;
loading.value = false; loading.value = false;
}); });
} }
function handleAdd() { function handleAdd() {
reset();
initOption(); initOption();
proxy.resetForm("orgRef");
open.value = true; open.value = true;
console.log(form.value);
} }
function handelEdit(id) { function handelEdit(row) {
reset();
initOption(); initOption();
getOrgDetail(id).then((res) => { // if (row.busNo.lastIndexOf(".") != -1) {
form.value = res.data.records; // row.busNoParent = row.busNo.substring(0, row.busNo.lastIndexOf("."));
}); // row.busNo = row.busNo.substring(
// row.busNo.lastIndexOf(".") + 1,
// row.busNo.length
// );
// }
form.value.busNo = row.busNo;
form.value.name = row.name;
form.value.typeEnum = row.typeEnum;
form.value.busNoParent = undefined;
open.value = true; open.value = true;
} }
function cancel() { function cancel() {
open.value = false; open.value = false;
proxy.resetForm("orgRef"); reset();
} }
/**
* 新增提交
*/
function submitForm() { function submitForm() {
proxy.$refs["orgRef"].validate((valid) => { proxy.$refs["orgRef"].validate((valid) => {
if (valid) { if (valid) {
if (form.value.id != undefined) { if (form.value.busNoParent) {
form.value.busNo = form.value.busNoParent + "." + form.value.busNo;
}
if (form.value.id == undefined) {
addOrganization(form.value).then((res) => { addOrganization(form.value).then((res) => {
proxy.$modal.msgSuccess(res.msg); proxy.$modal.msgSuccess(res.msg);
open.value = false; open.value = false;
@@ -255,11 +273,24 @@ function handleDisabled(id) {
}); });
} }
function handleSelectionChange() { function handelEnable(id){
console.log(orgTableRef.value.getSelectionRows()); enableOrg(id).then((res) => {
proxy.$modal.msgSuccess(res.msg);
getList();
});
}
function handleSelectionChange() {
selectRowIds.value = orgTableRef.value selectRowIds.value = orgTableRef.value
.getSelectionRows() .getSelectionRows()
.map((item) => item.id); .map((item) => item.id);
} }
// function handleAddInferior(row) {
// initOption();
// proxy.resetForm("orgRef");
// open.value = true;
// form.value.busNoParent = row.busNo;
// row.busNo = undefined;
// }
</script> </script>