<template>
    <div class="borderless" v-loading="pageLoading">
        <div class="customer-head">
            <div class="customer-back">
                <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
                    @click="backToList">返回列表
                </el-button>
            </div>
            <div class="add-customer-btn">
                <el-button size="small" type="success" style="margin-right: 8px" :loading="saveLoading"
                    :disabled="form.voucherStatus == 1">凭证标错
                </el-button>
                <el-button size="small" type="primary" style="margin-right: 8px" :loading="saveLoading"
                    @click="finvouchersSubmitfun" :disabled="form.voucherStatus == 1">保 存
                </el-button>
            </div>
        </div>
        <div style="margin: 55px 5px 0px 5px;'">
            <el-card class="box-card">
                <el-form :model="form" ref="form" label-width="90px" class="demo-ruleForm">
                    <el-row>
                        <el-col :span="6">
                            <el-form-item label="凭证类型" prop="voucherType">
                                <search-query :datalist="voucherTypeData" :selectValue="form.voucherType" :clearable="true"
                                    :buttonIf="false" :disabled="form.voucherStatus == 1"
                                    :forParameter="{ key: 'dictKey', label: 'dictValue', value: 'dictKey' }"
                                    placeholder="请选择凭证类型" @corpChange="corpChange($event, 'voucherType')">
                                </search-query>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="凭证号" prop="voucherNo">
                                <el-input style="width: 100%;" v-model="form.voucherNo" size="small" autocomplete="off"
                                    :disabled="true" clearable placeholder="请输入凭证号">
                                </el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="凭证日期" prop="voucherDate">
                                <el-date-picker v-model="form.voucherDate" clearable style="width: 100%;" type="date"
                                    size="small" value-format="yyyy-MM-dd HH:mm" :disabled="form.voucherStatus == 1"
                                    placeholder="选择凭证日期">
                                </el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="凭证来源" prop="voucherSource">
                                <search-query :datalist="voucherSourceData" :selectValue="form.voucherSource"
                                    :clearable="true" :buttonIf="false"
                                    :forParameter="{ key: 'dictKey', label: 'dictValue', value: 'dictKey' }"
                                    placeholder="请选择凭证类型" :disabled="form.voucherStatus == 1"
                                    @corpChange="corpChange($event, 'voucherSource')">
                                </search-query>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="REF NO" prop="billNo">
                                <el-input style="width: 100%;" v-model="form.billNo" size="small" autocomplete="off"
                                    :disabled="true" clearable placeholder="请输入编号">
                                </el-input>
                            </el-form-item>
                        </el-col>
                        <!--<el-col :span="6">-->
                        <!--    <el-form-item label="附件" prop="billNo">-->
                        <!--        <el-input type="" style="width: 100%;" v-model="form.billNo"-->
                        <!--                  size="small" autocomplete="off"-->
                        <!--                  clearable placeholder="请输入附件" >-->
                        <!--        </el-input>-->
                        <!--    </el-form-item>-->
                        <!--</el-col>-->
                    </el-row>
                </el-form>
            </el-card>

            <el-card style="margin-top: 10px">
                <div style="margin-bottom: 10px">
                    <el-button size="small" type="primary" style="margin-right: 8px" :loading="saveLoading"
                        @click="addEntryfun" :disabled="form.voucherStatus == 1">添加分录
                    </el-button>
                    <el-button size="small" type="danger" style="margin-right: 8px" :loading="saveLoading"
                        @click="deleteEntryfun" :disabled="form.voucherStatus == 1">删除分录
                    </el-button>
                    <el-button size="small" type="success" style="margin-right: 8px" :loading="saveLoading"
                        :disabled="form.voucherStatus == 1">项目属性
                    </el-button>
                    <el-button size="small" type="success" style="margin-right: 8px" :loading="saveLoading"
                        :disabled="form.voucherStatus == 1">凭证断号观察器
                    </el-button>
                    <el-button size="small" type="success" style="margin-right: 8px" :loading="saveLoading"
                        :disabled="form.voucherStatus == 1">断号优化
                    </el-button>
                    <el-button size="small" type="success" style="margin-right: 8px" :loading="saveLoading"
                        :disabled="form.voucherStatus == 1">科目余额查询
                    </el-button>
                </div>
                <fromtable-details :tableData="form.finVouchersItemsList" :handleSelectionData="handleSelectionData"
                    :disabled="form.voucherStatus == 1" @handleSelectionChange="handleSelectionChange"
                    @addRowsfun="addRowsfun" @deletefun="deletefun" @auxiliaryAccountingfun="auxiliaryAccountingfun">
                </fromtable-details>
            </el-card>
        </div>


        <!--辅助核算-->
        <el-dialog title=" " append-to-body :visible.sync="auxiliaryVisible" class="el-dialogDeep" width="40%"
            :before-close="handleClose">
            <div>科目名称:{{ subjectRow.accountCnName }}</div>
            <div style="margin-top: 10px">
                <el-form :model="subjectRow" ref="subjectRow" label-width="70px" class="demo-ruleForm">
                    <!--#region-->
                    <!--<div>外币核算:</div>-->
                    <!--<el-row>-->
                    <!--    <el-col :span="4">-->
                    <!--        <el-form-item label="币种:" prop="curCode">-->
                    <!--            <el-input style="width: 100%;" v-model="subjectRow.curCode"-->
                    <!--                      size="small" autocomplete="off"-->
                    <!--                      clearable placeholder="请输入币种" >-->
                    <!--            </el-input>-->
                    <!--        </el-form-item>-->
                    <!--    </el-col>-->
                    <!--    <el-col :span="4">-->
                    <!--        <el-form-item label="汇率:" prop="exrate">-->
                    <!--            <el-input style="width: 100%;" v-model="subjectRow.exrate"-->
                    <!--                      size="small" autocomplete="off"-->
                    <!--                      clearable placeholder="请输入汇率" >-->
                    <!--            </el-input>-->
                    <!--        </el-form-item>-->
                    <!--    </el-col>-->
                    <!--    <el-col :span="4">-->
                    <!--        <el-form-item label="借方金额:" prop="amountDrUsd">-->
                    <!--            <el-input style="width: 100%;" v-model="subjectRow.amountDrUsd"-->
                    <!--                      size="small" autocomplete="off"-->
                    <!--                      clearable placeholder="请输入借方金额" >-->
                    <!--            </el-input>-->
                    <!--        </el-form-item>-->
                    <!--    </el-col>-->
                    <!--    <el-col :span="4">-->
                    <!--        <el-form-item label="贷方金额:" prop="amountCrUsd">-->
                    <!--            <el-input style="width: 100%;" v-model="subjectRow.amountCrUsd"-->
                    <!--                      size="small" autocomplete="off"-->
                    <!--                      clearable placeholder="请输入贷方金额" >-->
                    <!--            </el-input>-->
                    <!--        </el-form-item>-->
                    <!--    </el-col>-->
                    <!--    <el-col :span="4">-->
                    <!--        <el-form-item label="本币借方:" prop="amountDr">-->
                    <!--            <el-input style="width: 100%;" v-model="subjectRow.amountDr"-->
                    <!--                      size="small" autocomplete="off"-->
                    <!--                      clearable placeholder="请输入本币借方" >-->
                    <!--            </el-input>-->
                    <!--        </el-form-item>-->
                    <!--    </el-col>-->
                    <!--    <el-col :span="4">-->
                    <!--        <el-form-item label="本币贷方:" prop="amountCr">-->
                    <!--            <el-input style="width: 100%;" v-model="subjectRow.amountCr"-->
                    <!--                      size="small" autocomplete="off"-->
                    <!--                      clearable placeholder="请输入本币贷方" >-->
                    <!--            </el-input>-->
                    <!--        </el-form-item>-->
                    <!--    </el-col>-->
                    <!--</el-row>-->
                    <!--#endregion-->
                    <!--#region-->
                    <!--<div>数量核算:</div>-->
                    <!--<el-row>-->
                    <!--    <el-col :span="4">-->
                    <!--        <el-form-item label="单位:" prop="unitNo">-->
                    <!--            <el-input style="width: 100%;" v-model="subjectRow.unitNo"-->
                    <!--                      size="small" autocomplete="off"-->
                    <!--                      clearable placeholder="请输入单位" >-->
                    <!--            </el-input>-->
                    <!--        </el-form-item>-->
                    <!--    </el-col>-->
                    <!--    <el-col :span="4">-->
                    <!--        <el-form-item label="规格:" prop="voucherNo">-->
                    <!--            <el-input style="width: 100%;" v-model="subjectRow.voucherNo"-->
                    <!--                      size="small" autocomplete="off"-->
                    <!--                      clearable placeholder="请输入规格" >-->
                    <!--            </el-input>-->
                    <!--        </el-form-item>-->
                    <!--    </el-col>-->
                    <!--    <el-col :span="4">-->
                    <!--        <el-form-item label="借方数量:" prop="quantityDr">-->
                    <!--            <el-input style="width: 100%;" v-model="subjectRow.quantityDr"-->
                    <!--                      size="small" autocomplete="off"-->
                    <!--                      clearable placeholder="请输入借方数量" >-->
                    <!--            </el-input>-->
                    <!--        </el-form-item>-->
                    <!--    </el-col>-->
                    <!--    <el-col :span="4">-->
                    <!--        <el-form-item label="借方单价:" prop="voucherNo">-->
                    <!--            <el-input style="width: 100%;" v-model="subjectRow.voucherNo"-->
                    <!--                      size="small" autocomplete="off"-->
                    <!--                      clearable placeholder="请输入借方单价" >-->
                    <!--            </el-input>-->
                    <!--        </el-form-item>-->
                    <!--    </el-col>-->
                    <!--    <el-col :span="4">-->
                    <!--        <el-form-item label="贷方数量:" prop="quantityCr">-->
                    <!--            <el-input style="width: 100%;" v-model="subjectRow.quantityCr"-->
                    <!--                      size="small" autocomplete="off"-->
                    <!--                      clearable placeholder="请输入贷方数量" >-->
                    <!--            </el-input>-->
                    <!--        </el-form-item>-->
                    <!--    </el-col>-->
                    <!--    <el-col :span="4">-->
                    <!--        <el-form-item label="贷方单价:" prop="voucherNo">-->
                    <!--            <el-input style="width: 100%;" v-model="subjectRow.voucherNo"-->
                    <!--                      size="small" autocomplete="off"-->
                    <!--                      clearable placeholder="请输入贷方单价" >-->
                    <!--            </el-input>-->
                    <!--        </el-form-item>-->
                    <!--    </el-col>-->
                    <!--</el-row>-->
                    <!--#endregion-->
                    <el-row :gutter="40">
                        <el-col :span="12" v-if="subjectAccount.isCorp">
                            <!--<div>客户核算：</div>-->
                            <el-form-item label="客户名称:" prop="corpCnName">
                                <search-query style="width: 100%" ref="searchQueryRef" :datalist="corpCnNameData"
                                    :selectValue="subjectRow.corpCnName" :filterable="true" :clearable="true" :remote="true"
                                    :buttonIf="true" placeholder="请选择客户名称"
                                    :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
                                    @corpFocus="getBcorpsListfun" @remoteMethod="getBcorpsListfun"
                                    @corpChange="corpChange($event, 'corpCnName')"
                                    @eldialogConfirm="eldialogConfirm('bcorps')"
                                    @bottonSearchfun="bottonSearchfun('bcorps')">
                                    <bcorps ref="bcorps" :eldialog="true"
                                        @selectionChange="eldialogMultipleChoice($event, 'bcorps')"></bcorps>
                                </search-query>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" v-if="subjectAccount.isDept">
                            <!--<div>部门核算：</div>-->
                            <el-form-item label="部门名称:" prop="deptName">
                                <tree-select v-model="subjectRow.deptName" filterable :data="deptData"
                                    :props="{ label: 'title', children: 'children' }" nodeKey="title" size="small"
                                    :multiple="false" placeholder="请选择部门名称" @focus="getDeptTreefun"
                                    @input="corpChange($event, 'deptName')">
                                </tree-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" v-if="subjectAccount.isEmpl">
                            <!--<div>职员核算：</div>-->
                            <el-form-item label="职员名称:" prop="emplName">
                                <search-query :datalist="emplData" :selectValue="subjectRow.emplName" :clearable="true"
                                    :buttonIf="false" :filterable="true" :remote="true" placeholder="请选择职员名称"
                                    :forParameter="{ key: 'id', label: 'name', value: 'name' }" @corpFocus="userGetListfun"
                                    @corpChange="corpChange($event, 'emplName')" @remoteMethod="userGetListfun">
                                </search-query>
                            </el-form-item>
                        </el-col>
                        <!--<el-col :span="12" v-if="subjectAccount.isItem">-->
                        <!--    <div>项目核算：</div>-->
                        <!--    <el-form-item label="项目名称:" prop="itemName">-->
                        <!--        <el-input style="width: 100%;" v-model="subjectRow.itemName"-->
                        <!--                  size="small" autocomplete="off"-->
                        <!--                  clearable placeholder="请输入项目名称" >-->
                        <!--        </el-input>-->
                        <!--        <search-query :datalist="itemData"-->
                        <!--                      :selectValue="subjectRow.itemName"-->
                        <!--                      :clearable="true"-->
                        <!--                      :buttonIf="false"-->
                        <!--                      :filterable="true"-->
                        <!--                      :remote="true"-->
                        <!--                      placeholder="请选择项目名称"-->
                        <!--                      :forParameter="{ key:'id', label:'cnName', value:'cnName'}"-->
                        <!--                      @corpFocus="baccitemstypeListfun"-->
                        <!--                      @corpChange="corpChange($event,'itemName')"-->
                        <!--                      @remoteMethod="baccitemstypeListfun" >-->
                        <!--        </search-query>-->
                        <!--    </el-form-item>-->
                        <!--</el-col>-->
                    </el-row>

                </el-form>
            </div>
            <span slot="footer" class="dialog-footer">
                <el-button @click="auxiliaryVisible = false">取 消</el-button>
                <el-button type="primary" @click="auxiliaryDeterminefun">确 定</el-button>
            </span>
        </el-dialog>

    </div>
