更新目录结构

This commit is contained in:
2023-10-21 17:45:00 +08:00
parent 59cc869bb2
commit 664295167d
55 changed files with 1856 additions and 6329 deletions

View File

@@ -1,22 +1,11 @@
APP_DEBUG = true
[APP]
DEFAULT_TIMEZONE = Asia/Shanghai
DB_TYPE = mysql
DB_HOST = 127.0.0.1
DB_NAME = test
DB_USER = username
DB_PASS = password
DB_PORT = 3306
DB_CHARSET = utf8
[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
DATABASE = test
USERNAME = username
PASSWORD = password
HOSTPORT = 3306
CHARSET = utf8
DEBUG = true
[LANG]
default_lang = zh-cn
[JWT]
SECRET={secret}
ADMIN_ROOT = 1
DEFAULT_LANG = zh-cn

11
.gitignore vendored
View File

@@ -1,5 +1,12 @@
*.log
.env
composer.phar
composer.lock
.DS_Store
Thumbs.db
/.idea
/.vscode
/vendor
*.log
.env
/.settings
/.buildpath
/.project

73
LICENSE
View File

@@ -1,73 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,6 +1,6 @@
ThinkPHP遵循Apache2开源协议发布并提供免费使用。
版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn)
版权所有Copyright © 2006-2023 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。

View File

