增加追加导入逻辑
This commit is contained in:
parent
e18f095e82
commit
2a91e4961d
@ -48,6 +48,10 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="upload" @click="handleImportDialog">{{ $t('btn.import') }}</el-button>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="upload" @click="addImportDialog">追加导入</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
@ -360,6 +364,7 @@
|
||||
ref="uploadRef"
|
||||
action="/mes/orderManagement/OrderPurchase/importData"
|
||||
accept=".xlsx, .xls"
|
||||
:data="{value: uploadValue}"
|
||||
:before-upload="beforeUpload"
|
||||
:http-request="uploadFile"
|
||||
:auto-upload="false"
|
||||
@ -389,6 +394,7 @@ import {
|
||||
downloadTemplate // 添加下载模板API
|
||||
} from '@/api/orderPurchaseManagement/orderpurchase.js'
|
||||
|
||||
var value = false;
|
||||
const { proxy } = getCurrentInstance()
|
||||
import dayjs from 'dayjs'
|
||||
const queryParams = reactive({
|
||||
@ -486,7 +492,7 @@ const dataList = ref([])
|
||||
const queryRef = ref()
|
||||
const loading = ref(false)
|
||||
const showSearch = ref(true)
|
||||
|
||||
const uploadValue = ref(false)
|
||||
const state = reactive({
|
||||
form: {},
|
||||
rules: {
|
||||
@ -646,11 +652,23 @@ const beforeUpload = (file) => {
|
||||
}
|
||||
const uploadRef = ref(null)
|
||||
const submitUpload = () => {
|
||||
console.log(uploadRef.value );
|
||||
if(value){
|
||||
uploadValue.value=true;
|
||||
value=false;
|
||||
}
|
||||
uploadRef.value.submit()
|
||||
}
|
||||
|
||||
const uploadFile = (options) => {
|
||||
importOrderPurchase(formData.value)
|
||||
console.log(options.file);
|
||||
console.log(uploadValue.value);
|
||||
const forData = new FormData();
|
||||
forData.append('file', options.file);
|
||||
forData.append('value', uploadValue.value)
|
||||
|
||||
|
||||
importOrderPurchase(forData)
|
||||
.then((response) => {
|
||||
if (response.code === 200) {
|
||||
importOpen.value = false
|
||||
@ -663,6 +681,7 @@ const uploadFile = (options) => {
|
||||
}
|
||||
)
|
||||
getList()
|
||||
uploadValue.value=false;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
@ -678,6 +697,10 @@ function handleDownloadTemplate() {
|
||||
})
|
||||
}
|
||||
|
||||
function addImportDialog(){
|
||||
importOpen.value = true
|
||||
value =true;
|
||||
}
|
||||
handleQuery()
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user