Commit d89d0796 authored by Marcus's avatar Marcus

2.2品名上传影像需要实现上传后自动保存

https://zentao.test.jdshangmen.com/bug-view-3843.html
parent 4d182249
......@@ -46,6 +46,7 @@
<script>
import { getToken } from "@/utils/auth";
import {warehousePictureCreate} from "@/api/ecw/order";
export default {
props: {
......@@ -65,6 +66,15 @@ export default {
type: Boolean,
default: true
},
// 类型 1入仓 2 调拨出仓 3调拨到仓 4 订单转异
type: {
type: Number,
default: undefined
},
id: {
type: Number,
default: undefined
},
readonly: {
type: Boolean,
default: false
......@@ -121,9 +131,11 @@ export default {
methods: {
// 删除图片
handleRemove(index) {
this.fileList.splice(index, 1);
this.$emit("input", this.listToString(this.fileList));
if (this.id && this.type) {
this.$emit("delete", this.fileList[index].url);
}
this.fileList.splice(index, 1);
this.$emit("input", this.listToString(this.fileList));
},
// 上传成功回调
handleUploadSuccess(res) {
......@@ -133,8 +145,21 @@ export default {
this.fileList = this.fileList.concat(this.uploadList);
this.uploadList = [];
this.number = 0;
this.$emit("input", this.listToString(this.fileList));
this.$modal.closeLoading();
if (this.id && this.type) {
warehousePictureCreate({
"bizId": this.id,
"type": this.type,
"url": res.data
}).then(() => {
this.$emit("input", this.listToString(this.fileList));
this.$emit("refresh");
this.$modal.closeLoading();
})
} else {
this.$emit("input", this.listToString(this.fileList));
this.$emit("refresh");
this.$modal.closeLoading();
}
}
}else {
this.handleUploadError();
......
......@@ -209,7 +209,14 @@
<span style="font-size: 18px">{{$t('入仓影像')}}</span>
</div>
<div>
<image-and-video-upload :fileSize="50" :isShowTip="true" v-model="form.pictureUrls" ></image-and-video-upload>
<image-and-video-upload
:fileSize="50"
:isShowTip="true"
v-model="form.pictureUrls"
:id="orderItemId"
:type="5"
@delete="handleImageDelete"
></image-and-video-upload>
</div>
</el-card>
</el-tab-pane>
......@@ -489,7 +496,11 @@ import {getFeeTypeByOrderProduct, getProductBrankPage} from "@/api/ecw/productBr
import {cancelProcessInstance} from "@/api/bpm/processInstance"
import WorkFlow from "@/components/WorkFlow"
import {DICT_TYPE, getDictDataLabel, getDictDatas} from "@/utils/dict"
import {orderWarehouseIn, orderWarehouseInUpdateApply} from "@/api/ecw/order"
import {
orderWarehouseIn,
orderWarehouseInUpdateApply, warehousePictureDelete,
warehousePictureList
} from "@/api/ecw/order"
import {getProductAttrList} from "@/api/ecw/productAttr"
import {getProductTypeList} from "@/api/ecw/productType"
import {addProduct} from "@/api/ecw/product"
......@@ -560,6 +571,9 @@ export default {
orderId(){
return this.order.orderId
},
orderItemId(){
return this.warehousing.orderItemId
},
brandObject(){
return this.brandList.find(e => e.id === this.form.brand) || ''
},
......@@ -765,6 +779,22 @@ export default {
this.handleAdd(1)
}
},
handleImageDelete(url) {
warehousePictureList({
bizId: this.orderId,
type: 1
}).then(r =>{
console.log(r, url)
if (r.data?.length > 0) {
const id = r.data.find(e => e?.url === url)?.id
if (id) {
warehousePictureDelete(id).then(r => {
console.log(r)
})
}
}
})
},
handleClose() {
this.visible = false
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment