Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zhupu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sugar
zhupu
Commits
139037e3
Commit
139037e3
authored
Nov 23, 2023
by
wuxiaoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
族谱代理后台
parent
1b26ab9e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
289 additions
and
74 deletions
+289
-74
application/admin/controller/user/Agent.php
application/admin/controller/user/Agent.php
+188
-4
application/admin/lang/zh-cn/user/agent.php
application/admin/lang/zh-cn/user/agent.php
+4
-2
application/admin/model/user/Agent.php
application/admin/model/user/Agent.php
+11
-16
application/admin/view/user/agent/add.html
application/admin/view/user/agent/add.html
+14
-23
application/admin/view/user/agent/edit.html
application/admin/view/user/agent/edit.html
+12
-20
application/admin/view/user/agent/index.html
application/admin/view/user/agent/index.html
+15
-0
public/assets/js/backend/user/agent.js
public/assets/js/backend/user/agent.js
+45
-9
No files found.
application/admin/controller/user/Agent.php
View file @
139037e3
...
...
@@ -3,6 +3,7 @@
namespace
app\admin\controller\user
;
use
app\common\controller\Backend
;
use
think\Db
;
/**
*
...
...
@@ -25,12 +26,195 @@ class Agent extends Backend
$this
->
view
->
assign
(
"typeList"
,
$this
->
model
->
getTypeList
());
$this
->
view
->
assign
(
"statusList"
,
$this
->
model
->
getStatusList
());
}
/**
* 查看
*/
public
function
index
()
{
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
]);
if
(
$this
->
request
->
isAjax
())
{
//如果发送的来源是Selectpage,则转发到Selectpage
if
(
$this
->
request
->
request
(
'keyField'
))
{
return
$this
->
selectpage
();
}
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$total
=
$this
->
model
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
count
();
$list
=
$this
->
model
->
with
(
"users,agent,family"
)
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
limit
(
$offset
,
$limit
)
->
select
();
$list
=
collection
(
$list
)
->
toArray
();
foreach
(
$list
as
$key
=>
$val
)
{
if
(
$val
[
'area_id'
]){
$area
=
Db
::
name
(
'addr'
)
->
where
([
'ID'
=>
$val
[
'area_id'
]])
->
find
();
$list
[
$key
][
'MergerName'
]
=
$area
[
'MergerName'
];
}
else
if
(
$val
[
'city_id'
]){
$city
=
Db
::
name
(
'addr'
)
->
where
([
'ID'
=>
$val
[
'city_id'
]])
->
find
();
$list
[
$key
][
'MergerName'
]
=
$city
[
'MergerName'
];
}
else
if
(
$val
[
'province_id'
]){
$province
=
Db
::
name
(
'addr'
)
->
where
([
'ID'
=>
$val
[
'province_id'
]])
->
find
();
$list
[
$key
][
'MergerName'
]
=
$province
[
'MergerName'
];
}
}
$result
=
array
(
"total"
=>
$total
,
"rows"
=>
$list
);
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
* 添加
*/
public
function
add
()
{
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
$params
=
$this
->
preExcludeFields
(
$params
);
if
(
$this
->
dataLimit
&&
$this
->
dataLimitFieldAutoFill
)
{
$params
[
$this
->
dataLimitField
]
=
$this
->
auth
->
id
;
}
$result
=
false
;
Db
::
startTrans
();
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
str_replace
(
"
\\
model
\\
"
,
"
\\
validate
\\
"
,
get_class
(
$this
->
model
));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.add'
:
$name
)
:
$this
->
modelValidate
;
$this
->
model
->
validateFailException
(
true
)
->
validate
(
$validate
);
}
if
(
in_array
(
$params
[
"type"
],[
1
,
2
])
){
if
(
empty
(
$params
[
'family_id'
])){
$this
->
error
(
"请选择族谱ID"
);
}
unset
(
$params
[
'province_id'
]);
unset
(
$params
[
'city_id'
]);
unset
(
$params
[
'area_id'
]);
}
else
{
if
(
$params
[
"type"
]
==
3
){
if
(
empty
(
$params
[
'province_id'
])){
$this
->
error
(
"请选择省级"
);
}
unset
(
$params
[
'city_id'
]);
unset
(
$params
[
'area_id'
]);
}
else
if
(
$params
[
"type"
]
==
4
){
if
(
empty
(
$params
[
'city_id'
])){
$this
->
error
(
"请选择市级"
);
}
unset
(
$params
[
'area_id'
]);
}
else
if
(
$params
[
"type"
]
==
5
){
if
(
empty
(
$params
[
'area_id'
])){
$this
->
error
(
"请选择区县级"
);
}
}
unset
(
$params
[
'family_id'
]);
}
$result
=
$this
->
model
->
allowField
(
true
)
->
save
(
$params
);
Db
::
commit
();
}
catch
(
ValidateException
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
catch
(
PDOException
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
catch
(
Exception
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
if
(
$result
!==
false
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were inserted'
));
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
return
$this
->
view
->
fetch
();
}
/**
* 编辑
*/
public
function
edit
(
$ids
=
null
)
{
$row
=
$this
->
model
->
get
(
$ids
);
if
(
!
$row
)
{
$this
->
error
(
__
(
'No Results were found'
));
}
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
if
(
!
in_array
(
$row
[
$this
->
dataLimitField
],
$adminIds
))
{
$this
->
error
(
__
(
'You have no permission'
));
}
}
if
(
$this
->
request
->
isPost
())
{
$params
=
$this
->
request
->
post
(
"row/a"
);
if
(
$params
)
{
$params
=
$this
->
preExcludeFields
(
$params
);
$result
=
false
;
Db
::
startTrans
();
try
{
//是否采用模型验证
if
(
$this
->
modelValidate
)
{
$name
=
str_replace
(
"
\\
model
\\
"
,
"
\\
validate
\\
"
,
get_class
(
$this
->
model
));
$validate
=
is_bool
(
$this
->
modelValidate
)
?
(
$this
->
modelSceneValidate
?
$name
.
'.edit'
:
$name
)
:
$this
->
modelValidate
;
$row
->
validateFailException
(
true
)
->
validate
(
$validate
);
}
if
(
in_array
(
$params
[
"type"
],[
1
,
2
])
){
if
(
empty
(
$params
[
'family_id'
])){
$this
->
error
(
"请选择族谱ID"
);
}
unset
(
$params
[
'province_id'
]);
unset
(
$params
[
'city_id'
]);
unset
(
$params
[
'area_id'
]);
}
else
{
if
(
$params
[
"type"
]
==
3
){
if
(
empty
(
$params
[
'province_id'
])){
$this
->
error
(
"请选择省级"
);
}
unset
(
$params
[
'city_id'
]);
unset
(
$params
[
'area_id'
]);
}
else
if
(
$params
[
"type"
]
==
4
){
if
(
empty
(
$params
[
'city_id'
])){
$this
->
error
(
"请选择市级"
);
}
unset
(
$params
[
'area_id'
]);
}
else
if
(
$params
[
"type"
]
==
5
){
if
(
empty
(
$params
[
'area_id'
])){
$this
->
error
(
"请选择区县级"
);
}
}
unset
(
$params
[
'family_id'
]);
}
$result
=
$row
->
allowField
(
true
)
->
save
(
$params
);
Db
::
commit
();
}
catch
(
ValidateException
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
catch
(
PDOException
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
catch
(
Exception
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
if
(
$result
!==
false
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were updated'
));
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
''
));
}
$this
->
view
->
assign
(
"row"
,
$row
);
return
$this
->
view
->
fetch
();
}
}
application/admin/lang/zh-cn/user/agent.php
View file @
139037e3
...
...
@@ -11,11 +11,13 @@ return [
'Area_id'
=>
'县/区级id'
,
'Createtime'
=>
'创建时间'
,
'Type'
=>
'类型'
,
'Type 1'
=>
'族长'
,
'Type 2'
=>
'传承人'
,
'Type 3'
=>
'县区代理'
,
'Type 4'
=>
'市级代理'
,
'Type 5'
=>
'省级代理'
,
'Rate'
=>
'返佣
百分
比例'
,
'Family_id'
=>
'
关联
族谱id'
,
'Rate'
=>
'返佣比例'
,
'Family_id'
=>
'族谱id'
,
'Level'
=>
'传承人代系'
,
'Status'
=>
'状态'
,
'Status 1'
=>
'显示'
,
...
...
application/admin/model/user/Agent.php
View file @
139037e3
...
...
@@ -7,11 +7,6 @@ use think\Model;
class
Agent
extends
Model
{
// 表名
protected
$name
=
'agent'
;
...
...
@@ -29,19 +24,9 @@ class Agent extends Model
'status_text'
];
protected
static
function
init
()
{
self
::
afterInsert
(
function
(
$row
)
{
$pk
=
$row
->
getPk
();
$row
->
getQuery
()
->
where
(
$pk
,
$row
[
$pk
])
->
update
([
'level'
=>
$row
[
$pk
]]);
});
}
public
function
getTypeList
()
{
return
[
'3'
=>
__
(
'Type 3'
),
'4'
=>
__
(
'Type 4'
),
'5'
=>
__
(
'Type 5'
)];
return
[
'
1'
=>
__
(
'Type 1'
),
'2'
=>
__
(
'Type 2'
),
'
3'
=>
__
(
'Type 3'
),
'4'
=>
__
(
'Type 4'
),
'5'
=>
__
(
'Type 5'
)];
}
public
function
getStatusList
()
...
...
@@ -64,8 +49,18 @@ class Agent extends Model
$list
=
$this
->
getStatusList
();
return
isset
(
$list
[
$value
])
?
$list
[
$value
]
:
''
;
}
public
function
users
(){
return
self
::
hasOne
(
"app\admin\model\User"
,
'id'
,
"user_id"
);
}
public
function
agent
(){
return
self
::
hasOne
(
"app\admin\model\User"
,
'id'
,
"parent_user_id"
);
}
public
function
family
()
{
return
self
::
hasOne
(
"app\admin\model\Family\Family"
,
'id'
,
"family_id"
)
->
bind
(
"family_name"
);
}
}
application/admin/view/user/agent/add.html
View file @
139037e3
...
...
@@ -3,19 +3,19 @@
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('User_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-user_id"
data-rule=
"required"
data-source=
"user/user/index"
data-
field=
"nickname
"
class=
"form-control selectpage"
name=
"row[user_id]"
type=
"text"
value=
""
>
<input
id=
"c-user_id"
data-rule=
"required"
data-source=
"user/user/index"
data-
search-field=
"id,nickname,mobile"
data-primary-key=
"id"
data-field=
"id"
data-format-item=
"{id} - {nickname} - {mobile}
"
class=
"form-control selectpage"
name=
"row[user_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Realname')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-realname"
class=
"form-control"
name=
"row[realname]"
type=
"text"
value=
""
>
<input
id=
"c-realname"
data-rule=
"required"
class=
"form-control"
name=
"row[realname]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Mobile')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-mobile"
class=
"form-control"
name=
"row[mobile]"
type=
"text"
value=
""
>
<input
id=
"c-mobile"
data-rule=
"required"
class=
"form-control"
name=
"row[mobile]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
...
...
@@ -27,34 +27,25 @@
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Parent_user_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-parent_user_id"
data-rule=
"
required"
data-source=
"parent/user/index
"
class=
"form-control selectpage"
name=
"row[parent_user_id]"
type=
"text"
value=
""
>
<input
id=
"c-parent_user_id"
data-rule=
"
"
data-multiple=
"true"
data-source=
"user/user/index"
data-search-field=
"id,nickname,mobile"
data-primary-key=
"id"
data-field=
"id"
data-format-item=
"{id} - {nickname} - {mobile}
"
class=
"form-control selectpage"
name=
"row[parent_user_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Province_id')}:
</label>
<label
class=
"control-label col-xs-12 col-sm-2"
>
省市区:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-province_id"
data-rule=
"required"
data-source=
"province/index"
class=
"form-control selectpage"
name=
"row[province_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('City_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-city_id"
data-rule=
"required"
data-source=
"city/index"
class=
"form-control selectpage"
name=
"row[city_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Area_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-area_id"
data-rule=
"required"
data-source=
"area/index"
class=
"form-control selectpage"
name=
"row[area_id]"
type=
"text"
value=
""
>
<div
class=
"form-inline col-xs-12"
data-toggle=
"cxselect"
data-selects=
"province,city,area"
>
<select
class=
"province form-control"
data-rule=
""
name=
"row[province_id]"
data-value=
""
data-url=
"ajax/address"
id=
"c-province"
></select>
<select
class=
"city form-control"
data-rule=
""
name=
"row[city_id]"
data-value=
""
data-url=
"ajax/address"
id=
"c-city"
></select>
<select
class=
"area form-control"
data-rule=
""
name=
"row[area_id]"
data-value=
""
data-url=
"ajax/address"
id=
"c-area"
></select>
</div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Type')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="typeList" item="vo"}
<label
for=
"row[type]-{$key}"
><input
id=
"row[type]-{$key}"
name=
"row[type]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"
2"
}
checked
{/
in
}
/>
{$vo}
</label>
<label
for=
"row[type]-{$key}"
><input
id=
"row[type]-{$key}"
name=
"row[type]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"
1"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
...
...
@@ -63,19 +54,19 @@
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Rate')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-rate"
class=
"form-control"
name=
"row[rate]"
type=
"number
"
value=
"0"
>
<input
id=
"c-rate"
data-rule=
"required;range(0~1);"
class=
"form-control"
name=
"row[rate]"
type=
"text
"
value=
"0"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Family_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-family_id"
data-rule=
"
required"
data-source=
"family/index"
class=
"form-control selectpage"
name=
"row[family_id]"
type=
"text"
value=
""
>
<input
id=
"c-family_id"
data-rule=
"
"
data-source=
"family/family/index"
class=
"form-control selectpage"
data-search-field=
"id,family_name,realname,address"
data-primary-key=
"id"
data-field=
"id"
data-format-item=
"{id} - {family_name} - {realname} - {address}"
name=
"row[family_id]"
type=
"text"
data-params=
'{"custom[status]":"1"}'
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Level')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-level"
class=
"form-control"
name=
"row[level]"
type=
"number"
>
<input
id=
"c-level"
class=
"form-control"
name=
"row[level]"
type=
"number"
value=
"0"
>
</div>
</div>
<div
class=
"form-group"
>
...
...
application/admin/view/user/agent/edit.html
View file @
139037e3
...
...
@@ -3,19 +3,19 @@
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('User_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-user_id"
data-rule=
"required"
data-source=
"user/user/index"
data-
field=
"nickname
"
class=
"form-control selectpage"
name=
"row[user_id]"
type=
"text"
value=
"{$row.user_id|htmlentities}"
>
<input
id=
"c-user_id"
data-rule=
"required"
data-source=
"user/user/index"
data-
search-field=
"id,nickname,mobile"
data-primary-key=
"id"
data-field=
"id"
data-format-item=
"{id} - {nickname} - {mobile}
"
class=
"form-control selectpage"
name=
"row[user_id]"
type=
"text"
value=
"{$row.user_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Realname')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-realname"
class=
"form-control"
name=
"row[realname]"
type=
"text"
value=
"{$row.realname|htmlentities}"
>
<input
id=
"c-realname"
data-rule=
"required"
class=
"form-control"
name=
"row[realname]"
type=
"text"
value=
"{$row.realname|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Mobile')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-mobile"
class=
"form-control"
name=
"row[mobile]"
type=
"text"
value=
"{$row.mobile|htmlentities}"
>
<input
id=
"c-mobile"
data-rule=
"required"
class=
"form-control"
name=
"row[mobile]"
type=
"text"
value=
"{$row.mobile|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
...
...
@@ -27,25 +27,17 @@
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Parent_user_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-parent_user_id"
data-rule=
"
required"
data-source=
"parent/user/index
"
class=
"form-control selectpage"
name=
"row[parent_user_id]"
type=
"text"
value=
"{$row.parent_user_id|htmlentities}"
>
<input
id=
"c-parent_user_id"
data-rule=
"
"
data-multiple=
"true"
data-source=
"user/user/index"
data-search-field=
"id,nickname,mobile"
data-primary-key=
"id"
data-field=
"id"
data-format-item=
"{id} - {nickname} - {mobile}
"
class=
"form-control selectpage"
name=
"row[parent_user_id]"
type=
"text"
value=
"{$row.parent_user_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Province_id')}:
</label>
<label
class=
"control-label col-xs-12 col-sm-2"
>
省市区:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-province_id"
data-rule=
"required"
data-source=
"province/index"
class=
"form-control selectpage"
name=
"row[province_id]"
type=
"text"
value=
"{$row.province_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('City_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-city_id"
data-rule=
"required"
data-source=
"city/index"
class=
"form-control selectpage"
name=
"row[city_id]"
type=
"text"
value=
"{$row.city_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Area_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-area_id"
data-rule=
"required"
data-source=
"area/index"
class=
"form-control selectpage"
name=
"row[area_id]"
type=
"text"
value=
"{$row.area_id|htmlentities}"
>
<div
class=
"form-inline col-xs-12"
data-toggle=
"cxselect"
data-selects=
"province,city,area"
>
<select
class=
"province form-control"
data-rule=
""
name=
"row[province_id]"
data-value=
"{$row.province_id|htmlentities}"
data-url=
"ajax/address"
id=
"c-province"
></select>
<select
class=
"city form-control"
data-rule=
""
name=
"row[city_id]"
data-value=
"{$row.city_id|htmlentities}"
data-url=
"ajax/address"
id=
"c-city"
></select>
<select
class=
"area form-control"
data-rule=
""
name=
"row[area_id]"
data-value=
"{$row.area_id|htmlentities}"
data-url=
"ajax/address"
id=
"c-area"
></select>
</div>
</div>
</div>
<div
class=
"form-group"
>
...
...
@@ -63,13 +55,13 @@
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Rate')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-rate"
class=
"form-control"
name=
"row[rate]"
type=
"number
"
value=
"{$row.rate|htmlentities}"
>
<input
id=
"c-rate"
data-rule=
"required;range(0~1);"
class=
"form-control"
name=
"row[rate]"
type=
"text
"
value=
"{$row.rate|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Family_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-family_id"
data-rule=
"
required"
data-source=
"family/index"
class=
"form-control selectpage"
name=
"row[family_id]"
type=
"text"
value=
"{$row.family_id|htmlentities}"
>
<input
id=
"c-family_id"
data-rule=
"
"
data-source=
"family/family/index"
class=
"form-control selectpage"
data-search-field=
"id,family_name,realname,address"
data-primary-key=
"id"
data-field=
"id"
data-format-item=
"{id} - {family_name} - {realname} - {address}"
name=
"row[family_id]"
type=
"text"
data-params=
'{"custom[status]":"1"}'
value=
"{$row.family_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
...
...
application/admin/view/user/agent/index.html
View file @
139037e3
...
...
@@ -43,3 +43,18 @@
</div>
</div>
</div>
<script
id=
"sourcetpl"
type=
"text/html"
>
<
div
class
=
"
row
"
id
=
'
area-select
'
>
<
div
class
=
"
col-xs-12
"
>
<
div
class
=
"
form-inline
"
data
-
toggle
=
"
cxselect
"
data
-
selects
=
"
province,city,area
"
>
<
select
class
=
"
province form-control
"
name
=
"
province_id
"
data
-
url
=
"
ajax/address
"
><
/select
>
<
input
type
=
"
hidden
"
class
=
"
operate
"
data
-
name
=
"
province_id
"
value
=
"
=
"
/>
<
select
class
=
"
city form-control
"
name
=
"
city_id
"
data
-
url
=
"
ajax/city
"
data
-
query
-
name
=
"
province
"
><
/select
>
<
input
type
=
"
hidden
"
class
=
"
operate
"
data
-
name
=
"
city_id
"
value
=
"
=
"
/>
<
select
class
=
"
area form-control
"
name
=
"
area_id
"
data
-
url
=
"
ajax/area
"
data
-
query
-
name
=
"
city_id
"
><
/select
>
<
input
type
=
"
hidden
"
class
=
"
operate
"
data
-
name
=
"
area_id
"
value
=
"
=
"
/>
<
/div
>
<
/div
>
<
/div
>
</script>
\ No newline at end of file
public/assets/js/backend/user/agent.js
View file @
139037e3
...
...
@@ -25,19 +25,55 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
[
{
checkbox
:
true
},
{
field
:
'
id
'
,
title
:
__
(
'
Id
'
)},
{
field
:
'
user_id
'
,
title
:
__
(
'
User_id
'
)},
{
field
:
'
user_id
'
,
title
:
__
(
'
User_id
'
),
formatter
:
function
(
value
,
row
,
index
)
{
if
(
row
.
users
){
var
html
=
"
id:
"
+
row
.
user_id
+
"
<br/> 昵称:
"
+
row
.
users
.
nickname
;
html
=
row
.
realname
?
html
+
"
<br/> 姓名:
"
+
row
.
realname
:
html
;
html
=
row
.
users
.
mobile
?
html
+
"
<br/> 电话:
"
+
row
.
users
.
mobile
:
html
;
return
html
;
}
else
{
return
"
id:
"
+
row
.
agent_user_id
;
}
}},
{
field
:
'
realname
'
,
title
:
__
(
'
Realname
'
)},
{
field
:
'
mobile
'
,
title
:
__
(
'
Mobile
'
)},
{
field
:
'
identity_number
'
,
title
:
__
(
'
Identity_number
'
)},
{
field
:
'
parent_user_id
'
,
title
:
__
(
'
Parent_user_id
'
)},
{
field
:
'
province_id
'
,
title
:
__
(
'
Province_id
'
)},
{
field
:
'
city_id
'
,
title
:
__
(
'
City_id
'
)},
{
field
:
'
area_id
'
,
title
:
__
(
'
Area_id
'
)},
{
field
:
'
parent_user_id
'
,
title
:
__
(
'
Parent_user_id
'
),
formatter
:
function
(
value
,
row
,
index
)
{
if
(
row
.
parent_user_id
>
0
){
var
html
=
"
id:
"
+
row
.
parent_user_id
+
"
<br/> 昵称:
"
+
row
.
agent
.
nickname
;
html
=
row
.
agent
.
mobile
?
html
+
"
<br/> 电话:
"
+
row
.
agent
.
mobile
:
html
;
return
html
;
}
return
"
无
"
;
}
},
{
field
:
'
MergerName
'
,
title
:
__
(
'
省市区街道
'
),
formatter
:
function
(
value
,
row
,
index
)
{
if
(
row
.
province
&&
row
.
city
&&
row
.
area
)
{
return
row
.
province
.
name
+
row
.
city
.
name
+
row
.
area
.
name
+
row
.
town
.
name
;
}
else
{
return
row
.
MergerName
;
}
},
searchList
:
function
(
column
)
{
//重点
return
Template
(
'
sourcetpl
'
,
{});
}
},
{
field
:
'
rate
'
,
title
:
__
(
'
Rate
'
),
operate
:
false
},
{
field
:
'
type
'
,
title
:
__
(
'
Type
'
),
searchList
:
{
"
1
"
:
__
(
'
Type 1
'
),
"
2
"
:
__
(
'
Type 2
'
),
"
3
"
:
__
(
'
Type 3
'
),
"
4
"
:
__
(
'
Type 4
'
),
"
5
"
:
__
(
'
Type 5
'
)},
formatter
:
Table
.
api
.
formatter
.
normal
},
{
field
:
'
family_id
'
,
title
:
__
(
'
Family_id
'
),
formatter
:
function
(
value
,
row
,
index
)
{
if
(
row
.
family_id
){
return
"
id:
"
+
row
.
family_id
+
"
<br/>
"
+
row
.
family_name
+
"
氏谱
"
;
}
}},
{
field
:
'
level
'
,
title
:
__
(
'
Level
'
),
operate
:
false
},
{
field
:
'
createtime
'
,
title
:
__
(
'
Createtime
'
),
operate
:
'
RANGE
'
,
addclass
:
'
datetimerange
'
,
formatter
:
Table
.
api
.
formatter
.
datetime
},
{
field
:
'
type
'
,
title
:
__
(
'
Type
'
),
searchList
:
{
"
3
"
:
__
(
'
Type 3
'
),
"
4
"
:
__
(
'
Type 4
'
),
"
5
"
:
__
(
'
Type 5
'
)},
formatter
:
Table
.
api
.
formatter
.
normal
},
{
field
:
'
rate
'
,
title
:
__
(
'
Rate
'
)},
{
field
:
'
family_id
'
,
title
:
__
(
'
Family_id
'
)},
{
field
:
'
level
'
,
title
:
__
(
'
Level
'
)},
{
field
:
'
status
'
,
title
:
__
(
'
Status
'
),
searchList
:
{
"
1
"
:
__
(
'
Status 1
'
),
"
2
"
:
__
(
'
Status 2
'
)},
formatter
:
Table
.
api
.
formatter
.
status
},
{
field
:
'
operate
'
,
title
:
__
(
'
Operate
'
),
table
:
table
,
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
}
]
...
...
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