作者 王智

xiugai

@@ -45,62 +45,62 @@ class FourBaogao extends Backend @@ -45,62 +45,62 @@ class FourBaogao extends Backend
45 /** 45 /**
46 * 编辑 46 * 编辑
47 */ 47 */
48 - public function edit($ids = null)  
49 - {  
50 - $row = $this->model->get($ids);  
51 - dump($row);  
52 - $Info = Db::name('four_baogao')->where('id', $ids)->find();  
53 - if (!$row) {  
54 - $this->error(__('No Results were found'));  
55 - }  
56 - $adminIds = $this->getDataLimitAdminIds();  
57 - if (is_array($adminIds)) {  
58 - if (!in_array($row[$this->dataLimitField], $adminIds)) {  
59 - $this->error(__('You have no permission'));  
60 - }  
61 - }  
62 - if ($this->request->isPost()) {  
63 - $params = $this->request->post("row/a");  
64 - if ($params) {  
65 - $params = $this->preExcludeFields($params);  
66 - $result = false;  
67 - Db::startTrans();  
68 - try {  
69 - //是否采用模型验证  
70 - if ($this->modelValidate) {  
71 - $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));  
72 - $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;  
73 - $row->validateFailException(true)->validate($validate);  
74 - }  
75 - $result = $row->allowField(true)->save($params);  
76 - Db::commit();  
77 - } catch (ValidateException $e) {  
78 - Db::rollback();  
79 - $this->error($e->getMessage());  
80 - } catch (PDOException $e) {  
81 - Db::rollback();  
82 - $this->error($e->getMessage());  
83 - } catch (Exception $e) {  
84 - Db::rollback();  
85 - $this->error($e->getMessage());  
86 - }  
87 - if ($result !== false) {  
88 - $this->success();  
89 - } else {  
90 - $this->error(__('No rows were updated'));  
91 - }  
92 - }  
93 - $this->error(__('Parameter %s can not be empty', ''));  
94 - }  
95 - $this->assignconfig('SportType', $Info['sport_type']);  
96 - $this->assignconfig('FaceType', $Info['face_type']);  
97 - $this->assignconfig('SeasonType', $Info['season_type']);  
98 - $this->assignconfig('BodyType', $Info['body_type']);  
99 - $this->assignconfig('WorkType', $Info['work_type']);  
100 - $this->assignconfig('EatType', $Info['eat_type']);  
101 - $this->view->assign("row", $row);  
102 - return $this->view->fetch();  
103 - } 48 +// public function edit($ids = null)
  49 +// {
  50 +// $row = $this->model->get($ids);
  51 +// dump($row);
  52 +// $Info = Db::name('four_baogao')->where('id', $ids)->find();
  53 +// if (!$row) {
  54 +// $this->error(__('No Results were found'));
  55 +// }
  56 +// $adminIds = $this->getDataLimitAdminIds();
  57 +// if (is_array($adminIds)) {
  58 +// if (!in_array($row[$this->dataLimitField], $adminIds)) {
  59 +// $this->error(__('You have no permission'));
  60 +// }
  61 +// }
  62 +// if ($this->request->isPost()) {
  63 +// $params = $this->request->post("row/a");
  64 +// if ($params) {
  65 +// $params = $this->preExcludeFields($params);
  66 +// $result = false;
  67 +// Db::startTrans();
  68 +// try {
  69 +// //是否采用模型验证
  70 +// if ($this->modelValidate) {
  71 +// $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
  72 +// $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
  73 +// $row->validateFailException(true)->validate($validate);
  74 +// }
  75 +// $result = $row->allowField(true)->save($params);
  76 +// Db::commit();
  77 +// } catch (ValidateException $e) {
  78 +// Db::rollback();
  79 +// $this->error($e->getMessage());
  80 +// } catch (PDOException $e) {
  81 +// Db::rollback();
  82 +// $this->error($e->getMessage());
  83 +// } catch (Exception $e) {
  84 +// Db::rollback();
  85 +// $this->error($e->getMessage());
  86 +// }
  87 +// if ($result !== false) {
  88 +// $this->success();
  89 +// } else {
  90 +// $this->error(__('No rows were updated'));
  91 +// }
  92 +// }
  93 +// $this->error(__('Parameter %s can not be empty', ''));
  94 +// }
  95 +// $this->assignconfig('SportType', $Info['sport_type']);
  96 +// $this->assignconfig('FaceType', $Info['face_type']);
  97 +// $this->assignconfig('SeasonType', $Info['season_type']);
  98 +// $this->assignconfig('BodyType', $Info['body_type']);
  99 +// $this->assignconfig('WorkType', $Info['work_type']);
  100 +// $this->assignconfig('EatType', $Info['eat_type']);
  101 +// $this->view->assign("row", $row);
  102 +// return $this->view->fetch();
  103 +// }
