Commit 2b1af2e3 by 前端

Merge branch 'v1.21.2' into 'develop'

V1.21.2版本需求上线,合并代码到develop

See merge request !48
2 parents da757fd7 bc2ef028
......@@ -7,6 +7,7 @@
:value="item"
:status="status"
:limit="1"
:list="workOrderDocs"
@change="onChange('imgList')"
></image-upload>
<div class="image_name" :title="item.originName">
......@@ -17,7 +18,7 @@
</template>
<ImageOtherUpload
v-model="otherList"
:list="otherList"
:list="workOrderDocs"
:limit="20-imgList.length"
:status="status"
:nameIndex="otherList.length"
......@@ -77,6 +78,7 @@ export default {
// console.log(this.limit);
this.imgList = m;
this.otherList = _other;
this.workOrderDocs = n
},
immediate: true,
},
......@@ -86,6 +88,7 @@ export default {
imgList: [], // 固定位置
otherList: [], // 其他
limit: 1,
workOrderDocs:[], // 所有图片
};
},
methods: {
......
......@@ -3,18 +3,34 @@
<!-- 图片列表 开始 -->
<div class="img_cell" v-if="imgInfo.path">
<div class="el_img_box">
<i class="el-icon-error el_icon" @click="removeImage(imgInfo)" v-if="readStatus != 1"></i>
<el-image class="el_img" :src="imgInfo.path" :preview-src-list="[imgInfo.path]"></el-image>
<i
class="el-icon-error el_icon"
@click="removeImage(imgInfo)"
v-if="readStatus != 1"
></i>
<el-image
class="el_img"
:src="imgInfo.path"
:preview-src-list="getPreViewList(imgInfo.path)"
></el-image>
</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">
<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-upload2"></i>
</el-upload>
<!-- 上传 end -->
</div>
</template>
<script>
......@@ -40,6 +56,12 @@ export default {
type: [String, Number],
default: 1,
},
list: {
type: Array,
default: function () {
return [];
},
},
},
data() {
return {
......@@ -59,7 +81,7 @@ export default {
},
status: {
handler: function (n, o) {
console.log(n)
console.log(n);
this.readStatus = n;
},
immediate: true,
......@@ -107,7 +129,8 @@ export default {
// 上传图片到服务器
uploadImage(params = {}, noSignAttr = ["file"]) {
let _this = this;
const fileUploadURL = "https://didicb.glsx.com.cn" || localStorage.getItem("FILE_UPLOAD_URL");
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";
......@@ -127,11 +150,11 @@ export default {
if (response.returnCode == 0) {
// _this.imgList.push({ path: response.data });
// _this.previewList.push(res.data);
_this.$set(_this.imgInfo,'path',response.data)
_this.$set(_this.imgInfo, "path", response.data);
//
//this.$emit("change", response.data);
_this.$emit("input", _this.imgInfo);
_this.$emit('change')
_this.$emit("change");
}
});
},
......@@ -140,10 +163,10 @@ export default {
removeImage(row) {
//数组中删除对应img
//this.imgList = this.imgList.filter((k) => k.path != row.path);
row.path = '';
row.path = "";
row.changed = true;
this.$emit("input", row);
this.$emit('change')
this.$emit("change");
// 删除存量图片
// if (row.id) {
......@@ -153,11 +176,11 @@ export default {
// 是否可以上传
showUpload() {
let o = this.imgInfo||{}
let o = this.imgInfo || {};
if (this.readStatus == 1) {
return false;
}
if(o.source == 'bhg' && o.path){
if (o.source == "bhg" && o.path) {
return false;
}
......@@ -170,15 +193,20 @@ export default {
// 获取图片预览列表
getPreViewList(url) {
let _this = this;
//let list = this.imgList || [];
let list = this.list || [];
let arr = [];
// list.map((k) => {
// if (k.pah == url) {
// arr.unshift(k.path);
// } else {
// arr.push(k.path);
// }
// });
if (list.length > 20) {
list.length = 20;
}
list.map((k) => {
if (k.pah == url) {
arr.unshift(k.path);
} else {
if(k.path){
arr.push(k.path);
}
}
});
return arr;
},
},
......@@ -198,7 +226,7 @@ export default {
display: flex;
flex-wrap: wrap;
}
.el_upload{
.el_upload {
margin: 0 10px 0px 0;
}
.img_cell {
......
......@@ -66,6 +66,12 @@ export default {
type: Number,
default: 0,
},
list: {
type: Array,
default: function () {
return [];
},
},
},
data() {
return {
......@@ -209,15 +215,21 @@ export default {
// 获取图片预览列表
getPreViewList(url) {
let _this = this;
let list = this.imgList || [];
let list = this.list || [];
let arr = [];
if (list.length > 20) {
list.length = 20;
}
list.map((k) => {
if (k.pah == url) {
arr.unshift(k.path);
} else {
arr.push(k.path);
if (k.path) {
arr.push(k.path);
}
}
});
return arr;
},
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!