1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
| <template>
| <el-col :md="12" :lg="8">
| <el-form-item :label="config.filedDescription" prop="productname" :rules="rules">
| <el-select
| v-model="svalue"
| :disabled="buildParams.readonly && modify === 'modify'"
| filterable
| remote
| reserve-keyword
| placeholder="请输入关键词"
| :loading="loading"
| >
| <!-- :remote-method="remoteMethod" -->
| <!-- @focus="focus" -->
| <el-option v-for="(item, index) in options" :key="index" :label="item.productname" :value="item.serialNo"> </el-option>
| </el-select>
| </el-form-item>
| </el-col>
| </template>
|
| <script>
| import { queryProjectInfoByPage } from '@/api/area/building'
| import { mapState } from 'vuex'
| export default {
| props: ['config','value','modify'],
| 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, { serialNo: newVal })
| this.$emit('setProjectName', value)
| }
| }
| },
| ...mapState({
| buildParams: state => state.risk.buildParams
| })
| },
| methods: {
| remoteMethod(query) {
| if (query !== '') {
| let params = {
| currentPage: 1,
| pageSize: 50000,
| productname: query
| }
| this.loading = true
| setTimeout(() => {
| queryProjectInfoByPage(params).then(res => {
| if (res.code === '00') {
| this.options = res.result.records
| this.loading = false
| }
| })
| }, 200)
| } else {
| this.options = []
| }
| },
| focus() {
| if (this._.isEmpty(this.options)) {
| let params = {
| currentPage: 1,
| pageSize: 50000,
| productname: ''
| }
| setTimeout(() => {
| queryProjectInfoByPage(params).then(res => {
| if (res.code === '00') {
| this.options = res.result.records
| }
| })
| }, 300)
| }
| },
| initSelect() {
| let params = {
| currentPage: 1,
| pageSize: 50000,
| productname: ''
| }
| queryProjectInfoByPage(params).then(res => {
| if (res.code === '00') {
| this.options = res.result.records
| }
| })
| }
| }
| }
| </script>
|
| <style scoped></style>
|
|