page(input('page')) ->select(); $count = OfficerReviewModel::count(); if ($count == 0) { ajax_return(1, '未查询到数据'); } foreach ($list as $v) { $v['name'] = strip_tags($v['name']); } list_return($list, $count); } /** * 列表 */ public function detail() { $id = input('id'); if (empty($id)) { return '该测评不存在'; } return view('', ['id' => $id]); } public function listDetail() { $id = input('id', 0); $list = OfficerAnswerModel::where('rid', $id) ->where('status', 2) ->order('id', 'desc') ->limit(input('limit')) ->page(input('page')) ->append(['status_text']) ->select(); $count = OfficerAnswerModel::where('rid', $id) ->where('status', 2) ->count(); if ($count == 0) { ajax_return(1, '未查询到数据'); } list_return($list, $count); } public function export() { $id = input('id', 0); $list = OfficerAnswerModel::with(['detail']) ->where('rid', $id) ->where('status', 2) ->order('id', 'desc') ->append(['status_text']) ->select(); if ($list->isEmpty()) { return '暂无人答题'; } $xlsCell = [ ['name', '姓名'], ['sex', '性别'], ['age', '年龄'], ['current_position', '当前岗位'], ['education', '学历'], ['major', '专业'], ['seniority', '工龄'], ['leader', '担任领导的累计年限'], ['industry', '所在行业'], ['company', '所在单位'], ['job', '职位'], ]; $res = []; foreach ($list as $ak => $answer) { $item = []; $item['name'] = $answer['name']; $item['sex'] = $answer['sex']; $item['age'] = $answer['age']; $item['current_position'] = $answer['current_position']; $item['education'] = $answer['education']; $item['major'] = $answer['major']; $item['seniority'] = $answer['seniority']; $item['leader'] = $answer['leader']; $item['industry'] = $answer['industry']; if (empty($answer['company_text'])) { $item['company'] = $answer['company']; } else { $item['company'] = $answer['company'] . "({$answer['company_text']})"; } if (empty($answer['job_text'])) { $item['job'] = $answer['job']; } else { $item['job'] = $answer['job'] . "({$answer['job_text']})"; } foreach ($answer['detail'] as $k => $v) { $index = 'item_' . $v['no']; if ($ak == 0) { $xlsCell[] = [$index, $index]; } $item[$index] = $v['score']; } $res[] = $item; } // $xlsCell = array_merge($xlsCell, [ // ['name', '姓名'], // ['mobile', '手机号'], // ['sex', '性别'], // ['age', '年龄'], // ['marry', '婚姻状况'], // ['education', '学历'], // ['major', '专业'], // ['seniority', '工龄'], // ['leader', '担任领导的累计年限'], // ['industry', '所在行业'], // ['company', '所在单位'], // ['job', '职位'],]); export_exl("考试明细", $xlsCell, $res); } /** * 二维码 */ public function qrcode() { $id = input('id/d', 0); $file_name = "/officer_{$id}.png"; $link = url('/mobile/officer/index') . '?id=' . $id; $file_url = QrcodeService::getQrcode($file_name, $link, 600); ajax_return(0, '', $file_url); } }