| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace app\admin\controller;
- use app\common\controller\Backend;
- /**
- * 外发采购 — 月度报表导出列表
- *
- * @icon fa fa-file-excel-o
- */
- class Procuremenexport extends Backend
- {
- /**
- * @var \app\admin\model\Purchasemonthexport
- */
- protected $model = null;
- protected $searchFields = 'ym,admin_name';
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\admin\model\Purchasemonthexport;
- }
- public function index()
- {
- $this->relationSearch = false;
- $this->request->filter(['strip_tags', 'trim']);
- if ($this->request->isAjax()) {
- list($where, $sort, $order, $offset, $limit) = $this->buildparams();
- $list = $this->model
- ->where($where)
- ->order($sort ?: 'id', $order ?: 'desc')
- ->paginate($limit);
- foreach ($list as $row) {
- $ct = (int)($row['createtime'] ?? 0);
- $row->createtime_text = $ct > 0 ? date('Y-m-d H:i:s', $ct) : '';
- $row->total_amount_text = number_format((float)($row['total_amount'] ?? 0), 2, '.', ',');
- }
- return json(['total' => $list->total(), 'rows' => $list->items()]);
- }
- return $this->view->fetch();
- }
- }
|