Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
note-library
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a88a7a4d
authored
May 13, 2020
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
up
parent
9c29d7c3
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
13 deletions
app/Http/Controllers/AjaxController.php
app/Http/Controllers/WebController.php
app/Model/TemplateListModel.php
public/js/web/labelList.js
resources/views/web/labelList.blade.php
app/Http/Controllers/AjaxController.php
View file @
a88a7a4d
...
...
@@ -30,11 +30,12 @@ Class AjaxController extends Controller
$status
=
$request
->
input
(
"status"
,
'all'
);
$begin_time
=
$request
->
input
(
"begin_time"
,
''
);
$end_time
=
$request
->
input
(
"end_time"
,
''
);
$userType
=
$request
->
input
(
"userType"
,
0
);
//1只显示系统模板
$admin_id
=
$request
->
user
->
userId
;
$perm
=
new
PermController
;
// 用户角色
$role
=
$perm
->
getUserRole
(
$request
);
$query
=
TemplateListModel
::
select
(
'*'
)
->
CreateUserId
(
$admin_id
,
$role
,
$create_username
)
->
TemplateName
(
$template_name
)
$query
=
TemplateListModel
::
select
(
'*'
)
->
CreateUserId
(
$admin_id
,
$role
,
$create_username
,
$userType
)
->
TemplateName
(
$template_name
)
->
Status
(
$status
)
->
SearchTime
(
$begin_time
,
$end_time
)
->
OrderBy
(
"id"
,
"desc"
);
...
...
app/Http/Controllers/WebController.php
View file @
a88a7a4d
...
...
@@ -73,10 +73,21 @@ class WebController extends Controller
// 模板列表
public
function
labelList
(
$request
,
$info
)
{
$info
[
'title'
]
=
'
标签模板列表'
;
$info
[
'title'
]
=
'我的
标签模板列表'
;
return
view
(
'web'
,
$info
);
}
// 模板列表
public
function
systemlabelList
(
$request
,
$info
)
{
$info
[
'title'
]
=
'系统内置标签模板列表'
;
$info
[
'id'
]
=
"labelList"
;
$info
[
"labelListSystem"
]
=
1
;
return
view
(
'web'
,
$info
);
}
// 标签使用记录
public
function
record
(
$request
,
$info
)
{
...
...
@@ -108,14 +119,14 @@ class WebController extends Controller
public
function
showTemplate
(
$request
,
$info
){
$info
[
'title'
]
=
'预览'
;
$id
=
$request
->
input
(
"t_id"
,
0
);
$count
=
TemplateListModel
::
where
(
"id"
,
intval
(
$id
))
->
where
(
"create_userid"
,
$request
->
user
->
userId
)
->
count
(
"id"
);
if
(
$count
<=
0
){
return
back
()
->
with
(
'showTemplateerror'
,
'没找到属于您的模板信息'
);
}
//
$count = TemplateListModel::where("id",intval($id))->where("create_userid",$request->user->userId)->count("id");
//
if($count <= 0){
//
return back()->with('showTemplateerror', '没找到属于您的模板信息');
//
}
$templateInfo
=
TemplateListModel
::
where
(
"id"
,
intval
(
$id
))
->
select
(
"id"
,
"template_name"
,
"status"
)
->
first
();
if
(
$templateInfo
->
status
<=
0
){
return
back
()
->
with
(
'showTemplateerror'
,
'该模板已经被主人禁用了'
);
}
//
if($templateInfo->status <= 0){
//
return back()->with('showTemplateerror', '该模板已经被主人禁用了');
//
}
// dump($templateInfo->template_extend);
$html
=
$templateInfo
->
template_extend
;
...
...
app/Model/TemplateListModel.php
View file @
a88a7a4d
...
...
@@ -58,7 +58,10 @@ class TemplateListModel extends Model{
return
$query
;
}
public
function
scopeCreateUserId
(
$query
,
$create_userid
=
0
,
$role
=
null
,
$create_username
=
''
){
public
function
scopeCreateUserId
(
$query
,
$create_userid
=
0
,
$role
=
null
,
$create_username
=
''
,
$userType
=
0
){
if
(
$userType
==
1
){
return
$query
->
where
(
'create_userid'
,
1000
);
}
if
(
$create_userid
&&
$role
!=
1
){
$query
=
$query
->
where
(
'create_userid'
,
$create_userid
);
}
...
...
public/js/web/labelList.js
View file @
a88a7a4d
...
...
@@ -18,7 +18,7 @@ layui.use(['form', 'table', 'laydate'], function(){
,
cellMinWidth
:
80
//全局定义常规单元格的最小宽度
,
page
:
true
//开启分页
,
where
:
{
model_id
:
$
(
'input[name=model_id]'
).
val
()
userType
:
$
(
'input[name=labelListSystem]'
).
val
(),
}
,
cols
:
[[
//表头
{
title
:
'ID'
,
field
:
"id"
,
fixed
:
'left'
,
width
:
80
}
...
...
@@ -36,7 +36,7 @@ layui.use(['form', 'table', 'laydate'], function(){
form
.
on
(
'submit(load)'
,
function
(
data
)
{
console
.
log
(
data
)
//
console.log(data)
//执行重载
table
.
reload
(
'list'
,
{
page
:
{
...
...
resources/views/web/labelList.blade.php
View file @
a88a7a4d
...
...
@@ -3,6 +3,8 @@
{{ session('showTemplateerror') }}
</div>
@endif
@if(!isset(
$labelListSystem
))
<form class="
layui
-
form
layui
-
box
" method="
post
">
<div class="
layui
-
form
-
item
">
<div class="
layui
-
inline
">
...
...
@@ -49,7 +51,8 @@
</div>
</div>
</form>
@endif
<input type="
hidden
" name="
labelListSystem
" value="
{{
isset
(
$labelListSystem
)
?
$labelListSystem
:
0
}}
" />
<table id="
list
" lay-filter="
list
"></table>
<script type="
text
/
html
" id="
action
">
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment