Skip to content

Commit

Permalink
修改定义
Browse files Browse the repository at this point in the history
  • Loading branch information
zaaksam committed Aug 23, 2017
1 parent 4cccebb commit 4c24a55
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
3 changes: 3 additions & 0 deletions web/ts/custom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ declare interface BaseModalModel {
isLoading: boolean
isErr: boolean
errMsg: string
isEdit: boolean
title: string
okBtnText: string
}

declare interface BaseListModel {
Expand Down
32 changes: 12 additions & 20 deletions web/vue/portMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
</Row>
<Table stripe border :columns="table.columns" :data="table.list.items">
</Table>
<Modal :title="modalState.title" v-model="modal.isShow" :mask-closable="false" :closable="false">
<Modal :title="modal.title" v-model="modal.isShow" :mask-closable="false" :closable="false">
<Form :label-width="80">
<Form-item label="ID" v-show="modalState.isEdit">
<Form-item label="ID" v-show="modal.isEdit">
<Input v-model="modal.data.id" readonly></Input>
</Form-item>
<Form-item label="标题">
Expand Down Expand Up @@ -43,7 +43,7 @@
<Alert v-show="modal.isErr" type="error" show-icon>{{modal.errMsg}}</Alert>
<div slot="footer">
<Button :disabled="modal.isLoading" @click="onModalCancel">取消</Button>
<Button type="primary" :loading="modal.isLoading" @click="onModalOK">{{modalState.okBtnText}}</Button>
<Button type="primary" :loading="modal.isLoading" @click="onModalOK">{{modal.okBtnText}}</Button>
</div>
</Modal>
</div>
Expand All @@ -58,12 +58,6 @@ import Axios, { AxiosResponse, AxiosError } from 'axios'
import MyPage from './page.vue'
import API from '../ts/api'
interface modalState {
isEdit: boolean
title: string
okBtnText: string
}
interface modalDataModel {
id: number
title: string
Expand Down Expand Up @@ -94,16 +88,14 @@ interface tableModel {
}
})
export default class MyPortMap extends Vue {
modalState: modalState = {
isEdit: false,
title: '',
okBtnText: ''
}
modal: modalModel = {
isShow: false,
isLoading: false,
isErr: false,
errMsg: '',
isEdit: false,
title: '',
okBtnText: '',
data: {
id: 0,
title: '',
Expand Down Expand Up @@ -311,15 +303,15 @@ export default class MyPortMap extends Vue {
this.modal.errMsg = ''
if (data) {
this.modalState.isEdit = true
this.modalState.title = '端口映射修改'
this.modalState.okBtnText = '修改'
this.modal.isEdit = true
this.modal.title = '端口映射修改'
this.modal.okBtnText = '修改'
this.modal.data = _.pick(data, _.keys(this.modal.data))
} else {
this.modalState.isEdit = false
this.modalState.title = '端口映射添加'
this.modalState.okBtnText = '添加'
this.modal.isEdit = false
this.modal.title = '端口映射添加'
this.modal.okBtnText = '添加'
this.modal.data = {
id: 0,
Expand Down

0 comments on commit 4c24a55

Please sign in to comment.