diff --git a/common/util.js b/common/util.js index 1020bd3..3397256 100644 --- a/common/util.js +++ b/common/util.js @@ -127,8 +127,8 @@ const setAddresModalParam = (data = {})=> { // - 转换list的key val const transListKeyTitle = ({ valKey = '', titleKey = '', list = [] })=> { list.map(t=> { - t.title = t[titleKey] - t.val = t[valKey] + t.title = t[titleKey] || t.title + t.val = t[valKey] || t.val }) return list } diff --git a/components/tpx-checkitems/tpx-checkitems.vue b/components/tpx-checkitems/tpx-checkitems.vue index c495ea4..1a886d0 100644 --- a/components/tpx-checkitems/tpx-checkitems.vue +++ b/components/tpx-checkitems/tpx-checkitems.vue @@ -36,6 +36,11 @@ return [] } }, + checkedList: { + default () { + return [] + } + }, value: { default () { return [] @@ -93,13 +98,18 @@ this.$emit('onItemClick', { curItem, index, checked: checkedVal.indexOf(curItem.val)>-1 }) }, changeTabCheck(checkedVal) { - let oldVal = checkedVal - let val = oldVal + let value = checkedVal + 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) { - val = checkedVal[0] + value = checkedVal[0] } - this.$emit('onChange', val) - this.$emit('update:value', val) + this.$emit('onChange', value, checkedList) + this.$emit('update:value', value) } } } diff --git a/components/tpx-select/content-items.vue b/components/tpx-select/content-items.vue index b7e0e2e..40be630 100644 --- a/components/tpx-select/content-items.vue +++ b/components/tpx-select/content-items.vue @@ -3,7 +3,7 @@ @@ -50,6 +50,11 @@ return '' } }, + checkedList: { + default () { + return [] + } + }, list: { default () { return [] @@ -69,9 +74,10 @@ unmounted() {}, methods: { - handleDataItemChange(val) { - this.$emit('onChange', val) + handleDataItemChange(val, checkedList) { + this.$emit('onChange', val, checkedList) this.$emit('update:value', val) + this.$emit('update:checkedList', checkedList) } } } diff --git a/components/tpx-select/default-select-input.vue b/components/tpx-select/default-select-input.vue index 90ac6a9..a204c7f 100644 --- a/components/tpx-select/default-select-input.vue +++ b/components/tpx-select/default-select-input.vue @@ -2,7 +2,7 @@ - + @@ -19,7 +19,11 @@ if (this.value) { const curItem = this.list.filter(item => item.val == this.value)[0] || {} 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 } return str @@ -67,7 +71,12 @@ default () { return [] } - } + }, + checkedList: { + default () { + return [] + } + }, }, data() { return { diff --git a/components/tpx-select/tpx-select.vue b/components/tpx-select/tpx-select.vue index 4ff75b5..a995f4d 100644 --- a/components/tpx-select/tpx-select.vue +++ b/components/tpx-select/tpx-select.vue @@ -2,14 +2,16 @@ - + - @@ -51,6 +53,13 @@ } return list }, + filDatacheckedList() { + let list = (this.getListFun ? this.resObject.checkedList : this.checkedList) || [] + if(this.transKeyVal) { + list = transListKeyTitle({ ...this.transKeyVal, list: list }) + } + return list + }, filResObject() { let res = this.getListFun ? this.resObject : { list: this.list, total: this.list.length } return res @@ -106,6 +115,11 @@ return [] } }, + checkedList: { + default () { + return [] + } + }, searchParam: { default () { return {} @@ -164,9 +178,16 @@ // this.$emit('update:show', !this.show) this.show = !this.show }, - handleDataItemChange(val) { - this.$emit('onChange', val) + handleDataItemChange(val, checkedList) { + this.$emit('onChange', val, checkedList) this.$emit('update:value', val) + this.$emit('update:checkedList', checkedList) + if(this.resObject) { + this.$emit('update:resObject', { + ...this.resObject, + checkedList + }) + } if(this.type == "single") { this.handleSelectSwitch() } diff --git a/components/tpx-text-dic/tpx-text-dic.vue b/components/tpx-text-dic/tpx-text-dic.vue index 43be7d1..67193a8 100644 --- a/components/tpx-text-dic/tpx-text-dic.vue +++ b/components/tpx-text-dic/tpx-text-dic.vue @@ -8,13 +8,18 @@ title() { let title = this.value let val = this.value - !val && this.list && (title = '-'); if(val && this.list) { - if(!Array.isArray() && val.split) { + if(!Array.isArray(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(",") } + 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 } }, @@ -23,6 +28,8 @@ }, list: { }, + checkedList: { + }, }, data() { return { diff --git a/components/tpx-text-item/tpx-text-item.vue b/components/tpx-text-item/tpx-text-item.vue index b7f1208..b3092ad 100644 --- a/components/tpx-text-item/tpx-text-item.vue +++ b/components/tpx-text-item/tpx-text-item.vue @@ -10,7 +10,7 @@ @@ -23,13 +23,18 @@ title() { let title = this.value let val = this.value - !val && this.list && (title = '请选择'); if(val && this.list) { - if(!Array.isArray() && val.split) { + if(!Array.isArray(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(",") } + 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 } }, @@ -48,6 +53,8 @@ }, list: { }, + checkedList: { + }, }, data() { return { diff --git a/pages/post/openorder.vue b/pages/post/openorder.vue index 6b255fa..9bf9670 100644 --- a/pages/post/openorder.vue +++ b/pages/post/openorder.vue @@ -43,7 +43,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -84,13 +84,13 @@ - + - + @@ -106,7 +106,7 @@ - + @@ -128,7 +128,7 @@ - + @@ -140,7 +140,7 @@ - + @@ -295,14 +295,14 @@ billCode: '', // 运单id orderSn: '', // 订单id }, - kehuRes: { list: [] }, - wayRes: { list: [] }, - productRes: { list: [] }, - caozuoRes: { list: [] }, - shoupaiRes: { list: [] }, - yuejieRes: { list: [] }, - destPostRes: { list: [] }, - wareRes: { list: [] }, + kehuRes: { list: [], checkedList: [] }, + wayRes: { list: [], checkedList: [] }, + productRes: { list: [], checkedList: [] }, + caozuoRes: { list: [], checkedList: [] }, + shoupaiRes: { list: [], checkedList: [] }, + yuejieRes: { list: [], checkedList: [] }, + destPostRes: { list: [], checkedList: [] }, + wareRes: { list: [], checkedList: [] }, goodChooseModal: { show: false, }, @@ -385,6 +385,7 @@ // 更新路线推荐的默认目的地 let data = res.data || {} this.submitParam.destinationCode = data.destCode + this.destPostRes.checkedList = [{ title: data.destName, val: data.destCode }] this.submitParam.dispatchUnderlingSiteCode = data.siteCode; this.submitParam.dispatchUnderlingSite = data.siteName; },