This commit is contained in:
2020-08-15 21:50:59 +08:00
parent 2184b686f5
commit 27da9c50ca
8 changed files with 27 additions and 203 deletions

View File

@@ -150,20 +150,15 @@ class Form extends Base {
public function outxls($form_id = '') {
$form = $this->model->where('id', $form_id)->find();
$attr = $this->Fattr->where('form_id', $form_id)->where('is_show', 1)->select();
$attr = FormAttr::where('form_id', $form_id)->where('is_show', 1)->select();
foreach ($attr as $key => $value) {
$title[$value['name']] = $value['title'];
}
$data[] = $title;
$res = M($form['name'], 'form')->order('id desc')->select();
$data = $list = $this->model->order('id desc')->select();
foreach ($res as $key => $value) {
$data[] = $value;
}
$out = new \com\Outxls($data, date('Y-m-d'));
$out->out();
$this->data['data'] = $data;
return $this->data;
}
/**

View File

@@ -1,72 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller\admin;
use QL\QueryList;
use app\model\Company;
/**
* @title 住建管理
* @description 住建管理
*/
class Hcloud extends Base {
/**
* @title 住建列表
*/
public function index(){
$map = array();
$order = "compId desc";
$list = Company::with(['apt'])->where($map)->order($order)->paginate($this->request->pageConfig);
$this->data = array(
'list' => $list,
'page' => $list->render(),
);
return $this->fetch();
}
public function get_comp_date(){
$param = $this->request->param();
// $param['qyType'] = 'QY_TYPE_0001';
$client = new \GuzzleHttp\Client();
$res = $client->request('post', 'http://zjy.jxjst.gov.cn/w/dataQuery/getCompDate', ['form_params' => $param])->getBody()->getContents();
$list = json_decode($res, true);
$data = [];
foreach($list['rows'] as $key => $val){
// $apt = $client->request('get', 'http://zjy.jxjst.gov.cn/w/cms/qy/getQyAptListData/'.$val['qyCompId'])->getBody()->getContents();
// $apt_list = json_decode($apt, true);
$detail = QueryList::get('http://zjy.jxjst.gov.cn/w/dataQuery/compDetailInfo/'.$val['qyCompId']);
$val['registerDate'] = $detail->find('.introduce-body:eq(0) table.daBg tr:eq(2) td:eq(1)')->text();
$val['registerGov'] = $detail->find('.introduce-body:eq(0) table.daBg tr:eq(3) td:eq(3)')->text();
$val['businessScope'] = $detail->find('.introduce-body:eq(0) table.daBg tr:eq(7) td:eq(1)')->text();
$val['safetyCode'] = $detail->find('.introduce-body:eq(1) table.daBg tr:eq(0) td:eq(1)')->text();
$val['safetyBdate'] = $detail->find('.introduce-body:eq(1) table.daBg tr:eq(1) td:eq(1)')->text();
$val['safetyEdate'] = $detail->find('.introduce-body:eq(1) table.daBg tr:eq(2) td:eq(1)')->text();
$val['safetyContent'] = $detail->find('.introduce-body:eq(1) table.daBg tr:eq(1) td:eq(3)')->text();
$val['safetyGov'] = $detail->find('.introduce-body:eq(1) table.daBg tr:eq(2) td:eq(3)')->text();
// $val['apt'] = $apt_list;
Company::create($val, [], true);
// if(count($apt_list['rows']) > 0){
// foreach($apt_list['rows'] as $k => $v){
// }
// }
// $list['rows'][$key] = $val;
// $data[] = $val;
}
// dump($list);
// (new Company())->saveAll($data, true);
}
public function list_ba_pubic(){
}
}

View File

@@ -16,6 +16,8 @@ use think\facade\Session;
*/
class Admin {
public $data = [];
public function handle($request, \Closure $next) {
$request->rootUid = env('rootuid');
$request->user = Session::get('adminInfo');
@@ -29,6 +31,20 @@ class Admin {
MemberLog::record($request);
$response = $next($request);
return $response;
if (is_array($response->getData())) {
$this->data = array_merge($this->data, $response->getData());
} else {
$this->data = $response->getData();
}
if ($request->isAjax()) {
return json($this->data);
} else {
if (\is_string($this->data) && $this->data != '') {
return $response;
} else {
return json($this->data);
}
}
}
}

View File

@@ -1,22 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
namespace app\model;
/**
* Company模型
*/
class Company extends \think\Model{
protected $auto = array('update_time');
protected $insert = array('create_time');
public function apt(){
return $this->hasMany('CompanyApt', 'compId', 'compId');
}
}

View File

@@ -1,19 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------
namespace app\model;
/**
* Company模型
*/
class CompanyApt extends \think\Model{
protected $auto = array('update_time');
protected $insert = array('create_time');
}

View File

@@ -8,11 +8,12 @@ define(['jquery', 'sent', 'form', 'xlsxs'], function($, sent, form, xlsxs){
$('.btn-out').click(function(e){
e.preventDefault();
var url = $(this).attr('href');
formModule.outXlsx(url)
var filename = $(this).data('name');
formModule.outXlsx(url, 1, filename)
})
}
},
outXlsx: function (url, page = 1){
outXlsx: function (url, page = 1, filename){
var data = $('form').serialize();
var pagesize = $('select.pagesize').val() || 30;
data = data + '&out=1&pagesize='+pagesize+'&page='+page
@@ -29,9 +30,9 @@ define(['jquery', 'sent', 'form', 'xlsxs'], function($, sent, form, xlsxs){
success:function(res){
outList = outList.concat(res.data);
if (res.last_page > page) {
formModule.outXlsx(url, page+1)
formModule.outXlsx(url, page+1, filename)
}else{
xlsxs.downloadExl(outList,res.file_name);
xlsxs.downloadExl(outList,filename);
sent.msg('导出完成!');
setTimeout(function(){}, 3000);
}

View File

@@ -4,7 +4,7 @@
<div class="box-header with-border">
<h3 class="box-title">{$meta_title}</h3>
<div class="box-tools pull-right">
<a class="btn btn-warning btn-out btn-sm" href="{:url('/admin/form/lists')}"><i class="fa fa-reply"></i> 导出</a>
<a class="btn btn-warning btn-out btn-sm" href="{:url('/admin/form/outxls', ['form_id' => $form_id])}" data-name="{$meta_title}"><i class="fa fa-reply"></i> 导出</a>
</div>
</div>
<div class="box-body">

View File

@@ -1,75 +0,0 @@
{extend name="admin/public/base"/}
{block name="body"}
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">{$meta_title}</h3>
<div class="box-tools pull-right">
<!-- <a class="btn btn-sm btn-primary" href="{:url('/admin/hcloud/add')}">新 增</a>
<button class="btn btn-sm btn-danger ajax-post confirm" url="{:url('/admin/hcloud/delete')}" data-form="ids">删 除</button> -->
</div>
</div>
<div class="box-body">
<div class="table-responsive clearfix">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>公司名称</th>
<th>公司法人</th>
<th>注册地址</th>
<th>证书编号</th>
<th>安全许可到期时间</th>
<th>资质项名称</th>
<th>证书编号</th>
<th>发证日期</th>
<th>证书有效期</th>
<th>发证机关</th>
</tr>
</thead>
<tbody>
{volist name="list" id="item"}
{if count($item['apt']) > 0}
<tr>
<td rowspan="{:count($item['apt'])}">{$item['compName']}</td>
<td rowspan="{:count($item['apt'])}">{$item['compCeoName']}</td>
<td rowspan="{:count($item['apt'])}">{$item['compRegAddr']}</td>
<td rowspan="{:count($item['apt'])}">{$item['safetyCode']}</td>
<td rowspan="{:count($item['apt'])}">{$item['safetyEdate']}</td>
<td>{$item['apt'][0]['aptCasename']}</td>
<td>{$item['apt'][0]['certPrintNo']}</td>
<td>{$item['apt'][0]['validBdate']}</td>
<td>{$item['apt'][0]['validEdate']}</td>
<td>{$item['apt'][0]['issueUnitName']}</td>
</tr>
{volist name="item['apt']" id="vo" key="j"}
{if $j > 1}
<tr>
<td>{$vo['aptCasename']}</td>
<td>{$vo['certPrintNo']}</td>
<td>{$vo['validBdate']}</td>
<td>{$vo['validEdate']}</td>
<td>{$vo['issueUnitName']}</td>
</tr>
{/if}
{/volist}
{else/}
<tr>
<td>{$item['compName']}</td>
<td>{$item['compCeoName']}</td>
<td>{$item['compRegAddr']}</td>
<td>{$item['safetyCode']}</td>
<td>{$item['safetyEdate']}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
{/if}
{/volist}
</tbody>
</table>
{$page|raw}
</div>
</div>
</div>
{/block}