Commit 9ab03b29 authored by nature2104's avatar nature2104

lov组件修改

parent 0eb9183b
......@@ -184,14 +184,14 @@ export default {
},
},
methods: {
selectCall (v1, v2, v3) {
selectCall (v1, v2, v3, v4) {
let vm = this
if (!vm.multiple) {
this.$emit('input', v2[vm.code])
this.$emit('onSelect', v1, v2, v3)
this.$emit('onSelect', v1, v2, v3, v4)
} else {
this.$emit('input', v1)
this.$emit('onSelect', v1, v2)
this.$emit('onSelect', v1, v2, v3, v4)
}
vm.hasError = false
},
......@@ -208,11 +208,12 @@ export default {
let vm = this
if (!vm.disabled) {
let list = []
vm.dataArray.forEach((date, index, array) => {
vm.dataArray.forEach((data, index, array) => {
list.push({
value: date[vm.valueKey],
name: date[vm.valueName],
parent: date.parent,
...data,
value: data[vm.valueKey],
name: data[vm.valueName],
parent: data.parent,
})
})
VueSelect.show({
......
......@@ -25,7 +25,7 @@
<input v-model="value" type="text" hidden>
<i v-if="showClean" class="field-icon field-right-icon icon ion-close-circled" @click="cleanValue"/>
<!--<slot name="icon"/>-->
<img v-if="!showClean" :src="rightIcon" class="field-right-icon date-field-icon" >
<img v-if="!showClean" :src="rightIcon" class="field-right-icon date-field-icon">
</div>
</div>
</div>
......@@ -33,9 +33,10 @@
</template>
<script>
import {isDef} from '../../../packages/common/utils'
import { isDef } from '../../../packages/common/utils'
import VueSelect from './index'
import axios from 'axios'
export default {
name: 'HSelect',
inheritAttrs: false,
......@@ -264,14 +265,14 @@ export default {
})
},
selectCall (v1, v2, v3) {
selectCall (v1, v2, v3, v4) {
let vm = this
if (!vm.multiple) {
this.$emit('input', v2[vm.code])
this.$emit('onSelect', v1, v2, v3)
this.$emit('onSelect', v1, v2, v3, v4)
} else {
this.$emit('input', v1)
this.$emit('onSelect', v1, v2)
this.$emit('onSelect', v1, v2, v3, v4)
}
vm.hasError = false
},
......@@ -290,12 +291,13 @@ export default {
if (!vm.disabled) {
let array = (vm.lookUpCode || vm.lovCode) ? vm.arrayList : vm.dataArray
let list = []
array.forEach((data, index, array) => {
list.push(Object.assign({
array.map((data, index, array) => {
list.push({
...data,
value: data[vm.valueKey],
name: data[vm.valueName],
parent: data.parent,
}, data))
})
})
VueSelect.show({
list: list,
......@@ -313,8 +315,8 @@ export default {
if (required && error) {
this.hasError = !isDef(fieldInput.value)
/* if (isString(error)) {
this.placehold = error
} */
this.placehold = error
} */
}
},
......@@ -329,11 +331,13 @@ export default {
<style lang="less">
@import "../../../packages/common/styles/hField";
.h-select{
.h-select {
background-color: #fff;
position: relative;
.field-value{
.date-field-icon{
.field-value {
.date-field-icon {
height: 12.5px;
}
}
......
......@@ -142,6 +142,7 @@ export default {
},
contentHeight: '380px',
multiple: false,
multipleIndex: [],
popupTitle: '',
cancelText: '取消',
confirmText: '确定',
......@@ -201,9 +202,10 @@ export default {
let code_name = vm.code + '_n' // eslint-disable-line
vm.object[code] = vm.value
vm.object[code_name] = vm.name // eslint-disable-line
vm.callBack(vm.index, vm.object, vm.childs)
let obj = Object.assign(vm.object, vm.list[vm.index])
vm.callBack(vm.index, obj, vm.childs, vm.list)
} else {
vm.callBack(vm.value, vm.name)
vm.callBack(vm.value, vm.name, vm.multipleIndex, vm.list)
}
}
this.state = 0
......@@ -266,6 +268,7 @@ export default {
this.selectedIndex[index] = !this.selectedIndex[index]
this.value.includes(item.value) ? this.value = this.value.filter(n => n !== item.value) : this.value.push(item.value)
this.name.includes(item.name) ? this.name = this.name.filter(n => n !== item.name) : this.name.push(item.name)
this.multipleIndex.includes(index) ? this.multipleIndex = this.multipleIndex.filter(n => n !== index) : this.multipleIndex.push(index)
},
},
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment