import { getAgreementTypeName } from "@/common/constants/enumsName";
import { formatValue } from "@/common/methods";
import { QhjAgreementConfig } from "@/services/go/ermcp/qhj/interface";
import { ref } from "vue";
import { handleArgreementType } from "../setup";


export function handleAgreementLog(data: QhjAgreementConfig) {
    const { getRateEnumName } = handleArgreementType();
    const columns = [
        {
            title: '时间',
            dataIndex: 'updatetime',
            key: 'updatetime',
        },
        {
            title: '协议名称',
            dataIndex: 'agreementname',
            key: 'agreementname',
        },
        {
            title: '内容',
            dataIndex: 'agreementcontent',
            key: 'agreementcontent',
            slots: { customRender: 'agreementcontent' },
        },
    ];
    // 协议内容
    const visibleContent = ref<boolean>(false);
    const content = ref<string>('');
    function getContent(value: string) {
        visibleContent.value = true;
        content.value = value;
    }
    const list = [
        { label: '协议编号', value: formatValue(data.agreementno) },
        { label: '协议名称', value: formatValue(data.agreementname) },
        { label: '协议类型', value: getAgreementTypeName(data.agreementtype) },
        { label: '签署频率', value: getRateEnumName(data.agreementfrequency) },
        { label: '内容', value: '查看', className: 'blue' },
    ];
    return { columns, visibleContent, content, getContent, list }
}