<template>
  <layout-card>
    <layout-table :data="list" :show-pagination="false">
      <el-table-column label="序号" width="70" type="index" />
      <el-table-column prop="CHECK_CONTENT" label="检查内容" />
      <el-table-column label="操作" width="80">
        <template v-slot="{ row }">
          <el-button type="primary" text link @click="fnEdit(row)">
            修改
          </el-button>
        </template>
      </el-table-column>
    </layout-table>
    <allocation-edit
      v-model:visible="data.editDialog.visible"
      v-model:form="data.editDialog.form"
      @get-data="fnGetData"
    />
  </layout-card>
</template>

<script setup>
import { useRoute } from "vue-router";
import useListData from "@/assets/js/useListData.js";
import { getRiskControlLedgerAllocationList } from "@/request/risk_control.js";
import { reactive } from "vue";
import { cloneDeep } from "lodash-es";
import AllocationEdit from "./components/allocation_edit.vue";

const route = useRoute();
const { RISKPOINT_ID } = route.query;
const { list, fnGetData } = useListData(getRiskControlLedgerAllocationList, {
  otherParams: { RISKPOINT_ID },
  usePagination: false,
});
const data = reactive({
  editDialog: {
    visible: false,
    form: {
      CHECK_CONTENT: "",
    },
  },
});
const fnEdit = (row) => {
  data.editDialog.visible = true;
  data.editDialog.form = cloneDeep(row);
};
</script>

<style scoped lang="scss"></style>
