qa-regulatory-gwj-vue/src/views/system/noticetemplate/components/indexAdd.vue

163 lines
4.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div>
<el-form ref="form" :rules="rules" :model="form" label-position="right" label-width="160px" style="padding:10px 40px">
<el-row>
<el-col :span="12">
<el-form-item label="名称" prop="NAME">
<el-input v-model="form.NAME" type="text" placeholder="这里输入名称"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="编码" prop="BIANMA">
<el-input v-model="form.BIANMA" placeholder="这里输入编码"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述" prop="REPRESENT">
<el-input v-model="form.REPRESENT" type="text" placeholder="描述信息"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="内容" prop="CONTENT">
<el-input v-model="form.CONTENT" type="text" placeholder="这里输入内容"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="heightt"/>
<div class="subdy-foot">
<el-row style="text-align: center">
<el-button @click="goBack">取 消</el-button>
<el-button type="primary" @click="confirm"> </el-button>
</el-row>
</div>
</div>
</template>
<script>
import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包
import { requestFN } from '@/utils/request'
// import { upload } from '@/utils/upload'
import waves from '@/directive/waves' // waves directive
import SelectTree from '@/components/SelectTree'
export default {
components: { Pagination, SelectTree },
directives: { waves },
data() {
return {
config: config,
dialogVisible: false,
dialogImageUrl: '',
certificate_files: [],
hImgs: [],
form: {
NAME: '',
BIANMA: '',
REPRESENT: '',
CONTENT: ''
},
rules: {
NAME: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
BIANMA: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
CONTENT: [{ required: true, message: '内容不能为空', trigger: 'blur' }]
},
loadingMap: true,
BMap: '',
map: '',
showMap: false,
addressKeyword: '',
pointLngLat: '',
zoom: 16,
location: '',
lng: '',
lat: '',
dialogFormEdit: false,
qyztList: [],
industryList: [],
economicsList: [],
scaleList: [],
areaprops: {
lazy: true,
lazyLoad(node, resolve) {
setTimeout(() => {
const areaLeven = node.level
var areaParID = ''
if (areaLeven == '0') {
areaParID = 'e725d2a91b8248f4b8f49889038df7de'
} else {
areaParID = node.data.id
}
requestFN(
'dictionaries/getLevels',
{ DICTIONARIES_ID: areaParID }
).then((data) => {
const nodes = data.list.map(item => ({
value: item.BIANMA,
label: item.NAME.toString(),
id: item.DICTIONARIES_ID.toString(),
leaf: areaLeven > 1
}))
resolve(nodes) // 通过调用resolve将子节点数据返回通知组件数据加载完成
}).catch((e) => {})
}, 500)
}
}
}
},
created() {
this.$parent.indexVal && this.getData()
},
methods: {
// 保存
confirm() {
this.$refs.form.validate(valid => {
if (valid) {
requestFN(
this.$parent.indexVal ? '/noticetemplate/edit' : '/noticetemplate/add',
{
...this.form
}
).then((data) => {
this.$message.success('新建成功')
this.goBack()
}).catch((e) => { })
} else {
return false
}
})
},
getData() {
requestFN(
'/noticetemplate/goEdit',
{
NOTICETEMPLATE_ID: this.$parent.indexVal
}
).then((data) => {
this.form = data.pd
}).catch((e) => { })
},
// 返回
goBack() {
this.$parent.activeName = 'IndexList'
},
setPoint() {
this.form.LATITUDE = this.lat
this.form.LONGITUDE = this.lng
this.dialogFormEdit = false
this.form.jinweidu = this.lat + '-' + this.lng
}
}
}
</script>
<style scoped>
.el-divider__text{
color: #2a90d2;
font-size: 15px;
}
.el-radio-group{
margin-left: 20px;
}
</style>