<template>
    <div class="policy-management-content">
        <div class="control-con-title">
            <div><span class="policy-export-btn">销售政策列表</span></div>
            <div>
                <!-- <span><a-button type="default" @click="handlePolicyExport">政策导出</a-button></span> -->
                <span class="add-acount-policy-btn"><a-button type="primary" @click="handleAddAccountPolicy">创建账户政策</a-button></span>
            </div>
        </div>
        <div class="control-con-header">
            <a-form
                class="grid-form"
                layout="inline"
                :form="searchForm"
                hide-required-mark
                @submit="handleQueryList"
            >
                <a-row class="grid-form-options">
                    <a-form-item
                        class="grid-form-item"
                        label="公司名称："
                        :colon="false"
                    >
                        <a-input v-model="configForm.companyName" placeholder="请输入公司名称"/>
                    </a-form-item>
                    <a-form-item
                        class="grid-form-item"
                        label="广告主名称："
                        :colon="false"
                    >
                        <a-input v-model="configForm.adverName" placeholder="请输入广告主名称"/>
                    </a-form-item>
                    <a-form-item
                        class="grid-form-item"
                        label="产品名称："
                        :colon="false"
                    >
                        <a-input v-model="configForm.productName" placeholder="请输入产品名称"/>
                    </a-form-item>
                    <a-form-item label="媒体：">
                        <a-select v-model="configForm.creativeMedia" style="width: 100px">
                            <a-select-option :value="2">不限</a-select-option>
                            <a-select-option value="CREATIVE_IMAGE_MODE_VIDEO_VERTICAL">快手</a-select-option>
                            <a-select-option value="CREATIVE_IMAGE_MODE_LARGE">头条</a-select-option>
                        </a-select>
                    </a-form-item>
                    <a-form-item label="返点类型：">
                        <a-select v-model="configForm.creativeRebate" style="width: 100px">
                            <a-select-option :value="2">不限</a-select-option>
                            <a-select-option value="CREATIVE_IMAGE_MODE_VIDEO_VERTICAL">返现</a-select-option>
                            <a-select-option value="CREATIVE_IMAGE_MODE_LARGE">返货</a-select-option>
                            <a-select-option value="CREATIVE_IMAGE_MODE_LARGE_VERTICAL">返现+返货</a-select-option>
                        </a-select>
                    </a-form-item>
                </a-row>
                <a-row>
                    <a-form-item
                        class="grid-form-item"
                        label="垫付公司名称："
                        :colon="false"
                    >
                        <a-input v-model="configForm.creativeAdvance" placeholder="请输入垫付公司名称"/>
                    </a-form-item>
                    <a-form-item label="销售：">
                        <a-select v-model="configForm.creativeSale" style="width: 100px">
                            <a-select-option :value="2">不限</a-select-option>
                            <a-select-option value="CREATIVE_IMAGE_MODE_VIDEO_VERTICAL">竖版视频</a-select-option>
                            <a-select-option value="CREATIVE_IMAGE_MODE_LARGE">大图横图</a-select-option>
                            <a-select-option value="CREATIVE_IMAGE_MODE_LARGE_VERTICAL">大图竖图</a-select-option>
                            <a-select-option value="CREATIVE_IMAGE_MODE_UNION_SPLASH">开屏</a-select-option>
                        </a-select>
                    </a-form-item>
                    <a-form-item label="运营方式：">
                        <a-select v-model="configForm.creativeOperate" style="width: 100px">
                            <a-select-option :value="2">不限</a-select-option>
                            <a-select-option value="CREATIVE_IMAGE_MODE_VIDEO_VERTICAL">自运营</a-select-option>
                            <a-select-option value="CREATIVE_IMAGE_MODE_LARGE">代运营</a-select-option>
                        </a-select>
                    </a-form-item>
                    <a-form-item
                        class="grid-form-item"
                        label="时间："
                        :colon="false"
                    >
                        <a-range-picker
                            v-model="configForm.time"
                            format="YYYY-MM-DD"
                        />
                    </a-form-item>
                    <a-form-item label="状态：">
                        <a-select v-model="configForm.searchStatus" style="width: 100px">
                            <a-select-option :value="2">不限</a-select-option>
                            <a-select-option :value="0">待审核</a-select-option>
                            <a-select-option :value="1">审核中</a-select-option>
                            <a-select-option :value="1">审核通过</a-select-option>
                            <a-select-option :value="1">审核拒绝</a-select-option>
                        </a-select>
                    </a-form-item>
                    <a-form-item class="form-handle-btn">
                        <a-button type="default" class="reset-class" @click="handleResetList">重置</a-button>
                        <a-button type="primary" html-type="submit">搜索</a-button>
                    </a-form-item>
                </a-row>
            </a-form>
        </div>
        <div class="control-con-table">
            <a-table
                ref="table"
                size="middle"
                bordered
                :columns="columns"
                :dataSource="dataSource"
                :pagination="false"
                :scroll="{x: 3000}"
            >
                <span slot="accountId_dictText" slot-scope="text">
                    <a>{{ text }}</a>
                </span>
                <span slot="validBalance" slot-scope="text">
                    <a>{{ text }}</a>
                </span>
                <span slot="adCpaBidStr" slot-scope="text">
                    <a>{{ text }}</a>
                </span>
                <span slot="action" slot-scope="text, record">
                    <a @click="handleDetail">查看</a>
                    <a-divider type="vertical"/>
                    <a @click="handleSubmitReview(text)">提交审核</a>
                    <a-divider type="vertical"/>
                    <a @click="handleEditTable(record)">编辑</a>
                    <a-divider type="vertical"/>
                    <a @click="handleAuditSure">审核通过</a>
                    <a-divider type="vertical"/>
                    <a @click="handleAuditCancel">审核拒绝</a>
                </span>
                <span slot="reason" slot-scope="text, record">
                    <a @click="handleRejectionReason(text)">被拒原因</a>
                </span>
            </a-table>
            <a-pagination
                class="pagin-table-class"
                :total="totalAll"
                :show-total="total => `共 ${totalAll} 条`"
                size="small"
                show-size-changer
                show-quick-jumper
                @change="onShowSizeChange"
                @showSizeChange="onShowSizeChange"
            />
        </div>
        <!-- 被拒理由 -->
        <a-modal
            v-if="rejectionReasonStatus"
            title="审核不通过"
            :visible="rejectionReasonStatus"
            dialog-class="rejection-reason-class"
            @ok="handleModeSure"
            @cancel="handleModeCancel"
        >
            <div>
                <div class="reason-class-header">请输入审核不通过的理由:</div>
                <div>显示不通过的理由</div>
            </div>
        </a-modal>
        <!-- 查看详情 -->
        <a-modal
            v-if="auditPolicyStatus"
            title="审核政策"
            :visible="auditPolicyStatus"
            :closable="false"
            okText="审核通过"
            cancelText="审核拒绝"
            dialog-class="audit-policy-class"
            @ok="handleAuditSure"
            @cancel="handleAuditCancel"
        >
            <div>
                <span class="audit-policy-icon" @click="handleCloseAuditPolicy"><a-icon type="close"/></span>
                <div class="policy-line-quen">
                    <div class="line-quen-left">
                        <div class="policy-line-left">
                            <span class="line-left-spn">公司名称：</span>
                            <span class="line-right-spn">北京有限公司北京有限公司北京有限公司北京有限公司北京有限公司北京有限公司</span>
                        </div>
                        <div class="policy-line-left">
                            <span class="line-left-spn">广告主：</span>
                            <span class="line-right-spn">北京有限公司</span>
                        </div>
                        <div class="policy-line-left">
                            <span class="line-left-spn">产品名称：</span>
                            <div style="width: 200px;">
                                <div class="line-right-spn">产品名称产品名称产品名称产品名称产品名称产品名称</div>
                                <div class="line-right-spn">产品名称</div>
                                <div class="line-right-spn">产品名称</div>
                            </div>
                        </div>
                        <div class="policy-line-left">
                            <span class="line-left-spn">媒体：</span>
                            <span class="line-right-spn">产品名称</span>
                        </div>
                        <div class="policy-line-left">
                            <span class="line-left-spn">销售：</span>
                            <span class="line-right-spn">产品名称</span>
                        </div>
                        <div class="policy-line-left">
                            <span class="line-left-spn">区域：</span>
                            <span class="line-right-spn">产品名称</span>
                        </div>
                        <div class="policy-line-left">
                            <span class="line-left-spn">我司主体：</span>
                            <span class="line-right-spn">产品名称</span>
                        </div>
                        <div class="policy-line-left">
                            <span class="line-left-spn">运营方式：</span>
                            <span class="line-right-spn">产品名称</span>
                        </div>
                        <div class="policy-line-left">
                            <span class="line-left-spn">集团简称：</span>
                            <span class="line-right-spn">产品名称</span>
                        </div>
                    </div>
                    <div class="line-quen-right">
                        <div class="policy-line-right">
                            <span class="line-left-spn">是否预付：</span>
                            <span class="line-right-spn">否</span>
                        </div>
                        <div class="policy-line-right">
                            <span class="line-left-spn">返点类型：</span>
                            <span class="line-right-spn">返现</span>
                        </div>
                        <div class="policy-line-right">
                            <span class="line-left-spn">返点比例：</span>
                            <span class="line-right-spn">3%</span>
                        </div>
                        <div class="policy-line-right">
                            <span class="line-left-spn">账期：</span>
                            <span class="line-right-spn">3%</span>
                        </div>
                        <div class="policy-line-right">
                            <span class="line-left-spn">是否第三方支付：</span>
                            <span class="line-right-spn">3%</span>
                        </div>
                        <div class="policy-line-right">
                            <span class="line-left-spn">垫付公司：</span>
                            <span class="line-right-spn">3%</span>
                        </div>
                        <div class="policy-line-right">
                            <span class="line-left-spn">垫付返现：</span>
                            <span class="line-right-spn">3%</span>
                        </div>
                        <div class="policy-line-right">
                            <span class="line-left-spn">政策起止时间：</span>
                            <span class="line-right-spn">3%</span>
                        </div>
                        <div class="policy-line-right">
                            <span class="line-left-spn">备注：</span>
                            <span class="line-right-spn">3%</span>
                        </div>
                    </div>
                </div>
            </div>
        </a-modal>
        <!-- 审核拒绝 -->
        <a-modal
            v-if="rejectAuditStatus"
            title="审核不通过"
            :visible="rejectAuditStatus"
            dialog-class="rejection-reason-class"
            @ok="handleRejectSure"
            @cancel="handleRejectCancel"
        >
            <div>
                <div class="reason-class-header">请输入审核不通过的理由:</div>
                <a-form-model
                    ref="rejectRuleForm"
                    :model="reasonForm"
                    :rules="reasonRules"
                >
                    <a-form-model-item label="" prop="desc">
                        <a-input
                            class="rejection-textarea-msg"
                            v-model="reasonForm.desc"
                            type="textarea"
                            placeholder="请输入至少五个字符"
                        />
                    </a-form-model-item>
                </a-form-model>
            </div>
        </a-modal>
        <!-- 新增、编辑政策 -->
        <a-modal
            v-if="policyOperationStatus"
            :title="addType === 'add' ? '新增政策' : '编辑政策'"
            :visible="policyOperationStatus"
            dialog-class="policy-operation-class"
            @ok="handlePolicyOperationSure"
            @cancel="handlePolicyOperationCancel"
        >
            <div>
                <a-form-model
                    class="policy-operation-form"
                    ref="policyOperationForm"
                    :model="policyOperationForm"
                    :rules="policyOperationRules"
                    :label-col="labelCol"
                    :wrapper-col="wrapperCol"
                >
                    <a-row class="policy-operation-form-left">
                        <a-form-model-item label="公司名称" prop="name1">
                            <a-input
                                v-model="policyOperationForm.name1"
                                placeholder="请输入公司名称"
                                allow-clear
                            />
                        </a-form-model-item>
                        <a-form-model-item label="广告主" prop="name1">
                            <a-input
                                v-model="policyOperationForm.name3"
                                placeholder="请输入广告主"
                                allow-clear
                            />
                        </a-form-model-item>
                        <!-- <a-form-model-item label="产品名称">
                            <a-button type="primary" @click="handleAddOrigin">
                                <a-icon type="plus"/>产品名称
                            </a-button>
                            <span class="especial-label">*</span>
                        </a-form-model-item>
                        <div class="adver-position-radio">
                            <a-form-model-item
                                v-for="(item, index) in policyOperationForm.defaultFormList"
                                :key="item.id"
                                :prop="'defaultFormList.' + index + '.value'"
                                :rules="[
                                    {required: true, message: '请输入', trigger: 'blur'},
                                    {min: 6, max: 9, message: '请输入6-9个字', trigger: 'blur'},
                                ]"
                            >
                                <a-input class="input-common-short" v-model="item.value" placeholder="请输入" allow-clear/>
                                <a-icon class="circle-icon-class" type="minus-circle" @click="handleDelOrigin(item)"/>
                            </a-form-model-item>
                        </div> -->
                        <div class="product-name-class" v-for="(item, index) in policyOperationForm.defaultFormList" :key="item.id">
                            <a-form-model-item
                                :label="index === 0 ? '产品名称' : ''"
                                :class="{'isActive': index > 0 }"
                                :prop="'defaultFormList.' + index + '.value'"
                                :rules="changeRules"
                            >
                                <a-input class="input-common-short" v-model="item.value" placeholder="请输入" allow-clear/>
                                <a-icon v-if="index === 0" class="circle-icon-class circle-icon-plus" type="plus-circle" @click="handleAddOrigin"/>
                                <a-icon v-if="policyOperationForm.defaultFormList.length > 1 && index === 0" class="circle-icon-class circle-icon-minus" type="minus-circle" @click="handleDelOrigin(item)"/>
                                <a-icon v-if="policyOperationForm.defaultFormList.length > 1 && index > 0" class="circle-icon-class circle-icon-plus" type="minus-circle" @click="handleDelOrigin(item)"/>
                            </a-form-model-item>
                        </div>
                        <a-form-model-item label="媒体" prop="name6">
                            <a-select v-model="policyOperationForm.name6" placeholder="请选择投放媒体">
                                <a-select-option :value="1">快手</a-select-option>
                                <a-select-option :value="2">头条</a-select-option>
                            </a-select>
                        </a-form-model-item>
                        <a-form-model-item label="销售" prop="name7">
                            <a-select v-model="policyOperationForm.name7" placeholder="请选择所属销售">
                                <a-select-option :value="2">不限</a-select-option>
                                <a-select-option :value="0">待审核</a-select-option>
                            </a-select>
                        </a-form-model-item>
                        <a-form-model-item label="区域" prop="name8">
                            <a-select v-model="policyOperationForm.name8" placeholder="请选择区域">
                                <a-select-option :value="2">不限</a-select-option>
                                <a-select-option :value="0">待审核</a-select-option>
                            </a-select>
                        </a-form-model-item>
                        <a-form-model-item label="我司主体" prop="name9">
                            <a-select v-model="policyOperationForm.name9" placeholder="请选择我司主体">
                                <a-select-option :value="2">不限</a-select-option>
                                <a-select-option :value="0">待审核</a-select-option>
                            </a-select>
                        </a-form-model-item>
                        <a-form-model-item label="运营方式" prop="name10">
                            <a-radio-group v-model="policyOperationForm.name10" button-style="solid">
                                <a-radio-button value="a">自运营</a-radio-button>
                                <a-radio-button value="b">代运营</a-radio-button>
                            </a-radio-group>
                        </a-form-model-item>
                        <a-form-model-item label="集团简称">
                            <a-input
                                v-model="policyOperationForm.name11"
                                placeholder="请输入集团简称"
                                allow-clear
                                @change="handleGroupAbbreviationChange"
                            />
                        </a-form-model-item>
                        <div v-if="subTitleMsgStatus" style="color: #f00;margin-left: 140px">只能输入30个汉字</div>
                    </a-row>
                    <a-row class="policy-operation-form-right">
                        <a-form-model-item label="是否预付" prop="name2">
                            <a-radio-group v-model="policyOperationForm.name2" button-style="solid" @change="handlePrepaidNotChange">
                                <a-radio-button value="a">是</a-radio-button>
                                <a-radio-button value="b">否</a-radio-button>
                            </a-radio-group>
                        </a-form-model-item>
                        <a-form-model-item label="返点类型：" prop="name4">
                            <a-select v-model="policyOperationForm.name4" placeholder="请选择返点类型">
                                <a-select-option :value="2">不限</a-select-option>
                                <a-select-option :value="0">待审核</a-select-option>
                                <a-select-option :value="1">审核中</a-select-option>
                                <a-select-option :value="1">审核通过</a-select-option>
                                <a-select-option :value="1">审核拒绝</a-select-option>
                            </a-select>
                        </a-form-model-item>
                        <a-form-model-item label="返点比例" prop="name12">
                            <a-input-number
                                v-model="policyOperationForm.name12"
                                :precision="2"
                            /> %
                        </a-form-model-item>
                        <a-form-model-item v-if="policyOperationForm.name2 === 'b'" label="账期" prop="name13">
                            <a-input-number
                                v-model="policyOperationForm.name13"
                                :precision="0"
                            /> 天
                        </a-form-model-item>
                        <a-form-model-item v-if="policyOperationForm.name2 === 'b'" label="是否第三方垫付" prop="name14">
                            <a-radio-group v-model="policyOperationForm.name14" button-style="solid">
                                <a-radio-button value="a">是</a-radio-button>
                                <a-radio-button value="b">否</a-radio-button>
                            </a-radio-group>
                        </a-form-model-item>
                        <a-form-model-item v-if="policyOperationForm.name14 === 'a'" label="垫付公司" prop="name15">
                            <a-input
                                v-model="policyOperationForm.name15"
                                placeholder="请输入垫付公司"
                                allow-clear
                            />
                        </a-form-model-item>
                        <a-form-model-item v-if="policyOperationForm.name14 === 'a'" label="垫付返点" prop="name16">
                            <a-input
                                v-model="policyOperationForm.name16"
                                placeholder="请输入垫付返点"
                                allow-clear
                            />
                        </a-form-model-item>
                        <a-form-model-item label="政策起止时间" prop="name17">
                            <a-range-picker
                                v-model="policyOperationForm.name17"
                                format="YYYY-MM-DD"
                            />
                        </a-form-model-item>
                        <a-form-model-item label="备注">
                            <a-input
                                v-model="policyOperationForm.name18"
                                placeholder="请输入备注"
                                allow-clear
                                @change="handleRemarksChange"
                            />
                        </a-form-model-item>
                        <div v-if="remarksStatus" style="color: #f00;margin-left: 140px">只能输入100个汉字</div>
                    </a-row>
                </a-form-model>
            </div>
        </a-modal>
    </div>
</template>
<script>
export default {
    name: 'policy-management',
    data() {
        let handleCharacterLen30 = (rule, value, callback) => {
            this.handleExportRules(value, 1, 30, callback);
        };
        return {
            subTitleMsgStatus: false,
            remarksStatus: false,
            changeRules: [
                {required: true, message: '请输入产品名称', trigger: 'blur'},
                {validator: handleCharacterLen30, trigger: 'blur'}
            ],
            addType: 'add',
            labelCol: {span: 7},
            wrapperCol: {span: 14},
            rejectAuditStatus: false,
            rejectionReasonStatus: false,
            auditPolicyStatus: false,
            policyOperationStatus: false,
            totalAll: 0,
            policyOperationForm: {
                defaultFormList: [
                    {
                        id: 1,
                        value: ''
                    }
                ],
                name1: '',
                name2: 'a',
                name3: '',
                name4: undefined,
                name6: 1,
                name7: undefined,
                name8: undefined,
                name9: undefined,
                name10: 'b',
                name11: '',
                name12: '',
                name13: '',
                name14: undefined,
                name15: '',
                name16: '',
                name17: [],
                name18: ''
            },
            reasonForm: {
                desc: ''
            },
            policyOperationRules: {
                name1: [
                    {required: true, message: '请输入公司名称', trigger: 'blur'},
                    {validator: handleCharacterLen30, trigger: 'blur'}
                ],
                name3: [
                    {required: true, message: '请输入广告主名称', trigger: 'blur'},
                    {validator: handleCharacterLen30, trigger: 'blur'}
                ],
                name4: [{required: true, message: '请选择返点类型', trigger: 'change'}],
                name6: [{required: true, message: '请选择投放媒体', trigger: 'change'}],
                name7: [{required: true, message: '请选择所属销售', trigger: 'change'}],
                name8: [{required: true, message: '请选择区域', trigger: 'change'}],
                name9: [{required: true, message: '请选择我司主体', trigger: 'change'}],
                name12: [{required: true, message: '请输入返点比例', trigger: 'blur'}],
                name13: [{required: true, message: '请输入账期', trigger: 'blur'}],
                name15: [
                    {required: true, message: '请输入垫付公司', trigger: 'blur'},
                    {validator: handleCharacterLen30, trigger: 'blur'}
                ],
                name16: [{required: true, message: '请输入垫付返点', trigger: 'blur'}],
                name17: [{required: true, message: '请选择时间', trigger: 'change'}],
            },
            reasonRules: {
                desc: [
                    {required: true, message: '请输入审核拒绝理由', trigger: 'blur'},
                    {min: 5, max: 100, message: '请输入5-100个字符', trigger: 'blur'}
                ]
            },
            dataSource: [
                {
                   status: '腾讯科技有限公司', 
                   accountId_dictText: '腾讯科技有限公司', 
                   creativeImageMode: '产品名称', 
                   accountId: '快手', 
                   createTime: '何甜甜', 
                   validBalance: '待审核', 
                   accountBudget: '是', 
                   adCpaBidStr: '80天',
                   cost: '返现',
                   cost11: '3%',
                   cost22: '是',
                   cost33: '酒气有限公司',
                   cost44: '3%',
                   cost55: '代运营',
                   cost66: '2020-12-04',
                   cost77: '这个是备注',
                }
            ],
            columns: [
                {
                    title: '公司名称',
                    align: 'center',
                    dataIndex: 'status',
                    width: 150
                },
                {
                    title: '广告主',
                    align: 'center',
                    dataIndex: 'accountId_dictText',
                    width: 150,
                    scopedSlots: {customRender: 'accountId_dictText'}
                },
                {
                    title: '产品',
                    align: 'center',
                    dataIndex: 'creativeImageMode',
                    width: 150
                },
                {
                    title: '媒体',
                    align: 'center',
                    dataIndex: 'accountId',
                    width: 150
                },
                {
                    title: '销售',
                    dataIndex: 'createTime',
                    align: 'center',
                    width: 150
                },
                {
                    title: '状态',
                    dataIndex: 'validBalance',
                    align: 'center',
                    width: 150,
                    scopedSlots: {customRender: 'validBalance'}
                },
                {
                    title: '是否预付',
                    dataIndex: 'accountBudget',
                    width: 180,
                    align: 'center'
                },
                {
                    title: '账期',
                    dataIndex: 'adCpaBidStr',
                    align: 'center',
                    width: 150,
                    scopedSlots: {customRender: 'adCpaBidStr'}
                },
                {
                    title: '返点类型',
                    align: 'center',
                    dataIndex: 'cost',
                    width: 150
                },
                {
                    title: '返点比例',
                    align: 'center',
                    dataIndex: 'cost11',
                    width: 150
                },
                {
                    title: '是否垫付',
                    align: 'center',
                    dataIndex: 'cost22',
                    width: 150
                },
                {
                    title: '垫付公司',
                    align: 'center',
                    dataIndex: 'cost33',
                    width: 150
                },
                {
                    title: '垫付公司返点',
                    align: 'center',
                    dataIndex: 'cost44',
                    width: 150
                },
                {
                    title: '运营方式',
                    align: 'center',
                    dataIndex: 'cost55',
                    width: 150
                },
                {
                    title: '政策日期',
                    align: 'center',
                    dataIndex: 'cost66',
                    width: 150
                },
                {
                    title: '备注',
                    align: 'center',
                    dataIndex: 'cost77',
                    width: 150
                },
                {
                    title: '操作',
                    dataIndex: 'action',
                    align: 'center',
                    width: 250,
                    fixed: 'right',
                    scopedSlots: {customRender: 'action'}
                },
                {
                    title: '审核理由',
                    dataIndex: 'reason',
                    align: 'center',
                    width: 150,
                    fixed: 'right',
                    scopedSlots: {customRender: 'reason'}
                }
            ],
            configForm: {
                companyName: undefined,
                adverName: undefined,
                productName: undefined,
                creativeMedia: 2,
                creativeRebate: 2,
                creativeAdvance: undefined,
                creativeSale: undefined,
                creativeOperate: 2,
                time: [],
                searchStatus: 2
            },
            tablePag: {
                page: 1,
                size: 10
            }
        }; 
    },
    created() {
        this.searchForm = this.$form.createForm(this);
    },
    methods: {
        handleRemarksChange(e) {
            const targetVal = e.target.value;
            let cnReg = /([\u4e00-\u9fa5]|[\u3000-\u303F]|[\uFF00-\uFF60])/;
            let length = 0;
            let strArr = targetVal.split('');
            strArr.forEach(item => {
                if (cnReg.test(item)) {
                    length += 2;
                }
                else {
                    length += 1;
                }
            });
            if (1 <= length && length <= 200) {
                this.remarksStatus = false;
            }
            else {
                this.remarksStatus = true;
            }
        },
        handleGroupAbbreviationChange(e) {
            const targetVal = e.target.value;
            let cnReg = /([\u4e00-\u9fa5]|[\u3000-\u303F]|[\uFF00-\uFF60])/;
            let length = 0;
            let strArr = targetVal.split('');
            strArr.forEach(item => {
                if (cnReg.test(item)) {
                    length += 2;
                }
                else {
                    length += 1;
                }
            });
            if (1 <= length && length <= 60) {
                this.subTitleMsgStatus = false;
            }
            else {
                this.subTitleMsgStatus = true;
            }
        },
        disabledDate(current) {
            return current > moment().subtract(1, 'day');
        },
        handleAddOrigin() {
            const randomNum = new Date().getTime() + Math.ceil(Math.random() * 1000);
            this.$nextTick(() => {
                this.policyOperationForm.defaultFormList.push({
                    id: randomNum,
                    value: ''
                });
            });
        },
        handleDelOrigin(list) {
            if (this.policyOperationForm.defaultFormList.length === 1) {
                return;
            }
            let formData = this.policyOperationForm.defaultFormList;
            this.policyOperationForm.defaultFormList = formData.filter(item => list.id !== item.id);
        },
        handlePrepaidNotChange(e) {
            if (e.target.value === 'a') {
                this.policyOperationForm.name14 = undefined;
            }
            else if (e.target.value === 'b') {
                this.policyOperationForm.name14 = 'a';
            }
        },
        handleExportRules(value, min, max, callback) {
            let cnReg = /([\u4e00-\u9fa5]|[\u3000-\u303F]|[\uFF00-\uFF60])/;
            let length = 0;
            let strArr = value.split('');
            strArr.forEach(item => {
                if (cnReg.test(item)) {
                    length += 2;
                }
                else {
                    length += 1;
                }
            });
            if (min * 2 <= length && length <= max * 2) {
                callback();
            }
            else {
                callback(`只能输入${min}-${max}个汉字`);
            }
        },
        // 分页操作按钮
        onShowSizeChange(current, pageSize) {
            // this.tablePag = {
            //     page: current,
            //     size: pageSize
            // };
            // this.handleInitTable();
        },
        handleEditTable() {
            this.addType = 'edit';
            this.policyOperationStatus = true;
        },
        // 政策导出按钮
        handlePolicyExport() {
            console.log('政策导出按钮');
        },
        // 新增政策按钮
        handleAddAccountPolicy() {
            console.log('新增政策按钮');
            this.addType = 'add';
            this.policyOperationStatus = true;
        },
        // 新增政策确定按钮
        handlePolicyOperationSure() {
            console.log('新增政策确定按钮');
            this.$refs.policyOperationForm.validate(valid => {
                if (valid) {
                    this.policyOperationStatus = false;
                }
                else {
                    console.log('error submit!!');
                    return false;
                }
            });
        },
        // 新增政策取消按钮
        handlePolicyOperationCancel() {
            console.log('新增政策取消按钮');
            this.policyOperationStatus = false;
        },
        // 审核拒绝确定按钮
        handleRejectSure() {
            console.log('审核拒绝确定按钮');
            this.$refs.rejectRuleForm.validate(valid => {
                if (valid) {
                    console.log('submit!');
                    this.rejectAuditStatus = false;
                }
                else {
                    console.log('error submit!!');
                    return false;
                }
            });
        },
        // 审核拒绝取消按钮
        handleRejectCancel() {
            this.reasonForm.desc = '';
            this.rejectAuditStatus = false;
        },
        // 查看的按钮
        handleDetail(list) {
            console.log(list, '查看的按钮');
            this.auditPolicyStatus = true;
        },
        // 查看的取消按钮
        handleCloseAuditPolicy() {
            this.auditPolicyStatus = false;
        },
        // 查看-审核政策-审核通过-按钮
        handleAuditSure() {
            let that = this;
            this.$confirm({
                title: '提示',
                content: '确认该政策审核通过',
                onOk() {}
            });
        },
        // 查看-审核政策-审核拒绝-按钮
        handleAuditCancel() {
            this.rejectAuditStatus = true;
        },
        // 提交审核弹窗
        handleSubmitReview(val) {
            let that = this;
            this.$confirm({
                title: '提示',
                content: '是否确认重新提交政策审核',
                onOk() {}
            });
        },
        // 被拒理由的操作
        handleRejectionReason(val) {
            console.log('被拒理由的操作');
            this.rejectionReasonStatus = true;
        },
        // 被拒理由确定按钮
        handleModeSure() {
            console.log('被拒理由确定按钮');
            this.rejectionReasonStatus = false;
        },
        // 被拒理由取消按钮
        handleModeCancel() {
            this.rejectionReasonStatus = false;
        },
        // 搜索按钮
        handleQueryList() {
            console.log('搜索按钮');
        },
        // 重置搜索
        handleResetList() {
            console.log('重置搜索');
        }
    }
};
</script>
<style lang="less" scoped>
    @import "policy-management";
</style>
