下载报告改名

main
yanzai 8 months ago
parent 22f3a87cfa
commit 430233f406

@ -17,6 +17,8 @@ class ReportController extends Controller
"查询密码" => $request->post('password'),
"文件Id" => $request->post('id')
];
$reportname=$request->post('reportname');
$username=$request->post('name');
$hospital_info = Hospital::where('id', $request->post('hospital'))->where('del', 2)->first();
if (!$hospital_info) Yo::error_echo(100000, ['机构/医院']);
$code = $hospital_info->code;
@ -38,6 +40,7 @@ class ReportController extends Controller
$disk = Storage::disk('public');
$name = $request->post('id');
$date = $request->post('rid');
$name=$username.$data['体检号'].$reportname.'_'.$name;
$path = "/assets/upload/pdf/$date/$name.pdf";
$put = $disk->put($path, $res_string);
if (!$put) Yo::error_echo(100028, ['put']);
@ -555,6 +558,7 @@ class ReportController extends Controller
// ]);
$list['info']['id'] = $info['体检号'];
$list['info']['name'] = $info['姓名'];
$list['info']['password'] = $info['查询密码'];
$list['list'] = $info['报告文件列表'];
$conclusion = [

@ -35,7 +35,20 @@
success: function(res) {
downLoadOk.value = true
filePath.value = res.tempFilePath;
const newFilePath = `${wx.env.USER_DATA_PATH}/${e.url.split('/').pop()}`;
uni.saveFile({
tempFilePath:res.tempFilePath, //
filePath: newFilePath, //
success: (saveResult) => {
console.log("文件保存成功,新路径为:", saveResult.savedFilePath);
filePath.value= saveResult.savedFilePath
},
fail: (saveErr) => {
console.error("文件保存失败:", saveErr);
reject(saveErr);
}
});
},
});

@ -32,12 +32,15 @@
const popup=ref(null)
let url = ref('')
const ReportDown = async (id) => {
const ReportDown = async (id,index) => {
uni.showLoading({
title: '正在查询报告...'
})
console.log(props.list);
const response = await ReportDownAction({
rid: props.list.info.id,
reportname:props.list.list[index].报告名称,
name:props.list.info.name,
password: props.list.info.password,
id,
})
@ -137,7 +140,7 @@
</view>
<view class="report_list_wrapper">
<!-- <view @click="tiao()"></view> -->
<view @click="ReportDown(i['文件Id'])" class="report_item_wrapper" v-for="(i,k) in props.list.list" :key="k">
<view @click="ReportDown(i['文件Id'],k)" class="report_item_wrapper" v-for="(i,k) in props.list.list" :key="k">
<view class="report_item_icon_wrapper">
<image :src="$image('/storage/assets/report/home/报告@2x.png')"></image>
</view>

Loading…
Cancel
Save