Commit d5734aff authored by jingnan's avatar jingnan 👀

通用试验记录添加指令搜索条件配置

parent 4b10b2f3
export default {
props: {},
layoutConfigData: [
{
title: '高级组件配置',
data: [
{
key: 'inheritAttr',
title: '继承属性',
component: {
defaultValue: 'sorties',
name: 'el-input'
}
}
]
}
],
data() {
return {
}
},
created() {
},
computed: {
},
methods: {
}
}
/**
* @Description: 通用试验申请添加指令
*/
<template>
<div class="inherit-select">
<el-select v-model="selVal" placeholder="请选择" size="mini" :disabled="disabledVal" @change="changeVal">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</template>
<script>
import config from './config'
import _get from 'lodash.get'
export default {
componentName: '继承外部数据下拉框',
name: 'InheritSelect', // name写在组件的最前方,自定义组件为必填
components: {},
mixins: [config],
props: {
itemObj: {
type: Object,
default: null
},
form: {
type: Object,
default: () => {}
},
middleForm: {
type: Object,
default: () => {}
},
value: {
type: [Number, String, Object],
default: () => ''
},
basicData: {
type: Object,
default: () => {}
}
},
data() {
return {
options: [],
selVal: '',
disabledVal: false,
inheritValue: ''
}
},
computed: {},
watch: {
basicData: {
immediate: true,
deep: true,
handler(val) {
if (val) {
if (!this.itemObj.inheritAttr) {
return
}
const _val = _get(val, this.itemObj.inheritAttr)
if (_val !== this.inheritValue) {
this.inheritValue = _val
if (this.inheritValue && this.inheritValue.length) {
const data = this.inheritValue.split(',')
this.options = data.map(item => {
return {
value: item,
label: item
}
})
} else {
this.options = []
}
}
}
}
},
value: {
immediate: true,
deep: true,
handler(v) {
if (v) {
this.selVal = this.value
}
}
}
},
created() {
// 初始化数据
},
methods: {
changeVal() {
this.$emit('input', this.selVal)
}
}
}
</script>
<style lang='scss'>
</style>
...@@ -94,7 +94,7 @@ export default { ...@@ -94,7 +94,7 @@ export default {
if (res && res.items && res.items.content && res.items.content[0].extPosition) { if (res && res.items && res.items.content && res.items.content[0].extPosition) {
this.options = res.items.content[0].extPosition.map(v => ({ this.options = res.items.content[0].extPosition.map(v => ({
key: v.id, key: v.id,
label: v.name, label: `${v.serialNumber}-${v.name}`,
value: v.serialNumber value: v.serialNumber
})) }))
} }
......
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