测试版2.3.2发布

This commit is contained in:
2021-05-08 20:14:31 +08:00
parent dafdbc1746
commit c8aa6ac4bc
17 changed files with 335 additions and 271 deletions
+25 -32
View File
@@ -5,6 +5,7 @@ use Gdoo\User\Models\User;
use Gdoo\Customer\Models\CustomerApply; use Gdoo\Customer\Models\CustomerApply;
use Gdoo\Customer\Models\Customer; use Gdoo\Customer\Models\Customer;
use Gdoo\Customer\Models\CustomerTax; use Gdoo\Customer\Models\CustomerTax;
use Gdoo\User\Services\UserService;
class CustomerApplyHook class CustomerApplyHook
{ {
@@ -27,8 +28,12 @@ class CustomerApplyHook
public function onBeforeAudit($params) { public function onBeforeAudit($params) {
$id = $params['id']; $id = $params['id'];
$apply = DB::table('customer_apply')->where('id', $id)
$apply = DB::table('customer_apply')
->where('id', $id)
->selectRaw(' ->selectRaw('
code,
name,
type_id, type_id,
department_id, department_id,
remark, remark,
@@ -39,7 +44,7 @@ class CustomerApplyHook
city_id, city_id,
county_id, county_id,
address, address,
name, status,
warehouse_address, warehouse_address,
warehouse_contact, warehouse_contact,
warehouse_phone, warehouse_phone,
@@ -60,37 +65,32 @@ class CustomerApplyHook
bank_address bank_address
')->first(); ')->first();
// 新建用户
$_user = [
'role_id' => 2,
'group_id' => 2,
'username' => $apply['code'],
'name' => $apply['name'],
'department_id' => $apply['department_id'],
'phone' => $apply['head_phone'],
'password' => '123456',
'status' => 1,
];
$user = UserService::updateData(0, $_user);
$apply['user_id'] = $user->id;
// 新建客户 // 新建客户
$customer = new Customer; $customer = new Customer;
$customer->fill($apply); $customer->fill($apply);
$customer->save(); $customer->save();
// 新建用户 // 新建开票单位
$_user = [
'role_id' => 2,
'group_id' => 2,
'username' => $customer['id'],
'name' => $customer['name'],
'department_id' => $customer['department_id'],
'phone' => $customer['head_phone'],
'password' => bcrypt('123456'),
'status' => 1,
];
$user = new User;
$user->fill($_user)->save();
$customer['user_id'] = $user->id;
// 重新更新客户数据
$customer->code = $customer['id'];
$customer->save();
// 自动新建开票单位
CustomerTax::insert([ CustomerTax::insert([
'code' => $customer->code,
'name' => $customer->name,
'customer_id' => $customer->id, 'customer_id' => $customer->id,
'class_id' => $customer->class_id, 'class_id' => $customer->class_id,
'department_id' => $customer->department_id, 'department_id' => $customer->department_id,
'code' => $customer->code,
'name' => $customer->name,
'bank_name' => $apply['bank_name'], 'bank_name' => $apply['bank_name'],
'tax_number' => $apply['tax_number'], 'tax_number' => $apply['tax_number'],
'bank_account' => $apply['bank_account'], 'bank_account' => $apply['bank_account'],
@@ -98,18 +98,11 @@ class CustomerApplyHook
'status' => 1, 'status' => 1,
]); ]);
// 回写申请的客户编码 // 客户档案同步外部接口
$_apply = CustomerApply::find($id);
$_apply->code = $customer['code'];
$_apply->save();
// 客户档案写入外部接口
$department = DB::table('department')->where('id', $customer['department_id'])->first(); $department = DB::table('department')->where('id', $customer['department_id'])->first();
$class = DB::table('customer_class')->where('id', $customer['class_id'])->first(); $class = DB::table('customer_class')->where('id', $customer['class_id'])->first();
$customer['class_code'] = $class['code']; $customer['class_code'] = $class['code'];
$customer['department_code'] = $department['code']; $customer['department_code'] = $department['code'];
$customer['headCode'] = $customer['code'];
$ret = plugin_sync_api('postCustomer', $customer); $ret = plugin_sync_api('postCustomer', $customer);
if ($ret['error_code'] > 0) { if ($ret['error_code'] > 0) {
abort_error($ret['msg']); abort_error($ret['msg']);
+24 -41
View File
@@ -4,6 +4,7 @@ use DB;
use Gdoo\User\Models\User; use Gdoo\User\Models\User;
use Gdoo\Customer\Models\Customer; use Gdoo\Customer\Models\Customer;
use Gdoo\Customer\Models\CustomerTax; use Gdoo\Customer\Models\CustomerTax;
use Gdoo\User\Services\UserService;
class CustomerHook class CustomerHook
{ {
@@ -18,28 +19,20 @@ class CustomerHook
public function onBeforeStore($params) public function onBeforeStore($params)
{ {
$master = $params['master']; $master = $params['master'];
$_user = [ $_user = [
'role_id' => 2, 'role_id' => 2,
'group_id' => 2, 'group_id' => 2,
'username' => $master['code'],
'name' => $master['name'], 'name' => $master['name'],
'username' => $master['code'],
'password' => $master['password'],
'department_id' => $master['department_id'], 'department_id' => $master['department_id'],
'phone' => $master['head_phone'], 'phone' => $master['head_phone'],
'status' => $master['status'], 'status' => $master['status'],
]; ];
$user = UserService::updateData($master['user_id'], $_user);
// 更新用户表
$user = User::findOrNew($master['user_id']);
// 密码处理
if (empty($master['password'])) {
unset($master['password']);
} else {
$user['password'] = bcrypt($master['password']);
$master['password'] = $user['password'];
}
$user->fill($_user)->save();
$master['user_id'] = $user->id; $master['user_id'] = $user->id;
$params['master'] = $master; $params['master'] = $master;
return $params; return $params;
@@ -47,39 +40,29 @@ class CustomerHook
public function onAfterStore($params) { public function onAfterStore($params) {
$master = $params['master']; $master = $params['master'];
if (empty($master['code'])) { // 客户开票单位为空
// 自动设置客户编码 $count = CustomerTax::where('customer_id', $master['id'])->count();
$customer = Customer::find($master['id']); if ($count == 0) {
$customer->code = $customer['id'];
$customer->save();
// 自动设置用户名
$user = User::find($customer['user_id']);
$user->username = $customer['id'];
$user->save();
// 自动新建开票单位 // 自动新建开票单位
CustomerTax::insert([ CustomerTax::insert([
'customer_id' => $customer->id, 'code' => $master['code'],
'class_id' => $customer->class_id, 'name' => $master['name'],
'department_id' => $customer->department_id, 'customer_id' => $master['id'],
'code' => $customer->code, 'class_id' => $master['class_id'],
'name' => $customer->name, 'department_id' => $master['department_id'],
'status' => 1, 'status' => 1,
]); ]);
// 客户档案写入外部接口
$department = DB::table('department')->where('id', $master['department_id'])->first();
$class = DB::table('customer_class')->where('id', $customer['class_id'])->first();
$customer['class_code'] = $class['code'];
$customer['department_code'] = $department['code'];
$customer['headCode'] = $customer->code;
$ret = plugin_sync_api('CustomerSync', $customer);
if ($ret['success'] == true) {
return $params;
}
abort_error($ret['msg']);
} }
// 客户档案同步外部接口
$department = DB::table('department')->where('id', $master['department_id'])->first();
$class = DB::table('customer_class')->where('id', $master['class_id'])->first();
$master['class_code'] = $class['code'];
$master['department_code'] = $department['code'];
$ret = plugin_sync_api('postCustomer', $master);
if ($ret['error_code'] > 0) {
abort_error($ret['msg']);
}
return $params; return $params;
} }
+8 -24
View File
@@ -22,32 +22,16 @@ class TaxHook
public function onAfterStore($params) { public function onAfterStore($params) {
$master = $params['master']; $master = $params['master'];
if (empty($master['code'])) {
// 自动设置开票编码
$customer = Customer::find($master['customer_id']);
$code = $customer['code'];
$max_id = (int)$customer['tax_max_id'] + 1;
// 更新开票单位code // 开票单位同步外部接口
$tax = CustomerTax::find($master['id']); $department = DB::table('department')->where('id', $master['department_id'])->first();
$tax->code = $code.$max_id; $class = DB::table('customer_class')->where('id', $master['class_id'])->first();
$tax->save(); $master['class_code'] = $class['code'];
$master['department_code'] = $department['code'];
$customer->tax_max_id = $max_id; $ret = plugin_sync_api('postTax', $master);
$customer->save(); if ($ret['error_code'] > 0) {
// 客户档案写入外部接口
$department = DB::table('department')->where('id', $tax['department_id'])->first();
$class = DB::table('customer_class')->where('id', $tax['class_id'])->first();
$tax['class_code'] = $class['code'];
$tax['department_code'] = $department['code'];
$tax['headCode'] = $customer->code;
$ret = plugin_sync_api('CustomerSync', $tax);
if ($ret['success'] == true) {
return $params;
}
abort_error($ret['msg']); abort_error($ret['msg']);
} }
return $params; return $params;
} }
@@ -31,6 +31,8 @@ Vue.createApp({
var setup = config.setup; var setup = config.setup;
console.log(setup);
Vue.onMounted(function() { Vue.onMounted(function() {
var gridDiv = config.div(136); var gridDiv = config.div(136);
// 初始化数据 // 初始化数据
@@ -4,14 +4,16 @@ use DB;
use Request; use Request;
use Gdoo\Index\Controllers\DefaultController; use Gdoo\Index\Controllers\DefaultController;
use Symfony\Component\Console\Input\Input;
class CategoryController extends DefaultController class CategoryController extends DefaultController
{ {
public function index() public function index()
{ {
// 更新排序 // 更新排序
if ($post = $this->post('sort')) { if (Request::method() == 'POST') {
foreach ($post as $k => $v) { $gets = Request::all();
foreach ($gets as $k => $v) {
$data['sort'] = $v; $data['sort'] = $v;
DB::table('forum')->where('id', $k)->update($data); DB::table('forum')->where('id', $k)->update($data);
} }
@@ -33,23 +35,21 @@ class CategoryController extends DefaultController
{ {
$id = (int)Request::get('id'); $id = (int)Request::get('id');
if ($post = $this->post()) { if (Request::method() == 'POST') {
if (empty($post['name'])) { $gets = Request::all();
if (empty($gets['name'])) {
return $this->error('类别名称必须填写。'); return $this->error('类别名称必须填写。');
} }
unset($gets['past_parent_id']);
unset($post['past_parent_id']); if ($gets['id'] > 0) {
DB::table('forum')->where('id', $gets['id'])->update($gets);
if ($post['id'] > 0) {
DB::table('forum')->where('id', $post['id'])->update($post);
} else { } else {
DB::table('forum')->insert($post); DB::table('forum')->insert($gets);
} }
return $this->success('index', '类别更新成功。'); return $this->success('index', '类别更新成功。');
} }
$row = DB::table('forum')->where('id', $id)->first(); $row = DB::table('forum')->where('id', $id)->first();
return $this->display(array( return $this->display(array(
'row' => $row, 'row' => $row,
)); ));
+38 -37
View File
@@ -7,9 +7,12 @@ use Request;
use Gdoo\Forum\Models\Forum; use Gdoo\Forum\Models\Forum;
use Gdoo\Forum\Models\ForumPost; use Gdoo\Forum\Models\ForumPost;
use Gdoo\Index\Controllers\DefaultController; use Gdoo\Index\Controllers\DefaultController;
use Gdoo\Index\Services\AttachmentService;
class PostController extends DefaultController class PostController extends DefaultController
{ {
public $permission = ['forum', 'comment'];
// 板块列表 // 板块列表
public function index() public function index()
{ {
@@ -105,37 +108,37 @@ class PostController extends DefaultController
$row['forum_id'] = empty($row['forum_id']) ? $forum_id : $row['forum_id']; $row['forum_id'] = empty($row['forum_id']) ? $forum_id : $row['forum_id'];
// 更新数据 // 更新数据
if ($post = $this->post()) { if (Request::method() == 'POST') {
if (empty($post['title'])) { $gets = Request::all();
if (empty($gets['title'])) {
return $this->error('主题必须填写。'); return $this->error('主题必须填写。');
} }
if (empty($post['content'])) { if (empty($gets['content'])) {
return $this->error('正文必须填写。'); return $this->error('正文必须填写。');
} }
$post['content'] = $_POST['content']; $gets['content'] = $_POST['content'];
$post['attachment'] = join(',', (array)$post['attachment']); $gets['attachment'] = join(',', (array)$gets['attachment']);
// 更新数据库 // 更新数据库
if ($post['id'] > 0) { if ($gets['id'] > 0) {
DB::table('forum_post')->where('id', $post['id'])->update($post); DB::table('forum_post')->where('id', $gets['id'])->update($gets);
} else { } else {
$post['add_time'] = time(); $gets['add_time'] = time();
$post['add_user_id'] = Auth::id(); $gets['add_user_id'] = Auth::id();
$post['id'] = DB::table('forum_post')->insertGetId($post); $gets['id'] = DB::table('forum_post')->insertGetId($gets);
} }
// 设置附件为已经使用 // 设置附件为已经使用
attachment_store('forum_attachment', $_POST['attachment']); AttachmentService::publish($_POST['attachment']);
return $this->success('view', ['id' => $post['id']], '帖子发表成功。'); return $this->success('view', ['id' => $gets['id']], '帖子发表成功。');
} }
$attachList = attachment_edit('forum_attachment', $row['attachment'], 'forum'); $attachment = AttachmentService::edit($row['attachment'], 'forum', 'attachment', 'forum');
return $this->display([ return $this->display([
'attachList' => $attachList, 'attachment' => $attachment,
'row' => $row, 'row' => $row,
]); ]);
} }
@@ -146,33 +149,32 @@ class PostController extends DefaultController
$parent_id = Request::get('parent_id'); $parent_id = Request::get('parent_id');
// 更新数据 // 更新数据
if ($post = $this->post()) { if (Request::method() == 'POST') {
if (empty($post['content'])) { $gets = Request::all();
if (empty($gets['content'])) {
return $this->error('正文必须填写。'); return $this->error('正文必须填写。');
} }
$post['content'] = $_POST['content']; $gets['content'] = $_POST['content'];
$post['attachment'] = join(',', (array)$post['attachment']); $gets['attachment'] = join(',', (array)$gets['attachment']);
// 更新数据库 // 更新数据库
if ($post['id']) { if ($gets['id']) {
DB::table('forum_post')->where('id', $post['id'])->update($post); DB::table('forum_post')->where('id', $gets['id'])->update($gets);
} else { } else {
$post['add_time'] = time(); $gets['add_time'] = time();
$post['add_user_id'] = Auth::id(); $gets['add_user_id'] = Auth::id();
DB::table('forum_post')->insert($post); DB::table('forum_post')->insert($gets);
} }
// 设置附件为已经使用 // 设置附件为已经使用
attachment_store('forum_attachment', $_POST['attachment']); AttachmentService::publish($_POST['attachment']);
return $this->success('view', ['id' => $post['parent_id']], '帖子回复保存成功。'); return $this->success('view', ['id' => $gets['parent_id']], '帖子回复保存成功。');
} }
$row = DB::table('forum_post')->where('id', $id)->first(); $row = DB::table('forum_post')->where('id', $id)->first();
$attachList = attachment_edit('forum_attachment', $row['attachment'], 'forum'); $attachment = AttachmentService::edit($row['attachment'], 'forum', 'attachment', 'forum');
return $this->display([ return $this->display([
'attachList' => $attachList, 'attachment' => $attachment,
'row' => $row, 'row' => $row,
]); ]);
} }
@@ -188,7 +190,7 @@ class PostController extends DefaultController
$rows = ForumPost::where('parent_id', $id)->get(); $rows = ForumPost::where('parent_id', $id)->get();
if ($rows->count()) { if ($rows->count()) {
foreach ($rows as $key => $row) { foreach ($rows as $key => $row) {
$row->attach = attachment_get('forum_attachment', $row['attachment']); $row->attachment = AttachmentService::show($row['attachment']);
$rows->put($key, $row); $rows->put($key, $row);
} }
} }
@@ -200,12 +202,11 @@ class PostController extends DefaultController
// 更新点击率 // 更新点击率
$post->increment('hit'); $post->increment('hit');
$attachList = attachment_view('forum_attachment', $post['attachment']); $attachment = AttachmentService::edit($post['attachment'], 'forum', 'attachment', 'forum');
$attachment = attachment_edit('forum_attachment', '', 'forum'); $attachment_comment = AttachmentService::edit('', 'forum', 'attachment', 'forum');
return $this->display([ return $this->display([
'attachList' => $attachList,
'attachment' => $attachment, 'attachment' => $attachment,
'attachment_comment' => $attachment_comment,
'post' => $post, 'post' => $post,
'rows' => $rows, 'rows' => $rows,
]); ]);
@@ -222,7 +223,7 @@ class PostController extends DefaultController
} }
// 删除帖子附件 // 删除帖子附件
attachment_delete('forum_attachment', $post['attachment']); AttachmentService::remove($post['attachment']);
// 删除帖子 // 删除帖子
$post->delete(); $post->delete();
@@ -234,7 +235,7 @@ class PostController extends DefaultController
if ($rows->count()) { if ($rows->count()) {
foreach ($rows as $row) { foreach ($rows as $row) {
$row->delete(); $row->delete();
attachment_delete('forum_attachment', $row['attachment']); AttachmentService::remove($row['attachment']);
} }
} }
return $this->success('forum', ['id' => $post->forum_id], '帖子删除成功。'); return $this->success('forum', ['id' => $post->forum_id], '帖子删除成功。');
+1 -1
View File
@@ -9,7 +9,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
@include('attachment/add') @include('attachment/create')
</div> </div>
<div class="form-group"> <div class="form-group">
+1 -1
View File
@@ -4,7 +4,7 @@
<form method="post" action="{{url('comment')}}" id="myform" name="myform"> <form method="post" action="{{url('comment')}}" id="myform" name="myform">
<div class="form-group"> <div class="form-group">
@include('attachment/add') @include('attachment/create')
</div> </div>
<div class="form-group"> <div class="form-group">
+8 -8
View File
@@ -29,10 +29,9 @@
<div class="wrapper-xs padder"> <div class="wrapper-xs padder">
{{$post->content}} {{$post->content}}
@if($attachment['rows'])
@if($attachList['view'])
<div class="b-a b-light wrapper-sm"> <div class="b-a b-light wrapper-sm">
@include('attachment/view') @include('attachment/show')
</div> </div>
@endif @endif
@@ -69,12 +68,13 @@
{{$row->content}} {{$row->content}}
@if($row['attach']) @if($row['attachment'])
{{'';$attachment = $row['attachment']}}
<div class="b-a b-light wrapper-sm"> <div class="b-a b-light wrapper-sm">
{{'';$attachList['view'] = $row['attach']}} @include('attachment/show')
@include('attachment/view')
</div> </div>
@endif @endif
</div> </div>
@endforeach @endforeach
</div> </div>
@@ -91,8 +91,8 @@
<form method="post" action="{{url('comment')}}" id="myform" name="myform"> <form method="post" action="{{url('comment')}}" id="myform" name="myform">
<div class="form-group"> <div class="form-group">
{{'';$attachList = $attachment}} {{'';$attachment = $attachment_comment}}
@include('attachment/add') @include('attachment/create')
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -73,58 +73,60 @@
@endforeach @endforeach
@foreach($sublist as $submodel) @foreach($sublist as $submodel)
<tr> <tr>
<td> <td>
<span class="label label-success">{{$submodel['name']}}</span> 权限 <span class="label label-success">{{$submodel['name']}}</span> 权限
</td> </td>
<td> <td>
{{$submodel->table}}@option {{$submodel->table}}@option
</td> </td>
<td> <td>
</td> </td>
<td> <td>
</td> </td>
<td> <td>
<select multiple data-placeholder="选择验证规则" class="form-control input-sm input-inline input-select2" name="data[{{$submodel->table}}][{{$field->field}}][v][]"> <select multiple data-placeholder="选择验证规则" class="form-control input-sm input-inline input-select2" name="data[{{$submodel->table}}][{{$field->field}}][v][]">
<option value=""></option> <option value=""></option>
<option @if(in_array('required', (array)$permission['data'][$submodel->table]['@option']['v'])) selected @endif value="required">必填</option> <option @if(in_array('required', (array)$permission['data'][$submodel->table]['@option']['v'])) selected @endif value="required">必填</option>
</select> </select>
<label class="inline-checkbox"><input type="checkbox" @if($permission['data'][$submodel->table]['@option']['w'] == 1) checked @endif name="data[{{$submodel->table}}][@option][w]" value="1"> </label> <label class="inline-checkbox"><input type="checkbox" @if($permission['data'][$submodel->table]['@option']['w'] == 1) checked @endif name="data[{{$submodel->table}}][@option][w]" value="1"> </label>
&nbsp; &nbsp;
<label class="inline-checkbox"><input type="checkbox" @if($permission['data'][$submodel->table]['@option']['d'] == 1) checked @endif name="data[{{$submodel->table}}][@option][d]" value="1"> </label> <label class="inline-checkbox"><input type="checkbox" @if($permission['data'][$submodel->table]['@option']['d'] == 1) checked @endif name="data[{{$submodel->table}}][@option][d]" value="1"> </label>
</td> </td>
</tr> </tr>
@foreach($submodel['fields'] as $field)
<tr> @foreach($submodel['fields'] as $field)
<td> <tr>
<span class="label label-primary">{{$submodel['name']}}</span> <td>
{{$field['name']}} <span class="label label-primary">{{$submodel['name']}}</span>
</td> {{$field['name']}}
<td> </td>
{{$submodel->table}}.{{$field->field}} <td>
</td> {{$submodel->table}}.{{$field->field}}
<td> </td>
<input type="checkbox" @if($permission['data'][$submodel->table][$field->field]['w'] == 1) checked @endif class="field-edit" data-key="{{$submodel->table}}_{{$field->field}}" id="{{$submodel->table}}_{{$field->field}}_edit" name="data[{{$submodel->table}}][{{$field->field}}][w]" value="1"> <td>
</td> <input type="checkbox" @if($permission['data'][$submodel->table][$field->field]['w'] == 1) checked @endif class="field-edit" data-key="{{$submodel->table}}_{{$field->field}}" id="{{$submodel->table}}_{{$field->field}}_edit" name="data[{{$submodel->table}}][{{$field->field}}][w]" value="1">
<td> </td>
<input type="checkbox" @if($permission['data'][$submodel->table][$field->field]['s'] == 1) checked @endif class="field-secret" data-key="{{$submodel->table}}_{{$field->field}}" id="{{$submodel->table}}_{{$field->field}}_secret" name="data[{{$submodel->table}}][{{$field->field}}][s]" value="1"> <td>
</td> <input type="checkbox" @if($permission['data'][$submodel->table][$field->field]['s'] == 1) checked @endif class="field-secret" data-key="{{$submodel->table}}_{{$field->field}}" id="{{$submodel->table}}_{{$field->field}}_secret" name="data[{{$submodel->table}}][{{$field->field}}][s]" value="1">
<td> </td>
<select multiple data-placeholder="选择验证规则" class="form-control input-sm input-inline input-select2" name="data[{{$submodel->table}}][{{$field->field}}][v][]"> <td>
<option value=""></option> <select multiple data-placeholder="选择验证规则" class="form-control input-sm input-inline input-select2" name="data[{{$submodel->table}}][{{$field->field}}][v][]">
@foreach($regulars as $key => $regular) <option value=""></option>
<option @if(in_array($key, (array)$permission['data'][$submodel->table][$field->field]['v'])) selected @endif value="{{$key}}">{{$regular}}</option> @foreach($regulars as $key => $regular)
@endforeach <option @if(in_array($key, (array)$permission['data'][$submodel->table][$field->field]['v'])) selected @endif value="{{$key}}">{{$regular}}</option>
</select> @endforeach
@if($field['form_type'] == 'auto' || $field['form_type'] == 'date') </select>
<label title="锁定将不允许修改宏控件的值"> @if($field['form_type'] == 'auto' || $field['form_type'] == 'date')
<input type="checkbox" value="1" @if($permission['data'][$submodel->table][$field->field]['m'] == 1) checked @endif name="data[{{$submodel->table}}][{{$field->field}}][m]"> 锁定 <label title="锁定将不允许修改宏控件的值">
</label> <input type="checkbox" value="1" @if($permission['data'][$submodel->table][$field->field]['m'] == 1) checked @endif name="data[{{$submodel->table}}][{{$field->field}}][m]"> 锁定
@else </label>
</td> @endif
</tr> </td>
</tr>
@endforeach
@endforeach
@endforeach @endforeach
</table> </table>
+31
View File
@@ -14,6 +14,37 @@ use Gdoo\System\Models\SystemLog;
class UserService class UserService
{ {
/**
* 写入或者更新用户
*/
public static function updateData($user_id, $data)
{
$user = User::findOrNew($user_id);
// 密码处理
$password = '';
if ($user->exists) {
if (not_empty($data['password'])) {
$password = $data['password'];
}
} else {
if (empty($data['password'])) {
$password = '123456';
} else {
$password = $data['password'];
}
}
if ($password) {
$user->password = bcrypt($password);
$user->password_text = $password;
}
unset($data['password']);
$user->fill($data)->save();
return $user;
}
public static function getUser($user_id = 0) { public static function getUser($user_id = 0) {
$user = null; $user = null;
if ($user_id == 0) { if ($user_id == 0) {
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+13 -2
View File
@@ -225,8 +225,7 @@
buttons: [], buttons: [],
tabs: {items:[], active:''}, tabs: {items:[], active:''},
search_form:{columns:[]}, search_form:{columns:[]},
by_title: '全部', bys: {name:'全部',items:[]}
bys: {items:[]}
}); });
this.search = { this.search = {
@@ -321,6 +320,18 @@
// bys // bys
if (header.bys) { if (header.bys) {
me.header.bys = header.bys; me.header.bys = header.bys;
if (search_form.params['by']) {
me.header.bys.active = search_form.params['by'];
for (let i = 0; i < header.bys.items.length; i++) {
const item = header.bys.items[i];
if (item.value == search_form.params['by']) {
me.header.bys.name = item.name;
}
}
} else {
me.header.bys.active = header.bys.items[0].value;
me.header.bys.name = header.bys.items[0].name;
}
} }
// tabs // tabs
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"/assets/dist/bundle.min.js": "/assets/dist/bundle.min.js?id=29a199441a88a73be4c8", "/assets/dist/bundle.min.js": "/assets/dist/bundle.min.js?id=4ccf319172adf4f16820",
"/assets/dist/vendor.min.js": "/assets/dist/vendor.min.js?id=29c59d13160c6607b4af", "/assets/dist/vendor.min.js": "/assets/dist/vendor.min.js?id=29c59d13160c6607b4af",
"/assets/dist/gdoo.min.js": "/assets/dist/gdoo.min.js?id=10ad64a993592703c0a5", "/assets/dist/gdoo.min.js": "/assets/dist/gdoo.min.js?id=2f3fe2352d24f1a8b7c1",
"/assets/dist/index.min.js": "/assets/dist/index.min.js?id=e68deaa21814b7ec0d1c", "/assets/dist/index.min.js": "/assets/dist/index.min.js?id=e68deaa21814b7ec0d1c",
"/assets/dist/vendor.min.css": "/assets/dist/vendor.min.css?id=99a58728a17257718260", "/assets/dist/vendor.min.css": "/assets/dist/vendor.min.css?id=99a58728a17257718260",
"/assets/dist/gdoo.min.css": "/assets/dist/gdoo.min.css?id=644acfd8367a5dd5a096", "/assets/dist/gdoo.min.css": "/assets/dist/gdoo.min.css?id=644acfd8367a5dd5a096",
+4 -3
View File
@@ -69,13 +69,13 @@
<div v-if="header.bys.items.length" class="btn-group btn-l-line" role="group"> <div v-if="header.bys.items.length" class="btn-group btn-l-line" role="group">
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="fa fa-filter"></span> {{header.by_title}} <span class="fa fa-filter"></span> {{header.bys.name}}
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<template v-for="item in header.bys.items"> <template v-for="item in header.bys.items">
<li v-if="item.value == 'divider'" class="divider"></li> <li v-if="item.value == 'divider'" class="divider"></li>
<li v-else :class="item.value == header.bys.value ? 'active' : ''"><a @click="byBtn(item)">{{item.name}}</a></li> <li v-else :class="item.value == header.bys.active ? 'active' : ''"><a @click="byBtn(item)">{{item.name}}</a></li>
</template> </template>
</ul> </ul>
</div> </div>
@@ -146,7 +146,8 @@ export default defineComponent({
} }
} }
let byBtn = (btn) => { let byBtn = (btn) => {
props.header.by_title = btn.name; props.header.bys.name = btn.name;
props.header.bys.active = btn.value;
props.grid.remoteData({page:1, by:btn.value}); props.grid.remoteData({page:1, by:btn.value});
} }
/* /*