Commit e457f6d5 by 张杰

Merge branch 'v1.26.0' into 'develop'

V1.26.0

See merge request !64
2 parents 9a319049 af74b908
......@@ -183,3 +183,8 @@ export const REST_FREQ_INFO = params => {
export const REPUSH_WORK_ORDER = params => {
return api.get('workOrder/retweetWorkOrder', params)
}
// 业务管理-车辆管理-三码合一照片修改
export const UPDATE_THREECODE_IMAGE = params => {
return api.post('vehicle/updateThreeCodeImage', params, 'object')
}
\ No newline at end of file
<template>
<div class="image_upload_page">
<!-- 图片列表 开始 -->
<div v-for="(item,index) in imgList" :key="index" class="img_cell">
<div
v-for="(item, index) in imgList"
:key="index"
class="img_cell"
:class="getCellClass(item)"
>
<div class="el_img_box">
<i v-if="item.url" class="el-icon-error el_icon" @click="removeImage(item, index)" />
<el-image v-if="item.url" class="el_img" lazy placeholder="加载中" :src="item.url" :preview-src-list="getPreViewList(item.url,imgList)" />
<el-upload v-if="!item.url" v-loading="item.imageFlag" class="el_upload" :action="uploadUrl" list-type="picture-card" :accept="acceptFile" :show-file-list="false" :on-change="onChange" :http-request="(event)=>{uploadRequest(event, index)}">
<i
v-if="item.url"
class="el-icon-error el_icon"
@click="removeImage(item, index)"
/>
<el-image
v-if="item.url"
class="el_img"
lazy
placeholder="加载中"
:src="item.url"
:preview-src-list="getPreViewList(item.url, imgList)"
/>
<el-upload
v-if="!item.url"
v-loading="item.imageFlag"
class="el_upload"
:action="uploadUrl"
list-type="picture-card"
:accept="acceptFile"
:show-file-list="false"
:on-change="onChange"
:http-request="
(event) => {
uploadRequest(event, index);
}
"
>
<i class="el-icon-plus" />
</el-upload>
</div>
<div class="img_name">{{ item.imageName }}</div>
</div>
<!-- 图片列表 end -->
</div>
</template>
<script>
import axios from 'axios'
import sign from '@/utils/sign'
import qs from 'qs'
import { showToast } from '@/utils/util'
import axios from "axios";
import sign from "@/utils/sign";
import qs from "qs";
import { showToast } from "@/utils/util";
export default {
name: 'ImageUpload',
name: "ImageUpload",
props: {
value: {
type: Array,
default: function() {
return []
}
default: function () {
return [];
},
},
limit: {
type: [String, Number],
default: 20
}
default: 20,
},
flag: {
type: [String, Number],
default: 0,
},
},
data() {
return {
imgList: [],
uploadUrl: '',
readStatus: '',
acceptFile: '.jpg,.png'
}
uploadUrl: "",
readStatus: "",
acceptFile: ".jpg,.png",
imgFlag: 0, // 是否只让修改三码合一 1:只能修改三码合一
};
},
watch: {
value: {
handler: function(n, o) {
this.imgList = n
handler: function (n, o) {
this.imgList = n;
},
immediate: true
}
},
mounted() {
immediate: true,
},
flag: {
handler: function (n) {
this.imgFlag = n;
},
immediate: true,
},
},
mounted() {},
methods: {
// 监听选择图片
onChange(file, fileList) {
console.log(file)
console.log(file);
},
// 图片转换成base64
toBase64(file, index) {
const _this = this
const reader = new FileReader()
reader.readAsDataURL(file)
const _this = this;
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = (event) => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
const imgFile = event.target.result;
const arrBase64 = imgFile.split(",");
const arr = file.name.split('.')
const _type = arr[arr.length - 1]
const fileInfo = _type + '@' + arrBase64[1]
const arr = file.name.split(".");
const _type = arr[arr.length - 1];
const fileInfo = _type + "@" + arrBase64[1];
const oParams = {
fileName: file.name,
file: fileInfo
}
_this.uploadImage(oParams, index)
}
file: fileInfo,
};
_this.uploadImage(oParams, index);
};
},
// 自定义上传
uploadRequest(e, index) {
const file = e.file
const file = e.file;
if (file.size > 10 * 1024 * 1024) {
showToast({
message: '图片最大上传10M'
})
return false
message: "图片最大上传10M",
});
return false;
}
this.imgList[index].imageFlag = true
this.$emit('input', this.imgList)
this.toBase64(file, index)
this.imgList[index].imageFlag = true;
this.$emit("input", this.imgList);
this.toBase64(file, index);
},
// 上传图片到服务器
uploadImage(params = {}, index, noSignAttr = ['file']) {
uploadImage(params = {}, index, noSignAttr = ["file"]) {
// 上传url 测试 http://qcdidicb.glsx.com.cn:7060 线上 https://didicb.glsx.com.cn 开发 http://qcdidicb.dev.glsx.com.cn:7060
const o = window.location
const origin = o.origin
let fileUploadURL = ''
const o = window.location;
const origin = o.origin;
let fileUploadURL = "";
switch (origin) {
case 'http://e-shield.didihu.com.cn':
fileUploadURL = 'https://didicb.glsx.com.cn'
break
case 'https://e-shield.didihu.com.cn':
fileUploadURL = `https://didicb.glsx.com.cn`
break
case 'http://e-shield.glsx.com.cn':
fileUploadURL = `http://qcdidicb.glsx.com.cn:7060`
break
case 'http://e-shield.dev.glsx.com.cn':
fileUploadURL = `http://qcdidicb.dev.glsx.com.cn:7060`
break
case "http://e-shield.didihu.com.cn":
fileUploadURL = "https://didicb.glsx.com.cn";
break;
case "https://e-shield.didihu.com.cn":
fileUploadURL = `https://didicb.glsx.com.cn`;
break;
case "http://e-shield.glsx.com.cn":
fileUploadURL = `http://qcdidicb.glsx.com.cn:7060`;
break;
case "http://e-shield.dev.glsx.com.cn":
fileUploadURL = `http://qcdidicb.dev.glsx.com.cn:7060`;
break;
default:
fileUploadURL = 'http://qcdidicb.dev.glsx.com.cn:7060'
break
fileUploadURL = "http://qcdidicb.dev.glsx.com.cn:7060";
break;
}
const _this = this
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)
const _this = this;
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) => {
_this.imgList[index].imageFlag = false
_this.$emit('input', _this.imgList)
const response = res.data
_this.imgList[index].imageFlag = false;
_this.$emit("input", _this.imgList);
const response = res.data;
if (response.returnCode == 0) {
_this.imgList[index].url = response.data
_this.imgList[index].isUpdate = 1 // 重新上传后,是否新上传替换图片标识
_this.imgList[index].url = response.data;
_this.imgList[index].isUpdate = 1; // 重新上传后,是否新上传替换图片标识
// this.$emit("change", response.data);
_this.$emit('input', _this.imgList)
_this.$emit("input", _this.imgList);
}
})
});
},
// 删除图片
removeImage(row, index) {
// 数组中删除对应img
this.imgList[index].url = ''
this.$emit('input', this.imgList)
this.imgList[index].url = "";
this.$emit("input", this.imgList);
},
// 获取图片预览列表
getPreViewList(url) {
const list = this.imgList || []
const arr = []
const list = this.imgList || [];
const arr = [];
list.map((k) => {
if (k.url) {
if (k.url == url) {
arr.unshift(k.url)
arr.unshift(k.url);
} else {
arr.push(k.url)
arr.push(k.url);
}
}
})
return arr
}
}
}
});
return arr;
},
// 获取classname 针对三码合一的修改特殊处理,其他图片显示遮罩层
getCellClass(row) {
console.log(this.imgFlag)
let idx = row.imageName.indexOf("三码合一");
if(this.imgFlag == 0){
return '';
}
if (idx < 0 && this.imgFlag == 1) {
return "img_cell_blk";
}
},
},
};
</script>
<style lang="scss">
.el_upload {
......@@ -182,6 +233,7 @@ export default {
flex-wrap: wrap;
}
.img_cell {
position: relative;
display: flex;
flex-wrap: wrap;
flex-flow: column;
......@@ -215,10 +267,22 @@ export default {
display: block;
}
}
.img_name{
.img_name {
width: 110px;
margin-top: 15px;
color: #999;
}
}
.img_cell_blk:after {
display: block;
content: "";
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background:#fff;
z-index:2;
opacity: 0.5;
}
</style>
......@@ -90,6 +90,9 @@
<el-input :value="form.specialTagStr" disabled />
</el-form-item>
</div>
<el-form-item label="是否加装" v-if="showFormItem">
<el-input :value="form.addFlag == 1?'是':'否'" disabled />
</el-form-item>
<el-form-item label="结算主体">
<el-input :value="form.tradeEntityStr" disabled />
</el-form-item>
......@@ -818,6 +821,7 @@ export default {
orderSourceStr: "",
specialTagStr: "",
tradeEntityStr: "",
addFlag:""
},
rules: {
shopName: [
......@@ -949,6 +953,7 @@ export default {
freshLoading: false,
pushTime: 120,
pushInterval: null,
showFormItem:false , // 是否展示加装工单选项
};
},
computed: {
......@@ -969,6 +974,7 @@ export default {
}
},
},
methods: {
resetForm() {
const form = this.form;
......@@ -1013,9 +1019,16 @@ export default {
form.orderSourceStr = "";
form.specialTagStr = "";
form.tradeEntityStr = "";
form.addFlag = 0
},
openDialog() {
console.log(this.progressShow);
let user = sessionStorage.getItem('user');
let info = user?JSON.parse(user):{};
// 针对平安特殊的账户,动态展示是否加装字段
if (info.username == "PAXM"||info.username == "paxm") {
this.showFormItem = true;
}
this.$emit("onOrderModalChange", true);
this.resetForm();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!