毛利分析的客户区域筛选。
This commit is contained in:
@@ -3,6 +3,13 @@
|
||||
<el-card shadow="never" class="search-card">
|
||||
<el-form :model="query" label-width="88px" @submit.prevent>
|
||||
<el-row :gutter="16">
|
||||
<el-col :xs="24" :sm="12" :lg="8">
|
||||
<el-form-item label="客户区域" class="filter-item">
|
||||
<el-select v-model="query.customerArea" placeholder="请选择客户区域" class="filter-control" @change="handleSearch">
|
||||
<el-option v-for="area in customer_area" :key="area.value" :label="area.label" :value="area.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :lg="8">
|
||||
<el-form-item label="计费日期" class="filter-item">
|
||||
<el-date-picker
|
||||
@@ -63,7 +70,7 @@
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :lg="8" class="filter-actions-col">
|
||||
<div class="filter-item filter-actions">
|
||||
<el-button type="primary" icon="Search" @click="handleSearch">搜索</el-button>
|
||||
<el-button type="primary" icon="Search" :disabled="!hasCustomerArea()" @click="handleSearch">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
@@ -132,6 +139,7 @@
|
||||
icon="Download"
|
||||
v-hasPermi="['report:profit:export']"
|
||||
:loading="exporting"
|
||||
:disabled="!hasCustomerArea()"
|
||||
@click="handleExport"
|
||||
>导出当前维度</el-button>
|
||||
</div>
|
||||
@@ -304,16 +312,19 @@ import { saveAs } from 'file-saver'
|
||||
// 提成功能暂停使用:import { ElMessageBox } from 'element-plus'
|
||||
|
||||
const dimension = ref('product')
|
||||
const { customer_area } = useDict('customer_area')
|
||||
const multiValueFilterLimit = 2000
|
||||
const dateRange = ref([formatLocalDate(-30), formatLocalDate(0)])
|
||||
const arBillStatus = ref('')
|
||||
const query = reactive({
|
||||
customerArea: '',
|
||||
orderNo: '',
|
||||
customerCode: '',
|
||||
belongSalerCode: '',
|
||||
productCode: ''
|
||||
})
|
||||
const summaryList = ref([])
|
||||
let summaryRequestVersion = 0
|
||||
const rows = ref([])
|
||||
let rowsRequestVersion = 0
|
||||
const loading = ref(false)
|
||||
@@ -397,15 +408,21 @@ function validateMultiValueFilters(showMessage = true) {
|
||||
return true
|
||||
}
|
||||
|
||||
function hasCustomerArea() {
|
||||
return query.customerArea !== '' && query.customerArea !== null && query.customerArea !== undefined
|
||||
}
|
||||
|
||||
function loadSummary() {
|
||||
if (!validateMultiValueFilters(false)) return Promise.resolve()
|
||||
if (!hasCustomerArea() || !validateMultiValueFilters(false)) return Promise.resolve()
|
||||
const requestVersion = ++summaryRequestVersion
|
||||
return listProfitSummary(buildQuery(false)).then(res => {
|
||||
if (requestVersion !== summaryRequestVersion) return
|
||||
summaryList.value = res.data || []
|
||||
})
|
||||
}
|
||||
|
||||
function loadRows() {
|
||||
if (!validateMultiValueFilters()) return Promise.resolve()
|
||||
if (!hasCustomerArea() || !validateMultiValueFilters()) return Promise.resolve()
|
||||
const requestVersion = ++rowsRequestVersion
|
||||
const requestDimension = dimension.value
|
||||
loading.value = true
|
||||
@@ -419,14 +436,31 @@ function loadRows() {
|
||||
})
|
||||
}
|
||||
|
||||
function clearReportResults() {
|
||||
summaryRequestVersion++
|
||||
rowsRequestVersion++
|
||||
orderListRequestVersion++
|
||||
summaryList.value = []
|
||||
rows.value = []
|
||||
total.value = 0
|
||||
loading.value = false
|
||||
orderListDialogVisible.value = false
|
||||
orderListLoading.value = false
|
||||
orderListRows.value = []
|
||||
orderListTotal.value = 0
|
||||
orderListContext.value = null
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
if (!validateMultiValueFilters()) return
|
||||
clearReportResults()
|
||||
if (!hasCustomerArea() || !validateMultiValueFilters()) return
|
||||
pageNum.value = 1
|
||||
Promise.all([loadSummary(), loadRows()])
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
Object.keys(query).forEach(key => { query[key] = '' })
|
||||
query.customerArea = customer_area.value[0]?.value ?? ''
|
||||
arBillStatus.value = ''
|
||||
dateRange.value = [formatLocalDate(-30), formatLocalDate(0)]
|
||||
handleSearch()
|
||||
@@ -459,7 +493,7 @@ function openOrderList(row) {
|
||||
|
||||
function loadOrderList() {
|
||||
if (!orderListContext.value) return
|
||||
if (!validateMultiValueFilters()) return
|
||||
if (!hasCustomerArea() || !validateMultiValueFilters()) return
|
||||
const requestVersion = ++orderListRequestVersion
|
||||
orderListLoading.value = true
|
||||
const params = {
|
||||
@@ -513,7 +547,7 @@ function arBillStatusLabel(value) {
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
if (!validateMultiValueFilters()) return
|
||||
if (!hasCustomerArea() || !validateMultiValueFilters()) return
|
||||
exporting.value = true
|
||||
const exporter = dimension.value === 'product' ? exportProfitProducts : exportProfitOrders
|
||||
try {
|
||||
@@ -625,7 +659,17 @@ function handleDeleteRate(row) {
|
||||
}
|
||||
*/
|
||||
|
||||
handleSearch()
|
||||
watch(customer_area, options => {
|
||||
if (!options?.length) {
|
||||
query.customerArea = ''
|
||||
clearReportResults()
|
||||
return
|
||||
}
|
||||
if (!options.some(area => area.value === query.customerArea)) {
|
||||
query.customerArea = options[0].value
|
||||
handleSearch()
|
||||
}
|
||||
}, { immediate: true })
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user