Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
梁建民
/
wmsApp
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
752ac4b8
authored
Feb 27, 2025
by
LJM
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
图片操作
parent
bda86a26
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
15 deletions
pages/stockRecheck/shipOut.vue
pages/stockRecheck/shipOut.vue
View file @
752ac4b8
...
...
@@ -341,6 +341,7 @@
data
()
{
return
{
noexebshowFalg
:
true
,
//控制是否会触发生命周期
img_upload_url
:
uni
.
getStorageSync
(
'img_upload_url'
)
||
'http://image.liexindev.net'
,
//oss系统
company_id
:
uni
.
getStorageSync
(
'company_id'
)
||
1
,
input_flag
:
false
,
flag
:
false
,
...
...
@@ -887,7 +888,7 @@
const
imagePaths
=
chooseImageRes
.
tempFilePaths
;
// 判断选择的图片数量是否超过最大限制数量
let
maxNum
=
Number
(
imagePaths
.
length
)
+
Number
(
this
.
list
[
index
].
recheck_img_list
.
length
);
//当前上传的+已经上传的
let
maxNum
=
Number
(
imagePaths
.
length
)
+
Number
(
this
.
list
[
index
].
sign_pic_ids
.
length
);
//当前上传的+已经上传的
if
(
maxNum
>
this
.
maxNum
)
{
uni
.
hideLoading
();
uni
.
showToast
({
...
...
@@ -922,27 +923,25 @@
uni
.
hideLoading
();
let
data
=
JSON
.
parse
(
uploadFileRes
.
data
);
if
(
data
.
code
===
0
)
{
// 根据参数index更新list里的数组
recheck_img_list
// 根据参数index更新list里的数组
sign_pic_ids
let
itemToUpdate
=
this
.
list
[
index
];
itemToUpdate
.
recheck_img_list
.
push
({
pic
_id
:
data
.
data
.
oss_image_id
,
itemToUpdate
.
sign_pic_ids
.
push
({
img
_id
:
data
.
data
.
oss_image_id
,
small_image_url
:
data
.
data
.
small_image_url
,
big_image_url
:
data
.
data
.
big_image_url
big_image_url
:
data
.
data
.
big_image_url
,
url
:
data
.
data
.
oss_image_url
,
id_del
:
1
});
// 更新整个list数组
this
.
list
=
[...
this
.
list
];
// 获取特定索引位置的recheck_img_list
let
pickImgList
=
this
.
list
[
index
].
recheck_img_list
;
// 使用flatMap获取所有的pic_id并拼接成字符串
let
pic_ids
=
pickImgList
.
flatMap
(
item
=>
item
.
pic_id
).
join
(
','
);
// 只传新上传图片的 img_id
let
img_id
=
data
.
data
.
oss_image_id
;
//签约图片更新
this
.
signUserPic
(
this
.
list
[
index
].
stock_out_id
,
pic_ids
,
1
);
this
.
signUserPic
(
this
.
list
[
index
].
stock_out_id
,
img_id
,
1
);
}
else
{
uni
.
showToast
({
...
...
@@ -974,7 +973,7 @@
* @param {string} img_id - 图片ID,多个以逗号分隔
* @param {number} type - 操作类型:1-新增 2-删除
*/
signUserPic
(
stock_out_id
,
img_id
,
type
)
{
signUserPic
(
stock_out_id
,
img_id
,
type
,
callback
)
{
// 使用对象展开运算符一次性更新参数
this
.
signUserPicParams
=
{
...
this
.
signUserPicParams
,
...
...
@@ -989,8 +988,7 @@
title
:
'操作成功'
,
icon
:
'success'
});
setTimeout
(()
=>
this
.
getData
(),
2000
);
typeof
callback
==
'function'
&&
callback
();
}
else
{
uni
.
showToast
({
title
:
res
.
msg
,
...
...
@@ -998,6 +996,31 @@
});
}
});
},
/**
* 删除图片
* @param {Object} index 主索引index
* @param {Object} i 图片索引
*/
deletePic
(
index
,
i
)
{
uni
.
showModal
({
title
:
'确认删除'
,
content
:
'确定要删除这张图片吗?'
,
success
:
(
res
)
=>
{
if
(
res
.
confirm
)
{
//签约图片删除
this
.
signUserPic
(
this
.
list
[
index
].
stock_out_id
,
this
.
list
[
index
].
sign_pic_ids
[
i
].
img_id
,
2
,
()
=>
{
this
.
list
[
index
].
sign_pic_ids
.
splice
(
i
,
1
);
this
.
list
=
[...
this
.
list
];
this
.
$forceUpdate
();
});
}
else
if
(
res
.
cancel
)
{
// 用户点击取消
console
.
log
(
'用户点击取消'
);
}
}
});
}
}
};
...
...
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