<template> 
 | 
    <GlobalWindow 
 | 
        :title="title" 
 | 
        submitText="修改" 
 | 
        :visible.sync="visible" 
 | 
        :confirm-working="isWorking" 
 | 
        @confirm="$refs.operaInsuranceWindow.open('编辑保险公司', form)" 
 | 
    > 
 | 
        <div class="box"> 
 | 
            <div class="box_name"> 
 | 
                <span>保险公司:{{form.name}}</span> 
 | 
                <span>是否启用:{{form.status == 0 ? '启用' : '禁用'}}</span> 
 | 
            </div> 
 | 
            <el-table 
 | 
                :data="tableData" 
 | 
                border> 
 | 
                <el-table-column 
 | 
                    label="序号" 
 | 
                    align="center" 
 | 
                    width="80"> 
 | 
                    <template slot-scope="scope"> 
 | 
                        <span>{{scope.$index + 1}}</span> 
 | 
                    </template> 
 | 
                </el-table-column> 
 | 
                <el-table-column 
 | 
                    prop="name" 
 | 
                    align="center" 
 | 
                    label="工种名称"> 
 | 
                </el-table-column> 
 | 
            </el-table> 
 | 
        </div> 
 | 
        <!-- 新建/修改 --> 
 | 
        <OperaInsuranceWindow ref="operaInsuranceWindow" @success="success"/> 
 | 
    </GlobalWindow> 
 | 
</template> 
 | 
  
 | 
<script> 
 | 
    import BaseOpera from '@/components/base/BaseOpera' 
 | 
    import GlobalWindow from '@/components/common/GlobalWindow' 
 | 
    import OperaInsuranceWindow from '@/components/business/OperaInsuranceWindow' 
 | 
    import { all } from '@/api/business/worktype' 
 | 
    export default { 
 | 
        name: 'OperaInsuranceDescWindow', 
 | 
        extends: BaseOpera, 
 | 
        components: { GlobalWindow, OperaInsuranceWindow }, 
 | 
        data () { 
 | 
            return { 
 | 
                // 表单数据 
 | 
                form: { 
 | 
                    id: null, 
 | 
                    name: '', 
 | 
                    status: '' 
 | 
                }, 
 | 
                tableData: [] 
 | 
            } 
 | 
        }, 
 | 
        created () { 
 | 
            this.config({ 
 | 
                api: '/business/insurance', 
 | 
                'field.id': 'id' 
 | 
            }) 
 | 
        }, 
 | 
        methods: { 
 | 
            open (title, target) { 
 | 
                this.title = title 
 | 
                this.visible = true 
 | 
                // 新建 
 | 
                if (target == null) { 
 | 
                    this.$nextTick(() => { 
 | 
                        this.$refs.form.resetFields() 
 | 
                        this.form[this.configData['field.id']] = null 
 | 
                    }) 
 | 
                    return 
 | 
                } 
 | 
                // 编辑 
 | 
                this.$nextTick(() => { 
 | 
                    for (const key in this.form) { 
 | 
                        this.form[key] = target[key] 
 | 
                    } 
 | 
                    all({ insuranceId: this.form.id }) 
 | 
                        .then(res => { 
 | 
                            let arr = [] 
 | 
                            res.forEach(item => { 
 | 
                                arr.push({ name: item.name }) 
 | 
                            }) 
 | 
                            this.tableData = arr 
 | 
                        }) 
 | 
                }) 
 | 
            }, 
 | 
            success() { 
 | 
                this.$emit('success') 
 | 
                this.visible = false 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
</script> 
 | 
<style lang="scss" scoped> 
 | 
    .box { 
 | 
        width: 100%; 
 | 
        .box_name { 
 | 
            display: flex; 
 | 
            align-items: center; 
 | 
            margin-bottom: 10px; 
 | 
            span { 
 | 
                font-size: 16px; 
 | 
                color: black; 
 | 
                margin-right: 30px; 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
</style> 
 |