<template>
  <SysDialog
    class="financial-verifyCategory-list"
    :visible="dialog.visible"
    v-bind="getBindValue"
    @onClose="onclose"
    @onConfirm="confirm"
    style="overflow: hidden;"
  >
    <template #content>
      <div class="flex">
        <div class="flex-1 preinstall">
          <el-divider content-position="left">
            <span class="title"> 产品费用 </span>
          </el-divider>
          <VxeBasicTable
            v-bind="financialVerifyCategoryListOptions"
            :data="stateFinancialVerifyCategory.productCost"
          />
        </div>
        <div class="flex-1 right">
          <el-divider content-position="left">
            <span class="title"> 账单费用 </span>
          </el-divider>
          <VxeBasicTable
            v-bind="financialVerifyCategoryListOptions"
            :data="stateFinancialVerifyCategory.billingExpenses"
          />
        </div>
      </div>
    </template>
    <template #defineFooter>
      <el-button
        type="danger"
        @click="onclose"
      >关闭</el-button>
    </template>
  </SysDialog>
</template>
<script lang="ts" setup>
import SysDialog from "@/components/SysDialog.vue";
import { financialVerifyCategoryListModel } from "@/composables/financial/financialVerifyList/useFinancialVerifyListModel";
import useDialog from "@/hooks/useDialog";
import { VxeBasicTable } from "@/components/VxeTable";
import { reactive } from "vue";
import { isArrayLength } from "@/utils/is";
// 弹框一些配置
const getBindValue = reactive({
  title: "核账费用明细",
  width: 920,
  height: 0,
  isFooter: true,
  overflowHidden: true,
});
//弹框属性
const { dialog, onClose, onShow } = useDialog();
const stateFinancialVerifyCategory = reactive({
  productCost: [] as Recordable[],
  billingExpenses: [] as Recordable[],
})

const { financialVerifyCategoryListOptions } =
  financialVerifyCategoryListModel();
// 显示/隐藏
const show = (list) => {
  // verifyRecordType 0: 产品费用 1:账单费用
  if(isArrayLength(list)) {
    stateFinancialVerifyCategory.productCost = list.filter(item => item.verifyRecordType === 0)
    stateFinancialVerifyCategory.billingExpenses = list.filter(item => item.verifyRecordType === 1)
  }
  onShow();
};
const onclose = () => {
  onClose();
};
const confirm = () => {};
//父组件调用子组件显示弹框
//暴露出去给外部使用
defineExpose({
  show
});
</script>
<style lang="scss" scoped>
.financial-verifyCategory-list {
  .preinstall {
    margin-right: 18px;
  }
}
</style>
