tft-fe/src/views/basicConfig/components/reportNameEdit.vue
2023-02-08 17:23:01 +08:00

83 lines
2.2 KiB
Vue

<template>
<el-form ref="form" :rules="rules" label-width="100px" :model="form">
<el-form-item label="报表名称" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="报表分类" prop="type">
<el-select v-model="form.type" placeholder="报表分类" style="width: 100%">
<el-option
v-for="(item, i) in typeList"
:key="i"
:label="item.dataName"
:value="item.dataName"
></el-option>
</el-select>
</el-form-item>
</el-form>
</template>
<script>
export default {
name: 'ReportNameEdit',
data() {
return {
form: {
id: '',
name: ''
},
typeList: [
{ dataName: '能源', id: 1 },
{ dataName: '订单', id: 2 },
{ dataName: '设备', id: 3 },
{ dataName: '人员', id: 4 }
],
rules: {
name: [
{ required: true, message: '请输入报表分类名', trigger: 'blur' }
],
type: [{ required: true, message: '请选择分类', trigger: 'change' }]
}
}
},
methods: {
init(id) {
if (id) {
this.form.id = id
// getAccount({ id }).then((res) => {
// if (res.code === 0) {
// this.form.account = res.data.account
// this.form.password = res.data.password
// this.form.name = res.data.name
// this.form.proLineId = res.data.proLineId
// this.form.role = res.data.role
// this.form.enabled = res.data.enabled
// }
// })
}
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
//编辑
// accountUpdate({ ...this.form }).then((res) => {
// if (res.code === 0) {
// this.$message({
// message: '操作成功',
// type: 'success',
// duration: 1500
// })
// this.$emit('successSubmit')
// }
// })
this.$emit('successSubmit')
} else {
return false
}
})
},
formClear() {
this.$refs.form.resetFields()
}
}
}
</script>