@@ -0,0 +1,56 @@ | |||||
import request from "@/utils/request"; | |||||
const BASE_URL = "/internal"; | |||||
/** | |||||
* 治疗方案 | |||||
*/ | |||||
// 治疗方案列表 | |||||
export function getTherapeuticListApi(params) { | |||||
return request({ | |||||
url: `${BASE_URL}/medical-treatment-plan`, | |||||
method: "get", | |||||
params, | |||||
}); | |||||
} | |||||
// 新增治疗方案 | |||||
export function addTherapeuticApi(data) { | |||||
return request({ | |||||
url: `${BASE_URL}/medical-treatment-plan`, | |||||
method: "post", | |||||
data, | |||||
}); | |||||
} | |||||
// 编辑治疗方案 | |||||
export function editTherapeuticApi(data) { | |||||
return request({ | |||||
url: `${BASE_URL}/medical-treatment-plan`, | |||||
method: "put", | |||||
data, | |||||
}); | |||||
} | |||||
// 批量删除 | |||||
export function batchDelTherapeuticApi(data) { | |||||
return request({ | |||||
url: `${BASE_URL}/medical-treatment-plan`, | |||||
method: "delete", | |||||
data, | |||||
}); | |||||
} | |||||
// 治疗方案详情 | |||||
export function getTherapeuticApi(id) { | |||||
return request({ | |||||
url: `${BASE_URL}/medical-treatment-plan/${id}`, | |||||
method: "get", | |||||
}); | |||||
} | |||||
// 治疗方案详情 | |||||
export function delTherapeuticApi(id) { | |||||
return request({ | |||||
url: `${BASE_URL}/medical-treatment-plan/${id}`, | |||||
method: "get", | |||||
}); | |||||
} |
@@ -20,6 +20,7 @@ | |||||
:options="deptList" | :options="deptList" | ||||
:autoFetch="false" | :autoFetch="false" | ||||
:props="{ emitPath: true }" | :props="{ emitPath: true }" | ||||
@change="onChangeDept" | |||||
/> | /> | ||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="疾病名称" prop="name"> | <el-form-item label="疾病名称" prop="name"> | ||||
@@ -108,9 +109,9 @@ | |||||
<script> | <script> | ||||
import ImportResultPopup from "@/components/ImportResultPopup"; | import ImportResultPopup from "@/components/ImportResultPopup"; | ||||
import { getTreeHospDept } from "@/api/index"; | |||||
import { diseasePageList, deleteDisease, batchImportDisease } from '@/api/dictManage/disease'; | |||||
import { getAllHospital } from '@/api/dictManage/hosp'; | |||||
import { getTreeHospDept } from "@/api/index"; | |||||
import { diseasePageList, deleteDisease, batchImportDisease } from "@/api/dictManage/disease"; | |||||
import { getAllHospital } from "@/api/dictManage/hosp"; | |||||
import CrudPopup from "./components/CrudPopup/index.vue"; | import CrudPopup from "./components/CrudPopup/index.vue"; | ||||
import TreeDept from "@/components/TreeDept"; | import TreeDept from "@/components/TreeDept"; | ||||
@@ -119,7 +120,7 @@ export default { | |||||
components: { | components: { | ||||
ImportResultPopup, | ImportResultPopup, | ||||
CrudPopup, | CrudPopup, | ||||
TreeDept | |||||
TreeDept, | |||||
}, | }, | ||||
data() { | data() { | ||||
@@ -139,12 +140,12 @@ export default { | |||||
pageSize: 10, | pageSize: 10, | ||||
name: "", | name: "", | ||||
wardId: "", // 院区ID | wardId: "", // 院区ID | ||||
deptId: [] | |||||
deptId: [], | |||||
}, | }, | ||||
pageList: [], | pageList: [], | ||||
uploading: false, | uploading: false, | ||||
wardIdList: [], // 院区列表 | wardIdList: [], // 院区列表 | ||||
deptList: [] // 科室数据 | |||||
deptList: [], // 科室数据 | |||||
}; | }; | ||||
}, | }, | ||||
created() { | created() { | ||||
@@ -189,15 +190,16 @@ export default { | |||||
}, | }, | ||||
/*获取科室数据*/ | /*获取科室数据*/ | ||||
async getDeptList(wardId) { | async getDeptList(wardId) { | ||||
const res = await getTreeHospDept({ wardId : wardId }); | |||||
const res = await getTreeHospDept({ wardId: wardId }); | |||||
this.deptList = res.data || []; | this.deptList = res.data || []; | ||||
}, | }, | ||||
getList() { | getList() { | ||||
this.loading = true; | this.loading = true; | ||||
const params = JSON.parse(JSON.stringify(this.queryParams)); | const params = JSON.parse(JSON.stringify(this.queryParams)); | ||||
params.deptId = params.deptId?.length === 2 ? | |||||
params.deptId.slice(-1).toString() : | |||||
params.deptId?.length === 1 && params.deptId.slice(-1).toString() || ''; | |||||
params.deptId = | |||||
params.deptId?.length === 2 | |||||
? params.deptId.slice(-1).toString() | |||||
: (params.deptId?.length === 1 && params.deptId.slice(-1).toString()) || ""; | |||||
diseasePageList(this.addDateRange(params, this.dateRange)) | diseasePageList(this.addDateRange(params, this.dateRange)) | ||||
.then((res) => { | .then((res) => { | ||||
const { list, page } = res.data; | const { list, page } = res.data; | ||||
@@ -1,19 +1,27 @@ | |||||
<template> | <template> | ||||
<vxe-modal type="modal" v-bind="modalConfig" v-model="show" :title="showTitle"> | <vxe-modal type="modal" v-bind="modalConfig" v-model="show" :title="showTitle"> | ||||
<vxe-form ref="formRef" v-bind="formConfig" :data="formData" :rules="formRules"> | |||||
<vxe-form | |||||
ref="formRef" | |||||
v-bind="formConfig" | |||||
:data="formData" | |||||
:rules="formRules" | |||||
:loading="loadingDetail" | |||||
> | |||||
<template #dept_f_d="{ data }"> | <template #dept_f_d="{ data }"> | ||||
<tree-dept | <tree-dept | ||||
v-model="data.deptId" | v-model="data.deptId" | ||||
clearable | clearable | ||||
class="w-full" | class="w-full" | ||||
:options="deptOptions" | :options="deptOptions" | ||||
:props="{ emitPath: false }" | |||||
:props="{ emitPath: false, checkStrictly: true }" | |||||
:autoFetch="false" | |||||
@change="() => onChangeDept(data)" | |||||
></tree-dept> | ></tree-dept> | ||||
</template> | </template> | ||||
<template #a3_f_d="{ data }"> | <template #a3_f_d="{ data }"> | ||||
<div class="flex justify-center items-center"> | <div class="flex justify-center items-center"> | ||||
<vxe-input | <vxe-input | ||||
v-model="data.min" | |||||
v-model="data.minPrice" | |||||
class="flex-1" | class="flex-1" | ||||
type="float" | type="float" | ||||
:min="0" | :min="0" | ||||
@@ -23,7 +31,7 @@ | |||||
/> | /> | ||||
<span>——</span> | <span>——</span> | ||||
<vxe-input | <vxe-input | ||||
v-model="data.max" | |||||
v-model="data.maxPrice" | |||||
class="flex-1" | class="flex-1" | ||||
type="float" | type="float" | ||||
:min="0" | :min="0" | ||||
@@ -37,7 +45,7 @@ | |||||
<template #footer> | <template #footer> | ||||
<div class="flex justify-center"> | <div class="flex justify-center"> | ||||
<vxe-button>取 消</vxe-button> | <vxe-button>取 消</vxe-button> | ||||
<vxe-button status="primary">确 认</vxe-button> | |||||
<vxe-button status="primary" @click="onSubmit" :loading="isLoading">确 认</vxe-button> | |||||
</div> | </div> | ||||
</template> | </template> | ||||
</vxe-modal> | </vxe-modal> | ||||
@@ -48,6 +56,12 @@ import { modalConfigMap } from "@/config/vxeModal"; | |||||
import { requireReg } from "@/regular"; | import { requireReg } from "@/regular"; | ||||
import { getTreeHospDept } from "@/api/index"; | import { getTreeHospDept } from "@/api/index"; | ||||
import { getAllHospital } from "@/api/dictManage/hosp"; | import { getAllHospital } from "@/api/dictManage/hosp"; | ||||
import { diseasePageList } from "@/api/dictManage/disease"; | |||||
import { | |||||
getTherapeuticApi, | |||||
addTherapeuticApi, | |||||
editTherapeuticApi, | |||||
} from "@/api/dictManage/therapeutic"; | |||||
import { to } from "await-to-js"; | import { to } from "await-to-js"; | ||||
export default { | export default { | ||||
name: "AddTherapeuticDialog", | name: "AddTherapeuticDialog", | ||||
@@ -59,9 +73,12 @@ export default { | |||||
type: Boolean, | type: Boolean, | ||||
default: false, | default: false, | ||||
}, | }, | ||||
initFormData: { | |||||
type: Object, | |||||
default: () => ({}), | |||||
id: { | |||||
default: () => null, | |||||
}, | |||||
getTableList: { | |||||
type: Function, | |||||
default: () => {}, | |||||
}, | }, | ||||
}, | }, | ||||
computed: { | computed: { | ||||
@@ -74,15 +91,15 @@ export default { | |||||
}, | }, | ||||
}, | }, | ||||
showTitle: function () { | showTitle: function () { | ||||
return this.formData.id ? "编辑治疗方案" : "新增治疗方案"; | |||||
return this.id ? "编辑治疗方案" : "新增治疗方案"; | |||||
}, | }, | ||||
}, | }, | ||||
data() { | data() { | ||||
const priceValidator = ({ data }) => { | const priceValidator = ({ data }) => { | ||||
if (!data.min || !data.max) { | |||||
if (!data.minPrice || !data.maxPrice) { | |||||
return new Error("请输入价格范围"); | return new Error("请输入价格范围"); | ||||
} | } | ||||
if (data.min > data.max) { | |||||
if (data.minPrice > data.maxPrice) { | |||||
return new Error("请输入正确的价格范围"); | return new Error("请输入正确的价格范围"); | ||||
} | } | ||||
}; | }; | ||||
@@ -124,17 +141,23 @@ export default { | |||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
field: "a1", | |||||
field: "medicalLabelId", | |||||
title: "疾病诊断", | title: "疾病诊断", | ||||
itemRender: { | itemRender: { | ||||
name: "VxeSelect", | name: "VxeSelect", | ||||
props: { | props: { | ||||
placeholder: "请选择", | placeholder: "请选择", | ||||
filterable: true, | |||||
}, | |||||
options: [], | |||||
optionProps: { | |||||
value: "id", | |||||
label: "name", | |||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
field: "a2", | |||||
field: "name", | |||||
title: "治疗方案", | title: "治疗方案", | ||||
itemRender: { | itemRender: { | ||||
name: "VxeInput", | name: "VxeInput", | ||||
@@ -144,7 +167,7 @@ export default { | |||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
field: "min", | |||||
field: "minPrice", | |||||
title: "价格区间", | title: "价格区间", | ||||
titleAsterisk: true, | titleAsterisk: true, | ||||
slots: { | slots: { | ||||
@@ -156,9 +179,9 @@ export default { | |||||
formRules: { | formRules: { | ||||
wardId: [requireReg("请选择所属院区")], | wardId: [requireReg("请选择所属院区")], | ||||
deptId: [requireReg("请选择所属科室")], | deptId: [requireReg("请选择所属科室")], | ||||
a1: [requireReg("请选择疾病诊断")], | |||||
a2: [requireReg("请输入治疗方案")], | |||||
min: [ | |||||
medicalLabelId: [requireReg("请选择疾病诊断")], | |||||
name: [requireReg("请输入治疗方案")], | |||||
minPrice: [ | |||||
requireReg("请输入价格范围"), | requireReg("请输入价格范围"), | ||||
{ | { | ||||
validator: priceValidator, | validator: priceValidator, | ||||
@@ -166,20 +189,50 @@ export default { | |||||
], | ], | ||||
}, | }, | ||||
formData: { | formData: { | ||||
id: undefined, | |||||
wardId: null, | wardId: null, | ||||
deptId: null, | deptId: null, | ||||
a1: null, | |||||
a2: null, | |||||
min: null, | |||||
max: null, | |||||
medicalLabelId: null, | |||||
name: null, | |||||
minPrice: null, | |||||
maxPrice: null, | |||||
}, | }, | ||||
deptOptions: [], | deptOptions: [], | ||||
isLoading: false, | |||||
loadingDetail: false, | |||||
}; | }; | ||||
}, | }, | ||||
methods: { | methods: { | ||||
init() { | |||||
async init() { | |||||
await this.getDetail(); | |||||
this.getWardOptions(); | this.getWardOptions(); | ||||
this.getDeptOptions(); | this.getDeptOptions(); | ||||
this.getDiseaseOptions(); | |||||
}, | |||||
// 获取详情 | |||||
async getDetail() { | |||||
console.log("this.editId=", this.id); | |||||
if (this.id) { | |||||
this.loadingDetail = true; | |||||
const [err, res] = await to(getTherapeuticApi(this.id)); | |||||
setTimeout(() => { | |||||
this.loadingDetail = false; | |||||
}, 500); | |||||
if (err) { | |||||
return; | |||||
} | |||||
const { id, wardId, deptId, medicalLabelId, name, minPrice, maxPrice } = res?.data || {}; | |||||
this.formData = { | |||||
id, | |||||
wardId, | |||||
deptId, | |||||
medicalLabelId, | |||||
name, | |||||
minPrice, | |||||
maxPrice, | |||||
}; | |||||
} | |||||
}, | }, | ||||
// 获取院区下拉选项 | // 获取院区下拉选项 | ||||
async getWardOptions() { | async getWardOptions() { | ||||
@@ -193,16 +246,20 @@ export default { | |||||
} | } | ||||
formItem[0].itemRender.options = res.data; | formItem[0].itemRender.options = res.data; | ||||
}, | }, | ||||
// 切换院区 | |||||
onChangeWard({ data }) { | onChangeWard({ data }) { | ||||
console.log("切换院区"); | |||||
data.deptId = null; | data.deptId = null; | ||||
this.deptOptions = []; | |||||
this.getDeptOptions(data.wardId); | |||||
data.medicalLabelId = null; | |||||
this.getDeptOptions(); | |||||
this.getDiseaseOptions(); | |||||
}, | }, | ||||
// 获取科室下拉选项 | // 获取科室下拉选项 | ||||
async getDeptOptions(wardId) { | |||||
async getDeptOptions() { | |||||
const { wardId } = this.formData; | |||||
const [err, res] = await to( | const [err, res] = await to( | ||||
getTreeHospDept({ | getTreeHospDept({ | ||||
wardId: wardId || undefined, | |||||
wardId, | |||||
}) | }) | ||||
); | ); | ||||
console.log("err=", err); | console.log("err=", err); | ||||
@@ -212,15 +269,70 @@ export default { | |||||
} | } | ||||
this.deptOptions = res.data || []; | this.deptOptions = res.data || []; | ||||
}, | }, | ||||
// 切换科室 | |||||
onChangeDept(data) { | |||||
console.log("切换科室"); | |||||
// 切换科室 | |||||
data.medicalLabelId = null; | |||||
this.getDiseaseOptions(); | |||||
}, | |||||
// 获取疾病选项 | |||||
async getDiseaseOptions() { | |||||
const { wardId, deptId } = this.formData; | |||||
const [err, res] = await to( | |||||
diseasePageList({ | |||||
pageNum: 1, | |||||
pageSize: 100, | |||||
wardId, | |||||
deptId, | |||||
}) | |||||
); | |||||
await this.$nextTick(); | |||||
const formItem = this.$refs.formRef.getItems(); | |||||
console.log("formItem=", formItem); | |||||
if (err) { | |||||
formItem[2].itemRender.options = []; | |||||
return; | |||||
} | |||||
formItem[2].itemRender.options = res.data?.list; | |||||
}, | |||||
// 提交 | |||||
async onSubmit() { | |||||
await this.$nextTick(); | |||||
const isNoPass = await this.$refs.formRef.validate(); | |||||
if (isNoPass) { | |||||
return; | |||||
} | |||||
this.isLoading = true; | |||||
const { id, wardId, deptId, medicalLabelId, name, minPrice, maxPrice } = this.formData; | |||||
const params = { | |||||
id, | |||||
wardId, | |||||
deptId, | |||||
medicalLabelId, | |||||
name, | |||||
minPrice, | |||||
maxPrice, | |||||
}; | |||||
if (this.formData.id) { | |||||
const [err, res] = await to(editTherapeuticApi(params)); | |||||
this.isLoading = false; | |||||
if (err) { | |||||
return; | |||||
} | |||||
} else { | |||||
const [err, res] = await to(addTherapeuticApi(params)); | |||||
this.isLoading = false; | |||||
if (err) { | |||||
return; | |||||
} | |||||
} | |||||
this.show = false; | |||||
this.$message.success("操作成功"); | |||||
this.getTableList(); | |||||
}, | |||||
}, | }, | ||||
created() { | created() { | ||||
this.formData = { | |||||
...this.formData, | |||||
...this.initFormData, | |||||
}; | |||||
console.log("this.formData=", this.formData); | |||||
}, | |||||
mounted() { | |||||
this.init(); | this.init(); | ||||
}, | }, | ||||
}; | }; | ||||
@@ -30,7 +30,7 @@ | |||||
批量导入数据 | 批量导入数据 | ||||
</vxe-button> | </vxe-button> | ||||
</el-upload> | </el-upload> | ||||
<a download="批量导入治疗方案模版.xlsx"> | |||||
<a :href="exportTemplateUrl" download="批量导入治疗方案模版.xlsx"> | |||||
<vxe-button status="success" icon="vxe-icon-download" class="mr-10"> | <vxe-button status="success" icon="vxe-icon-download" class="mr-10"> | ||||
下载数据模板 | 下载数据模板 | ||||
</vxe-button> | </vxe-button> | ||||
@@ -42,7 +42,9 @@ | |||||
clearable | clearable | ||||
class="w-240" | class="w-240" | ||||
:options="deptOptions" | :options="deptOptions" | ||||
:props="{ emitPath: false }" | |||||
:props="{ emitPath: false, checkStrictly: true }" | |||||
placeholder="全部" | |||||
@change="() => onChangeDept(data)" | |||||
></tree-dept> | ></tree-dept> | ||||
</template> | </template> | ||||
<template #op_t_d="{ row }"> | <template #op_t_d="{ row }"> | ||||
@@ -50,7 +52,12 @@ | |||||
<vxe-button type="text" status="danger" @click="onDelete(row)">删除</vxe-button> | <vxe-button type="text" status="danger" @click="onDelete(row)">删除</vxe-button> | ||||
</template> | </template> | ||||
</vxe-grid> | </vxe-grid> | ||||
<add-therapeutic-dialog v-if="visible" :visible.sync="visible" /> | |||||
<add-therapeutic-dialog | |||||
v-if="visible" | |||||
:visible.sync="visible" | |||||
:id="editId" | |||||
:getTableList="getTableList" | |||||
/> | |||||
</div> | </div> | ||||
</template> | </template> | ||||
<script> | <script> | ||||
@@ -59,6 +66,12 @@ import { commonGridConfig2 } from "@/config/vxeGrid"; | |||||
import { getAllHospital } from "@/api/dictManage/hosp"; | import { getAllHospital } from "@/api/dictManage/hosp"; | ||||
import TreeDept from "@/components/TreeDept"; | import TreeDept from "@/components/TreeDept"; | ||||
import { getTreeHospDept } from "@/api/index"; | import { getTreeHospDept } from "@/api/index"; | ||||
import { | |||||
getTherapeuticListApi, | |||||
delTherapeuticApi, | |||||
batchDelTherapeuticApi, | |||||
} from "@/api/dictManage/therapeutic"; | |||||
import { diseasePageList } from "@/api/dictManage/disease"; | |||||
import { to } from "await-to-js"; | import { to } from "await-to-js"; | ||||
export default { | export default { | ||||
name: "TherapeuticRegimen", | name: "TherapeuticRegimen", | ||||
@@ -68,6 +81,7 @@ export default { | |||||
}, | }, | ||||
data() { | data() { | ||||
return { | return { | ||||
exportTemplateUrl: process.env.VUE_APP_BASE_PATH + "template/therapeuticTemplate.xlsx", | |||||
gridConfig: { | gridConfig: { | ||||
...commonGridConfig2, | ...commonGridConfig2, | ||||
keepSource: true, | keepSource: true, | ||||
@@ -85,7 +99,7 @@ export default { | |||||
itemRender: { | itemRender: { | ||||
name: "VxeSelect", | name: "VxeSelect", | ||||
props: { | props: { | ||||
placeholder: "请选择院区", | |||||
placeholder: "全部", | |||||
className: "w-240", | className: "w-240", | ||||
clearable: true, | clearable: true, | ||||
filterable: true, | filterable: true, | ||||
@@ -101,7 +115,7 @@ export default { | |||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
field: "b", | |||||
field: "deptId", | |||||
title: "科室", | title: "科室", | ||||
itemRender: {}, | itemRender: {}, | ||||
slots: { | slots: { | ||||
@@ -109,18 +123,25 @@ export default { | |||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
field: "c", | |||||
field: "medicalLabelId", | |||||
title: "疾病诊断", | title: "疾病诊断", | ||||
itemRender: { | itemRender: { | ||||
name: "VxeInput", | |||||
name: "VxeSelect", | |||||
props: { | props: { | ||||
placeholder: "请输入疾病诊断", | |||||
placeholder: "全部", | |||||
className: "w-240", | className: "w-240", | ||||
clearable: true, | |||||
filterable: true, | |||||
}, | |||||
options: [], | |||||
optionProps: { | |||||
value: "id", | |||||
label: "name", | |||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
field: "d", | |||||
field: "name", | |||||
title: "治疗方案", | title: "治疗方案", | ||||
itemRender: { | itemRender: { | ||||
name: "VxeInput", | name: "VxeInput", | ||||
@@ -152,32 +173,37 @@ export default { | |||||
minWidth: 100, | minWidth: 100, | ||||
}, | }, | ||||
{ | { | ||||
field: "a", | |||||
field: "medicalLabelName", | |||||
title: "疾病诊断", | title: "疾病诊断", | ||||
minWidth: 200, | minWidth: 200, | ||||
}, | }, | ||||
{ | { | ||||
field: "b", | |||||
field: "name", | |||||
title: "治疗方案名称", | title: "治疗方案名称", | ||||
minWidth: 200, | minWidth: 200, | ||||
}, | }, | ||||
{ | { | ||||
field: "c", | |||||
title: "价格", | |||||
field: "minPrice", | |||||
title: "最低价格", | |||||
minWidth: 200, | |||||
}, | |||||
{ | |||||
field: "maxPrice", | |||||
title: "最高价格", | |||||
minWidth: 200, | minWidth: 200, | ||||
}, | }, | ||||
{ | { | ||||
field: "d", | |||||
field: "wardName", | |||||
title: "院区", | title: "院区", | ||||
minWidth: 200, | minWidth: 200, | ||||
}, | }, | ||||
{ | { | ||||
field: "e", | |||||
field: "level1DeptName", | |||||
title: "一级科室", | title: "一级科室", | ||||
minWidth: 200, | minWidth: 200, | ||||
}, | }, | ||||
{ | { | ||||
field: "f", | |||||
field: "level2DeptName", | |||||
title: "二级科室", | title: "二级科室", | ||||
minWidth: 200, | minWidth: 200, | ||||
}, | }, | ||||
@@ -213,14 +239,12 @@ export default { | |||||
const { currentPage: pageNum, pageSize } = page; | const { currentPage: pageNum, pageSize } = page; | ||||
console.log("pageNum=", pageNum); | console.log("pageNum=", pageNum); | ||||
console.log("pageSize=", pageSize); | console.log("pageSize=", pageSize); | ||||
return { | |||||
data: { | |||||
list: [{ a: "111" }], | |||||
page: { | |||||
total: 10, | |||||
}, | |||||
}, | |||||
const params = { | |||||
pageNum, | |||||
pageSize, | |||||
...form, | |||||
}; | }; | ||||
return getTherapeuticListApi(params); | |||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
@@ -232,12 +256,14 @@ export default { | |||||
}, | }, | ||||
deptOptions: [], | deptOptions: [], | ||||
visible: false, | visible: false, | ||||
editId: null, | |||||
}; | }; | ||||
}, | }, | ||||
methods: { | methods: { | ||||
init() { | init() { | ||||
this.getWardOptions(); | this.getWardOptions(); | ||||
this.getDeptOptions(); | this.getDeptOptions(); | ||||
this.getDiseaseOptions(); | |||||
}, | }, | ||||
// 获取院区下拉选项 | // 获取院区下拉选项 | ||||
async getWardOptions() { | async getWardOptions() { | ||||
@@ -254,14 +280,19 @@ export default { | |||||
// 院区改变 | // 院区改变 | ||||
onChangeWard({ data }) { | onChangeWard({ data }) { | ||||
data.deptId = null; | data.deptId = null; | ||||
this.deptOptions = []; | |||||
this.getDeptOptions(data.wardId); | |||||
data.medicalLabelId = null; | |||||
const { wardId } = data; | |||||
const params = { | |||||
wardId, | |||||
}; | |||||
this.getDeptOptions(params); | |||||
this.getDiseaseOptions(params); | |||||
}, | }, | ||||
// 获取科室选项 | // 获取科室选项 | ||||
async getDeptOptions(wardId) { | |||||
async getDeptOptions(params = {}) { | |||||
const [err, res] = await to( | const [err, res] = await to( | ||||
getTreeHospDept({ | getTreeHospDept({ | ||||
wardId: wardId || undefined, | |||||
...params, | |||||
}) | }) | ||||
); | ); | ||||
console.log("err=", err); | console.log("err=", err); | ||||
@@ -271,19 +302,44 @@ export default { | |||||
} | } | ||||
this.deptOptions = res.data || []; | this.deptOptions = res.data || []; | ||||
}, | }, | ||||
onChangeDept(formData) { | |||||
formData.medicalLabelId = null; | |||||
console.log("deptId=", deptId); | |||||
const { wardId, deptId } = formData; | |||||
const params = { wardId, deptId }; | |||||
this.getDiseaseOptions(params); | |||||
}, | |||||
// 获取疾病选项 | |||||
async getDiseaseOptions(params = {}) { | |||||
const [err, res] = await to( | |||||
diseasePageList({ | |||||
pageNum: 1, | |||||
pageSize: 100, | |||||
...params, | |||||
}) | |||||
); | |||||
await this.$nextTick(); | |||||
const formItem = this.$refs.gridRef.getFormItems(2); | |||||
if (err) { | |||||
formItem.itemRender.options = []; | |||||
return; | |||||
} | |||||
formItem.itemRender.options = res.data?.list; | |||||
}, | |||||
getTableList() { | getTableList() { | ||||
this.$nextTick(() => { | this.$nextTick(() => { | ||||
this.$refs.gridRef.commitProxy("query"); | this.$refs.gridRef.commitProxy("query"); | ||||
}); | }); | ||||
}, | }, | ||||
onAdd() { | onAdd() { | ||||
this.editId = null; | |||||
this.visible = true; | this.visible = true; | ||||
}, | }, | ||||
// 编辑 | // 编辑 | ||||
onEdit(row) { | onEdit(row) { | ||||
// const { id, deptId, name } = row; | |||||
// this.initFormData = { id, deptId, name }; | |||||
this.initFormData = { ...row }; | |||||
console.log("row=", row); | |||||
const { id } = row; | |||||
this.editId = id; | |||||
this.visible = true; | this.visible = true; | ||||
}, | }, | ||||
// 删除 | // 删除 | ||||
@@ -291,18 +347,13 @@ export default { | |||||
this.$modal | this.$modal | ||||
.confirm("是否确认删除?") | .confirm("是否确认删除?") | ||||
.then(async () => { | .then(async () => { | ||||
const [err, _] = await to( | |||||
deleteComplexApi({ | |||||
id: row.id, | |||||
}) | |||||
); | |||||
console.log("row.id", row.id); | |||||
const [err, _] = await to(delTherapeuticApi(row.id)); | |||||
this.getTableList(); | |||||
if (err) { | if (err) { | ||||
this.$message.success("操作失败"); | |||||
this.getTableList(); | |||||
return; | return; | ||||
} | } | ||||
this.$message.success("操作成功"); | this.$message.success("操作成功"); | ||||
this.getTableList(); | |||||
}) | }) | ||||
.catch(() => {}); | .catch(() => {}); | ||||
}, | }, | ||||
@@ -312,13 +363,13 @@ export default { | |||||
await this.$nextTick(); | await this.$nextTick(); | ||||
const checkedData = this.$refs.gridRef.getCheckboxRecords(true); | const checkedData = this.$refs.gridRef.getCheckboxRecords(true); | ||||
console.log("checkedData=", checkedData); | console.log("checkedData=", checkedData); | ||||
// const labelIdList = checkedData.map((item) => item.id); | |||||
// const [err, res] = await to(batchDeleteOperatorApi({ labelIdList })); | |||||
// if (err) { | |||||
// return; | |||||
// } | |||||
// this.$message.success("操作成功"); | |||||
// this.getTableList(); | |||||
const ids = checkedData.map((item) => item.id); | |||||
const [err, _] = await to(batchDelTherapeuticApi(ids)); | |||||
this.getTableList(); | |||||
if (err) { | |||||
return; | |||||
} | |||||
this.$message.success("操作成功"); | |||||
}); | }); | ||||
}, | }, | ||||
}, | }, | ||||