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 @@ ...@@ -46,6 +46,7 @@
<script> <script>
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import {warehousePictureCreate} from "@/api/ecw/order";
export default { export default {
props: { props: {
...@@ -65,6 +66,15 @@ export default { ...@@ -65,6 +66,15 @@ export default {
type: Boolean, type: Boolean,
default: true default: true
}, },
// 类型 1入仓 2 调拨出仓 3调拨到仓 4 订单转异
type: {
type: Number,
default: undefined
},
id: {
type: Number,
default: undefined
},
readonly: { readonly: {
type: Boolean, type: Boolean,
default: false default: false
...@@ -121,9 +131,11 @@ export default { ...@@ -121,9 +131,11 @@ export default {
methods: { methods: {
// 删除图片 // 删除图片
handleRemove(index) { handleRemove(index) {
this.fileList.splice(index, 1); if (this.id && this.type) {
this.$emit("input", this.listToString(this.fileList)); this.$emit("delete", this.fileList[index].url);
}
this.fileList.splice(index, 1);
this.$emit("input", this.listToString(this.fileList));
}, },
// 上传成功回调 // 上传成功回调
handleUploadSuccess(res) { handleUploadSuccess(res) {
...@@ -133,8 +145,21 @@ export default { ...@@ -133,8 +145,21 @@ export default {
this.fileList = this.fileList.concat(this.uploadList); this.fileList = this.fileList.concat(this.uploadList);
this.uploadList = []; this.uploadList = [];
this.number = 0; this.number = 0;
this.$emit("input", this.listToString(this.fileList)); if (this.id && this.type) {
this.$modal.closeLoading(); 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 { }else {
this.handleUploadError(); this.handleUploadError();
......
...@@ -209,7 +209,14 @@ ...@@ -209,7 +209,14 @@
<span style="font-size: 18px">{{$t('入仓影像')}}</span> <span style="font-size: 18px">{{$t('入仓影像')}}</span>
</div> </div>
<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> </div>
</el-card> </el-card>
</el-tab-pane> </el-tab-pane>
...@@ -489,7 +496,11 @@ import {getFeeTypeByOrderProduct, getProductBrankPage} from "@/api/ecw/productBr ...@@ -489,7 +496,11 @@ import {getFeeTypeByOrderProduct, getProductBrankPage} from "@/api/ecw/productBr
import {cancelProcessInstance} from "@/api/bpm/processInstance" import {cancelProcessInstance} from "@/api/bpm/processInstance"
import WorkFlow from "@/components/WorkFlow" import WorkFlow from "@/components/WorkFlow"
import {DICT_TYPE, getDictDataLabel, getDictDatas} from "@/utils/dict" 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 {getProductAttrList} from "@/api/ecw/productAttr"
import {getProductTypeList} from "@/api/ecw/productType" import {getProductTypeList} from "@/api/ecw/productType"
import {addProduct} from "@/api/ecw/product" import {addProduct} from "@/api/ecw/product"
...@@ -560,6 +571,9 @@ export default { ...@@ -560,6 +571,9 @@ export default {
orderId(){ orderId(){
return this.order.orderId return this.order.orderId
}, },
orderItemId(){
return this.warehousing.orderItemId
},
brandObject(){ brandObject(){
return this.brandList.find(e => e.id === this.form.brand) || '' return this.brandList.find(e => e.id === this.form.brand) || ''
}, },
...@@ -765,6 +779,22 @@ export default { ...@@ -765,6 +779,22 @@ export default {
this.handleAdd(1) 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() { handleClose() {
this.visible = false 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