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
dffbb8ea
authored
Jul 01, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
附件bug,我操
parent
6a8a14a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
33 deletions
app/Http/Services/SupplierAttachmentService.php
resources/views/script/AddSupplierScript.blade.php
app/Http/Services/SupplierAttachmentService.php
View file @
dffbb8ea
...
...
@@ -61,9 +61,9 @@ class SupplierAttachmentService
$attachments
=
[];
foreach
(
$attachmentData
[
'file_name'
]
as
$key
=>
$value
)
{
//最后一个跳过,因为是模板里的数据
//
if ($key == (count($attachmentData['file_name']) - 1)) {
//
continue;
//
}
if
(
$key
==
(
count
(
$attachmentData
[
'file_name'
])
-
1
))
{
continue
;
}
$attachment
=
[
'supplier_id'
=>
$supplierId
,
'file_name'
=>
$attachmentData
[
'file_name'
][
$key
],
...
...
@@ -76,6 +76,9 @@ class SupplierAttachmentService
'description'
=>
!
empty
(
$attachmentData
[
'description'
][
$key
])
?
$attachmentData
[
'description'
][
$key
]
:
' '
,
'type_name'
=>
array_get
(
config
(
'fixed.FileNameMapping'
),
$attachmentData
[
'field_name'
][
$key
]),
];
if
(
empty
(
$attachment
[
'file_name'
]))
{
continue
;
}
if
(
!
empty
(
$attachmentData
[
'validity_period'
][
$key
]))
{
$validityPeriod
=
explode
(
'~'
,
$attachmentData
[
'validity_period'
][
$key
]);
$attachment
[
'validity_start'
]
=
strtotime
(
trim
(
$validityPeriod
[
0
]));
...
...
resources/views/script/AddSupplierScript.blade.php
View file @
dffbb8ea
...
...
@@ -61,31 +61,41 @@
admin
.
closeThisTabs
();
});
form
.
on
(
'submit(addSupplier)'
,
function
(
data
)
{
admin
.
showLoading
({
type
:
3
,
});
function
getAttachmentData
(
data
)
{
let
file_name
=
[];
let
file_url
=
[];
let
validity_type
=
[];
let
field_name
=
[];
let
validity_period
=
[];
$
(
'.single_file_div'
).
each
(
function
()
{
let
description
=
[];
//只要寻找上传主区域的数据即可
$
(
'#attachment_upload_div'
).
find
(
'.single_file_div'
).
each
(
function
()
{
file_name
.
push
(
$
(
this
).
find
(
'#file_name'
).
val
());
file_url
.
push
(
$
(
this
).
find
(
'#file_url'
).
val
());
field_name
.
push
(
$
(
this
).
find
(
'#field_name'
).
val
());
validity_type
.
push
(
$
(
this
).
find
(
'#validity_type'
).
val
());
description
.
push
(
$
(
this
).
find
(
'#description'
).
val
());
validity_period
.
push
(
$
(
this
).
find
(
'#validity_period'
).
val
());
});
data
.
field
.
file_name
=
file_name
;
data
.
field
.
file_url
=
file_url
;
data
.
field
.
field_name
=
field_name
;
data
.
field
.
description
=
description
;
data
.
field
.
validity_type
=
validity_type
;
data
.
field
.
validity_period
=
validity_period
;
data
.
field
.
apply_audit_reason
=
$
(
'#apply_audit_reason'
).
val
();
return
data
;
}
form
.
on
(
'submit(addSupplier)'
,
function
(
data
)
{
admin
.
showLoading
({
type
:
3
,
});
data
=
getAttachmentData
(
data
);
let
url
=
'/api/supplier/AddSupplier'
;
let
res
=
ajax
(
url
,
data
.
field
);
if
(
!
res
)
{
admin
.
removeLoading
();
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
6
});
}
else
{
if
(
res
.
err_code
===
0
)
{
...
...
@@ -107,31 +117,9 @@
});
form
.
on
(
'submit(addAndApplySupplier)'
,
function
(
data
)
{
//去找出附件的所有数据
let
file_name
=
[];
let
file_url
=
[];
let
validity_type
=
[];
let
field_name
=
[];
let
validity_period
=
[];
let
description
=
[];
//只要寻找上传主区域的数据即可
$
(
'#attachment_upload_div'
).
find
(
'.single_file_div'
).
each
(
function
()
{
file_name
.
push
(
$
(
this
).
find
(
'#file_name'
).
val
());
file_url
.
push
(
$
(
this
).
find
(
'#file_url'
).
val
());
field_name
.
push
(
$
(
this
).
find
(
'#field_name'
).
val
());
validity_type
.
push
(
$
(
this
).
find
(
'#validity_type'
).
val
());
description
.
push
(
$
(
this
).
find
(
'#description'
).
val
());
validity_period
.
push
(
$
(
this
).
find
(
'#validity_period'
).
val
());
});
data
.
field
.
file_name
=
file_name
;
data
.
field
.
file_url
=
file_url
;
data
.
field
.
description
=
description
;
data
.
field
.
field_name
=
field_name
;
data
.
field
.
validity_type
=
validity_type
;
data
.
field
.
validity_period
=
validity_period
;
data
.
field
.
apply_audit_reason
=
$
(
'#apply_audit_reason'
).
val
();
let
fieldNameList
=
field_name
;
data
=
getAttachmentData
(
data
);
console
.
log
(
data
.
field
.
field_name
);
let
fieldNameList
=
data
.
field
.
field_name
?
data
.
field
.
field_name
:
[];
//提交先提示是否要转换供应商类型
let
radioObj
=
$
(
'input[name="supplier_type"]'
);
//已经上传品质保证协议(代理商则提示为“已经上传代理证”),是否切换为正式供应商?
...
...
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