Procházet zdrojové kódy

fix: 导入

master
yinsiyu před 4 týdny
rodič
revize
493ad31574
3 změnil soubory, kde provedl 45 přidání a 10 odebrání
  1. binární
      public/template/therapeuticTemplate.xlsx
  2. +21
    -7
      src/api/dictManage/therapeutic.js
  3. +24
    -3
      src/views/dictManage/therapeuticRegimen/list/index.vue

binární
public/template/therapeuticTemplate.xlsx Zobrazit soubor


+ 21
- 7
src/api/dictManage/therapeutic.js Zobrazit soubor

@@ -1,6 +1,6 @@
import request from "@/utils/request"; import request from "@/utils/request";


const BASE_URL = "/internal";
const BASE_URL = "/internal/medical-treatment-plan";


/** /**
* 治疗方案 * 治疗方案
@@ -8,7 +8,7 @@ const BASE_URL = "/internal";
// 治疗方案列表 // 治疗方案列表
export function getTherapeuticListApi(params) { export function getTherapeuticListApi(params) {
return request({ return request({
url: `${BASE_URL}/medical-treatment-plan`,
url: `${BASE_URL}`,
method: "get", method: "get",
params, params,
}); });
@@ -17,7 +17,7 @@ export function getTherapeuticListApi(params) {
// 新增治疗方案 // 新增治疗方案
export function addTherapeuticApi(data) { export function addTherapeuticApi(data) {
return request({ return request({
url: `${BASE_URL}/medical-treatment-plan`,
url: `${BASE_URL}`,
method: "post", method: "post",
data, data,
}); });
@@ -26,7 +26,7 @@ export function addTherapeuticApi(data) {
// 编辑治疗方案 // 编辑治疗方案
export function editTherapeuticApi(data) { export function editTherapeuticApi(data) {
return request({ return request({
url: `${BASE_URL}/medical-treatment-plan`,
url: `${BASE_URL}`,
method: "put", method: "put",
data, data,
}); });
@@ -35,22 +35,36 @@ export function editTherapeuticApi(data) {
// 批量删除 // 批量删除
export function batchDelTherapeuticApi(data) { export function batchDelTherapeuticApi(data) {
return request({ return request({
url: `${BASE_URL}/medical-treatment-plan`,
url: `${BASE_URL}`,
method: "delete", method: "delete",
data, data,
}); });
} }
// 批量导入
export function bathImportTherapeuticApi(file) {
const formData = new FormData();
formData.append("file", file);
return request({
url: `${BASE_URL}/import`,
timeout: 60 * 1000 * 10, // 10分钟
method: "post",
data: formData,
headers: {
"Content-Type": "multipart/form-data",
},
});
}
// 治疗方案详情 // 治疗方案详情
export function getTherapeuticApi(id) { export function getTherapeuticApi(id) {
return request({ return request({
url: `${BASE_URL}/medical-treatment-plan/${id}`,
url: `${BASE_URL}/${id}`,
method: "get", method: "get",
}); });
} }
// 治疗方案详情 // 治疗方案详情
export function delTherapeuticApi(id) { export function delTherapeuticApi(id) {
return request({ return request({
url: `${BASE_URL}/medical-treatment-plan/${id}`,
url: `${BASE_URL}/${id}`,
method: "get", method: "get",
}); });
} }

+ 24
- 3
src/views/dictManage/therapeuticRegimen/list/index.vue Zobrazit soubor

@@ -2,7 +2,7 @@
<div class="app-container"> <div class="app-container">
<vxe-grid ref="gridRef" v-bind="gridConfig"> <vxe-grid ref="gridRef" v-bind="gridConfig">
<template #toolbar_button_d="{ $grid }"> <template #toolbar_button_d="{ $grid }">
<vxe-button status="success" icon="vxe-icon-add" class="mr-10" @click="onAdd">
<vxe-button status="primary" icon="vxe-icon-add" class="mr-10" @click="onAdd">
新增治疗方案 新增治疗方案
</vxe-button> </vxe-button>
<vxe-button <vxe-button
@@ -24,14 +24,15 @@
:multiple="false" :multiple="false"
:limit="1" :limit="1"
:show-file-list="false" :show-file-list="false"
:http-request="handleUpload"
auto-upload auto-upload
> >
<vxe-button status="primary" icon="vxe-icon-upload" class="mr-10">
<vxe-button status="success" icon="vxe-icon-upload" class="mr-10">
批量导入数据 批量导入数据
</vxe-button> </vxe-button>
</el-upload> </el-upload>
<a :href="exportTemplateUrl" download="批量导入治疗方案模版.xlsx"> <a :href="exportTemplateUrl" download="批量导入治疗方案模版.xlsx">
<vxe-button status="success" icon="vxe-icon-download" class="mr-10">
<vxe-button status="danger" icon="vxe-icon-download" class="mr-10">
下载数据模板 下载数据模板
</vxe-button> </vxe-button>
</a> </a>
@@ -58,9 +59,11 @@
:id="editId" :id="editId"
:getTableList="getTableList" :getTableList="getTableList"
/> />
<ImportResultPopup ref="importResult" />
</div> </div>
</template> </template>
<script> <script>
import ImportResultPopup from "@/components/ImportResultPopup";
import AddTherapeuticDialog from "./components/AddTherapeuticDialog.vue"; import AddTherapeuticDialog from "./components/AddTherapeuticDialog.vue";
import { commonGridConfig2 } from "@/config/vxeGrid"; import { commonGridConfig2 } from "@/config/vxeGrid";
import { getAllHospital } from "@/api/dictManage/hosp"; import { getAllHospital } from "@/api/dictManage/hosp";
@@ -70,6 +73,7 @@ import {
getTherapeuticListApi, getTherapeuticListApi,
delTherapeuticApi, delTherapeuticApi,
batchDelTherapeuticApi, batchDelTherapeuticApi,
bathImportTherapeuticApi,
} from "@/api/dictManage/therapeutic"; } from "@/api/dictManage/therapeutic";
import { diseasePageList } from "@/api/dictManage/disease"; import { diseasePageList } from "@/api/dictManage/disease";
import { to } from "await-to-js"; import { to } from "await-to-js";
@@ -78,6 +82,7 @@ export default {
components: { components: {
TreeDept, TreeDept,
AddTherapeuticDialog, AddTherapeuticDialog,
ImportResultPopup,
}, },
data() { data() {
return { return {
@@ -255,6 +260,7 @@ export default {
}, },
}, },
deptOptions: [], deptOptions: [],
uploading: false,
visible: false, visible: false,
editId: null, editId: null,
}; };
@@ -358,6 +364,21 @@ export default {
}) })
.catch(() => {}); .catch(() => {});
}, },
// 导入
async handleUpload({ file }) {
this.uploading = true;
try {
const res = await bathImportTherapeuticApi(file);
if (res.data.successSize > 0) {
// 刷新
this.getTableList();
}
this.$refs.importResult.open(res.data);
} finally {
this.$refs.upload.clearFiles();
this.uploading = false;
}
},
// 批量删除 // 批量删除
onBatchDel() { onBatchDel() {
this.$modal.confirm("是否确认批量删除?").then(async () => { this.$modal.confirm("是否确认批量删除?").then(async () => {


Načítá se…
Zrušit
Uložit