<!--
|
* @Author: your name
|
* @Date: 2019-10-21 15:40:58
|
* @LastEditTime : 2019-12-26 16:08:41
|
* @LastEditors : PengJianTian
|
* @Description: In User Settings Edit
|
* @FilePath: /e:\Demo\cts-web\src\views\area\building\update\components\BuildName.vue
|
-->
|
<template>
|
<el-col :md="12" :lg="8">
|
<!-- <el-form-item label="楼栋名称" prop="productname" :rules="rules" v-if="Number(shproduct)===0 && Number(ispairkingfloor)===0"> -->
|
<el-form-item label="楼栋名称" prop="productname" :rules="rules" v-if="Number(shproduct)===0">
|
<el-select
|
v-model="svalue"
|
filterable
|
remote
|
clearable
|
reserve-keyword
|
placeholder="请输入关键词"
|
:loading="loading"
|
>
|
<!-- :remote-method="remoteMethod" -->
|
<el-option v-for="(item, index) in options" :key="index" :label="item.buildname" :value="item.buildid" :disabled="item.isCheck === '已准入'"></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="楼栋名称" prop="productname" :rules="rules" v-if="Number(shproduct)===1">
|
<el-input v-model="ivalue"></el-input>
|
</el-form-item>
|
</el-col>
|
</template>
|
|
<script>
|
import { queryBuildDataInfoByPage } from '@/api/area/building'
|
export default {
|
props: ['value', 'shproduct', 'projectId', 'ispairkingfloor'],
|
data: function() {
|
return {
|
options: [],
|
loading: false,
|
rules: { required: true, message: '请输入楼栋名称', trigger: 'blur' }
|
}
|
},
|
created() {
|
this.initSelect()
|
},
|
computed: {
|
svalue: {
|
get() {
|
return this.value
|
},
|
set(newVal) {
|
if (!this._.isEmpty(newVal)) {
|
let value = this._.find(this.options, { buildid: newVal })
|
this.$emit('setBuildName', value)
|
}
|
}
|
},
|
ivalue: {
|
get() {
|
return this.value
|
},
|
set(newVal) {
|
this.$emit('input', newVal)
|
}
|
}
|
},
|
watch: {
|
'projectId': {
|
immediate: true,
|
handler(newVal) {
|
if (!this._.isEmpty(newVal) && !this._.isEmpty(this.projectId)) {
|
let params = {
|
currentPage: 1,
|
pageSize: 5000,
|
projectid: this.projectId,
|
cname: ''
|
}
|
queryBuildDataInfoByPage(params).then(res => {
|
if (res.code === '00') {
|
this.options = res.result.records
|
}
|
})
|
}
|
}
|
}
|
},
|
methods: {
|
initSelect() {
|
let params = {
|
currentPage: 1,
|
pageSize: 5000,
|
// projectid: this.projectId,
|
productname: ''
|
}
|
queryBuildDataInfoByPage(params).then(res => {
|
if (res.code === '00') {
|
this.options = res.result.records
|
}
|
})
|
},
|
// remoteMethod(query) {
|
// if (query !== '') {
|
// let params = {
|
// currentPage: 1,
|
// pageSize: 500,
|
// projectid: this.projectId,
|
// cname: query
|
// }
|
// this.loading = true
|
// setTimeout(() => {
|
// queryBuildDataInfoByPage(params).then(res => {
|
// if (res.code === '00') {
|
// this.options = res.result.records
|
// this.loading = false
|
// }
|
// })
|
// }, 200)
|
// } else {
|
// this.options = []
|
// }
|
// }
|
}
|
}
|
</script>
|
|
<style scoped></style>
|