|
|
|
@ -36,16 +36,36 @@ |
|
|
|
<div v-if="showPreview" style="margin-top: 10px; margin-bottom: 10px;"> |
|
|
|
<!-- 可导入的发票表格 --> |
|
|
|
<div v-if="validInvoices.length > 0"> |
|
|
|
<div style="display: flex; align-items: center; margin-bottom: 8px;"> |
|
|
|
<span style="color: #67C23A;"> |
|
|
|
<i class="el-icon-success" style="margin-right: 8px;"></i> |
|
|
|
可导入的发票 (共{{ validInvoices.length }}个发票) |
|
|
|
</span> |
|
|
|
<el-table :data="validInvoices" border style="width: 100%" max-height="300" :show-overflow-tooltip="true" class="delClass valid-table"> |
|
|
|
<el-table-column label="操作" width="40" fixed="left"> |
|
|
|
<el-button |
|
|
|
type="danger" |
|
|
|
size="mini" |
|
|
|
style="margin-left: 15px;" |
|
|
|
:disabled="selectedRows.length === 0" |
|
|
|
@click="batchDeleteRows"> |
|
|
|
<i class="el-icon-delete"></i> |
|
|
|
批量删除 <span v-if="selectedRows.length > 0">({{ selectedRows.length }})</span> |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
<el-table |
|
|
|
:data="validInvoices" |
|
|
|
border |
|
|
|
style="width: 100%" |
|
|
|
max-height="300" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
class="delClass valid-table" |
|
|
|
ref="validInvoicesTable" |
|
|
|
@selection-change="handleSelectionChange"> |
|
|
|
<el-table-column type="selection" width="40" fixed="left" align="center"></el-table-column> |
|
|
|
<!-- <el-table-column label="操作" width="50" fixed="left"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a type="text" size="small" style="color: red" @click="deleteRow(scope.$index, scope.row)">删除</a> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column>--> |
|
|
|
<el-table-column prop="cmcInvoice" label="发票号" width="120" fixed="left"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<div> |
|
|
|
@ -275,8 +295,8 @@ |
|
|
|
<el-dialog :title="currentRow ? `为发票号 ${currentRow.cmcInvoice} 选择客户模板` : '客户模板'" |
|
|
|
@close="templateFlag = false; currentRow = null" :visible.sync="templateFlag" width="1200px" v-drag> |
|
|
|
<!-- 搜索表单 --> |
|
|
|
<el-form :inline="true" :model="templateSearchData" label-width="100px" style="margin-bottom: 15px;"> |
|
|
|
<el-form-item label="模板名称:"> |
|
|
|
<el-form :inline="true" label-position="top" :model="templateSearchData" label-width="100px" > |
|
|
|
<el-form-item label="模板名称"> |
|
|
|
<el-input |
|
|
|
v-model="templateSearchData.templateName" |
|
|
|
placeholder="请输入模板名称" |
|
|
|
@ -284,7 +304,7 @@ |
|
|
|
clearable> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="客户名称:"> |
|
|
|
<el-form-item label="客户名称"> |
|
|
|
<el-input |
|
|
|
v-model="templateSearchData.customerName" |
|
|
|
placeholder="请输入客户名称" |
|
|
|
@ -292,8 +312,10 @@ |
|
|
|
clearable> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-form-item label=" "> |
|
|
|
<el-button type="primary" @click="searchTemplateList">查询</el-button> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label=" "> |
|
|
|
<el-button @click="resetTemplateSearch">重置</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
@ -604,7 +626,9 @@ |
|
|
|
visible: false, |
|
|
|
invoice: '', |
|
|
|
materials: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
// 批量删除相关数据 |
|
|
|
selectedRows: [] // 选中的行 |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
@ -1439,6 +1463,46 @@ |
|
|
|
this.closeEditDialog() |
|
|
|
}, |
|
|
|
|
|
|
|
// 处理表格选择变化 |
|
|
|
handleSelectionChange(selection) { |
|
|
|
this.selectedRows = selection |
|
|
|
}, |
|
|
|
|
|
|
|
// 批量删除行 |
|
|
|
batchDeleteRows() { |
|
|
|
if (this.selectedRows.length === 0) { |
|
|
|
this.$message.warning('请先选择要删除的发票') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
const invoiceNumbers = this.selectedRows.map(row => row.cmcInvoice).join('、') |
|
|
|
this.$confirm(`确定要删除以下 ${this.selectedRows.length} 个发票吗?\n${invoiceNumbers}\n\n删除后将不会提交到后台。`, '批量删除确认', { |
|
|
|
confirmButtonText: '确定删除', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(() => { |
|
|
|
// 记录被删除的发票号并从预览数据中移除 |
|
|
|
this.selectedRows.forEach(row => { |
|
|
|
// 记录被删除的发票号 |
|
|
|
if (!this.deletedInvoices.includes(row.cmcInvoice)) { |
|
|
|
this.deletedInvoices.push(row.cmcInvoice) |
|
|
|
} |
|
|
|
// 从预览数据中移除该行 |
|
|
|
const previewIndex = this.previewData.findIndex(item => item.cmcInvoice === row.cmcInvoice) |
|
|
|
if (previewIndex !== -1) { |
|
|
|
this.previewData.splice(previewIndex, 1) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.$message.success(`已成功删除 ${this.selectedRows.length} 个发票`) |
|
|
|
// 清空选中状态 |
|
|
|
this.selectedRows = [] |
|
|
|
// 保存到缓存 |
|
|
|
this.saveToCache() |
|
|
|
}).catch(() => { |
|
|
|
// 用户取消删除 |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 删除行 |
|
|
|
deleteRow(index, row) { |
|
|
|
this.$confirm(`确定要删除发票号 "${row.cmcInvoice}" 吗?删除后将不会提交到后台。`, '删除确认', { |
|
|
|
@ -1456,6 +1520,8 @@ |
|
|
|
this.previewData.splice(previewIndex, 1) |
|
|
|
} |
|
|
|
this.$message.success(`发票号 "${row.cmcInvoice}" 已删除`) |
|
|
|
// 清空选中状态(如果删除的是选中的行) |
|
|
|
this.selectedRows = this.selectedRows.filter(r => r.cmcInvoice !== row.cmcInvoice) |
|
|
|
// 保存到缓存 |
|
|
|
this.saveToCache() |
|
|
|
}).catch(() => { |
|
|
|
|