service == null) { $this->service = new WorkOrderManage(); } return $this->service; } /** * Function Description:工单详情页面 * Function Name: actionWorkOrderDetail * * @return string * * @author 冒炎 */ public function actionWorkOrderDetail(){ $workOrderId = Yii::$app->request->get('id',0); $sendType = Yii::$app->request->get('send_type',-1); $data = $this->logic()->getWorkOrderDetail($workOrderId); $data['send_type'] = $sendType; return $this->render('work-order-detail',$data); } /** * Function Description:获取工单列表 * Function Name: actionGetWorkOrderList * @return string * @author 田玲菲 */ public function actionGetWorkOrderList() { //查询条件 $sendType = Yii::$app->request->get('send_type', 1); //1.我发起的工单, 2.待我处理的工单, 3.抄送给我的工单 $hotelName = Yii::$app->request->get('hotel_name', '');//酒店名字 $id = Yii::$app->request->get('id', '');//工单编号,id $timeType = Yii::$app->request->get('time_type', 1);//时间类型:1.提交时间,2.结束时间 $startDate = Yii::$app->request->get('start_date', date('Y-m-d', strtotime("-1 month")));//查询开始时间 $endDate = Yii::$app->request->get('end_date', date('Y-m-d').' 23:59:59');//查询结束时间 $workType = Yii::$app->request->get('work_type', '');//工单类型: 1.其他 2.预定问题 3.价格房态 $status = Yii::$app->request->get('status', '');//工单状态 $keyWords = Yii::$app->request->get('key_words', '');//关键字查询 $submitMan = Yii::$app->request->get('submit_man', '');//提交人id $page_size = Yii::$app->request->get('page_size', 10);//每页显示数 $current_page = Yii::$app->request->get('current_page', 1);//当前页数 $is_finish = Yii::$app->request->get('is_finish', 1);//是否完成 $res = $this->logic()->getWorkOrderList($sendType, $hotelName, $id, $timeType, $startDate, $endDate, $workType, $status, $keyWords, $submitMan, $is_finish, $page_size, $current_page); return $this->render('work-order-list', $res); } /** * Function Description:获取我提交的/我受理的/抄送给我的工单的数量 * Function Name: actionGetNum * @return string * @author 田玲菲 */ public function actionGetNum() { $hotelName = Yii::$app->request->get('hotel_name', '');//酒店名字 $id = Yii::$app->request->get('id', '');//工单编号,id $timeType = Yii::$app->request->get('time_type', 0);//时间类型:1.提交时间,2.结束时间 $startDate = Yii::$app->request->get('start_date', date('Y-m-d', strtotime("-1 month")));//查询开始时间 $endDate = Yii::$app->request->get('end_date', date('Y-m-d').' 23:59:59');//查询结束时间 $workType = Yii::$app->request->get('work_type', '');//工单类型: 1.其他 2.预定问题 3.价格房态 $status = Yii::$app->request->get('status', '');//工单状态 $keyWords = Yii::$app->request->get('key_words', '');//关键字查询 $submitMan = Yii::$app->request->get('submit_man', '');//提交人id $res = $this->logic()->getNums($hotelName, $id, $timeType, $startDate, $endDate, $workType, $status, $keyWords, $submitMan); return json_encode($res); } /** * Function Description:修改工单状态 * Function Name: actionChangeWorkStatus * @return string * @author 田玲菲 */ public function actionChangeWorkStatus() { $id = Yii::$app->request->post('id', '');//工单编号,id $status = Yii::$app->request->post('work_status', '');//工单编号,id $res = $this->logic()->changeWorkStatus($id, $status); return json_encode($res); } /** * Function Description:新增工单 * Function Name: actionAddWorkOrder * @return string * @author 田玲菲 */ public function actionAddWorkOrder() { $hotelName = Yii::$app->request->post('hotel_name', '');//酒店名字 $type = Yii::$app->request->post('work_type', '');//工单类型: 1.其他 2.预定问题 3.价格房态 $accepPeople = Yii::$app->request->post('accep_people', ''); //工单受理人 $copyPeople = Yii::$app->request->post('copy_people', ''); //工单抄送人 $title = Yii::$app->request->post('title', ''); //工单标题 $content = Yii::$app->request->post('content', ''); //工单内容 $res = $this->logic()->saveWorkOrder($hotelName, $accepPeople, $type, $copyPeople, $title, $content); return json_encode($res); } /** * Function Description:跳转到新增工单页面 * Function Name: actionAddWork * @return string * @author 田玲菲 */ public function actionAddWork() { $data = []; //酒店名字 $hotelName = $this->logic()->getHotelList(); $data['hotelList'] = $hotelName; //联系人列表 $data['people'] = $this->logic()->getWorkPeople(); return $this->render('add-work', $data); } /** * Function Description:确认或终止工单 * Function Name: actionChangeStatus * * @return string * * @author 冒炎 */ public function actionChangeStatus(){ $status = Yii::$app->request->post('status',-1); $id = Yii::$app->request->post('id',-1); if(($status != '5'&&$status != '6')||$id == -1){ $res = [ 'flag'=>false, 'info'=>'参数错误' ]; }else{ $res = $this->logic()->ChangeStatus($status,$id); } return json_encode($res); } /** * Function Description:工单添加评论和处理人抄送人接口 * Function Name: actionAddComment * * @return string * @throws \yii\db\Exception * * @author 冒炎 */ public function actionAddComment(){ $type = Yii::$app->request->post('type',-1); $accept = Yii::$app->request->post('accept',[]); $copy = Yii::$app->request->post('copy',[]); $comment = Yii::$app->request->post('comment',-1); $id = Yii::$app->request->post('id',-1); if(($type != '2'&&$type != '1')||$id == -1||$comment==-1){ $res = [ 'flag'=>false, 'info'=>'参数错误', 'detailInfo'=>'参数错误' ]; }else{ $res = $this->logic()->addComment($type,$id,$accept,$copy,$comment); } return json_encode($res); } }