110 lines
2.9 KiB
Plaintext
110 lines
2.9 KiB
Plaintext
<template>
|
|
<base-model :config="model_cfg">
|
|
<template slot="dialog-body">
|
|
<el-form
|
|
ref="LogForm"
|
|
v-loading="loading"
|
|
:model="form"
|
|
:rules="rules"
|
|
label-width="120px"
|
|
size="small"
|
|
>
|
|
<el-form-item label="发布版本" prop="Version">
|
|
<el-input
|
|
v-model="form.Version"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="更新功能" prop="UpdateContent">
|
|
<el-input
|
|
v-model="form.UpdateContent"
|
|
type="textarea"
|
|
maxlength="1000"
|
|
:autosize="{ minRows: 4, maxRows: 5}"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="发布日期" prop="PublishTime">
|
|
<el-date-picker
|
|
v-model="form.PublishTime"
|
|
type="date"
|
|
/>
|
|
</el-form-item>
|
|
</el-form>
|
|
</template>
|
|
<template slot="dialog-footer">
|
|
<el-button size="small" type="primary" @click="handleCancle">取消</el-button>
|
|
<el-button size="small" type="primary" @click="handleSave">保存</el-button>
|
|
</template>
|
|
</base-model>
|
|
</template>
|
|
<script>
|
|
import { addOrUpdatePublishLog } from '@/api/admin'
|
|
import BaseModel from '@/components/BaseModel'
|
|
const formDataDefault = () => {
|
|
return {
|
|
Id: null,
|
|
Version: null,
|
|
PublishTime: null,
|
|
UpdateContent: null
|
|
}
|
|
}
|
|
export default {
|
|
name: 'LogForm',
|
|
components: { BaseModel },
|
|
data() {
|
|
return {
|
|
loading: false,
|
|
form: formDataDefault(),
|
|
rules: {
|
|
Version: [
|
|
{ required: true, message: '请注明', trigger: 'blur' },
|
|
{ max: 50, message: `${this.$t('common:ruleMessage:maxLength')} 50` }
|
|
],
|
|
PublishTime: [
|
|
{ required: true, message: '请注明', trigger: 'blur' }
|
|
],
|
|
UpdateContent: [
|
|
{ required: true, message: '请注明', trigger: 'blur' },
|
|
{ max: 1000, message: `${this.$t('common:ruleMessage:maxLength')} 500` }
|
|
]
|
|
},
|
|
model_cfg: { visible: false, showClose: true, width: '500px', title: '', appendToBody: true }
|
|
}
|
|
},
|
|
mounted() {
|
|
},
|
|
methods: {
|
|
|
|
openDialog(title, data) {
|
|
this.model_cfg.visible = true
|
|
this.model_cfg.title = title
|
|
if (Object.keys(data).length > 0) {
|
|
for (const k in this.form) {
|
|
if (data.hasOwnProperty(k)) {
|
|
this.form[k] = data[k]
|
|
}
|
|
}
|
|
} else {
|
|
this.form = formDataDefault()
|
|
}
|
|
},
|
|
handleSave() {
|
|
this.$refs.LogForm.validate(valid => {
|
|
if (!valid) return
|
|
this.loading = true
|
|
addOrUpdatePublishLog(this.form).then(res => {
|
|
this.loading = false
|
|
this.$message.success(this.$t('common:message:savedSuccessfully'))
|
|
this.model_cfg.visible = false
|
|
this.$emit('getList')
|
|
}).catch(() => {
|
|
this.loading = false
|
|
})
|
|
})
|
|
},
|
|
handleCancle() {
|
|
this.model_cfg.visible = false
|
|
}
|
|
}
|
|
}
|
|
</script>
|