...
|
...
|
@@ -53,15 +53,25 @@ |
|
|
</filter-item>
|
|
|
|
|
|
<filter-item>
|
|
|
<Button type="primary" @click="upload">开始上传</Button>
|
|
|
<Button type="primary" :loading="loading" @click="upload">开始上传</Button>
|
|
|
</filter-item>
|
|
|
</layout-filter>
|
|
|
|
|
|
<layout-list>
|
|
|
<div v-if="importInfo">
|
|
|
<div v-if="importInfo.length !== 0">
|
|
|
<div class="error-title">导入错误记录</div>
|
|
|
<div class="error-content" v-for="e in importInfo"> {{e}} </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</layout-list>
|
|
|
</layout-body>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {SelectCategory, SelectBrand} from 'components/select';
|
|
|
import _ from 'lodash';
|
|
|
import LayoutList from '../../../components/global/layout/layout-list';
|
|
|
|
|
|
export default {
|
|
|
data() {
|
...
|
...
|
@@ -109,7 +119,9 @@ |
|
|
fieldSpan: 18,
|
|
|
model: ''
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
loading: false,
|
|
|
importInfo: null
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
...
|
...
|
@@ -132,15 +144,25 @@ |
|
|
if (files.length !== 1) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
this.importInfo = null;
|
|
|
this.xlsxFile = files[0].name;
|
|
|
},
|
|
|
upload() {
|
|
|
this.$refs.xlsxUpload.upload({brandId: this.brandId});
|
|
|
this.loading = true;
|
|
|
this.$refs.xlsxUpload.upload({brandId: this.brandId})
|
|
|
.then(() => {
|
|
|
this.loading = false;
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
onSuccess(data) {
|
|
|
if (data.code === 200) {
|
|
|
if (_.has(data.data, 'failFileReason')) {
|
|
|
this.$Message.error('部分导入成功');
|
|
|
this.importInfo = data.data.failFileReason;
|
|
|
} else {
|
|
|
this.$Message.info('全部导入成功');
|
|
|
}
|
...
|
...
|
@@ -149,7 +171,7 @@ |
|
|
}
|
|
|
},
|
|
|
onError() {
|
|
|
|
|
|
this.loading = false;
|
|
|
},
|
|
|
onProgress() {
|
|
|
|
...
|
...
|
@@ -159,13 +181,14 @@ |
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
LayoutList,
|
|
|
SelectCategory,
|
|
|
SelectBrand
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
<style lang="scss" scoped>
|
|
|
.import-title {
|
|
|
font-size: 15px;
|
|
|
font-weight: bold;
|
...
|
...
|
@@ -175,4 +198,20 @@ |
|
|
margin-bottom: 10px;
|
|
|
margin-top: 10px;
|
|
|
}
|
|
|
|
|
|
.error-title {
|
|
|
color: red;
|
|
|
font-size: 15px;
|
|
|
font-weight: bold;
|
|
|
background-color: #fafafa;
|
|
|
height: 40px;
|
|
|
line-height: 40px;
|
|
|
margin-bottom: 10px;
|
|
|
margin-top: 10px;
|
|
|
}
|
|
|
|
|
|
.error-content {
|
|
|
color: red;
|
|
|
line-height: 25px;
|
|
|
}
|
|
|
</style> |
...
|
...
|
|