Authored by htoooth

fix

... ... @@ -39,7 +39,7 @@ export default {
},
computed: {
values() {
return this.value.split('|');
return this.value ? this.value.split('|') : [];
}
},
methods: {
... ...
... ... @@ -54,7 +54,7 @@ export default {
>
<div class="upload-item-img">
<img v-if="row.goodsColorImage.value"
:src="row.goodsColorImage.value" alt="" width="120px" height="122px">
:src="row.goodsColorImage.value" alt="" width="88px" height="118px">
</div>
<div>
<file-upload :id="{index: ${index}}"
... ...
... ... @@ -272,7 +272,7 @@ export default {
>
<div class="upload-item-img">
<img v-if="row.goodsColorImage.value"
:src="row.goodsColorImage.value" alt="" width="120px" height="122px">
:src="row.goodsColorImage.value" alt="" width="88px" height="118px">
</div>
<div>
<file-upload :id="{index: ${index}}"
... ... @@ -881,8 +881,8 @@ export default {
.upload-item-img {
display: inline-block;
height: 126px;
width: 124px;
height: 120px;
width: 90px;
border: 2px solid #e8e8e8;
box-sizing: border-box;
}
... ...
... ... @@ -20,6 +20,7 @@
<script>
import service from 'jit-service';
import _ from 'lodash';
export default {
data() {
... ... @@ -50,7 +51,7 @@ export default {
align: 'center',
width: 250,
render() {
return '<i-input v-model="row.number" :number="true"></i-input>';
return '<i-input v-model="row.number" :maxlength="6"></i-input>';
}
}
],
... ... @@ -93,6 +94,11 @@ export default {
title: '保存失败,请重试',
});
}
}).catch((err) => {
this.modal_loading = false;
if (err.code === 501) {
this.$Message.error(err.message);
}
});
},
cancel() {
... ... @@ -116,21 +122,27 @@ export default {
},
save() {
this.refreshTable();
let data = this.beforeSave();
return service.updateStorage(data);
return this.beforeSave().then((data) => {
return service.updateStorage(data);
});
},
refreshTable() {
this.table.data = this.$refs.storeTable.rebuildData;
},
beforeSave() {
return this.table.data.map((item) => {
let hasString = _.some(this.table.data, d => !/^[0-9]*$/.test(d.number));
if (hasString) {
return Promise.reject({code: 501, message: '库存只能是数字'});
}
return Promise.resolve(this.table.data.map((item) => {
return {
productSku: item.productSku,
productSkn: item.productSkn,
number: item.number
};
});
}));
}
}
};
... ...