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