作者 王智

xiugai

... ... @@ -45,62 +45,62 @@ class FourBaogao extends Backend
/**
* 编辑
*/
public function edit($ids = null)
{
$row = $this->model->get($ids);
dump($row);
$Info = Db::name('four_baogao')->where('id', $ids)->find();
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
if (!in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$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 . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$this->assignconfig('SportType', $Info['sport_type']);
$this->assignconfig('FaceType', $Info['face_type']);
$this->assignconfig('SeasonType', $Info['season_type']);
$this->assignconfig('BodyType', $Info['body_type']);
$this->assignconfig('WorkType', $Info['work_type']);
$this->assignconfig('EatType', $Info['eat_type']);
$this->view->assign("row", $row);
return $this->view->fetch();
}
// public function edit($ids = null)
// {
// $row = $this->model->get($ids);
// dump($row);
// $Info = Db::name('four_baogao')->where('id', $ids)->find();
// if (!$row) {
// $this->error(__('No Results were found'));
// }
// $adminIds = $this->getDataLimitAdminIds();
// if (is_array($adminIds)) {
// if (!in_array($row[$this->dataLimitField], $adminIds)) {
// $this->error(__('You have no permission'));
// }
// }
// if ($this->request->isPost()) {
// $params = $this->request->post("row/a");
// if ($params) {
// $params = $this->preExcludeFields($params);
// $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 . '.edit' : $name) : $this->modelValidate;
// $row->validateFailException(true)->validate($validate);
// }
// $result = $row->allowField(true)->save($params);
// Db::commit();
// } catch (ValidateException $e) {
// Db::rollback();
// $this->error($e->getMessage());
// } catch (PDOException $e) {
// Db::rollback();
// $this->error($e->getMessage());
// } catch (Exception $e) {
// Db::rollback();
// $this->error($e->getMessage());
// }
// if ($result !== false) {
// $this->success();
// } else {
// $this->error(__('No rows were updated'));
// }
// }
// $this->error(__('Parameter %s can not be empty', ''));
// }
// $this->assignconfig('SportType', $Info['sport_type']);
// $this->assignconfig('FaceType', $Info['face_type']);
// $this->assignconfig('SeasonType', $Info['season_type']);
// $this->assignconfig('BodyType', $Info['body_type']);
// $this->assignconfig('WorkType', $Info['work_type']);
// $this->assignconfig('EatType', $Info['eat_type']);
// $this->view->assign("row", $row);
// return $this->view->fetch();
// }
/**
* 查看
... ...
... ... @@ -162,52 +162,67 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Controller.api.bindevent();
},
edit: function () {
// var SportType = Config.SportType;
// var EatType = Config.EatType;
// var SeasonType = Config.SeasonType;
// var BodyType = Config.BodyType;
// var WorkType = Config.WorkType;
// var FaceType = Config.FaceType;
// var web1 = document.getElementById("web1");
// var goods1 = document.getElementById("goods1");
// var web2 = document.getElementById("web2");
// var goods2 = document.getElementById("goods2");
// var web3 = document.getElementById("web3");
// var goods3 = document.getElementById("goods3");
// var web4 = document.getElementById("web4");
// var goods4 = document.getElementById("goods4");
// var web5 = document.getElementById("web5");
// var goods5 = document.getElementById("goods5");
// var web6 = document.getElementById("web6");
// var goods6 = document.getElementById("goods6");
// if (SportType == 1) {
// web1.style.display = 'none';
// goods1.style.display = 'block';
// } else {
// web1.style.display = 'block';
// goods1.style.display = 'none';
// }
// if (EatType == 1) {
// web2.style.display = 'none';
// goods2.style.display = 'block';
// } else {
// web2.style.display = 'block';
// goods2.style.display = 'none';
// }
// if (BodyType == 1) {
// web3.style.display = 'none';
// goods3.style.display = 'block';
// } else {
// web3.style.display = 'block';
// goods3.style.display = 'none';
// }
// if (SeasonType == 1) {
// web4.style.display = 'none';
// goods4.style.display = 'block';
// } else {
// web4.style.display = 'block';
// goods4.style.display = 'none';
// }
var SportType = Config.SportType;
var EatType = Config.EatType;
var SeasonType = Config.SeasonType;
var BodyType = Config.BodyType;
var WorkType = Config.WorkType;
var FaceType = Config.FaceType;
var web1 = document.getElementById("web1");
var goods1 = document.getElementById("goods1");
var web2 = document.getElementById("web2");
var goods2 = document.getElementById("goods2");
var web3 = document.getElementById("web3");
var goods3 = document.getElementById("goods3");
var web4 = document.getElementById("web4");
var goods4 = document.getElementById("goods4");
var web5 = document.getElementById("web5");
var goods5 = document.getElementById("goods5");
var web6 = document.getElementById("web6");
var goods6 = document.getElementById("goods6");
if (SportType == 1) {
web1.style.display = 'none';
goods1.style.display = 'block';
} else {
web1.style.display = 'block';
goods1.style.display = 'none';
}
if (EatType == 1) {
web2.style.display = 'none';
goods2.style.display = 'block';
} else {
web2.style.display = 'block';
goods2.style.display = 'none';
}
if (BodyType == 1) {
web3.style.display = 'none';
goods3.style.display = 'block';
} else {
web3.style.display = 'block';
goods3.style.display = 'none';
}
if (SeasonType == 1) {
web4.style.display = 'none';
goods4.style.display = 'block';
} else {
web4.style.display = 'block';
goods4.style.display = 'none';
}
if (WorkType == 1) {
web5.style.display = 'none';
goods5.style.display = 'block';
} else {
web5.style.display = 'block';
goods5.style.display = 'none';
}
if (FaceType == 1) {
web6.style.display = 'none';
goods6.style.display = 'block';
} else {
web6.style.display = 'block';
goods6.style.display = 'none';
}
// WorkType.onchange = function () {
// if (WorkType == 1) {
// web5.style.display = 'none';
// goods5.style.display = 'block';
... ... @@ -215,84 +230,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// web5.style.display = 'block';
// goods5.style.display = 'none';
// }
// if (FaceType == 1) {
// web6.style.display = 'none';
// goods6.style.display = 'block';
// } else {
// web6.style.display = 'block';
// goods6.style.display = 'none';
// }
// // WorkType.onchange = function () {
// // if (WorkType == 1) {
// // web5.style.display = 'none';
// // goods5.style.display = 'block';
// // } else {
// // web5.style.display = 'block';
// // goods5.style.display = 'none';
// // }
// // };
// // FaceType.onchange = function () {
// // if (FaceType == 1) {
// // web6.style.display = 'none';
// // goods6.style.display = 'block';
// // } else {
// // web6.style.display = 'block';
// // goods6.style.display = 'none';
// // }
// // };
// var SportType2 = document.getElementById("c-sport_type");
// var EatType2 = document.getElementById("c-eat_type");
// var SeasonType2 = document.getElementById("c-season_type");
// var BodyType2 = document.getElementById("c-body_type");
// var WorkType2 = document.getElementById("c-work_type");
// var FaceType2 = document.getElementById("c-face_type");
// SportType2.onchange = function () {
// if (SportType2.value == 1) {
// web1.style.display = 'none';
// goods1.style.display = 'block';
// } else {
// web1.style.display = 'block';
// goods1.style.display = 'none';
// }
// };
// EatType2.onchange = function () {
// if (EatType2.value == 1) {
// web2.style.display = 'none';
// goods2.style.display = 'block';
// } else {
// web2.style.display = 'block';
// goods2.style.display = 'none';
// }
// };
// BodyType2.onchange = function () {
// if (BodyType2.value == 1) {
// web3.style.display = 'none';
// goods3.style.display = 'block';
// } else {
// web3.style.display = 'block';
// goods3.style.display = 'none';
// }
// };
// SeasonType2.onchange = function () {
// if (SeasonType2.value == 1) {
// web4.style.display = 'none';
// goods4.style.display = 'block';
// } else {
// web4.style.display = 'block';
// goods4.style.display = 'none';
// }
// };
// WorkType2.onchange = function () {
// if (WorkType2.value == 1) {
// web5.style.display = 'none';
// goods5.style.display = 'block';
// } else {
// web5.style.display = 'block';
// goods5.style.display = 'none';
// }
// };
// FaceType2.onchange = function () {
// if (FaceType2.value == 1) {
// FaceType.onchange = function () {
// if (FaceType == 1) {
// web6.style.display = 'none';
// goods6.style.display = 'block';
// } else {
... ... @@ -300,6 +240,66 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// goods6.style.display = 'none';
// }
// };
var SportType2 = document.getElementById("c-sport_type");
var EatType2 = document.getElementById("c-eat_type");
var SeasonType2 = document.getElementById("c-season_type");
var BodyType2 = document.getElementById("c-body_type");
var WorkType2 = document.getElementById("c-work_type");
var FaceType2 = document.getElementById("c-face_type");
SportType2.onchange = function () {
if (SportType2.value == 1) {
web1.style.display = 'none';
goods1.style.display = 'block';
} else {
web1.style.display = 'block';
goods1.style.display = 'none';
}
};
EatType2.onchange = function () {
if (EatType2.value == 1) {
web2.style.display = 'none';
goods2.style.display = 'block';
} else {
web2.style.display = 'block';
goods2.style.display = 'none';
}
};
BodyType2.onchange = function () {
if (BodyType2.value == 1) {
web3.style.display = 'none';
goods3.style.display = 'block';
} else {
web3.style.display = 'block';
goods3.style.display = 'none';
}
};
SeasonType2.onchange = function () {
if (SeasonType2.value == 1) {
web4.style.display = 'none';
goods4.style.display = 'block';
} else {
web4.style.display = 'block';
goods4.style.display = 'none';
}
};
WorkType2.onchange = function () {
if (WorkType2.value == 1) {
web5.style.display = 'none';
goods5.style.display = 'block';
} else {
web5.style.display = 'block';
goods5.style.display = 'none';
}
};
FaceType2.onchange = function () {
if (FaceType2.value == 1) {
web6.style.display = 'none';
goods6.style.display = 'block';
} else {
web6.style.display = 'block';
goods6.style.display = 'none';
}
};
Controller.api.bindevent();
},
api: {
... ...