Browse Source

Merge pull request '标准属性定义优化、客户需求管理工作台新增批量导入' (#27) from wangxy into develop

Reviewed-on: #27
Reviewed-by: Liwei <wei.li@le-it.com.cn>
pull/28/head
Liwei 3 years ago
parent
commit
fb26c5dd2c
6 changed files with 128 additions and 9 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
  5. +11
    -5
      src/views/factoryModel/standardProperties/addOrEdit.vue
  6. +1
    -1
      src/views/factoryModel/standardProperties/index.vue

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> <template>
<div v-if="isShowComponent" class="handle-right-fixed clearfix"> <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"> <el-dropdown v-if="isDropdown" trigger="click" @visible-change="handleCommand">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
<img :src="notalReadyPic" alt="">
<img :src="notalReadyPic" alt="" title="检索条件">
</span> </span>
<template #dropdown> <template #dropdown>
<div class="predict-search-container"> <div class="predict-search-container">
@ -17,14 +18,24 @@
</div> </div>
</template> </template>
</el-dropdown> </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> </div>
</template> </template>
<script> <script>
import uploadTemplate from "./upload.vue";
export default { export default {
name: "QueryComponent", name: "QueryComponent",
components: {
uploadTemplate
},
props: ["isShowComponent", "isShowAddButton","customerId","CreateModel", 'isDownload', 'isDropdown'], props: ["isShowComponent", "isShowAddButton","customerId","CreateModel", 'isDownload', 'isDropdown'],
data() { data() {
return { return {
@ -32,9 +43,17 @@ export default {
notalReadyPic: require('../../assets/img/notalready.png'), notalReadyPic: require('../../assets/img/notalready.png'),
// //
SearchId: undefined, SearchId: undefined,
isShowDialog: '',
} }
}, },
methods: { methods: {
//
handleUpload() {
this.isShowDialog = 'upload'
},
completeCallBack() {
this.isShowDialog = ''
},
// / // /
handleCommand(bool) { handleCommand(bool) {
if (bool) { if (bool) {
@ -82,6 +101,7 @@ export default {
width: 24px; width: 24px;
height: 24px; height: 24px;
cursor: pointer; cursor: pointer;
margin-left: 10px;
} }
} }
</style> </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" }, headers: { "Content-Type": "multipart/form-data" },
data: param, data: param,
}); });
export const bulkimportfile = (data) =>
service.request({
url: "/admin/ap/custdemandverhead/bulkimportfile",
method: "post",
headers: { "Content-Type": "multipart/form-data" },
data,
});
export default { export default {
get, get,
post, post,


+ 11
- 5
src/views/factoryModel/standardProperties/addOrEdit.vue View File

@ -83,7 +83,7 @@
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24">
<!-- <el-col :span="24">
<el-table <el-table
:data="formData.Valst" :data="formData.Valst"
style="width: 100%; margin-bottom: 10px" style="width: 100%; margin-bottom: 10px"
@ -112,7 +112,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-col>
</el-col> -->
</el-row> </el-row>
</el-form> </el-form>
<template #footer> <template #footer>
@ -131,7 +131,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { add, edit } from "@/server/factoryModel/standardProperties";
import { getDetails, add, edit } from "@/server/factoryModel/standardProperties";
export default { export default {
name: "editField", name: "editField",
props: { props: {
@ -147,7 +147,7 @@ export default {
loading: false, loading: false,
// //
formData: { formData: {
Valst:[],
// Valst:[],
}, },
// //
rules: { rules: {
@ -180,7 +180,13 @@ export default {
}, },
mounted() { mounted() {
if (this.isAddOrEdit == "edit") { if (this.isAddOrEdit == "edit") {
this.formData = this.item;
getDetails(this.item['Attribute-AttrCode']).then(({code, data}) => {
if (code === 200) {
if (!data.Valst)
data.Valst = []
this.formData = data
}
})
} }
}, },
methods: { methods: {


+ 1
- 1
src/views/factoryModel/standardProperties/index.vue View File

@ -143,7 +143,7 @@ export default {
}, },
// //
resetQuery() { resetQuery() {
this.queryParams.uomId = undefined;
this.queryParams.AttrCode = undefined;
this.handleQuery(); this.handleQuery();
}, },
// //


Loading…
Cancel
Save