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
cf8c9ea1
authored
May 28, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' into ysx-CRM转化供应商流程-20260518
parents
100d148e
07205bd0
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
391 additions
and
40 deletions
.gitignore
app/Http/Controllers/Api/CommonApiController.php
app/Http/Controllers/Api/SkuApiController.php
app/Http/Controllers/Filter/SkuListFilter.php
app/Http/Controllers/Filter/SupplierAccountFilter.php
app/Http/Controllers/SupplierController.php
app/Http/Services/SkuService.php
app/Http/Services/SkuUploadLogService.php
app/Http/Services/SyncSupplierService.php
app/Http/routes.php
config/perm.php
resources/views/script/SupplierListScript.blade.php
resources/views/web/SupplierList.blade.php
storage/framework/views/5238497145456f693cc29f1fe0a7ff8fb43fd269.php
storage/framework/views/d4d13e9bcdea7366e4952031431aae4b22f055c1.php
.gitignore
View file @
cf8c9ea1
...
...
@@ -10,4 +10,6 @@ Homestead.json
/vendor/_laravel_ide
/storage/framework/views
/storage
CLAUDE.md
\ No newline at end of file
CLAUDE.md
/.windsurf
/skills-lock.json
app/Http/Controllers/Api/CommonApiController.php
View file @
cf8c9ea1
...
...
@@ -7,6 +7,7 @@ use App\Http\Services\AdminUserService;
use
App\Http\Services\CompanyService
;
use
App\Http\Services\StandardBrandService
;
use
App\Model\BrandModel
;
use
App\Model\RedisModel
;
use
App\Model\StandardBrandModel
;
use
App\Model\SupplierChannelModel
;
use
Illuminate\Http\Request
;
...
...
@@ -120,4 +121,33 @@ class CommonApiController extends Controller
$this
->
response
(
0
,
'ok'
,
$result
);
}
//保存列表列显示设置
public
function
SaveColSettings
(
Request
$request
)
{
$userId
=
$request
->
input
(
'user_id'
,
0
);
$pageKey
=
$request
->
input
(
'page_key'
,
''
);
$settings
=
$request
->
input
(
'settings'
,
''
);
if
(
empty
(
$userId
)
||
empty
(
$pageKey
)
||
empty
(
$settings
))
{
$this
->
response
(
-
1
,
'参数错误'
);
}
$redis
=
new
RedisModel
();
$hashKey
=
'col_settings:'
.
$pageKey
;
$redis
->
hset
(
$hashKey
,
$userId
,
$settings
);
$this
->
response
(
0
,
'ok'
);
}
//获取列表列显示设置
public
function
GetColSettings
(
Request
$request
)
{
$userId
=
$request
->
input
(
'user_id'
,
0
);
$pageKey
=
$request
->
input
(
'page_key'
,
''
);
if
(
empty
(
$userId
)
||
empty
(
$pageKey
))
{
$this
->
response
(
-
1
,
'参数错误'
);
}
$redis
=
new
RedisModel
();
$hashKey
=
'col_settings:'
.
$pageKey
;
$settings
=
$redis
->
hget
(
$hashKey
,
$userId
);
$this
->
response
(
0
,
'ok'
,
$settings
?
json_decode
(
$settings
,
true
)
:
new
\stdClass
());
}
}
app/Http/Controllers/Api/SkuApiController.php
View file @
cf8c9ea1
...
...
@@ -60,16 +60,59 @@ class SkuApiController extends Controller
$supplierCode
=
$request
->
get
(
'supplier_code'
);
$brandId
=
$request
->
get
(
'brand_ids'
);
$brandId
=
str_replace
(
','
,
''
,
$brandId
);
// $updateTime = $request->get('update_time');
if
(
empty
(
$supplierCode
))
{
$this
->
response
(
-
1
,
'请选择供应商'
);
}
// $startTime = $endTime = 0;
// if ($updateTime) {
// $updateTime = explode('~', $updateTime);
// $startTime = $updateTime[0];
// $endTime = $updateTime[1];
// }
$supplier
=
SupplierChannelModel
::
where
(
'supplier_code'
,
$supplierCode
)
->
first
();
if
(
empty
(
$supplier
))
{
$this
->
response
(
-
1
,
'供应商不存在'
);
}
if
(
!
checkPerm
(
'ViewAllSku'
))
{
$userId
=
$request
->
user
->
userId
;
$codeId
=
$request
->
user
->
codeId
;
$canViewSubordinate
=
checkPerm
(
'ViewSubordinateSku'
);
if
(
$canViewSubordinate
)
{
$departmentService
=
new
\App\Http\Services\DepartmentService
();
$subordinateUserIds
=
$departmentService
->
getSubordinateUserIds
(
$userId
);
$adminUserService
=
new
\App\Http\Services\AdminUserService
();
$subordinateCodeIds
=
$adminUserService
->
getCodeIdsByUserIds
(
$subordinateUserIds
)
->
toArray
();
$subordinateCodeIds
[]
=
$codeId
;
$isAuthorized
=
false
;
if
(
in_array
(
$supplier
->
purchase_uid
,
$subordinateCodeIds
))
{
$isAuthorized
=
true
;
}
if
(
!
empty
(
$supplier
->
channel_uid
))
{
$channelUids
=
explode
(
','
,
trim
(
$supplier
->
channel_uid
,
','
));
foreach
(
$channelUids
as
$channelUid
)
{
if
(
in_array
(
$channelUid
,
$subordinateCodeIds
))
{
$isAuthorized
=
true
;
break
;
}
}
}
if
(
!
$isAuthorized
)
{
$this
->
response
(
-
1
,
'无权限操作该供应商的SKU'
);
}
}
else
{
$isAuthorized
=
false
;
if
(
$supplier
->
purchase_uid
==
$codeId
)
{
$isAuthorized
=
true
;
}
if
(
!
empty
(
$supplier
->
channel_uid
))
{
$channelUids
=
explode
(
','
,
trim
(
$supplier
->
channel_uid
,
','
));
if
(
in_array
(
$codeId
,
$channelUids
))
{
$isAuthorized
=
true
;
}
}
if
(
!
$isAuthorized
)
{
$this
->
response
(
-
1
,
'无权限操作该供应商的SKU'
);
}
}
}
$uploadLogId
=
SkuUploadLogModel
::
where
(
'supplier_code'
,
$supplierCode
)
->
where
(
'status'
,
SkuUploadLogModel
::
STATUS_HANDLED
)
->
orderBy
(
'id'
,
'desc'
)
...
...
@@ -89,7 +132,6 @@ class SkuApiController extends Controller
'log_id'
=>
$uploadLogId
,
"down_type"
=>
1
,
];
//改成队列
(
new
SkuService
())
->
batchOffShelfSkuQueue
(
$data
);
$this
->
response
(
0
,
'批量下架任务已经发送,请等待任务完成,期间你可以刷新列表查看下架情况'
);
}
...
...
@@ -131,6 +173,59 @@ class SkuApiController extends Controller
'operate_type'
,
'cp_time'
,
]);
$supplierCodes
=
explode
(
','
,
$data
[
'supplier_codes'
]);
if
(
!
checkPerm
(
'ViewAllSku'
))
{
$userId
=
$request
->
user
->
userId
;
$codeId
=
$request
->
user
->
codeId
;
$canViewSubordinate
=
checkPerm
(
'ViewSubordinateSku'
);
if
(
$canViewSubordinate
)
{
$departmentService
=
new
\App\Http\Services\DepartmentService
();
$subordinateUserIds
=
$departmentService
->
getSubordinateUserIds
(
$userId
);
$adminUserService
=
new
\App\Http\Services\AdminUserService
();
$subordinateCodeIds
=
$adminUserService
->
getCodeIdsByUserIds
(
$subordinateUserIds
)
->
toArray
();
$subordinateCodeIds
[]
=
$codeId
;
$suppliers
=
SupplierChannelModel
::
whereIn
(
'supplier_code'
,
$supplierCodes
)
->
get
();
foreach
(
$suppliers
as
$supplier
)
{
$isAuthorized
=
false
;
if
(
in_array
(
$supplier
->
purchase_uid
,
$subordinateCodeIds
))
{
$isAuthorized
=
true
;
}
if
(
!
empty
(
$supplier
->
channel_uid
))
{
$channelUids
=
explode
(
','
,
trim
(
$supplier
->
channel_uid
,
','
));
foreach
(
$channelUids
as
$channelUid
)
{
if
(
in_array
(
$channelUid
,
$subordinateCodeIds
))
{
$isAuthorized
=
true
;
break
;
}
}
}
if
(
!
$isAuthorized
)
{
$this
->
response
(
-
1
,
'无权限操作供应商 '
.
$supplier
->
supplier_code
.
' 的SKU'
);
}
}
}
else
{
$suppliers
=
SupplierChannelModel
::
whereIn
(
'supplier_code'
,
$supplierCodes
)
->
get
();
foreach
(
$suppliers
as
$supplier
)
{
$isAuthorized
=
false
;
if
(
$supplier
->
purchase_uid
==
$codeId
)
{
$isAuthorized
=
true
;
}
if
(
!
empty
(
$supplier
->
channel_uid
))
{
$channelUids
=
explode
(
','
,
trim
(
$supplier
->
channel_uid
,
','
));
if
(
in_array
(
$codeId
,
$channelUids
))
{
$isAuthorized
=
true
;
}
}
if
(
!
$isAuthorized
)
{
$this
->
response
(
-
1
,
'无权限操作供应商 '
.
$supplier
->
supplier_code
.
' 的SKU'
);
}
}
}
}
if
(
$data
[
'operate_type'
]
==
SkuService
::
OPERATE_TYPE_PUTAWAY
)
{
if
(
$data
[
'is_long_term'
]
==
-
1
&&
empty
(
$data
[
'cp_time'
]))
{
$this
->
response
(
-
1
,
'请设置上架有效期'
);
...
...
app/Http/Controllers/Filter/SkuListFilter.php
View file @
cf8c9ea1
...
...
@@ -21,7 +21,6 @@ class SkuListFilter
$map
=
array_map
(
function
(
$item
)
{
return
trim
(
$item
);
},
$map
);
//dd($map);
//只获取专卖的数据
$map
[
'supplier_id'
]
=
17
;
if
((
!
empty
(
$map
[
'create_time'
])))
{
...
...
@@ -32,18 +31,38 @@ class SkuListFilter
unset
(
$map
[
'create_time'
]);
}
$userId
=
request
()
->
user
->
userId
;
$codeId
=
request
()
->
user
->
codeId
;
if
(
checkPerm
(
'ViewAllSku'
))
{
}
else
if
(
checkPerm
(
'ViewSubordinateSku'
))
{
//查看下级
$departmentService
=
new
DepartmentService
();
//下属用户id(结果包括自己的id)
$subordinateUserIds
=
$departmentService
->
getSubordinateUserIds
(
$userId
);
$adminUserService
=
new
AdminUserService
();
$subordinateCodeIds
=
$adminUserService
->
getCodeIdsByUserIds
(
$subordinateUserIds
);
$subordinateCodeIds
=
$subordinateCodeIds
->
toArray
();
$map
[
'encoded/eqs'
]
=
implode
(
','
,
$subordinateCodeIds
);
// $map['encoded/eqs'] = implode(',', $subordinateCodeIds);
$supplierCodes
=
SupplierChannelModel
::
where
(
function
(
$query
)
use
(
$subordinateCodeIds
)
{
$query
->
whereIn
(
'purchase_uid'
,
$subordinateCodeIds
)
->
orWhereRaw
(
"channel_uid REGEXP '"
.
implode
(
'|'
,
$subordinateCodeIds
)
.
"'"
);
})
->
whereNotNull
(
'supplier_code'
)
->
where
(
'supplier_code'
,
'!='
,
''
)
->
pluck
(
'supplier_code'
)
->
toArray
();
if
(
!
empty
(
$supplierCodes
))
{
$map
[
'canal_new/eqs'
]
=
implode
(
','
,
$supplierCodes
);
}
else
{
$map
[
'canal_new/eqs'
]
=
'NO_MATCH'
;
}
}
else
{
$map
[
'encoded/condition'
]
=
request
()
->
user
->
codeId
;
// $map['encoded/condition'] = $codeId;
$supplierCodes
=
SupplierChannelModel
::
where
(
function
(
$query
)
use
(
$codeId
)
{
$query
->
where
(
'purchase_uid'
,
$codeId
)
->
orWhere
(
'channel_uid'
,
'like'
,
'%'
.
$codeId
.
'%'
);
})
->
whereNotNull
(
'supplier_code'
)
->
where
(
'supplier_code'
,
'!='
,
''
)
->
pluck
(
'supplier_code'
)
->
toArray
();
if
(
!
empty
(
$supplierCodes
))
{
$map
[
'canal_new/eqs'
]
=
implode
(
','
,
$supplierCodes
);
}
else
{
$map
[
'canal_new/eqs'
]
=
'NO_MATCH'
;
}
}
if
((
!
empty
(
$map
[
'update_time'
])))
{
$times
=
explode
(
'~'
,
$map
[
'update_time'
]);
...
...
@@ -74,22 +93,6 @@ class SkuListFilter
unset
(
$map
[
'data_channel_uid'
]);
}
//根据数据维护员(purchase_uid)查询对应的供应商编码,多个一起请求
if
(
!
empty
(
$map
[
'purchase_uid'
]))
{
$supplierCodes
=
SupplierChannelModel
::
where
(
'purchase_uid'
,
$map
[
'purchase_uid'
])
->
whereNotNull
(
'supplier_code'
)
->
where
(
'supplier_code'
,
'!='
,
''
)
->
pluck
(
'supplier_code'
)
->
toArray
();
if
(
!
empty
(
$supplierCodes
))
{
$map
[
'canal_new/eqs'
]
=
implode
(
','
,
$supplierCodes
);
}
else
{
// 没有匹配的供应商,传一个不存在的值以确保查不到数据
$map
[
'canal_new/eqs'
]
=
'NO_MATCH'
;
}
unset
(
$map
[
'purchase_uid'
]);
}
if
(
!
empty
(
$map
[
'source_type'
]))
{
switch
(
$map
[
'source_type'
])
{
case
'all'
:
...
...
app/Http/Controllers/Filter/SupplierAccountFilter.php
View file @
cf8c9ea1
...
...
@@ -22,17 +22,16 @@ class SupplierAccountFilter
if
(
!
checkPerm
(
'ViewAllSupplierAccount'
))
{
if
(
checkPerm
(
'ViewSubSupplierAccount'
))
{
$departmentService
=
new
DepartmentService
();
//下属用户id(结果包括自己的id)
$subordinateUserIds
=
$departmentService
->
getSubordinateUserIds
(
$request
->
user
->
userId
);
$adminUserService
=
new
AdminUserService
();
$subordinateCodeIds
=
$adminUserService
->
getCodeIdsByUserIds
(
$subordinateUserIds
);
$subordinateCodeIds
=
$subordinateCodeIds
->
toArray
();
$likeSqlRaw
=
implode
(
'|'
,
$subordinateCodeIds
);
$supplierIds
=
SupplierChannelModel
::
whereRaw
(
DB
::
raw
(
"(channel_uid REGEXP '
$likeSqlRaw
')"
))
->
pluck
(
'supplier_id'
)
->
toArray
();
$inCodeIdSql
=
implode
(
','
,
$subordinateCodeIds
);
$supplierIds
=
SupplierChannelModel
::
whereRaw
(
DB
::
raw
(
"(channel_uid REGEXP '
$likeSqlRaw
' OR purchase_uid IN (
$inCodeIdSql
))"
))
->
pluck
(
'supplier_id'
)
->
toArray
();
$query
->
whereIn
(
'supplier_id'
,
$supplierIds
);
}
else
{
//否则只能查看自己的
$supplierIds
=
SupplierChannelModel
::
whereRaw
(
DB
::
raw
(
"(channel_uid REGEXP '
$codeId
')"
))
->
pluck
(
'supplier_id'
)
->
toArray
();
$supplierIds
=
SupplierChannelModel
::
whereRaw
(
DB
::
raw
(
"(channel_uid REGEXP '
$codeId
' OR purchase_uid = '
$codeId
')"
))
->
pluck
(
'supplier_id'
)
->
toArray
();
$query
->
whereIn
(
'supplier_id'
,
$supplierIds
);
}
}
...
...
app/Http/Controllers/SupplierController.php
View file @
cf8c9ea1
...
...
@@ -2,9 +2,9 @@
namespace
App\Http\Controllers
;
use
function
foo
\func
;
use
App\Model\LogModel
;
use
App\Model\NationModel
;
use
App\Model\RedisModel
;
use
Illuminate\Http\Request
;
use
App\Model\IntracodeModel
;
use
App\Http\Services\LogService
;
...
...
@@ -119,6 +119,12 @@ class SupplierController extends Controller
//获取创建人部门树
$this
->
data
[
'createUserDepartmentList'
]
=
(
new
DepartmentService
())
->
getCreateUserDepartmentListForXmSelect
();
//获取列显示设置
$redis
=
new
RedisModel
();
$hashKey
=
'col_settings:supplier_list'
;
$colSettings
=
$redis
->
hget
(
$hashKey
,
$request
->
user
->
userId
);
$this
->
data
[
'colSettings'
]
=
$colSettings
?
$colSettings
:
'{}'
;
return
$this
->
view
(
'供应商列表'
);
}
...
...
app/Http/Services/SkuService.php
View file @
cf8c9ea1
...
...
@@ -44,9 +44,7 @@ class SkuService extends BaseService
die
();
}
try
{
// $return = curl($url, $map, 1);
$url
=
base64_encode
(
$url
.
'?'
.
http_build_query
(
$map
));
$return
=
curl
(
config
(
'website.FootstoneCurlUrl'
)
.
$url
);
$return
=
curl
(
$url
,
$map
,
1
);
}
catch
(
\Exception
$e
)
{
return
$e
->
getMessage
();
}
...
...
app/Http/Services/SkuUploadLogService.php
View file @
cf8c9ea1
...
...
@@ -9,6 +9,7 @@ use App\Http\Transformers\SupplierTransformer;
use
App\Model\LogModel
;
use
App\Model\SkuUploadLogModel
;
use
App\Model\SupplierChannelModel
;
use
Illuminate\Support\Facades\DB
;
class
SkuUploadLogService
{
...
...
@@ -26,7 +27,6 @@ class SkuUploadLogService
return
$list
;
}
//获取上传次数
public
function
getSkuUploadLogCount
(
$supplierId
)
{
$supplierCode
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
value
(
'supplier_code'
);
...
...
app/Http/Services/SyncSupplierService.php
View file @
cf8c9ea1
...
...
@@ -463,6 +463,16 @@ class SyncSupplierService
}
}
}
if
(
!
empty
(
$supplier
[
'purchase_uid'
]))
{
$purchaseUids
=
explode
(
','
,
$supplier
[
'purchase_uid'
]);
$purchaseUserList
=
(
new
AdminUserService
())
->
getAdminUserListByCodeIds
(
$purchaseUids
);
foreach
(
$purchaseUserList
as
$purchaseUser
)
{
if
(
!
empty
(
$purchaseUser
[
'email'
]))
{
(
new
MessageService
())
->
sendMessage
(
'supplier_entity_notice_purchase'
,
$data
,
$purchaseUser
[
'email'
],
true
);
}
}
}
}
}
}
app/Http/routes.php
View file @
cf8c9ea1
...
...
@@ -85,6 +85,8 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Api'], function () {
Route
::
match
([
'get'
,
'post'
],
'/api/external/checkSupplierApply'
,
'ExternalApiController@checkSupplierApply'
);
Route
::
match
([
'get'
,
'post'
],
'/api/external/applySupplier'
,
'ExternalApiController@applySupplier'
);
Route
::
match
([
'get'
,
'post'
],
'/api/external/checkSupplierAccountExist'
,
'ExternalApiController@checkSupplierAccountExist'
);
Route
::
match
([
'get'
,
'post'
],
'/api/external/SaveColSettings'
,
'CommonApiController@SaveColSettings'
);
Route
::
match
([
'get'
,
'post'
],
'/api/external/GetColSettings'
,
'CommonApiController@GetColSettings'
);
});
//同步相关的接口
...
...
config/perm.php
View file @
cf8c9ea1
...
...
@@ -17,6 +17,8 @@ return [
'BatchUpdateSkuStatus'
,
'GetAuditFlow'
,
'ViewAccountLog'
,
'SaveColSettings'
,
'GetColSettings'
,
'TempTemp'
]
//不用验证权限的方法
],
...
...
resources/views/script/SupplierListScript.blade.php
View file @
cf8c9ea1
...
...
@@ -361,6 +361,24 @@
];
cols
.
push
(
);
// 列显示设置 - 从后端Redis hash渲染
let
colSettingsData
=
{
!!
$colSettings
!!
};
let
colSettingsUserId
=
'{{request()->user->userId}}'
;
let
colSettingsPageKey
=
'supplier_list'
;
function
applyColSettings
()
{
if
(
colSettingsData
&&
Object
.
keys
(
colSettingsData
).
length
>
0
)
{
for
(
let
i
=
0
;
i
<
cols
.
length
;
i
++
)
{
let
field
=
cols
[
i
].
field
;
if
(
field
&&
colSettingsData
[
field
]
!==
undefined
)
{
cols
[
i
].
hide
=
!
colSettingsData
[
field
];
}
}
}
}
applyColSettings
();
table
.
render
({
elem
:
'#list'
,
url
:
'/api/supplier/GetSupplierList'
...
...
@@ -449,6 +467,88 @@
admin
.
putTempData
(
"needFreshDetail_supplier_id="
+
supplierId
,
1
);
}
//列设置
$
(
"#col_setting"
).
click
(
function
()
{
let
html
=
'
<
div
style
=
"padding: 15px;"
>
';
html += '
<
div
style
=
"margin-bottom: 10px;"
>
';
html += '
<
button
type
=
"button"
class
=
"layui-btn layui-btn-xs layui-btn-info"
id
=
"col_select_all"
>
全选
<
/button>'
;
html
+=
'
<
button
type
=
"button"
class
=
"layui-btn layui-btn-xs layui-btn-danger"
id
=
"col_invert_select"
>
反选
<
/button>'
;
html
+=
'
<
/div>'
;
html
+=
'
<
div
style
=
"max-height: 600px; overflow-y: auto;"
>
';
html += '
<
form
class
=
"layui-form"
lay
-
filter
=
"colSettingForm"
>
'
;
for
(
let
i
=
0
;
i
<
cols
.
length
;
i
++
)
{
if
(
cols
[
i
].
type
===
'checkbox'
)
continue
;
let
field
=
cols
[
i
].
field
;
let
title
=
cols
[
i
].
title
||
''
;
let
checked
=
cols
[
i
].
hide
?
''
:
'checked'
;
html
+=
'
<
div
class
=
"layui-form-item"
style
=
"display:inline-block;width:33%;margin-bottom:5px;"
>
';
html += '
<
input
type
=
"checkbox"
name
=
"' + field + '"
lay
-
skin
=
"primary"
title
=
"' + title + '"
' + checked + '
>
';
html += '
<
/div>'
;
}
html
+=
'
<
/form></
div
><
/div>'
;
layer
.
open
({
type
:
1
,
title
:
'显示列设置'
,
area
:
[
'600px'
,
'600px'
],
content
:
html
,
btn
:
[
'确定'
,
'取消'
],
success
:
function
(
layero
,
index
)
{
form
.
render
(
'checkbox'
,
'colSettingForm'
);
//全选
layero
.
find
(
'#col_select_all'
).
on
(
'click'
,
function
()
{
layero
.
find
(
'input[type="checkbox"]'
).
prop
(
'checked'
,
true
);
form
.
render
(
'checkbox'
,
'colSettingForm'
);
});
//反选
layero
.
find
(
'#col_invert_select'
).
on
(
'click'
,
function
()
{
layero
.
find
(
'input[type="checkbox"]'
).
each
(
function
()
{
$
(
this
).
prop
(
'checked'
,
!
$
(
this
).
is
(
':checked'
));
});
form
.
render
(
'checkbox'
,
'colSettingForm'
);
});
},
yes
:
function
(
index
,
layero
)
{
let
settings
=
{};
let
checkboxes
=
layero
.
find
(
'input[type="checkbox"]'
);
checkboxes
.
each
(
function
()
{
let
name
=
$
(
this
).
attr
(
'name'
);
let
checked
=
$
(
this
).
is
(
':checked'
);
settings
[
name
]
=
checked
;
});
//保存到后端Redis
$
.
ajax
({
url
:
'/api/external/SaveColSettings'
,
type
:
'post'
,
data
:
{
user_id
:
colSettingsUserId
,
page_key
:
colSettingsPageKey
,
settings
:
JSON
.
stringify
(
settings
)
},
dataType
:
'json'
,
async
:
false
});
colSettingsData
=
settings
;
for
(
let
i
=
0
;
i
<
cols
.
length
;
i
++
)
{
let
field
=
cols
[
i
].
field
;
if
(
field
&&
settings
[
field
]
!==
undefined
)
{
cols
[
i
].
hide
=
!
settings
[
field
];
}
}
table
.
reload
(
'list'
,
{
cols
:
[
cols
],
page
:
{
curr
:
currentPage
},
where
:
whereCondition
});
layer
.
close
(
index
);
}
});
});
//新增供应商弹窗
$
(
"#add_supplier"
).
click
(
function
()
{
index
.
openTab
({
...
...
resources/views/web/SupplierList.blade.php
View file @
cf8c9ea1
...
...
@@ -82,6 +82,10 @@
@if(checkPerm('ConfirmCrmSupplier') && checkPerm('ViewConfirmSupplier'))
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
confirm_crm_supplier
">确认客户转化供应商</button>
@endif
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
layui
-
btn
-
normal
" id="
col_setting
">展示列设置</button>
@if(checkPerm('ConfirmCrmSupplier') && checkPerm('ViewConfirmSupplier'))
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
confirm_crm_supplier
">确认客户转化供应商</button>
@endif
</div>
<button type="
button
" id="
refreshWindow
" style="
display
:
none
">刷新页面</button>
<table class="
layui
-
table
" id="
list
" lay-filter="
list
"></table>
...
...
storage/framework/views/5238497145456f693cc29f1fe0a7ff8fb43fd269.php
View file @
cf8c9ea1
...
...
@@ -82,6 +82,7 @@
<?php
if
(
checkPerm
(
'ConfirmCrmSupplier'
)
&&
checkPerm
(
'ViewConfirmSupplier'
))
:
?>
<button
type=
"button"
class=
"layui-btn layui-btn-sm"
id=
"confirm_crm_supplier"
>
确认客户转化供应商
</button>
<?php
endif
;
?>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-normal"
id=
"col_setting"
>
展示列设置
</button>
</div>
<button
type=
"button"
id=
"refreshWindow"
style=
"display: none"
>
刷新页面
</button>
<table
class=
"layui-table"
id=
"list"
lay-filter=
"list"
></table>
...
...
storage/framework/views/d4d13e9bcdea7366e4952031431aae4b22f055c1.php
View file @
cf8c9ea1
...
...
@@ -361,6 +361,24 @@
];
cols
.
push
(
);
// 列显示设置 - 从后端Redis hash渲染
let
colSettingsData
=
<?php
echo
$colSettings
;
?>
;
let
colSettingsUserId
=
'
<?php
echo
e
(
request
()
->
user
->
userId
);
?>
';
let colSettingsPageKey = '
supplier_list
'
;
function
applyColSettings
()
{
if
(
colSettingsData
&&
Object
.
keys
(
colSettingsData
).
length
>
0
)
{
for
(
let
i
=
0
;
i
<
cols
.
length
;
i
++
)
{
let
field
=
cols
[
i
].
field
;
if
(
field
&&
colSettingsData
[
field
]
!==
undefined
)
{
cols
[
i
].
hide
=
!
colSettingsData
[
field
];
}
}
}
}
applyColSettings
();
table
.
render
({
elem
:
'#list'
,
url
:
'/api/supplier/GetSupplierList'
...
...
@@ -449,6 +467,88 @@
admin
.
putTempData
(
"needFreshDetail_supplier_id="
+
supplierId
,
1
);
}
//列设置
$
(
"#col_setting"
).
click
(
function
()
{
let
html
=
'
<
div
style
=
"padding: 15px;"
>
';
html += '
<
div
style
=
"margin-bottom: 10px;"
>
';
html += '
<
button
type
=
"button"
class
=
"layui-btn layui-btn-xs layui-btn-info"
id
=
"col_select_all"
>
全选
<
/button>'
;
html
+=
'
<
button
type
=
"button"
class
=
"layui-btn layui-btn-xs layui-btn-danger"
id
=
"col_invert_select"
>
反选
<
/button>'
;
html
+=
'
<
/div>'
;
html
+=
'
<
div
style
=
"max-height: 600px; overflow-y: auto;"
>
';
html += '
<
form
class
=
"layui-form"
lay
-
filter
=
"colSettingForm"
>
'
;
for
(
let
i
=
0
;
i
<
cols
.
length
;
i
++
)
{
if
(
cols
[
i
].
type
===
'checkbox'
)
continue
;
let
field
=
cols
[
i
].
field
;
let
title
=
cols
[
i
].
title
||
''
;
let
checked
=
cols
[
i
].
hide
?
''
:
'checked'
;
html
+=
'
<
div
class
=
"layui-form-item"
style
=
"display:inline-block;width:33%;margin-bottom:5px;"
>
';
html += '
<
input
type
=
"checkbox"
name
=
"' + field + '"
lay
-
skin
=
"primary"
title
=
"' + title + '"
' + checked + '
>
';
html += '
<
/div>'
;
}
html
+=
'
<
/form></
div
><
/div>'
;
layer
.
open
({
type
:
1
,
title
:
'显示列设置'
,
area
:
[
'600px'
,
'600px'
],
content
:
html
,
btn
:
[
'确定'
,
'取消'
],
success
:
function
(
layero
,
index
)
{
form
.
render
(
'checkbox'
,
'colSettingForm'
);
//全选
layero
.
find
(
'#col_select_all'
).
on
(
'click'
,
function
()
{
layero
.
find
(
'input[type="checkbox"]'
).
prop
(
'checked'
,
true
);
form
.
render
(
'checkbox'
,
'colSettingForm'
);
});
//反选
layero
.
find
(
'#col_invert_select'
).
on
(
'click'
,
function
()
{
layero
.
find
(
'input[type="checkbox"]'
).
each
(
function
()
{
$
(
this
).
prop
(
'checked'
,
!
$
(
this
).
is
(
':checked'
));
});
form
.
render
(
'checkbox'
,
'colSettingForm'
);
});
},
yes
:
function
(
index
,
layero
)
{
let
settings
=
{};
let
checkboxes
=
layero
.
find
(
'input[type="checkbox"]'
);
checkboxes
.
each
(
function
()
{
let
name
=
$
(
this
).
attr
(
'name'
);
let
checked
=
$
(
this
).
is
(
':checked'
);
settings
[
name
]
=
checked
;
});
//保存到后端Redis
$
.
ajax
({
url
:
'/api/external/SaveColSettings'
,
type
:
'post'
,
data
:
{
user_id
:
colSettingsUserId
,
page_key
:
colSettingsPageKey
,
settings
:
JSON
.
stringify
(
settings
)
},
dataType
:
'json'
,
async
:
false
});
colSettingsData
=
settings
;
for
(
let
i
=
0
;
i
<
cols
.
length
;
i
++
)
{
let
field
=
cols
[
i
].
field
;
if
(
field
&&
settings
[
field
]
!==
undefined
)
{
cols
[
i
].
hide
=
!
settings
[
field
];
}
}
table
.
reload
(
'list'
,
{
cols
:
[
cols
],
page
:
{
curr
:
currentPage
},
where
:
whereCondition
});
layer
.
close
(
index
);
}
});
});
//新增供应商弹窗
$
(
"#add_supplier"
).
click
(
function
()
{
index
.
openTab
({
...
...
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