Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
6d6b9650
Commit
6d6b9650
authored
Oct 24, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增部门总监选填
parent
b13e9e47
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
32 deletions
+32
-32
District.php
application/index/controller/District.php
+1
-3
index.html
application/index/view/district/index.html
+1
-1
ADistrict.php
application/model/ADistrict.php
+30
-24
district.js
public/resource/js/district.js
+0
-4
No files found.
application/index/controller/District.php
View file @
6d6b9650
...
@@ -68,17 +68,15 @@ class District extends Basic
...
@@ -68,17 +68,15 @@ class District extends Basic
* 添加部门,绑定总监关系
* 添加部门,绑定总监关系
*
*
* @return \think\Response
* @return \think\Response
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
*/
public
function
addDistrict
()
{
public
function
addDistrict
()
{
$district
=
new
ADistrict
();
$district
=
new
ADistrict
();
if
(
$this
->
request
->
isPost
())
{
if
(
$this
->
request
->
isPost
())
{
if
(
$this
->
params
[
'department_name'
]
||
$this
->
params
[
'agents_id'
]
)
{
if
(
$this
->
params
[
'department_name'
])
{
$this
->
data
=
$district
->
addDepartmentAgents
(
$this
->
params
,
$this
->
params
[
'agents_id'
]);
$this
->
data
=
$district
->
addDepartmentAgents
(
$this
->
params
,
$this
->
params
[
'agents_id'
]);
}
else
{
}
else
{
$this
->
code
=
101
;
$this
->
code
=
101
;
...
...
application/index/view/district/index.html
View file @
6d6b9650
...
@@ -91,7 +91,7 @@
...
@@ -91,7 +91,7 @@
<input
type=
"text"
value=
""
name=
"title"
class=
"form-control btn6"
placeholder=
"部门名称"
>
<input
type=
"text"
value=
""
name=
"title"
class=
"form-control btn6"
placeholder=
"部门名称"
>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
部门总监:
</label>
<label
class=
"col-sm-3 control-label"
>
部门总监
(选填)
:
</label>
<input
type=
"text"
value=
""
name=
"agents_id"
class=
"form-control btn6 phone_mend"
placeholder=
"部门总监"
>
<input
type=
"text"
value=
""
name=
"agents_id"
class=
"form-control btn6 phone_mend"
placeholder=
"部门总监"
>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
...
...
application/model/ADistrict.php
View file @
6d6b9650
...
@@ -18,35 +18,31 @@ class ADistrict extends BaseModel
...
@@ -18,35 +18,31 @@ class ADistrict extends BaseModel
*
*
* @param $data
* @param $data
* @param $agents_id
* @param $agents_id
* @return
bool|
mixed
* @return mixed
* @throws \Exception
* @throws \Exception
* @throws \think\exception\PDOException
*/
*/
public
function
addDepartmentAgents
(
$data
,
$agents_id
)
{
public
function
addDepartmentAgents
(
$data
,
$agents_id
)
{
$this
->
startTrans
();
$agents_data
=
[];
if
(
empty
(
$data
[
'id'
]))
{
if
(
empty
(
$data
[
'id'
]))
{
$this
->
save
([
$save_data
[
'district_name'
]
=
$data
[
'department_name'
];
'district_name'
=>
$data
[
'department_name'
],
$save_data
[
'site_id'
]
=
$data
[
'site_id'
];
'site_id'
=>
$data
[
'site_id'
],
$save_data
[
'create_time'
]
=
date
(
'Y-m-d H:i:s'
);
'create_time'
=>
date
(
'Y-m-d H:i:s'
)
$id
=
$this
->
insertGetId
(
$save_data
);
]);
$id
=
$this
->
id
;
}
else
{
}
else
{
$
this
->
save
([
$
save_data
[
'district_name'
]
=
$data
[
'department_name'
];
'district_name'
=>
$data
[
'department_name'
],
$save_data
[
'id'
]
=
$data
[
'id'
];
],[
'id'
=>
$data
[
'id'
]]
);
$this
->
update
(
$save_data
);
$id
=
$data
[
'id'
];
$id
=
$data
[
'id'
];
}
}
if
(
$id
)
{
//处理经纪人等级 10业务员 20店长 30总监 40店长和总监
$agents
=
new
AAgents
();
$agents
=
new
AAgents
();
//处理经纪人等级 10业务员 20店长 30总监 40店长和总监
$agents_info
=
$agents
->
where
([
$agents_info
=
$agents
->
where
([
'district_id'
=>
$id
,
'level'
=>
[
'in'
,
'30,40'
]
'district_id'
=>
$id
,
'level'
=>
[
'in'
,
'30,40'
]
])
->
column
(
'id,level'
);
])
->
column
(
'id,level'
);
$agents_data
=
[];
if
(
$id
&&
!
empty
(
$agents_id
))
{
if
(
empty
(
$agents_info
))
{
if
(
empty
(
$agents_info
))
{
$agents_data
[
0
][
'id'
]
=
$agents_id
;
$agents_data
[
0
][
'id'
]
=
$agents_id
;
$agents_data
[
0
][
'level'
]
=
30
;
$agents_data
[
0
][
'level'
]
=
30
;
...
@@ -81,16 +77,26 @@ class ADistrict extends BaseModel
...
@@ -81,16 +77,26 @@ class ADistrict extends BaseModel
$agents_data
[
$k
][
'id'
]
=
$agents_id
;
$agents_data
[
$k
][
'id'
]
=
$agents_id
;
$agents_data
[
$k
][
'district_id'
]
=
$id
;
$agents_data
[
$k
][
'district_id'
]
=
$id
;
}
}
$agents
->
saveAll
(
$agents_data
);
$result
=
$id
;
$this
->
commit
();
}
else
{
}
else
{
$result
=
false
;
//删除总监
$this
->
rollback
();
foreach
(
$agents_info
as
$k
=>
$v
)
{
if
(
$agents_id
!=
$k
)
{
if
(
$v
==
40
)
{
//总监降级为店长
$agents_data
[
$k
][
'id'
]
=
$k
;
$agents_data
[
$k
][
'level'
]
=
20
;
$agents_data
[
$k
][
'district_id'
]
=
$id
;
}
else
{
//总监降级为业务员
$agents_data
[
$k
][
'id'
]
=
$k
;
$agents_data
[
$k
][
'level'
]
=
10
;
$agents_data
[
$k
][
'district_id'
]
=
$id
;
}
}
}
return
$result
;
}
}
$agents
->
saveAll
(
$agents_data
);
return
$id
;
}
}
/**
/**
...
...
public/resource/js/district.js
View file @
6d6b9650
...
@@ -116,10 +116,6 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa
...
@@ -116,10 +116,6 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa
alert
(
'请选择部门'
);
alert
(
'请选择部门'
);
return
;
return
;
}
}
if
(
par
.
agents_id
==
''
){
alert
(
'请选择部门总监'
);
return
;
}
$
.
ajax
({
$
.
ajax
({
'type'
:
'POST'
,
'type'
:
'POST'
,
...
...
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