@@ -82,7 +82,7 @@ class Form extends Model {
if(isset($params[$v['id']]) && $params[$v['id']]){
$whereT['id'] = array('in',$params[$v['id']]);
- $fileinfo = File::where($whereT)->field('id,name,file_path,save_name')->select();
+ $fileinfo = File::where($whereT)->field('id,types,name,file_path,save_name')->select();
$fileinfo=collection($fileinfo)->toArray();
$params[$v['id']] = $fileinfo;
@@ -110,9 +110,16 @@
<span class="text-muted">{$val.config.label}:</span>
{if condition="isset($row[$val['id']]) && $row[$val['id']] neq ''"}
{foreach name="$row[$val['id']]" id="v" k="key"}
+
+ {if condition="$v.types eq 'application/pdf' || $v.types eq 'text/plain'"}
+ <a href="{:$v.file_path??''}" download="" style="margin-right:10px;">
+ {$v.name}
+ </a>
+ {else}
<a href="{:$v.file_path??''}" target="_blank" style="margin-right:10px;">
{$v.name}
</a>
+ {/if}
{/foreach}
{/if}
</div>
@@ -55,7 +55,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return '';
},operate:true},
{field : 'file', title : '文件', formatter : function (value, row, index) {
-
$file = '';
for (i=0;i<value.length;i++){
if(value[i]["types"] == "application/pdf" ||value[i]["types"] == "text/plain"){