Commit 9ab03b29 authored by nature2104's avatar nature2104

lov组件修改

parent 0eb9183b
...@@ -184,14 +184,14 @@ export default { ...@@ -184,14 +184,14 @@ export default {
}, },
}, },
methods: { methods: {
selectCall (v1, v2, v3) { selectCall (v1, v2, v3, v4) {
let vm = this let vm = this
if (!vm.multiple) { if (!vm.multiple) {
this.$emit('input', v2[vm.code]) this.$emit('input', v2[vm.code])
this.$emit('onSelect', v1, v2, v3) this.$emit('onSelect', v1, v2, v3, v4)
} else { } else {
this.$emit('input', v1) this.$emit('input', v1)
this.$emit('onSelect', v1, v2) this.$emit('onSelect', v1, v2, v3, v4)
} }
vm.hasError = false vm.hasError = false
}, },
...@@ -208,11 +208,12 @@ export default { ...@@ -208,11 +208,12 @@ export default {
let vm = this let vm = this
if (!vm.disabled) { if (!vm.disabled) {
let list = [] let list = []
vm.dataArray.forEach((date, index, array) => { vm.dataArray.forEach((data, index, array) => {
list.push({ list.push({
value: date[vm.valueKey], ...data,
name: date[vm.valueName], value: data[vm.valueKey],
parent: date.parent, name: data[vm.valueName],
parent: data.parent,
}) })
}) })
VueSelect.show({ VueSelect.show({
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<input v-model="value" type="text" hidden> <input v-model="value" type="text" hidden>
<i v-if="showClean" class="field-icon field-right-icon icon ion-close-circled" @click="cleanValue"/> <i v-if="showClean" class="field-icon field-right-icon icon ion-close-circled" @click="cleanValue"/>
<!--<slot name="icon"/>--> <!--<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> </div>
</div> </div>
...@@ -33,9 +33,10 @@ ...@@ -33,9 +33,10 @@
</template> </template>
<script> <script>
import {isDef} from '../../../packages/common/utils' import { isDef } from '../../../packages/common/utils'
import VueSelect from './index' import VueSelect from './index'
import axios from 'axios' import axios from 'axios'
export default { export default {
name: 'HSelect', name: 'HSelect',
inheritAttrs: false, inheritAttrs: false,
...@@ -264,14 +265,14 @@ export default { ...@@ -264,14 +265,14 @@ export default {
}) })
}, },
selectCall (v1, v2, v3) { selectCall (v1, v2, v3, v4) {
let vm = this let vm = this
if (!vm.multiple) { if (!vm.multiple) {
this.$emit('input', v2[vm.code]) this.$emit('input', v2[vm.code])
this.$emit('onSelect', v1, v2, v3) this.$emit('onSelect', v1, v2, v3, v4)
} else { } else {
this.$emit('input', v1) this.$emit('input', v1)
this.$emit('onSelect', v1, v2) this.$emit('onSelect', v1, v2, v3, v4)
} }
vm.hasError = false vm.hasError = false
}, },
...@@ -290,12 +291,13 @@ export default { ...@@ -290,12 +291,13 @@ export default {
if (!vm.disabled) { if (!vm.disabled) {
let array = (vm.lookUpCode || vm.lovCode) ? vm.arrayList : vm.dataArray let array = (vm.lookUpCode || vm.lovCode) ? vm.arrayList : vm.dataArray
let list = [] let list = []
array.forEach((data, index, array) => { array.map((data, index, array) => {
list.push(Object.assign({ list.push({
...data,
value: data[vm.valueKey], value: data[vm.valueKey],
name: data[vm.valueName], name: data[vm.valueName],
parent: data.parent, parent: data.parent,
}, data)) })
}) })
VueSelect.show({ VueSelect.show({
list: list, list: list,
...@@ -329,11 +331,13 @@ export default { ...@@ -329,11 +331,13 @@ export default {
<style lang="less"> <style lang="less">
@import "../../../packages/common/styles/hField"; @import "../../../packages/common/styles/hField";
.h-select{
.h-select {
background-color: #fff; background-color: #fff;
position: relative; position: relative;
.field-value{
.date-field-icon{ .field-value {
.date-field-icon {
height: 12.5px; height: 12.5px;
} }
} }
......
...@@ -142,6 +142,7 @@ export default { ...@@ -142,6 +142,7 @@ export default {
}, },
contentHeight: '380px', contentHeight: '380px',
multiple: false, multiple: false,
multipleIndex: [],
popupTitle: '', popupTitle: '',
cancelText: '取消', cancelText: '取消',
confirmText: '确定', confirmText: '确定',
...@@ -201,9 +202,10 @@ export default { ...@@ -201,9 +202,10 @@ export default {
let code_name = vm.code + '_n' // eslint-disable-line let code_name = vm.code + '_n' // eslint-disable-line
vm.object[code] = vm.value vm.object[code] = vm.value
vm.object[code_name] = vm.name // eslint-disable-line 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 { } else {
vm.callBack(vm.value, vm.name) vm.callBack(vm.value, vm.name, vm.multipleIndex, vm.list)
} }
} }
this.state = 0 this.state = 0
...@@ -266,6 +268,7 @@ export default { ...@@ -266,6 +268,7 @@ export default {
this.selectedIndex[index] = !this.selectedIndex[index] 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.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.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