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
c896bae0
authored
Sep 14, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
供应商入驻字段
parent
8239706f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
163 deletions
app/Http/Controllers/Api/ChainApiController.php
app/Http/Services/SupplierStatisticsService.php
app/Http/Transformers/ChainTransformer.php
config/field.php
resources/views/script/ChainListScript.blade.php
resources/views/web/ChainList.blade.php
app/Http/Controllers/Api/ChainApiController.php
View file @
c896bae0
...
...
@@ -8,6 +8,7 @@ use App\Http\Services\ChainService;
use
App\Http\Services\SupplierExaminationService
;
use
App\Http\Transformers\SupplierLogTransformer
;
use
App\Http\Validators\SupplierExaminationValidator
;
use
App\Model\ChainModel
;
use
App\Model\LogModel
;
use
App\Model\SupplierAccountModel
;
use
App\Model\SupplierApplyModel
;
...
...
@@ -30,4 +31,12 @@ class ChainApiController extends Controller
$list
=
$service
->
getChainList
(
$request
->
all
());
$this
->
response
(
0
,
'ok'
,
$list
[
'data'
],
$list
[
'total'
]);
}
//获取芯链账号
public
function
GetChain
(
$request
)
{
$chainId
=
$request
->
input
(
'chain_id'
);
$chain
=
ChainModel
::
where
(
'chain_id'
,
$chainId
)
->
first
()
->
toArray
();
$this
->
response
(
0
,
'ok'
,
$chain
);
}
}
app/Http/Services/SupplierStatisticsService.php
View file @
c896bae0
...
...
@@ -115,7 +115,7 @@ class SupplierStatisticsService
return
$value
;
},
$result
);
$redis
->
set
(
$statisticsKey
,
json_encode
(
$result
));
$redis
->
expire
(
$statisticsKey
,
60
0
);
$redis
->
expire
(
$statisticsKey
,
60
);
return
$result
;
}
...
...
app/Http/Transformers/ChainTransformer.php
View file @
c896bae0
...
...
@@ -17,10 +17,26 @@ class ChainTransformer
$item
[
'create_time'
]
=
$item
[
'create_time'
]
?
date
(
'Y-m-d H:i:s'
,
$item
[
'create_time'
])
:
''
;
$item
[
'supplier_type_name'
]
=
array_get
(
config
(
'field.ChainSupplierType'
),
$item
[
'supplier_type'
],
'无'
);
$item
[
'data_type_name'
]
=
array_get
(
config
(
'field.ChainDataType'
),
$item
[
'data_type'
],
'无'
);
$item
[
'company_nature'
]
=
array_get
(
config
(
'field.ChainCompanyNature'
),
$item
[
'company_nature'
],
'无'
);
$item
[
'region'
]
=
array_get
(
config
(
'field.ChainRegion'
),
$item
[
'region'
],
'无'
);
if
(
!
empty
(
$item
[
'mobile'
]))
{
$item
[
'mobile'
]
=
substr
(
$item
[
'mobile'
],
0
,
3
)
.
'****'
.
substr
(
$item
[
'mobile'
],
7
);
}
if
(
!
empty
(
$item
[
'email'
]))
{
$emailTemp
=
explode
(
'@'
,
$item
[
'email'
])[
0
];
$replace
=
str_pad
(
'*'
,
strlen
(
$emailTemp
),
'*'
);
$emailTemp
=
str_replace
(
$emailTemp
,
$replace
,
$emailTemp
);
if
(
count
(
explode
(
'@'
,
$item
[
'email'
]))
>
1
)
{
$item
[
'email'
]
=
$emailTemp
.
'@'
.
explode
(
'@'
,
$item
[
'email'
])[
1
];
}
else
{
$item
[
'email'
]
=
$emailTemp
;
}
}
}
unset
(
$item
);
return
$list
;
}
}
\ No newline at end of file
}
config/field.php
View file @
c896bae0
...
...
@@ -290,4 +290,19 @@ return [
2
=>
'联营供应商'
,
3
=>
'国产推荐'
],
'ChainCompanyNature'
=>
[
7
=>
'原厂'
,
1
=>
'代理商'
,
2
=>
'现货商'
,
3
=>
'其它'
,
],
'ChainRegion'
=>
[
1
=>
'欧美'
,
2
=>
'大陆'
,
3
=>
'日韩'
,
4
=>
'港台'
,
5
=>
'其它'
,
]
];
resources/views/script/ChainListScript.blade.php
View file @
c896bae0
...
...
@@ -11,62 +11,41 @@
let
whereCondition
=
initCondition
;
let
type
=
'all'
;
$
(
document
).
on
(
"click"
,
".layui-table-body table.layui-table tbody tr"
,
function
()
{
let
index
=
$
(
this
).
attr
(
'data-index'
);
let
tableBox
=
$
(
this
).
parents
(
'.layui-table-box'
);
let
tableDiv
=
null
;
if
(
tableBox
.
find
(
".layui-table-fixed.layui-table-fixed-l"
).
length
>
0
)
{
tableDiv
=
tableBox
.
find
(
".layui-table-fixed.layui-table-fixed-l"
);
}
else
{
tableDiv
=
tableBox
.
find
(
".layui-table-body.layui-table-main"
);
}
let
checkCell
=
tableDiv
.
find
(
"tr[data-index="
+
index
+
"]"
).
find
(
"td div.laytable-cell-checkbox div.layui-form-checkbox I"
);
if
(
checkCell
.
length
>
0
)
{
checkCell
.
click
();
}
});
$
(
document
).
on
(
"click"
,
"td div.laytable-cell-checkbox div.layui-form-checkbox"
,
function
(
e
)
{
e
.
stopPropagation
();
});
//监听复选框事件,被选中的行高亮显示
table
.
on
(
'checkbox(chainList)'
,
function
(
obj
)
{
//拉黑就不用变色了
if
(
obj
.
data
.
status
===
-
3
)
{
return
}
if
(
obj
.
checked
===
true
&&
obj
.
type
===
'all'
)
{
//点击全选,拉黑的不用选上
$
(
'.layui-table-body table.layui-table tbody tr:not(.block-class)'
).
addClass
(
'layui-table-click'
);
$
(
'.layui-table-body table.layui-table tbody'
).
find
(
'.block-class'
).
find
(
'.layui-form-checkbox'
).
remove
();
$
(
'.layui-table-body table.layui-table tbody tr .block-class'
).
addClass
(
'layui-table-click'
);
}
else
if
(
obj
.
checked
===
false
&&
obj
.
type
===
'all'
)
{
//点击全不选
$
(
'.layui-table-body table.layui-table tbody tr'
).
removeClass
(
'layui-table-click'
);
}
else
if
(
obj
.
checked
===
true
&&
obj
.
type
===
'one'
)
{
//点击单行
if
(
obj
.
checked
===
true
)
{
obj
.
tr
.
addClass
(
'layui-table-click'
);
}
else
{
obj
.
tr
.
removeClass
(
'layui-table-click'
);
}
}
else
if
(
obj
.
checked
===
false
&&
obj
.
type
===
'one'
)
{
//点击全选之后点击单行
if
(
obj
.
tr
.
hasClass
(
'layui-table-click'
))
{
obj
.
tr
.
removeClass
(
'layui-table-click'
);
}
}
});
let
cols
=
[
{
field
:
'chain_id'
,
title
:
'序号'
,
align
:
'center'
,
width
:
80
},
{
field
:
'com_name'
,
title
:
'公司名称'
,
align
:
'center'
,
width
:
250
},
{
field
:
'company_nature'
,
title
:
'公司性质'
,
align
:
'center'
,
width
:
100
},
{
field
:
'region'
,
title
:
'所在区域'
,
align
:
'center'
,
width
:
100
},
{
field
:
'link_name'
,
title
:
'联系人'
,
align
:
'center'
,
width
:
170
},
{
field
:
'
mobile'
,
title
:
'联系方式'
,
align
:
'center'
,
width
:
16
0
},
{
field
:
'
position'
,
title
:
'职位'
,
align
:
'center'
,
width
:
10
0
},
{
field
:
'main_brand'
,
title
:
'主营产品'
,
align
:
'center'
field
:
'mobile'
,
title
:
'联系方式'
,
align
:
'center'
,
width
:
160
,
templet
:
function
(
data
)
{
let
text
=
'查看'
;
return
'
<
span
>
' + data.mobile + '
<
/span><span style="color: dodgerblue;margin-left: 10px" class="viewChain" type="mobile" id="' + data.chain_id + '">' + text + '</
span
>
';
}
},
{
field: '
email
', title: '
邮箱
', align: '
center
', width: 150,
templet: function (data) {
if (data.email) {
let text = '
查看
';
return '
<
span
>
' + data.email + '
<
/span><span style="color: dodgerblue;margin-left: 10px" class="viewChain" type="email" id="' + data.chain_id + '">' + text + '</
span
>
';
}
return '';
}
},
{
field: '
main_product_type
', title: '
主营产品
', align: '
center
'
},
{
field: '
main_brand
', title: '
主营品牌
', align: '
center
'
},
{field: '
supplier_type_name
', title: '
入驻类型
', align: '
center
', width: 100},
{field: '
data_type_name
', title: '
来源
', align: '
center
', width: 100},
...
...
@@ -99,92 +78,6 @@
});
$
(
"#add_supplier_examination"
).
click
(
function
()
{
layer
.
open
({
type
:
2
,
content
:
'/supplier_examination/AddChain?view=iframe&supplier_id='
+
getQueryVariable
(
'supplier_id'
),
area
:
[
'80%'
,
'90%'
],
title
:
'添加IQC检测记录'
,
end
:
function
()
{
table
.
reload
(
'chainList'
);
}
});
return
false
;
});
$
(
"#update_supplier_examination"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'chainList'
);
let
data
=
checkStatus
.
data
;
if
(
data
.
length
>
1
)
{
layer
.
msg
(
'该操作不支持多选'
,
{
icon
:
5
});
return
;
}
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的记录'
,
{
icon
:
5
});
}
else
{
let
id
=
data
[
0
].
id
;
layer
.
open
({
type
:
2
,
content
:
'/supplier_examination/UpdateChain?view=iframe&id='
+
id
+
'&supplier_id='
+
getQueryVariable
(
'supplier_id'
),
area
:
[
'80%'
,
'90%'
],
title
:
'添加IQC检测记录'
,
end
:
function
()
{
table
.
reload
(
'chainList'
);
}
});
}
return
false
;
});
$
(
"#batch_update_supplier_examination"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'chainList'
);
let
data
=
checkStatus
.
data
;
let
ids
=
[];
$
.
each
(
data
,
function
(
i
,
v
)
{
ids
.
push
(
v
.
id
);
});
if
(
!
ids
)
{
layer
.
msg
(
'请先选择要操作的记录'
,
{
icon
:
5
});
}
else
{
ids
=
ids
.
join
(
','
)
layer
.
open
({
type
:
2
,
content
:
'/supplier_examination/BatchUpdateChain?view=iframe&ids='
+
ids
+
'&supplier_id='
+
getQueryVariable
(
'supplier_id'
),
area
:
[
'80%'
,
'90%'
],
title
:
'批量修改IQC检测记录'
,
end
:
function
()
{
table
.
reload
(
'chainList'
);
}
});
}
return
false
;
});
//启用
$
(
"#delete_supplier_examination"
).
click
(
function
()
{
let
checkStatus
=
table
.
checkStatus
(
'chainList'
);
let
data
=
checkStatus
.
data
;
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的检测数据'
,
{
icon
:
5
})
}
else
{
layer
.
confirm
(
'是否删除所选记录?'
,
function
(
index
)
{
let
ids
=
[];
$
.
each
(
data
,
function
(
index
,
value
)
{
ids
.
push
(
value
.
id
);
});
ids
=
ids
.
join
(
','
);
let
res
=
ajax
(
'/api/supplier_examination/DeleteChains'
,
{
ids
:
ids
})
if
(
res
.
err_code
===
0
)
{
table
.
reload
(
'chainList'
);
layer
.
closeAll
();
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
})
}
else
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
})
}
});
}
});
form.on('
submit
(
load
)
', function (data) {
whereCondition = $.extend(false, initCondition, data.field);
//执行重载
...
...
@@ -203,35 +96,43 @@
});
//执行实例
var
uploadInst
=
upload
.
render
({
elem
:
'#import_supplier_examination'
,
//绑定元素
url
:
'/api/supplier_examination/ImportChain'
,
//上传接口
auto
:
true
,
exts
:
'xlsx'
,
before
:
function
(
obj
)
{
//obj参数包含的信息,跟 choose回调完全一致,可参见上文。
layer
.
msg
(
'上传中'
,
{
icon
:
16
});
//上传loading
},
done
:
function
(
res
)
{
if
(
!
res
)
{
return
layui
.
msg
(
'上传失败'
,
{
icon
:
5
});
$(document).on('
click
', '
.
viewChain
', function (e) {
if ($(this).text() === '
隐藏
') {
$(this).prev().text($(this).attr('
prev_text
'));
$(this).text('
查看
');
} else {
let chainId = $(this).attr('
id
');
let type = $(this).attr('
type
');
let resp = ajax('
/
api
/
chain
/
GetChain
', {chain_id: chainId, type: type});
if (!resp) {
layer.msg('
网络连接失败
', {'
icon
': 5});
return false;
}
if
(
res
.
err_code
===
0
)
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
table
.
reload
(
'chainList'
);
}
else
{
let
errMsg
=
res
.
err_msg
;
let
msg
=
''
;
$
.
each
(
errMsg
.
split
(
'&'
),
function
(
index
,
value
)
{
msg
+=
"
<
span
>
" + value + "
<
/span><br>
"
let prevText = $(this).prev().text();
$(this).attr('
prev_text
', prevText);
if (resp.err_code === 0) {
switch (type) {
case '
mobile
':
$(this).prev().text(resp.data.mobile);
break;
case '
email
':
$(this).prev().text(resp.data.email);
break;
}
$.get(getLogDomain() + "/api/addSensitiveClick", {
uid: getCookie("oa_user_id") || 0,
sys_id: 4,
mask_type: type || 0,
origin_id: chainId || 0,
source_from: window.location.href
});
layer
.
msg
(
msg
,
{
icon
:
5
,
time
:
5000
})
$(this).text('
隐藏
');
} else {
layer.msg(resp.err_msg, {'
icon
'
:
5
});
return
false
;
}
},
error
:
function
()
{
return
layer
.
msg
(
'上传失败'
,
{
icon
:
5
});
}
});
});
</script>
\ No newline at end of file
</script>
resources/views/web/ChainList.blade.php
View file @
c896bae0
...
...
@@ -54,4 +54,3 @@
</div>
<table
class=
"layui-table"
id=
"chainList"
lay-filter=
"chainList"
></table>
</div>
@include('script.ChainListScript')
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