-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
2,913 additions
and
2,931 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Component, Vue } from "vue-property-decorator"; | ||
import FormMixin from "view-ui-admin/src/mixins/form"; | ||
|
||
const module = "ads"; | ||
|
||
@Component({ | ||
mixins: [FormMixin] | ||
}) | ||
export default class ListForm extends Vue { | ||
data() { | ||
return { | ||
cForm: { | ||
id: 0, | ||
modal: false, | ||
loading: true, | ||
model: this.getFormInitModel(), | ||
rules: { | ||
title: [ | ||
{ | ||
required: true, | ||
message: "标题不能为空" | ||
} | ||
], | ||
pictureId: [ | ||
{ | ||
required: true, | ||
message: "图片不能为空" | ||
} | ||
] | ||
} | ||
} | ||
}; | ||
} | ||
|
||
getFormInitModel() { | ||
return { | ||
status: 1 | ||
}; | ||
} | ||
|
||
show(detail) { | ||
this.cForm.modal = true; | ||
|
||
if (detail && detail.id) { | ||
this.cForm.id = detail.id; | ||
this.initFormFields(detail); | ||
} else { | ||
this.cForm.id = 0; | ||
} | ||
} | ||
|
||
submit() { | ||
this.$refs.form.validate(async valid => { | ||
if (valid) { | ||
const { id, model } = this.cForm; | ||
const { data } = await this.$store.dispatch( | ||
`${module}/${id ? "put" : "post"}`, | ||
{ | ||
id, | ||
body: model | ||
} | ||
); | ||
|
||
this.cForm.modal = false; | ||
this.$Message.success(`${id ? "编辑" : "新增"}成功`); | ||
this.$emit("get-list", data); | ||
} | ||
|
||
this.fixFormButtonLoading(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.