93 lines
2.6 KiB
Vue
93 lines
2.6 KiB
Vue
<template>
|
|
<ai-detail class="content-add">
|
|
<template slot="title">
|
|
<ai-title :title="params.id ? '编辑卡口' : '添加卡口'" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
|
|
</ai-title>
|
|
</template>
|
|
<template slot="content">
|
|
<ai-card title="基本信息">
|
|
<template #content>
|
|
<el-form class="ai-form" :model="form" label-width="120px" ref="form">
|
|
<el-form-item prop="name" style="width: 100%;" label="卡口名称" :rules="[{required: true, message: '请输入卡口名称', trigger: 'blur'}]">
|
|
<el-input size="small" :maxlength="40" show-word-limit v-model="form.name" placeholder="请输入卡口名称"></el-input>
|
|
</el-form-item>
|
|
<el-form-item prop="remark" style="width: 100%;" label="备注" :rules="[{required: true, message: '请输入备注', trigger: 'blur'}]">
|
|
<el-input size="small" type="textarea" :rows="5" placeholder="请输入备注" v-model="form.remark"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
</template>
|
|
</ai-card>
|
|
</template>
|
|
<template #footer>
|
|
<el-button @click="cancel">取消</el-button>
|
|
<el-button type="primary" @click="confirm">提交</el-button>
|
|
</template>
|
|
</ai-detail>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'Add',
|
|
|
|
props: {
|
|
instance: Function,
|
|
dict: Object,
|
|
params: Object
|
|
},
|
|
data () {
|
|
return {
|
|
info: {},
|
|
form: {
|
|
name: '',
|
|
remark: ''
|
|
},
|
|
id: ''
|
|
}
|
|
},
|
|
|
|
created () {
|
|
if (this.params && this.params.id) {
|
|
this.id = this.params.id
|
|
this.getInfo(this.params.id)
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
getInfo (id) {
|
|
this.instance.post(`/app/appepidemicpreventiongateway/queryDetailById?id=${id}`).then(res => {
|
|
if (res.code === 0) {
|
|
this.form = res.data
|
|
}
|
|
})
|
|
},
|
|
|
|
confirm () {
|
|
this.$refs.form.validate((valid) => {
|
|
if (valid) {
|
|
this.instance.post(`/app/appepidemicpreventiongateway/addOrUpdate`, {
|
|
...this.form
|
|
}).then(res => {
|
|
if (res.code == 0) {
|
|
this.$message.success('提交成功')
|
|
setTimeout(() => {
|
|
this.cancel(true)
|
|
}, 600)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
|
|
cancel (isRefresh) {
|
|
this.$emit('change', {
|
|
type: 'list',
|
|
isRefresh: !!isRefresh
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
</style>
|