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