Authored by htoooth

fix

... ... @@ -54,7 +54,7 @@ export default {
>
<div class="upload-item-img">
<img v-if="row.goodsColorImage.value"
:src="row.goodsColorImage.value" alt="" width="88px" height="118px">
:src="row.goodsColorImage.value" alt="" width="120px" height="122px">
</div>
<div>
<file-upload :id="{index: ${index}}"
... ...
... ... @@ -209,8 +209,8 @@ export default {
if (!Number.isInteger(value)) {
callback(new Error('请输入整数,不能有小数点'));
} else if (value > 100000) {
callback(new Error('价格不能大于6位'));
} else if (value > 10000) {
callback(new Error('价格不能大于5位'));
} else {
callback();
... ... @@ -272,7 +272,7 @@ export default {
>
<div class="upload-item-img">
<img v-if="row.goodsColorImage.value"
:src="row.goodsColorImage.value" alt="" width="88px" height="118px">
:src="row.goodsColorImage.value" alt="" width="120px" height="122px">
</div>
<div>
<file-upload :id="{index: ${index}}"
... ... @@ -881,8 +881,8 @@ export default {
.upload-item-img {
display: inline-block;
height: 120px;
width: 90px;
height: 126px;
width: 124px;
border: 2px solid #e8e8e8;
box-sizing: border-box;
}
... ...
... ... @@ -42,7 +42,7 @@ export default {
align: 'center',
width: 250,
render(row) {
return `${row.factoryGoodsName}/${row.sizeName}`
return `${row.factoryGoodsName}/${row.sizeName}`;
}
},
{
... ... @@ -51,7 +51,7 @@ export default {
align: 'center',
width: 250,
render() {
return '<i-input v-model="row.number" :maxlength="6"></i-input>';
return '<i-input v-model="row.number" :maxlength="5"></i-input>';
}
}
],
... ... @@ -136,6 +136,12 @@ export default {
return Promise.reject({code: 501, message: '库存只能是数字'});
}
let gtMax = _.some(this.table.data, d => +d.number > 30000);
if (gtMax) {
return Promise.reject({code: 501, message: '库存应小于 60000'});
}
return Promise.resolve(this.table.data.map((item) => {
return {
productSku: item.productSku,
... ...
... ... @@ -27,7 +27,7 @@
</ul>
</div>
</Form-item>
</Form>
</Form>
</div>
<div slot="footer" style="text-align: center">
... ... @@ -38,6 +38,15 @@
</template>
<script>
const ERROR = {
sknNotInShop: '',
skuNotInSkn: '',
sknNotExist: '',
skuNotExist: '',
storageNumError: ''
};
export default {
data() {
return {
... ... @@ -56,14 +65,20 @@
if (result.code === 200) {
this.$Notice.success({
title: '更新库存成功',
title: '导入成功',
});
this.$emit('on-success');
this.close();
} else if (result.code === 500) {
this.$Notice.error({
title: '导入失败',
content: result.message
});
} else {
this.$Notice.error({
title: '保存失败,请重试',
title: '导入失败',
content: result.message
});
}
},
... ...
... ... @@ -85,6 +85,10 @@ class FileController extends Context {
let file = req.files && req.files.file;
return this.xlsxService.handle(file.path).then((result) => {
if (result.code === 500) {
return res.json(result);
}
req.body = result.body;
req.url = result.path;
... ...
... ... @@ -29,7 +29,11 @@ class XlsxService extends Context {
let data = _.first(jsonArray);
if (!data) {
return Promise.reject(new Error('数据为空'));
return {code: 500, message: '数据为空'};
}
if (data.length > 1000) {
return {code: 500, message: '数据超出限制'};
}
return this.postJitStore(data);
... ...