<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Tracking\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Auth\AdminPermission; use ModStart\Admin\Concern\HasAdminQuickCRUD; use ModStart\Admin\Layout\AdminCRUDBuilder; use ModStart\Admin\Layout\AdminPage; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Input\Request; use ModStart\Core\Input\Response; use ModStart\Field\AbstractField; use ModStart\Field\AutoRenderedFieldValue; use ModStart\Form\Form; use ModStart\Grid\GridFilter; use ModStart\Support\Concern\HasFields; use ModStart\Widget\Box; use Module\Tracking\Util\CodeUtil; class CodeProcessItemController extends Controller { use HasAdminQuickCRUD; protected function crud(AdminCRUDBuilder $P0Vsm) { $P0Vsm->init('tracking_code_process_item')->field(function ($P0Vsm) { $P0Vsm->id('id', 'ID'); $P0Vsm->display('codeId', '防伪码')->hookRendering(function (AbstractField $aR4e2, $lDvaK, $POXOb) { $MipNh = ModelUtil::get('tracking_code', $lDvaK->codeId); return AutoRenderedFieldValue::make($MipNh['code']); }); $P0Vsm->select('processId', '流程类别')->required()->optionModel('tracking_code_process', 'id', 'title'); $P0Vsm->text('operator', '操作员'); $P0Vsm->datetime('operateTime', '操作时间'); $P0Vsm->text('remark', '流程记录说明'); $P0Vsm->display('created_at', L('Created At'))->listable(false); $P0Vsm->display('updated_at', L('Updated At'))->listable(false); })->gridFilter(function (GridFilter $roX32) { $roX32->eq('id', L('ID')); $roX32->eq('codeId', '防伪码ID'); })->canAdd(false)->formClass('wide')->title('溯源流程'); } public function create(AdminPage $DNh5u) { goto hi889; QEHQc: $ypG_B->text('operator', '操作员')->help('填写负责人姓名或工号'); goto qp_jp; AyIuP: $ypG_B->textarea('transportCodes', '录入物流码')->placeholder('一行一个，回车换行 , 支持扫描枪')->help('录入物流码，支持扫描枪'); goto G_GPK; hi889: $ypG_B = Form::make('')->formClass('wide'); goto Sw67e; fkSIc: if (Request::isPost()) { return $ypG_B->formRequest(function (Form $ypG_B) { AdminPermission::demoCheck(); $xJzrK = $ypG_B->dataForming(); $UqwoT = CodeUtil::getCodeIdsByTransportCodes($xJzrK['transportCodes']); $Dj64C = array('processId' => $xJzrK['processId'], 'operator' => $xJzrK['operator'], 'operateTime' => $xJzrK['operateTime'], 'remark' => $xJzrK['remark']); ModelUtil::transactionBegin(); foreach ($UqwoT as $pq22a) { $umZPe = array('codeId' => $pq22a); ModelUtil::insert('tracking_code_process_item', array_merge($Dj64C, $umZPe)); } ModelUtil::transactionCommit(); return Response::generate(0, '批量录入流程记录成功', null, action('\\' . __CLASS__ . '@index')); }); } goto NgSfn; Sw67e: $ypG_B->select('processId', '选择流程类别')->optionModel('tracking_code_process', 'id', 'title')->required(); goto AyIuP; NgSfn: return $DNh5u->pageTitle('录入流程记录')->row(new Box('通过流程记录用户可以查看到详细的生产流程记录信息。操作员或经销商通过后台将每个流程按物流码录入，系统会根据物流码自动显示在对应的防伪码查询结果页面。', '使用说明'))->row(new Box($ypG_B, '录入流程记录')); goto lf6XI; G_GPK: $ypG_B->text('remark', '流程记录说明')->help('在此输入流程记录的简要说明'); goto QEHQc; qp_jp: $ypG_B->datetime('operateTime', '操作时间')->help('选择流程发生的时间！将会展示在流程追溯内容和列表中')->defaultValue(date('Y-m-d H:i:s')); goto fkSIc; lf6XI: } }