</template>

<script>
import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
import { getWorkDicts } from "@/api/system/dictbiz";
import { finvouchersDetail, finvouchersitemsRemove, finvouchersSubmit } from "@/api/iosBasicData/finvouchers";
import { getCurrentDate, getYearDate } from "@/util/date";
import fromtableDetails from "@/views/iosBasicData/finvouchers/assembly/fromtableDetails.vue";
import { accountsDetail } from "@/api/iosBasicData/accounts";
import { getBcorpsList } from "@/api/iosBasicData/bcorps";
import TreeSelect from "@/components/iosbasic-data/TreeSelect.vue";
import { getDeptLazyTree, getDeptTree } from "@/api/system/dept";
import { getList as userGetList } from '@/api/system/user'
import { baccitemstypeList } from "@/api/iosBasicData/baccitemstype";
import bcorps from "@/views/iosBasicData/bcorps/index.vue";

export default {
    components: { bcorps, TreeSelect, SearchQuery, fromtableDetails },
    data() {
        return {
            pageLoading: false, // 整个的动画
            saveLoading: false, // 按钮动画
            // 获取的数据
            form: {
                voucherType: 'PZDH-J', // 凭证类型
                voucherDate: getCurrentDate(),
                finVouchersItemsList: [],
            },
            voucherTypeData: [], // 凭证字数据
            voucherSourceData: [], // 业务类型
            auxiliaryVisible: false, // 辅助核算弹窗
            handleSelectionData: [], // 分录多选的数据
            subjectRow: {}, // 科目弹窗的显示数据
            subjectAccount: {},// 当前选择科目的数据
            corpCnNameData: [], // 客户核算 下拉数据
            deptData: [], // 部门核算 下拉数据
            emplData: [], // 职员核算 下拉数据
            itemData: [], // 项目核算 下拉数据
        }
    },
    created() {
        this.getWorkDictsfun()
    },
    methods: {
        // 下拉弹窗打开操作
        bottonSearchfun(name) {
            this.$nextTick(() => {
                if (this.$refs.bcorps.selectionList.length == 0) return
                this.$refs.bcorps.$refs.crud.toggleSelection() // 先清空所以选择的数据
            })
        },
        // 下拉多选弹窗的确认
        eldialogConfirm(name) {
            if (name == 'bcorps') {
                if (this.$refs.bcorps.isShow) {
                    console.log('列表确认')
                    this.$set(this.subjectRow, 'corpCnName', this.$refs.bcorps.selectionList[0].cnName)
                    this.$set(this.subjectRow, 'corpEnName', this.$refs.bcorps.selectionList[0].enName)
                    this.$set(this.subjectRow, 'corpId', this.$refs.bcorps.selectionList[0].id)
                } else {
                    console.log('详情确认')
                    this.$refs.bcorps.$refs.detail.submitForm()
                    this.$set(this.subjectRow, 'corpCnName', this.$refs.bcorps.$refs.detail.formData.cnName)
                    this.$set(this.subjectRow, 'corpEnName', this.$refs.bcorps.$refs.detail.formData.enName)
                    this.$set(this.subjectRow, 'corpId', this.$refs.bcorps.$refs.detail.formData.id)
                }
            } else {
                console.log('其他的组件')
            }
            this.$refs.searchQueryRef.corpVisible = false
        },
        // 下拉多选弹窗数据多选回调
        eldialogMultipleChoice(list, name) {
            if (name == 'bcorps') {
                let arr = []
                if (list.length > 1) {
                    this.$refs.bcorps.$refs.crud.toggleSelection() // 先清空所以选择的数据
                    arr = [list[list.length - 1]] // 获取最新点击的数组
                    this.$refs.bcorps.$refs.crud.toggleSelection(arr, true) // 把刚点击的数组变成选择状态
                } else {
                    arr = list
                }
                this.$refs.bcorps.selectionList = arr
            } else {
                console.log('其他的组件')
            }
        },
        // 详情接口
        finvouchersDetailfun(id) {
            this.pageLoading = true
            finvouchersDetail(id).then(res => {
                this.form = res.data.data
            }).finally(() => {
                this.pageLoading = false
            });
        },
        // 添加分录
        addEntryfun() {
            let obj = {}
            if (this.form.finVouchersItemsList.length > 0) {
                obj.descr = this.form.finVouchersItemsList[this.form.finVouchersItemsList.length - 1].descr
            }
            this.form.finVouchersItemsList.push(obj)
        },
        // 行添加
        addRowsfun(row, index) {
            //第二个参数为0的时候，是可以添加参数的，1的时候是删除
            this.form.finVouchersItemsList.splice(index, 0, {
                descr: row.descr
            });
        },
        // 行删除
        deletefun(row, index) {
            if (row.id) {
                this.finvouchersitemsRemovefun(row.id)
            }
            this.form.finVouchersItemsList.splice(index, 1)
        },
        // 删除分录
        deleteEntryfun() {
            if (this.handleSelectionData.length == 0) {
                return this.$message.warning('请选择至少一条数据')
            }
            let multiList = this.handleSelectionData
            let arr = this.form.finVouchersItemsList
            // 获取有id 的数据
            const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
            let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
            // 把选中的删除掉
            multiList.forEach((item) => {
                for (let index in arr) {
                    if (JSON.stringify(item) == JSON.stringify(arr[index])) {
                        arr.splice(Number(index), 1)
                    }
                }
            })
            // 有id 的处理
            if (itemsWithId.length != 0) {
                this.finvouchersitemsRemovefun(arrIds.join(','))
            }
        },
        // 大保存
        finvouchersSubmitfun() {
            this.form.businessTypeCode = 'PZDH'
            this.form.billNoFormat = this.form.voucherType
            if (this.form.finVouchersItemsList.length < 2) {
                return this.$message.warning('请填写至少凭证两笔分录后再保存！')
            }
            // // 判断币种是否一样
            // for (let item of this.form.finVouchersItemsList) {
            //     if (this.form.finVouchersItemsList[0].curCode != item.curCode) {
            //         return this.$message.warning('请选择相同币种的科目')
            //     }
            // }
            // 判断借方金额合计 是否等于 贷方金额合计
            let amountDrSum = 0
            let amountCrSum = 0
            for (let item of this.form.finVouchersItemsList) {
                amountDrSum += Number(item.amountDr)
                amountCrSum += Number(item.amountCr)
                // if (item.curCode == 'USD') {
                //     amountDrSum += Number(item.amountDrUsd)
                //     amountCrSum += Number(item.amountCrUsd)
                // }else {
                //     amountDrSum += Number(item.amountDr)
                //     amountCrSum += Number(item.amountCr)
                // }
            }
            if (amountDrSum != amountCrSum) {
                return this.$message.warning('凭证借贷金额不平衡')
            }
            console.log(this.form, 379)

            this.pageLoading = true
            finvouchersSubmit(this.form).then(res => {
                this.$message.success('操作成功')
                this.finvouchersDetailfun(res.data.data.id)
            }).finally(() => {
                this.pageLoading = false
            });
        },
        // 分录删除接口
        finvouchersitemsRemovefun(id) {
            finvouchersitemsRemove(id).then(res => {
                this.$message.success('操作成功')
                this.finvouchersDetailfun()
            })
        },
        // 科目编辑打开辅助核算弹窗
        auxiliaryAccountingfun(row) {
            // 获取状态
            accountsDetail(row.accountId).then(res => {
                this.subjectAccount = res.data.data
                this.subjectRow = row
                // 如果三个都没有勾选 直接不自动打开弹窗
                if (res.data.data.isCorp || res.data.data.isDept || res.data.data.isEmpl) {
                    this.auxiliaryVisible = true
                }
            })
        },
        // 辅助核算弹窗确认按钮
        auxiliaryDeterminefun() {
            this.auxiliaryVisible = false
        },
        // 下拉回调
        corpChange(value, name) {
            // 客户名称
            if (name == 'corpCnName') {
                for (let item of this.corpCnNameData) {
                    if (item.cnName == value) {
                        this.$set(this.subjectRow, 'corpEnName', item.enName)
                        this.$set(this.subjectRow, 'corpCnName', item.cnName)
                        this.$set(this.subjectRow, 'corpId', item.id)
                    }
                }
            }
            // 核算
            else if (name == 'deptName') {
                for (let item of this.deptData) {
                    if (item.title == value) {
                        this.$set(this.subjectRow, 'deptName', item.title)
                        this.$set(this.subjectRow, 'deptId', item.id)
                    }
                }
            }
            // 职员
            else if (name == 'emplName') {
                for (let item of this.emplData) {
                    if (item.name == value) {
                        this.$set(this.subjectRow, 'emplName', item.name)
                        this.$set(this.subjectRow, 'emplId', item.id)
                    }
                }
            }
            // 项目核算
            else if (name == 'itemName') {
                for (let item of this.itemData) {
                    if (item.cnName == value) {
                        this.$set(this.subjectRow, 'itemName', item.cnName)
                        this.$set(this.subjectRow, 'itemId', item.id)
                    }
                }
            } else if (name == 'voucherType' || name == 'voucherSource') {
                this.$set(this.form, name, value)
            }
        },
        // 接口数据调用
        // 客户
        getBcorpsListfun(cnName) {
            getBcorpsList(1, 10, { cnName }).then(res => {
                this.corpCnNameData = res.data.data.records
            })
        },
        // 部门
        getDeptTreefun() {
            getDeptLazyTree(JSON.parse(localStorage.getItem('saber-userInfo')).content.dept_pid.split(',')[0]).then(res => {
                this.deptData = res.data.data
            })
        },
        // 职员
        userGetListfun(account = undefined, type = false,) {
            userGetList(1, 10, { account }, JSON.parse(localStorage.getItem('saber-userInfo')).content.dept_pid.split(',')[0]).then(res => {
                this.emplData = res.data.data.records
            })
        },
        // 项目核算
        baccitemstypeListfun(cnName) {
            baccitemstypeList(1, 10, { cnName }).then(res => {
                this.itemData = res.data.data.records
            })
        },
        // 表格多选数据
        handleSelectionChange(list) {
            this.handleSelectionData = list
        },
        // 弹窗点击差号
        handleClose(done) {
            this.$confirm('确认关闭？')
                .then(_ => {
                    done();
                })
                .catch(_ => { });
        },
        // 获取字典数据
        getWorkDictsfun() {
            // 凭证字数据
            getWorkDicts('voucher_word_los').then(res => {
                this.voucherTypeData = res.data.data
            })
            getWorkDicts('voucher_source_los').then(res => {
                this.voucherSourceData = res.data.data
            })
        },
        //返回列表
        backToList() {
            this.$emit('goBack')
        },
    }
}
</script>

<style scoped lang="scss">
::v-deep.el-form-item {
    margin-bottom: 0;
}

.borderBox {
    border: 1px solid #b6b6b6;
    padding: 5px;
    box-sizing: border-box;
    border-radius: 2px;
    position: relative;
    margin-right: 10px;
}

.positionCheckbox {
    position: absolute;
    top: -10px;
    left: 10px;
    background: #fff;
}

.cardRight {
    margin-right: 10px;
    height: 220px;
}

.borderCheckbox {
    border-bottom: 1px solid #4a9de6;
    padding-bottom: 5px;
    color: #4a9de6;
    margin-bottom: 5px;
}

.el-dialogDeep {
    ::v-deep .el-dialog {
        .el-dialog__body {
            padding-bottom: 0 !important;
            padding-top: 0 !important;
        }
    }
}
</style>
