Commit 03745322 by Kyle_Li

接口调试

parent 29dd5bb1
......@@ -70,6 +70,8 @@ const urlConfig = {
getBatchRecord: '/api-member/queryBatchRecord', // 批量积分导入-获取积分导入数据
downLoadExcelTemplate: '/api-member/downLoadExcelTemplate', // 批量积分导入-下载积分导入模板
uploadExecl: '/api-member/uploadExecl', // 批量积分导入-导入数据
queryBatchRetErrInfo: '/api-member/queryBatchRetErrInfo', // 批量积分导入-日志详情-获取数据
downloadErrorData: '/api-member/downloadErrorData', // 批量积分导入-日志详情-下载错误数据
}
const defaultUrl = Object.assign({}, urlConfig);
......
......@@ -28,8 +28,7 @@
<el-button type="primary" @click="openDialogImport">新建导入</el-button>
</div>
<el-table
:data="tableData"
style="width: 100%">
:data="tableData">
<el-table-column
prop="createTime"
label="导入时间">
......@@ -42,21 +41,21 @@
prop="total"
label="层预计导入数量">
<template slot-scope="{ row }">
{{ row.total || '--' }}
{{ row.total || '0' }}
</template>
</el-table-column>
<el-table-column
prop="succeedNum"
label="成功数">
<template slot-scope="{ row }">
{{ row.succeedNum || '--' }}
{{ row.succeedNum || '0' }}
</template>
</el-table-column>
<el-table-column
prop="errorNum"
label="失败数">
<template slot-scope="{ row }">
{{ row.errorNum || '--' }}
{{ row.errorNum || '0' }}
</template>
</el-table-column>
<el-table-column
......@@ -77,7 +76,8 @@
fixed="right"
label="操作">
<template slot-scope="scope">
<el-button @click="logDetails(scope.row.batchId, scope.row.batchType)" type="text">日志详情</el-button>
<el-button v-if="scope.row.errorNum > 0" @click="logDetails(scope.row)" type="text">日志详情</el-button>
<div v-else> -- </div>
</template>
</el-table-column>
</el-table>
......@@ -135,9 +135,11 @@
:before-upload="beforeUpload"
:limit="1"
:data="expendParams"
:with-credentials="true"
:on-error="handleError"
:on-exceed="handelExceed"
:on-change="handleChange"
:on-success="handleSuccess"
:auto-upload="false">
<div slot="trigger">
<div class="importBox">
......@@ -188,7 +190,7 @@
</p>
<p class="successCon">导入完成后可点击批量导入记录查看结果</p>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="importTable" :disable="load">确 定</el-button>
<el-button type="primary" @click="dialogSuccess = false" :disable="load">确 定</el-button>
</span>
</el-dialog>
</div>
......@@ -221,7 +223,9 @@ export default {
importValue: '',
fileList: [],
},
// 请求数据
expendParams: {
requestProject: 'member',
batchType: ''
},
rules: {
......@@ -256,16 +260,23 @@ export default {
} else {
date = this.pickDate
}
let type;
if(this.importType) {
type = Number(this.importType)
} else {
type = ''
}
doFetchqs(url.getBatchRecord, {
beginTime: date[0],
endTime: date[1],
batchType: Number(this.importType)
batchType: type
}).then(res => {
if (res.data.errorCode == 0) {
let value = res.data.result;
this.page.totalCount = value.totalCount;
this.tableData = value.result;
// console.log(this.tableData)
console.log(this.tableData)
} else {
checkFalse(res.data.message);
}
......@@ -293,13 +304,12 @@ export default {
this.getIntegral();
},
// 跳转详情
logDetails(id, type) {
this.$router.push({ path: '/bulkLogsDetail', query: { id: id, type: 666 } });
logDetails(data) {
this.$router.push({ path: '/bulkLogsDetail', query: { data } });
},
// 打开dialog
openDialogImport() {
this.formByImport.importValue = '';
this.fileList = [];
this.dialogImport = true;
},
// 表单清除
......@@ -314,31 +324,21 @@ export default {
importTable() {
this.$refs.formByImport.validateField('importValue' , err => {
if(!err) {
// let params = new FormData(); //创建form对象
// params.append('file', this.formByImport.fileList[0]);
// params.append('batchType', this.formByImport.importValue);
// let params = {
// file: this.formByImport.fileList[0],
// batchType: this.formByImport.importValue
// }
// this.expendParams = { : this.formByImport.importValue };
console.log(this.expendParams);
this.$refs.memberUpload.submit();
// doFetchqs(url.uploadExecl, params).then(res => {
// if(res.status == '200') {
// } else {
// checkFalse()
// }
// })
// this.dialogImport = false
// this.dialogSuccess = true;
// console.log(this.formByImport.fileList);
if(this.formByImport.fileList.length) {
this.load = true;
this.$refs.memberUpload.submit();
// this.getIntegral();
} else {
checkFalse('请上传积分数据');
}
}
})
},
// 上传验证
beforeUpload(file) {
let _this = this;
// let _this = this;
const isLt2M = file.size / 1024 / 1024 < 10;
const types = file.name.split(".")[1];
const fileType = ["xlsx", "xlc", "xlm", "xls", "xlt", "xlw", "csv"].some(
item => item === types
......@@ -347,6 +347,10 @@ export default {
this.$message.warning("请上传excel表格");
return false;
}
if(!isLt2M){
this.$message.error('上传模板大小不能超过 10MB')
return false;
}
// console.log(file)
// var reader = new FileReader();
// console.log(fileReader)
......@@ -400,13 +404,15 @@ export default {
// }
// }
},
// handleChange(val) {
handleChange(file, fileList) {
// if(this.rows > 10000) {
// console.log(1)
// this.$message.warning('数据超过10000,请重新上传');
// this.formByImport.fileList.pop()
// }
// },
this.formByImport.fileList = fileList;
// console.log(fileList, this.formByImport.fileList)
},
handelExceed() {
this.$message.warning('超出最大上传数');
},
......@@ -415,8 +421,16 @@ export default {
},
onDialogSuccessClosed() {
// 更新表单
this.getIntegral();
},
handleSuccess() {
checkSuccess('上传成功');
this.dialogImport = false;
this.load = false;
this.dialogSuccess = true;
this.$refs.memberUpload.clearFiles();
this.getIntegral();
}
},
created() {
this.getIntegral();
......@@ -446,6 +460,9 @@ export default {
<style lang="stylus" scoped>
#bulkIntegral {
// height: 100%;
.el-table{
width:99.9%;
}
.content {
padding: 22px 24px;
.contentInfo {
......
......@@ -4,36 +4,41 @@
<div class="content">
<div class="contentInfo">
<div class="flex">
<span class="headerTips">总条数:1000条,成功导入995条,<span class="headerTipsError">错误5</span></span>
<span class="headerTips">总条数:{{ count.all }} 条,成功导入 {{ count.success }} 条,<span class="headerTipsError">错误 {{ count.error }} </span></span>
<el-button type="primary" @click="exportExcel"><i class="iconfont icon-icon_yunxiazai"></i> 导出</el-button>
</div>
<el-table
:data="tableData"
style="width: 100%">
:data="tableData">
<el-table-column
prop="date"
prop="sequence"
label="序号">
</el-table-column>
<el-table-column
prop="name"
prop="errorCause"
label="错误提示">
</el-table-column>
<el-table-column
prop="province"
prop="cardNum"
label="会员卡号">
</el-table-column>
<el-table-column
prop="city"
prop="opIntegral"
label="变更额度">
</el-table-column>
<el-table-column
v-if="integralType == '积分增加'"
v-if="isShow"
prop="address"
label="成本主体">
<template slot-scope="{ row }">
{{ operation || '——' }}
</template>
</el-table-column>
<el-table-column
prop="zip"
prop="remark"
label="原因备注">
<template slot-scope="{ row }">
{{ row.remark || '——' }}
</template>
</el-table-column>
</el-table>
......@@ -58,12 +63,17 @@
import { doFetch, doFetchqs } from "../../components/axios/api";
import NavPath from "@/common/navbar/navbar.vue";
import url from "../../components/axios/url";
import {
checkFalse,
checkStatus,
checkSuccess
} from "../../../static/js/checkStatus";
export default {
data() {
return {
navpath: [{ name: "首页", path: "" }, { name: "微信会员", path: "" }, { name: "批量导入", path: "" }, { name: "日志详情", path: "" }],
tableData: [{ name: 123, id: 123 }],
tableData: [],
// 换页
page: {
currentPage: 1,
......@@ -72,17 +82,60 @@ export default {
},
// 判断积分类型
integralType: '积分扣除',
// 条数
count: {
all: 0,
success: 0,
error: 0
},
batchId: '',
batchType: '',
isShow: false,
}
},
methods: {
// 导出
exportExcel() {},
exportExcel() {
window.location.href = `${url.downloadErrorData}?requestProject=member&batchType=${this.batchType}&batchId=${this.batchId}` ;
},
// 获取数据
getLogsDetail() {},
getLogsDetail() {
let params = {
batchId: this.batchId,
batchType: this.batchType
}
doFetchqs(url.queryBatchRetErrInfo, params).then(res => {
if(res.data.errorCode == 0) {
let value = res.data.result;
// console.log(value)
this.page.totalCount = value.totalCount;
this.tableData = value.result;
} else {
checkFalse(res.data.message)
}
}).catch(err => {
checkStatus(err);
})
},
},
created() {
console.log(this.$route.query.id)
console.log(this.$route.query.type)
if(!this.$route.query.data) {
checkFalse('123')
} else {
const { batchId, batchType, total, succeedNum, errorNum, operaUerName } = this.$route.query.data;
this.batchId = batchId;
this.batchType = batchType;
console.log(this.batchType)
if(batchType == 11) {
this.isShow = true;
this.operation = operaUerName
}
this.count.all = total;
this.count.success = succeedNum;
this.count.error = errorNum;
console.log(this.$route.query.data)
this.getLogsDetail();
}
},
components: {
NavPath
......@@ -91,6 +144,9 @@ export default {
</script>
<style lang="scss" scoped>
#bulkLogsDetail {
.el-table{
width:99.9%;
}
.content {
padding: 22px 24px;
.contentInfo {
......
......@@ -831,7 +831,7 @@ export default {
handleFocusBatch() {
if (this.batchValue == "bulkIntegral") {
this.batchValue = '';
this.$router.push({ path: '/bulkIntegral', query: { ids: 123 } });
this.$router.push({ path: '/bulkIntegral' });
} else if(this.multipleList.length < 1) {
this.batchValue = '';
checkFalse('请勾选会员');
......
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