12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace app\admin\controller\qingdongams\finance;
- use app\admin\controller\qingdongams\Base;
- use addons\qingdongams\model\Account as AccountModel;
- /**
- * 审批管理
- * @icon fa fa-user
- */
- class Account extends Base {
- protected $relationSearch = true;
- /**
- * @var \addons\qingdongams\model\Account
- */
- protected $model = null;
- public function _initialize() {
- parent::_initialize();
- $this->model = new AccountModel();
- }
- /**
- * 查看
- */
- public function index() {
- //设置过滤方法
- $this->request->filter(['strip_tags', 'trim']);
- if ($this->request->isAjax()) {
- //如果发送的来源是Selectpage,则转发到Selectpage
- if ($this->request->request('keyField')) {
- return $this->selectpage();
- }
- list($where, $sort, $order, $offset, $limit) = $this->buildparams();
- $list = $this->model->where($where)->where([])->order('id desc')->paginate($limit);
- $result = array("total" => $list->total(), "rows" => $list->items());
- return json($result);
- }
- return $this->view->fetch();
- }
- //添加
- public function add() {
- if ($this->request->isAjax()) {
- $data = $this->request->post('row/a');
- $result = $this->model->save($data);
- if (!$result) {
- $this->error('提交失败');
- }
- $this->success('提交成功');
- }
- return $this->view->fetch();
- }
- //修改
- public function edit($ids = null) {
- $map['id'] = $ids;
- if ($this->request->isAjax()) {
- $data = $this->request->post('row/a');
- $result = $this->model->save($data, $map);
- if (!$result) {
- $this->error('修改失败');
- }
- $this->success('修改成功');
- }
- $data = AccountModel::where($map)->find();
- $this->view->assign("row", $data);
- return $this->view->fetch();
- }
- }
|