|
|
@ -97,6 +97,43 @@ |
|
|
|
</div> |
|
|
|
<specialrebatemanagementAdd v-show="viewState == 2 || viewState == 3" ref="divAdd" @doback="resetState" @reloadlist="getList"/> |
|
|
|
<specialrebatemanagementInfo v-show="viewState == 4" ref="divInfo" @doback="resetState"/> |
|
|
|
<el-dialog :visible.sync="dialogVisible" width="70%" :show-close="false"> |
|
|
|
<div> |
|
|
|
<el-button style="font-weight: bold" size="small" type="text" @click="downLoad">下载专项返利模板</el-button> |
|
|
|
</div> |
|
|
|
<el-card class="box-card"> |
|
|
|
<div> |
|
|
|
<el-upload |
|
|
|
ref="upload" |
|
|
|
class="upload-demo" |
|
|
|
accept=".xls" |
|
|
|
name="file" |
|
|
|
:action="updateAction" |
|
|
|
:on-success="handleSuccess" |
|
|
|
:on-remove="handleRemove" |
|
|
|
:file-list="fileList" |
|
|
|
:auto-upload="false" |
|
|
|
:multiple="false" |
|
|
|
:limit="1" |
|
|
|
:data="uploadData" |
|
|
|
:headers="headers" |
|
|
|
> |
|
|
|
<el-button slot="trigger" size="small" type="primary">选取文件</el-button> |
|
|
|
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传</el-button> |
|
|
|
</el-upload> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<h3>文件上传结果</h3> |
|
|
|
<el-card class="box-card"> |
|
|
|
<div>{{ uploadResultMesssage }}</div> |
|
|
|
</el-card> |
|
|
|
</div> |
|
|
|
</el-card> |
|
|
|
<div slot="footer" class="dialog-footer" style="text-align: center"> |
|
|
|
<el-button type="primary" size="small" @click="handleConfirm">确定</el-button> |
|
|
|
<el-button size="small" @click="dialogVisible = false">取消</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
@ -129,6 +166,13 @@ export default { |
|
|
|
btnKey: 'toAdd', |
|
|
|
btnLabel: '新增' |
|
|
|
}, |
|
|
|
{ |
|
|
|
type: 'success', |
|
|
|
size: 'small', |
|
|
|
icon: 'Import', |
|
|
|
btnKey: 'doImport', |
|
|
|
btnLabel: '导入' |
|
|
|
}, |
|
|
|
{ |
|
|
|
type: 'success', |
|
|
|
size: 'small', |
|
|
@ -211,7 +255,19 @@ export default { |
|
|
|
size: 5, |
|
|
|
total: 0 |
|
|
|
}, |
|
|
|
rules: {} |
|
|
|
rules: {}, |
|
|
|
dialogVisible: false, |
|
|
|
updateAction: process.env.VUE_APP_BASE_API + '/scm/v1/scmspecialrebate/getExcelInfo', |
|
|
|
fileList: [], |
|
|
|
uploadResultMesssage: '', |
|
|
|
uploadData: { |
|
|
|
sid: '', |
|
|
|
userSid: '', |
|
|
|
orgPath: '' |
|
|
|
}, |
|
|
|
headers: { |
|
|
|
token: window.sessionStorage.getItem('token') |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
@ -250,6 +306,9 @@ export default { |
|
|
|
case 'toAdd': |
|
|
|
this.toAdd() |
|
|
|
break |
|
|
|
case 'doImport': |
|
|
|
this.doImport() |
|
|
|
break |
|
|
|
case 'doExport': |
|
|
|
this.doExport() |
|
|
|
break |
|
|
@ -370,6 +429,63 @@ export default { |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
}, |
|
|
|
doImport() { |
|
|
|
this.dialogVisible = true |
|
|
|
this.fileList = [] |
|
|
|
this.uploadResultMesssage = '' |
|
|
|
}, |
|
|
|
downLoad() { |
|
|
|
const loading = this.$loading({ |
|
|
|
lock: true, |
|
|
|
text: 'Loading', |
|
|
|
spinner: 'el-icon-loading', |
|
|
|
background: 'rgba(0, 0, 0, 0.7)' |
|
|
|
}) |
|
|
|
req.downloadExcel().then((resp) => { |
|
|
|
loading.close() |
|
|
|
const blob = new Blob([resp], { |
|
|
|
type: 'application/vnd.ms-excel' |
|
|
|
}) |
|
|
|
const fileName = '专项返利模版' + '.xls' |
|
|
|
const elink = document.createElement('a') |
|
|
|
elink.download = fileName |
|
|
|
elink.style.display = 'none' |
|
|
|
elink.href = URL.createObjectURL(blob) |
|
|
|
document.body.appendChild(elink) |
|
|
|
elink.click() |
|
|
|
URL.revokeObjectURL(elink.href) |
|
|
|
document.body.removeChild(elink) |
|
|
|
}).catch(() => { |
|
|
|
loading.close() |
|
|
|
}) |
|
|
|
}, |
|
|
|
handleRemove() { |
|
|
|
this.uploadResultMesssage = '' |
|
|
|
}, |
|
|
|
submitUpload() { |
|
|
|
this.uploadData.userSid = window.sessionStorage.getItem('userSid') |
|
|
|
this.uploadData.orgPath = window.sessionStorage.getItem('defaultOrgPath') |
|
|
|
this.$refs.upload.submit() |
|
|
|
}, |
|
|
|
handleSuccess(resp, file, fileList) { |
|
|
|
const _this = this |
|
|
|
if (resp.success) { |
|
|
|
_this.uploadResultMesssage = resp.msg |
|
|
|
} else { |
|
|
|
_this.uploadResultMesssage = resp.msg |
|
|
|
} |
|
|
|
}, |
|
|
|
handleConfirm() { |
|
|
|
if (this.uploadResultMesssage === '') { |
|
|
|
this.$message({ showClose: true, type: 'error', message: '请先上传专项返利模版' }) |
|
|
|
return |
|
|
|
} else { |
|
|
|
this.dialogVisible = false |
|
|
|
this.uploadData.userSid = '' |
|
|
|
this.uploadData.orgPath = '' |
|
|
|
this.getList() |
|
|
|
} |
|
|
|
}, |
|
|
|
doExport() { |
|
|
|
const loading = this.$loading({ |
|
|
|
lock: true, |
|
|
|