<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
    <div>

        <div v-if="inputForm.sourceType === '5'">
            <el-divider content-position="left"><i class="el-icon-document"></i>
                采购详情
            </el-divider>
            <el-row :gutter="15">
                <vxe-table border show-footer show-overflow :footer-method="footerMethod555" ref="preTable"
                    class="vxe-table-element" :data="inputForm.preList" style="margin-left: 5em" highlight-current-row>
                    <vxe-table-column field="purchaser" title="采购人" :edit-render="{}" show-overflow="title"
                        :rules="[{ required: true, message: '请选择采购人', trigger: 'blur' }]"></vxe-table-column>
                    <vxe-table-column field="procurementOffice" title="采购部门" :edit-render="{}"
                        show-overflow="title"></vxe-table-column>
                    <vxe-table-column field="procurementType" title="采购类型" :edit-render="{}" show-overflow="title"
                        :rules="[{ required: true, message: '请选择采购类型', trigger: 'blur' }]"></vxe-table-column>
                    <vxe-table-column field="tradeName" title="商品名称" :edit-render="{}" show-overflow="title"
                        :rules="[{ required: true, message: '请填写商品名称', trigger: 'blur' }]"></vxe-table-column>
                    <vxe-table-column field="tradePrice" title="商品单价(元)" :edit-render="{}" show-overflow="title"
                        :rules="[{ required: true, message: '请输入商品单价', trigger: 'blur' }]"></vxe-table-column>
                    <vxe-table-column field="tradeNumber" title="商品数量" :edit-render="{}"
                        show-overflow="title"></vxe-table-column>
                    <vxe-table-column field="priceSum" title="商品总价" :edit-render="{}"
                        show-overflow="title"></vxe-table-column>
                    <vxe-table-column field="company" title="单位" :edit-render="{}"
                        show-overflow="title"></vxe-table-column>
                    <vxe-table-column field="remarks" title="备注" :edit-render="{}"
                        show-overflow="title"></vxe-table-column>
                    <vxe-table-column title="操作">
                        <template #default="scope">
                            <el-button size="default" type="primary" :disabled="false"
                                @click="seeFileInfo(scope.$rowIndex)">文件详情</el-button>
                        </template>
                    </vxe-table-column>
                </vxe-table>
            </el-row>
        </div>
        <div v-if="tenantFlag === 'pg' && inputForm.sourceType === '1'">
            <el-divider content-position="left"><i class="el-icon-document"></i>
                项目报销详情
                <el-button style="margin-left: 20px" type="primary"
                    :disabled="method === 'view' || status === 'audit' || status === 'taskFormDetail'" size="default"
                    @click="insertEvent('detail')" plain>
                    新增报销单
                </el-button>
            </el-divider>
            <el-row :gutter="15">
                <el-col :span="24">
                    <vxe-table border show-footer show-overflow :footer-method="footerMethod" ref="detailTable"
                        :key="detailKey" class="vxe-table-element" :data="inputForm.detailInfos"
                        style="margin-left: 5em" @cell-click="" @edit-closed="" highlight-current-row
                        :edit-config="{ trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon: '_' }"
                        :edit-rules="validRules" :row-config="{ keyField: 'uniqueId' }"
                        :expand-config="{ expandAll: false, accordion: false, toggleMethod: handleExpand, expandRowKeys: handleDefaultExpand() }">
                        <vxe-column title="报销单" type="expand" width="80">
                            <template #default="{ row, rowIndex }">
                                <span>{{ rowIndex + 1 }}</span>
                            </template>
                            <template #content="{ row, rowIndex }">
                                <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                    @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
                                    :ref="row.uniqueId + 'Upload'">
                                </InvoiceReimbursementUpLoadComponent>
                            </template>
                        </vxe-column>
                        <vxe-table-column field="userName" title="报销人" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销人', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.userName"
                                    @focus="userPullListForm(scope.$rowIndex)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input :disabled='true' v-model="scope.row.deptName"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="typeName" title="报销类别" :edit-render="{}"
                            :rules="[{ required: true, message: '请选择报销类别', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.typeName"
                                    @focus="typePullForm(scope.$rowIndex, scope.row.deptId)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="projectName" title="报销项目" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销项目', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.projectName"
                                    @focus="openProgramPageFormPg(scope.$rowIndex, scope.row)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="reportNumber" title="报告号" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input :readonly="true" v-model="scope.row.reportNumber"></el-input>
                            </template>
                        </vxe-table-column>

                        <vxe-colgroup title="费用" align="center">
                            <vxe-table-column field="number" title="数电发票" show-overflow="title" :edit-render="{}"
                                :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.number"
                                        @input="handleOrdinaryNumberInput(scope.row, 1)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 1)"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="ordinaryNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title" :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.ordinaryNumber"
                                        @input="handleOrdinaryNumberInput(scope.row, 2)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 2)"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="numberCount" title="汇总" show-overflow="title"
                                :rules="[{ required: true, message: '请输入费用汇总', trigger: 'blur' }]">
                                <template #header="{ column }">
                                    <span class="star-icon"></span>
                                    <span>汇总</span>
                                </template>
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.numberCount"></el-input>
                                </template>
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-colgroup title="票据张数" align="center">
                            <vxe-table-column field="receiptNumber" title="数电发票" show-overflow="title">

                            </vxe-table-column>
                            <vxe-table-column field="ordinaryReceiptNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title">
                                <template #edit="scope">
                                    <el-input v-model="scope.row.ordinaryReceiptNumber"
                                        @input="handleReceiptNumberInput(scope.row)" maxlength="10"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="receiptNumberCount" title="汇总" show-overflow="title">
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-table-column field="content" title="内容" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.content"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="days" title="出差天数" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.days" oninput="value=value.replace(/\D|^0/g,'')"
                                    maxlength="10"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column title="操作" width="180">
                            <template #default="scope">
                                <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                    type="primary">新增</el-button>
                                <el-button size="default" type="danger"
                                    @click="removeEvent(scope.row, scope.$rowIndex, 'detail')">删除</el-button>
                            </template>
                        </vxe-table-column>
                    </vxe-table>
                </el-col>

            </el-row>
        </div>
        <div v-else-if="tenantFlag === 'cw' && inputForm.sourceType === '1'">
            <el-divider content-position="left"><i class="el-icon-document"></i>
                项目报销详情
                <el-button style="margin-left: 20px" type="primary"
                    :disabled="method === 'view' || status === 'audit' || status === 'taskFormDetail'" size="default"
                    @click="insertEvent('detail')" plain>
                    新增报销单
                </el-button>
            </el-divider>
            <el-row :gutter="15">
                <el-col :span="24">
                    <vxe-table border show-footer show-overflow :footer-method="footerMethod" ref="detailTable"
                        :key="detailKey" class="vxe-table-element" :data="inputForm.detailInfos"
                        style="margin-left: 5em" @cell-click="" @edit-closed="" highlight-current-row
                        :edit-config="{ trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon: '_' }"
                        :edit-rules="validRules" :row-config="{ keyField: 'uniqueId' }"
                        :expand-config="{ expandAll: false, accordion: false, toggleMethod: handleExpand, expandRowKeys: handleDefaultExpand() }">
                        <vxe-column title="报销单" type="expand" width="80">
                            <template #default="{ row, rowIndex }">
                                <span>{{ rowIndex + 1 }}</span>
                            </template>
                            <template #content="{ row, rowIndex }">
                                <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                    @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
                                    :ref="row.uniqueId + 'Upload'">
                                </InvoiceReimbursementUpLoadComponent>
                            </template>
                        </vxe-column>
                        <vxe-table-column field="userName" title="报销人" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销人', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.userName"
                                    @focus="userPullListForm(scope.$rowIndex)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input :disabled='true' v-model="scope.row.deptName"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="typeName" title="报销类别" :edit-render="{}"
                            :rules="[{ required: true, message: '请选择报销类别', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.typeName"
                                    @focus="typePullFormProject(scope.$rowIndex, scope.row.deptId)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="projectName" title="报销项目" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销项目', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.projectName"
                                    @focus="openProgramPageFormCwProject(scope.$rowIndex, scope.row)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="reportNumber" title="报告号" :edit-render="{}" show-overflow="title">
                            <template v-slot:edit="scope">
                                <el-input :readonly="true" v-model="scope.row.reportNumber"
                                    @focus="openReportNoPageFormCwProject(scope.$rowIndex, scope.row)"></el-input>
                            </template>
                        </vxe-table-column>

                        <vxe-colgroup title="费用" align="center">
                            <vxe-table-column field="number" title="数电发票" show-overflow="title" :edit-render="{}"
                                :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.number"
                                        @input="handleOrdinaryNumberInput(scope.row, 1)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 1)"></el-input> </template>
                            </vxe-table-column>
                            <vxe-table-column field="ordinaryNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title" :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.ordinaryNumber"
                                        @input="handleOrdinaryNumberInput(scope.row, 2)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 2)"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="numberCount" title="汇总" show-overflow="title"
                                :rules="[{ required: true, message: '请输入费用汇总', trigger: 'blur' }]">
                                <template #header="{ column }">
                                    <span class="star-icon"></span>
                                    <span>汇总</span>
                                </template>
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.numberCount"></el-input>
                                </template>
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-colgroup title="票据张数" align="center">
                            <vxe-table-column field="receiptNumber" title="数电发票" show-overflow="title">

                            </vxe-table-column>
                            <vxe-table-column field="ordinaryReceiptNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title">
                                <template #edit="scope">
                                    <el-input v-model="scope.row.ordinaryReceiptNumber"
                                        @input="handleReceiptNumberInput(scope.row)" maxlength="10"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="receiptNumberCount" title="汇总" show-overflow="title">
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-table-column field="content" title="内容" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.content"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="days" title="出差天数" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.days" oninput="value=value.replace(/\D|^0/g,'')"
                                    maxlength="10"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column title="操作" width="180">
                            <template #default="scope">
                                <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                    type="primary">新增</el-button>
                                <el-button size="default" type="danger"
                                    @click="removeEvent(scope.row, scope.$rowIndex, 'detail')">删除</el-button>
                            </template>
                        </vxe-table-column>
                    </vxe-table>
                </el-col>

            </el-row>
        </div>
        <div v-else-if="tenantFlag !== 'pg' && inputForm.sourceType === '1'">
            <el-divider content-position="left"><i class="el-icon-document"></i>
                项目报销详情
                <el-button size="default" style="margin-left: 20px" type="primary"
                    :disabled="method === 'view' || status === 'audit' || status === 'taskFormDetail'"
                    @click="insertEvent('detail')" plain>
                    新增报销单
                </el-button>
            </el-divider>
            <el-row :gutter="15">
                <el-col :span="24">
                    <vxe-table border show-footer show-overflow :footer-method="footerMethod" ref="detailTable"
                        class="vxe-table-element" :data="inputForm.detailInfos" style="margin-left: 5em"
                        :key="detailKey" highlight-current-row
                        :edit-config="{ trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon: '_' }"
                        :edit-rules="validRules" :row-config="{ keyField: 'uniqueId' }"
                        :expand-config="{ expandAll: false, accordion: false, toggleMethod: handleExpand, expandRowKeys: handleDefaultExpand() }">
                        <vxe-column title="报销单" type="expand" width="80">
                            <template #default="{ row, rowIndex }">
                                <span>{{ rowIndex + 1 }}</span>
                            </template>
                            <template #content="{ row, rowIndex }">
                                <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                    @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
                                    :ref="row.uniqueId + 'Upload'">
                                </InvoiceReimbursementUpLoadComponent>
                            </template>
                        </vxe-column>
                        <vxe-table-column field="userName" title="报销人" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销人', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.userName"
                                    @focus="userPullListForm(scope.$rowIndex)"></el-input>
                                <!--              <UserSelectV2 :limit='1' :userName="scope.row.userName" @getValue='(value, label) => {scope.row.userName = label}'></UserSelectV2>-->
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input :disabled='true' v-model="scope.row.deptName"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="typeName" title="报销类别" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销类别', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.typeName"
                                    @focus="typePullForm(scope.$rowIndex, scope.row.deptId)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="projectName" title="报销详情" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请填写报销详情', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.projectName"
                                    @focus="openProgramPageForm(scope.$rowIndex, scope.row)"></el-input>
                            </template>
                        </vxe-table-column>

                        <vxe-colgroup title="费用" align="center">
                            <vxe-table-column field="number" title="数电发票" show-overflow="title" :edit-render="{}"
                                :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.number"
                                        @input="handleOrdinaryNumberInput(scope.row, 1)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 1)"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="ordinaryNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title" :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.ordinaryNumber"
                                        @input="handleOrdinaryNumberInput(scope.row, 2)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 2)"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="numberCount" title="汇总" show-overflow="title"
                                :rules="[{ required: true, message: '请输入费用汇总', trigger: 'blur' }]">
                                <template #header="{ column }">
                                    <span class="star-icon"></span>
                                    <span>汇总</span>
                                </template>
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.numberCount"></el-input>
                                </template>
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-colgroup title="票据张数" align="center">
                            <vxe-table-column field="receiptNumber" title="数电发票" show-overflow="title">

                            </vxe-table-column>
                            <vxe-table-column field="ordinaryReceiptNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title">
                                <template #edit="scope">
                                    <el-input v-model="scope.row.ordinaryReceiptNumber"
                                        @input="handleReceiptNumberInput(scope.row)" maxlength="10"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="receiptNumberCount" title="汇总" show-overflow="title">
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-table-column field="content" title="内容" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.content"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="days" title="出差天数" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.days" oninput="value=value.replace(/\D|^0/g,'')"
                                    maxlength="10"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column title="操作" width="180">
                            <template #default="scope">
                                <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                    type="primary">新增</el-button>
                                <el-button size="default" type="danger"
                                    @click="removeEvent(scope.row, scope.$rowIndex, 'detail')">删除</el-button>
                            </template>
                        </vxe-table-column>
                    </vxe-table>
                </el-col>
            </el-row>
        </div>

        <div v-if="inputForm.sourceType === '2'">
            <el-divider content-position="left"><i class="el-icon-document"></i>
                合同报销详情
                <el-button size="default" style="margin-left: 20px" type="primary"
                    :disabled="method === 'view' || status === 'audit' || status === 'taskFormDetail'"
                    @click="insertEvent('contract_detail')" plain>
                    新增报销单
                </el-button>
            </el-divider>
            <el-row :gutter="15">
                <vxe-table border show-footer show-overflow :footer-method="footerMethod" ref="detailTableContract"
                    :key="detailKeyContract" class="vxe-table-element" :data="inputForm.detailInfoContracts"
                    style="margin-left: 5em" highlight-current-row
                    :edit-config="{ trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon: '_' }"
                    :edit-rules="validRules">
                    <vxe-table-column field="userName" title="报销人" :edit-render="{}" show-overflow="title"
                        :rules="[{ required: true, message: '请选择报销人', trigger: 'blur' }]">
                        <template #edit="scope">
                            <el-input v-model="scope.row.userName"
                                @focus="userPullListForm2(scope.$rowIndex)"></el-input>
                            <!--              <UserSelectV2 :limit='1' :userName="scope.row.userName" @getValue='(value, label) => {scope.row.userName = label}'></UserSelectV2>-->
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
                        <template #edit="scope">
                            <el-input :disabled='true' v-model="scope.row.deptName"></el-input>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="typeName" title="报销类别" :edit-render="{}" show-overflow="title"
                        :rules="[{ required: true, message: '请选择报销类别', trigger: 'blur' }]">
                        <template #edit="scope">
                            <el-input v-model="scope.row.typeName"
                                @focus="typePullForm2(scope.$rowIndex, scope.row.deptId)"></el-input>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="contractName" title="报销合同" :edit-render="{}" show-overflow="title"
                        :rules="[{ required: true, message: '请选择报销合同', trigger: 'blur' }]">
                        <template #edit="scope">
                            <el-input v-model="scope.row.contractName"
                                @focus="openContractForm(scope.$rowIndex, scope.row)"></el-input>
                        </template>
                    </vxe-table-column>
                    <vxe-colgroup title="费用" align="center">
                        <vxe-table-column field="number" title="数电发票" show-overflow="title" :edit-render="{}"
                            :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input maxlength="15" v-model="scope.row.number"
                                    @input="handleOrdinaryNumberInput(scope.row, 1)"
                                    @blur="handleOrdinaryNumberInput(scope.row, 1)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="ordinaryNumber" title="非数电发票" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input maxlength="15" v-model="scope.row.ordinaryNumber"
                                    @input="handleOrdinaryNumberInput(scope.row, 2)"
                                    @blur="handleOrdinaryNumberInput(scope.row, 2)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="numberCount" title="汇总" show-overflow="title"
                            :rules="[{ required: true, message: '请输入费用汇总', trigger: 'blur' }]">
                            <template #header="{ column }">
                                <span class="star-icon"></span>
                                <span>汇总</span>
                            </template>
                            <template #edit="scope">
                                <el-input maxlength="15" v-model="scope.row.numberCount"></el-input>
                            </template>
                        </vxe-table-column>
                    </vxe-colgroup>
                    <vxe-colgroup title="票据张数" align="center">
                        <vxe-table-column field="receiptNumber" title="数电发票" show-overflow="title">

                        </vxe-table-column>
                        <vxe-table-column field="ordinaryReceiptNumber" title="非数电发票" :edit-render="{}"
                            show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.ordinaryReceiptNumber"
                                    @input="handleReceiptNumberInput(scope.row)" maxlength="10"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="receiptNumberCount" title="汇总" show-overflow="title">
                        </vxe-table-column>
                    </vxe-colgroup>
                    <vxe-table-column field="content" title="内容" :edit-render="{}" show-overflow="title">
                        <template #edit="scope">
                            <el-input v-model="scope.row.content"></el-input>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="days" title="出差天数" :edit-render="{}" show-overflow="title">
                        <template #edit="scope">
                            <el-input v-model="scope.row.days" oninput="value=value.replace(/\D|^0/g,'')"
                                maxlength="10"></el-input>
                        </template>
                    </vxe-table-column>

                    <vxe-table-column title="操作" width="100">
                        <template #default="scope">
                            <el-button size="default" type="danger"
                                @click="removeEvent(scope.row, scope.$rowIndex, 'contract_detail')">删除</el-button>
                        </template>
                    </vxe-table-column>
                </vxe-table>
            </el-row>
        </div>
        <div v-if="inputForm.sourceType === '3' && tenantFlag === 'cw'">
            <el-divider content-position="left"><i class="el-icon-document"></i>
                报告报销详情
                <el-button size="default" style="margin-left: 20px" type="primary"
                    :disabled="method === 'view' || status === 'audit' || status === 'taskFormDetail'"
                    @click="insertEvent('report_detail')" plain>
                    新增报销单
                </el-button>
            </el-divider>
            <el-row :gutter="15">
                <el-col :span="24">
                    <vxe-table border show-footer show-overflow :footer-method="footerMethod" ref="detailTableReport"
                        class="vxe-table-element" :data="inputForm.detailInfoReports" style="margin-left: 5em"
                        :key="detailKeyReport" highlight-current-row
                        :edit-config="{ trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon: '_' }"
                        :edit-rules="validRules" :row-config="{ keyField: 'uniqueId' }"
                        :expand-config="{ expandAll: false, accordion: false, toggleMethod: handleExpand, expandRowKeys: handleDefaultExpand() }">
                        <vxe-column title="报销单" type="expand" width="80">
                            <template #default="{ row, rowIndex }">
                                <span>{{ rowIndex + 1 }}</span>
                            </template>
                            <template #content="{ row, rowIndex }">
                                <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                    @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
                                    :ref="row.uniqueId + 'Upload'">
                                </InvoiceReimbursementUpLoadComponent>
                            </template>
                        </vxe-column>
                        <vxe-table-column field="userName" title="报销人" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销人', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.userName"
                                    @focus="userPullListForm(scope.$rowIndex)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input :disabled='true' v-model="scope.row.deptName"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="typeName" title="报销类别" :edit-render="{}"
                            :rules="[{ required: true, message: '请选择报销类别', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.typeName"
                                    @focus="typePullFormCw(scope.$rowIndex, scope.row.deptId)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="projectName" title="报销项目" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销项目', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.projectName"
                                    @focus="openProgramPageFormCw(scope.$rowIndex, scope.row)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="reportNumber" title="报告号" :edit-render="{}" show-overflow="title">
                            <template v-slot:edit="scope">
                                <el-input :readonly="true" v-model="scope.row.reportNumber"
                                    @focus="openReportNoPageForm(scope.$rowIndex, scope.row)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-colgroup title="费用" align="center">
                            <vxe-table-column field="number" title="数电发票" show-overflow="title" :edit-render="{}"
                                :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.number"
                                        @input="handleOrdinaryNumberInput(scope.row, 1)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 1)"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="ordinaryNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title" :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.ordinaryNumber"
                                        @input="handleOrdinaryNumberInput(scope.row, 2)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 2)"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="numberCount" title="汇总" show-overflow="title"
                                :rules="[{ required: true, message: '请输入费用汇总', trigger: 'blur' }]">
                                <template #header="{ column }">
                                    <span class="star-icon"></span>
                                    <span>汇总</span>
                                </template>
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.numberCount"></el-input>
                                </template>
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-colgroup title="票据张数" align="center">
                            <vxe-table-column field="receiptNumber" title="数电发票" show-overflow="title">

                            </vxe-table-column>
                            <vxe-table-column field="ordinaryReceiptNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title">
                                <template #edit="scope">
                                    <el-input v-model="scope.row.ordinaryReceiptNumber"
                                        @input="handleReceiptNumberInput(scope.row)" maxlength="10"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="receiptNumberCount" title="汇总" show-overflow="title">
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-table-column field="content" title="内容" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.content"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="days" title="出差天数" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.days" oninput="value=value.replace(/\D|^0/g,'')"
                                    maxlength="10"></el-input>
                            </template>
                        </vxe-table-column>

                        <vxe-table-column title="操作" width="180">
                            <template #default="scope">
                                <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                    type="primary">新增</el-button>
                                <el-button size="default" type="danger"
                                    @click="removeEvent(scope.row, scope.$rowIndex, 'report_detail')">删除</el-button>
                            </template>
                        </vxe-table-column>
                    </vxe-table>
                </el-col>
            </el-row>
        </div>
        <div v-else-if="inputForm.sourceType === '3' && tenantFlag !== 'cw'">
            <el-divider content-position="left"><i class="el-icon-document"></i>
                报告报销详情
                <el-button size="default" style="margin-left: 20px" type="primary"
                    :disabled="method === 'view' || status === 'audit' || status === 'taskFormDetail'"
                    @click="insertEvent('report_detail')" plain>
                    新增报销单
                </el-button>
            </el-divider>
            <el-row :gutter="15">
                <el-col :span="24">
                    <vxe-table border show-footer show-overflow :footer-method="footerMethod" ref="detailTableReport"
                        class="vxe-table-element" :data="inputForm.detailInfoReports" style="margin-left: 5em"
                        :key="detailKeyReport" highlight-current-row
                        :edit-config="{ trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon: '_' }"
                        :edit-rules="validRules" :row-config="{ keyField: 'uniqueId' }"
                        :expand-config="{ expandAll: false, accordion: false, toggleMethod: handleExpand, expandRowKeys: handleDefaultExpand() }">
                        <vxe-column title="报销单" type="expand" width="80">
                            <template #default="{ row, rowIndex }">
                                <span>{{ rowIndex + 1 }}</span>
                            </template>
                            <template #content="{ row, rowIndex }">
                                <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                    @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
                                    :ref="row.uniqueId + 'Upload'">
                                </InvoiceReimbursementUpLoadComponent>
                            </template>
                        </vxe-column>
                        <vxe-table-column field="userName" title="报销人" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销人', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.userName"
                                    @focus="userPullListForm3(scope.$rowIndex)"></el-input>
                                <!--              <UserSelectV2 :limit='1' :userName="scope.row.userName" @getValue='(value, label) => {scope.row.userName = label}'></UserSelectV2>-->
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input :disabled='true' v-model="scope.row.deptName"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="typeName" title="报销类别" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销类别', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.typeName"
                                    @focus="typePullForm3(scope.$rowIndex, scope.row.deptId)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="projectName" title="报销详情" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请填写报销详情', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.projectName"
                                    @focus="openProgramPageForm3(scope.$rowIndex, scope.row)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-colgroup title="费用" align="center">
                            <vxe-table-column field="number" title="数电发票" show-overflow="title" :edit-render="{}"
                                :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.number"
                                        @input="handleOrdinaryNumberInput(scope.row, 1)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 1)"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="ordinaryNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title" :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.ordinaryNumber"
                                        @input="handleOrdinaryNumberInput(scope.row, 2)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 2)"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="numberCount" title="汇总" show-overflow="title"
                                :rules="[{ required: true, message: '请输入费用汇总', trigger: 'blur' }]">
                                <template #header="{ column }">
                                    <span class="star-icon"></span>
                                    <span>汇总</span>
                                </template>
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.numberCount"></el-input>
                                </template>
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-colgroup title="票据张数" align="center">
                            <vxe-table-column field="receiptNumber" title="数电发票" show-overflow="title">

                            </vxe-table-column>
                            <vxe-table-column field="ordinaryReceiptNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title">
                                <template #edit="scope">
                                    <el-input v-model="scope.row.ordinaryReceiptNumber"
                                        @input="handleReceiptNumberInput(scope.row)" maxlength="10"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="receiptNumberCount" title="汇总" show-overflow="title">
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-table-column field="content" title="内容" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.content"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="days" title="出差天数" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.days" oninput="value=value.replace(/\D|^0/g,'')"
                                    maxlength="10"></el-input>
                            </template>
                        </vxe-table-column>

                        <vxe-table-column title="操作" width="180">
                            <template #default="scope">
                                <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                    type="primary">新增</el-button>
                                <el-button size="default" type="danger"
                                    @click="removeEvent(scope.row, scope.$rowIndex, 'report_detail')">删除</el-button>
                            </template>
                        </vxe-table-column>
                    </vxe-table>
                </el-col>
            </el-row>
        </div>

        <div v-if="inputForm.sourceType === '4'">
            <el-divider content-position="left"><i class="el-icon-document"></i>
                其他报销详情
                <el-button size="default" style="margin-left: 20px" type="primary"
                    :disabled="method === 'view' || status === 'audit' || status === 'taskFormDetail'"
                    @click="insertEvent('others')" plain>
                    新增报销单
                </el-button>
            </el-divider>
            <el-row :gutter="15">
                <el-col :span="24">
                    <vxe-table border show-footer show-overflow :footer-method="footerMethod" ref="detailTableOthers"
                        class="vxe-table-element" :data="inputForm.detailInfoOthers" style="margin-left: 5em"
                        :key="detailKeyOthers" highlight-current-row
                        :edit-config="{ trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon: '_' }"
                        :edit-rules="validRules" :row-config="{ keyField: 'uniqueId' }"
                        :expand-config="{ expandAll: false, accordion: false, toggleMethod: handleExpand, expandRowKeys: handleDefaultExpand() }">
                        <vxe-column title="报销单" type="expand" width="80">
                            <template #default="{ row, rowIndex }">
                                <span>{{ rowIndex + 1 }}</span>
                            </template>
                            <template #content="{ row, rowIndex }">
                                <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                    @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
                                    :ref="row.uniqueId + 'Upload'">
                                </InvoiceReimbursementUpLoadComponent>

                            </template>
                        </vxe-column>
                        <vxe-table-column field="userName" title="报销人" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销人', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.userName"
                                    @focus="userPullListForm4(scope.$rowIndex)"></el-input>
                                <!--              <UserSelectV2 :limit='1' :userName="scope.row.userName" @getValue='(value, label) => {scope.row.userName = label}'></UserSelectV2>-->
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input :disabled='true' v-model="scope.row.deptName"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="typeName" title="报销类别" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销类别', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.typeName"
                                    @focus="typePullForm4(scope.$rowIndex, scope.row.deptId)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="projectName" title="报销详情" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请填写报销详情', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.projectName"
                                    @focus="openProgramPageForm4(scope.$rowIndex, scope.row)"></el-input>
                            </template>
                        </vxe-table-column>

                        <vxe-colgroup title="费用" align="center">
                            <vxe-table-column field="number" title="数电发票" show-overflow="title" :edit-render="{}"
                                :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.number"
                                        @input="handleOrdinaryNumberInput(scope.row, 1)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 1)"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="ordinaryNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title" :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.ordinaryNumber"
                                        @input="handleOrdinaryNumberInput(scope.row, 2)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 2)"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="numberCount" title="汇总" show-overflow="title"
                                :rules="[{ required: true, message: '请输入费用汇总', trigger: 'blur' }]">
                                <template #header="{ column }">
                                    <span class="star-icon"></span>
                                    <span>汇总</span>
                                </template>
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.numberCount"></el-input>
                                </template>
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-colgroup title="票据张数" align="center">
                            <vxe-table-column field="receiptNumber" title="数电发票" show-overflow="title">

                            </vxe-table-column>
                            <vxe-table-column field="ordinaryReceiptNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title">
                                <template #edit="scope">
                                    <el-input v-model="scope.row.ordinaryReceiptNumber"
                                        @input="handleReceiptNumberInput(scope.row)" maxlength="10"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="receiptNumberCount" title="汇总" show-overflow="title">
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-table-column field="content" title="内容" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.content"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="days" title="出差天数" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.days" oninput="value=value.replace(/\D|^0/g,'')"
                                    maxlength="10"></el-input>
                            </template>
                        </vxe-table-column>

                        <vxe-table-column title="操作" width="180">
                            <template #default="scope">
                                <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                    type="primary">新增</el-button>
                                <el-button size="default" type="danger"
                                    @click="removeEvent(scope.row, scope.$rowIndex, 'others')">删除</el-button>
                            </template>
                        </vxe-table-column>
                    </vxe-table>
                </el-col>
            </el-row>
        </div>
        <div v-if="inputForm.sourceType === '5'">
            <el-divider content-position="left"><i class="el-icon-document"></i>
                采购报销详情
                <el-button size="default" style="margin-left: 20px" type="primary"
                    :disabled="method === 'view' || this.formReadOnly" @click="insertEvent('procured')" plain>
                    新增报销单
                </el-button>
            </el-divider>
            <el-row :gutter="15">
                <vxe-table border show-footer show-overflow :footer-method="footerMethod" ref="detailTableProcured"
                    class="vxe-table-element" :data="inputForm.detailInfoProcured" style="margin-left: 5em"
                    :key="detailKeyProcured" highlight-current-row
                    :edit-config="{ trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon: '_' }"
                    :edit-rules="validRules">
                    <vxe-table-column field="userName" title="报销人" :edit-render="{}" show-overflow="title"
                        :rules="[{ required: true, message: '请选择报销人', trigger: 'blur' }]">
                        <template #edit="scope">
                            <el-input v-model="scope.row.userName"
                                @focus="userPullListForm5(scope.$rowIndex)"></el-input>
                            <!--              <UserSelectV2 :limit='1' :userName="scope.row.userName" @getValue='(value, label) => {scope.row.userName = label}'></UserSelectV2>-->
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
                        <template #edit="scope">
                            <el-input :disabled='true' v-model="scope.row.deptName"></el-input>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="typeName" title="报销类别" :edit-render="{}" show-overflow="title"
                        :rules="[{ required: true, message: '请选择报销类别', trigger: 'blur' }]">
                        <template #edit="scope">
                            <el-input v-model="scope.row.typeName"
                                @focus="typePullForm5(scope.$rowIndex, scope.row.deptId)"></el-input>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="projectName" title="报销项目" :edit-render="{}" show-overflow="title"
                        :rules="[{ required: true, message: '请选择报销项目', trigger: 'blur' }]">
                        <template #edit="scope">
                            <el-input v-model="scope.row.projectName"
                                @focus="openProgramPageForm5(scope.$rowIndex, scope.row)"></el-input>
                        </template>
                    </vxe-table-column>
                    <vxe-colgroup title="费用" align="center">
                        <vxe-table-column field="number" title="数电发票" show-overflow="title" :edit-render="{}"
                            :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input maxlength="15" v-model="scope.row.number"
                                    @input="handleOrdinaryNumberInput(scope.row, 1)"
                                    @blur="handleOrdinaryNumberInput(scope.row, 1)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="ordinaryNumber" title="非数电发票" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input maxlength="15" v-model="scope.row.ordinaryNumber"
                                    @input="handleOrdinaryNumberInput(scope.row, 2)"
                                    @blur="handleOrdinaryNumberInput(scope.row, 2)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="numberCount" title="汇总" show-overflow="title"
                            :rules="[{ required: true, message: '请输入费用汇总', trigger: 'blur' }]">
                            <template #header="{ column }">
                                <span class="star-icon"></span>
                                <span>汇总</span>
                            </template>
                            <template #edit="scope">
                                <el-input maxlength="15" v-model="scope.row.numberCount"></el-input>
                            </template>
                        </vxe-table-column>
                    </vxe-colgroup>
                    <vxe-colgroup title="票据张数" align="center">
                        <vxe-table-column field="receiptNumber" title="数电发票" show-overflow="title">

                        </vxe-table-column>
                        <vxe-table-column field="ordinaryReceiptNumber" title="非数电发票" :edit-render="{}"
                            show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.ordinaryReceiptNumber"
                                    @input="handleReceiptNumberInput(scope.row)" maxlength="10"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="receiptNumberCount" title="汇总" show-overflow="title">
                        </vxe-table-column>
                    </vxe-colgroup>
                    <vxe-table-column field="content" title="内容" :edit-render="{}" show-overflow="title">
                        <template #edit="scope">
                            <el-input v-model="scope.row.content"></el-input>
                        </template>
                    </vxe-table-column>
                    <vxe-table-column field="days" title="出差天数" :edit-render="{}" show-overflow="title">
                        <template #edit="scope">
                            <el-input v-model="scope.row.days" oninput="value=value.replace(/\D|^0/g,'')"
                                maxlength="10"></el-input>
                        </template>
                    </vxe-table-column>

                    <vxe-table-column title="操作" width="100">
                        <template #default="scope">
                            <el-button size="default" type="danger"
                                @click="removeEvent(scope.row, scope.$rowIndex, 'procured')">删除</el-button>
                        </template>
                    </vxe-table-column>
                </vxe-table>
            </el-row>
        </div>
        <div v-if="inputForm.sourceType === '8'">
            <el-divider content-position="left"><i class="el-icon-document"></i>
                中审项目报销详情
                <el-button size="default" style="margin-left: 20px" type="primary"
                    :disabled="method === 'view' || status === 'audit' || status === 'taskFormDetail'"
                    @click="insertEvent('zs_project_detail')" plain>
                    新增报销单
                </el-button>
            </el-divider>
            <el-row :gutter="15">
                <el-col :span="24">
                    <vxe-table border show-footer show-overflow :footer-method="footerMethod" ref="detailTableProject"
                        class="vxe-table-element" :data="inputForm.detailInfoProject" style="margin-left: 5em"
                        :key="detailKeyProject" highlight-current-row
                        :edit-config="{ trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon: '_' }"
                        :edit-rules="validRules" :tooltip-config="{
                            enterable: true
                        }" :row-config="{ keyField: 'uniqueId' }"
                        :expand-config="{ expandAll: false, accordion: false, toggleMethod: handleExpand, expandRowKeys: handleDefaultExpand() }">
                        <vxe-column title="报销单" type="expand" width="80">
                            <template #default="{ row, rowIndex }">
                                <span>{{ rowIndex + 1 }}</span>
                            </template>
                            <template #content="{ row, rowIndex }">
                                <InvoiceReimbursementUpLoadComponent @changeConfirmList="changeConfirmList"
                                    @handleCount="handleCount" @handleUploadSuccess="handleUploadSuccess"
                                    :ref="row.uniqueId + 'Upload'">
                                </InvoiceReimbursementUpLoadComponent>

                            </template>
                        </vxe-column>
                        <vxe-table-column field="userName" title="报销人" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销人', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.userName"
                                    @focus="userPullListForm8(scope.$rowIndex)"></el-input>
                                <!--              <UserSelectV2 :limit='1' :userName="scope.row.userName" @getValue='(value, label) => {scope.row.userName = label}'></UserSelectV2>-->
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input :disabled='true' v-model="scope.row.deptName"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="typeName" title="报销类别" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请选择报销类别', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.typeName"
                                    @focus="typePullForm8(scope.$rowIndex, scope.row.deptId)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="projectName" title="报销详情" :edit-render="{}" show-overflow="title"
                            :rules="[{ required: true, message: '请填写报销详情', trigger: 'blur' }]">
                            <template #edit="scope">
                                <el-input v-model="scope.row.projectName"
                                    @focus="openProgramPageForm8(scope.$rowIndex, scope.row)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-colgroup title="发票号和立项号至少填写一项" header-align="center">
                            <vxe-table-column field="invoiceNumber" title="发票号" :edit-render="{}" show-overflow="title">
                                <template #header>
                                    <i class="vxe-cell--required-icon"></i>发票号
                                </template>
                                <template #edit="scope">
                                    <el-input v-model="scope.row.invoiceNumber"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="projectApprovalNumber" title="立项号" :edit-render="{}"
                                show-overflow="title">
                                <template #header>
                                    <i class="vxe-cell--required-icon"></i>立项号
                                </template>
                                <template #edit="scope">
                                    <el-input v-model="scope.row.projectApprovalNumber"></el-input>
                                </template>
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-colgroup title="费用" align="center">
                            <vxe-table-column field="number" title="数电发票" show-overflow="title" :edit-render="{}"
                                :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.number"
                                        @input="handleOrdinaryNumberInput(scope.row, 1)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 1)"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="ordinaryNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title" :rules="[{ required: true, message: '请输入费用', trigger: 'blur' }]">
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.ordinaryNumber"
                                        @input="handleOrdinaryNumberInput(scope.row, 2)"
                                        @blur="handleOrdinaryNumberInput(scope.row, 2)"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="numberCount" title="汇总" show-overflow="title"
                                :rules="[{ required: true, message: '请输入费用汇总', trigger: 'blur' }]">
                                <template #header="{ column }">
                                    <span class="star-icon"></span>
                                    <span>汇总</span>
                                </template>
                                <template #edit="scope">
                                    <el-input maxlength="15" v-model="scope.row.numberCount"></el-input>
                                </template>
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-colgroup title="票据张数" align="center">
                            <vxe-table-column field="receiptNumber" title="数电发票" show-overflow="title">

                            </vxe-table-column>
                            <vxe-table-column field="ordinaryReceiptNumber" title="非数电发票" :edit-render="{}"
                                show-overflow="title">
                                <template #edit="scope">
                                    <el-input v-model="scope.row.ordinaryReceiptNumber"
                                        @input="handleReceiptNumberInput(scope.row)" maxlength="10"></el-input>
                                </template>
                            </vxe-table-column>
                            <vxe-table-column field="receiptNumberCount" title="汇总" show-overflow="title">
                            </vxe-table-column>
                        </vxe-colgroup>
                        <vxe-table-column field="content" title="内容" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.content"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="days" title="出差天数" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input v-model="scope.row.days" oninput="value=value.replace(/\D|^0/g,'')"
                                    maxlength="10"></el-input>
                            </template>
                        </vxe-table-column>

                        <vxe-table-column title="操作" width="180">
                            <template #default="scope">
                                <el-button size="default" @click="uploadFile(scope.row, scope.$rowIndex,)"
                                    type="primary">新增</el-button>
                                <el-button size="default" type="danger"
                                    @click="removeEvent(scope.row, scope.$rowIndex, 'zs_project_detail')">删除</el-button>
                            </template>
                        </vxe-table-column>
                    </vxe-table>
                </el-col>
            </el-row>
        </div>
        <div v-if="inputForm.reimbursementType === '0'">
            <el-divider content-position="left"><i class="el-icon-document"></i>
                专用发票信息
                <el-button size="default" style="margin-left: 10px" type="primary"
                    :disabled="method === 'view' || status === 'audit' || status === 'taskFormDetail'"
                    @click="insertEvent('amount')" plain>
                    新增报销单
                </el-button>
            </el-divider>
            <el-row :gutter="15">
                <el-col :span="24">
                    <vxe-table border show-overflow ref="amountTable" class="vxe-table-element"
                        :data="inputForm.amountInfos" style="margin-left: 5em" :key="amountKey" highlight-current-row
                        :edit-config="{ trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon: '_' }">
                        <vxe-table-column field="code" title="发票代码" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input oninput="value=value.replace(/\D|^/g,'')" maxlength="20"
                                    v-model="scope.row.code"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="number" title="发票号" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input oninput="value=value.replace(/\D|^/g,'')" maxlength="8"
                                    @change="isExict(scope.row)" v-model="scope.row.number"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="amount" title="金额" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input maxlength="15" v-model="scope.row.amount"
                                    @input="scope.row.amount = twoDecimalPlaces(scope.row.amount)"
                                    @change="countAmount(scope.row)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="taxAmount" title="税额" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input maxlength="15" v-model="scope.row.taxAmount"
                                    @input="scope.row.taxAmount = twoDecimalPlaces(scope.row.taxAmount)"
                                    @change="countAmount(scope.row)"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column field="count" title="价税合计" :edit-render="{}" show-overflow="title">
                            <template #edit="scope">
                                <el-input disabled="true" v-model="scope.row.count"></el-input>
                            </template>
                        </vxe-table-column>
                        <vxe-table-column title="操作" width="100">
                            <template #default="scope">
                                <el-button size="default" type="danger"
                                    @click="removeEvent(scope.row, scope.$rowIndex, 'amount')">删除</el-button>
                            </template>
                        </vxe-table-column>
                    </vxe-table>
                </el-col>

            </el-row>
        </div>

        <ProgramPageForm ref="programPageForm" @getProgram="getProgramPg"></ProgramPageForm>
        <CwProgramPageForm2 ref="cwProgramPageFormCw" @getProgram="getProgramCw"></CwProgramPageForm2>
        <CwProgramPageForm ref="cwProgramPageForm" @getProgram="getProgram"></CwProgramPageForm>
        <CwProgramPageForm ref="cwProgramPageForm3" @getProgram="getProgram3"></CwProgramPageForm>
        <CwProgramPageForm ref="cwProgramPageFormCwProject" @getProgram="getProgramCwProject"></CwProgramPageForm>


        <CwProgramPageForm ref="cwProgramPageForm4" @getProgram="getProgram4"></CwProgramPageForm>
        <CwProgramPageForm ref="cwProgramPageForm5" @getProgram="getProgram5"></CwProgramPageForm>
        <CwProgramPageForm ref="cwProgramPageForm8" @getProgram="getProgram8"></CwProgramPageForm>

        <!--      <ReimbursementTypePullForm ref="reimbursementTypePullForm" @getProgramForType="getProgramForType"></ReimbursementTypePullForm>-->
        <CwReimbursementTypePullFormZs ref="cwReimbursementTypePullForm" @getProgramForType="getProgramForType">
        </CwReimbursementTypePullFormZs>
        <CwReimbursementTypePullFormCw ref="cwReimbursementTypePullFormCw" @getProgramForType="getProgramForTypeCw">
        </CwReimbursementTypePullFormCw>
        <CwReimbursementTypePullFormCw ref="cwReimbursementTypePullFormCwProject"
            @getProgramForType="getProgramForTypeCwProject">
        </CwReimbursementTypePullFormCw>
        <CwReimbursementTypePullForm ref="cwReimbursementTypePullForm2" @getProgramForType="getProgramForType2">
        </CwReimbursementTypePullForm>
        <CwReimbursementTypePullFormZs ref="cwReimbursementTypePullForm3" @getProgramForType="getProgramForType3">
        </CwReimbursementTypePullFormZs>
        <CwReimbursementTypePullForm ref="cwReimbursementTypePullForm4" @getProgramForType="getProgramForType4">
        </CwReimbursementTypePullForm>
        <CwReimbursementTypePullForm ref="cwReimbursementTypePullForm5" @getProgramForType="getProgramForType5">
        </CwReimbursementTypePullForm>
        <CwReimbursementTypePullFormZs ref="cwReimbursementTypePullForm8" @getProgramForType="getProgramForType8">
        </CwReimbursementTypePullFormZs>


        <UserPullForm ref="userPullForm" @getProgramForUser="getProgramForUser"></UserPullForm>
        <UserPullForm ref="userPullForm2" @getProgramForUser="getProgramForUser2"></UserPullForm>
        <UserPullForm ref="userPullForm3" @getProgramForUser="getProgramForUser3"></UserPullForm>
        <UserPullForm ref="userPullForm4" @getProgramForUser="getProgramForUser4"></UserPullForm>
        <UserPullForm ref="userPullForm5" @getProgramForUser="getProgramForUser5"></UserPullForm>
        <UserPullForm ref="userPullForm8" @getProgramForUser="getProgramForUser8"></UserPullForm>

        <WorkContractChooseCom ref="workContractChooseCom" @getContract="getContract"></WorkContractChooseCom>
        <ReportNoChooseRadio ref="reportNoChooseRadio" @getWorkClientRadioChoose="getWorkClientChoose2">
        </ReportNoChooseRadio>
        <ReportNoChooseRadio ref="reportNoChooseRadioCwProject"
            @getWorkClientRadioChoose="getWorkClientChooseCwProject">
        </ReportNoChooseRadio>
    </div>
