Browse Source

导出函数调整

newMaster
1747191978@qq.com 4 months ago
parent
commit
131163330c
  1. 3
      acupuncture-前台/src/main.js
  2. 33
      acupuncture-前台/src/utils/request.js
  3. 42
      acupuncture-前台/src/views/patientFile/index.vue

3
acupuncture-前台/src/main.js

@ -12,7 +12,7 @@ import store from './store'
import router from './router' import router from './router'
import directive from './directive' // directive import directive from './directive' // directive
import plugins from './plugins' // plugins import plugins from './plugins' // plugins
import { download } from '@/utils/request' import { download, download1} from '@/utils/request'
import moment from 'moment'; import moment from 'moment';
import './assets/icons' // icon import './assets/icons' // icon
@ -48,6 +48,7 @@ Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download Vue.prototype.download = download
Vue.prototype.download1 = download1
Vue.prototype.handleTree = handleTree Vue.prototype.handleTree = handleTree
Vue.prototype.$moment = moment Vue.prototype.$moment = moment

33
acupuncture-前台/src/utils/request.js

@ -148,5 +148,38 @@ export function download(url, params, filename, config) {
downloadLoadingInstance.close(); downloadLoadingInstance.close();
}) })
} }
// 通用下载方法
export function download1(url, params, filename, config) {
downloadLoadingInstance = Loading.service({
text: "正在下载数据,请稍候",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
});
return service
.post(url, params, {
headers: { "Content-Type": "application/json;charset=utf-8" },
responseType: "blob",
})
.then(async (data) => {
const isBlob = blobValidate(data);
if (isBlob) {
const blob = new Blob([data]);
saveAs(blob, filename);
} else {
const resText = await data.text();
const rspObj = JSON.parse(resText);
const errMsg =
errorCode[rspObj.code] || rspObj.msg || errorCode["default"];
Message.error(errMsg);
}
downloadLoadingInstance.close();
})
.catch((r) => {
console.error(r);
Message.error("下载文件出现错误,请联系管理员!");
downloadLoadingInstance.close();
});
}
export default service export default service

42
acupuncture-前台/src/views/patientFile/index.vue

@ -33,7 +33,7 @@
/> />
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="建档组织" prop="tenantId"> <!-- <el-form-item label="建档组织" prop="tenantId">
<el-select <el-select
v-model="queryParams.param.tenantId" v-model="queryParams.param.tenantId"
placeholder="请选择" placeholder="请选择"
@ -41,7 +41,7 @@
> >
<el-option label="dict.label" value="dict.value" /> <el-option label="dict.label" value="dict.value" />
</el-select> </el-select>
</el-form-item> </el-form-item> -->
<el-form-item label="数据来源" prop="sourceId"> <el-form-item label="数据来源" prop="sourceId">
<el-select <el-select
v-model="queryParams.param.sourceId" v-model="queryParams.param.sourceId"
@ -96,7 +96,7 @@
icon="el-icon-bottom" icon="el-icon-bottom"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDownload"
>下载模版</el-button >下载模版</el-button
> >
</el-col> </el-col>
@ -133,13 +133,14 @@
max-height="600" max-height="600"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="姓名" align="center" prop="name" width="100" /> <el-table-column label="姓名" align="center" prop="name" width="100" fixed/>
<el-table-column <el-table-column
label="性别" label="性别"
align="center" align="center"
prop="gender" prop="gender"
show-overflow-tooltip show-overflow-tooltip
width="100" width="100"
fixed
> >
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.gender == 0"></span> <span v-if="scope.row.gender == 0"></span>
@ -153,6 +154,7 @@
prop="birthDate" prop="birthDate"
show-overflow-tooltip show-overflow-tooltip
width="150" width="150"
fixed
/> />
<el-table-column <el-table-column
label="民族" label="民族"
@ -204,11 +206,11 @@
<el-table-column <el-table-column
label="建档组织(医院名称)" label="建档组织(医院名称)"
align="center" align="center"
prop="organization" prop="tenantName"
show-overflow-tooltip show-overflow-tooltip
width="150" width="150"
/> />
<el-table-column label="建档日期" align="center" width="130"> <el-table-column label="建档日期" align="center" width="140">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ <span>{{
parseTime(scope.row.createTime, "{y}-{m}-{d} {h}:{i}") parseTime(scope.row.createTime, "{y}-{m}-{d} {h}:{i}")
@ -224,9 +226,9 @@
width="100" width="100"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.gender == 0">筛查</span> <span v-if="scope.row.source == 0">筛查</span>
<span v-if="scope.row.gender == 1">录入</span> <span v-if="scope.row.source == 1">录入</span>
<span v-if="scope.row.gender == 2">HIS</span> <span v-if="scope.row.source == 2">HIS</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column fixed="right" label="操作" align="center" width="150"> <el-table-column fixed="right" label="操作" align="center" width="150">
@ -256,7 +258,7 @@
size="mini" size="mini"
type="text" type="text"
icon="el-icon-notebook-2" icon="el-icon-notebook-2"
@click="handleDelete(scope.row)" @click="handleArchives(scope.row)"
>诊疗档案</el-button >诊疗档案</el-button
> >
</template> </template>
@ -422,7 +424,7 @@ export default {
Authorization: "Bearer " + getToken(), Authorization: "Bearer " + getToken(),
deptId: localStorage.getItem("hospitalId"), deptId: localStorage.getItem("hospitalId"),
}, },
uploadFileUrl1: process.env.VUE_APP_BASE_API + "/pms/importTjbgZip", // uploadFileUrl1: process.env.VUE_APP_API_QZURL + "/acupuncture/patient/import", //
fileList: [], fileList: [],
// //
medicalHistory: [ medicalHistory: [
@ -462,6 +464,10 @@ export default {
label: "台湾居民来往大陆通行证", label: "台湾居民来往大陆通行证",
value: 3, value: 3,
}, },
{
label: "台湾居民来往大陆通行证",
value: 3,
},
], ],
idCardTypeValue: { idCardTypeValue: {
0: "身份证", 0: "身份证",
@ -672,14 +678,24 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download( this.download1(
"system/user/export", "/patient/export",
{ {
...this.queryParams.params, ...this.queryParams.params,
}, },
`患者档案.xlsx` `患者档案.xlsx`
); );
}, },
/** 下载按钮操作 */
handleDownload() {
this.download1(
"/patient/export",
{
...this.queryParams.params,
},
`患者档案.xlsx`
);
},
/** 导入按钮操作 */ /** 导入按钮操作 */
handleImport() { handleImport() {
this.upload.title = "用户导入"; this.upload.title = "用户导入";

Loading…
Cancel
Save