Browse Source

标准属性定义优化、客户需求管理工作台新增批量导入

pull/27/head
wangxy 3 years ago
parent
commit
ef90cd8782
4 changed files with 116 additions and 3 deletions
  1. BIN
      src/assets/img/import.png
  2. +23
    -3
      src/components/queryComponent/index.vue
  3. +86
    -0
      src/components/queryComponent/upload.vue
  4. +7
    -0
      src/server/api.js

BIN
src/assets/img/import.png View File

Before After
Width: 24  |  Height: 24  |  Size: 1.3 KiB

+ 23
- 3
src/components/queryComponent/index.vue View File

@ -1,8 +1,9 @@
<template>
<div v-if="isShowComponent" class="handle-right-fixed clearfix">
<img v-if="isShowAddButton" @click="handleUpload" src="../../assets/img/import.png" alt="" title="批量导入">
<el-dropdown v-if="isDropdown" trigger="click" @visible-change="handleCommand">
<span class="el-dropdown-link">
<img :src="notalReadyPic" alt="">
<img :src="notalReadyPic" alt="" title="检索条件">
</span>
<template #dropdown>
<div class="predict-search-container">
@ -17,14 +18,24 @@
</div>
</template>
</el-dropdown>
<img v-if="isShowAddButton" @click="handleNew" src="../../assets/img/add.png" alt="">
<img v-if="isDownload" @click="download" src="../../assets/img/download.png" alt="">
<img v-if="isShowAddButton" @click="handleNew" src="../../assets/img/add.png" alt="" title="新增">
<img v-if="isDownload" @click="download" src="../../assets/img/download.png" alt="" title="下载">
<!-- 上传 -->
<uploadTemplate
v-if="isShowDialog === 'upload'"
:item="item"
v-model:isShowDialog="isShowDialog"
@editCallBack="completeCallBack" />
</div>
</template>
<script>
import uploadTemplate from "./upload.vue";
export default {
name: "QueryComponent",
components: {
uploadTemplate
},
props: ["isShowComponent", "isShowAddButton","customerId","CreateModel", 'isDownload', 'isDropdown'],
data() {
return {
@ -32,9 +43,17 @@ export default {
notalReadyPic: require('../../assets/img/notalready.png'),
//
SearchId: undefined,
isShowDialog: '',
}
},
methods: {
//
handleUpload() {
this.isShowDialog = 'upload'
},
completeCallBack() {
this.isShowDialog = ''
},
// /
handleCommand(bool) {
if (bool) {
@ -82,6 +101,7 @@ export default {
width: 24px;
height: 24px;
cursor: pointer;
margin-left: 10px;
}
}
</style>


+ 86
- 0
src/components/queryComponent/upload.vue View File

@ -0,0 +1,86 @@
<template>
<el-dialog :title="title" model-value width="50%" :close-on-click-modal="false" :before-close="cancel">
<input
type="file"
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, xls, xlsx"
@change="previewUpload"
>
<el-button
type="primary"
:loading="uploadLoading"
icon="el-icon-upload"
size="mini"
@click="uploadEvent"
>上传</el-button>
</el-dialog>
</template>
<script>
import { bulkimportfile } from "@/server/api.js";
export default {
name: 'editField',
props: {
item: {
default: null,
}
},
data() {
return {
title: '导入', //
uploadLoading: false,
excel: '',
}
},
methods: {
cancel() { //
this.$emit('update:isShowDialog','')
},
//
previewUpload(file) {
this.excle = file.target.files[0]
},
//
uploadEvent() {
this.uploadLoading = true
if (this.excle === null || this.excle === '' || this.excle === undefined) {
this.$message({
showClose: true,
duration: 2000,
message: '请选择文件',
type: 'error'
})
this.uploadLoading = false
} else {
const uploadData = new FormData()
uploadData.append('upload', this.excle)
bulkimportfile(uploadData).then(res => {
this.uploadLoading = false
if (res.code === 200) {
this.$message({
showClose: true,
duration: 2000,
message: '导入成功',
type: 'success'
})
this.$emit('editCallBack', true)
} else {
this.$message({
showClose: true,
duration: 2000,
message: res.msg,
type: 'error'
})
}
}).catch((res) => {
this.uploadLoading = false
this.$message({
showClose: true,
duration: 2000,
message: res.msg,
type: 'error'
})
})
}
},
}
}
</script>

+ 7
- 0
src/server/api.js View File

@ -62,6 +62,13 @@ export const uploadExcel = (param, customerId, versionId) =>
headers: { "Content-Type": "multipart/form-data" },
data: param,
});
export const bulkimportfile = (data) =>
service.request({
url: "/admin/ap/custdemandverhead/bulkimportfile",
method: "post",
headers: { "Content-Type": "multipart/form-data" },
data,
});
export default {
get,
post,


Loading…
Cancel
Save