Kaynağa Gözat

fix: 导入

master
yinsiyu 4 hafta önce
ebeveyn
işleme
493ad31574
3 değiştirilmiş dosya ile 45 ekleme ve 10 silme
  1. BIN
      public/template/therapeuticTemplate.xlsx
  2. +21
    -7
      src/api/dictManage/therapeutic.js
  3. +24
    -3
      src/views/dictManage/therapeuticRegimen/list/index.vue

BIN
public/template/therapeuticTemplate.xlsx Dosyayı Görüntüle


+ 21
- 7
src/api/dictManage/therapeutic.js Dosyayı Görüntüle

@@ -1,6 +1,6 @@
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) {
return request({
url: `${BASE_URL}/medical-treatment-plan`,
url: `${BASE_URL}`,
method: "get",
params,
});
@@ -17,7 +17,7 @@ export function getTherapeuticListApi(params) {
// 新增治疗方案
export function addTherapeuticApi(data) {
return request({
url: `${BASE_URL}/medical-treatment-plan`,
url: `${BASE_URL}`,
method: "post",
data,
});
@@ -26,7 +26,7 @@ export function addTherapeuticApi(data) {
// 编辑治疗方案
export function editTherapeuticApi(data) {
return request({
url: `${BASE_URL}/medical-treatment-plan`,
url: `${BASE_URL}`,
method: "put",
data,
});
@@ -35,22 +35,36 @@ export function editTherapeuticApi(data) {
// 批量删除
export function batchDelTherapeuticApi(data) {
return request({
url: `${BASE_URL}/medical-treatment-plan`,
url: `${BASE_URL}`,
method: "delete",
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) {
return request({
url: `${BASE_URL}/medical-treatment-plan/${id}`,
url: `${BASE_URL}/${id}`,
method: "get",
});
}
// 治疗方案详情
export function delTherapeuticApi(id) {
return request({
url: `${BASE_URL}/medical-treatment-plan/${id}`,
url: `${BASE_URL}/${id}`,
method: "get",
});
}

+ 24
- 3
src/views/dictManage/therapeuticRegimen/list/index.vue Dosyayı Görüntüle

@@ -2,7 +2,7 @@
<div class="app-container">
<vxe-grid ref="gridRef" v-bind="gridConfig">
<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
@@ -24,14 +24,15 @@
:multiple="false"
:limit="1"
:show-file-list="false"
:http-request="handleUpload"
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>
</el-upload>
<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>
</a>
@@ -58,9 +59,11 @@
:id="editId"
:getTableList="getTableList"
/>
<ImportResultPopup ref="importResult" />
</div>
</template>
<script>
import ImportResultPopup from "@/components/ImportResultPopup";
import AddTherapeuticDialog from "./components/AddTherapeuticDialog.vue";
import { commonGridConfig2 } from "@/config/vxeGrid";
import { getAllHospital } from "@/api/dictManage/hosp";
@@ -70,6 +73,7 @@ import {
getTherapeuticListApi,
delTherapeuticApi,
batchDelTherapeuticApi,
bathImportTherapeuticApi,
} from "@/api/dictManage/therapeutic";
import { diseasePageList } from "@/api/dictManage/disease";
import { to } from "await-to-js";
@@ -78,6 +82,7 @@ export default {
components: {
TreeDept,
AddTherapeuticDialog,
ImportResultPopup,
},
data() {
return {
@@ -255,6 +260,7 @@ export default {
},
},
deptOptions: [],
uploading: false,
visible: false,
editId: null,
};
@@ -358,6 +364,21 @@ export default {
})
.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() {
this.$modal.confirm("是否确认批量删除?").then(async () => {


Yükleniyor…
İptal
Kaydet