Commit b0c457c7 authored by 高宇's avatar 高宇

1.修改 检查表

parent cdba673f
......@@ -60,3 +60,28 @@ export function exportOutcomeWmsJbapplyTemp(query) {
responseType: 'blob'
})
}
// 下载空模板
export function getDownloadTemplate(query) {
return request({
url: '/outcomewmsjbapplytemp/downloadTemplate',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导入字典数据信息
export function importJbapplyExcel(data) {
return request({
url: '/outcomewmsjbapplytemp/importJbapplyData',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data'
},
transformRequest: [(data) => {
return data
}],
data
})
}
......@@ -104,4 +104,4 @@ export function importExcel(data) {
data
})
}
// 导入字典数据信息
......@@ -71,15 +71,17 @@
:icon="commonField.queryIcon"
:size="commonField.smallSize"
@click="handleQuery"
>查询</el-button>
>查询
</el-button>
<el-button
:class="commonField.resetClass"
:icon="commonField.resetIcon"
:size="commonField.smallSize"
@click="resetQuery"
>重置</el-button>
>重置
</el-button>
</el-form-item>
<div style="margin-left: 92%">
<div style="text-align: end">
<el-form-item>
<el-button
:class="commonField.addClass"
......@@ -87,26 +89,30 @@
:icon="commonField.addIcon"
:size="commonField.smallSize"
@click="handleAdd"
>新增</el-button>
<!-- <el-button-->
<!-- :class="commonField.exportClass"-->
<!-- :type="commonField.typeSuccess"-->
<!-- :icon="commonField.exportIcon"-->
<!-- :size="commonField.smallSize"-->
<!-- @click="handleExport"-->
<!-- >导出</el-button>-->
>新增
</el-button>
<el-button
:class="commonField.importClass"
:type="commonField.typeSuccess"
:icon="commonField.importIcon"
:size="commonField.smallSize"
@click="handleImport"
>{{commonField.importName}}
</el-button>
</el-form-item>
</div>
</el-form>
<div class="placeholder" />
<div class="placeholder"/>
<div style="padding:5px 10px">
<div class="mb12 font-small-bold">检查申请列表</div>
<el-table v-loading="loading" border :data="outcomeWmsJbapplyTempList">
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column label="wh_id" prop="whId" :show-overflow-tooltip="true">
<template slot-scope="scope">
<!-- 假设字典数据存储在 dataDict 中 -->
<span v-if="scope.row.whId &&getDataDictLabel(scope.row.whId) ">{{ getDataDictLabel(scope.row.whId) }}</span>
<span v-if="scope.row.whId &&getDataDictLabel(scope.row.whId) ">{{
getDataDictLabel(scope.row.whId)
}}</span>
<span v-else>-</span>
</template>
</el-table-column>
......@@ -159,7 +165,8 @@
:type="commonField.typeParent"
:size="commonField.size"
@click="handleDelete(scope.row)"
>删除</el-button>
>删除
</el-button>
</template>
</el-table-column>
</el-table>
......@@ -208,10 +215,10 @@
</el-select>
</el-form-item>
<el-form-item label="pn" prop="pn">
<el-input v-model.trim="form.pn" show-word-limit :maxlength="100" placeholder="请输入pn" />
<el-input v-model.trim="form.pn" show-word-limit :maxlength="100" placeholder="请输入pn"/>
</el-form-item>
<el-form-item label="qty" prop="qty">
<el-input v-model.trim="form.qty" placeholder="请输入qty的值" />
<el-input v-model.trim="form.qty" placeholder="请输入qty的值"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -219,6 +226,53 @@
<el-button class="submitBtn" type="primary" @click="submitForm">确 定</el-button>
</div>
</el-dialog>
<!-- 导入配置对话框 -->
<el-dialog class="importDialog" :title="importControls.title" :visible="importControls.open" width="80" append-to-body :close-on-click-modal="false" @close="cancelFileFrom">
<el-tabs type="border-card">
<el-tab-pane label="导入一">
<div class="importOne">
<div>
<!-- 下载模型按钮 -->
<div class="downloadTemplateDiv">
<el-button class="downloadTemplateDivButton" type="primary" :loading="downloadTemplateLoading" size="small" @click="downloadTemplate">下载模板</el-button>
</div>
<div>
<el-upload
accept=".xlsx, .xls"
:headers="importControls.headers"
:action="importControls.url + '?updateSupport=' + importControls.updateSupport"
:disabled="importControls.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
:on-change="employeeUpload"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:on-preview="handlePreview"
:file-list="files"
drag
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传</em>
</div>
<div slot="tip" class="el-upload__tip">
<!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
<!-- <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>-->
</div>
<div slot="tip" class="el-upload__tip" style="color:red">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
</el-upload>
</div>
</div>
</div>
</el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelFileFrom">取 消</el-button>
<el-button :loading="importLoading" type="primary" @click="submitFileForm">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
......@@ -229,13 +283,37 @@ import {
delOutcomeWmsJbapplyTemp,
addOutcomeWmsJbapplyTemp,
updateOutcomeWmsJbapplyTemp,
exportOutcomeWmsJbapplyTemp } from '@/api/outcomeWmsJbapplyTemp'
exportOutcomeWmsJbapplyTemp, getDownloadTemplate, importJbapplyExcel
} from '@/api/outcomeWmsJbapplyTemp'
import commonField from '@/utils/commonField'
import { getDicts } from '@/api/system/dict/data'
import {getDicts} from '@/api/system/dict/data'
import {getToken} from "@/utils/auth";
export default {
name: 'OutcomeWmsJbapplyTemp',
data() {
return {
// 导入列表
files: [],
// 下载模板loading
downloadTemplateLoading: false,
// 导入对话框遮盖层
importLoading: false,
// 导入对话框控制器
importControls:{
// 是否显示弹出层(数据导入)
open: false,
// 弹出层标题(数据导入)
title: '',
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: 'Bearer ' + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + '/system/user/importExcel'
},
// 遮罩层
loading: true,
// 总条数
......@@ -304,8 +382,7 @@ export default {
// 表单参数
form: {},
// 表单校验
rules: {
}
rules: {}
}
},
computed: {
......@@ -318,6 +395,81 @@ export default {
this.getwareHouse() // 查询数据字典
},
methods: {
handleRemove(file, fileList) {
this.files = []
},
beforeRemove(file, fileList) {
this.files = []
},
/* 上传文件所需求 */
handlePreview(file) {
},
employeeUpload(file, fileList) {
if (fileList.length > 1) {
fileList.splice(0, 1)
}
this.files = fileList[0].raw
},
// 文件上传成功处理
handleFileSuccess(response) {
this.upload.open = false
this.upload.isUploading = false
this.$refs.upload.clearFiles()
this.$alert(response.msg, '导入结果', { dangerouslyUseHTMLString: true })
this.getList()
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true
},
// 点击下载模板
downloadTemplate() {
this.downloadTemplateLoading = true
getDownloadTemplate().then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '导出空模板' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
this.downloadTemplateLoading = false
})
},
// 导入取消
cancelFileFrom() {
this.importControls.open = false
},
// 导入确认
submitFileForm() {
this.importLoading = true
if (this.files.length === 0) {
this.$message.warning('请上传文件')
// 导入成功后关闭弹出框
this.importLoading = false
// this.upload.open = true
} else {
var formData = new FormData() // 当前为空
formData.append('file', this.files)
importJbapplyExcel(formData).then(res => {
if (res.code === 200) {
this.importLoading = false
this.importControls.open = false
this.getList()
}
}).catch(() => {
this.importLoading = false
})
}
// this.importControls.open = false
},
// 导入
handleImport() {
this.importControls.title = '检查申请导入'
this.importControls.open = true
},
/* 获取数据字典中的值*/
getDataDictLabel(whId) {
const dictItem = this.warehouseList.find(item => item.dictValue === whId)
......@@ -410,19 +562,19 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
}).then(function () {
return updateOutcomeWmsJbapplyTemp(row)
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
}).catch(function() {
}).catch(function () {
row.flag = row.flag === '0' ? '1' : '0'
})
},
/** 提交按钮 */
submitForm: function() {
submitForm: function () {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.businessId !== undefined) {
......@@ -456,7 +608,7 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
}).then(function () {
return delOutcomeWmsJbapplyTemp(id)
}).then(() => {
this.getList()
......@@ -464,7 +616,7 @@ export default {
message: '删除成功',
type: 'success'
})
}).catch(function() {
}).catch(function () {
})
},
/** 导出按钮操作 */
......@@ -474,7 +626,7 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
}).then(function () {
return exportOutcomeWmsJbapplyTemp(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
......@@ -492,14 +644,32 @@ export default {
}
</script>
<style lang="scss" scoped>
.app-container {
font-size: 18px;
padding: 0;
// 导入对话框的css
.importDialog{
// 第一个标签
.importOne{
display: flex;
justify-content: center;
.downloadTemplateDiv{
margin: 40px;
display: flex;
justify-content: center;
// 下载模板的按钮样式
.downloadTemplateDivButton{
}
}
}
// 第二个标签
}
.app-container {
font-size: 18px;
padding: 0;
.placeholder {
height: 1.3vh;
background-color: #F4F4F4;
margin-bottom: 10px
}
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment