|  |  |  | 
|---|
|  |  |  | 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" | 
|---|
|  |  |  | 
|---|
|  |  |  | </el-table> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!-- 新建/修改 --> | 
|---|
|  |  |  | <OperaInsuranceWindow ref="operaInsuranceWindow" @success="handlePageChange"/> | 
|---|
|  |  |  | <OperaInsuranceWindow ref="operaInsuranceWindow" @success="success"/> | 
|---|
|  |  |  | </GlobalWindow> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | 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, | 
|---|
|  |  |  | 
|---|
|  |  |  | // 表单数据 | 
|---|
|  |  |  | form: { | 
|---|
|  |  |  | id: null, | 
|---|
|  |  |  | name: '' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 验证规则 | 
|---|
|  |  |  | rules: { | 
|---|
|  |  |  | name: '', | 
|---|
|  |  |  | status: '' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | tableData: [] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | 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> | 
|---|