add 运营数据
parent
9383e43b39
commit
3f2f9acc04
|
|
@ -0,0 +1,66 @@
|
|||
import request from '@/config/axios'
|
||||
|
||||
// 项目月度统计 VO
|
||||
export interface ProjectMonthlyStatVO {
|
||||
id: number; // 统计记录ID
|
||||
projectName: string; // 项目名称
|
||||
projectId: number // 项目ID
|
||||
statMonth: string // 统计月份
|
||||
chargingQuantity: number // 充电量(度)
|
||||
grossProfit: number // 毛利润
|
||||
}
|
||||
export interface ProjectMonthlyStatPageReqVO {
|
||||
projectId?: number; // 项目ID
|
||||
statMonth?: string; // 统计月份
|
||||
perGunCharging?: number[]; // 每枪充电量(度)
|
||||
perGunProfit?: number[]; // 每枪利润
|
||||
electricityServiceFee?: number[]; // 度电服务费(元)
|
||||
pageNo?: number; // 页码
|
||||
pageSize?: number; // 页大小
|
||||
sortingFields?: SortingField[];
|
||||
}
|
||||
|
||||
// 添加排序字段类型定义
|
||||
export interface SortingField {
|
||||
field: string;
|
||||
order: 'asc' | 'desc';
|
||||
}
|
||||
// 查询项目月度统计分页
|
||||
export const getProjectMonthlyStatPage = async (data: ProjectMonthlyStatPageReqVO) => {
|
||||
return await request.post({ url: `/crm/project-monthly-stat/page`, data })
|
||||
}
|
||||
|
||||
// 查询项目月度统计详情
|
||||
export const getProjectMonthlyStat = async (id: number) => {
|
||||
return await request.get({ url: `/crm/project-monthly-stat/get?id=` + id })
|
||||
}
|
||||
|
||||
// 新增项目月度统计
|
||||
export const createProjectMonthlyStat = async (data: ProjectMonthlyStatVO) => {
|
||||
return await request.post({ url: `/crm/project-monthly-stat/create`, data })
|
||||
}
|
||||
|
||||
// 修改项目月度统计
|
||||
export const updateProjectMonthlyStat = async (data: ProjectMonthlyStatVO) => {
|
||||
return await request.put({ url: `/crm/project-monthly-stat/update`, data })
|
||||
}
|
||||
|
||||
// 删除项目月度统计
|
||||
export const deleteProjectMonthlyStat = async (id: number) => {
|
||||
return await request.delete({ url: `/crm/project-monthly-stat/delete?id=` + id })
|
||||
}
|
||||
|
||||
// 导出项目月度统计 Excel
|
||||
export const exportProjectMonthlyStat = async (params: any) => {
|
||||
return await request.download({ url: `/crm/project-monthly-stat/export-excel`, params })
|
||||
}
|
||||
|
||||
// 同步项目月度统计
|
||||
export const syncProjectMonthlyStat = async (data: ProjectMonthlyStatVO) => {
|
||||
return await request.put({ url: `/crm/project-monthly-stat/sync`, data })
|
||||
}
|
||||
|
||||
// 查询项目月度统计图数据
|
||||
export const getProjectMonthlyStatChartData = async (params: any) => {
|
||||
return await request.get({ url: `/crm/project-monthly-stat/get-chart-data`, params})
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
<template>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :inline="true" :model="queryParams" class="mb-16px">
|
||||
<el-form-item label="项目名称" prop="projectId">
|
||||
<el-select
|
||||
v-model="queryParams.projectId"
|
||||
placeholder="请选择项目名称"
|
||||
class="!w-240px"
|
||||
@change="getChartData"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in projectList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="起始月份" prop="startMonth">
|
||||
<el-date-picker
|
||||
v-model="queryParams.startMonth"
|
||||
type="month"
|
||||
placeholder="选择月"
|
||||
:value-format="'YYYYMM'"
|
||||
clearable
|
||||
@change="getChartData"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="结束月份" prop="endMonth">
|
||||
<el-date-picker
|
||||
v-model="queryParams.endMonth"
|
||||
type="month"
|
||||
placeholder="选择月"
|
||||
:value-format="'YYYYMM'"
|
||||
clearable
|
||||
@change="getChartData"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<el-card>
|
||||
<v-chart :option="chartOption" autoresize style="height: 480px;" />
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { use } from 'echarts/core'
|
||||
import VChart from 'vue-echarts'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
import { BarChart, LineChart } from 'echarts/charts'
|
||||
import { GridComponent, TooltipComponent, LegendComponent, TitleComponent } from 'echarts/components'
|
||||
import * as ProjectApi from '@/api/crm/project'
|
||||
import * as ProjectMonthlyStatApi from '@/api/crm/project/monthly'
|
||||
import { start } from 'nprogress'
|
||||
import { format } from 'path'
|
||||
|
||||
use([
|
||||
CanvasRenderer,
|
||||
BarChart,
|
||||
LineChart,
|
||||
GridComponent,
|
||||
TooltipComponent,
|
||||
LegendComponent,
|
||||
TitleComponent
|
||||
])
|
||||
|
||||
const queryParams = reactive({
|
||||
projectId: undefined,
|
||||
startMonth: undefined,
|
||||
endMonth: undefined
|
||||
|
||||
})
|
||||
const projectList = ref<any[]>([])
|
||||
const chartData = ref<any[]>([])
|
||||
|
||||
const chartOption = ref({})
|
||||
|
||||
const getChartData = async () => {
|
||||
// 获取月度统计数据
|
||||
chartData.value = await ProjectMonthlyStatApi.getProjectMonthlyStatChartData({
|
||||
projectId: queryParams.projectId,
|
||||
startMonth: queryParams.startMonth,
|
||||
endMonth: queryParams.endMonth
|
||||
})
|
||||
updateChartOption()
|
||||
}
|
||||
|
||||
function updateChartOption() {
|
||||
const xData = chartData.value.map(item => {
|
||||
const str = String(item.statMonth)
|
||||
if (str.length === 6) {
|
||||
return `${str.slice(0, 4)}年${str.slice(4)}月`
|
||||
}
|
||||
return item.statMonth
|
||||
})
|
||||
const chargingQuantity = chartData.value.map(item => item.chargingQuantity)
|
||||
const totalIncome = chartData.value.map(item => item.totalIncome)
|
||||
const grossProfit = chartData.value.map(item => item.grossProfit)
|
||||
const grossProfitRate = chartData.value.map(item => item.grossProfitRate)
|
||||
|
||||
chartOption.value = {
|
||||
title: { text: '项目月度统计(折柱混合)', left: 'center' },
|
||||
tooltip: { trigger: 'axis' },
|
||||
legend: { data: ['充电量', '总营收', '毛利润', '毛利率'], top: 30 },
|
||||
xAxis: [
|
||||
{ type: 'category', data: xData, axisTick: { alignWithLabel: true }}
|
||||
],
|
||||
yAxis: [
|
||||
{ type: 'value', name: '金额(万元)', position: 'left', min: null, max: null, alignTicks: true }, // 0: 总营收/毛利润
|
||||
{ type: 'value', name: '充电量(万度)', position: 'left', offset: 120, min: null, max: null, alignTicks: true }, // 1: 充电量
|
||||
{ type: 'value', name: '毛利率(%)', position: 'right', min: null, max: null, axisLabel: { formatter: '{value}%' }, alignTicks: true } // 2: 毛利率
|
||||
],
|
||||
series: [
|
||||
{ name: '总营收', type: 'bar', data: totalIncome, yAxisIndex: 0, barMaxWidth: 28 },
|
||||
{ name: '毛利润', type: 'bar', data: grossProfit, yAxisIndex: 0, barMaxWidth: 28 },
|
||||
{ name: '充电量', type: 'bar', data: chargingQuantity, yAxisIndex: 1, barMaxWidth: 28 },
|
||||
{ name: '毛利率', type: 'line', data: grossProfitRate, yAxisIndex: 2, smooth: true, symbol: 'circle', symbolSize: 8 }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
// 获取项目列表
|
||||
const list = await ProjectApi.getProjectSimpleList()
|
||||
projectList.value = [{ id: undefined, name: '全部' }, ...list]
|
||||
queryParams.projectId = undefined
|
||||
await getChartData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.mb-16px { margin-bottom: 16px; }
|
||||
</style>
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目" prop="projectId">
|
||||
<el-select
|
||||
v-model="formData.projectId"
|
||||
class="!w-240px"
|
||||
placeholder="请选择项目"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in projectList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="统计月份" prop="statMonth">
|
||||
<el-date-picker
|
||||
v-model="formData.statMonth"
|
||||
type="month"
|
||||
placeholder="选择月"
|
||||
:value-format="'YYYYMM'"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="充电量(度)" prop="chargingQuantity">
|
||||
<el-input
|
||||
v-model="formData.chargingQuantity"
|
||||
placeholder="请输入充电量"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as ProjectMonthlyStatApi from '@/api/crm/project/monthly'
|
||||
import * as ProjectApi from '@/api/crm/project'
|
||||
|
||||
/** 项目月度统计 表单 */
|
||||
defineOptions({ name: 'ProjectMonthlyStatForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
projectId: undefined,
|
||||
statMonth: undefined,
|
||||
chargingQuantity: undefined
|
||||
})
|
||||
const formRules = reactive({
|
||||
projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }],
|
||||
statMonth: [{ required: true, message: '统计月份不能为空', trigger: 'blur' }],
|
||||
chargingQuantity: [{ required: true, message: '充电量不能为空', trigger: 'blur' }],
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
const projectList = ref()
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await ProjectMonthlyStatApi.getProjectMonthlyStat(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
// 获取项目列表
|
||||
projectList.value = await ProjectApi.getProjectSimpleList()
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as ProjectMonthlyStatApi.ProjectMonthlyStatVO
|
||||
if (formType.value === 'create') {
|
||||
await ProjectMonthlyStatApi.createProjectMonthlyStat(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await ProjectMonthlyStatApi.updateProjectMonthlyStat(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
projectId: undefined,
|
||||
statMonth: undefined,
|
||||
chargingQuantity: undefined
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,303 @@
|
|||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="项目名称" prop="projectId">
|
||||
<el-select
|
||||
v-model="queryParams.projectId"
|
||||
class="!w-240px"
|
||||
placeholder="请选择项目名称"
|
||||
@keyup.enter="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in projectList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="统计月份" prop="statMonth">
|
||||
<el-date-picker
|
||||
v-model="queryParams.statMonth"
|
||||
type="month"
|
||||
placeholder="选择月"
|
||||
:value-format="'YYYYMM'"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-120px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单枪充电量" prop="perGunCharging" label-width="90px">
|
||||
<el-input-number
|
||||
v-model="queryParams.perGunCharging[0]"
|
||||
:precision="2"
|
||||
class="!w-90px mr-8px"
|
||||
:controls="false"
|
||||
placeholder="最小值"
|
||||
/>
|
||||
<span style="margin: 0 8px;">-</span>
|
||||
<el-input-number
|
||||
v-model="queryParams.perGunCharging[1]"
|
||||
:precision="2"
|
||||
class="!w-90px"
|
||||
:controls="false"
|
||||
placeholder="最大值"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单枪服务费" prop="perGunProfit" label-width="90px">
|
||||
<el-input-number
|
||||
v-model="queryParams.perGunProfit[0]"
|
||||
:precision="2"
|
||||
class="!w-90px mr-8px"
|
||||
:controls="false"
|
||||
placeholder="最小值"
|
||||
/>
|
||||
<span style="margin: 0 8px;">-</span>
|
||||
<el-input-number
|
||||
v-model="queryParams.perGunProfit[1]"
|
||||
:precision="2"
|
||||
class="!w-90px"
|
||||
:controls="false"
|
||||
placeholder="最大值"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="度电服务费" prop="electricityServiceFee" label-width="90px">
|
||||
<el-input-number
|
||||
v-model="queryParams.electricityServiceFee[0]"
|
||||
:precision="2"
|
||||
class="!w-90px mr-8px"
|
||||
:controls="false"
|
||||
placeholder="最小值"
|
||||
/>
|
||||
<span style="margin: 0 8px;">-</span>
|
||||
<el-input-number
|
||||
v-model="queryParams.electricityServiceFee[1]"
|
||||
:precision="2"
|
||||
class="!w-90px"
|
||||
:controls="false"
|
||||
placeholder="最大值"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['crm:project-monthly-stat:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['crm:project-monthly-stat:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
<el-button plain type="warning" @click="openSummaryDialog">
|
||||
<Icon class="mr-5px" icon="ep:view" />
|
||||
查看汇总
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
@sort-change="handleSortChange"
|
||||
>
|
||||
|
||||
<el-table-column label="项目名称" align="center" prop="projectName" min-width="150px"/>
|
||||
<el-table-column label="枪数" align="center" prop="estimatedPiles" width="100px"/>
|
||||
<el-table-column label="统计月份" align="center" prop="statMonth" sortable="custom" />
|
||||
<el-table-column label="总充电量(度)" align="center" prop="chargingQuantity" sortable="custom"/>
|
||||
<el-table-column label="总营收(元)" align="center" prop="totalIncome" sortable="custom"/>
|
||||
<el-table-column label="总电费(元)" align="center" prop="totalElectricityCost" sortable="custom"/>
|
||||
<el-table-column label="总服务费(元)" align="center" prop="grossProfit" sortable="custom"/>
|
||||
<el-table-column label="毛利率(%)" align="center" prop="grossProfitRate" sortable="custom"/>
|
||||
<el-table-column label="单枪充电量(度)" align="center" prop="perGunCharging" sortable="custom"/>
|
||||
<el-table-column label="单枪服务费(元)" align="center" prop="perGunProfit" sortable="custom"/>
|
||||
<el-table-column label="度电服务费(元)" align="center" prop="electricityServiceFee" sortable="custom"/>
|
||||
<el-table-column label="操作" align="center" min-width="120px">
|
||||
<template #default="scope">
|
||||
<!-- {{ scope.row }} -->
|
||||
<el-button
|
||||
link
|
||||
type="success"
|
||||
@click="syncData(scope.row)"
|
||||
v-hasPermi="['crm:project-monthly-stat:update']"
|
||||
>
|
||||
同步
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['crm:project-monthly-stat:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<ProjectMonthlyStatForm ref="formRef" @success="getList" />
|
||||
<Dialog v-model="summaryDialogVisible" title="项目月度汇总图" width="80%" destroy-on-close>
|
||||
<ProjectMonthlyChart />
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import download from '@/utils/download'
|
||||
import * as ProjectMonthlyStatApi from '@/api/crm/project/monthly'
|
||||
import * as ProjectApi from '@/api/crm/project'
|
||||
import ProjectMonthlyStatForm from './ProjectMonthlyStatForm.vue'
|
||||
import ProjectMonthlyChart from '../component/ProjectMonthlyChart.vue'
|
||||
const summaryDialogVisible = ref(false)
|
||||
const openSummaryDialog = () => {
|
||||
summaryDialogVisible.value = true
|
||||
}
|
||||
|
||||
/** 项目月度统计 列表 */
|
||||
defineOptions({ name: 'ProjectMonthlyStat' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<ProjectMonthlyStatApi.ProjectMonthlyStatVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
projectId: undefined,
|
||||
statMonth: undefined,
|
||||
perGunCharging: [],
|
||||
perGunProfit: [],
|
||||
electricityServiceFee: [],
|
||||
sortingFields: []
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
const projectList = ref() // 项目列表
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const params = queryParams as unknown as ProjectMonthlyStatApi.ProjectMonthlyStatVO
|
||||
const data = await ProjectMonthlyStatApi.getProjectMonthlyStatPage(params)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await ProjectMonthlyStatApi.deleteProjectMonthlyStat(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await ProjectMonthlyStatApi.exportProjectMonthlyStat(queryParams)
|
||||
download.excel(data, '项目月度统计.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 同步数据操作 */
|
||||
const syncData = async (row: ProjectMonthlyStatApi.ProjectMonthlyStatVO) => {
|
||||
try {
|
||||
// 同步的二次确认
|
||||
await message.confirm('是否确认同步数据?')
|
||||
// 发起同步
|
||||
await ProjectMonthlyStatApi.syncProjectMonthlyStat(row)
|
||||
message.success(t('同步成功'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
|
||||
const handleSortChange = ({ prop, order }) => {
|
||||
// 只允许单列排序,清空原有排序
|
||||
if (!prop || !order) {
|
||||
queryParams.sortingFields = [];
|
||||
} else {
|
||||
queryParams.sortingFields = [{
|
||||
field: prop,
|
||||
order: order === 'ascending' ? 'asc' : 'desc'
|
||||
}];
|
||||
}
|
||||
queryParams.pageNo = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(async () => {
|
||||
|
||||
await getList()
|
||||
// 获取项目列表
|
||||
projectList.value = await ProjectApi.getProjectSimpleList()
|
||||
})
|
||||
</script>
|
||||
Loading…
Reference in New Issue