优化打印

This commit is contained in:
2021-04-03 22:50:24 +08:00
parent bab69fb3a1
commit 4560ef7c93
5 changed files with 26 additions and 39 deletions
@@ -302,39 +302,31 @@ class DeliveryController extends WorkflowController
$template_id = Request::get('template_id');
$template = DB::table('model_template')->where('id', $template_id)->first();
$print_type = $template['print_type'];
// 存在打印模板
$print_tpl = view()->exists(Request::controller().'.print.'.$template_id);
$this->layout = 'layouts.print_'.$print_type;
$form = [
'template' => $template,
];
// 自定义模板
if ($print_tpl) {
$data = DeliveryService::getPrintData($id);
$data['form'] = $form;
$data['template'] = $template;
$tpl = $this->display($data, 'print/'.$template_id);
return $print_type == 'pdf' ? print_prince($tpl) : $tpl;
}
$this->layout = 'layouts.print_'.$print_type;
// 打印插件
if ($print_type == 'stiReport') {
$data = DeliveryService::getPrintData($id);
$print_data = [
'master' => [$data['master']],
'money' => $data['money'],
'stock_delivery_data' => $data['rows'],
];
return $this->display([
'template' => $template,
'print_data' => $print_data,
]);
} else {
$print_tpl = view()->exists(Request::controller().'.print.'.$template_id);
if ($print_tpl) {
$data = DeliveryService::getPrintData($id);
$data['template'] = $template;
$tpl = $this->display($data, 'print/'.$template_id);
} else {
$tpl = $this->create('print');
}
return $print_type == 'pdf' ? print_prince($tpl) : $tpl;
}
// 默认模板
$tpl = $this->create('print');
return $print_type == 'pdf' ? print_prince($tpl) : $tpl;
}
// 物流信息