Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
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
c483e6a1
authored
May 13, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
只能选采购员
parent
5759f1fe
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
20 deletions
app/Http/Controllers/SupplierContactController.php
app/Http/Controllers/SupplierController.php
app/Model/IntracodeModel.php
resources/views/script/supplier/SupplierContactScript.blade.php
app/Http/Controllers/SupplierContactController.php
View file @
c483e6a1
...
...
@@ -61,8 +61,8 @@ class SupplierContactController extends Controller
$this
->
data
[
'receipt'
]
=
$model
->
where
(
'contact_id'
,
$contactId
)
->
first
()
->
toArray
();
}
$intracodeModel
=
new
IntracodeModel
();
$userCodes
=
$intracodeModel
->
getSampleEncode
();
$this
->
data
[
'userCodes'
]
=
$
userCodes
;
//
$userCodes = $intracodeModel->getSampleEncode();
$this
->
data
[
'userCodes'
]
=
$
intracodeModel
->
getChannelUsersEncode
()
;
return
$this
->
view
(
'添加联系方式'
);
}
...
...
@@ -74,7 +74,7 @@ class SupplierContactController extends Controller
$model
=
new
SupplierContactModel
();
$this
->
data
[
'contact'
]
=
$model
->
where
(
'contact_id'
,
$contactId
)
->
first
()
->
toArray
();
$intracodeModel
=
new
IntracodeModel
();
$userCodes
=
$intracodeModel
->
get
Sample
Encode
();
$userCodes
=
$intracodeModel
->
get
ChannelUsers
Encode
();
$this
->
data
[
'userCodes'
]
=
$userCodes
;
return
$this
->
view
(
'添加联系方式'
);
}
...
...
app/Http/Controllers/SupplierController.php
View file @
c483e6a1
...
...
@@ -58,7 +58,7 @@ class SupplierController extends Controller
public
function
SupplierList
(
$request
)
{
$intracodeModel
=
new
IntracodeModel
();
$this
->
data
[
'userCodes'
]
=
$intracodeModel
->
get
Sample
Encode
();
$this
->
data
[
'userCodes'
]
=
$intracodeModel
->
get
ChannelUsers
Encode
();
$this
->
data
[
'users'
]
=
$intracodeModel
->
getAdminUserAndCode
();
$supplierStatisticsService
=
new
SupplierStatisticsService
();
$statistics
=
$supplierStatisticsService
->
getSupplierListStatistics
();
...
...
@@ -99,7 +99,7 @@ class SupplierController extends Controller
$intracodeModel
=
new
IntracodeModel
();
$this
->
data
[
'outside_contact_status'
]
=
Config
(
'fixed.OutsideContactStatus'
);
$this
->
data
[
'outside_contact_type'
]
=
Config
(
'fixed.OutsideContactType'
);
$userCodes
=
$intracodeModel
->
get
Sample
Encode
();
$userCodes
=
$intracodeModel
->
get
ChannelUsers
Encode
();
$this
->
data
[
'userCodes'
]
=
$userCodes
;
$this
->
data
[
'user'
]
=
$userCodes
;
$this
->
data
[
'purchase_users'
]
=
[];
...
...
@@ -131,7 +131,7 @@ class SupplierController extends Controller
{
$intracodeModel
=
new
IntracodeModel
();
$userCodes
=
$intracodeModel
->
getSampleEncode
();
$this
->
data
[
'userCodes'
]
=
$
userCodes
;
$this
->
data
[
'userCodes'
]
=
$
intracodeModel
->
getChannelUsersEncode
()
;
$this
->
data
[
'user'
]
=
$userCodes
;
$this
->
data
[
'purchase_users'
]
=
[];
$this
->
data
[
'operate'
]
=
'update'
;
...
...
@@ -183,7 +183,7 @@ class SupplierController extends Controller
$supplier
=
$transformer
->
transformInfo
(
$supplier
);
$this
->
data
[
'supplier'
]
=
$supplier
;
$intracodeModel
=
new
IntracodeModel
();
$this
->
data
[
'userCodes'
]
=
$intracodeModel
->
get
PurchaseUserCodes
();
$this
->
data
[
'userCodes'
]
=
$intracodeModel
->
get
ChannelUsersEncode
();
$logModel
=
new
LogModel
();
$this
->
data
[
'logs'
]
=
$logModel
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'action'
,
'分配渠道开发员'
)
->
orderBy
(
'id'
,
'desc'
)
...
...
app/Model/IntracodeModel.php
View file @
c483e6a1
...
...
@@ -3,6 +3,7 @@
namespace
App\Model
;
use
App\Http\Services\AdminUserService
;
use
App\Http\Services\DepartmentService
;
use
Illuminate\Database\Eloquent\Model
;
class
IntracodeModel
extends
Model
...
...
@@ -16,7 +17,8 @@ class IntracodeModel extends Model
$codeList
=
json_decode
(
$redis
->
get
(
'EncodedList_supplier'
),
true
);
if
(
!
$codeList
)
{
$codeList
=
$this
->
where
(
'admin_id'
,
'>'
,
0
)
->
join
(
'user_info'
,
'lie_intracode.admin_id'
,
'='
,
'user_info.userId'
)
->
select
(
'code_id'
,
'admin_id'
,
'name'
,
'email'
)
->
get
();
'user_info.userId'
)
->
where
(
'user_info.status'
,
'!='
,
4
)
->
select
(
'code_id'
,
'admin_id'
,
'name'
,
'email'
)
->
get
();
if
(
$codeList
)
{
$codeList
=
$codeList
->
toArray
();
foreach
(
$codeList
as
$k
=>
&
$v
)
{
...
...
@@ -31,6 +33,7 @@ class IntracodeModel extends Model
return
$codeList
;
}
//获取简单的内部用户数据
public
function
getSampleEncode
()
{
...
...
@@ -42,13 +45,22 @@ class IntracodeModel extends Model
return
$result
;
}
//获取
开发员的编码(渠道开发部门的优先排序)
public
function
get
AdminId
Encode
()
//获取
采购员和对应的编码
public
function
get
ChannelUsers
Encode
()
{
$codeList
=
$this
->
getEncode
();
$departmentService
=
new
DepartmentService
();
//市场部
$usersMarket
=
$departmentService
->
getUserByDepartmentId
(
4
);
//运营部
$usersOperation
=
$departmentService
->
getUserByDepartmentId
(
9
);
//采购部
$userChannel
=
$departmentService
->
getUserByDepartmentId
(
8
);
$users
=
array_merge
(
array_merge
(
$usersMarket
,
$usersOperation
),
$userChannel
);
$userIds
=
array_column
(
$users
,
'userId'
);
$users
=
$this
->
getEncodeByUserIds
(
$userIds
);
$result
=
[];
foreach
(
$
codeList
as
$code
)
{
$result
[
$code
[
'
admin
_id'
]]
=
$code
[
'name'
]
.
'('
.
$code
[
'code_id'
]
.
')'
;
foreach
(
$
users
as
$code
)
{
$result
[
$code
[
'
code
_id'
]]
=
$code
[
'name'
]
.
'('
.
$code
[
'code_id'
]
.
')'
;
}
return
$result
;
}
...
...
@@ -88,7 +100,7 @@ class IntracodeModel extends Model
}
$temp
=
[];
foreach
(
$codes
as
$code
=>
$name
)
{
if
(
in_array
(
$code
,
$codeIds
))
{
if
(
in_array
(
$code
,
$codeIds
))
{
unset
(
$codes
[
$code
]);
$temp
[
$code
]
=
$name
;
}
...
...
@@ -102,7 +114,7 @@ class IntracodeModel extends Model
{
$encodedUsers
=
[];
$codes
=
$this
->
select
(
'code_id'
,
'admin_id'
)
->
whereIn
(
'code_id'
,
$encodedList
)
->
whereIn
(
'code_id'
,
$encodedList
)
->
get
();
if
(
empty
(
$codes
))
{
return
[];
...
...
@@ -110,8 +122,8 @@ class IntracodeModel extends Model
$codes
=
$codes
->
toArray
();
$adminIds
=
array_column
(
$codes
,
'admin_id'
);
$userModel
=
new
UserInfoModel
();
$users
=
$userModel
->
whereIn
(
'userId'
,
$adminIds
)
->
pluck
(
'name'
,
'userId'
);
foreach
(
$codes
as
$key
=>
$code
)
{
$users
=
$userModel
->
whereIn
(
'userId'
,
$adminIds
)
->
pluck
(
'name'
,
'userId'
);
foreach
(
$codes
as
$key
=>
$code
)
{
$encodedUsers
[
$code
[
'code_id'
]]
=
array_get
(
$users
,
$code
[
'admin_id'
]);
}
return
$encodedUsers
;
...
...
resources/views/script/supplier/SupplierContactScript.blade.php
View file @
c483e6a1
...
...
@@ -46,7 +46,7 @@
area
:
[
'600px'
,
'525px'
],
title
:
'新增联系人'
,
end
:
function
()
{
// 监听弹窗关闭
location
.
href
=
'/supplier/UpdateSupplier?view=iframe&tab=contact&supplier_id='
+
supplierId
;
//
location.href = '/supplier/UpdateSupplier?view=iframe&tab=contact&supplier_id='+supplierId;
table
.
reload
(
'contactList'
);
}
});
...
...
@@ -66,7 +66,7 @@
area
:
[
'600px'
,
'525px'
],
title
:
'编辑联系人'
,
end
:
function
()
{
// 监听弹窗关闭
location
.
href
=
'/supplier/UpdateSupplier?view=iframe&tab=contact&supplier_id='
+
supplierId
;
//
location.href = '/supplier/UpdateSupplier?view=iframe&tab=contact&supplier_id='+supplierId;
table
.
reload
(
'contactList'
);
}
});
...
...
@@ -92,7 +92,7 @@
return
false
;
}
if
(
resp
.
err_code
===
0
)
{
location
.
href
=
'/supplier/UpdateSupplier?view=iframe&tab=contact&supplier_id='
+
supplierId
;
//
location.href = '/supplier/UpdateSupplier?view=iframe&tab=contact&supplier_id='+supplierId;
table
.
reload
(
'contactList'
);
layer
.
closeAll
();
layer
.
msg
(
resp
.
err_msg
,
{
'icon'
:
6
});
...
...
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