<template>
  <!-- 列表 -->
  <ContentWrap style="margin-top: 10px;padding: 10px;">
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" @row-click="openForm($event)" row-class-name="row"
    	>
      <el-table-column label="时间" align="center" prop="everyday"  />
      <el-table-column label="平台对碰支出" align="center" prop="totalCollisionAmount" >
        <template #default="scope">
          <span>{{ pointsToPoint(scope.row.totalCollisionAmount) }}</span>
        </template>
      </el-table-column>  
      <el-table-column label="平台收益" align="center" prop="totalRemainingAmount" >
        <template #default="scope">
          <span>{{ pointsToPoint(scope.row.totalRemainingAmount) }}</span>
        </template>
      </el-table-column> 
    </el-table>
    <!-- 分页 -->
    <Pagination
:total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize"
      @pagination="getList()" />
  </ContentWrap>

  <!-- 表单弹窗：添加/修改 -->
  <PartitionCrashForm ref="formRef" @success="getList" />
</template>

<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import { pointsToPoint } from '@/utils'
import download from '@/utils/download'
import { PartitionCrashApi, PartitionCrashVO } from '@/api/system/distri/partitioncrash'
import PartitionCrashForm from './PartitionCrashForm.vue'
import { Setting, Search, Operation } from '@element-plus/icons-vue'

/** 分区碰撞 列表 */
defineOptions({ name: 'PartitionCrash' })

const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化

const loading = ref(true) // 列表的加载中
const list = ref<PartitionCrashVO[]>([]) // 列表的数据
// 列表的总页数
const total = ref(0)
const queryParams = reactive({
  pageNo: 1,
  pageSize: 10,
  userId: undefined,
  partNo: undefined,
  brotherPrice: undefined,
  sonPrice: undefined,
  afterHitQuota: undefined,
  createTime: []
})
const queryFormRef = ref() // 搜索的表单
const exportLoading = ref(false) // 导出的加载中

/** 查询列表 */
const getList = async () => {
  loading.value = true
  try {
    const data = await PartitionCrashApi.getPartitionCrashAll(queryParams)
    list.value = data.list
    total.value = data.total
  } finally {
    loading.value = false
  }
  
}



/** 添加/修改操作 */
const formRef = ref()
const openForm = (row: any) => {
  formRef.value.open(row.everyday)
}




/** 初始化 **/
onMounted(() => {
  getList()
})
</script>
<style src="@/styles/SearchIndex.css"  lang="scss" scoped></style>
<style>
  .row{
    cursor: pointer;
  }
</style>