* [task#141578,doing,1h] add create & ajax get model list.

This commit is contained in:
sunguangming
2025-04-16 10:18:25 +08:00
committed by 刘刚
parent d350da361c
commit 81ae731992
+38 -2
View File
@@ -24,8 +24,44 @@ class deliverable extends control
*/
public function create()
{
if($_POST)
{
$files = $this->loadModel('file')->getUpload();
if(empty($files[0]['title'])) return $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->error->notempty, $this->lang->deliverable->files)));
$deliverable = form::data($this->config->deliverable->form->create)
->add('createdBy', $this->app->user->account)
->add('createdDate', helper::today())
->get();
$this->deliverable->create($deliverable);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->sendSuccess(array('load' => inlink('browse')));
}
$this->view->title = $this->lang->deliverable->create;
$this->view->modelList = $this->deliverable->buildModelList();
$this->view->modelList = $this->deliverable->buildModelList('all');
$this->display();
}
}
/**
* Ajax获取交付物适用范围列表。
* Ajax get deliverable model list.
*
* @param string $type execution|project
* @access public
* @return void
*/
public function ajaxGetModelList($type = 'execution')
{
$items = array();
$modelList = $this->deliverable->buildModelList($type);
foreach($modelList as $key => $value)
{
$items[] = array('value' => $key, 'text' => $value);
}
return print(json_encode($items));
}
}