提交
This commit is contained in:
1 parent
d84f4b944c
commit
7c838cfb2d
249 files changed
+50600
-18556
No files matched your search
@@ -139,14 +139,65 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增记录
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedRows.length === 1 && selectedRows[0]?.purchasePlanId"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows[0]?.hasWeighingSlip"
|
||||
@click="handleGenerateWeighing(selectedRows[0])"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
{{ selectedRows[0]?.hasWeighingSlip ? '已生成地磅单' : '生成地磅单' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedRows.length === 1 && selectedRows[0]?.purchasePlanId"
|
||||
class="btn-ghost"
|
||||
@click="handleCopyFillLink(selectedRows[0])"
|
||||
>
|
||||
<el-icon><Link /></el-icon>
|
||||
磅单二维码
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="
|
||||
selectedRows.length !== 1 ||
|
||||
!canDeleteRecord(selectedRows[0]) ||
|
||||
!canDeleteByCreator(selectedRows[0])
|
||||
"
|
||||
:title="
|
||||
selectedRows.length === 1 && !canDeleteRecord(selectedRows[0])
|
||||
? '仅支持删除当天及之后日期的记录'
|
||||
: selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0])
|
||||
? CREATOR_DELETE_TIP
|
||||
: ''
|
||||
"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="exportLoading" @click="handleExport">
|
||||
<el-icon><Download /></el-icon>
|
||||
导出 Excel
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="loading" @click="loadData">
|
||||
<el-icon><Refresh /></el-icon>
|
||||
刷新
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="loadData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -161,10 +212,12 @@
|
||||
:summary-method="getSummary"
|
||||
@sort-change="handleSortChange"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="60" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('id')"
|
||||
prop="id"
|
||||
label="ID"
|
||||
min-width="100"
|
||||
@@ -175,6 +228,7 @@
|
||||
:sort-order="getSortOrder('id')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('planNo')"
|
||||
prop="planNo"
|
||||
label="计划号"
|
||||
min-width="140"
|
||||
@@ -189,8 +243,13 @@
|
||||
show-overflow-tooltip
|
||||
sortable="custom"
|
||||
:sort-order="getSortOrder('batchNo')"
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.batchNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('date')"
|
||||
prop="date"
|
||||
label="日期"
|
||||
min-width="120"
|
||||
@@ -198,6 +257,7 @@
|
||||
:sort-order="getSortOrder('date')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('partnerCompany')"
|
||||
prop="partnerCompany"
|
||||
label="往来单位"
|
||||
min-width="150"
|
||||
@@ -206,6 +266,7 @@
|
||||
:sort-order="getSortOrder('partnerCompany')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('businessType')"
|
||||
prop="businessType"
|
||||
label="业务类型"
|
||||
min-width="100"
|
||||
@@ -219,6 +280,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('status')"
|
||||
prop="status"
|
||||
label="状态"
|
||||
min-width="110"
|
||||
@@ -232,6 +294,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('product')"
|
||||
prop="product"
|
||||
label="产品"
|
||||
min-width="120"
|
||||
@@ -240,6 +303,7 @@
|
||||
:sort-order="getSortOrder('product')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('specification')"
|
||||
prop="specification"
|
||||
label="规格"
|
||||
min-width="120"
|
||||
@@ -248,6 +312,7 @@
|
||||
:sort-order="getSortOrder('specification')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('vehicleNo')"
|
||||
prop="vehicleNo"
|
||||
label="车牌号"
|
||||
min-width="120"
|
||||
@@ -255,6 +320,7 @@
|
||||
:sort-order="getSortOrder('vehicleNo')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('quantity')"
|
||||
prop="quantity"
|
||||
label="数量(吨)"
|
||||
min-width="110"
|
||||
@@ -262,6 +328,7 @@
|
||||
:sort-order="getSortOrder('quantity')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('netWeight')"
|
||||
prop="netWeight"
|
||||
label="净重(吨)"
|
||||
min-width="110"
|
||||
@@ -273,6 +340,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('grossWeight')"
|
||||
prop="grossWeight"
|
||||
label="毛重(吨)"
|
||||
min-width="110"
|
||||
@@ -284,6 +352,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('grossWeightTime')"
|
||||
prop="grossWeightTime"
|
||||
label="毛重时间"
|
||||
min-width="160"
|
||||
@@ -295,6 +364,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('tareWeight')"
|
||||
prop="tareWeight"
|
||||
label="皮重(吨)"
|
||||
min-width="110"
|
||||
@@ -306,6 +376,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('tareWeightTime')"
|
||||
prop="tareWeightTime"
|
||||
label="皮重时间"
|
||||
min-width="160"
|
||||
@@ -317,6 +388,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('deduction')"
|
||||
prop="deduction"
|
||||
label="扣杂(吨)"
|
||||
min-width="110"
|
||||
@@ -328,6 +400,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('remarks')"
|
||||
prop="remarks"
|
||||
label="备注"
|
||||
min-width="150"
|
||||
@@ -335,52 +408,6 @@
|
||||
sortable="custom"
|
||||
:sort-order="getSortOrder('remarks')"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="520"
|
||||
align="center"
|
||||
header-align="center"
|
||||
fixed="right"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div class="db-op-actions">
|
||||
<el-button class="btn-op-item" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button class="btn-op-item primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.purchasePlanId"
|
||||
class="btn-op-item"
|
||||
:disabled="row.hasWeighingSlip"
|
||||
@click="handleGenerateWeighing(row)"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
{{ row.hasWeighingSlip ? '已生成地磅单' : '生成地磅单' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.purchasePlanId"
|
||||
class="btn-op-item"
|
||||
@click="handleCopyFillLink(row)"
|
||||
>
|
||||
<el-icon><Link /></el-icon>
|
||||
磅单二维码
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item danger"
|
||||
:disabled="!canDeleteRecord(row) || !canDeleteByCreator(row)"
|
||||
:title="!canDeleteRecord(row) ? '仅支持删除当天及之后日期的记录' : canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -485,7 +512,47 @@
|
||||
v-model:visible="relatedModalOpen"
|
||||
:loading="loadingRelated"
|
||||
:data="relatedData"
|
||||
/>
|
||||
>
|
||||
<template v-if="viewingRecord" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewingRecord)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingRecord.purchasePlanId"
|
||||
class="btn-ghost"
|
||||
:disabled="viewingRecord.hasWeighingSlip"
|
||||
@click="handleGenerateWeighing(viewingRecord)"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
{{ viewingRecord.hasWeighingSlip ? '已生成地磅单' : '生成地磅单' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingRecord.purchasePlanId"
|
||||
class="btn-ghost"
|
||||
@click="handleCopyFillLink(viewingRecord)"
|
||||
>
|
||||
<el-icon><Link /></el-icon>
|
||||
磅单二维码
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteRecord(viewingRecord) || !canDeleteByCreator(viewingRecord)"
|
||||
:title="
|
||||
!canDeleteRecord(viewingRecord)
|
||||
? '仅支持删除当天及之后日期的记录'
|
||||
: canDeleteByCreator(viewingRecord)
|
||||
? ''
|
||||
: CREATOR_DELETE_TIP
|
||||
"
|
||||
@click="handleViewDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</DbInventoryRelatedViewDialog>
|
||||
|
||||
<DbPoundSlipQrcodeDialog v-model:visible="qrcodeModalOpen" :inventory-id="qrcodeInventoryId" />
|
||||
</div>
|
||||
@@ -508,12 +575,12 @@
|
||||
Edit,
|
||||
Link,
|
||||
Plus,
|
||||
Refresh,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
View
|
||||
} from '@element-plus/icons-vue'
|
||||
import DbCrmCustomerSelect from '@/components/business/db/DbCrmCustomerSelect.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import DbCrmProductSelect from '@/components/business/db/DbCrmProductSelect.vue'
|
||||
import DbInventoryRelatedViewDialog from '@/components/business/db/DbInventoryRelatedViewDialog.vue'
|
||||
@@ -535,13 +602,42 @@
|
||||
const router = useRouter()
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'id', label: 'ID', defaultVisible: false },
|
||||
{ prop: 'planNo', label: '计划号' },
|
||||
{ prop: 'date', label: '日期' },
|
||||
{ prop: 'partnerCompany', label: '往来单位' },
|
||||
{ prop: 'businessType', label: '业务类型' },
|
||||
{ prop: 'status', label: '状态' },
|
||||
{ prop: 'product', label: '产品' },
|
||||
{ prop: 'specification', label: '规格' },
|
||||
{ prop: 'vehicleNo', label: '车牌号' },
|
||||
{ prop: 'quantity', label: '数量(吨)' },
|
||||
{ prop: 'netWeight', label: '净重(吨)' },
|
||||
{ prop: 'grossWeight', label: '毛重(吨)' },
|
||||
{ prop: 'grossWeightTime', label: '毛重时间' },
|
||||
{ prop: 'tareWeight', label: '皮重(吨)' },
|
||||
{ prop: 'tareWeightTime', label: '皮重时间' },
|
||||
{ prop: 'deduction', label: '扣杂(吨)' },
|
||||
{ prop: 'remarks', label: '备注' }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('db-inventory-list-columns', listColumnDefs)
|
||||
|
||||
const exportLoading = ref(false)
|
||||
const saving = ref(false)
|
||||
const tableData = ref<InventoryRecord[]>([])
|
||||
const allRecords = ref<InventoryRecord[]>([])
|
||||
const total = ref(0)
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const pageSize = ref(20)
|
||||
const activeDateShortcut = ref<'all' | 'today' | 'tomorrow' | 'yesterday' | 'week' | ''>('today')
|
||||
const searchKeyword = ref('')
|
||||
const selectedRows = ref<InventoryRecord[]>([])
|
||||
@@ -559,6 +655,7 @@
|
||||
const relatedModalOpen = ref(false)
|
||||
const loadingRelated = ref(false)
|
||||
const relatedData = ref<InventoryRelatedData>({ plan: null, weighing: null })
|
||||
const viewingRecord = ref<InventoryRecord | null>(null)
|
||||
|
||||
const filters = reactive({
|
||||
batchNo: '',
|
||||
@@ -845,6 +942,7 @@
|
||||
}
|
||||
|
||||
const handleView = async (record: InventoryRecord) => {
|
||||
viewingRecord.value = record
|
||||
loadingRelated.value = true
|
||||
try {
|
||||
relatedData.value = await inventoryApi.getRelated(record.id)
|
||||
@@ -856,6 +954,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条记录')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条记录')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleViewDelete() {
|
||||
if (!viewingRecord.value) return
|
||||
await handleDelete(viewingRecord.value)
|
||||
relatedModalOpen.value = false
|
||||
}
|
||||
|
||||
const handleEdit = (record: InventoryRecord) => {
|
||||
editingRecord.value = record
|
||||
Object.assign(formData, {
|
||||
|
||||
@@ -135,14 +135,46 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增计划
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarGenerateInventory"
|
||||
>
|
||||
<el-icon><DocumentAdd /></el-icon>
|
||||
生成出入库单
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="exportLoading" @click="handleExport">
|
||||
<el-icon><Download /></el-icon>
|
||||
导出 Excel
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="loading" @click="loadData">
|
||||
<el-icon><Refresh /></el-icon>
|
||||
刷新
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="loadData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -156,6 +188,7 @@
|
||||
show-summary
|
||||
:summary-method="getSummary"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="60" align="center" header-align="center" />
|
||||
@@ -166,8 +199,13 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.planNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('businessType')"
|
||||
prop="businessType"
|
||||
label="业务类型"
|
||||
min-width="100"
|
||||
@@ -181,6 +219,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('customerName')"
|
||||
prop="customerName"
|
||||
label="往来单位"
|
||||
min-width="150"
|
||||
@@ -189,6 +228,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('startDate')"
|
||||
prop="startDate"
|
||||
label="起始日期"
|
||||
min-width="120"
|
||||
@@ -196,6 +236,7 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('endDate')"
|
||||
prop="endDate"
|
||||
label="截止日期"
|
||||
min-width="120"
|
||||
@@ -203,6 +244,7 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('product')"
|
||||
prop="product"
|
||||
label="产品"
|
||||
min-width="120"
|
||||
@@ -211,6 +253,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('specification')"
|
||||
prop="specification"
|
||||
label="规格"
|
||||
min-width="120"
|
||||
@@ -219,18 +262,26 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('plannedQuantity')"
|
||||
label="计划量(吨)"
|
||||
prop="plannedQuantity"
|
||||
min-width="120"
|
||||
align="right"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column label="已执行量(吨)" min-width="130" align="right" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('executedQuantity')"
|
||||
label="已执行量(吨)"
|
||||
min-width="130"
|
||||
align="right"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ ((row.executedQuantity || 0) / 1000).toFixed(2) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('executionStatus')"
|
||||
prop="executionStatus"
|
||||
label="执行状态"
|
||||
min-width="120"
|
||||
@@ -244,6 +295,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('remarks')"
|
||||
prop="remarks"
|
||||
label="备注"
|
||||
min-width="150"
|
||||
@@ -251,7 +303,13 @@
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="自动生成" min-width="140" align="center" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('autoGenerate')"
|
||||
label="自动生成"
|
||||
min-width="140"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
v-model="row.autoGenerateEnabled"
|
||||
@@ -266,39 +324,6 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="360"
|
||||
align="center"
|
||||
header-align="center"
|
||||
fixed="right"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div class="db-op-actions">
|
||||
<el-button class="btn-op-item" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button class="btn-op-item primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="handleGenerateInventory(row)">
|
||||
<el-icon><DocumentAdd /></el-icon>
|
||||
生成出入库单
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item danger"
|
||||
:disabled="!canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -436,7 +461,28 @@
|
||||
v-model:visible="relatedModalOpen"
|
||||
:loading="loadingRelated"
|
||||
:data="relatedData"
|
||||
/>
|
||||
>
|
||||
<template v-if="viewingRecord" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewingRecord)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleGenerateInventory(viewingRecord)">
|
||||
<el-icon><DocumentAdd /></el-icon>
|
||||
生成出入库单
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewingRecord)"
|
||||
:title="canDeleteByCreator(viewingRecord) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleViewDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</DbPlanRelatedViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -454,12 +500,12 @@
|
||||
Download,
|
||||
Edit,
|
||||
Plus,
|
||||
Refresh,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
View
|
||||
} from '@element-plus/icons-vue'
|
||||
import DbCrmCustomerSelect from '@/components/business/db/DbCrmCustomerSelect.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import DbCrmProductSelect from '@/components/business/db/DbCrmProductSelect.vue'
|
||||
import DbPlanRelatedViewDialog from '@/components/business/db/DbPlanRelatedViewDialog.vue'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
@@ -478,13 +524,35 @@
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'businessType', label: '业务类型' },
|
||||
{ prop: 'customerName', label: '往来单位' },
|
||||
{ prop: 'startDate', label: '起始日期' },
|
||||
{ prop: 'endDate', label: '截止日期' },
|
||||
{ prop: 'product', label: '产品' },
|
||||
{ prop: 'specification', label: '规格' },
|
||||
{ prop: 'plannedQuantity', label: '计划量(吨)' },
|
||||
{ prop: 'executedQuantity', label: '已执行量(吨)' },
|
||||
{ prop: 'executionStatus', label: '执行状态' },
|
||||
{ prop: 'remarks', label: '备注' },
|
||||
{ prop: 'autoGenerate', label: '自动生成' }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('db-plans-list-columns', listColumnDefs)
|
||||
|
||||
const loading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const saving = ref(false)
|
||||
const tableData = ref<Plan[]>([])
|
||||
const total = ref(0)
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const pageSize = ref(20)
|
||||
const searchKeyword = ref('')
|
||||
const selectedRows = ref<Plan[]>([])
|
||||
const activeDateShortcut = ref<'all' | 'today' | 'tomorrow' | 'yesterday' | 'week' | ''>('')
|
||||
@@ -762,8 +830,10 @@
|
||||
})
|
||||
const relatedModalOpen = ref(false)
|
||||
const loadingRelated = ref(false)
|
||||
const viewingRecord = ref<Plan | null>(null)
|
||||
|
||||
const handleView = async (record: Plan) => {
|
||||
viewingRecord.value = record
|
||||
loadingRelated.value = true
|
||||
try {
|
||||
relatedData.value = await planApi.getRelated(record.id)
|
||||
@@ -775,6 +845,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条计划')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarGenerateInventory() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条计划')
|
||||
return
|
||||
}
|
||||
handleGenerateInventory(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条计划')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleViewDelete() {
|
||||
if (!viewingRecord.value) return
|
||||
await handleDelete(viewingRecord.value)
|
||||
relatedModalOpen.value = false
|
||||
}
|
||||
|
||||
const handleDelete = async (row: Plan) => {
|
||||
if (!canDeleteByCreator(row)) {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
|
||||
@@ -137,14 +137,45 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增地磅单
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="
|
||||
selectedRows.length !== 1 ||
|
||||
selectedRows[0]?.isVoided === 1 ||
|
||||
!isWeighingRecordToday(selectedRows[0])
|
||||
"
|
||||
:title="
|
||||
selectedRows.length === 1 && !isWeighingRecordToday(selectedRows[0])
|
||||
? '仅支持作废当天的地磅单'
|
||||
: ''
|
||||
"
|
||||
@click="handleToolbarVoid"
|
||||
>
|
||||
<el-icon><Close /></el-icon>
|
||||
作废
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="exportLoading" @click="handleExport">
|
||||
<el-icon><Download /></el-icon>
|
||||
导出 Excel
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="loading" @click="loadData">
|
||||
<el-icon><Refresh /></el-icon>
|
||||
刷新
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="loadData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -158,10 +189,12 @@
|
||||
show-summary
|
||||
:summary-method="getSummary"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="60" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('inventoryDate')"
|
||||
prop="inventoryDate"
|
||||
label="日期"
|
||||
min-width="120"
|
||||
@@ -173,6 +206,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('planNo')"
|
||||
prop="planNo"
|
||||
label="计划单号"
|
||||
min-width="140"
|
||||
@@ -187,8 +221,13 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.batchNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('vehicleNo')"
|
||||
prop="vehicleNo"
|
||||
label="车牌号"
|
||||
min-width="120"
|
||||
@@ -196,6 +235,7 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('cargoName')"
|
||||
prop="cargoName"
|
||||
label="货物名称"
|
||||
min-width="150"
|
||||
@@ -204,6 +244,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('specification')"
|
||||
prop="specification"
|
||||
label="规格"
|
||||
min-width="120"
|
||||
@@ -212,6 +253,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('businessType')"
|
||||
prop="businessType"
|
||||
label="业务类型"
|
||||
min-width="100"
|
||||
@@ -224,7 +266,13 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单据状态" min-width="100" align="center" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('docStatus')"
|
||||
label="单据状态"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.isVoided === 1 ? 'danger' : 'success'" size="small">
|
||||
{{ row.isVoided === 1 ? '已作废' : '正常' }}
|
||||
@@ -232,6 +280,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('supplier')"
|
||||
prop="supplier"
|
||||
label="供货单位"
|
||||
min-width="150"
|
||||
@@ -240,6 +289,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('consignee')"
|
||||
prop="consignee"
|
||||
label="收货单位"
|
||||
min-width="150"
|
||||
@@ -247,17 +297,30 @@
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="本次量(吨)" min-width="110" align="right" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('currentQuantity')"
|
||||
label="本次量(吨)"
|
||||
min-width="110"
|
||||
align="right"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ formatKgToTon(row.currentQuantity) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="净重(吨)" min-width="110" align="right" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('netWeight')"
|
||||
label="净重(吨)"
|
||||
min-width="110"
|
||||
align="right"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ formatKgToTon(row.netWeight) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('grossWeight')"
|
||||
prop="grossWeight"
|
||||
label="毛重(kg)"
|
||||
min-width="110"
|
||||
@@ -265,6 +328,7 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('grossWeightTime')"
|
||||
prop="grossWeightTime"
|
||||
label="毛重时间"
|
||||
min-width="160"
|
||||
@@ -272,6 +336,7 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('tareWeight')"
|
||||
prop="tareWeight"
|
||||
label="皮重(kg)"
|
||||
min-width="110"
|
||||
@@ -279,45 +344,23 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('tareWeightTime')"
|
||||
prop="tareWeightTime"
|
||||
label="皮重时间"
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column prop="deduction" label="扣杂(kg)" min-width="110" align="right" header-align="center">
|
||||
<template #default="{ row }">
|
||||
{{ row.deduction || 0 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="280"
|
||||
align="center"
|
||||
v-if="isColumnVisible('deduction')"
|
||||
prop="deduction"
|
||||
label="扣杂(kg)"
|
||||
min-width="110"
|
||||
align="right"
|
||||
header-align="center"
|
||||
fixed="right"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div class="db-op-actions">
|
||||
<el-button class="btn-op-item" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button class="btn-op-item primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.isVoided === 0"
|
||||
class="btn-op-item op-warn"
|
||||
:disabled="!isWeighingRecordToday(row)"
|
||||
:title="isWeighingRecordToday(row) ? '' : '仅支持作废当天的地磅单'"
|
||||
@click="handleVoid(row)"
|
||||
>
|
||||
<el-icon><Close /></el-icon>
|
||||
作废
|
||||
</el-button>
|
||||
</div>
|
||||
{{ row.deduction || 0 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -477,7 +520,24 @@
|
||||
v-model:visible="relatedModalOpen"
|
||||
:loading="loadingRelated"
|
||||
:sections="relatedViewSections"
|
||||
/>
|
||||
>
|
||||
<template v-if="viewingRecord" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewingRecord)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingRecord.isVoided === 0"
|
||||
class="btn-ghost"
|
||||
:disabled="!isWeighingRecordToday(viewingRecord)"
|
||||
:title="isWeighingRecordToday(viewingRecord) ? '' : '仅支持作废当天的地磅单'"
|
||||
@click="handleViewVoid"
|
||||
>
|
||||
<el-icon><Close /></el-icon>
|
||||
作废
|
||||
</el-button>
|
||||
</template>
|
||||
</DbRelatedViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -495,12 +555,12 @@
|
||||
Download,
|
||||
Edit,
|
||||
Plus,
|
||||
Refresh,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
View
|
||||
} from '@element-plus/icons-vue'
|
||||
import DbCrmCustomerSelect from '@/components/business/db/DbCrmCustomerSelect.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import DbCrmProductSelect from '@/components/business/db/DbCrmProductSelect.vue'
|
||||
import DbRelatedViewDialog from '@/components/business/db/DbRelatedViewDialog.vue'
|
||||
import { buildWeighingRelatedSections } from '@/components/business/db/db-related-view'
|
||||
@@ -522,13 +582,40 @@
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'inventoryDate', label: '日期' },
|
||||
{ prop: 'planNo', label: '计划单号' },
|
||||
{ prop: 'vehicleNo', label: '车牌号' },
|
||||
{ prop: 'cargoName', label: '货物名称' },
|
||||
{ prop: 'specification', label: '规格' },
|
||||
{ prop: 'businessType', label: '业务类型' },
|
||||
{ prop: 'docStatus', label: '单据状态' },
|
||||
{ prop: 'supplier', label: '供货单位' },
|
||||
{ prop: 'consignee', label: '收货单位' },
|
||||
{ prop: 'currentQuantity', label: '本次量(吨)' },
|
||||
{ prop: 'netWeight', label: '净重(吨)' },
|
||||
{ prop: 'grossWeight', label: '毛重(kg)' },
|
||||
{ prop: 'grossWeightTime', label: '毛重时间' },
|
||||
{ prop: 'tareWeight', label: '皮重(kg)' },
|
||||
{ prop: 'tareWeightTime', label: '皮重时间' },
|
||||
{ prop: 'deduction', label: '扣杂(kg)' }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('db-weighing-list-columns', listColumnDefs)
|
||||
|
||||
const loading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const saving = ref(false)
|
||||
const allData = ref<WeighingRecord[]>([])
|
||||
const total = ref(0)
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const pageSize = ref(20)
|
||||
const searchKeyword = ref('')
|
||||
const selectedRows = ref<WeighingRecord[]>([])
|
||||
const activeDateShortcut = ref<'all' | 'today' | 'tomorrow' | 'yesterday' | 'week' | ''>('today')
|
||||
@@ -556,6 +643,7 @@
|
||||
const relatedModalOpen = ref(false)
|
||||
const loadingRelated = ref(false)
|
||||
const relatedData = ref<WeighingRelatedData>({ plan: null, inventory: null })
|
||||
const viewingRecord = ref<WeighingRecord | null>(null)
|
||||
|
||||
const relatedViewSections = computed(() => buildWeighingRelatedSections(relatedData.value))
|
||||
|
||||
@@ -836,6 +924,7 @@
|
||||
}
|
||||
|
||||
const handleView = async (record: WeighingRecord) => {
|
||||
viewingRecord.value = record
|
||||
loadingRelated.value = true
|
||||
try {
|
||||
relatedData.value = await weighingApi.getRelated(record.id)
|
||||
@@ -847,6 +936,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条地磅单')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarVoid() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条地磅单')
|
||||
return
|
||||
}
|
||||
handleVoid(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleViewVoid() {
|
||||
if (!viewingRecord.value) return
|
||||
await handleVoid(viewingRecord.value)
|
||||
relatedModalOpen.value = false
|
||||
}
|
||||
|
||||
const handleEdit = (record: WeighingRecord) => {
|
||||
editingRecord.value = record
|
||||
Object.assign(formData, {
|
||||
|
||||
Reference in new issue
Block a user