产品定义原始完工

This commit is contained in:
DESKTOP-H2PAFLR\Administrator
2023-08-10 11:33:34 +08:00
parent 414c1ac2a8
commit a332e09daf
6 changed files with 142 additions and 8 deletions

View File

@@ -26,6 +26,9 @@
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExcel_export">导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-download" size="mini" @click="handleExcel_import">导入</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -102,6 +105,35 @@
<el-button @click="exportopen = false"> </el-button>
</div>
</el-dialog>
<!-- 产品上传对话框 -->
<el-dialog title="上传产品" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<div class="el-upload__tip" slot="tip"><el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的设备数据</div>
<span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板</el-link>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@@ -115,6 +147,7 @@ import {
delproduct,
exportProduct,
} from '@/api/basisManagement/productEfinition.js'
import { getToken } from '@/utils/auth'
import { debounce } from '@/utils'
export default {
@@ -198,6 +231,21 @@ export default {
},
],
},
//上传配置
upload: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: '上传',
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: 'Bearer ' + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + '/mes/md/product/importExcel',
},
}
},
created() {
@@ -221,8 +269,8 @@ export default {
this.open = true
},
handleUpdate(row) {
debugger
this.dmlform.productUnitName = '22222222222222222'
this.reset()
this.open = true
this.title = '修改'
@@ -379,6 +427,35 @@ export default {
handleProcessrouteNameSelect(row) {
this.dmlform.Processroute = row.measureId
},
//导入excel
handleExcel_import() {
this.upload.open = true
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false
this.upload.isUploading = false
this.$refs.upload.clearFiles()
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + '</div>', '导入结果', {
dangerouslyUseHTMLString: true,
})
this.getList()
},
// 提交上传文件
submitFileForm() {
this.$refs.upload.submit()
},
/** 下载模板操作 */
importTemplate() {
this.download('mes/dv/product/importTemplate', {}, `md_item_${new Date().getTime()}.xlsx`)
},
},
}
</script>

View File

@@ -0,0 +1,17 @@
<template>
<div>
<!-- 搜索部分 -->
<div>
</div>
</div>
</template>
<script>
export default {
name: "workshop"
}
</script>
<style></style>