'工作单位合并'

This commit is contained in:
proudlx
2021-04-30 10:20:00 +08:00
committed by li.jieyu@ebiz-digits.com
parent 088661fd5f
commit a3fd86cfd8
2 changed files with 63 additions and 17 deletions

View File

@@ -3,7 +3,7 @@
<van-field :label="label" required> <van-field :label="label" required>
<template #input> <template #input>
<input <input
style="width: 100%; border: none;" style="width: 100%; border: none"
type="text" type="text"
:placeholder="placeholder" :placeholder="placeholder"
:value="searchContent" :value="searchContent"
@@ -16,9 +16,7 @@
<div class="border_item" v-for="(item, index) in computedCustomerList" :value="item.label" :key="index" @click="chooseCustomer(item)"> <div class="border_item" v-for="(item, index) in computedCustomerList" :value="item.label" :key="index" @click="chooseCustomer(item)">
{{ item.label }} {{ item.label }}
</div> </div>
<div class="border_item" v-show="computedCustomerList == 0"> <div class="border_item" v-show="computedCustomerList == 0">无结果</div>
无结果
</div>
</div> </div>
</transition> </transition>
</template> </template>
@@ -41,6 +39,10 @@ export default {
}, },
value: { value: {
type: String type: String
},
isAsync: {
type: Boolean,
default: false
} }
}, },
components: { components: {
@@ -55,7 +57,7 @@ export default {
computed: { computed: {
computedCustomerList() { computedCustomerList() {
let searchStr = this.value.trim() let searchStr = this.value.trim()
return this.customerList.filter(item => { return this.customerList.filter((item) => {
return item.label.includes(searchStr) return item.label.includes(searchStr)
}) })
}, },
@@ -68,6 +70,7 @@ export default {
const result = await getTreasureMenus(param) const result = await getTreasureMenus(param)
if (result.result === '0') { if (result.result === '0') {
this.customerList = result.content this.customerList = result.content
this.$emit('workcompanys', result.content)
} else { } else {
this.$toast(result.resultMessage) this.$toast(result.resultMessage)
} }
@@ -81,16 +84,18 @@ export default {
this.$emit('input', this.value) this.$emit('input', this.value)
}, },
onInputFocus() { onInputFocus() {
this.showCustomer = true if (this.isAsync) {
setTimeout(() => { this.showCustomer = true
this.$refs.picker.scrollIntoView() setTimeout(() => {
}, 300) this.$refs.picker.scrollIntoView()
this.$nextTick(() => { }, 300)
this.$refs.picker.scrollTo({ this.$nextTick(() => {
top: 0, this.$refs.picker.scrollTo({
behavior: 'smooth' top: 0,
behavior: 'smooth'
})
}) })
}) }
}, },
chooseCustomer(item) { chooseCustomer(item) {
this.$emit('input', item.label) this.$emit('input', item.label)

View File

@@ -308,7 +308,16 @@
clearable clearable
:readonly="isAppnt" :readonly="isAppnt"
/> --> /> -->
<SearchField v-model="userInfo.workcompany" label="工作单位" placeholder="无工作单位,请输入无" v-validate="'required'" name="工作单位" /> <select-radio v-if="userInfo.relationToAppnt != 1" required :radios="Asyncs" label="是否协同工作单位" name="是否协同工作单位" v-validate="'required'" :value.sync="isAsync"></select-radio>
<SearchField
v-model="userInfo.workcompany"
@workcompanys="workcompanys"
:isAsync="isAsync"
label="工作单位"
placeholder="无工作单位,请输入无"
v-validate="'required'"
name="工作单位"
/>
<!-- <van-field <!-- <van-field
v-model="areaName" v-model="areaName"
readonly readonly
@@ -484,6 +493,17 @@ export default {
}, },
isScan: false, //是否显示证件扫描组件 isScan: false, //是否显示证件扫描组件
effectiveDateTypeAble: false, //长期按钮是否禁用 effectiveDateTypeAble: false, //长期按钮是否禁用
isAsync: false,
Asyncs: [
{
label: '是',
value: true,
},
{
label: '否',
value: false,
},
],
sexRadio: [ sexRadio: [
{ {
label: '男', label: '男',
@@ -584,7 +604,8 @@ export default {
isAppnt: false, // 是否投被同人 isAppnt: false, // 是否投被同人
// appntMarriage: '', //投保人婚姻状况 // appntMarriage: '', //投保人婚姻状况
idLimit: false, //证件起止日期是否只读 idLimit: false, //证件起止日期是否只读
salePageFlag: '2' salePageFlag: '2',
userWorkcompanys:[],//单位数据
} }
}, },
created() { created() {
@@ -722,6 +743,11 @@ export default {
// // document.body.style.backgroundColor = '#F5F5F5' // // document.body.style.backgroundColor = '#F5F5F5'
}, },
methods: { methods: {
workcompanys(list) {
// 单位数据
console.log(list)
this.userWorkcompanys = list
},
setCustomerMarriage(marriageCode) { setCustomerMarriage(marriageCode) {
for (let status of DataDictionary.marriage) { for (let status of DataDictionary.marriage) {
if (status.id == marriageCode) { if (status.id == marriageCode) {
@@ -1472,7 +1498,22 @@ export default {
return this.$toast('亲,国籍为外籍,证件类型必须为护照或外国人永久居留身份证投保') return this.$toast('亲,国籍为外籍,证件类型必须为护照或外国人永久居留身份证投保')
} }
} }
if (this.isAsync) {
if (
!this.userWorkcompanys.some((item) => {
return item.label == this.userInfo.workcompany
})
) {
if (
this.userWorkcompanys.some((item) => {
return item.label.search(this.userInfo.workcompany) != -1
})
) {
return this.$toast('请填写完整的协同单位名称')
}
return this.$toast('您选择的为非协同单位,请重新选择。')
}
}
this.infoUpdate() this.infoUpdate()
} else { } else {
return this.$toast(this.$validator.errors.all()[0]) return this.$toast(this.$validator.errors.all()[0])