切换导航条
此项目
正在载入...
登录
何书鹏
/
salarycalculator
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
Karson
6 years ago
提交
7e831339c8e0f2ee35a0daf27ac9f5eb6f1400d1
1 个父辈
453bb1dd
新增系统配置删除功能
修复会员分组规则编辑的BUG
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
55 行增加
和
5 行删除
application/admin/controller/general/Config.php
application/admin/model/UserRule.php
application/admin/view/general/config/index.html
public/assets/js/backend/general/config.js
application/admin/controller/general/Config.php
查看文件 @
7e83133
...
...
@@ -85,10 +85,10 @@ class Config extends Backend
if
(
$result
!==
false
)
{
try
{
$this
->
refreshFile
();
$this
->
success
();
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
$this
->
success
();
}
else
{
$this
->
error
(
$this
->
model
->
getError
());
}
...
...
@@ -126,15 +126,32 @@ class Config extends Backend
$this
->
model
->
allowField
(
true
)
->
saveAll
(
$configList
);
try
{
$this
->
refreshFile
();
$this
->
success
();
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
$this
->
success
();
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
}
public
function
del
(
$ids
=
""
)
{
$name
=
$this
->
request
->
request
(
'name'
);
$config
=
ConfigModel
::
getByName
(
$name
);
if
(
$config
)
{
try
{
$config
->
delete
();
$this
->
refreshFile
();
}
catch
(
Exception
$e
)
{
$this
->
error
(
$e
->
getMessage
());
}
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'Invalid parameters'
));
}
}
/**
* 刷新配置文件
*/
...
...
application/admin/model/UserRule.php
查看文件 @
7e83133
...
...
@@ -2,6 +2,7 @@
namespace
app\admin\model
;
use
fast\Tree
;
use
think\Model
;
class
UserRule
extends
Model
...
...
@@ -43,8 +44,16 @@ class UserRule extends Model
{
$ruleList
=
collection
(
self
::
where
(
'status'
,
'normal'
)
->
order
(
'weigh desc,id desc'
)
->
select
())
->
toArray
();
$nodeList
=
[];
Tree
::
instance
()
->
init
(
$ruleList
);
$ruleList
=
Tree
::
instance
()
->
getTreeList
(
Tree
::
instance
()
->
getTreeArray
(
0
),
'name'
);
$hasChildrens
=
[];
foreach
(
$ruleList
as
$k
=>
$v
)
{
if
(
$v
[
'haschild'
])
$hasChildrens
[]
=
$v
[
'id'
];
}
foreach
(
$ruleList
as
$k
=>
$v
)
{
$state
=
array
(
'selected'
=>
$v
[
'ismenu'
]
?
false
:
in_array
(
$v
[
'id'
],
$selected
));
$state
=
array
(
'selected'
=>
in_array
(
$v
[
'id'
],
$selected
)
&&
!
in_array
(
$v
[
'id'
],
$hasChildrens
));
$nodeList
[]
=
array
(
'id'
=>
$v
[
'id'
],
'parent'
=>
$v
[
'pid'
]
?
$v
[
'pid'
]
:
'#'
,
'text'
=>
__
(
$v
[
'title'
]),
'type'
=>
'menu'
,
'state'
=>
$state
);
}
return
$nodeList
;
...
...
application/admin/view/general/config/index.html
查看文件 @
7e83133
...
...
@@ -4,10 +4,16 @@
.edit-form
tr
th
:first-child
,
.edit-form
tr
td
:first-child
{
width
:
20%
;
}
.edit-form
tr
th
:
last-child
,
.edit-form
tr
td
:last-child
{
.edit-form
tr
th
:
nth-last-of-type
(
-n
+
2
),
.edit-form
tr
td
:nth-last-of-type
(
-n
+
2
)
{
display
:
none
;
}
}
.edit-form
table
>
tbody
>
tr
td
a
.btn-delcfg
{
visibility
:
hidden
;
}
.edit-form
table
>
tbody
>
tr
:hover
td
a
.btn-delcfg
{
visibility
:
visible
;
}
</style>
<div
class=
"panel panel-default panel-intro"
>
<div
class=
"panel-heading"
>
...
...
@@ -32,8 +38,9 @@
<thead>
<tr>
<th
width=
"15%"
>
{:__('Title')}
</th>
<th
width=
"
70
%"
>
{:__('Value')}
</th>
<th
width=
"
68
%"
>
{:__('Value')}
</th>
<th
width=
"15%"
>
{:__('Name')}
</th>
<th
width=
"2%"
></th>
</tr>
</thead>
<tbody>
...
...
@@ -121,6 +128,7 @@
</td>
<td>
{php}echo "{\$site.". $item['name'] . "}";{/php}
</td>
<td><a
href=
"javascript:;"
class=
"btn-delcfg text-muted"
data-name=
"{$item.name}"
><i
class=
"fa fa-times"
></i></a></td>
</tr>
{/foreach}
</tbody>
...
...
@@ -132,6 +140,7 @@
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
...
...
public/assets/js/backend/general/config.js
查看文件 @
7e83133
...
...
@@ -73,6 +73,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
});
});
//删除配置
$
(
document
).
on
(
"click"
,
".btn-delcfg"
,
function
()
{
var
that
=
this
;
Layer
.
confirm
(
__
(
'Are you sure you want to delete this item?'
),
{
icon
:
3
,
title
:
'提示'
},
function
(
index
)
{
Backend
.
api
.
ajax
({
url
:
"general/config/del?receiver="
+
value
,
data
:
{
name
:
$
(
that
).
data
(
"name"
)}
},
function
()
{
$
(
that
).
closest
(
"tr"
).
remove
();
Layer
.
close
(
index
);
});
});
});
},
add
:
function
()
{
Controller
.
api
.
bindevent
();
...
...
请
注册
或
登录
后发表评论