diff --git a/common/models/NetworkPhoneAssignT.php b/common/models/NetworkPhoneAssignT.php new file mode 100644 index 0000000..692bc3d --- /dev/null +++ b/common/models/NetworkPhoneAssignT.php @@ -0,0 +1,55 @@ + 'ID', + 'user_id' => 'User ID', + 'created_at' => 'Created At', + 'updated_at' => 'Updated At', + 'phone' => 'Phone', + ]; + } + + public function getUser() + { + return $this->hasOne(UserT::className(),['id'=>'user_id']); + } +} diff --git a/common/models/NetworkPhoneSubT.php b/common/models/NetworkPhoneSubT.php new file mode 100644 index 0000000..9b20999 --- /dev/null +++ b/common/models/NetworkPhoneSubT.php @@ -0,0 +1,55 @@ + 'ID', + 'user_id' => 'User ID', + 'created_at' => 'Created At', + 'updated_at' => 'Updated At', + 'phone' => 'Phone', + ]; + } + + public function getUser() + { + return $this->hasOne(UserT::className(),['id'=>'user_id']); + } +} diff --git a/common/models/NetworkPhoneT.php b/common/models/NetworkPhoneT.php new file mode 100644 index 0000000..9bf2fbe --- /dev/null +++ b/common/models/NetworkPhoneT.php @@ -0,0 +1,93 @@ + 225], + [['sign', 'begin_time', 'connect_time', 'alerting_time', 'release_time', 'call_result', 'record_file_url'], 'string', 'max' => 255], + [['recorder_id'], 'string', 'max' => 128], + [['caller', 'called', 'caller_show', 'called_show', 'caller_area', 'called_area'], 'string', 'max' => 32], + [['call_cost', 'extend'], 'string', 'max' => 10], + [['id'], 'unique'], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'corp_key' => 'Corp Key', + 'ts' => 'Ts', + 'sign' => 'Sign', + 'recorder_id' => 'Recorder ID', + 'caller' => 'Caller', + 'called' => 'Called', + 'caller_show' => 'Caller Show', + 'called_show' => 'Called Show', + 'begin_time' => 'Begin Time', + 'connect_time' => 'Connect Time', + 'alerting_time' => 'Alerting Time', + 'release_time' => 'Release Time', + 'call_duration' => 'Call Duration', + 'bill_duration' => 'Bill Duration', + 'call_result' => 'Call Result', + 'record_file_url' => 'Record File Url', + 'call_cost' => 'Call Cost', + 'caller_area' => 'Caller Area', + 'called_area' => 'Called Area', + 'extend' => 'Extend', + ]; + } + + public function getUser() + { + return $this->hasOne(UserT::className(),['id'=>'user_id']); + } +} diff --git a/frontend/controllers/PersonnelController.php b/frontend/controllers/PersonnelController.php index 6dbace4..aa99a4e 100644 --- a/frontend/controllers/PersonnelController.php +++ b/frontend/controllers/PersonnelController.php @@ -15,6 +15,8 @@ use yii\web\UploadedFile; class PersonnelController extends \frontend\controllers\UserBaseController { public $my = null; + public $enableCsrfValidation = false; + public $layout = 'blue-main'; public function init() { @@ -38,52 +40,60 @@ class PersonnelController extends \frontend\controllers\UserBaseController */ public function actionPayList() { + $pay_date = date('Y-m'); + $group_items = GroupT::getTree(); + return $this->render('pay-list',[ + 'group_items' => $group_items, + 'pay_date' => $pay_date + ]); + } + + public function actionPayListJson() + { + Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; $username = $request->get('username'); $name = $request->get('name'); $pay_date = $request->get('pay_date',date('Y-m')); $group_id = $request->get('group_id',0); - $page = $request->get('page',1); $is_leave = $request->get('is_leave'); + $offset = $request->get('offset',0); + $limit = $request->get('limit', 10); $query = UserT::find() ->where('group_id>0 and is_delete=0'); if($username != '') { - $query = $query->andWhere('username like "'.$username.'"'); + $query->andWhere('username like "'.$username.'"'); } if($name != '') { - $query = $query->andWhere('name like "'.$name.'"'); + $query->andWhere('name like "'.$name.'"'); } - if($is_leave != ''){ - $query = $query->andWhere(['is_leave' => $is_leave]); + if($is_leave == 'true'){ + $query->andWhere(['is_leave' => 1]); } if($group_id > 0) { - $query = $query->andWhere('group_id='.$group_id); + $query->andWhere('group_id='.$group_id); } - $query = $query->orderBy('username ASC,id ASC'); + $query->orderBy('username ASC,id ASC'); $total = $query->count(); - $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]); - $pagination->setPage($page-1); - - $query = $query->offset($pagination->offset)->limit($pagination->limit); + $query = $query->offset($offset)->limit($limit); $items = $query->all(); - $page_info = MyLib::getPageInfo($pagination); - - $group_items = GroupT::getTree(); + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $row['pay_date'] = $pay_date; + $row['group_path'] = $item->group ? $item->group->getPath():''; + $pay = $item->getPay($pay_date); + $row['real_pay'] = $pay ? $pay->real_pay : '0.00'; + $row['is_leave'] = $item->is_leave == 1 ? '已离职':''; + $data['rows'][] = $row; + } - return $this->render('pay-list',[ - 'group_items' => $group_items, - 'items' => $items, - 'page_info' => $page_info, - 'page' => $page, - 'username' => $username, - 'name' => $name, - 'pay_date' => $pay_date, - 'group_id' => $group_id, - 'is_leave' => $is_leave - ]); + return $data; } /** diff --git a/frontend/views/personnel/pay-list.php b/frontend/views/personnel/pay-list.php index 2ef0bf1..7308248 100644 --- a/frontend/views/personnel/pay-list.php +++ b/frontend/views/personnel/pay-list.php @@ -1,164 +1,139 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 工号: - 真实姓名: - 工资月份: - 是否离职: - 分组: - -
- - - - - - - - - - - - - - $item) { - $pay_info = $item->getPay($pay_date); - $real_pay = 0; - if($pay_info) - $real_pay = $pay_info->real_pay; - ?> - - - - - - - - - - - - - - - - -
工号真实姓名工资月份所属岗位角色提成公式工资是否离职操作
username?>name?>group?$item->group->getPath():''?>role?$item->role->name:''?>formulae:''?> - 元 - is_leave?'是':''?> - [维护] -
- - - - - + + + +endBlock(); ?>