public function __construct($data = array()) { parent::__construct($data); $this->setPropertiesDefine(array('sample_no' => array('getter' => function (SampleProduceOrderMapSamples $item) { if (!$item->sample_id) { return ''; } return Sample::findOneByPk($item->sample_id)->sample_no; }), 'sample' => array('getter' => function (SampleProduceOrderMapSamples $item) { if (!$item->sample_id) { return ''; } return Sample::findOneByPk($item->sample_id); }), 'sample_type_name' => array('getter' => function (SampleProduceOrderMapSamples $item) { if (!$item->sample_id) { return ''; } return Sample::findOneByPk($item->sample_id)->sample_type_name; }), 'produce_type_text' => array('getter' => function (SampleProduceOrderMapSamples $item) { $def = self::getPropertiesDefine('produce_type'); return $def['options'][$item->produce_type]; }), 'image_list' => array('getter' => function (SampleProduceOrderMapSamples $item) { $tmp = SampleImage::find('sample_id=?', $item->sample_id)->all(); return array_column($tmp, 'image_url'); }), 'produce_state' => array('getter' => function (self $item) { if ($item->produce_employee_id && $item->produce_process_state) { $process_n = WorkProcess::findOneByPk($item->produce_process_state)->name; $employee_n = Employee::findOneByPk($item->produce_employee_id)->name; return "{$process_n}({$employee_n})"; } return ''; }))); }
public function __construct($data = array()) { $this->setPropertiesDefine(array('work_process' => array('options' => function () { $tmp = WorkProcess::find()->all(true); return $tmp ? array_combine(array_column($tmp, 'id'), array_column($tmp, 'name')) : array(); }))); parent::__construct($data); }
public function info($get) { $id = $get['id']; $base_info = SampleProduceOrder::findOneByPk($id); $paginate = Paginate::instance(); $sample_list = SampleProduceOrderMapSamples::find('produce_order_id = ?', $id)->paginate($paginate); $sample_process_list = WorkProcess::find('work_stage_id=? AND state=?', WorkStage::SAMPLE_STATE_ID, WorkProcess::STATE_ENABLED)->all(); $deliver_info = SampleProduceOrderDeliverInfo::find('produce_order_id=?', $id)->one(); return array('base_info' => $base_info, 'deliver_info' => $deliver_info, 'paginate' => $paginate, 'sample_list' => $sample_list, 'sample_process_list' => $sample_process_list); }
public function index() { $process_list = array(); $all_process = WorkProcess::find()->all(true); $all_process = array_group($all_process, 'work_stage_id'); foreach (WorkStage::$work_stage_list as $stage_id => $name) { $rs = array(); $ps = $all_process[$stage_id] ?: array(); array_orderby($ps, 'ord', SORT_DESC); foreach ($ps as $p) { $rs[] = new WorkProcess($p); } $process_list[$stage_id] = $rs; } return array('process_list' => $process_list); }
<?php use Lite\Core\Config; use Lite\CRUD\ModelInterface; use Lite\DB\Model; use www\model\WorkProcess; use www\model\WorkStage; use function Lite\func\array_group; use function Lite\func\dump; use function Lite\func\h; /** @var ModelInterface|Model $model_instance */ include $this->resolveTemplate('inc/header.inc.php'); $pk = $model_instance->getPrimaryKey(); $extra_params = $this->getData('extra_params'); $update_fields = $this->getData('update_fields'); $all_process_list = WorkProcess::getProcessInOrder(); $all_process_list = array_group($all_process_list, 'work_stage_id'); ?> <div id="col-aside"> <?php echo $this->getSideMenu(); ?> </div> <div id="col-main"> <form action="<?php echo $this->getUrl($this->getController() . '/update', array($pk => $model_instance->{$pk})); ?> " class="frm" rel="async" method="post"> <input style="display:none"> <input type="password" style="display:none">