|
@@ -50,8 +50,8 @@
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <!-- <el-button type="primary" size="medium" @click="excelImportShow = true">导入数据</el-button> -->
|
|
|
|
- <el-button type="primary" size="medium" @click="exportExcel">导出当前数据</el-button>
|
|
|
|
|
|
+ <el-button type="success" size="medium" @click="excelImportShow = true" plain>导入数据</el-button>
|
|
|
|
+ <el-button type="primary" size="medium" @click="exportExcel" plain>导出当前数据</el-button>
|
|
<!-- <el-button type="primary" size="medium" plain @click="swiperShow = true">轮播事件</el-button> -->
|
|
<!-- <el-button type="primary" size="medium" plain @click="swiperShow = true">轮播事件</el-button> -->
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
@@ -211,15 +211,23 @@
|
|
<el-button size="medium" type="primary" @click="downloadTemplate" plain>下载模板</el-button>
|
|
<el-button size="medium" type="primary" @click="downloadTemplate" plain>下载模板</el-button>
|
|
</div>
|
|
</div>
|
|
<div class="margin-bottom">
|
|
<div class="margin-bottom">
|
|
- <el-upload :limit="1" :headers="ATOKEN" ref="upload1" :action="action" :data="{ type: 'integral' }" :on-success="handlePictureCardPreview" :before-upload="beforeFilesUpload">
|
|
|
|
|
|
+ <el-upload
|
|
|
|
+ :limit="1"
|
|
|
|
+ :headers="ATOKEN"
|
|
|
|
+ ref="upload"
|
|
|
|
+ :action="action"
|
|
|
|
+ :on-remove="handleRemove"
|
|
|
|
+ :on-success="handlePictureCardPreview"
|
|
|
|
+ :file-list="fileList"
|
|
|
|
+ :before-upload="beforeFilesUpload">
|
|
<p>2、上传积分事件数据Excel表<el-button style="margin-left: 10px;" size="medium" type="primary" plain>选择文件</el-button></p>
|
|
<p>2、上传积分事件数据Excel表<el-button style="margin-left: 10px;" size="medium" type="primary" plain>选择文件</el-button></p>
|
|
</el-upload>
|
|
</el-upload>
|
|
</div>
|
|
</div>
|
|
- <div>3、选择文件后点击下方【上传】按钮</div>
|
|
|
|
|
|
+ <!-- <div>3、选择文件后点击下方【上传】按钮</div> -->
|
|
</div>
|
|
</div>
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="close_import" size="medium">取 消</el-button>
|
|
<el-button @click="close_import" size="medium">取 消</el-button>
|
|
- <el-button type="primary" @click="uploadFile(1)" size="medium" :loading="update_btn">上传</el-button>
|
|
|
|
|
|
+ <!-- <el-button type="primary" @click="uploadFile()" size="medium" :loading="update_btn">上传</el-button> -->
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
@@ -262,8 +270,9 @@ import noData from '@/components/noData';
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- action:process.env.VUE_APP_BASE_API+'/api/upload/excel',
|
|
|
|
- ATOKEN: { 'A-TOKEN':this.$getToken()},
|
|
|
|
|
|
+ action:process.env.VUE_APP_BASE_API+'api/integral/import',
|
|
|
|
+ ATOKEN: { 'A-TOKEN': this.$getToken(),'Accept':'application/vnd.test.v2+json' },
|
|
|
|
+
|
|
loading: false,
|
|
loading: false,
|
|
swiperShow: false,
|
|
swiperShow: false,
|
|
swiperPageList: [{ value: '10' }, { value: '30' }, { value: '50' }],
|
|
swiperPageList: [{ value: '10' }, { value: '30' }, { value: '50' }],
|
|
@@ -288,7 +297,8 @@ export default {
|
|
excelImportShow: false,
|
|
excelImportShow: false,
|
|
update_btn: false,
|
|
update_btn: false,
|
|
error_list: [],
|
|
error_list: [],
|
|
- importErrorInfoShow: false
|
|
|
|
|
|
+ importErrorInfoShow: false,
|
|
|
|
+ fileList: [],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
components: { noData },
|
|
components: { noData },
|
|
@@ -321,9 +331,9 @@ export default {
|
|
dept_name(val, old_val) {
|
|
dept_name(val, old_val) {
|
|
this.formData.page = 1;
|
|
this.formData.page = 1;
|
|
if (val.length !== 0) {
|
|
if (val.length !== 0) {
|
|
- this.formData.dept_id = val[val.length - 1];
|
|
|
|
|
|
+ this.formData.dept_ids = val[val.length - 1];
|
|
} else {
|
|
} else {
|
|
- this.formData.dept_id == 0;
|
|
|
|
|
|
+ this.formData.dept_ids == 0;
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
this.$refs.dept.dropDownVisible = false;
|
|
this.$refs.dept.dropDownVisible = false;
|
|
@@ -332,23 +342,31 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ handleRemove(file, fileList) {
|
|
|
|
+ // if (fileList !== null && fileList.length != 0) {
|
|
|
|
+ // this.import_btn_show = true;
|
|
|
|
+ // } else {
|
|
|
|
+ // this.import_btn_show = false;
|
|
|
|
+ // }
|
|
|
|
+ },
|
|
|
|
+ // 导入相关
|
|
|
|
+ close_import() {
|
|
|
|
+ this.excelImportShow = false;
|
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
|
+ },
|
|
// keyword
|
|
// keyword
|
|
keyWordSelect() {
|
|
keyWordSelect() {
|
|
this.formData.page = 1;
|
|
this.formData.page = 1;
|
|
this.get_integral_list(this.formData);
|
|
this.get_integral_list(this.formData);
|
|
},
|
|
},
|
|
downloadTemplate() {
|
|
downloadTemplate() {
|
|
- window.open(process.env.VUE_APP_BASE_API + 'api/download/integral/template');
|
|
|
|
- },
|
|
|
|
- // 文件上传
|
|
|
|
- close_import() {
|
|
|
|
- this.excelImportShow = false;
|
|
|
|
|
|
+ window.open('https://ding.insys.g107.com/file/integral.xlsx');
|
|
},
|
|
},
|
|
uploadFile() {
|
|
uploadFile() {
|
|
let params = {};
|
|
let params = {};
|
|
params.file = this.file;
|
|
params.file = this.file;
|
|
this.update_btn = true;
|
|
this.update_btn = true;
|
|
- this.$axios("post",'/api/integral/import', params).then(res => {
|
|
|
|
|
|
+ this.$axios("post",'/api/integral/import', params,'v2').then(res => {
|
|
if (res.data.code == 1) {
|
|
if (res.data.code == 1) {
|
|
if (res.data.data.error.length == 0) {
|
|
if (res.data.data.error.length == 0) {
|
|
this.$message({ type: 'success', message: '导入成功' });
|
|
this.$message({ type: 'success', message: '导入成功' });
|
|
@@ -361,17 +379,35 @@ export default {
|
|
} else {
|
|
} else {
|
|
this.$message({ type: 'error', message: res.data.msg });
|
|
this.$message({ type: 'error', message: res.data.msg });
|
|
}
|
|
}
|
|
- })
|
|
|
|
- .finally(() => {
|
|
|
|
|
|
+ }).finally(() => {
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
this.update_btn = false;
|
|
this.update_btn = false;
|
|
}, 3000);
|
|
}, 3000);
|
|
});
|
|
});
|
|
},
|
|
},
|
|
handlePictureCardPreview(response) {
|
|
handlePictureCardPreview(response) {
|
|
- console.log(response);
|
|
|
|
if (response.code == 1) {
|
|
if (response.code == 1) {
|
|
- this.file = response.data;
|
|
|
|
|
|
+ if(response.data.error.length>0){
|
|
|
|
+ var htmls=response.data.error;
|
|
|
|
+ var str="<div class='red'></div>";
|
|
|
|
+ htmls.forEach(item=>{
|
|
|
|
+ str+=`<div>${item}</div>`;
|
|
|
|
+ })
|
|
|
|
+ this.close_import();
|
|
|
|
+ this.$notify.error({
|
|
|
|
+ title: '导入错误',
|
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
|
+ message: str,
|
|
|
|
+ duration:0,
|
|
|
|
+ offset:50,
|
|
|
|
+ customClass:'notifyBox',
|
|
|
|
+ });
|
|
|
|
+ }else{
|
|
|
|
+ this.file = response.data;
|
|
|
|
+ this.$message.success({ message: response.msg });
|
|
|
|
+ this.keyWordSelect();
|
|
|
|
+ this.close_import();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
beforeFilesUpload(file) {
|
|
beforeFilesUpload(file) {
|
|
@@ -391,7 +427,7 @@ export default {
|
|
this.formData.page_size +
|
|
this.formData.page_size +
|
|
(this.formData.rule_id ? '&rule_id=' + this.formData.rule_id : '') +
|
|
(this.formData.rule_id ? '&rule_id=' + this.formData.rule_id : '') +
|
|
(this.formData.pt_id ? '&pt_id=' + this.formData.pt_id : '') +
|
|
(this.formData.pt_id ? '&pt_id=' + this.formData.pt_id : '') +
|
|
- (this.formData.dept_id ? '&dept_ids=' + this.formData.dept_id : '') +
|
|
|
|
|
|
+ (this.formData.dept_ids ? '&dept_ids=' + this.formData.dept_ids : '') +
|
|
(this.formData.start_day ? '&start_day=' + this.formData.start_day : '') +
|
|
(this.formData.start_day ? '&start_day=' + this.formData.start_day : '') +
|
|
(this.formData.end_day ? '&end_day=' + this.formData.end_day : '') +
|
|
(this.formData.end_day ? '&end_day=' + this.formData.end_day : '') +
|
|
(this.formData.keyword ? '&keyword=' + this.formData.keyword : ''),
|
|
(this.formData.keyword ? '&keyword=' + this.formData.keyword : ''),
|
|
@@ -437,8 +473,6 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
get_integral_list(data) {
|
|
get_integral_list(data) {
|
|
- data.dept_ids = data.dept_id;
|
|
|
|
- delete data.dept_id;
|
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
this.$axios('get','/api/integral/statistics/integral',data).then(res => {
|
|
this.$axios('get','/api/integral/statistics/integral',data).then(res => {
|
|
if (res.data.code == 1) {
|
|
if (res.data.code == 1) {
|