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
175ec29f
authored
Jul 26, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
文件上传
parent
105b40a5
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
26 deletions
app/Http/Controllers/SupplierController.php
app/Http/Services/SupplierAuditService.php
app/Http/Services/SupplierService.php
resources/views/script/supplier/SupplierFileScript.blade.php
resources/views/web/SupplierDetail.blade.php
resources/views/web/UpdateSupplier.blade.php
resources/views/web/supplier/SupplierFile.blade.php
app/Http/Controllers/SupplierController.php
View file @
175ec29f
...
...
@@ -95,6 +95,9 @@ class SupplierController extends Controller
]);
$this
->
data
[
'province_city'
]
=
implode
(
' | '
,
$regionNames
);
$this
->
data
[
'address'
]
=
$supplierService
->
getAddress
(
$supplierId
);
$supplierAttachmentService
=
new
SupplierAttachmentService
();
$this
->
data
[
'attachment'
]
=
$supplierAttachmentService
->
getAttachment
(
$supplierId
);
// dd($supplierAttachmentService->getAttachment($supplierId));
return
$this
->
view
(
'供应商详情'
);
}
...
...
app/Http/Services/SupplierAuditService.php
View file @
175ec29f
...
...
@@ -5,6 +5,7 @@ namespace App\Http\Services;
use
App\Model\LogModel
;
use
App\Model\RedisModel
;
use
App\Model\SupplierAttachmentModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
...
...
@@ -169,7 +170,7 @@ class SupplierAuditService
}
//判断是否要进入审核中状态,因为部分字段修改是不需要走审核的
public
function
checkNeedAudit
(
$supplierId
,
$channel
)
public
function
checkNeedAudit
(
$supplierId
,
$channel
,
$attachment
)
{
$notNeedAuditField
=
[
'register_company_name'
,
...
...
@@ -188,6 +189,15 @@ class SupplierAuditService
return
true
;
}
$attachmentModel
=
new
SupplierAttachmentModel
();
//判断附件有没有变化,有变化也要进入审核
$oldAttachment
=
$attachmentModel
->
select
(
array_keys
(
config
(
'fixed.FileNameMapping'
)))
->
where
(
'supplier_id'
,
$supplierId
)
->
first
();
$oldAttachment
=
!
empty
(
$oldAttachment
)
?
$oldAttachment
->
toArray
()
:
[];
$newAttachment
=
$attachment
;
if
(
$oldAttachment
!=
$newAttachment
)
{
return
true
;
}
$supplier
=
$model
->
select
(
$selectField
)
->
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
$changeField
=
[];
foreach
(
$supplier
as
$key
=>
$value
)
{
...
...
app/Http/Services/SupplierService.php
View file @
175ec29f
...
...
@@ -123,7 +123,7 @@ class SupplierService
$supplierId
=
$this
->
newSupplierId
=
$channel
[
'supplier_id'
];
//要做进一步判断,部分字段修改不需要审核
$auditService
=
new
SupplierAuditService
();
$needAudit
=
$auditService
->
checkNeedAudit
(
$supplierId
,
$channel
);
$needAudit
=
$auditService
->
checkNeedAudit
(
$supplierId
,
$channel
,
$attachment
);
if
(
$needAudit
)
{
$channel
[
'status'
]
=
SupplierChannelModel
::
STATUS_IN_REVIEW
;
}
...
...
resources/views/script/supplier/SupplierFileScript.blade.php
View file @
175ec29f
...
...
@@ -39,17 +39,19 @@
},
choose
:
function
(
obj
)
{
var
files
=
this
.
files
=
obj
.
pushFile
();
let
files
=
this
.
files
=
obj
.
pushFile
();
let
recentFile
=
files
[
Object
.
keys
(
files
)[
Object
.
keys
(
files
)
.
length
-
1
]]
fileName
=
recentFile
.
name
;
loadIndex
=
layer
.
load
(
1
);
},
done
:
function
(
res
,
index
,
upload
)
{
fileName
=
this
.
files
[
index
]
.
name
;
if
(
res
.
code
===
200
)
{
//动态添加js
let
fileTemplateObj
=
$
(
'#file_template'
)
fileTemplateObj
.
find
(
'a'
)
.
attr
(
'href'
,
res
.
data
[
0
]);
fileTemplateObj
.
find
(
'a'
)
.
text
(
fileName
);
fileTemplateObj
.
find
(
'a'
)
.
attr
(
'value'
,
fileName
);
let
fileTemplate
=
fileTemplateObj
.
html
();
$
(
'#'
+
fileType
+
'_div'
)
.
show
();
$
(
'#'
+
fileType
+
'_file_div'
)
.
append
(
fileTemplate
);
...
...
@@ -64,10 +66,13 @@
//删除文件操作
$
(
document
)
.
on
(
'click'
,
'.delete_file'
,
function
()
{
// layer.confirm('确定要删除该文件吗?', function (index) {
let
fileType
=
$
(
this
)
.
parent
()
.
parent
()
.
parent
()
.
find
(
'input'
)
.
attr
(
'id'
);
//找出对应的div删除
$
(
this
)
.
parent
()
.
remove
();
setFileTypeValue
(
fileType
)
// return false;
// });
});
//遍历找出文件list复制到表单域
...
...
@@ -77,7 +82,7 @@
let
fileValueArr
=
[];
fileTypeDiv
.
find
(
'a'
)
.
each
(
function
()
{
let
url
=
$
(
this
)
.
attr
(
'href'
);
let
fileName
=
$
(
this
)
.
text
(
);
let
fileName
=
$
(
this
)
.
attr
(
'value'
);
let
fileValueMap
=
{
file_name
:
fileName
,
url
:
url
,
...
...
@@ -85,7 +90,16 @@
}
fileValueArr
.
push
(
fileValueMap
)
})
if
(
fileValueArr
.
length
===
0
)
{
fileTypeObj
.
val
(
''
);
}
else
{
fileTypeObj
.
val
(
JSON
.
stringify
(
fileValueArr
));
}
//判断是否没有子元素了,没有的话直接隐藏父元素
// let fileListSize = $('#fileType').find('a').size();
// if (fileListSize === 0) {
// fileTypeDiv.hide();
// }
}
});
</
script
>
\ No newline at end of file
resources/views/web/SupplierDetail.blade.php
View file @
175ec29f
...
...
@@ -148,15 +148,20 @@
</div>
</div>
<div
class=
"layui-row"
style=
"width: 700px"
>
{{-- @foreach($supplier['qualification_photos'] as $name=>$file)--}}
{{-- @if(!empty($file['url']))--}}
{{--
<div
class=
"layui-col-md6"
>
--}}
{{-- {{array_get(config('fixed.FileNameMapping'),$name)}} :
<a--
}}
{{
--
style=
"color: dodgerblue"
href=
"{{$file['url']}}"
target=
"_blank"
>
--}}
{{-- {{$file['file_name']}}
</a>
--}}
{{--
</div>
--}}
{{-- @endif--}}
{{-- @endforeach--}}
@if (!empty($attachment))
@foreach($attachment as $key=>$item)
@if(in_array($key,array_keys(config('fixed.FileNameMapping'))))
@if (!empty($item))
<div
class=
"layui-col-md12"
>
{{array_get(config('fixed.FileNameMapping'),$key)}} :
@foreach($item as $k=>$v)
<a
href=
"{{$v['url']}}"
style=
"color: dodgerblue"
target=
"_blank"
>
{{$v['file_name']}}
</a>
|
@endforeach
</div>
@endif
@endif
@endforeach
@endif
</div>
<hr/>
<blockquote
class=
"layui-elem-quote layui-text"
>
...
...
resources/views/web/UpdateSupplier.blade.php
View file @
175ec29f
...
...
@@ -23,14 +23,6 @@
width
:
100%
;
z-index
:
10
;
}
/*.layui-form-label {*/
/* width: 150px;*/
/*}*/
/*.layui-input-block {*/
/* margin-left: 180px;*/
/*}*/
</style>
<div
class=
"layui-card"
>
<form
class=
"layui-form"
action=
""
>
...
...
resources/views/web/supplier/SupplierFile.blade.php
View file @
175ec29f
<div
class=
"layui-form-item"
>
<div
class=
"layui-row"
>
<div
class=
"
layui-col-md2
"
>
<div
class=
"
@if (empty($supplier['supplier_id']))layui-col-md4 @else layui-col-md2 @endif
"
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
附件上传
</label>
<div
class=
"layui-input-block block-12"
style=
"width: 155px"
id=
"file_type_selector"
>
<select
lay-verify=
""
lay-filter=
"file_type_selector"
>
...
...
@@ -11,7 +11,10 @@
</select>
</div>
</div>
<div
class=
"layui-col-md10"
>
@if (empty($supplier['supplier_id']))
@endif
<div
@
if
(
empty
($
supplier
['
supplier_id
']))
class=
"layui-col-md8"
style=
"margin-left: -30px;"
@
else
class=
"layui-col-md10"
style=
"padding-left: 10px;"
@
endif
>
<button
type=
"button"
class=
"layui-btn layui-btn-primary layui-btn-sm layui-btn-disabled"
id=
"disable_upload_button"
>
请选择附件类型再上传
</button>
...
...
@@ -21,14 +24,15 @@
<input
type=
"hidden"
class=
"upload_obj"
value=
""
>
</div>
<div
class=
"layui-col-md12"
style=
"padding-left: 35px;margin-top: 20px"
>
<blockquote
class=
"layui-elem-quote layui-quote-nm"
>
<blockquote
class=
"layui-elem-quote layui-quote-nm"
style=
"padding-bottom: 5px"
>
<div
id=
"file_list"
class=
"layui-row"
>
@foreach(config('fixed.FileNameMapping') as $name=>$cnName)
@if (!empty($attachment[$name]))
<div
id=
"{{$name}}_div"
>
<input
type=
"hidden"
name=
"{{$name}}"
id=
"{{$name}}"
value=
"{{json_encode($attachment[$name])}}"
>
<input
type=
"hidden"
name=
"{{$name}}"
id=
"{{$name}}"
value=
"{{json_encode($attachment[$name])}}"
>
<span>
{{$cnName}} :
</span>
<div
id=
"{{$name}}_file_div"
>
</div>
<div
id=
"{{$name}}_file_div"
>
@foreach($attachment[$name] as $k=>$item)
<span
class=
"single_file_div"
>
<a
href=
"{{$item['url']}}"
target=
"_blank"
>
...
...
@@ -38,6 +42,7 @@
style=
"font-size: 15px !important; color: red;cursor: pointer;margin-left: 3px;"
>
X
</i>
</span>
@endforeach
</div>
<hr>
</div>
@else
...
...
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