104 104
105 /** 105 /**
106 * 查看 106 * 查看
@@ -162,128 +162,68 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -162,128 +162,68 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
162 Controller.api.bindevent(); 162 Controller.api.bindevent();
163 }, 163 },
164 edit: function () { 164 edit: function () {
165 - // var SportType = Config.SportType;  
166 - // var EatType = Config.EatType;  
167 - // var SeasonType = Config.SeasonType;  
168 - // var BodyType = Config.BodyType;  
169 - // var WorkType = Config.WorkType;  
170 - // var FaceType = Config.FaceType;  
171 - // var web1 = document.getElementById("web1");  
172 - // var goods1 = document.getElementById("goods1");  
173 - // var web2 = document.getElementById("web2");  
174 - // var goods2 = document.getElementById("goods2");  
175 - // var web3 = document.getElementById("web3");  
176 - // var goods3 = document.getElementById("goods3");  
177 - // var web4 = document.getElementById("web4");  
178 - // var goods4 = document.getElementById("goods4");  
179 - // var web5 = document.getElementById("web5");  
180 - // var goods5 = document.getElementById("goods5");  
181 - // var web6 = document.getElementById("web6");  
182 - // var goods6 = document.getElementById("goods6");  
183 - // if (SportType == 1) {  
184 - // web1.style.display = 'none';  
185 - // goods1.style.display = 'block';  
186 - // } else {  
187 - // web1.style.display = 'block';  
188 - // goods1.style.display = 'none';  
189 - // }  
190 - // if (EatType == 1) {  
191 - // web2.style.display = 'none';  
192 - // goods2.style.display = 'block';  
193 - // } else {  
194 - // web2.style.display = 'block';  
195 - // goods2.style.display = 'none';  
196 - // }  
197 - // if (BodyType == 1) {  
198 - // web3.style.display = 'none';  
199 - // goods3.style.display = 'block';  
200 - // } else {  
201 - // web3.style.display = 'block';  
202 - // goods3.style.display = 'none';  
203 - // }  
204 - // if (SeasonType == 1) {  
205 - // web4.style.display = 'none';  
206 - // goods4.style.display = 'block';  
207 - // } else {  
208 - // web4.style.display = 'block';  
209 - // goods4.style.display = 'none';  
210 - // }  
211 - // if (WorkType == 1) {  
212 - // web5.style.display = 'none';  
213 - // goods5.style.display = 'block';  
214 - // } else {  
215 - // web5.style.display = 'block';  
216 - // goods5.style.display = 'none';  
217 - // }  
218 - // if (FaceType == 1) {  
219 - // web6.style.display = 'none';  
220 - // goods6.style.display = 'block';  
221 - // } else {  
222 - // web6.style.display = 'block';  
223 - // goods6.style.display = 'none';  
224 - // }  
225 - // // WorkType.onchange = function () {  
226 - // // if (WorkType == 1) {  
227 - // // web5.style.display = 'none';  
228 - // // goods5.style.display = 'block';  
229 - // // } else {  
230 - // // web5.style.display = 'block';  
231 - // // goods5.style.display = 'none';  
232 - // // }  
233 - // // };  
234 - // // FaceType.onchange = function () {  
235 - // // if (FaceType == 1) {  
236 - // // web6.style.display = 'none';  
237 - // // goods6.style.display = 'block';  
238 - // // } else {  
239 - // // web6.style.display = 'block';  
240 - // // goods6.style.display = 'none';  
241 - // // }  
242 - // // };  
243 - // var SportType2 = document.getElementById("c-sport_type");  
244 - // var EatType2 = document.getElementById("c-eat_type");  
245 - // var SeasonType2 = document.getElementById("c-season_type");  
246 - // var BodyType2 = document.getElementById("c-body_type");  
247 - // var WorkType2 = document.getElementById("c-work_type");  
248 - // var FaceType2 = document.getElementById("c-face_type");  
249 - // SportType2.onchange = function () {  
250 - // if (SportType2.value == 1) {  
251 - // web1.style.display = 'none';  
252 - // goods1.style.display = 'block';  
253 - // } else {  
254 - // web1.style.display = 'block';  
255 - // goods1.style.display = 'none';  
256 - // }  
257 - // };  
258 - // EatType2.onchange = function () {  
259 - // if (EatType2.value == 1) {  
260 - // web2.style.display = 'none';  
261 - // goods2.style.display = 'block';  
262 - // } else {  
263 - // web2.style.display = 'block';  
264 - // goods2.style.display = 'none';  
265 - // }  
266 - // };  
267 - // BodyType2.onchange = function () {  
268 - // if (BodyType2.value == 1) {  
269 - // web3.style.display = 'none';  
270 - // goods3.style.display = 'block';  
271 - // } else {  
272 - // web3.style.display = 'block';  
273 - // goods3.style.display = 'none';  
274 - // }  
275 - // };  
276 - // SeasonType2.onchange = function () {  
277 - // if (SeasonType2.value == 1) {  
278 - // web4.style.display = 'none';  
279 - // goods4.style.display = 'block';  
280 - // } else {  
281 - // web4.style.display = 'block';  
282 - // goods4.style.display = 'none';  
283 - // }  
284 - // };  
285 - // WorkType2.onchange = function () {  
286 - // if (WorkType2.value == 1) { 165 + var SportType = Config.SportType;
  166 + var EatType = Config.EatType;
  167 + var SeasonType = Config.SeasonType;
  168 + var BodyType = Config.BodyType;
  169 + var WorkType = Config.WorkType;
  170 + var FaceType = Config.FaceType;
  171 + var web1 = document.getElementById("web1");
  172 + var goods1 = document.getElementById("goods1");
  173 + var web2 = document.getElementById("web2");
  174 + var goods2 = document.getElementById("goods2");
  175 + var web3 = document.getElementById("web3");
  176 + var goods3 = document.getElementById("goods3");
  177 + var web4 = document.getElementById("web4");
  178 + var goods4 = document.getElementById("goods4");
  179 + var web5 = document.getElementById("web5");
  180 + var goods5 = document.getElementById("goods5");
  181 + var web6 = document.getElementById("web6");
  182 + var goods6 = document.getElementById("goods6");
  183 + if (SportType == 1) {
  184 + web1.style.display = 'none';
  185 + goods1.style.display = 'block';
  186 + } else {
  187 + web1.style.display = 'block';
  188 + goods1.style.display = 'none';
  189 + }
  190 + if (EatType == 1) {
  191 + web2.style.display = 'none';
  192 + goods2.style.display = 'block';
  193 + } else {
  194 + web2.style.display = 'block';
  195 + goods2.style.display = 'none';
  196 + }
  197 + if (BodyType == 1) {
  198 + web3.style.display = 'none';
  199 + goods3.style.display = 'block';
  200 + } else {
  201 + web3.style.display = 'block';
  202 + goods3.style.display = 'none';
  203 + }
  204 + if (SeasonType == 1) {
  205 + web4.style.display = 'none';
  206 + goods4.style.display = 'block';
  207 + } else {
  208 + web4.style.display = 'block';
  209 + goods4.style.display = 'none';
  210 + }
  211 + if (WorkType == 1) {
  212 + web5.style.display = 'none';
  213 + goods5.style.display = 'block';
  214 + } else {
  215 + web5.style.display = 'block';
  216 + goods5.style.display = 'none';
  217 + }
  218 + if (FaceType == 1) {
  219 + web6.style.display = 'none';
  220 + goods6.style.display = 'block';
  221 + } else {
  222 + web6.style.display = 'block';
  223 + goods6.style.display = 'none';
  224 + }
  225 + // WorkType.onchange = function () {
  226 + // if (WorkType == 1) {
287 // web5.style.display = 'none'; 227 // web5.style.display = 'none';
288 // goods5.style.display = 'block'; 228 // goods5.style.display = 'block';
289 // } else { 229 // } else {
@@ -291,8 +231,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -291,8 +231,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
291 // goods5.style.display = 'none'; 231 // goods5.style.display = 'none';
292 // } 232 // }
293 // }; 233 // };
294 - // FaceType2.onchange = function () {  
295 - // if (FaceType2.value == 1) { 234 + // FaceType.onchange = function () {
  235 + // if (FaceType == 1) {
296 // web6.style.display = 'none'; 236 // web6.style.display = 'none';
297 // goods6.style.display = 'block'; 237 // goods6.style.display = 'block';
298 // } else { 238 // } else {
@@ -300,6 +240,66 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -300,6 +240,66 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
300 // goods6.style.display = 'none'; 240 // goods6.style.display = 'none';
301 // } 241 // }
302 // }; 242 // };
  243 + var SportType2 = document.getElementById("c-sport_type");
  244 + var EatType2 = document.getElementById("c-eat_type");
  245 + var SeasonType2 = document.getElementById("c-season_type");
  246 + var BodyType2 = document.getElementById("c-body_type");
  247 + var WorkType2 = document.getElementById("c-work_type");
  248 + var FaceType2 = document.getElementById("c-face_type");
  249 + SportType2.onchange = function () {
  250 + if (SportType2.value == 1) {
  251 + web1.style.display = 'none';
  252 + goods1.style.display = 'block';
  253 + } else {
  254 + web1.style.display = 'block';
  255 + goods1.style.display = 'none';
  256 + }
  257 + };
  258 + EatType2.onchange = function () {
  259 + if (EatType2.value == 1) {
  260 + web2.style.display = 'none';
  261 + goods2.style.display = 'block';
  262 + } else {
  263 + web2.style.display = 'block';
  264 + goods2.style.display = 'none';
  265 + }
  266 + };
  267 + BodyType2.onchange = function () {
  268 + if (BodyType2.value == 1) {
  269 + web3.style.display = 'none';
  270 + goods3.style.display = 'block';
  271 + } else {
  272 + web3.style.display = 'block';
  273 + goods3.style.display = 'none';
  274 + }
  275 + };
  276 + SeasonType2.onchange = function () {
  277 + if (SeasonType2.value == 1) {
  278 + web4.style.display = 'none';
  279 + goods4.style.display = 'block';
  280 + } else {
  281 + web4.style.display = 'block';
  282 + goods4.style.display = 'none';
  283 + }
  284 + };
  285 + WorkType2.onchange = function () {
  286 + if (WorkType2.value == 1) {
  287 + web5.style.display = 'none';
  288 + goods5.style.display = 'block';
  289 + } else {
  290 + web5.style.display = 'block';
  291 + goods5.style.display = 'none';
  292 + }
  293 + };
  294 + FaceType2.onchange = function () {
  295 + if (FaceType2.value == 1) {
  296 + web6.style.display = 'none';
  297 + goods6.style.display = 'block';
  298 + } else {
  299 + web6.style.display = 'block';
  300 + goods6.style.display = 'none';
  301 + }
  302 + };
303 Controller.api.bindevent(); 303 Controller.api.bindevent();
304 }, 304 },
305 api: { 305 api: {