@@ -1,3 +1,79 @@
# sentos
![](https://www.thinkphp.cn/uploads/images/20230630/300c856765af4d8ae758c503185f8739.png)
sentos以thinkphp+vue3.0+element-plus为基础开发的管理系统
ThinkPHP 8.0
===============
## 特性
* 基于PHP`8.0+`重构
* 升级`PSR`依赖
* 依赖`think-orm`3.0版本
* `6.0`/`6.1`无缝升级
> ThinkPHP8.0的运行环境要求PHP8.0.0+
现在开始,你可以使用官方提供的[ThinkChat](https://chat.topthink.com/)让你在学习ThinkPHP的旅途中享受私人AI助理服务
![](https://www.topthink.com/uploads/assistant/20230630/4d1a3f0ad2958b49bb8189b7ef824cb0.png)
## 文档
[完全开发手册](https://doc.thinkphp.cn)
## 服务
ThinkPHP生态服务由[顶想云](https://www.topthink.com)TOPThink Cloud提供为生态提供专业的开发者服务和价值之选。
## 赞助
全新的[赞助计划](https://www.thinkphp.cn/sponsor)可以让你通过我们的网站、手册、欢迎页及GIT仓库获得巨大曝光同时提升企业的品牌声誉也更好保障ThinkPHP的可持续发展。
[![](https://www.thinkphp.cn/uploads/images/20230630/48396092a0515886a3da6bd268131c8f.png)](http://github.crmeb.net/u/TPSY)
[![](https://www.thinkphp.cn/uploads/images/20230630/a12bd248beee0e7491dd0f79dc4dd5e9.png)](https://www.thinkphp.cn/sponsor)
[![](https://www.thinkphp.cn/uploads/images/20230630/e7f48d909d41dd5ebaf4a5aa982d0455.png)](https://www.thinkphp.cn/sponsor)
## 安装
~~~
composer create-project topthink/think tp
~~~
启动服务
~~~
cd tp
php think run
~~~
然后就可以在浏览器中访问
~~~
http://localhost:8000
~~~
如果需要更新框架使用
~~~
composer update topthink/framework
~~~
## 命名规范
`ThinkPHP`遵循PSR-2命名规范和PSR-4自动加载规范。
## 参与开发
直接提交PR或者Issue即可
## 版权信息
ThinkPHP遵循Apache2开源协议发布并提供免费使用。
本项目包含的第三方源码和二进制文件之版权信息另行标注。
版权所有Copyright © 2006-2023 by ThinkPHP (http://thinkphp.cn) All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
更多细节参阅 [LICENSE.txt](LICENSE.txt)

View File

@@ -64,7 +64,7 @@ abstract class BaseController
* @return array|string|true
* @throws ValidateException
*/
protected function validate(array $data, $validate, array $message = [], bool $batch = false)
protected function validate(array $data, string|array $validate, array $message = [], bool $batch = false)
{
if (is_array($validate)) {
$v = new Validate();

View File

@@ -1,37 +1,2 @@
<?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>
// +----------------------------------------------------------------------
use think\facade\Cache;
use sent\tree\Tree;
function getDepartmentChild($pid = 0){
$department = Cache::get('department');
if(!$department){
$department = \app\model\auth\Departments::where('status', '=', 1)->column('id,parent_id,title', 'id');
Cache::set('department', $department);
}
$res = getChilds($department, $pid, 'id', 'parent_id');
$res[] = (int) $pid; //把自己包含在内
return $res;
}
/**
* 获得所有的子
* @param [type] $id [description]
* @return [type] [description]
*/
function getChilds($data, $id = 0, $pk = 'id', $pid = 'parent_id') {
$array = [];
foreach ($data as $k => $v) {
if ($v[$pid] == $id) {
$array[] = $v[$pk];
$array = array_merge($array, getChilds($data, $v[$pk]));
}
}
return $array;
}
// 应用公共文件

View File

@@ -24,16 +24,14 @@ class Index extends Base{
if(request()->isAjax()){
return ['code' => 1, 'data' => 'SentOS'];
}else{
return view('/index');
return `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible"content="IE=edge"><meta name="viewport"content="width=device-width, initial-scale=1"><title>SentOS</title><style>html,body{background-color:#fff;color:#3c4042;font-family:'Raleway',sans-serif;font-weight:100;height:80vh;margin:0}.top{text-align:right;line-height:35px;padding:0 20px}.top a{color:#333333;padding:0 10px}.full-height{height:90vh}.flex-center{align-items:center;display:flex;justify-content:center}.position-ref{position:relative}.top-right{position:absolute;right:10px;top:18px}.content{text-align:center}.title{font-size:84px}.links>a{color:#3c4042;padding:0 25px;font-size:12px;font-weight:600;letter-spacing:.1rem;text-decoration:none;text-transform:uppercase}.m-b-md{margin-bottom:30px}</style></head><body><div class="flex-center position-ref full-height"><div class="content"><div class="title m-b-md">SentOS</div><div class="links"></div></div></div><div style="text-align: center; font-size: 12px;"><p><a href="https://beian.miit.gov.cn/"target="_blank"style="color: #333333; text-decoration: none;">赣ICP备13006622号-1</a></p><p>技术支持:<a href="https://www.tensent.cn"target="_blank"style="color: #333333; text-decoration: none;">腾速科技</a></p></div></body></html>`;
}
}
public function test(){
// $area = \think\facade\Db::name('areas')->select();
// $save = [];
// foreach($area as $val){
// $save[] = ['title' => $val['area'], 'code' => $val['area_id'], 'parent_id' => $val['city_id'], 'first' => '', 'create_time' => time(), 'update_time' => time()];
// }
// \think\facade\Db::name('area')->insertAll($save);
}
public function miss(){
return '404 Not Found!';
}
}

View File

@@ -11,7 +11,7 @@ namespace app\controller\auth;
use think\facade\Request;
use app\model\auth\Departments;
use app\services\auth\DepartmentService;
use sent\tree\Tree;
use Xin\Support\Arr;
use app\controller\Base;
class Department extends Base {
@@ -35,7 +35,7 @@ class Department extends Base {
}
}
}
$tree = (new Tree())->listToTree($list, 'id', 'parent_id', 'children', $root);
$tree = Arr::tree($list, null, 0, ['id'=>'id', 'parent' => 'parent_id', 'child' => 'children']);
if(empty($tree)){
$this->data['data'] = $list;
}else{

View File

@@ -11,9 +11,6 @@ namespace app\controller\auth;
use app\controller\Base;
use app\services\auth\AuthService;
use app\services\SocialiteService;
use app\model\Member;
use app\model\auth\Users;
use app\model\auth\RolesAccess;
class Index extends Base{
@@ -28,21 +25,6 @@ class Index extends Base{
return $this->data;
}
public function member(){
// $output = $this->app->console->call('migrate:run');
// return $output->fetch();
// $map = [];
// $member = Member::where($map)->select();
// $save = [];
// foreach($member as $item){
// $user = Users::where('username', '=', $item->username)->findOrEmpty();
// if($user->isEmpty()){
// $save[] = ['uid' => $item['uid'], 'username' => $item['username'], 'password' => '123456', 'nickname' => $item['nickname'], 'email' => $item['email'], 'department_id' => $item['department']];
// }
// }
// (new Users())->saveAll($save);
}
/**
* @title 第三方账号登录
*/

View File

@@ -0,0 +1,71 @@
<?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\customer;
use app\controller\Base;
use app\services\company\CompanyService;
/**
* @title 企业信息模型
*/
class Company extends Base{
/**
* @title 企业列表
*
* @time 2020年01月09日
* @param CompanyService $service
* @return Array
*/
public function index(CompanyService $service) {
$data = $service->getCompanyList($this->request);
$this->data['data'] = $data;
return $this->data;
}
/**
* @title 企业详情
*
* @time 2020年01月09日
* @param CompanyService $service
* @return Array
*/
public function detail(CompanyService $service) {
$data = $service->getCompanyDetail($this->request);
$this->data['data'] = $data;
return $this->data;
}
/**
* @title 修改企业
*
* @time 2020年01月09日
* @param CompanyService $service
* @return Array
*/
public function edit(CompanyService $service) {
$data = $service->editCompany($this->request);
$this->data['data'] = $data;
return $this->data;
}
/**
* @title 导入企业信息
*
* @param CompanyService $service
* @return void
*/
public function insert(CompanyService $service){
$this->data['data'] = $service->insertCompanyData($this->request);
return $this->data;
}
}

View File

@@ -1,6 +1,12 @@
<?php
// 全局中间件定义文件
return [
// 全局请求缓存
// \think\middleware\CheckRequestCache::class,
// 多语言加载
// \think\middleware\LoadLangPack::class,
// Session初始化
// \think\middleware\SessionInit::class
\app\middleware\AllowCrossDomain::class,
\app\middleware\Api::class,
\app\middleware\Validate::class,

View File

@@ -16,6 +16,7 @@ use think\Request;
class AllowCrossDomain{
protected $header = [
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Credentials' => 'true',
'Access-Control-Max-Age' => 1800,
'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE, OPTIONS',

View File

@@ -12,7 +12,6 @@ namespace app\middleware;
use think\App;
use think\Response;
use xiaodi\JWTAuth\Exception\JWTException;
class Check{
protected $app;
@@ -31,26 +30,16 @@ class Check{
*/
public function handle($request, \Closure $next, $store = null){
try {
$verify = $this->app->get('jwt')->store($store)->verify();
$verify = \leruge\facade\JWT::validate();;
if (true === $verify) {
if ($this->app->get('jwt.user')->getBind()) {
if ($user = $this->app->get('jwt.user')->find()) {
$user = \leruge\facade\JWT::auth();
if ($user->uid) {
// 路由注入
$request->user = $user;
// 绑定当前用户模型
$class = $this->app->get('jwt.user')->getClass();
$this->app->bind($class, $user);
// 绑定用户后一些业务处理
$this->bindUserAfter($request);
} else {
return Response::create(['message' => '登录校验已失效, 请重新登录', 'code' => 2000], 'json', 401);
}
}
return $next($request);
}
} catch (JWTException $e) {
} catch (\think\Exception $e) {
return Response::create(['message' => $e->getMessage(), 'code' => 2000], 'json', 401);
}
}

View File

@@ -10,7 +10,6 @@ namespace app\model\auth;
use app\model\BaseModel;
use think\facade\Config;
use xiaodi\JWTAuth\Facade\Jwt;
class Users extends BaseModel{
@@ -28,7 +27,7 @@ class Users extends BaseModel{
}
public function getTokenAttr($value, $data){
$token = Jwt::store('api')->token($data)->__toString();
$token = \leruge\facade\JWT::builder($data, false);
return $token;
}

View File

@@ -0,0 +1,67 @@
<?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\model\customer;
use app\model\BaseModel;
use think\model\concern\SoftDelete;
use think\facade\Cache;
class Company extends BaseModel{
use SoftDelete;
protected $deleteTime = 'delete_time';
protected $defaultSoftDelete = 0;
public $insertFieldAlis = [
'企业编号' => ['name' => 'org_code', 'table' => 'company'],
'公司名称' => ['name' => 'name', 'table' => 'company'],
'网址' => ['name' => 'web_site', 'table' => 'company'],
'一级行业' => ['name' => 'industry', 'table' => 'company'],
'二级行业' => ['name' => 'industry_sub', 'table' => 'company'],
'三级行业' => ['name' => 'industry_three', 'table' => 'company'],
'省份' => ['name' => 'province', 'table' => 'company'],
'城市' => ['name' => 'city', 'table' => 'company'],
'区县' => ['name' => 'area', 'table' => 'company'],
'年营业额' => ['name' => 'turnover_text', 'table' => 'company',],
'员工人数' => ['name' => 'staff_num_text', 'table' => 'company'],
'注册资金' => ['name' => 'reg_capital', 'table' => 'company'],
'资金类型' => ['name' => 'reg_capital_type', 'table' => 'company'],
'PC数量' => ['name' => 'pc_num_text', 'table' => 'company'],
'营收规模' => ['name' => 'turnover', 'table' => 'company'],
'社保人数' => ['name' => 'social_insurance', 'table' => 'company'],
'企业性质' => ['name' => 'company_type', 'table' => 'company'],
'是否上市' => ['name' => 'is_ipo_text', 'table' => 'company'],
'融资信息' => ['name' => 'finance_info', 'table' => 'company'],
'企业标签' => ['name' => 'tags', 'table' => 'company'],
'企业状态' => ['name' => 'status', 'table' => 'company'],
'成立时间' => ['name' => 'reg_date', 'table' => 'company'],
'注册地址' => ['name' => 'reg_address', 'table' => 'company'],
'联系人' => ['name' => 'name', 'table' => 'contact'],
'岗位' => ['name' => 'job','table' => 'contact'],
'固定电话' => ['name' => 'phone', 'table' => 'contact'],
'手机号码' => ['name' => 'mobile', 'table' => 'contact'],
'邮箱' => ['name' => 'email', 'table' => 'contact'],
'是否法人' => ['name' => 'is_faren', 'table' => 'contact']
];
public function getAreaTAttr($value, $data){
$text = [$data['province'], $data['city'], $data['area']];
return implode(",", array_filter($text));
}
public function getIndustryTAttr($value, $data){
$text = [$data['industry'], $data['industry_sub'], $data['industry_three']];
return implode(",", array_filter($text));
}
public function contact(){
return $this->hasMany(Contact::class);
}
}

View File

@@ -6,10 +6,16 @@
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\model\customer;
return [
'Access-Control-Allow-Credentials' => 'true',
'Access-Control-Max-Age' => 1800,
'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE, OPTIONS',
'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With',
];
use app\model\BaseModel;
use think\model\concern\SoftDelete;
class Contact extends BaseModel{
use SoftDelete;
protected $deleteTime = 'delete_time';
protected $defaultSoftDelete = 0;
protected $name = "company_contact";
}

View File

@@ -10,7 +10,7 @@ namespace app\services\auth;
use app\model\auth\Users;
use app\model\auth\Permissions;
use sent\tree\Tree;
use Xin\Support\Arr;
use think\facade\Env;
class AuthService{
@@ -52,7 +52,7 @@ class AuthService{
public function getAuthMenu(){
$order = "sort asc, id desc";
$map = [];
if(request()->user['uid'] != Env::get('admin_root')){
if(request()->user['uid'] != Env::get('ADMIN')){
$map[] = ['name', 'IN', request()->auth()['permission']];
}
$map[] = ['type', '<>', 'button'];
@@ -62,7 +62,7 @@ class AuthService{
$item->hiddenBreadcrumb = (int) $item['hiddenBreadcrumb'];
})->toArray();
return (new Tree())->listToTree($list, 'id', 'parent_id', 'children');
return Arr::tree($list, null, 0, ['id'=>'id', 'parent' => 'parent_id', 'child' => 'children']);
}
/**
@@ -72,7 +72,7 @@ class AuthService{
*/
public function getAuthPermissions(){
$map = [];
if(request()->user['uid'] != Env::get('admin_root')){
if(request()->user['uid'] != Env::get('ADMIN')){
$map[] = ['name', 'IN', request()->auth()['permission']];
}
$list = Permissions::where($map)->select();

View File

@@ -9,8 +9,7 @@
namespace app\services\auth;
use app\model\auth\Permissions;
use sent\tree\Tree;
use think\facade\Env;
use Xin\Support\Arr;
class MenuService{
@@ -21,10 +20,9 @@ class MenuService{
* @return void
*/
public function getSystemMenu($is_menu = true, $is_tree = true){
$rootid = Env::get('admin_root');
$order = "sort asc, id desc";
$map = [];
if(request()->user['uid'] != $rootid){
if(request()->user['uid'] != env('ADMIN')){
$map[] = ['name', 'IN', request()->auth()['permission']];
}
if($is_menu){
@@ -37,7 +35,7 @@ class MenuService{
$item->hiddenBreadcrumb = (int) $item['hiddenBreadcrumb'];
})->toArray();
if($is_tree){
$menu = (new Tree())->listToTree($list, 'id', 'parent_id', 'children');
$menu = Arr::tree($list, null, 0, ['id'=>'id', 'parent' => 'parent_id', 'child' => 'children']);
return $menu;
}else{

View File

@@ -11,7 +11,7 @@ namespace app\services\auth;
use app\model\auth\Roles;
use app\model\auth\PermissionAccess;
use app\model\auth\RolesAccess;
use sent\tree\Tree;
use Xin\Support\Arr;
class RoleService{
/**
@@ -36,7 +36,7 @@ class RoleService{
$item->permission_id = $permission_id;
});
if($is_tree){
return (new Tree())->listToTree($list->toArray(), 'id', 'parent_id', 'children');
return Arr::tree($list->toArray(), null, 0, ['id'=>'id', 'parent' => 'parent_id', 'child' => 'children']);
}else{
return $list;
}

View File

@@ -10,8 +10,8 @@ namespace app\services\auth;
use app\model\auth\Users;
use app\model\auth\UsersLog;
use xin\helper\Server;
use xin\helper\Time;
use Xin\Support\Server;
use Xin\Support\Time;
class UsersLogService{
@@ -133,7 +133,7 @@ class UsersLogService{
}
protected static function Parser($text) {
$doc = new \doc\Doc();
return $doc->parse($text);
$service = app()->make(\sent\services\DocService::class);
return $service->parse($text);
}
}

View File

@@ -0,0 +1,119 @@
<?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\services\company;
use app\model\customer\Company;
use app\model\customer\Contact;
/**
* Undocumented class
*/
class CompanyService {
/**
* @title 获取企业列表
*
* @param [type] $request
* @return void
*/
public function getCompanyList($request) {
$param = $request->param();
$map = [];
if (isset($param['name']) && $param['name']) {
$map[] = ['name', 'LIKE', '%' . $param['name'] . '%'];
}
if (isset($param['org_code']) && $param['org_code']) {
$map[] = ['org_code', '=', $param['org_code']];
}
$list = Company::with(['contact'])->where($map)->order('id desc')->paginate($request->pageConfig);
return $list->append(['area_t', 'industry_t']);
}
/**
* @title 获取企业详情
*
* @param [type] $request
* @return void
*/
public function getCompanyDetail($request) {
$param = $request->param();
if (!isset($param['id'])) {
return [];
}
$map = [];
$map[] = ['id', '=', $param['id']];
$data = Company::with(['contact'])->where($map)->find();
return $data->append(['area_t', 'industry_t']);
}
/**
* @title 导入数据
*
* @return void
*/
public function insertCompanyData($request) {
$data = $request->post('data');
$company = new Company();
$contactM = new Contact();
$resultData = [];
foreach ($data as $k => $item) {
$info = [];
if (!is_array($item)) {
continue;
}
foreach ($item as $key => $value) {
if (isset($company->insertFieldAlis[$key])) {
$info[$company->insertFieldAlis[$key]['table']][$company->insertFieldAlis[$key]['name']] = trim($value);
}
}
$info['company']['uid'] = $info['contact']['uid'] = request()->user['uid'];
if (isset($info['company']) && isset($info['company']['name'])) {
$customer = $company->where('name', '=', trim($info['company']['name']))->find();
$company_id = isset($customer['id']) ? $customer['id'] : 0;
if (!$company_id) {
$info['company']['turnover'] = '';
$info['company']['staff_num'] = '';
$info['company']['come_from'] = '';
$info['company']['company_type'] = '';
$info['company']['pc_count'] = '';
$customer = Company::create($info['company']);
$company_id = $customer->id;
} else {
$save_coustomer = $info['company'];
if (!empty($save_coustomer)) {
$save_coustomer['id'] = $company_id;
$result = $customer->save($save_coustomer);
}
}
if (isset($info['contact']['name'])) {
$map = [];
$map[] = ['name', '=', $info['contact']['name']];
$map[] = ['mobile', '=', isset($info['contact']['mobile']) ? $info['contact']['mobile'] : ''];
$map[] = ['company_id', '=', $company_id];
$contact = $contactM->where($map)->find(); //每次查询重新实例化
$contact_id = isset($contact['id']) ? $contact['id'] : 0;
if (!$contact_id) {
$info['contact']['company_id'] = $company_id;
$res = Contact::create($info['contact']);
$contact_id = $res->id;
} else {
$info['contact']['id'] = $contact_id;
$contact->save($info['contact']);
}
} else {
$contact_id = 0;
}
$resultData[] = ['company_id' => $company_id, 'contact_id' => (int) $contact_id, 'company' => $info['company'], 'contact' => $info['contact']];
}
}
return empty($resultData) ? false : $resultData;
}
}

View File

@@ -10,7 +10,7 @@ namespace app\services\system;
use app\model\system\Dictionary;
use app\model\system\DictionaryType;
use sent\tree\Tree;
use Xin\Support\Arr;
class DictionaryService{
/**
@@ -53,7 +53,7 @@ class DictionaryService{
public function getTree($request){
$list = DictionaryType::select()->toArray();
$tree = (new Tree())->listToTree($list, 'id', 'parent_id', 'children');
$tree = Arr::tree($list, null, 0, ['id'=>'id', 'parent' => 'parent_id', 'child' => 'children']);
return $tree;
}
/**

View File

@@ -7,7 +7,7 @@
"thinkphp",
"ORM"
],
"homepage": "http://thinkphp.cn/",
"homepage": "https://www.thinkphp.cn/",
"license": "Apache-2.0",
"authors": [
{
@@ -20,23 +20,23 @@
}
],
"require": {
"php": ">=7.2.5",
"topthink/framework": "^6.0.0",
"topthink/think-orm": "^2.0",
"xiaodi/think-jwt": "^2.0",
"sent/tree": "^1.0",
"xin/helper": "1.0",
"php": ">=8.0.0",
"topthink/framework": "^8.0",
"topthink/think-orm": "^3.0",
"topthink/think-filesystem": "^2.0",
"topthink/think-view": "^2.0",
"topthink/think-migration": "^3.0",
"thans/thinkphp-filesystem-cloud": "^1.0",
"yzh52521/schedule": "^1.0"
"xin/support": "^1.0",
"leruge/jwt": "^2.0"
},
"require-dev": {
"symfony/var-dumper": "^4.2",
"topthink/think-trace":"^1.0"
"symfony/var-dumper": ">=4.2",
"topthink/think-trace": "^1.0"
},
"autoload": {
"psr-4": {
"app\\": "app"
"app\\": "app",
"sent\\": "sent"
},
"psr-0": {
"": "extend/"

2354
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@
return [
// 应用地址
'app_host' => env('app.host', ''),
'app_host' => env('APP_HOST', ''),
// 应用的命名空间
'app_namespace' => '',
// 是否启用路由

View File

@@ -1,4 +0,0 @@
<?php
return [
'admin_root' => [1]
];

View File

@@ -6,7 +6,7 @@
return [
// 默认缓存驱动
'default' => env('cache.driver', 'file'),
'default' => 'file',
// 缓存连接方式配置
'stores' => [

View File

@@ -5,6 +5,5 @@
return [
// 指令定义
'commands' => [
'schedule:run'=>\app\command\Schedule::class,
],
];

View File

@@ -2,7 +2,7 @@
return [
// 默认使用的数据库连接配置
'default' => env('database.driver', 'mysql'),
'default' => env('DB_DRIVER', 'mysql'),
// 自定义时间查询规则
'time_query_rule' => [],
@@ -22,23 +22,23 @@ return [
'connections' => [
'mysql' => [
// 数据库类型
'type' => env('database.type', 'mysql'),
'type' => env('DB_TYPE', 'mysql'),
// 服务器地址
'hostname' => env('database.hostname', '127.0.0.1'),
'hostname' => env('DB_HOST', '127.0.0.1'),
// 数据库名
'database' => env('database.database', ''),
'database' => env('DB_NAME', ''),
// 用户名
'username' => env('database.username', 'root'),
'username' => env('DB_USER', 'root'),
// 密码
'password' => env('database.password', ''),
'password' => env('DB_PASS', ''),
// 端口
'hostport' => env('database.hostport', '3306'),
'hostport' => env('DB_PORT', '3306'),
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => env('database.charset', 'utf8'),
'charset' => env('DB_CHARSET', 'utf8'),
// 数据库表前缀
'prefix' => env('database.prefix', ''),
'prefix' => env('DB_PREFIX', ''),
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
@@ -53,9 +53,11 @@ return [
// 是否需要断线重连
'break_reconnect' => false,
// 监听SQL
'trigger_sql' => env('app_debug', true),
'trigger_sql' => env('APP_DEBUG', true),
// 开启字段缓存
'fields_cache' => false,
]
],
// 更多的数据库配置信息
],
];

View File

@@ -2,7 +2,7 @@
return [
// 默认磁盘
'default' => env('filesystem.driver', 'local'),
'default' => 'local',
// 磁盘列表
'disks' => [
'local' => [
@@ -20,33 +20,5 @@ return [
'visibility' => 'public',
],
// 更多的磁盘配置信息
'aliyun' => [
'type' => 'aliyun',
'accessId' => '******',
'accessSecret' => '******',
'bucket' => 'bucket',
'endpoint' => 'oss-cn-hongkong.aliyuncs.com',
'url' => 'http://oss-cn-hongkong.aliyuncs.com',//不要斜杠结尾此处为URL地址域名。
],
'qiniu' => [
'type' => 'qiniu',
'accessKey' => '******',
'secretKey' => '******',
'bucket' => 'bucket',
'url' => '',//不要斜杠结尾此处为URL地址域名。
],
'qcloud' => [
'type' => 'qcloud',
'region' => '***', //bucket 所属区域 英文
'appId' => '***', // 域名中数字部分
'secretId' => '***',
'secretKey' => '***',
'bucket' => '***',
'timeout' => 60,
'connect_timeout' => 60,
'cdn' => '您的 CDN 域名',
'scheme' => 'https',
'read_from_cdn' => false,
]
],
];

View File

@@ -1,45 +1,18 @@
<?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>
// +----------------------------------------------------------------------
use app\model\auth\Users;
/**
* @title jwt配置
* @author Leruge
* @email leruge@163.com
*/
return [
'stores' => [
'api' => [
'sso' => [
'enable' => false,
],
'token' => [
'unique_id_key' => 'uid',
'signer_key' => 'tensent',
'not_before' => 0,
'expires_at' => 86400,
'refresh_ttL' => 72000,
'signer' => 'Lcobucci\JWT\Signer\Hmac\Sha256',
'type' => 'Header',
'relogin_code' => 50001,
'refresh_code' => 50002,
'iss' => 'client.tensent',
'aud' => 'server.tensent',
'automatic_renewal' => false,
],
'user' => [
'bind' => true,
'class' => Users::class,
]
]
],
'manager' => [
// 缓存前缀
'prefix' => 'jwt',
// 黑名单缓存名
'blacklist' => 'blacklist',
// 白名单缓存名
'whitelist' => 'whitelist'
]
// JWT加密算法
'alg' => env('JWT.ALG', 'HS256'),
'secret' => env('JWT.SECRET', 'leruge'),
// 非对称加密需要配置
'public_key' => env('JWT.PUBLIC_KEY'),
'private_key' => env('JWT.PRIVATE_KEY'),
'password' => env('JWT.PASSWORD'),
// JWT有效期
'ttl' => env('JWT.TTL', 3600 * 24 * 365),
];

View File

@@ -5,7 +5,7 @@
return [
// 默认语言
'default_lang' => env('lang.default_lang', 'zh-cn'),
'default_lang' => env('DEFAULT_LANG', 'zh-cn'),
// 允许的语言列表
'allow_lang_list' => [],
// 多语言自动侦测变量名

View File

@@ -5,7 +5,7 @@
// +----------------------------------------------------------------------
return [
// 默认日志记录通道
'default' => env('log.channel', 'file'),
'default' => 'file',
// 日志记录级别
'level' => [],
// 日志类型记录的通道 ['error'=>'email',...]

View File

@@ -4,11 +4,5 @@ return [
// 别名或分组
'alias' => [],
// 优先级设置,此数组中的中间件会按照数组中的顺序优先执行
'priority' => [
\app\middleware\AllowCrossDomain::class,
\app\middleware\Api::class,
\app\middleware\Validate::class,
\app\middleware\Check::class,
\app\middleware\Auth::class
],
'priority' => [],
];

View File

@@ -13,7 +13,7 @@ return [
// 是否开启路由延迟解析
'url_lazy_route' => false,
// 是否强制使用路由
'url_route_must' => true,
'url_route_must' => false,
// 合并路由规则
'route_rule_merge' => false,
// 路由是否完全匹配

View File

@@ -5,7 +5,7 @@
return [
// 模板引擎类型使用Think
'type' => 'php',
'type' => 'Think',
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
'auto_rule' => 1,
// 模板目录名

View File

@@ -1,68 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
use Phinx\Db\Adapter\MysqlAdapter;
class BaseData extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('dictionary', ['engine' => 'InnoDB', 'collation' => 'utf8_general_ci', 'comment' => '字典表' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
$table->addColumn('name', 'string', ['limit' => 15,'null' => false,'default' => '','signed' => true,'comment' => '项名称',])
->addColumn('values', 'string', ['limit' => 255,'null' => false,'default' => '','signed' => true,'comment' => '键值',])
->addColumn('dic_type', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '所属字典',])
->addColumn('create_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
->addColumn('update_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
->addColumn('delete_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '删除状态null 未删除 timestamp 已删除',])
->create();
$table = $this->table('dictionary_type', ['engine' => 'InnoDB', 'collation' => 'utf8_general_ci', 'comment' => '字典分类表' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
$table->addColumn('name', 'string', ['limit' => 15,'null' => false,'default' => '','signed' => true,'comment' => '字典名称',])
->addColumn('parent_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '父级ID',])
->addColumn('code', 'string', ['limit' => 255,'null' => false,'default' => '','signed' => true,'comment' => '编码',])
->addColumn('create_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
->addColumn('update_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
->addColumn('delete_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '删除状态null 未删除 timestamp 已删除',])
->create();
$table = $this->table('system_config', ['engine' => 'InnoDB', 'collation' => 'utf8_general_ci', 'comment' => '系统配置表' ,'id' => 'id' ,'primary_key' => ['id']]);
$table->addColumn('name', 'string', ['limit' => 100,'null' => false,'default' => null,'signed' => true,'comment' => '配置名称',])
->addColumn('title', 'string', ['limit' => 200,'null' => false,'default' => null,'signed' => true,'comment' => '配置标题',])
->addColumn('value', 'text', ['null' => false,'signed' => true,'comment' => '配置值',])
->addColumn('type', 'string', ['limit' => 100,'null' => false,'default' => null,'signed' => true,'comment' => '表单类型',])
->addColumn('group_name', 'string', ['limit' => 100,'null' => false,'default' => null,'signed' => true,'comment' => '分组',])
->addColumn('remark', 'string', ['limit' => 200,'null' => false,'default' => null,'signed' => true,'comment' => '描述',])
->addColumn('status', 'boolean', ['null' => false,'default' => null,'signed' => true,'comment' => '状态',])
->addColumn('create_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => true,'comment' => '创建时间',])
->addColumn('update_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => true,'comment' => '更新时间',])
->create();
$table = $this->table('area',array('engine'=>'MyISAM'));
$table->addColumn('title', 'string',array('limit' => 255,'default'=>'','comment'=>'名称'))
->addColumn('code', 'string',array('limit'=>18,'comment'=>'编号'))
->addColumn('parent_id', 'integer',array('limit'=>11,'comment'=>'上级code'))
->addColumn('first', 'string',array('limit'=>255,'comment'=>'首字母'))
->addColumn('create_time', 'integer',array('limit'=>11, 'default'=>0,'comment'=>'创建时间'))
->addColumn('update_time', 'integer',array('limit'=>11, 'default'=>0,'comment'=>'更新时间'))
->create();
}
}

View File

@@ -1,88 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
use Phinx\Db\Adapter\MysqlAdapter;
class UserData extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('users', ['engine' => 'InnoDB', 'collation' => 'utf8_general_ci', 'comment' => '用户表' ,'id' => 'uid','signed' => true ,'primary_key' => ['uid']]);
$table->addColumn('username', 'string', ['limit' => 15,'null' => false,'default' => '','signed' => true,'comment' => '用户名',])
->addColumn('nickname', 'string', ['limit' => 255,'null' => false,'default' => null,'signed' => true,'comment' => '姓名',])
->addColumn('password', 'string', ['limit' => 255,'null' => false,'default' => null,'signed' => true,'comment' => '用户密码',])
->addColumn('email', 'string', ['limit' => 100,'null' => true,'signed' => true,'comment' => '邮箱 登录',])
->addColumn('avatar', 'string', ['limit' => 255,'null' => true,'signed' => true,'comment' => '用户头像',])
->addColumn('remember_token', 'string', ['limit' => 512,'null' => true,'signed' => true,'comment' => '用户token',])
->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '创建人ID',])
->addColumn('department_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '部门ID',])
->addColumn('user_type', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '用户类型',])
->addColumn('status', 'integer', ['default' => 1,'signed' => true,'comment' => '用户状态 1 正常 2 禁用',])
->addColumn('last_login_ip', 'string', ['limit' => 50,'null' => false,'default' => 0,'signed' => true,'comment' => '最后登录IP',])
->addColumn('last_login_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '最后登录时间',])
->addColumn('create_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
->addColumn('update_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
->addColumn('delete_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '删除状态0未删除 >0 已删除',])
->create();
$table = $this->table('departments', ['engine' => 'InnoDB', 'collation' => 'utf8_general_ci', 'comment' => '部门表' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
$table->addColumn('title', 'string', ['limit' => 15,'null' => false,'default' => '','signed' => true,'comment' => '部门名称',])
->addColumn('parent_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '父级ID',])
->addColumn('principal', 'string', ['limit' => 20,'null' => false,'default' => '','signed' => true,'comment' => '负责人',])
->addColumn('mobile', 'string', ['limit' => 20,'null' => false,'default' => '','signed' => true,'comment' => '联系电话',])
->addColumn('email', 'string', ['limit' => 100,'null' => false,'default' => '','signed' => true,'comment' => '联系又想',])
->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '创建人ID',])
->addColumn('status', 'integer', ['default' => 1,'signed' => true,'comment' => '1 正常 2 停用',])
->addColumn('sort', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '排序字段',])
->addColumn('create_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
->addColumn('update_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
->addColumn('delete_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '删除状态null 未删除 timestamp 已删除',])
->create();
$table = $this->table('users_log', ['engine' => 'InnoDB', 'collation' => 'utf8_general_ci', 'comment' => '用户表' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
$table->addColumn('uid', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => false,'comment' => '用户ID',])
->addColumn('title', 'string', ['limit' => 100,'null' => false,'default' => '','signed' => true,'comment' => '操作名称',])
->addColumn('method', 'string', ['limit' => 20,'null' => false,'default' => 'POST','signed' => true,'comment' => '操作类型',])
->addColumn('route', 'string', ['limit' => 255,'null' => false,'default' => '','signed' => true,'comment' => '操作路由',])
->addColumn('params', 'text', ['null' => false,'signed' => true,'comment' => '操作参数',])
->addColumn('client_ip', 'string', ['limit' => 100,'null' => false,'default' => '','signed' => true,'comment' => '客户端IP',])
->addColumn('browser', 'string', ['limit' => 255,'null' => false,'default' => '','signed' => true,'comment' => '浏览器',])
->addColumn('code', 'string', ['limit' => 20,'null' => false,'default' => null,'signed' => true,'comment' => '状态码',])
->addColumn('create_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
->addColumn('update_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
->addColumn('delete_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '删除状态0未删除 >0 已删除',])
->create();
$table = $this->table('jobs', ['engine' => 'InnoDB', 'collation' => 'utf8_general_ci', 'comment' => '岗位表' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
$table->addColumn('job_name', 'string', ['limit' => 15,'null' => false,'default' => '','signed' => true,'comment' => '岗位名称',])
->addColumn('coding', 'string', ['limit' => 50,'null' => false,'default' => '','signed' => true,'comment' => '编码',])
->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '创建人ID',])
->addColumn('status', 'integer', ['default' => 1,'signed' => true,'comment' => '1 正常 2 停用',])
->addColumn('sort', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '排序字段',])
->addColumn('description', 'string', ['limit' => 255,'null' => false,'default' => '','signed' => true,'comment' => '描述',])
->addColumn('create_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
->addColumn('update_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
->addColumn('delete_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '删除状态null 未删除 timestamp 已删除',])
->create();
}
}

View File

@@ -1,83 +0,0 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
use Phinx\Db\Adapter\MysqlAdapter;
class UserAuth extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$table = $this->table('permissions', ['engine' => 'InnoDB', 'collation' => 'utf8_general_ci', 'comment' => '系统菜单表' ,'id' => 'id' ,'primary_key' => ['id']]);
$table->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => true,'comment' => '创建人',])
->addColumn('parent_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => true,'comment' => '上级ID',])
->addColumn('name', 'string', ['limit' => 200,'null' => false,'default' => null,'signed' => true,'comment' => '菜单标识',])
->addColumn('title', 'string', ['limit' => 255,'null' => true,'signed' => true,'comment' => '权限标题',])
->addColumn('type', 'string', ['limit' => 20,'null' => true,'signed' => true,'comment' => '栏目类型',])
->addColumn('icon', 'string', ['limit' => 100,'null' => true,'signed' => true,'comment' => '图标',])
->addColumn('color', 'string', ['limit' => 10,'null' => true,'signed' => true,'comment' => '标题颜色',])
->addColumn('hidden', 'integer', ['default' => 0,'signed' => true,'comment' => '是否隐藏'])
->addColumn('hiddenbreadcrumb', 'integer', ['default' => 0,'limit' => MysqlAdapter::INT_REGULAR,'signed' => true,'comment' => '是否隐藏面包屑菜单'])
->addColumn('affix', 'integer', ['default' => 0,'limit' => MysqlAdapter::INT_REGULAR,'comment' => '是否固定',])
->addColumn('fullpage', 'integer', ['default' => 0,'limit' => MysqlAdapter::INT_REGULAR,'comment' => '是否全屏',])
->addColumn('path', 'string', ['limit' => 200,'null' => false,'default' => null,'signed' => true,'comment' => '路径',])
->addColumn('redirect', 'string', ['limit' => 200,'null' => true,'signed' => true,'comment' => '重定向',])
->addColumn('component', 'string', ['limit' => 200,'null' => true,'signed' => true,'comment' => '组件',])
->addColumn('api_list', 'text', ['null' => true,'signed' => true,'comment' => 'api接口列表',])
->addColumn('sort', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 1,'signed' => true,'comment' => '排序',])
->addColumn('status', 'integer', ['default' => 1,'signed' => true,'comment' => '状态',])
->addColumn('create_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => true,'comment' => '创建时间',])
->addColumn('update_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => true,'comment' => '更新时间',])
->create();
$table = $this->table('roles', ['engine' => 'InnoDB', 'collation' => 'utf8_general_ci', 'comment' => '角色表' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
$table->addColumn('title', 'string', ['limit' => 15,'null' => false,'default' => '','signed' => true,'comment' => '角色名',])
->addColumn('identify', 'string', ['limit' => 20,'null' => false,'default' => 1,'signed' => true,'comment' => '角色的标识,用英文表示,用于后台路由权限',])
->addColumn('parent_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '父级ID',])
->addColumn('description', 'string', ['limit' => 255,'null' => false,'default' => '','signed' => true,'comment' => '角色备注',])
->addColumn('data_range', 'integer', ['default' => 0,'signed' => true,'comment' => '1 全部数据 2 自定义数据 3 仅本人数据 4 部门数据 5 部门及以下数据',])
->addColumn('sort', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '排序',])
->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '创建人ID',])
->addColumn('create_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
->addColumn('update_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
->addColumn('delete_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '删除状态0未删除 >0 已删除',])
->create();
$table = $this->table('role_has_departments', ['engine' => 'InnoDB', 'collation' => 'utf8_general_ci', 'comment' => '角色部门表' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
$table->addColumn('role_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => false,'comment' => '角色ID',])
->addColumn('department_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => false,'comment' => '部门ID',])
->create();
$table = $this->table('role_has_permissions', ['engine' => 'InnoDB', 'collation' => 'utf8_general_ci', 'comment' => '角色权限表' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
$table->addColumn('role_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => false,'comment' => '角色ID',])
->addColumn('permission_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => false,'comment' => '权限ID',])
->create();
$table = $this->table('user_has_jobs', ['engine' => 'InnoDB', 'collation' => 'utf8_general_ci', 'comment' => '用户角色表' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
$table->addColumn('uid', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => false,'comment' => '用户ID',])
->addColumn('job_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => false,'comment' => '岗位ID',])
->create();
$table = $this->table('user_has_roles', ['engine' => 'InnoDB', 'collation' => 'utf8_general_ci', 'comment' => '用户角色表' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
$table->addColumn('uid', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => false,'comment' => '用户ID',])
->addColumn('role_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => null,'signed' => false,'comment' => '角色ID',])
->create();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,42 +0,0 @@
<?php
use think\migration\Seeder;
class BaseData extends Seeder
{
/**
* Run Method.
*
* Write your database seeder using this method.
*
* More information on writing seeders is available here:
* http://docs.phinx.org/en/latest/seeding.html
*/
public function run(){
$permissions = array(
array('id' => '1','creator_id' => '1','parent_id' => '0','name' => 'systems','title' => '系统','type' => 'menu','icon' => 'el-icon-tools','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/system','redirect' => '','component' => '','api_list' => '[]','sort' => '2','status' => '1','create_time' => '1647866389','update_time' => '1647831105','fullpage' => '0'),
array('id' => '2','creator_id' => '0','parent_id' => '1','name' => 'system','title' => '配置管理','type' => 'menu','icon' => 'el-icon-set-up','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/system/setting','redirect' => '','component' => 'system/setting','api_list' => '[]','sort' => '21','status' => '1','create_time' => '1647866389','update_time' => '1653363608','fullpage' => '0'),
array('id' => '3','creator_id' => '0','parent_id' => '15','name' => 'user','title' => '用户管理','type' => 'menu','icon' => 'el-icon-avatar','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/auth/user','redirect' => '','component' => 'auth/user','api_list' => '[]','sort' => '22','status' => '1','create_time' => '1647866389','update_time' => '1653363713','fullpage' => '0'),
array('id' => '4','creator_id' => '0','parent_id' => '15','name' => 'role','title' => '角色管理','type' => 'menu','icon' => 'el-icon-medal','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/auth/role','redirect' => '','component' => 'auth/role','api_list' => '[]','sort' => '23','status' => '1','create_time' => '1647866389','update_time' => '1653363781','fullpage' => '0'),
array('id' => '5','creator_id' => '0','parent_id' => '1','name' => 'dic','title' => '字典管理','type' => 'menu','icon' => 'el-icon-checked','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/system/dic','redirect' => '','component' => 'system/dic','api_list' => '[]','sort' => '24','status' => '1','create_time' => '1634565766','update_time' => '1653363627','fullpage' => '0'),
array('id' => '6','creator_id' => '0','parent_id' => '15','name' => 'department','title' => '部门管理','type' => 'menu','icon' => 'el-icon-tools','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/auth/department','redirect' => '','component' => 'auth/department','api_list' => '[]','sort' => '25','status' => '1','create_time' => '1647866389','update_time' => '1647830185','fullpage' => '0'),
array('id' => '7','creator_id' => '0','parent_id' => '15','name' => 'settingMenu','title' => '权限管理','type' => 'menu','icon' => 'el-icon-key','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/auth/menu','redirect' => '','component' => 'auth/menu','api_list' => '[]','sort' => '26','status' => '1','create_time' => '1647866389','update_time' => '1653363800','fullpage' => '0'),
array('id' => '8','creator_id' => '0','parent_id' => '1','name' => 'task','title' => '任务管理','type' => 'menu','icon' => 'el-icon-alarm-clock','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/system/task','redirect' => '','component' => 'system/task','api_list' => '[]','sort' => '27','status' => '1','create_time' => '1634565766','update_time' => '1653363635','fullpage' => '0'),
array('id' => '9','creator_id' => '0','parent_id' => '1','name' => 'client','title' => '客户端','type' => 'menu','icon' => 'el-icon-menu','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/system/client','redirect' => '','component' => 'system/client','api_list' => '[]','sort' => '28','status' => '1','create_time' => '1647866389','update_time' => '1653363681','fullpage' => '0'),
array('id' => '10','creator_id' => '0','parent_id' => '1','name' => 'log','title' => '日志管理','type' => 'menu','icon' => 'el-icon-management','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/system/log','redirect' => '','component' => 'system/log','api_list' => '[]','sort' => '29','status' => '1','create_time' => '1647866389','update_time' => '1653363706','fullpage' => '0'),
array('id' => '11','creator_id' => '1','parent_id' => '0','name' => 'home','title' => '首页','type' => 'menu','icon' => 'el-icon-home-filled','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/home','redirect' => '','component' => '','api_list' => '[]','sort' => '0','status' => '1','create_time' => '1647866389','update_time' => '1666057629','fullpage' => '0'),
array('id' => '12','creator_id' => '1','parent_id' => '11','name' => 'dashboard','title' => '仪表盘','type' => 'menu','icon' => 'el-icon-odometer','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '1','path' => '/dashboard','redirect' => '','component' => 'home/index','api_list' => '[]','sort' => '11','status' => '1','create_time' => '1647866389','update_time' => '1653363766','fullpage' => '0'),
array('id' => '14','creator_id' => '1','parent_id' => '11','name' => 'ucenter','title' => '个人设置','type' => 'menu','icon' => 'el-icon-operation','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/usercenter','redirect' => '','component' => 'ucenter','api_list' => '[]','sort' => '12','status' => '1','create_time' => '1647866389','update_time' => '1653363592','fullpage' => '0'),
array('id' => '15','creator_id' => '1','parent_id' => '0','name' => 'auth','title' => '权限','type' => 'menu','icon' => 'el-icon-lock','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/auth','redirect' => NULL,'component' => '','api_list' => '[]','sort' => '3','status' => '1','create_time' => '1647866389','update_time' => '1653363498','fullpage' => '0'),
array('id' => '16','creator_id' => '1','parent_id' => '0','name' => 'customer','title' => '客户','type' => 'menu','icon' => 'el-icon-stamp','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '','redirect' => NULL,'component' => '','api_list' => '[]','sort' => '1','status' => '1','create_time' => '1665135189','update_time' => '1666057618','fullpage' => '0'),
array('id' => '17','creator_id' => '1','parent_id' => '16','name' => 'companyList','title' => '企业数据','type' => 'menu','icon' => 'el-icon-apple','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '/company/list','redirect' => NULL,'component' => 'customer/company/list','api_list' => '[]','sort' => '1','status' => '1','create_time' => '1665135252','update_time' => '1666104518','fullpage' => '0'),
array('id' => '18','creator_id' => '1','parent_id' => '17','name' => 'insertCompany','title' => '导入数据','type' => 'button','icon' => '','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '','redirect' => NULL,'component' => '','api_list' => NULL,'sort' => '1','status' => '1','create_time' => '1666104522','update_time' => '1666104564','fullpage' => '0'),
array('id' => '19','creator_id' => '1','parent_id' => '17','name' => 'addCompany','title' => '添加企业','type' => 'button','icon' => NULL,'color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '','redirect' => NULL,'component' => '','api_list' => '[]','sort' => '1','status' => '1','create_time' => '1666524705','update_time' => '1666524963','fullpage' => '0'),
array('id' => '20','creator_id' => '1','parent_id' => '17','name' => 'deleteCompany','title' => '删除企业','type' => 'button','icon' => '','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '','redirect' => NULL,'component' => '','api_list' => NULL,'sort' => '1','status' => '1','create_time' => '1666524749','update_time' => '1666524825','fullpage' => '0'),
array('id' => '21','creator_id' => '1','parent_id' => '17','name' => 'showDetail','title' => '查看企业详情','type' => 'button','icon' => '','color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '','redirect' => NULL,'component' => '','api_list' => NULL,'sort' => '1','status' => '1','create_time' => '1666524836','update_time' => '1666524855','fullpage' => '0'),
array('id' => '22','creator_id' => '1','parent_id' => '17','name' => 'editCompany','title' => '编辑企业','type' => 'button','icon' => NULL,'color' => NULL,'hidden' => '0','hiddenbreadcrumb' => '0','affix' => '0','path' => '','redirect' => NULL,'component' => '','api_list' => '[]','sort' => '1','status' => '1','create_time' => '1666524859','update_time' => '1666524958','fullpage' => '0'),
array('id' => '23','creator_id' => '1','parent_id' => '16','name' => 'companyDetail','title' => '企业详情','type' => 'm-menu','icon' => 'el-icon-brush-filled','color' => NULL,'hidden' => '1','hiddenbreadcrumb' => '0','affix' => '0','path' => '/company/detail','redirect' => NULL,'component' => 'customer/company/detail','api_list' => '[]','sort' => '0','status' => '1','create_time' => '1666525508','update_time' => '1666579701','fullpage' => '0')
);
$this->table('permissions')->insert($permissions)->save();
}
}

View File

@@ -1,22 +0,0 @@
<?php
use think\migration\Seeder;
class Users extends Seeder
{
/**
* Run Method.
*
* Write your database seeder using this method.
*
* More information on writing seeders is available here:
* http://docs.phinx.org/en/latest/seeding.html
*/
public function run()
{
$user = array(
array('username' => 'admin', 'password' => password_hash('admin888', PASSWORD_DEFAULT), 'nickname' => '超级管理员', 'email' => 'admin@admin.com')
);
$this->table('users')->insert($user)->save();
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -20,3 +20,5 @@ Route::group('/', function(){
Route::rule('auth/role/:action', 'auth.Role/:action');
Route::rule('customer/company/:action', 'customer.Company/:action');
})->middleware([\app\middleware\Check::class], 'api');
Route::miss('index/miss');

View File

@@ -7,9 +7,9 @@
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace doc;
namespace sent\services;
Class Doc{
Class DocService{
private $params = array ();
/**

View File

@@ -0,0 +1,42 @@
import config from "@/config"
import http from "@/utils/request"
export default {
company:{
list: {
url: `${config.API_URL}customer/company/index`,
name: "企业列表",
get: function(params){
return http.get(this.url, params);
}
},
detail: {
url: `${config.API_URL}customer/company/detail`,
name: "企业详情",
get: function(params){
return http.get(this.url, params);
}
},
insert: {
url: `${config.API_URL}customer/company/insert`,
name: "导入公司信息",
post: async function(data={}){
return await http.post(this.url, data);
}
},
add: {
url: `${config.API_URL}customer/company/add`,
name: "添加信息",
post: async function(data={}){
return await http.post(this.url, data);
}
},
edit: {
url: `${config.API_URL}customer/company/edit`,
name: "修改信息",
post: async function(data={}){
return await http.post(this.url, data);
}
}
},
}

View File

@@ -12,7 +12,7 @@ const DEFAULT_CONFIG = {
CORE_VER: "1.6.6",
//接口地址
API_URL: "http://127.0.0.1/",
API_URL: "http://127.0.0.1:8000/",
// API_URL: "http://q.dxpd.cn/",
//请求超时

View File

@@ -0,0 +1,38 @@
<template>
<div class="tool">
<el-icon-minus class="btn" @click="minimizeWin" :size="10">最小化</el-icon-minus>
<el-icon-full-screen class="btn" @click="maximizeWin" :size="8">最大化</el-icon-full-screen>
<el-icon-close class="btn" @click="closeWin" :size="10">关闭窗口</el-icon-close>
</div>
</template>
<script>
import { ipcRenderer } from "electron"
export default {
name: 'HelloWorld',
props: {
msg: String
},
created(){
},
methods: {
closeWin(){
ipcRenderer.send('controller.system.closeWin')
},
minimizeWin(){
ipcRenderer.send('controller.system.minimizeWin')
},
maximizeWin(){
ipcRenderer.send('controller.system.maximizeWin')
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.tool{display: flex; flex-direction: row; align-items: center; justify-content: end; gap: 8px; -webkit-app-region: drag; padding-right: 10px;}
.tool .btn{-webkit-app-region: no-drag; width: 14px; height: 14px;}
</style>

View File

@@ -0,0 +1,67 @@
<template>
<el-container>
<el-header>
<el-page-header :content="detail.name" @back="goBack" />
</el-header>
<el-main>
<el-card shadow="never" header="公司信息">
<el-descriptions border :column="2">
<el-descriptions-item label="统一社会信用代码">{{detail.org_code}}</el-descriptions-item>
<el-descriptions-item label="公司名称">{{detail.name}}</el-descriptions-item>
<el-descriptions-item label="注册资金">{{detail.reg_capital}}</el-descriptions-item>
<el-descriptions-item label="登记状态">{{detail.status}}</el-descriptions-item>
<el-descriptions-item label="成立日期">{{detail.reg_date}}</el-descriptions-item>
<el-descriptions-item label="人员规模">{{detail.staff_num}}</el-descriptions-item>
<el-descriptions-item label="营收规模">{{detail.turnover}}</el-descriptions-item>
<el-descriptions-item label="参保人数">{{detail.social_insurance}}</el-descriptions-item>
<el-descriptions-item label="所属区域">{{detail.area_t}}</el-descriptions-item>
<el-descriptions-item label="所属行业">{{detail.industry_t}}</el-descriptions-item>
<el-descriptions-item label="是否上市">{{detail.is_ipo}}</el-descriptions-item>
<el-descriptions-item label="融资信息">{{detail.finance_info}}</el-descriptions-item>
<el-descriptions-item label="网址">{{detail.website}}</el-descriptions-item>
<el-descriptions-item label="注册地址">{{detail.reg_address}}</el-descriptions-item>
<el-descriptions-item label="经营范围">{{detail.business}}</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card shadow="never" header="成员信息" style="margin-top: 10px">
<el-table :data="detail.contact" style="width: 100%">
<el-table-column prop="name" label="姓名" width="180" />
<el-table-column prop="sex" label="性别" width="180" />
<el-table-column prop="job" label="职务" />
<el-table-column prop="mobile" label="手机号码" />
<el-table-column prop="phone" label="单位电话" />
<el-table-column prop="phone" label="是否法人" />
</el-table>
</el-card>
</el-main>
</el-container>
</template>
<script>
import useTabs from '@/utils/useTabs'
export default {
data() {
return {
detail: {}
}
},
mounted(){
this.getCompanyDetail();
},
methods:{
async getCompanyDetail(){
let id = this.$router.currentRoute.value.query.id;
let res = await this.$API.customer.company.detail.get({id: id});
if(res.code == 1){
this.detail = res.data;
useTabs.setTitle(this.detail.name)
}
},
goBack(){
this.$router.go(-1)
}
}
}
</script>

View File

@@ -0,0 +1,112 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'addCompany'"></el-button>
<el-button type="danger" plain icon="el-icon-delete" :disabled="selection.length==0" @click="batch_del" v-auth="'deleteCompany'"></el-button>
<div style="padding: 10px;" v-auth="'insertCompany'"><el-upload :before-upload="beforeUpload" :show-file-list="false"><el-button type="primary" icon="el-icon-upload">导入</el-button></el-upload></div>
</div>
<div class="right-panel">
<div class="right-panel-search">
<el-input v-model="search.name" placeholder="公司名称" style="width:150px" clearable></el-input>
<el-button type="primary" icon="el-icon-search" @click="upsearch"></el-button>
<el-button type="primary" icon="el-icon-arrow-down-bold" @click="moreSearch"></el-button>
<el-button type="primary" icon="el-icon-download" @click="upsearch"></el-button>
</div>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" :column="columnList" row-key="id" @selection-change="selectionChange" stripe>
<el-table-column type="selection" width="50"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="200">
<template #default="scope">
<el-button type="text" size="small" @click="table_show(scope.row, scope.$index)" v-auth="'showDetail'">查看</el-button>
<el-button type="text" size="small" @click="table_edit(scope.row, scope.$index)" v-auth="'editCompany'">编辑</el-button>
<el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
<template #reference>
<el-button type="text" size="small" v-auth="'deleteCompany'">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
<search v-if="dialog.search" ref="searchBox" @success="moreUpsearch" @closed="dialog.search=false"></search>
<save-box v-if="dialog.save" ref="saveBox"></save-box>
</el-container>
</template>
<script>
import search from './search.vue';
import saveBox from './save.vue';
import imports from '@/mixin/import';
export default{
components:{
search,
saveBox
},
mixins: [imports],
data(){
return {
dialog: {
search: false
},
apiObj: this.$API.customer.company.list,
selection: [],
columnList: [
{label: "公司名称", prop: "name", width: "150"},
{label: "区域", prop: "area_t", width: "150"},
{label: "行业", prop: "industry_t", width: "150"},
{label: "注册资金", prop: "reg_capital", width: "150"},
{label: "员工人数", prop: "staff_num", width: "150", hide: true},
{label: "社保人数", prop: "social_insurance", width: "150"},
{label: "上市状态", prop: "is_ipo", width: "150"},
{label: "营收规模", prop: "turnover", width: "150"},
{label: "企业状态", prop: "status", width: "150"},
],
search: {}
}
},
methods:{
upsearch(){
this.$refs.table.reload(this.search);
},
moreUpsearch(search){
this.search = search;
this.upsearch();
},
moreSearch(){
this.dialog.search = true
this.$nextTick(() => {
this.$refs.searchBox.open().setData(this.search)
})
},
//表格选择后回调事件
selectionChange(selection){
this.selection = selection;
},
batch_del(){
},
table_show(row){
this.$router.push('/company/detail?id='+row.id)
},
add(){
this.dialog.save = true
this.$nextTick(() => {
this.$refs.saveBox.open()
})
},
table_edit(row){
this.dialog.save = true
this.$nextTick(() => {
this.$refs.saveBox.open('edit').setData(row)
})
},
table_del(){
}
}
}
</script>

View File

@@ -0,0 +1,118 @@
<template>
<el-drawer :title="titleMap[mode]" v-model="visible" size="80%" destroy-on-close @closed="$emit('closed')">
<el-form :model="form" ref="dialogForm" label-width="150px" style="padding: 10px">
<el-form-item label="公司名称">
<el-input v-model="form.name" placeholder="公司名称" clearable></el-input>
</el-form-item>
<el-form-item label="营业执照编号">
<el-input v-model="form.reg_code" placeholder="营业执照编号" clearable></el-input>
</el-form-item>
<el-form-item label="联系人" prop="contact">
<sc-form-table v-model="form.contact" :addTemplate="addTemplate" >
<el-table-column prop="name" label="姓名" width="180">
<template #default="scope"><el-input v-model="scope.row.name" placeholder="请输入姓名"></el-input></template>
</el-table-column>
<el-table-column prop="name" label="性别" width="180">
<template #default="scope"><el-input v-model="scope.row.sex" placeholder="请输入姓名"></el-input></template>
</el-table-column>
<el-table-column prop="name" label="电话" width="180">
<template #default="scope"><el-input v-model="scope.row.mobile" placeholder="请输入姓名"></el-input></template>
</el-table-column>
<el-table-column prop="name" label="电子邮箱" width="180">
<template #default="scope"><el-input v-model="scope.row.email" placeholder="请输入姓名"></el-input></template>
</el-table-column>
<el-table-column prop="name" label="职位" width="180">
<template #default="scope"><el-input v-model="scope.row.job" placeholder="请输入姓名"></el-input></template>
</el-table-column>
</sc-form-table>
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" @click="submit()">确认提交</el-button>
</template>
</el-drawer>
</template>
<script>
export default {
emits: ['success', 'closed'],
data() {
return {
mode: "add",
titleMap: {
add: '新增',
edit: '编辑',
show: '查看'
},
visible: false,
isSaveing: false,
//表单数据
form: {
contact: [{ name: ''}]
},
//验证规则
rules: {
sort: [
{required: true, message: '请输入排序', trigger: 'change'}
],
label: [
{required: true, message: '请输入角色名称'}
],
alias: [
{required: true, message: '请输入角色别名'}
]
},
addTemplate: {
id: '',
name: '',
email: '',
mobile: '',
job: '',
sex: ''
}
}
},
mounted() {
},
methods: {
//显示
open(mode='add'){
this.mode = mode;
this.visible = true;
return this
},
//加载树数据
async getGroup(){
var res = await this.$API.user.department.list.get();
this.groups = res.data;
},
//表单提交方法
submit(){
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
this.isSaveing = true;
var res = {}
if(this.mode == 'add'){
res = await this.$API.customer.company.add.post(this.form);
}else{
res = await this.$API.customer.company.edit.post(this.form);
}
this.isSaveing = false;
if(res.code == 1){
this.$emit('success', this.form, this.mode)
this.visible = false;
this.$message.success("操作成功")
}else{
this.$alert(res.msg, "提示", {type: 'error'})
}
}
})
},
//表单注入数据
setData(data){
//可以和上面一样单个注入,也可以像下面一样直接合并进去
Object.assign(this.form, data)
}
}
}
</script>

View File

@@ -0,0 +1,83 @@
<template>
<el-drawer title="更多查询" v-model="visible" direction="ttb" :size="600" destroy-on-close @closed="$emit('closed')">
<el-form :model="search" label-width="150px" style="padding: 10px">
<el-form-item label="关键词">
<el-input v-model="search.keyword" placeholder="关键词" clearable></el-input>
</el-form-item>
<el-form-item label="行业">
<el-input v-model="search.keyword" placeholder="行业" clearable></el-input>
</el-form-item>
<el-form-item label="省份城市">
<el-input v-model="search.keyword" placeholder="省份城市" clearable></el-input>
</el-form-item>
<el-form-item label="成立年限">
<el-input v-model="search.keyword" placeholder="省份城市" clearable></el-input>
</el-form-item>
<el-form-item label="注册资本">
<el-input v-model="search.keyword" placeholder="省份城市" clearable></el-input>
</el-form-item>
<el-form-item label="企业状态">
<el-input v-model="search.keyword" placeholder="省份城市" clearable></el-input>
</el-form-item>
<el-form-item label="企业类型">
<el-input v-model="search.keyword" placeholder="省份城市" clearable></el-input>
</el-form-item>
<el-form-item label="资本类型">
<el-input v-model="search.keyword" placeholder="省份城市" clearable></el-input>
</el-form-item>
<el-form-item label="联系方式">
<el-input v-model="search.keyword" placeholder="省份城市" clearable></el-input>
</el-form-item>
<el-form-item label="参保人数">
<el-input v-model="search.keyword" placeholder="省份城市" clearable></el-input>
</el-form-item>
<el-form-item label="融资信息">
<el-input v-model="search.keyword" placeholder="省份城市" clearable></el-input>
</el-form-item>
<el-form-item label="上市状态">
<el-input v-model="search.keyword" placeholder="省份城市" clearable></el-input>
</el-form-item>
</el-form>
<template #footer>
<el-button type="primary" icon="el-icon-search" @click="submit()"></el-button>
</template>
</el-drawer>
</template>
<script>
export default {
emits: ['success', 'closed', 'output', 'delete'],
data() {
return {
visible: false,
//表单数据
search: {user: []},
}
},
mounted() {
},
methods: {
//显示
open(){
this.visible = true;
return this
},
//表单提交方法
submit(){
this.visible = false;
this.$emit('success', this.search)
},
//表单注入数据
setData(data){
data.page = 1;
data.pagesize = 100;
Object.assign(this.search, data)
}
}
}
</script>
<style scoped>
.code {background: #848484;padding:15px;color: #fff;font-size: 12px;border-radius: 4px;}
.el-row{padding: 5px 0;}
</style>

View File

@@ -1,38 +0,0 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SentOS</title>
<style>
html, body {background-color: #fff; color: #3c4042; font-family: 'Raleway', sans-serif; font-weight: 100; height: 80vh; margin: 0;}
.top{text-align: right; line-height: 35px; padding: 0 20px;}
.top a{color: #333333; padding: 0 10px}
.full-height {height: 90vh;}
.flex-center {align-items: center;display: flex;justify-content: center;}
.position-ref {position: relative;}
.top-right {position: absolute;right: 10px;top: 18px;}
.content {text-align: center;}
.title {font-size: 84px;}
.links > a {color: #3c4042;padding: 0 25px; font-size: 12px;font-weight: 600;letter-spacing: .1rem;text-decoration: none;text-transform: uppercase;}
.m-b-md {margin-bottom: 30px;}
</style>
</head>
<body>
<div class="flex-center position-ref full-height">
<div class="content">
<div class="title m-b-md">
SentOS
</div>
<div class="links">
</div>
</div>
</div>
<div style="text-align: center; font-size: 12px;">
<p><a href="https://beian.miit.gov.cn/" target="_blank" style="color: #333333; text-decoration: none;">赣ICP备13006622号-1</a></p>
<p>技术支持:<a href="https://www.tensent.cn" target="_blank" style="color: #333333; text-decoration: none;">腾速科技</a></p>
</div>
</body>
</html>