diff --git a/.example.env b/.example.env index 7d0c0d70..42b4b0f5 100755 --- a/.example.env +++ b/.example.env @@ -1,5 +1,5 @@ APP_DEBUG = false -VERSION = 4.0.2 +VERSION = 4.0.3 rootuid = 1 diff --git a/app/controller/admin/Form.php b/app/controller/admin/Form.php index 7c0c5ae5..fa426454 100644 --- a/app/controller/admin/Form.php +++ b/app/controller/admin/Form.php @@ -110,6 +110,9 @@ class Form extends Base { * @return html 页面 */ public function lists($form_id = '') { + if(!$form_id){ + return $this->error('无此表单!'); + } $form = $this->modelInfo; $list = $this->model->order('id desc')->paginate(25); @@ -118,6 +121,7 @@ class Form extends Base { 'grid' => $this->modelInfo['grid_list'], 'meta_title' => $this->modelInfo['title'] . '列表', 'form_id' => $form_id, + 'require' => ['jsname' => 'form', 'actionname' => 'lists'], 'list' => $list, 'page' => $list->render(), ); diff --git a/app/controller/admin/Hcloud.php b/app/controller/admin/Hcloud.php new file mode 100644 index 00000000..96cd3e21 --- /dev/null +++ b/app/controller/admin/Hcloud.php @@ -0,0 +1,72 @@ + +// +---------------------------------------------------------------------- +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(){ + + } +} \ No newline at end of file diff --git a/app/controller/front/Index.php b/app/controller/front/Index.php index 244951e7..b9b8e961 100644 --- a/app/controller/front/Index.php +++ b/app/controller/front/Index.php @@ -8,6 +8,8 @@ // +---------------------------------------------------------------------- namespace app\controller\front; +use QL\QueryList; + class Index extends Base { /** @@ -16,7 +18,7 @@ class Index extends Base { */ public function index() { $this->setSeo("网站首页", '网站首页', '网站首页'); - return $this->fetch(); + // return $this->fetch(); } public function miss(){ diff --git a/app/model/Company.php b/app/model/Company.php new file mode 100644 index 00000000..1a8471fe --- /dev/null +++ b/app/model/Company.php @@ -0,0 +1,22 @@ + +// +---------------------------------------------------------------------- + +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'); + } +} \ No newline at end of file diff --git a/app/model/CompanyApt.php b/app/model/CompanyApt.php new file mode 100644 index 00000000..cc969a26 --- /dev/null +++ b/app/model/CompanyApt.php @@ -0,0 +1,19 @@ + +// +---------------------------------------------------------------------- + +namespace app\model; + +/** + * Company模型 + */ +class CompanyApt extends \think\Model{ + protected $auto = array('update_time'); + protected $insert = array('create_time'); + +} \ No newline at end of file diff --git a/composer.json b/composer.json index 93e48a08..f9f06081 100755 --- a/composer.json +++ b/composer.json @@ -28,7 +28,8 @@ "xin/helper": "^1.0.0", "sent/tree": "^1.0.0", "sent/think-addons": "^1.0.0", - "overtrue/wechat": "^4.2" + "overtrue/wechat": "^4.2", + "jaeger/querylist": "^4.2" }, "require-dev": { "symfony/var-dumper": "^4.2" diff --git a/public/static/admin/js/main.js b/public/static/admin/js/main.js index ce0b6282..e55ea507 100644 --- a/public/static/admin/js/main.js +++ b/public/static/admin/js/main.js @@ -104,7 +104,8 @@ require.config({ 'webupload': {deps: ['jquery', 'css!'+baseRoot+'plugins/webuploader/theme/webuploader.css', 'css!'+baseRoot+'/plugins/webuploader/theme/app.css']}, 'layer': {deps: ['jquery', 'css!'+baseRoot+'plugins/layer/theme/default/layer.css']}, - 'layui':{exports: "layui"} + 'layui':{exports: "layui"}, + // 'sheetjs':{exports: 'XLSX'} }, deps: ['json'], // 开启debug模式,不缓存资源 diff --git a/public/static/admin/js/module/form.js b/public/static/admin/js/module/form.js new file mode 100644 index 00000000..033aaef9 --- /dev/null +++ b/public/static/admin/js/module/form.js @@ -0,0 +1,17 @@ +define(['jquery', 'sent', 'form', 'xlsx', 'sheetjs'], function($, sent, form, xlsx, xlsx2){ + + var formModule = { + lists: function(){ + console.log('xlsx2') + if($('.btn-out').size() > 0){ + $('.btn-out').click(function(e){ + e.preventDefault(); + var url = $(this).attr('href'); + console.log(xlsx) + }) + } + } + }; + + return formModule; +}) \ No newline at end of file diff --git a/public/static/admin/js/module/hcloud.js b/public/static/admin/js/module/hcloud.js new file mode 100644 index 00000000..2821148e --- /dev/null +++ b/public/static/admin/js/module/hcloud.js @@ -0,0 +1,10 @@ +define(['jquery', 'sent', 'form', 'xlsx', 'sheetjs'], function($, sent, form, xls){ + var hcloud = { + + index: function(){ + // console.log(XLSX); + } + } + + return hcloud; +}) \ No newline at end of file diff --git a/public/static/common/js/require-xlsx.js b/public/static/common/js/require-xlsx.js index abfaec1e..31b2d792 100644 --- a/public/static/common/js/require-xlsx.js +++ b/public/static/common/js/require-xlsx.js @@ -1,4 +1,4 @@ -require(['jquery', 'sheetjs'], function($, XLSX) { +define(['jquery', 'sheetjs'], function($, XLSX) { // var wopts = { bookType: 'csv', bookSST: false, type: 'binary' };//ods格式 var wopts = { bookType: 'xlsx', bookSST: false, type: 'binary' };//这里的数据是用来定义导出的格式类型 @@ -9,10 +9,9 @@ require(['jquery', 'sheetjs'], function($, XLSX) { var xls = { downloadExl: function (data, fileName) { - checkFileIn(); var wb = { SheetNames: ['Sheet1'], Sheets: {}, Props: {} }; - wb.Sheets['Sheet1'] = XLSX.utils.json_to_sheet(data);//通过json_to_sheet转成单页(Sheet)数据 - this.saveAs(new Blob([this.s2ab(XLSX.write(wb, wopts))], { type: "application/octet-stream" }), fileName + '.' + (wopts.bookType=="biff2"?"xls":wopts.bookType)); + wb.Sheets['Sheet1'] = sheetjs.utils.json_to_sheet(data);//通过json_to_sheet转成单页(Sheet)数据 + this.saveAs(new Blob([this.s2ab(sheetjs.write(wb, wopts))], { type: "application/octet-stream" }), fileName + '.' + (wopts.bookType=="biff2"?"xls":wopts.bookType)); }, //如果使用 FileSaver.js 就不要同时使用以下函数 @@ -41,19 +40,7 @@ require(['jquery', 'sheetjs'], function($, XLSX) { } } }; - - checkFileIn = function(){ - if($("script[src='/static/js/js-xlsx/xlsx.full.min.js']").length > 0){ - return; - }else{ - var body = $("body"); - var script = $("