订单Excel导入增加追加导入功能

This commit is contained in:
2025-05-14 09:31:00 +08:00
parent 2a91e4961d
commit db1048412f

View File

@@ -46,22 +46,16 @@
<el-button type="success" plain icon="download" @click="handleExport">{{ $t('btn.export') }}</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="upload" @click="handleImportDialog">{{ $t('btn.import') }}</el-button>
<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-button type="warning" plain icon="upload" @click="addImportDialog">追加{{ $t('btn.import') }}</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table
:data="dataList"
v-loading="loading"
border
header-cell-class-name="el-table-header-cell"
highlight-current-row
@sort-change="sortChange">
<el-table :data="dataList" v-loading="loading" border header-cell-class-name="el-table-header-cell" highlight-current-row @sort-change="sortChange">
<el-table-column
prop="orderNoMes"
label="订单扫描号"
@@ -81,13 +75,7 @@
<dict-tag :options="options.statusOptions" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column
prop="variety"
label="品种"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('variety')"
min-width="100" />
<el-table-column prop="variety" label="品种" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('variety')" min-width="100" />
<el-table-column
prop="materialName"
label="物料"
@@ -103,12 +91,7 @@
v-if="columns.showColumn('materialCode')"
min-width="120" />
<el-table-column prop="demandQuantity" label="需求数量" align="center" v-if="columns.showColumn('demandQuantity')" min-width="100" />
<el-table-column
prop="deliveryDate"
label="交货日期"
:show-overflow-tooltip="true"
v-if="columns.showColumn('deliveryDate')"
min-width="120" />
<el-table-column prop="deliveryDate" label="交货日期" :show-overflow-tooltip="true" v-if="columns.showColumn('deliveryDate')" min-width="120" />
<el-table-column prop="startDate" label="基本开始日期" :show-overflow-tooltip="true" v-if="columns.showColumn('startDate')" min-width="120" />
<el-table-column prop="endDate" label="基本结束日期" :show-overflow-tooltip="true" v-if="columns.showColumn('endDate')" min-width="120" />
<el-table-column prop="deliveryQuantity" label="实际交货数量" align="center" v-if="columns.showColumn('deliveryQuantity')" min-width="120" />
@@ -144,19 +127,8 @@
<dict-tag :options="options.kdTypeOptions" :value="scope.row.kdType" />
</template>
</el-table-column>
<el-table-column
prop="documentDate"
label="单据日期"
:show-overflow-tooltip="true"
v-if="columns.showColumn('documentDate')"
min-width="120" />
<el-table-column
prop="seller"
label="售达方"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('seller')"
min-width="120" />
<el-table-column prop="documentDate" label="单据日期" :show-overflow-tooltip="true" v-if="columns.showColumn('documentDate')" min-width="120" />
<el-table-column prop="seller" label="售达方" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('seller')" min-width="120" />
<el-table-column
prop="salesArea"
label="销售地区"
@@ -164,13 +136,7 @@
:show-overflow-tooltip="true"
v-if="columns.showColumn('salesArea')"
min-width="120" />
<el-table-column
prop="remark"
label="备注"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('remark')"
min-width="150" />
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('remark')" min-width="150" />
<el-table-column
prop="createdBy"
label="创建人"
@@ -189,13 +155,7 @@
<el-table-column prop="updatedTime" label="更新时间" :show-overflow-tooltip="true" v-if="columns.showColumn('updatedTime')" min-width="150" />
<el-table-column prop="id" label="雪花id" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('id')" min-width="150" />
<el-table-column prop="importDate" label="导入日期" :show-overflow-tooltip="true" v-if="columns.showColumn('importDate')" min-width="120" />
<el-table-column
prop="poitem"
label="编号"
align="center"
:show-overflow-tooltip="true"
v-if="columns.showColumn('poitem')"
min-width="100" />
<el-table-column prop="poitem" label="编号" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('poitem')" min-width="100" />
<el-table-column label="操作" width="160" fixed="right">
<template #default="scope">
<el-button type="success" size="small" icon="edit" title="编辑" @click="handleUpdate(scope.row)"></el-button>
@@ -359,12 +319,11 @@
</el-dialog>
<!-- 导入对话框 -->
<el-dialog title="导入数据" :lock-scroll="false" v-model="importOpen" width="40%" center>
<el-dialog :title="importTitle" :lock-scroll="false" v-model="importOpen" width="40%" center append-to-body :close-on-click-modal="false">
<el-upload
ref="uploadRef"
action="/mes/orderManagement/OrderPurchase/importData"
accept=".xlsx, .xls"
:data="{value: uploadValue}"
:before-upload="beforeUpload"
:http-request="uploadFile"
:auto-upload="false"
@@ -393,8 +352,6 @@ import {
importOrderPurchase,
downloadTemplate // 添加下载模板API
} from '@/api/orderPurchaseManagement/orderpurchase.js'
var value = false;
const { proxy } = getCurrentInstance()
import dayjs from 'dayjs'
const queryParams = reactive({
@@ -492,7 +449,7 @@ const dataList = ref([])
const queryRef = ref()
const loading = ref(false)
const showSearch = ref(true)
const uploadValue = ref(false)
const uploadType = ref(false)
const state = reactive({
form: {},
rules: {
@@ -521,7 +478,7 @@ const title = ref('')
const opertype = ref(0)
const open = ref(false)
const importOpen = ref(false)
const importTitle = ref('覆盖导入')
function getList() {
loading.value = true
listOrderPurchase(queryParams).then((res) => {
@@ -642,6 +599,8 @@ function handleExport() {
function handleImportDialog() {
importOpen.value = true
importTitle.value = '覆盖导入'
uploadType.value = false
}
const formData = ref(new FormData())
@@ -652,22 +611,13 @@ 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) => {
console.log(options.file);
console.log(uploadValue.value);
const forData = new FormData();
forData.append('file', options.file);
forData.append('value', uploadValue.value)
const forData = new FormData()
forData.append('file', options.file)
forData.append('uploadType', uploadType.value)
importOrderPurchase(forData)
.then((response) => {
if (response.code === 200) {
@@ -681,7 +631,6 @@ const uploadFile = (options) => {
}
)
getList()
uploadValue.value=false;
}
})
.catch((error) => {
@@ -697,9 +646,10 @@ function handleDownloadTemplate() {
})
}
function addImportDialog(){
function addImportDialog() {
importOpen.value = true
value =true;
importTitle.value = '追加导入'
uploadType.value = true
}
handleQuery()
</script>