feat(xumu): 优化耳标号选择功能
- 在 AppInsuranceApply 和 AppLoanApply 组件中添加 value-key 属性 - 在 AiEartagPicker 组件中增加对 valueKey 属性的支持- 优化 AiEartagPicker 组件的样式和布局
This commit is contained in:
@@ -125,7 +125,7 @@ export default {
|
|||||||
</ai-card>
|
</ai-card>
|
||||||
<ai-card title="投保对象">
|
<ai-card title="投保对象">
|
||||||
<template #right v-if="isAdd||isEdit">
|
<template #right v-if="isAdd||isEdit">
|
||||||
<ai-eartag-picker @select="v=>detail.detailList=v" :instance="instance"
|
<ai-eartag-picker @select="v=>detail.detailList=v" :instance="instance" value-key="biochipEarNumber"
|
||||||
:action="`/api/insurance/apply/getEarNumberList?farmId=${detail.farmId}`">
|
:action="`/api/insurance/apply/getEarNumberList?farmId=${detail.farmId}`">
|
||||||
<el-button type="text">选择</el-button>
|
<el-button type="text">选择</el-button>
|
||||||
</ai-eartag-picker>
|
</ai-eartag-picker>
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ export default {
|
|||||||
<ai-card title="质押标的">
|
<ai-card title="质押标的">
|
||||||
<template #right>
|
<template #right>
|
||||||
<ai-input placeholder="请输入/扫描耳标号" v-model="filterText" class="shrink"/>
|
<ai-input placeholder="请输入/扫描耳标号" v-model="filterText" class="shrink"/>
|
||||||
<ai-eartag-picker @select="v=>detail.detailList=v" :instance="instance" v-if="isAdd||isEdit"
|
<ai-eartag-picker @select="v=>detail.detailList=v" :instance="instance" v-if="isAdd||isEdit" value-key="biochipEarNumber"
|
||||||
:action="`/api/insurance/apply/getEarNumberList?farmId=${detail.farmId}`">
|
:action="`/api/insurance/apply/getEarNumberList?farmId=${detail.farmId}`">
|
||||||
<el-button type="text">选择</el-button>
|
<el-button type="text">选择</el-button>
|
||||||
</ai-eartag-picker>
|
</ai-eartag-picker>
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ export default {
|
|||||||
name: "AiEartagPicker",
|
name: "AiEartagPicker",
|
||||||
props: {
|
props: {
|
||||||
instance: Function,
|
instance: Function,
|
||||||
value: { default: () => [] },
|
value: {default: () => []},
|
||||||
action: { default: "/api/breed/earTag/getEarTagByPenId" },
|
action: {default: "/api/breed/earTag/getEarTagByPenId"},
|
||||||
penId: String
|
penId: String,
|
||||||
|
valueKey: String
|
||||||
},
|
},
|
||||||
model: {
|
model: {
|
||||||
prop: "value",
|
prop: "value",
|
||||||
@@ -39,7 +40,14 @@ export default {
|
|||||||
getEartag() {
|
getEartag() {
|
||||||
!/undefined/.test(this.api) && this.instance.post(this.api).then(res => {
|
!/undefined/.test(this.api) && this.instance.post(this.api).then(res => {
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
this.list = res.data?.map(v => ({ key: v, label: v })) || []
|
const key = this.valueKey
|
||||||
|
this.list = res.data?.map(v => {
|
||||||
|
if (typeof v == 'string') {
|
||||||
|
return {key: v, label: v}
|
||||||
|
} else if (key) {
|
||||||
|
return {key: v[key], label: v[key]}
|
||||||
|
}
|
||||||
|
}) || []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -55,15 +63,15 @@ export default {
|
|||||||
<template>
|
<template>
|
||||||
<section class="AiEartagPicker">
|
<section class="AiEartagPicker">
|
||||||
<div style="width: auto;" v-if="$slots.default" @click="dialog = true">
|
<div style="width: auto;" v-if="$slots.default" @click="dialog = true">
|
||||||
<slot />
|
<slot/>
|
||||||
</div>
|
</div>
|
||||||
<el-select v-else :value="value" clearable multiple placeholder="请选择">
|
<el-select v-else :value="value" clearable multiple placeholder="请选择">
|
||||||
<el-option v-for="op in list" :key="op.id" :label="op.earTag" :value="op.id" />
|
<el-option v-for="(op,i) in list" :key="i" :label="op.label" :value="op.key"/>
|
||||||
<div slot="prefix" @click.stop="dialog = true" />
|
<div slot="prefix" @click.stop="dialog = true"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
<ai-dialog v-model="dialog" title="选择牲畜" width="640px" @confirm="handleConfirm" @closed="selected = []"
|
<ai-dialog v-model="dialog" title="选择牲畜" width="800px" @confirm="handleConfirm" @closed="selected = []"
|
||||||
@open="selected = value">
|
@open="selected = value">
|
||||||
<el-transfer :data="list" v-model="selected" :titles="['可选', '已选择']" />
|
<el-transfer :data="list" v-model="selected" :titles="['可选', '已选择']"/>
|
||||||
</ai-dialog>
|
</ai-dialog>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
@@ -85,10 +93,21 @@ export default {
|
|||||||
right: 0;
|
right: 0;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
|
|
||||||
&>div {
|
& > div {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.el-transfer) {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.el-transfer-panel {
|
||||||
|
width: auto;
|
||||||
|
min-width: 200px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user