作者 开飞机的舒克

项目添加时取消场次下拉框选择

... ... @@ -3,6 +3,9 @@
namespace app\admin\controller;
use app\common\controller\Backend;
use think\Db;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 项目管理
... ... @@ -72,6 +75,47 @@ class Item extends Backend
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if (false === $this->request->isPost()) {
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
$params[$this->dataLimitField] = $this->auth->id;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException()->validate($validate);
}
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result === false) {
$this->error(__('No rows were inserted'));
}
$this->success();
}
/**
* 学生信息
*/
public function details($ids){
... ...
... ... @@ -15,7 +15,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Ronda_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-ronda_id" data-rule="required" data-source="ronda/index" class="form-control selectpage" data-field="title" name="row[ronda_id]" type="text" value="">
<input id="c-ronda_id" data-rule="required" data-source="ronda/index" class="form-control" data-field="id" name="row[ronda_id]" type="text" value="">
</div>
</div>
<div class="form-group">
... ...
... ... @@ -15,7 +15,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Ronda_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-ronda_id" data-rule="required" data-source="ronda/index" class="form-control selectpage" name="row[ronda_id]" data-field="title" type="text" value="{$row.ronda_id|htmlentities}">
<input id="c-ronda_id" data-rule="required" data-source="ronda/index" class="form-control" name="row[ronda.title]" data-field="title" type="text" value="{$row.ronda.title|htmlentities}">
</div>
</div>
<div class="form-group">
... ...
... ... @@ -5920,7 +5920,7 @@
</div>
<div class="col-md-6" align="right">
Generated on 2023-04-04 14:01:25 <a href="./" target="_blank">校园活动</a>
Generated on 2023-04-06 10:14:06 <a href="./" target="_blank">校园活动</a>
</div>
</div>
... ...