k94314517
2024-04-09 02bc3bfe47e3d5311a0bb041c94e70a34b1ca73c
company/src/components/business/OperaInsuranceDescWindow.vue
@@ -4,12 +4,12 @@
        submitText="修改"
        :visible.sync="visible"
        :confirm-working="isWorking"
        @confirm="$refs.operaInsuranceWindow.open('编辑保险公司')"
        @confirm="$refs.operaInsuranceWindow.open('编辑保险公司', form)"
    >
        <div class="box">
            <div class="box_name">
                <span>保险公司:平安保险</span>
                <span>是否启用:是</span>
                <span>保险公司:{{form.name}}</span>
                <span>是否启用:{{form.status == 0 ? '启用' : '禁用'}}</span>
            </div>
            <el-table
                :data="tableData"
@@ -30,7 +30,7 @@
            </el-table>
        </div>
        <!-- 新建/修改 -->
        <OperaInsuranceWindow ref="operaInsuranceWindow" @success="handlePageChange"/>
        <OperaInsuranceWindow ref="operaInsuranceWindow" @success="success"/>
    </GlobalWindow>
</template>
@@ -38,6 +38,7 @@
    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,
@@ -47,10 +48,8 @@
                // 表单数据
                form: {
                    id: null,
                    name: ''
                },
                // 验证规则
                rules: {
                    name: '',
                    status: ''
                },
                tableData: []
            }
@@ -60,6 +59,38 @@
                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>