</template>

<script>
import ReportNoChooseRadio from '@/views/cw/reimbursementApproval/info/ReportNoChooseRadio'
import ReimbursementService from '@/api/zs/reimbursement/ReimbursementService'
import ReimbursementTypeService from '@/api/zs/reimbursement/ReimbursementTypeService'
import InvoiceReimbursementUpLoadComponent from '@/views/common/NewDigitalInvoiceUploadComponent'
import ReimbursementApprovalTypeService from '@/api/cw/reimbursementApproval/ReimbursementApprovalTypeService'
import UpLoadComponent from '@/views/common/NewUpLoadComponent'
import XEUtils from 'xe-utils'
import CwReimbursementTypePullFormZs from '@/views/zs/reimbursement/info/CwReimbursementTypePullFormZs'

import CwProgramPageForm from '@/views/cw/reimbursementApproval/info/CwProgramPageForm'
import CwProgramPageForm2 from '@/views/cw/reimbursementApproval/info/CwProgramPageForm2'
import CwReimbursementTypePullForm from '@/views/zs/reimbursement/info/CwReimbursementTypePullForm'

// 会计
import CwReimbursementTypePullFormCw from '@/views/cw/reimbursementApproval/info/CwReimbursementTypePullForm'
import UserPullForm from '@/views/finance/invoice/UserPullForm'
import CommonApi from '@/api/cw/common/CommonApi'
import WorkContractChooseCom from '@/views/cw/projectRecords/WorkContractChooseCom'
import processService from '@/api/flowable/processService'
import userService from '@/api/sys/UserService'
import ProgramPageForm from '@/views/finance/invoice/ProgramPageForm'
export default {
    props: {
        businessId: {
            type: String,
            default: ''
        },
        formReadOnly: {
            type: Boolean,
            default: false
        },
    },
    data() {
        return {
            status: "",
            companyName: "",
            isConfirm: "2",
            uploadFlag: "",
            tenantFlag: "",
            tableData: [],
            tableRef: null,
            currentNodeName: "",
            confirmStatusList: [],
            validRules: {
                userName: [
                    { required: true, message: '报销人不能为空' }
                ],
                deptName: [
                    { required: true, message: '报销部门不能为空' }
                ],
                reimbursementType: [
                    { required: true, message: '报销类型不能为空' }
                ],
                typeName: [
                    { required: true, message: '报销类别不能为空' }
                ],
                projectName: [
                    { required: true, message: '报销项目不能为空' }
                ],
                contractName: [
                    { required: true, message: '报销合同不能为空' }
                ],
                reportNumber: [
                    { required: true, message: '报告号不能为空' }
                ],
                numberCount: [
                    { required: true, message: '费用汇总不能为空' }
                ],
            },
            amountInfoRules: {
                code: [
                    { required: true, message: '发票代码不能为空' }
                ],
                number: [
                    { required: true, message: '发票号不能为空' }
                ],
                amount: [
                    { required: true, message: '金额不能为空' }
                ],
                taxAmount: [
                    { required: true, message: '税额不能为空' }
                ]
            },
            invoiceReimbursementRules: {
                invoiceType: [
                    { required: true, message: '发票类型不能为空' }
                ],
                invoiceProjectName: [
                    { required: true, message: '发票项目名不能为空' }
                ],
                number: [
                    { required: true, message: '发票号不能为空' }
                ],
                invoiceDate: [
                    { required: true, message: '开票日期不能为空' }
                ],
                invoiceUnit: [
                    { required: true, message: '开票单位不能为空' }
                ],
                buyerName: [
                    { required: true, message: '购买方名称不能为空' }
                ],
                amount: [
                    { required: true, message: '金额不能为空' }
                ],
                taxAmount: [
                    { required: true, message: '税额不能为空' }
                ]
            },
            title: '',
            method: '',
            visible: false,
            loading: false,
            indexRow: '',
            detailKey: '',
            detailKeyContract: '',
            detailKeyReport: '',
            detailKeyProject: "",
            detailKeyOthers: '',
            detailKeyProcured: '',
            inputForm: {
                reimbursementType: '1',
                userId: '',
                createById: '',
                userName: '',
                no: '',
                department: '',
                reimDate: '',
                remarks: '',
                detailInfos: [],
                detailInfoContracts: [],
                detailInfoReports: [],
                detailInfoOthers: [],
                detailInfoProject: [],
                detailInfoProcured: [],
                amountInfos: [],
                invoiceReimbursements: [],
                invoiceReimbursementFiles: [], // 电子发票附件信息
                files: [], // 附件信息
                procInsId: '',
                sourceType: '',
                preList: [],
                purchaseNo: '',
                tradeTotalPrice: '',
                purchaseId: '',
                procDefId: '',
                procDefKey: '',
                formTitle: '',
                departmentName: '',
                paymentStatus: ''
            },
            amountKey: '',
            invoiceReimbursementKey: '',
            isZj: false,
            isZjbry: false,
            isDgsbxBmzr: false,
            payment: '',
        }
    },
    ReimbursementService: null,
    reimbursementTypeService: null,
    reimbursementApprovalTypeService: null,
    commonApi: null,
    created() {
        this.reimbursementService = new ReimbursementService()
        this.reimbursementTypeService = new ReimbursementTypeService()
        this.reimbursementApprovalTypeService = new ReimbursementApprovalTypeService()
        this.commonApi = new CommonApi()
    },
    components: {
        InvoiceReimbursementUpLoadComponent,
        UpLoadComponent,
        CwProgramPageForm,
        CwProgramPageForm2,
        CwReimbursementTypePullForm,
        CwReimbursementTypePullFormZs,
        UserPullForm,
        ReportNoChooseRadio,
        WorkContractChooseCom,
        ProgramPageForm,
        CwReimbursementTypePullFormCw
    },
    computed: {
        name() {
            return this.$store.state.user.name
        },
        officeName() {
            return this.$store.state.user.office.name
        },
        userId() {
            return this.$store.state.user.id
        }
    },
    methods: {
        initComponent(uploadFlag, tenantFlag, companyName, inputForm, isConfirm, status) {
            if (this.commonJS.isNotEmpty(tenantFlag)) {
                this.tenantFlag = tenantFlag
            }
            if (this.commonJS.isNotEmpty(uploadFlag)) {
                this.uploadFlag = uploadFlag
            }
            if (this.commonJS.isNotEmpty(companyName)) {
                this.companyName = companyName
            }
            if (this.commonJS.isNotEmpty(inputForm)) {
                this.inputForm = inputForm
            }
            if (this.commonJS.isNotEmpty(isConfirm)) {
                this.isConfirm = isConfirm
            }
            if (this.commonJS.isNotEmpty(status)) {
                this.status = status
            }

        },
        // 删除
        removeEvent(row, rowIndex, type) {
            this.handleTableInfo(this.inputForm.sourceType)
            this.inputForm.invoiceReimbursementFiles = this.inputForm.invoiceReimbursementFiles.filter(item => item.remarks != row.uniqueId)
            if (type === 'detail') {
                this.$refs.detailTable.remove(row)
                this.inputForm.detailInfos.splice(rowIndex, 1)
            }
            if (type === 'amount') {
                this.$refs.amountTable.remove(row)
                this.inputForm.amountInfos.splice(rowIndex, 1)
            }
            if (type === 'invoiceReimbursement') {
                this.$refs.invoiceReimbursementTable.remove(row)
                this.inputForm.invoiceReimbursements.splice(rowIndex, 1)
            }
            if (type === 'contract_detail') {
                this.$refs.detailTableContract.remove(row)
                this.inputForm.detailInfoContracts.splice(rowIndex, 1)
            }
            if (type === 'report_detail') {
                this.$refs.detailTableReport.remove(row)
                this.inputForm.detailInfoReports.splice(rowIndex, 1)
            }
            if (type === 'zs_project_detail') {
                this.$refs.detailTableProject.remove(row)
                this.inputForm.detailInfoProject.splice(rowIndex, 1)
            }
            if (type === 'others') {
                this.$refs.detailTableOthers.remove(row)
                this.inputForm.detailInfoOthers.splice(rowIndex, 1)
            }
            if (type === 'procured') {
                this.$refs.detailTableProcured.remove(row)
                this.inputForm.detailInfoProcured.splice(rowIndex, 1)
            }
        },
        generateRandomId() {
            let id = '';
            for (let i = 0; i < 16; i++) {
                id += Math.floor(Math.random() * 10); // 生成 0-9 的随机数
            }
            return id;
        },
        // 新增
        async insertEvent(type) {
            if (type === 'detail') {
                let d = {
                    uniqueId: this.generateRandomId(),
                    userName: this.$store.state.user.name,
                    deptName: this.$store.state.user.office.name,
                    userId: this.$store.state.user.id,
                    deptId: this.$store.state.user.office.id
                }
                if (this.commonJS.isEmpty(this.inputForm.detailInfos)) {
                    this.inputForm.detailInfos = []
                }
                this.$refs.detailTable.insertAt(d)
                this.inputForm.detailInfos.push(d)
                this.detailKey = Math.random()
            }
            if (type === 'amount') {
                let d = {}
                if (this.commonJS.isEmpty(this.inputForm.amountInfos)) {
                    this.inputForm.amountInfos = []
                }
                this.$refs.amountTable.insertAt(d)
                this.inputForm.amountInfos.push(d)
                this.amountKey = Math.random()
            }
            if (type === 'invoiceReimbursement') {
                let d = {}
                if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursements)) {
                    this.inputForm.invoiceReimbursements = []
                }
                this.$refs.invoiceReimbursementTable.insertAt(d)
                this.inputForm.invoiceReimbursements.push(d)
                this.invoiceReimbursementKey = Math.random()
            }
            if (type === 'contract_detail') {
                let d = {
                    userName: this.$store.state.user.name,
                    deptName: this.$store.state.user.office.name,
                    userId: this.$store.state.user.id,
                    deptId: this.$store.state.user.office.id
                }
                if (this.commonJS.isEmpty(this.inputForm.detailInfoContracts)) {
                    this.inputForm.detailInfoContracts = []
                }
                this.$refs.detailTableContract.insertAt(d)
                this.inputForm.detailInfoContracts.push(d)
                this.detailKeyContract = Math.random()
            }
            if (type === 'report_detail') {
                let d = {
                    uniqueId: this.generateRandomId(),
                    userName: this.$store.state.user.name,
                    deptName: this.$store.state.user.office.name,
                    userId: this.$store.state.user.id,
                    deptId: this.$store.state.user.office.id
                }
                if (this.commonJS.isEmpty(this.inputForm.detailInfoReports)) {
                    this.inputForm.detailInfoReports = []
                }
                this.$refs.detailTableReport.insertAt(d)
                this.inputForm.detailInfoReports.push(d)
                this.detailKeyReport = Math.random()
            }
            if (type === 'zs_project_detail') {
                let d = {
                    uniqueId: this.generateRandomId(),
                    userName: this.$store.state.user.name,
                    deptName: this.$store.state.user.office.name,
                    userId: this.$store.state.user.id,
                    deptId: this.$store.state.user.office.id
                }
                if (this.commonJS.isEmpty(this.inputForm.detailInfoProject)) {
                    this.inputForm.detailInfoProject = []
                }
                this.$refs.detailTableProject.insertAt(d)
                this.inputForm.detailInfoProject.push(d)
                this.detailKeyProject = Math.random()
            }
            if (type === 'others') {
                let d = {
                    uniqueId: this.generateRandomId(),
                    userName: this.$store.state.user.name,
                    deptName: this.$store.state.user.office.name,
                    userId: this.$store.state.user.id,
                    deptId: this.$store.state.user.office.id
                }
                if (this.commonJS.isEmpty(this.inputForm.detailInfoOthers)) {
                    this.inputForm.detailInfoOthers = []
                }
                this.$refs.detailTableOthers.insertAt(d)
                this.inputForm.detailInfoOthers.push(d)
                this.detailKeyOthers = Math.random()
            }
            if (type === 'procured') {
                let d = {
                    userName: this.$store.state.user.name,
                    deptName: this.$store.state.user.office.name,
                    userId: this.$store.state.user.id,
                    deptId: this.$store.state.user.office.id
                }
                if (this.commonJS.isEmpty(this.inputForm.detailInfoProcured)) {
                    this.inputForm.detailInfoProcured = []
                }
                this.$refs.detailTableProcured.insertAt(d)
                this.inputForm.detailInfoProcured.push(d)
                this.detailKeyProcured = Math.random()
            }
        },
        insertInvoiceReimbursementEvent(type, value) {
            if (type === 'invoiceReimbursement') {
                if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursements)) {
                    this.inputForm.invoiceReimbursements = []
                }
                this.$refs.invoiceReimbursementTable.insertAt(value)
                this.inputForm.invoiceReimbursements.push(value)
                this.invoiceReimbursementKey = Math.random()
            }
        },
        footerMethod({ columns, data }) {
            const footerData = [
                columns.map((column, columnIndex) => {
                    if (columnIndex === 0) {
                        return '汇总'
                    }
                    if (['numberCount'].includes(column.property)) {
                        // eslint-disable-next-line no-undef
                        return XEUtils.sum(data, column.property)
                    }
                    if (['receiptNumberCount'].includes(column.property)) {
                        // eslint-disable-next-line no-undef
                        return XEUtils.sum(data, column.property)
                    }
                    return null
                })
            ]
            return footerData
        },
        twoDecimalPlaces(num) {
            num = parseFloat(num).toFixed(2);
            // 解决精度问题
            let str = num.toString()
            str = str.replace(/\s+/g, "");
            var len1 = str.substr(0, 1)
            var len2 = str.substr(1, 1)
            // eslint-disable-next-line eqeqeq
            if (str.length > 1 && len1 == 0 && len2 != '.') {
                str = str.substr(1, 1)
            }
            // eslint-disable-next-line eqeqeq
            if (len1 == '.') {
                str = ''
            }
            // eslint-disable-next-line eqeqeq
            if (str.indexOf('.') != -1) {
                var str_ = str.substr(str.indexOf('.') + 1)
                // eslint-disable-next-line eqeqeq
                if (str_.indexOf('.') != -1) {
                    str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
                }
                if (str_.length > 2) {
                    this.$message.warning(`金额小数点后只能输入两位，请正确输入！`)
                    return (str = '')
                }
            }
            // eslint-disable-next-line no-useless-escape
            str = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
            return str
        },
        isExict(row) {
            this.reimbursementService.checkNumber(row.number).then((data) => {
                if (data) {
                    this.$message.error('该发票号已存在')
                    row.number = ''
                }
            })
            if (this.commonJS.isNotEmpty(this.inputForm.reimbursementType) && "1" === this.inputForm.reimbursementType) {
                var invoiceReimbursements = this.inputForm.invoiceReimbursements;
                //创建判断值，若行信息存在相同的发票号，则进行数据检查调整，若不存在发票号，则新增行，并将信息写入
                if (!invoiceReimbursements) {
                    invoiceReimbursements = [];
                }
                var count = 0;
                for (var i = 0; i < invoiceReimbursements.length; i++) {
                    var item = invoiceReimbursements[i];
                    if (item.number === row.number) {
                        count++;
                        if (count === 2) {
                            this.$message.error('数电发票号：' + row.number + ' 已存在')
                            row.number = ''
                            throw new Error('数电发票号：' + row.number + ' 已存在')
                        }
                    }
                }

            }
            // this.reimbursementService.checkNumber(row.number).then(({data}) => {
            //   if (data) {
            //     this.$message.error('该发票号已存在')
            //     row.number = ''
            //   }
            // })
        },
        countAmount(row) {
            let amount
            let taxAmount
            let count = 0
            if (!this.commonJS.isEmpty(row.amount)) {
                amount = parseFloat(row.amount)
                count = count + amount
            }
            if (!this.commonJS.isEmpty(row.taxAmount)) {
                taxAmount = parseFloat(row.taxAmount)
                count = count + taxAmount
            }
            row.count = parseFloat(count).toFixed(2)
        },
        openReportNoPageFormCwProject(rowIndex, row) {
            if (this.commonJS.isEmpty(row.projectName)) {
                this.$message.error('请选择报销项目')
                return
            }
            this.indexRow = rowIndex
            this.$refs.reportNoChooseRadioCwProject.init(this.inputForm.detailInfos[rowIndex].projectId)
        },
        // 选择报告号
        openReportNoPageForm(rowIndex, row) {
            if (this.commonJS.isEmpty(row.projectName)) {
                this.$message.error('请选择报销项目')
                return
            }
            this.indexRow = rowIndex
            this.$refs.reportNoChooseRadio.init(this.inputForm.detailInfoReports[rowIndex].projectId)
        },
        openProgramPageFormCwProject(rowIndex, row) {
            if (this.commonJS.isEmpty(row.typeName)) {
                this.$message.error('请选择报销类型')
                return
            }
            this.indexRow = rowIndex
            this.reimbursementApprovalTypeService.findById(row.typeId).then((data) => {
                let i = data.sort.toString()
                i = i.substring(0, 1)
                // 非业务报销
                if (i !== '1') {
                    this.$refs.cwProgramPageFormCwProject.init('2', false)
                } else {
                    // 打开单选组件
                    this.$refs.cwProgramPageFormCwProject.init('1', false)
                }
            })
        },
        openProgramPageFormCw(rowIndex, row) {
            if (this.commonJS.isEmpty(row.typeName)) {
                this.$message.error('请选择报销类型')
                return
            }
            this.indexRow = rowIndex
            this.reimbursementApprovalTypeService.findById(row.typeId).then((data) => {
                let i = data.sort.toString()
                i = i.substring(0, 1)
                // 非业务报销
                if (i !== '1') {
                    this.$refs.cwProgramPageFormCw.init('2', false)
                } else {
                    // 打开单选组件
                    this.$refs.cwProgramPageFormCw.init('1', false)
                }
            })
        },

        openProgramPageFormPg(rowIndex, row) {
            if (this.commonJS.isEmpty(row.typeName)) {
                this.$message.error('请选择报销类型')
                return
            }
            this.indexRow = rowIndex
            this.reimbursementApprovalTypeService.findById(row.typeId).then((data) => {
                let i = data.sort.toString()
                i = i.substring(0, 1)
                // 非业务报销
                if (i !== '1') {
                    this.$refs.programPageForm.init('2', false)
                } else {
                    // 打开单选组件
                    this.$refs.programPageForm.init('1', true)
                }
            })
        },

        openProgramPageForm3(rowIndex, row) {
            if (this.commonJS.isEmpty(row.typeName)) {
                this.$message.error('请选择报销类型')
                return
            }
            this.indexRow = rowIndex
            this.$refs.cwProgramPageForm3.init('2', false)
        },
        openProgramPageForm4(rowIndex, row) {
            if (this.commonJS.isEmpty(row.typeName)) {
                this.$message.error('请选择报销类型')
                return
            }
            this.indexRow = rowIndex
            this.$refs.cwProgramPageForm4.init('2', false)
        },
        openProgramPageForm8(rowIndex, row) {
            if (this.commonJS.isEmpty(row.typeName)) {
                this.$message.error('请选择报销类型')
                return
            }
            this.indexRow = rowIndex
            this.$refs.cwProgramPageForm8.init('2', false)
        },
        openProgramPageForm5(rowIndex, row) {
            if (this.commonJS.isEmpty(row.typeName)) {
                this.$message.error('请选择报销类型')
                return
            }
            this.indexRow = rowIndex
            this.$refs.cwProgramPageForm5.init('2', false)
        },
        openContractForm(rowIndex, row) {
            this.$refs.workContractChooseCom.init(rowIndex)
        },
        getProgramPg(rows) {
            if (this.commonJS.isNotEmpty(rows)) {
                this.inputForm.detailInfos[this.indexRow].projectId = rows.map(item => { return item.id }).join(',')
                this.inputForm.detailInfos[this.indexRow].projectName = rows.map(item => { return item.name }).join(',')
                this.inputForm.detailInfos[this.indexRow].reportNumber = rows.map(item => { return item.reportNo }).join(',')
            }
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgram(rows) {
            this.inputForm.detailInfos[this.indexRow].projectId = rows[0].id
            this.inputForm.detailInfos[this.indexRow].projectName = rows[0].projectName
            this.inputForm.detailInfos[this.indexRow].reportNumber = rows[0].reportNumber
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramCw(rows) {
            this.inputForm.detailInfoReports[this.indexRow].projectId = rows.id
            this.inputForm.detailInfoReports[this.indexRow].projectName = rows.projectName
            this.inputForm.detailInfoReports[this.indexRow].reportNumber = rows.reportNumber
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgram3(rows) {
            this.inputForm.detailInfoReports[this.indexRow].projectId = rows[0].id
            this.inputForm.detailInfoReports[this.indexRow].projectName = rows[0].projectName
            this.inputForm.detailInfoReports[this.indexRow].reportNumber = rows[0].reportNumber
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramCwProject(rows) {
            this.inputForm.detailInfos[this.indexRow].projectId = rows[0].id
            this.inputForm.detailInfos[this.indexRow].projectName = rows[0].projectName
            this.inputForm.detailInfos[this.indexRow].reportNumber = rows[0].reportNumber
            this.indexRow = ''
            this.$forceUpdate()
        },

        getProgram4(rows) {
            this.inputForm.detailInfoOthers[this.indexRow].projectId = rows[0].id
            this.inputForm.detailInfoOthers[this.indexRow].projectName = rows[0].projectName
            this.inputForm.detailInfoOthers[this.indexRow].reportNumber = rows[0].reportNumber
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgram8(rows) {
            this.inputForm.detailInfoProject[this.indexRow].projectId = rows[0].id
            this.inputForm.detailInfoProject[this.indexRow].projectName = rows[0].projectName
            this.inputForm.detailInfoProject[this.indexRow].reportNumber = rows[0].reportNumber
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgram5(rows) {
            this.inputForm.detailInfoProcured[this.indexRow].projectId = rows[0].id
            this.inputForm.detailInfoProcured[this.indexRow].projectName = rows[0].projectName
            this.inputForm.detailInfoProcured[this.indexRow].reportNumber = rows[0].reportNumber
            this.indexRow = ''
            this.$forceUpdate()
        },
        // 报销类型下拉弹窗
        typePullForm(rowIndex, deptName) {
            this.indexRow = rowIndex
            // this.$refs.reimbursementTypePullForm.init()
            this.$refs.cwReimbursementTypePullForm.init('2', deptName)

            //this.$refs.cwReimbursementTypePullForm.init('1', deptName)
        },
        // 报销类型下拉弹窗
        typePullFormCw(rowIndex, deptName) {
            this.indexRow = rowIndex
            // this.$refs.reimbursementTypePullForm.init()
            this.$refs.cwReimbursementTypePullFormCw.init('1', deptName)
        },
        typePullFormProject(rowIndex, deptName) {
            this.indexRow = rowIndex
            // this.$refs.reimbursementTypePullForm.init()
            this.$refs.cwReimbursementTypePullFormCwProject.init('1', deptName)
        },
        typePullForm2(rowIndex, deptName) {
            this.indexRow = rowIndex
            // this.$refs.reimbursementTypePullForm.init()
            this.$refs.cwReimbursementTypePullForm2.init('2', deptName)
        },
        typePullForm3(rowIndex, deptName) {
            this.indexRow = rowIndex
            // this.$refs.reimbursementTypePullForm.init()
            this.$refs.cwReimbursementTypePullForm3.init('1', deptName)
        },
        typePullForm4(rowIndex, deptName) {
            this.indexRow = rowIndex
            // this.$refs.reimbursementTypePullForm.init()
            this.$refs.cwReimbursementTypePullForm4.init('2', deptName)
        },
        typePullForm8(rowIndex, deptName) {
            this.indexRow = rowIndex
            // this.$refs.reimbursementTypePullForm.init()
            this.$refs.cwReimbursementTypePullForm8.init('2', deptName)
        },
        typePullForm5(rowIndex, deptName) {
            this.indexRow = rowIndex
            // this.$refs.reimbursementTypePullForm.init()
            this.$refs.cwReimbursementTypePullForm5.init('2', deptName)
        },
        // 报销内容详情
        getProgramForType(rows) {
            this.inputForm.detailInfos[this.indexRow].typeId = rows.id
            this.inputForm.detailInfos[this.indexRow].typeName = rows.name
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramForTypeCw(rows) {
            this.inputForm.detailInfoReports[this.indexRow].typeId = rows.id
            this.inputForm.detailInfoReports[this.indexRow].typeName = rows.name
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramForTypeCwProject(rows) {
            this.inputForm.detailInfos[this.indexRow].typeId = rows.id
            this.inputForm.detailInfos[this.indexRow].typeName = rows.name
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramForType2(rows) {
            this.inputForm.detailInfoContracts[this.indexRow].typeId = rows.id
            this.inputForm.detailInfoContracts[this.indexRow].typeName = rows.name
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramForType3(rows) {
            this.inputForm.detailInfoReports[this.indexRow].typeId = rows.id
            this.inputForm.detailInfoReports[this.indexRow].typeName = rows.name
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramForType4(rows) {
            this.inputForm.detailInfoOthers[this.indexRow].typeId = rows.id
            this.inputForm.detailInfoOthers[this.indexRow].typeName = rows.name
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramForType5(rows) {
            this.inputForm.detailInfoProcured[this.indexRow].typeId = rows.id
            this.inputForm.detailInfoProcured[this.indexRow].typeName = rows.name
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramForType8(rows) {
            this.inputForm.detailInfoProject[this.indexRow].typeId = rows.id
            this.inputForm.detailInfoProject[this.indexRow].typeName = rows.name
            this.indexRow = ''
            this.$forceUpdate()
        },

        // 报销人下拉弹窗
        userPullListForm(rowIndex) {
            this.indexRow = rowIndex
            this.$refs.userPullForm.init()
        },
        userPullListForm2(rowIndex) {
            this.indexRow = rowIndex
            this.$refs.userPullForm2.init()
        },
        userPullListForm3(rowIndex) {
            this.indexRow = rowIndex
            this.$refs.userPullForm3.init()
        },
        userPullListForm4(rowIndex) {
            this.indexRow = rowIndex
            this.$refs.userPullForm4.init()
        },
        userPullListForm8(rowIndex) {
            this.indexRow = rowIndex
            this.$refs.userPullForm8.init()
        },
        userPullListForm5(rowIndex) {
            this.indexRow = rowIndex
            this.$refs.userPullForm5.init()
        },
        getProgramForUser(rows) {
            this.inputForm.detailInfos[this.indexRow].userId = rows[0].id
            this.inputForm.detailInfos[this.indexRow].userName = rows[0].name
            this.inputForm.detailInfos[this.indexRow].deptId = rows[0].parentId
            this.inputForm.detailInfos[this.indexRow].deptName = rows[0].officeName
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramForUser2(rows) {
            this.inputForm.detailInfoContracts[this.indexRow].userId = rows[0].id
            this.inputForm.detailInfoContracts[this.indexRow].userName = rows[0].name
            this.inputForm.detailInfoContracts[this.indexRow].deptId = rows[0].parentId
            this.inputForm.detailInfoContracts[this.indexRow].deptName = rows[0].officeName
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramForUser3(rows) {
            this.inputForm.detailInfoReports[this.indexRow].userId = rows[0].id
            this.inputForm.detailInfoReports[this.indexRow].userName = rows[0].name
            this.inputForm.detailInfoReports[this.indexRow].deptId = rows[0].parentId
            this.inputForm.detailInfoReports[this.indexRow].deptName = rows[0].officeName
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramForUser4(rows) {
            this.inputForm.detailInfoOthers[this.indexRow].userId = rows[0].id
            this.inputForm.detailInfoOthers[this.indexRow].userName = rows[0].name
            this.inputForm.detailInfoOthers[this.indexRow].deptId = rows[0].parentId
            this.inputForm.detailInfoOthers[this.indexRow].deptName = rows[0].officeName
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramForUser5(rows) {
            this.inputForm.detailInfoProcured[this.indexRow].userId = rows[0].id
            this.inputForm.detailInfoProcured[this.indexRow].userName = rows[0].name
            this.inputForm.detailInfoProcured[this.indexRow].deptId = rows[0].parentId
            this.inputForm.detailInfoProcured[this.indexRow].deptName = rows[0].officeName
            this.indexRow = ''
            this.$forceUpdate()
        },
        getProgramForUser8(rows) {
            this.inputForm.detailInfoProject[this.indexRow].userId = rows[0].id
            this.inputForm.detailInfoProject[this.indexRow].userName = rows[0].name
            this.inputForm.detailInfoProject[this.indexRow].deptId = rows[0].parentId
            this.inputForm.detailInfoProject[this.indexRow].deptName = rows[0].officeName
            this.indexRow = ''
            this.$forceUpdate()
        },
        getWorkClientChooseCwProject(list) {
            this.inputForm.detailInfos[this.indexRow].reportNumber = list.reportNo
            this.indexRow = ''
            this.$forceUpdate()
        },
        getWorkClientChoose2(list) {
            this.inputForm.detailInfoReports[this.indexRow].reportNumber = list.reportNo
            this.indexRow = ''
            this.$forceUpdate()
        },
        getContract(row, rowIndex) {
            this.inputForm.detailInfoContracts[rowIndex].contractId = row.id
            this.inputForm.detailInfoContracts[rowIndex].contractName = row.contractName
            this.$forceUpdate()
        },
        changeSourceType(value) {
            this.inputForm.detailInfos = []
            this.inputForm.detailInfoContracts = []
            this.inputForm.detailInfoReports = []
            this.inputForm.detailInfoOthers = []
            this.inputForm.detailInfoProcured = []
            this.inputForm.detailInfoProject = []
            this.inputForm.purchaseNo = ''
            this.inputForm.preList = ''
            this.inputForm.purchaseId = ''
            this.detailKey = Math.random()
            this.detailKeyContract = Math.random()
            this.detailKeyReport = Math.random()
            this.detailKeyOthers = Math.random()
            this.detailKeyProcured = Math.random()
            this.detailKeyProject = Math.random()
        },
        submitCheck() {
            if (this.commonJS.isEmpty(this.inputForm.sourceType)) {
                this.$message.error('请填写报销类型')
                this.loading = false
                throw new Error('请填写报销类型')
            } else {
                if (this.inputForm.sourceType === '1') {
                    if (this.commonJS.isEmpty(this.inputForm.detailInfos)) {
                        this.$message.error('至少填写一条报销详情信息')
                        this.loading = false
                        throw new Error('至少填写一条报销详情信息')
                    } else {
                        let i = this.inputForm.detailInfos.length
                        for (let j = 0; j < i; j++) {
                            let k = j + 1
                            if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].userName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销人')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销人')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].typeName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销类型')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销类型')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].projectName)) {
                                this.$message.error('报销详情第' + k + '行请填写报销详情')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请填写报销详情')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].numberCount)) {
                                this.$message.error('报销详情第' + k + '行请输入费用')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请输入费用')
                            }
                        }
                    }
                } else if (this.inputForm.sourceType === '2') {
                    if (this.commonJS.isEmpty(this.inputForm.detailInfoContracts)) {
                        this.$message.error('至少填写一条报销详情信息')
                        this.loading = false
                        throw new Error('至少填写一条报销详情信息')
                    } else {
                        let i = this.inputForm.detailInfoContracts.length
                        for (let j = 0; j < i; j++) {
                            let k = j + 1
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoContracts[j].userName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销人')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销人')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoContracts[j].typeName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销类型')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销类型')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoContracts[j].contractName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销合同')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销合同')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoContracts[j].numberCount)) {
                                this.$message.error('报销详情第' + k + '行请输入费用')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请输入费用')
                            }
                        }
                    }
                } else if (this.inputForm.sourceType === '3') {
                    if (this.commonJS.isEmpty(this.inputForm.detailInfoReports)) {
                        this.$message.error('至少填写一条报销详情信息')
                        this.loading = false
                        throw new Error('至少填写一条报销详情信息')
                    } else {
                        let i = this.inputForm.detailInfoReports.length
                        for (let j = 0; j < i; j++) {
                            let k = j + 1
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoReports[j].userName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销人')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销人')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoReports[j].typeName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销类型')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销类型')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoReports[j].projectName)) {
                                this.$message.error('报销详情第' + k + '行请填写报销详情')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请填写报销详情')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoReports[j].numberCount)) {
                                this.$message.error('报销详情第' + k + '行请输入费用')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请输入费用')
                            }
                        }
                    }
                } else if (this.inputForm.sourceType === '4') {
                    if (this.commonJS.isEmpty(this.inputForm.detailInfoOthers)) {
                        this.$message.error('至少填写一条报销详情信息')
                        this.loading = false
                        throw new Error('至少填写一条报销详情信息')
                    } else {
                        let i = this.inputForm.detailInfoOthers.length
                        for (let j = 0; j < i; j++) {
                            let k = j + 1
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoOthers[j].userName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销人')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销人')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoOthers[j].typeName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销类型')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销类型')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoOthers[j].projectName)) {
                                this.$message.error('报销详情第' + k + '行请填写报销详情')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请填写报销详情')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoOthers[j].numberCount)) {

                                this.$message.error('报销详情第' + k + '行请输入费用')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请输入费用')
                            }
                        }
                    }
                } else if (this.inputForm.sourceType === '8') {
                    if (this.commonJS.isEmpty(this.inputForm.detailInfoProject)) {
                        this.$message.error('至少填写一条报销详情信息')
                        this.loading = false
                        throw new Error('至少填写一条报销详情信息')
                    } else {
                        let i = this.inputForm.detailInfoProject.length
                        for (let j = 0; j < i; j++) {
                            let k = j + 1
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoProject[j].userName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销人')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销人')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoProject[j].typeName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销类型')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销类型')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoProject[j].projectName)) {
                                this.$message.error('报销详情第' + k + '行请填写报销详情')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请填写报销详情')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoProject[j].numberCount)) {
                                this.$message.error('报销详情第' + k + '行请输入费用')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请输入费用')
                            }

                            if (this.commonJS.isEmpty(this.inputForm.detailInfoProject[j].projectApprovalNumber) && this.commonJS.isEmpty(this.inputForm.detailInfoProject[j].invoiceNumber)) {
                                this.$message.error('报销详情第' + k + '行发票号或者立项号至少填写一项')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行发票号或者立项号至少填写一项')
                            }

                        }
                    }
                } else if (this.inputForm.sourceType === '5') {
                    if (this.commonJS.isEmpty(this.inputForm.detailInfoProcured)) {
                        this.$message.error('至少填写一条报销详情信息')
                        this.loading = false
                        throw new Error('至少填写一条报销详情信息')
                    } else {
                        let i = this.inputForm.detailInfoProcured.length
                        for (let j = 0; j < i; j++) {
                            let k = j + 1
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoProcured[j].userName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销人')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销人')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoProcured[j].typeName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销类型')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销类型')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoProcured[j].projectName)) {
                                this.$message.error('报销详情第' + k + '行请选择报销项目')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请选择报销项目')
                            }
                            if (this.commonJS.isEmpty(this.inputForm.detailInfoProcured[j].numberCount)) {
                                this.$message.error('报销详情第' + k + '行请输入费用')
                                this.loading = false
                                throw new Error('报销详情第' + k + '行请输入费用')
                            }
                        }
                    }
                }
            }
        },
        openPurForm() {
            this.$refs.purchaseChooseForm.init()
        },
        startPur(id) {
            this.materialManagementService.findById(id).then((data) => {
                this.inputForm.preList = data.detailInfos
                this.inputForm.purchaseNo = data.purchaseNo
                let i = this.inputForm.preList.length
                for (let j = 0; j < i; j++) {
                    if (this.commonJS.isNotEmpty(this.inputForm.preList[j].tradePrice)) {
                        if (this.commonJS.isNotEmpty(this.inputForm.preList[j].tradeNumber)) {
                            this.inputForm.preList[j].priceSum = this.inputForm.preList[j].tradePrice * this.inputForm.preList[j].tradeNumber
                        }
                    }
                }
            })
            this.$forceUpdate()
        },
        getPurChoose(row) {
            this.inputForm.purchaseId = row.id
            this.startPur(row.id)
        },
        footerMethod555({ columns, data }) {
            const footerData = [
                columns.map((column, columnIndex) => {
                    if (columnIndex === 0) {
                        return '商品总价'
                    }
                    if (['priceSum'].includes(column.property)) {
                        // eslint-disable-next-line no-undef
                        this.inputForm.tradeTotalPrice = XEUtils.sum(data, column.property)
                        return XEUtils.sum(data, column.property)
                    }
                    return null
                })
            ]
            return footerData
        },
        seeFileInfo(index) {
            if (this.commonJS.isEmpty(this.inputForm.preList[index].fileInfoLost)) {
                this.inputForm.preList[index].fileInfoLost = []
            }
            this.$refs.materialManagementDialog.newUpload('view', this.inputForm.preList[index].fileInfoLost, null, null, null, null, null, false, index)
        },
        invoiceReimbursementDisposeData: function (data, file) {
            var invoiceReimbursements = this.inputForm.invoiceReimbursements;
            //创建判断值，若行信息存在相同的发票号，则进行数据检查调整，若不存在发票号，则新增行，并将信息写入
            var includeFlag = false;
            if (!invoiceReimbursements) {
                invoiceReimbursements = [];
            }
            //将购买方的名称中括号全部转换成英文进行比较
            var buyerInformationBuyerName = data.BuyerInformationBuyerName.replace(/（/g, '(').replace(/）/g, ')')
            buyerInformationBuyerName = buyerInformationBuyerName.replace(/\s+/g, '');
            if ("中审众环会计师事务所(特殊普通合伙)江苏分所" !== buyerInformationBuyerName) {
                //删除上传的附件信息
                this.$refs.invoiceReimbursementUpLoadComponent.parentDeleteById(file)
                //进行提醒
                this.$message.warning("仅可上传中审众环会计师事务所(特殊普通合伙)江苏分所的报销数电发票")
            } else {
                this.reimbursementService.getEffectiveDataByInvoiceNumber(data.InvoiceNumber, this.inputForm.id).then((decide) => {
                    if (!decide.success) {
                        //删除上传的附件信息
                        this.$refs.invoiceReimbursementUpLoadComponent.parentDeleteById(file)
                        //进行提醒
                        this.$message.warning(decide.message)
                    } else {
                        invoiceReimbursements.forEach(item => {
                            if (item.number === data.InvoiceNumber) {
                                includeFlag = true;
                                item.invoiceType = data.InherentLabelGeneralOrSpecialVATLabelCode;
                                item.invoiceProjectName = data.IssuItemInformationItemName;
                                item.number = data.InvoiceNumber;
                                item.invoiceDate = data.IssueTime;
                                item.invoiceUnit = data.SellerInformationSellerName;
                                item.amount = data.BasicInformationTotalAmWithoutTax;
                                item.taxAmount = data.BasicInformationTotalTaxAm;
                                item.count = data.BasicInformationTotalTaxincludedAmount;
                                item.buyerName = data.BuyerInformationBuyerName;
                            }
                        })
                        //列表中未查到相同发票号
                        if (!includeFlag) {
                            let value = {
                                invoiceType: data.InherentLabelGeneralOrSpecialVATLabelCode,
                                invoiceProjectName: data.IssuItemInformationItemName,
                                number: data.InvoiceNumber,
                                invoiceDate: data.IssueTime,
                                invoiceUnit: data.SellerInformationSellerName,
                                amount: data.BasicInformationTotalAmWithoutTax,
                                taxAmount: data.BasicInformationTotalTaxAm,
                                count: data.BasicInformationTotalTaxincludedAmount,
                                buyerName: data.BuyerInformationBuyerName,
                                remarks: ''
                            }
                            this.insertInvoiceReimbursementEvent('invoiceReimbursement', value)
                        }
                    }

                }).catch(() => {
                    this.$refs.inputForm.resetFields()
                    this.loading = false
                })
            }


        },
        invoiceReimbursementDispose: function (data) {
            var invoiceReimbursements = this.inputForm.invoiceReimbursements;
            //创建判断值，若行信息存在相同的发票号，则进行数据检查调整，若不存在发票号，则新增行，并将信息写入
            var includeFlag = false;
            if (!invoiceReimbursements) {
                invoiceReimbursements = [];
            }

            invoiceReimbursements.forEach(item => {
                if (item.number === data.InvoiceNumber) {
                    includeFlag = true;
                }
            })
            return includeFlag;
        },
        deleteInvoiceReimbursementDisposeData: function (data) {
            var invoiceReimbursements = this.inputForm.invoiceReimbursements;
            //创建判断值，若行信息存在相同的发票号，则进行数据检查调整，若不存在发票号，则新增行，并将信息写入
            if (!invoiceReimbursements) {
                invoiceReimbursements = [];
            }

            for (var i = 0; i < invoiceReimbursements.length; i++) {
                var item = invoiceReimbursements[i];
                if (item.number === data.InvoiceNumber) {
                    this.removeEvent(item, i, 'invoiceReimbursement')
                }
                if (this.inputForm.id && item.number) {
                    //根据电子发票号和报销表id去删除数据库中存在的数据
                    this.reimbursementService.deleteByIdAndNumber(this.inputForm.id, data.InvoiceNumber).then((data) => {
                        if (!data.success) {
                            this.$message.error(data.message)
                        }
                    })
                }
            }

        },
        footerMethod1111({ columns, data }) {
            const footerData = [
                columns.map((column, columnIndex) => {
                    if (columnIndex === 0) {
                        return '汇总'
                    }
                    if (['amount'].includes(column.property)) {
                        // eslint-disable-next-line no-undef
                        return XEUtils.sum(data, column.property)
                    }
                    if (['taxAmount'].includes(column.property)) {
                        // eslint-disable-next-line no-undef
                        return XEUtils.sum(data, column.property)
                    }
                    if (['count'].includes(column.property)) {
                        // eslint-disable-next-line no-undef
                        return XEUtils.sum(data, column.property)
                    }
                    return null
                })
            ]
            return footerData
        },
        changeConfirmList(row) {
            // 如果 confirmStatusList 中存在这个 row.id，则移除
            const index = this.confirmStatusList.findIndex(item => item === row.id);
            if (index !== -1) {
                this.confirmStatusList.splice(index, 1);
                row.confirmStatus = "0"
            } else {
                this.confirmStatusList.push(row.id);
                row.confirmStatus = "1"
            }
        },
        async changeStatusApi() {
            if (this.inputForm.invoiceReimbursementFiles.length == 0) {
                return
            }
            let invoiceStatusIds = this.inputForm.invoiceReimbursementFiles.map(item => {
                return item.id
            }).join(",")
            await this.reimbursementService.saveConfirmStatus({
                invoiceId: invoiceStatusIds,
                status: "1",
                reimbursementId: this.inputForm.id
            })
        },
        handleExpand({ expanded, column, columnIndex, row, rowIndex }) {
            this.handleTableInfo(this.inputForm.sourceType)
            let tempUniqueId = ""
            if (this.tableData[0].uniqueId) {
                tempUniqueId = this.tableData[0].uniqueId
            }
            this.inputForm.invoiceReimbursementFiles.forEach(item => {
                if (!item.remarks) {
                    item.remarks = tempUniqueId
                }
            })
            if (expanded == true) {
                setTimeout(() => {

                    this.$refs[row.uniqueId + "Upload"].clearUpload()
                    let files = JSON.parse(JSON.stringify(this.inputForm.invoiceReimbursementFiles))
                    this.$refs[row.uniqueId + "Upload"].newUpload(this.method, files, this.uploadFlag, 300, '数电发票信息', null, null, null, this.companyName, row.uniqueId)
                    this.$refs[row.uniqueId + "Upload"].isConfirm = this.isConfirm
                }, 100)
            }
            else {

                let files = this.$refs[row.uniqueId + "Upload"].getDataList()
                this.inputForm.invoiceReimbursementFiles = this.inputForm.invoiceReimbursementFiles.filter(item => {
                    return item.remarks != row.uniqueId
                })
                this.inputForm.invoiceReimbursementFiles.push(...files)

            }

            return true

        },
        handleChangeType(value) {

        },
        // 触发上传按钮
        async uploadFile(row, index) {
            this.handleTableInfo(this.inputForm.sourceType)
            await this.tableRef.clearEdit()
            let tempIndex = this.tableRef.getRowExpandRecords().findIndex(item => {
                return row.id == item.id
            })
            if (tempIndex == -1) {
                this.tableRef.setRowExpand(this.tableData[index], true)

            }
            setTimeout(() => {
                this.$refs[row.uniqueId + "Upload"].$el.querySelector('.upload-btn').click();

            }, 100)

        },
        handleTableInfo(value) {
            if (value === '1') {
                this.tableRef = this.$refs.detailTable
                this.tableData = this.inputForm.detailInfos
            } else if (value == "3") {
                this.tableRef = this.$refs.detailTableReport
                this.tableData = this.inputForm.detailInfoReports
            } else if (value == "4") {
                this.tableRef = this.$refs.detailTableOthers
                this.tableData = this.inputForm.detailInfoOthers
            } else if (value == "8") {
                this.tableRef = this.$refs.detailTableProject
                this.tableData = this.inputForm.detailInfoProject
            }
        },
        handleCount(files, uniqueId) {
            this.handleTableInfo(this.inputForm.sourceType)
            let total = 0
            files.forEach((item) => {
                total += Number(item.count)
            });
            let obj = this.tableData.find(item => {
                return item.uniqueId == uniqueId
            })
            obj.number = total
            obj.numberCount = Number(obj.number || 0) + Number(obj.ordinaryNumber || 0)

        },
        handleUploadSuccess(files, uniqueId) {

            this.handleTableInfo(this.inputForm.sourceType)
            let row = this.tableData.find(item => {
                return item.uniqueId == uniqueId
            })
            this.inputForm.invoiceReimbursementFiles = this.inputForm.invoiceReimbursementFiles.filter(item => {
                return item.remarks != row.uniqueId
            })
            this.inputForm.invoiceReimbursementFiles.push(...files)
            this.tableRef.updateFooter(this.tableData)
            row.receiptNumber = files.length
            this.handleReceiptNumberInput(row)
            // this.handleNumberInput(row)
        },
        handleCheckAmount() {
            let countFlag = false
            let countIndex = 0
            this.handleTableInfo(this.inputForm.sourceType)
            this.tableData.forEach((element, index) => {


                let files = this.inputForm.invoiceReimbursementFiles.filter(item => {
                    return item.remarks == element.uniqueId
                })
                let count = 0
                files.forEach((item) => {
                    if (this.commonJS.isNotEmpty(item.count)) {
                        count += Number(item.count)
                    }
                });
                if (count != element.number) {
                    countFlag = true
                    countIndex = index
                }

            })
            if (countFlag) {
                this.$message.warning(`第${countIndex + 1}行报销费用与发票金额不一致`);
                this.loading = false
                throw new Error(`第${countIndex + 1}行报销费用与发票金额不一致`);
            } else {
                this.loading = false
            }
        },
        handleDefaultExpand() {
            this.handleTableInfo(this.inputForm.sourceType)
            let arr = []

            this.tableData.forEach((item, index) => {
                let tempIndex = this.inputForm.invoiceReimbursementFiles.findIndex(temp => {
                    return temp.remarks == item.uniqueId
                })
                if (tempIndex !== -1) {
                    arr.push(item.uniqueId)
                }
            })

            return arr
        },
        handleOrdinaryNumberInput(row, index) {
            console.log(row);
            console.log(row);
            console.log(row);
            console.log(row);

            let value = 0
            if (index == 1) {
                value = row.number
            } else {
                value = row.ordinaryNumber
            }
            const regex = /^(?:[1-9]\d*|0)?(?:\.\d{0,2})?$/;
            // 如果是非数字，直接删除
            if (!regex.test(value)) {
                if (index == 1) {
                    row.number = value.slice(0, -1);
                } else {
                    row.ordinaryNumber = value.slice(0, -1);
                }
                this.$message.warning('确保输入数字格式且小数点后只能输入两位')
                return;
            } else {
                if (index == 1) {
                    let numberCount = 0
                    this.inputForm.invoiceReimbursementFiles.forEach(item => {
                        if (item.remarks == row.uniqueId) {
                            numberCount += parseFloat(item.count || 0)
                        }
                    })
                    if (numberCount > 0 && row.number > numberCount) {
                        row.number = value.slice(0, -1);
                        this.$message.warning('输入结果不可大于发票费用总和')
                        return
                    }
                }

                row.numberCount = parseFloat(Number(row.number || 0) + Number(row.ordinaryNumber || 0)).toFixed(2)
                this.handleTableInfo(this.inputForm.sourceType)
                this.tableRef.updateFooter(this.tableData)
            }
        },
        handleNumberInput(row, index) {
            let value = 0
            if (index == 1) {
                value = row.number
            } else {
                value = row.ordinaryNumber
            }
            const regex = /^(?:[1-9]\d*|0)?(?:\.\d{0,2})?$/;
            // 如果是非数字，直接删除
            if (!regex.test(value)) {
                row.ordinaryNumber = value.slice(0, -1);
                return;
            }
            row.numberCount = parseFloat(Number(row.number || 0) + Number(row.ordinaryNumber || 0)).toFixed(2)
            this.handleTableInfo(this.inputForm.sourceType)
            this.tableRef.updateFooter(this.tableData)

        },
        handleReceiptNumberInput(row) {
            if (this.commonJS.isNotEmpty(row.receiptNumber)) {
                row.receiptNumber = String(row.receiptNumber).replace(/\D|^0/g, '')
            }
            if (this.commonJS.isNotEmpty(row.ordinaryReceiptNumber)) {
                row.ordinaryReceiptNumber = String(row.ordinaryReceiptNumber).replace(/\D|^0/g, '')
            }
            row.receiptNumberCount = Number(row.receiptNumber || 0) + Number(row.ordinaryReceiptNumber || 0)
            this.handleTableInfo(this.inputForm.sourceType)
            this.tableRef.updateFooter(this.tableData)

        },
        handleGetData() {
            return this.inputForm
        }
    }
}
</script>
<style scoped>
.star-icon::before {
    content: "*";
    color: #f56c6c;
    font-weight: bold;
    margin-right: 5px;
}

/deep/ .el-input-number .el-input__inner {
    text-align: left;
}

.bold-red>>>.el-input__inner {
    -webkit-text-fill-color: #ff0000 !important;
    font-weight: bolder;
    text-align: left;
}
</style>
