Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a28bc237
authored
Jul 03, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
v1.21.1版本需求
1 parent
ccb6e1ab
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
438 additions
and
27 deletions
src/views/work/ImageList.vue
src/views/work/edit.vue
src/views/work/image.vue
src/views/work/otherImage.vue
src/views/work/ImageList.vue
0 → 100644
View file @
a28bc23
<
template
>
<div
class=
"image_list_page"
>
<template
v-if=
"imgList && imgList.length"
>
<div
class=
"image_cell"
v-for=
"(item, index) in imgList"
:key=
"`img_upload_$
{index}`"
>
<image-upload
:value=
"item"
:status=
"status"
:limit=
"1"
@
change=
"onChange('imgList')"
></image-upload>
<div
class=
"image_name"
:title=
"item.originName"
>
{{
item
.
originName
||
item
.
name
}}
</div>
</div>
</
template
>
<ImageOtherUpload
v-model=
"otherList"
:limit=
"limit"
:status=
"status"
@
change=
"onChange('otherList')"
></ImageOtherUpload>
</div>
</template>
<
script
>
import
ImageUpload
from
"./image.vue"
;
import
ImageOtherUpload
from
"./otherImage.vue"
;
export
default
{
name
:
"ImageList"
,
components
:
{
ImageUpload
,
ImageOtherUpload
,
},
props
:
{
value
:
{
type
:
Array
,
default
:
function
()
{
return
[];
},
},
type
:
{
type
:
[
String
,
Number
],
default
:
1
,
//
},
status
:
{
//1:查看工单,不可编辑 2:编辑工单 3:激活工单 4:审核工单 5: 单独编辑图片
type
:
[
String
,
Number
],
default
:
""
,
},
},
watch
:
{
value
:
{
handler
:
function
(
n
,
o
)
{
let
m
=
[];
let
_other
=
[];
n
.
map
((
k
)
=>
{
// 固定位置
if
(
k
.
source
==
"bhg"
)
{
m
.
push
(
k
);
}
else
{
_other
.
push
(
k
);
}
});
let
len
=
m
.
length
;
if
(
len
<=
20
)
{
this
.
limit
=
20
-
len
;
}
else
{
this
.
limit
=
1
;
}
console
.
log
(
this
.
limit
);
this
.
imgList
=
m
;
this
.
otherList
=
_other
;
},
immediate
:
true
,
},
},
data
()
{
return
{
imgList
:
[],
// 固定位置
otherList
:
[],
// 其他
limit
:
1
,
};
},
methods
:
{
// 监听图片组件删除、上传更新
onChange
(
id
)
{
console
.
log
(
id
);
let
_list
=
this
.
imgList
.
concat
(
this
.
otherList
);
console
.
log
(
_list
);
this
.
$emit
(
"input"
,
_list
);
},
},
};
</
script
>
<
style
lang=
"scss"
scoped
>
.image_list_page
{
display
:
flex
;
flex-wrap
:
wrap
;
.image_cell
{
width
:
120px
;
margin
:
0
10px
10px
0
;
}
.image_name
{
height
:
30px
;
width
:
100%
;
text-align
:
center
;
overflow
:
hidden
;
white-space
:
nowrap
;
word-break
:
break-all
;
text-overflow
:
ellipsis
;
line-height
:
30px
;
}
}
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/work/edit.vue
View file @
a28bc23
...
@@ -154,7 +154,8 @@
...
@@ -154,7 +154,8 @@
<!-- 安装照片 开始 -->
<!-- 安装照片 开始 -->
<div
ref=
"imageUpload"
class=
"line_title glsx_hairline"
>
安装照片
</div>
<div
ref=
"imageUpload"
class=
"line_title glsx_hairline"
>
安装照片
</div>
<image-upload
v-model=
"editForm.workOrderDocs"
:status=
"type"
></image-upload>
<!-- <image-upload v-model="editForm.workOrderDocs" :status="type"></image-upload> -->
<image-list
v-model=
"editForm.workOrderDocs"
:status=
"type"
></image-list>
<!-- 安装照片 end -->
<!-- 安装照片 end -->
<!-- 操作日志 开始 -->
<!-- 操作日志 开始 -->
...
@@ -203,6 +204,7 @@ import moment from "moment";
...
@@ -203,6 +204,7 @@ import moment from "moment";
import
MapLocation
from
"@/components/amap"
;
import
MapLocation
from
"@/components/amap"
;
import
OrderProgress
from
"./progress"
;
import
OrderProgress
from
"./progress"
;
import
ImageUpload
from
"./image"
;
import
ImageUpload
from
"./image"
;
import
ImageList
from
'./ImageList.vue'
;
/**
/**
* type 1:查看工单,不可编辑 2:编辑工单 3:激活工单 4:审核工单 5: 单独编辑图片
* type 1:查看工单,不可编辑 2:编辑工单 3:激活工单 4:审核工单 5: 单独编辑图片
...
@@ -216,6 +218,7 @@ export default {
...
@@ -216,6 +218,7 @@ export default {
MapLocation
,
MapLocation
,
OrderProgress
,
OrderProgress
,
ImageUpload
,
ImageUpload
,
ImageList
},
},
props
:
{
props
:
{
id
:
{
id
:
{
...
@@ -874,9 +877,20 @@ export default {
...
@@ -874,9 +877,20 @@ export default {
// 单独保存照片
// 单独保存照片
saveImageInfo
()
{
saveImageInfo
()
{
let
_this
=
this
;
let
_this
=
this
;
let
m
=
this
.
editForm
;
let
oParams
=
{};
let
oParams
=
{};
oParams
.
workOrderId
=
this
.
editForm
.
id
;
oParams
.
workOrderId
=
m
.
id
;
oParams
.
workOrderDocs
=
this
.
editForm
.
workOrderDocs
;
oParams
.
workOrderDocs
=
m
.
workOrderDocs
;
for
(
let
i
=
0
,
len
=
m
.
workOrderDocs
.
length
;
i
<
len
;
i
++
){
let
o
=
m
.
workOrderDocs
[
i
];
if
(
!
o
.
path
&&
o
.
source
==
'bhg'
){
showToast
({
message
:
`请上传
${
o
.
originName
}
`
,
});
this
.
$emit
(
'change'
,
false
)
return
false
;
}
}
UPDATE_ORDER_IMAGE
(
oParams
).
then
((
res
)
=>
{
UPDATE_ORDER_IMAGE
(
oParams
).
then
((
res
)
=>
{
if
(
res
.
code
!=
200
)
{
if
(
res
.
code
!=
200
)
{
showToast
({
showToast
({
...
...
src/views/work/image.vue
View file @
a28bc23
<
template
>
<
template
>
<div
class=
"image_upload_page"
>
<div
class=
"image_upload_page"
>
<!-- 图片列表 开始 -->
<!-- 图片列表 开始 -->
<div
class=
"img_cell"
v-
for=
"(item,index) in imgList"
:key=
"index
"
>
<div
class=
"img_cell"
v-
if=
"imgInfo.path
"
>
<div
class=
"el_img_box"
>
<div
class=
"el_img_box"
>
<i
class=
"el-icon-error el_icon"
@
click=
"removeImage(i
tem
)"
v-if=
"readStatus != 1"
></i>
<i
class=
"el-icon-error el_icon"
@
click=
"removeImage(i
mgInfo
)"
v-if=
"readStatus != 1"
></i>
<el-image
class=
"el_img"
:src=
"i
tem.path"
:preview-src-list=
"getPreViewList(item.path,imgList)
"
></el-image>
<el-image
class=
"el_img"
:src=
"i
mgInfo.path"
:preview-src-list=
"[imgInfo.path]
"
></el-image>
</div>
</div>
</div>
</div>
<!-- 图片列表 end -->
<!-- 图片列表 end -->
...
@@ -27,7 +27,7 @@ export default {
...
@@ -27,7 +27,7 @@ export default {
name
:
"ImageUpload"
,
name
:
"ImageUpload"
,
props
:
{
props
:
{
value
:
{
value
:
{
type
:
Array
,
type
:
Object
,
default
:
function
()
{
default
:
function
()
{
return
[];
return
[];
},
},
...
@@ -38,12 +38,12 @@ export default {
...
@@ -38,12 +38,12 @@ export default {
},
},
limit
:
{
limit
:
{
type
:
[
String
,
Number
],
type
:
[
String
,
Number
],
default
:
20
,
default
:
1
,
},
},
},
},
data
()
{
data
()
{
return
{
return
{
img
List
:
[]
,
img
Info
:
{}
,
uploadUrl
:
""
,
uploadUrl
:
""
,
readStatus
:
""
,
readStatus
:
""
,
acceptFile
:
".jpg,.png"
,
acceptFile
:
".jpg,.png"
,
...
@@ -53,12 +53,13 @@ export default {
...
@@ -53,12 +53,13 @@ export default {
watch
:
{
watch
:
{
value
:
{
value
:
{
handler
:
function
(
n
,
o
)
{
handler
:
function
(
n
,
o
)
{
this
.
img
List
=
n
;
this
.
img
Info
=
n
;
},
},
immediate
:
true
,
immediate
:
true
,
},
},
status
:
{
status
:
{
handler
:
function
(
n
,
o
)
{
handler
:
function
(
n
,
o
)
{
console
.
log
(
n
)
this
.
readStatus
=
n
;
this
.
readStatus
=
n
;
},
},
immediate
:
true
,
immediate
:
true
,
...
@@ -124,12 +125,13 @@ export default {
...
@@ -124,12 +125,13 @@ export default {
console
.
log
(
res
);
console
.
log
(
res
);
let
response
=
res
.
data
;
let
response
=
res
.
data
;
if
(
response
.
returnCode
==
0
)
{
if
(
response
.
returnCode
==
0
)
{
_this
.
imgList
.
push
({
path
:
response
.
data
});
//
_this.imgList.push({ path: response.data });
_this
.
previewList
.
push
(
res
.
data
);
//
_this.previewList.push(res.data);
console
.
log
(
_this
.
imgList
);
_this
.
$set
(
_this
.
imgInfo
,
'path'
,
response
.
data
)
//
//
//this.$emit("change", response.data);
//this.$emit("change", response.data);
_this
.
$emit
(
"input"
,
_this
.
imgList
);
_this
.
$emit
(
"input"
,
_this
.
imgInfo
);
_this
.
$emit
(
'change'
)
}
}
});
});
},
},
...
@@ -137,9 +139,11 @@ export default {
...
@@ -137,9 +139,11 @@ export default {
// 删除图片
// 删除图片
removeImage
(
row
)
{
removeImage
(
row
)
{
//数组中删除对应img
//数组中删除对应img
this
.
imgList
=
this
.
imgList
.
filter
((
k
)
=>
k
.
path
!=
row
.
path
);
//this.imgList = this.imgList.filter((k) => k.path != row.path);
console
.
log
(
this
.
imgList
);
row
.
path
=
''
;
this
.
$emit
(
"input"
,
this
.
imgList
);
row
.
changed
=
true
;
this
.
$emit
(
"input"
,
row
);
this
.
$emit
(
'change'
)
// 删除存量图片
// 删除存量图片
// if (row.id) {
// if (row.id) {
...
@@ -149,27 +153,32 @@ export default {
...
@@ -149,27 +153,32 @@ export default {
// 是否可以上传
// 是否可以上传
showUpload
()
{
showUpload
()
{
let
o
=
this
.
imgInfo
||
{}
if
(
this
.
readStatus
==
1
)
{
if
(
this
.
readStatus
==
1
)
{
return
false
;
return
false
;
}
}
if
(
this
.
imgList
&&
this
.
imgList
.
length
>=
this
.
limit
)
{
if
(
o
.
source
==
'bhg'
&&
o
.
path
)
{
return
false
;
return
false
;
}
}
// if (this.imgList && this.imgList.length >= this.limit) {
// return false;
// }
return
true
;
return
true
;
},
},
// 获取图片预览列表
// 获取图片预览列表
getPreViewList
(
url
)
{
getPreViewList
(
url
)
{
let
_this
=
this
;
let
_this
=
this
;
let
list
=
this
.
imgList
||
[];
//
let list = this.imgList || [];
let
arr
=
[];
let
arr
=
[];
list
.
map
((
k
)
=>
{
//
list.map((k) => {
if
(
k
.
pah
==
url
)
{
//
if (k.pah == url) {
arr
.
unshift
(
k
.
path
);
//
arr.unshift(k.path);
}
else
{
//
} else {
arr
.
push
(
k
.
path
);
//
arr.push(k.path);
}
//
}
});
//
});
return
arr
;
return
arr
;
},
},
},
},
...
@@ -189,6 +198,9 @@ export default {
...
@@ -189,6 +198,9 @@ export default {
display
:
flex
;
display
:
flex
;
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
}
}
.el_upload
{
margin
:
0
10px
0px
0
;
}
.img_cell
{
.img_cell
{
display
:
flex
;
display
:
flex
;
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
...
@@ -199,7 +211,7 @@ export default {
...
@@ -199,7 +211,7 @@ export default {
border-radius
:
4px
;
border-radius
:
4px
;
border
:
1px
dashed
#d8d8d8
;
border
:
1px
dashed
#d8d8d8
;
padding
:
4px
;
padding
:
4px
;
margin
:
0
10px
1
0px
0
;
margin
:
0
10px
0px
0
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
.el_icon
{
.el_icon
{
position
:
absolute
;
position
:
absolute
;
...
...
src/views/work/otherImage.vue
0 → 100644
View file @
a28bc23
<
template
>
<div
class=
"image_upload_page"
>
<!-- 图片列表 开始 -->
<div
class=
"img_cell"
v-for=
"(item, index) in imgList"
:key=
"index"
>
<div
class=
"el_img_box"
>
<i
class=
"el-icon-error el_icon"
@
click=
"removeImage(item)"
v-if=
"readStatus != 1"
></i>
<el-image
class=
"el_img"
:src=
"item.path"
:preview-src-list=
"getPreViewList(item.path, imgList)"
></el-image>
</div>
<div
class=
"image_name"
:title=
"item.originName"
>
{{
item
.
originName
||
item
.
name
}}
</div>
</div>
<!-- 图片列表 end -->
<!-- 上传 开始 -->
<el-upload
class=
"el_upload"
v-if=
"showUpload()"
:action=
"uploadUrl"
list-type=
"picture-card"
:accept=
"acceptFile"
:show-file-list=
"false"
:on-change=
"onChange"
:http-request=
"uploadRequest"
>
<i
class=
"el-icon-plus"
></i>
</el-upload>
<!-- 上传 end -->
</div>
</
template
>
<
script
>
import
axios
from
"axios"
;
import
sign
from
"@/utils/sign"
;
import
qs
from
"qs"
;
import
{
DELETE_ORDER_IMAGE
}
from
"@/services/order"
;
import
{
showToast
}
from
"@/utils/util"
;
export
default
{
name
:
"ImageOtherUpload"
,
props
:
{
value
:
{
type
:
Array
,
default
:
function
()
{
return
[];
},
},
status
:
{
type
:
[
String
,
Number
],
default
:
""
,
},
limit
:
{
type
:
[
String
,
Number
],
default
:
20
,
},
},
data
()
{
return
{
imgList
:
[],
uploadUrl
:
""
,
readStatus
:
""
,
acceptFile
:
".jpg,.png"
,
previewList
:
[],
};
},
watch
:
{
value
:
{
handler
:
function
(
n
,
o
)
{
this
.
imgList
=
n
;
},
immediate
:
true
,
},
status
:
{
handler
:
function
(
n
,
o
)
{
this
.
readStatus
=
n
;
},
immediate
:
true
,
},
},
mounted
()
{},
methods
:
{
// 监听选择图片
onChange
(
file
,
fileList
)
{
console
.
log
(
file
);
},
// 图片转换成base64
toBase64
(
file
)
{
let
_this
=
this
;
const
reader
=
new
FileReader
();
reader
.
readAsDataURL
(
file
);
reader
.
onload
=
(
event
)
=>
{
const
imgFile
=
event
.
target
.
result
;
const
arrBase64
=
imgFile
.
split
(
","
);
let
arr
=
file
.
name
.
split
(
"."
);
let
_type
=
arr
[
arr
.
length
-
1
];
let
fileInfo
=
_type
+
"@"
+
arrBase64
[
1
];
let
oParams
=
{
fileName
:
file
.
name
,
file
:
fileInfo
,
};
_this
.
uploadImage
(
oParams
);
};
},
// 自定义上传
uploadRequest
(
e
)
{
let
file
=
e
.
file
;
if
(
file
.
size
>
10
*
1024
*
1024
)
{
showToast
({
message
:
"图片最大上传10M"
,
});
return
false
;
}
this
.
toBase64
(
file
);
},
// 上传图片到服务器
uploadImage
(
params
=
{},
noSignAttr
=
[
"file"
])
{
let
_this
=
this
;
const
fileUploadURL
=
"https://didicb.glsx.com.cn"
||
localStorage
.
getItem
(
"FILE_UPLOAD_URL"
);
//const fileUploadURL = 'http://qcdidicb.dev.glsx.com.cn:7060' // 给java后台测试用的地址
params
.
source
=
"glsx-oss-carowner"
;
params
.
app_key
=
"48e5e13229b82c1b4e6e8c96151f0637"
;
params
.
timestamp
=
new
Date
().
getTime
();
params
.
v
=
"1.0.0"
;
params
.
format
=
"json"
;
params
.
method
=
"glsx.accounts.biz.common.pictureUpload"
;
const
data
=
sign
(
params
,
noSignAttr
);
axios
.
post
(
`
${
fileUploadURL
}
/router?method=
${
params
.
method
}
`
,
qs
.
stringify
(
data
)
)
.
then
((
res
)
=>
{
console
.
log
(
res
);
let
response
=
res
.
data
;
if
(
response
.
returnCode
==
0
)
{
_this
.
imgList
.
push
({
path
:
response
.
data
,
name
:
params
.
fileName
});
_this
.
previewList
.
push
(
res
.
data
);
console
.
log
(
_this
.
imgList
);
//
//this.$emit("change", response.data);
_this
.
$emit
(
"input"
,
_this
.
imgList
);
_this
.
$emit
(
"change"
);
}
});
},
// 删除图片
removeImage
(
row
)
{
//数组中删除对应img
this
.
imgList
=
this
.
imgList
.
filter
((
k
)
=>
k
.
path
!=
row
.
path
);
console
.
log
(
this
.
imgList
);
this
.
$emit
(
"input"
,
this
.
imgList
);
this
.
$emit
(
"change"
);
// 删除存量图片
// if (row.id) {
// DELETE_ORDER_IMAGE({ id: row.id });
// }
},
// 是否可以上传
showUpload
()
{
console
.
log
(
this
.
readStatus
);
if
(
this
.
readStatus
==
1
)
{
return
false
;
}
console
.
log
(
this
.
imgList
+
"----"
+
"-----"
+
this
.
imgList
.
length
+
this
.
limit
);
if
(
this
.
imgList
&&
this
.
imgList
.
length
>=
this
.
limit
)
{
return
false
;
}
return
true
;
},
// 获取图片预览列表
getPreViewList
(
url
)
{
let
_this
=
this
;
let
list
=
this
.
imgList
||
[];
let
arr
=
[];
list
.
map
((
k
)
=>
{
if
(
k
.
pah
==
url
)
{
arr
.
unshift
(
k
.
path
);
}
else
{
arr
.
push
(
k
.
path
);
}
});
return
arr
;
},
},
};
</
script
>
<
style
lang=
"scss"
>
.el_upload
{
.el-upload--picture-card
{
width
:
120px
!important
;
height
:
120px
;
line-height
:
118px
;
}
}
</
style
>
<
style
lang=
"scss"
scoped
>
.image_upload_page
{
display
:
flex
;
flex-wrap
:
wrap
;
}
.img_cell
{
display
:
flex
;
flex-wrap
:
wrap
;
flex-direction
:
column
;
margin-bottom
:
10px
;
.el_img_box
{
position
:
relative
;
width
:
120px
;
height
:
120px
;
border-radius
:
4px
;
border
:
1px
dashed
#d8d8d8
;
padding
:
4px
;
margin
:
0
10px
0px
0
;
box-sizing
:
border-box
;
.el_icon
{
position
:
absolute
;
top
:
0
;
right
:
0
;
z-index
:
2
;
color
:
#f00
;
font-size
:
20px
;
display
:
none
;
cursor
:
pointer
;
}
.el_img
{
width
:
100%
;
height
:
100%
;
border-radius
:
4px
;
}
}
.el_img_box
:hover
{
.el_icon
{
display
:
block
;
}
}
}
.image_name
{
height
:
30px
;
width
:
120px
;
text-align
:
center
;
overflow
:
hidden
;
white-space
:
nowrap
;
word-break
:
break-all
;
text-overflow
:
ellipsis
;
line-height
:
30px
;
}
</
style
>
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment