This commit is contained in:
aihe 2024-05-19 13:56:23 +08:00
parent c4f93bca30
commit 8a889597ea
8 changed files with 98 additions and 37 deletions

View File

@ -127,8 +127,8 @@ const setAddresModalParam = (data = {})=> {
// - 转换list的key val // - 转换list的key val
const transListKeyTitle = ({ valKey = '', titleKey = '', list = [] })=> { const transListKeyTitle = ({ valKey = '', titleKey = '', list = [] })=> {
list.map(t=> { list.map(t=> {
t.title = t[titleKey] t.title = t[titleKey] || t.title
t.val = t[valKey] t.val = t[valKey] || t.val
}) })
return list return list
} }

View File

@ -36,6 +36,11 @@
return [] return []
} }
}, },
checkedList: {
default () {
return []
}
},
value: { value: {
default () { default () {
return [] return []
@ -93,13 +98,18 @@
this.$emit('onItemClick', { curItem, index, checked: checkedVal.indexOf(curItem.val)>-1 }) this.$emit('onItemClick', { curItem, index, checked: checkedVal.indexOf(curItem.val)>-1 })
}, },
changeTabCheck(checkedVal) { changeTabCheck(checkedVal) {
let oldVal = checkedVal let value = checkedVal
let val = oldVal let allList = this.list.concat(this.checkedList)
let checkedList = []
checkedVal.map(val=> {
let item = allList.filter(t=> t.val == val)[0]
checkedList.push(item)
})
if (this.type == typeEnum.single) { if (this.type == typeEnum.single) {
val = checkedVal[0] value = checkedVal[0]
} }
this.$emit('onChange', val) this.$emit('onChange', value, checkedList)
this.$emit('update:value', val) this.$emit('update:value', value)
} }
} }
} }

View File

@ -3,7 +3,7 @@
<view class=""> <view class="">
<view class=""> <view class="">
<tpx-checkitems :list="list" :value="value" v-slot="dlCurrent" :min-checked="minChecked" :type="type" <tpx-checkitems :list="list" :value="value" v-slot="dlCurrent" :min-checked="minChecked" :type="type"
@onChange="handleDataItemChange" :checkedList="checkedList" @onChange="handleDataItemChange"
> >
<view slot :class="`slt-item ${dlCurrent.checked?'active':''}`"> <view slot :class="`slt-item ${dlCurrent.checked?'active':''}`">
<u-row justify="between"> <u-row justify="between">
@ -50,6 +50,11 @@
return '' return ''
} }
}, },
checkedList: {
default () {
return []
}
},
list: { list: {
default () { default () {
return [] return []
@ -69,9 +74,10 @@
unmounted() {}, unmounted() {},
methods: { methods: {
handleDataItemChange(val) { handleDataItemChange(val, checkedList) {
this.$emit('onChange', val) this.$emit('onChange', val, checkedList)
this.$emit('update:value', val) this.$emit('update:value', val)
this.$emit('update:checkedList', checkedList)
} }
} }
} }

View File

@ -2,7 +2,7 @@
<view :class="contClass" :style="styles"> <view :class="contClass" :style="styles">
<u-row custom-style="width: 100%;"> <u-row custom-style="width: 100%;">
<view style="flex: 1;"> <view style="flex: 1;">
<u-text :text="leftText" size="28"></u-text> <u-text :text="leftText" size="28" :lines="1"></u-text>
</view> </view>
<u-row> <u-row>
<u-icon size="22" :name="`${show?'arrow-up':'arrow-down'}`" color="#333"></u-icon> <u-icon size="22" :name="`${show?'arrow-up':'arrow-down'}`" color="#333"></u-icon>
@ -19,7 +19,11 @@
if (this.value) { if (this.value) {
const curItem = this.list.filter(item => item.val == this.value)[0] || {} const curItem = this.list.filter(item => item.val == this.value)[0] || {}
curItem.title && (str = curItem.title) curItem.title && (str = curItem.title)
} else { }
if(!str && Array.isArray(this.checkedList)) {
str = this.checkedList.map(t=> t.title).join(',')
}
if(!str) {
str = this.placeholder str = this.placeholder
} }
return str return str
@ -67,8 +71,13 @@
default () { default () {
return [] return []
} }
},
checkedList: {
default () {
return []
} }
}, },
},
data() { data() {
return { return {

View File

@ -2,14 +2,16 @@
<view @click.stop="handleRootClick" class="" style="position: relative;"> <view @click.stop="handleRootClick" class="" style="position: relative;">
<view @click="handleSelectSwitch"> <view @click="handleSelectSwitch">
<slot v-if="$slots.default"></slot> <slot v-if="$slots.default"></slot>
<default-select-input v-else :placeholder="placeholder" :show="show" :list="filDataList" :value="value" :isWhite="isWhite" :customStyle="customStyle"></default-select-input> <default-select-input v-else :placeholder="placeholder" :show="show" :list="filDataList" :value="value" :isWhite="isWhite"
:checkedList="filDatacheckedList" :customStyle="customStyle"
></default-select-input>
</view> </view>
<view v-if="mode == modeEnum.sheet"> <view v-if="mode == modeEnum.sheet">
<tpx-dialog :show="show" :title="placeholder" @onClose="handleSelectSwitch"> <tpx-dialog :show="show" :title="placeholder" @onClose="handleSelectSwitch">
<view style="height: calc(60vh);"> <view style="height: calc(60vh);">
<tpx-scroll-view :resObject="filResObject" :searchParam="searchParam" :getListFun="getListFun" size="sm" :showLoadedAll="false" @onListChange="onListChange"> <tpx-scroll-view :resObject="filResObject" :searchParam="searchParam" :getListFun="getListFun" size="sm" :showLoadedAll="false" @onListChange="onListChange">
<content-items :value="value" :list="filDataList" :minChecked="minChecked" :type="type" <content-items :value="value" :list="filDataList" :checkedList="filDatacheckedList" :minChecked="minChecked" :type="type"
@onChange="handleDataItemChange" @onChange="handleDataItemChange"
></content-items> ></content-items>
</tpx-scroll-view> </tpx-scroll-view>
@ -51,6 +53,13 @@
} }
return list return list
}, },
filDatacheckedList() {
let list = (this.getListFun ? this.resObject.checkedList : this.checkedList) || []
if(this.transKeyVal) {
list = transListKeyTitle({ ...this.transKeyVal, list: list })
}
return list
},
filResObject() { filResObject() {
let res = this.getListFun ? this.resObject : { list: this.list, total: this.list.length } let res = this.getListFun ? this.resObject : { list: this.list, total: this.list.length }
return res return res
@ -106,6 +115,11 @@
return [] return []
} }
}, },
checkedList: {
default () {
return []
}
},
searchParam: { searchParam: {
default () { default () {
return {} return {}
@ -164,9 +178,16 @@
// this.$emit('update:show', !this.show) // this.$emit('update:show', !this.show)
this.show = !this.show this.show = !this.show
}, },
handleDataItemChange(val) { handleDataItemChange(val, checkedList) {
this.$emit('onChange', val) this.$emit('onChange', val, checkedList)
this.$emit('update:value', val) this.$emit('update:value', val)
this.$emit('update:checkedList', checkedList)
if(this.resObject) {
this.$emit('update:resObject', {
...this.resObject,
checkedList
})
}
if(this.type == "single") { if(this.type == "single") {
this.handleSelectSwitch() this.handleSelectSwitch()
} }

View File

@ -8,13 +8,18 @@
title() { title() {
let title = this.value let title = this.value
let val = this.value let val = this.value
!val && this.list && (title = '-');
if(val && this.list) { if(val && this.list) {
if(!Array.isArray() && val.split) { if(!Array.isArray(val) && val.split) {
val = val.split(",") val = val.split(",")
} }
title = this.list.filter(t=> t.val == val || (val.indexOf && val.indexOf(t.val) > -1)).map(t=> t.title).join(",") title = this.list.filter(t=> t.val == val || (val.indexOf && val.indexOf(t.val) > -1)).map(t=> t.title).join(",")
} }
if(Array.isArray(this.checkedList)) {
val = this.checkedList.map(t=> t.title).join(',')
}
if((!title || title?.length == 0) && (this.list || this.checkedList?.length == 0)) {
title = '-'
}
return title return title
} }
}, },
@ -23,6 +28,8 @@
}, },
list: { list: {
}, },
checkedList: {
},
}, },
data() { data() {
return { return {

View File

@ -10,7 +10,7 @@
<template v-if="!$slots.right"> <template v-if="!$slots.right">
<u-text align="right" margin="0 12rpx 0 0" size="26" <u-text align="right" margin="0 12rpx 0 0" size="26"
:text="title"></u-text> :text="title"></u-text>
<u-icon v-if="list" size="26" name="arrow-right" color="#333"></u-icon> <u-icon v-if="list || checkedList" size="26" name="arrow-right" color="#333"></u-icon>
</template> </template>
<slot name="right"></slot> <slot name="right"></slot>
</u-row> </u-row>
@ -23,13 +23,18 @@
title() { title() {
let title = this.value let title = this.value
let val = this.value let val = this.value
!val && this.list && (title = '请选择');
if(val && this.list) { if(val && this.list) {
if(!Array.isArray() && val.split) { if(!Array.isArray(val) && val.split) {
val = val.split(",") val = val.split(",")
} }
title = this.list.filter(t=> t.val == val || (val.indexOf && val.indexOf(t.val) > -1)).map(t=> t.title).join(",") title = this.list.filter(t=> t.val == val || (val.indexOf && val.indexOf(t.val) > -1)).map(t=> t.title).join(",")
} }
if(Array.isArray(this.checkedList)) {
title = this.checkedList.map(t=> t.title).join(',')
}
if((!title || title?.length == 0) && (this.list || this.checkedList?.length == 0)) {
title = '请选择'
}
return title return title
} }
}, },
@ -48,6 +53,8 @@
}, },
list: { list: {
}, },
checkedList: {
},
}, },
data() { data() {
return { return {

View File

@ -43,7 +43,7 @@
<tpx-select v-model:value="submitParam.transLine" v-model:resObject="wayRes" :getListFun="getTransLineList" :transKeyVal="{valKey: 'lineCode',titleKey: 'lineName'}" <tpx-select v-model:value="submitParam.transLine" v-model:resObject="wayRes" :getListFun="getTransLineList" :transKeyVal="{valKey: 'lineCode',titleKey: 'lineName'}"
:searchParam="waySearchParam" @onChange="handleWayChange" placeholder="请选择路线" :searchParam="waySearchParam" @onChange="handleWayChange" placeholder="请选择路线"
> >
<tpx-text-item label="线路" :value="submitParam.transLine" :list="wayRes.list"></tpx-text-item> <tpx-text-item label="线路" :checkedList="wayRes.checkedList"></tpx-text-item>
</tpx-select> </tpx-select>
</view> </view>
</template> </template>
@ -53,7 +53,7 @@
<tpx-select v-model:value="submitParam.productType" v-model:resObject="productRes" :getListFun="getTransProductList" :transKeyVal="{valKey: 'prodCode',titleKey: 'prodName'}" :isWhite="true" <tpx-select v-model:value="submitParam.productType" v-model:resObject="productRes" :getListFun="getTransProductList" :transKeyVal="{valKey: 'prodCode',titleKey: 'prodName'}" :isWhite="true"
:searchParam="productSearchParam" placeholder="请选择产品类型" :searchParam="productSearchParam" placeholder="请选择产品类型"
> >
<tpx-text-item label="产品类型" :value="submitParam.productType" :list="productRes.list"></tpx-text-item> <tpx-text-item label="产品类型" :checkedList="productRes.checkedList"></tpx-text-item>
</tpx-select> </tpx-select>
</view> </view>
</template> </template>
@ -84,13 +84,13 @@
<view class="yunf-input-item"> <view class="yunf-input-item">
<tpx-select v-model:value="submitParam.operateEmployeeCode" v-model:resObject="caozuoRes" :getListFun="getOpStaffList" :transKeyVal="{valKey: 'empCode',titleKey: 'empName'}" placeholder="请选择操作员"> <tpx-select v-model:value="submitParam.operateEmployeeCode" v-model:resObject="caozuoRes" :getListFun="getOpStaffList" :transKeyVal="{valKey: 'empCode',titleKey: 'empName'}" placeholder="请选择操作员">
<tpx-text-item label="操作员" :value="submitParam.operateEmployeeCode" :list="caozuoRes.list" ></tpx-text-item> <tpx-text-item label="操作员" :checkedList="caozuoRes.checkedList" ></tpx-text-item>
</tpx-select> </tpx-select>
</view> </view>
<view class="yunf-input-item"> <view class="yunf-input-item">
<tpx-select v-model:value="submitParam.takePieceEmployeeCode" v-model:resObject="shoupaiRes" :getListFun="getRSDStaffList" :transKeyVal="{valKey: 'empCode',titleKey: 'empName'}" placeholder="请选择收派员"> <tpx-select v-model:value="submitParam.takePieceEmployeeCode" v-model:resObject="shoupaiRes" :getListFun="getRSDStaffList" :transKeyVal="{valKey: 'empCode',titleKey: 'empName'}" placeholder="请选择收派员">
<tpx-text-item label="收派员" :value="submitParam.takePieceEmployeeCode" :list="shoupaiRes.list"></tpx-text-item> <tpx-text-item label="收派员" :checkedList="shoupaiRes.checkedList"></tpx-text-item>
</tpx-select> </tpx-select>
</view> </view>
@ -106,7 +106,7 @@
<tpx-select v-model:value="submitParam.custNo" v-model:resObject="yuejieRes" :getListFun="getMonthpayAccountList" :transKeyVal="{valKey: 'custNo',titleKey: 'custName'}" <tpx-select v-model:value="submitParam.custNo" v-model:resObject="yuejieRes" :getListFun="getMonthpayAccountList" :transKeyVal="{valKey: 'custNo',titleKey: 'custName'}"
@onChange="handleYueJieSelect" placeholder="请选择月结账户" @onChange="handleYueJieSelect" placeholder="请选择月结账户"
> >
<tpx-text-item label="月结账户" :value="submitParam.custNo" :list="yuejieRes.list"></tpx-text-item> <tpx-text-item label="月结账户" :checkedList="yuejieRes.checkedList"></tpx-text-item>
</tpx-select> </tpx-select>
</view> </view>
@ -128,7 +128,7 @@
<tpx-select v-model:value="submitParam.destinationCode" v-model:resObject="destPostRes" :getListFun="getDestPositionList" :transKeyVal="{valKey: 'destCode',titleKey: 'destName'}" :isWhite="true" <tpx-select v-model:value="submitParam.destinationCode" v-model:resObject="destPostRes" :getListFun="getDestPositionList" :transKeyVal="{valKey: 'destCode',titleKey: 'destName'}" :isWhite="true"
:searchParam="destPostParam" @onChange="handleDestPostChange" placeholder="请选择目的地" :searchParam="destPostParam" @onChange="handleDestPostChange" placeholder="请选择目的地"
> >
<tpx-text-item label="目的地" :value="submitParam.destinationCode" :list="destPostRes.list"></tpx-text-item> <tpx-text-item label="目的地" :checkedList="destPostRes.checkedList"></tpx-text-item>
</tpx-select> </tpx-select>
</view> </view>
@ -140,7 +140,7 @@
<tpx-select v-model:value="submitParam.warehouseInNo" v-model:resObject="wareRes" :getListFun="getWarehouseInList" :transKeyVal="{valKey: 'inNo',titleKey: 'inNo'}" :isWhite="true" <tpx-select v-model:value="submitParam.warehouseInNo" v-model:resObject="wareRes" :getListFun="getWarehouseInList" :transKeyVal="{valKey: 'inNo',titleKey: 'inNo'}" :isWhite="true"
searchParam="" type="multiple" placeholder="请选择进仓单" minChecked="0" searchParam="" type="multiple" placeholder="请选择进仓单" minChecked="0"
> >
<tpx-text-item label="进仓单" :value="submitParam.warehouseInNo" :list="wareRes.list"></tpx-text-item> <tpx-text-item label="进仓单" :checkedList="wareRes.checkedList"></tpx-text-item>
</tpx-select> </tpx-select>
</view> </view>
@ -295,14 +295,14 @@
billCode: '', // 运单id billCode: '', // 运单id
orderSn: '', // 订单id orderSn: '', // 订单id
}, },
kehuRes: { list: [] }, kehuRes: { list: [], checkedList: [] },
wayRes: { list: [] }, wayRes: { list: [], checkedList: [] },
productRes: { list: [] }, productRes: { list: [], checkedList: [] },
caozuoRes: { list: [] }, caozuoRes: { list: [], checkedList: [] },
shoupaiRes: { list: [] }, shoupaiRes: { list: [], checkedList: [] },
yuejieRes: { list: [] }, yuejieRes: { list: [], checkedList: [] },
destPostRes: { list: [] }, destPostRes: { list: [], checkedList: [] },
wareRes: { list: [] }, wareRes: { list: [], checkedList: [] },
goodChooseModal: { goodChooseModal: {
show: false, show: false,
}, },
@ -385,6 +385,7 @@
// 更新路线推荐的默认目的地 // 更新路线推荐的默认目的地
let data = res.data || {} let data = res.data || {}
this.submitParam.destinationCode = data.destCode this.submitParam.destinationCode = data.destCode
this.destPostRes.checkedList = [{ title: data.destName, val: data.destCode }]
this.submitParam.dispatchUnderlingSiteCode = data.siteCode; this.submitParam.dispatchUnderlingSiteCode = data.siteCode;
this.submitParam.dispatchUnderlingSite = data.siteName; this.submitParam.dispatchUnderlingSite = data.siteName;
}, },