Browse Source

修改直接完工功能2024/7/18 17:24:08

hella_vue3
zhang_li 3 months ago
parent
commit
5a00aaf5c8
  1. 4
      src/api/request2.js
  2. 28
      src/common/style/new_style.css
  3. 2
      src/mycomponents/balance/location.vue
  4. 30
      src/mycomponents/balance/toLocation.vue
  5. 4
      src/mycomponents/item/itemCompareQty.vue
  6. 2
      src/mycomponents/job/jobComMainDetailCard.vue
  7. 100
      src/mycomponents/qty/recommendQty.vue
  8. 85
      src/pages/fg/coms/comReceiptPopup.vue
  9. 781
      src/uni_modules/vk-uview-ui/components/u-select/u-select.vue

4
src/api/request2.js

@ -2648,3 +2648,7 @@ export function getPlaneInfoByproductLine(productionLine,planDate) {
export function planReceiptSubmit(data) { export function planReceiptSubmit(data) {
return http.post("/wms/production-main/getPlanProductionByProductionLineAndPlanDate",data) return http.post("/wms/production-main/getPlanProductionByProductionLineAndPlanDate",data)
} }
export function getProductionlineAndWorkStation() {
return http.get("/wms/production-main/getProductionlineAndWorkStation")
}

28
src/common/style/new_style.css

@ -2076,6 +2076,11 @@ button::after {
color:#2E3A63; color:#2E3A63;
margin-left:20rpx margin-left:20rpx
} }
.card_big_content {
font-size: 40rpx;
font-weight: bold;
padding: 5px;
}
.card_icon_normal { .card_icon_normal {
width: 30rpx; width: 30rpx;
@ -2085,23 +2090,25 @@ button::after {
} }
.card_packing_code { .card_packing_code {
color: #1677FF; color: #3315EB;
font-size: 26rpx; padding: 5px;
font-style: italic; font-size: 30rpx;
} }
.card_batch { .card_batch {
color: #9747FF; color: #9747FF;
font-size: 26rpx; padding: 5px;
font-style: italic; font-size: 30rpx;
} }
.card_container { .card_container {
color: #0076F6; color: #0076F6;
padding: 5px; padding: 5px;
font-size: 30rpx;
} }
.card_container_content { .card_container_content {
font-size: 32rpx; font-size: 32rpx;
padding: 5px; padding: 5px;
@ -2497,10 +2504,17 @@ button[disabled] {
.text_recommend { .text_recommend {
color: #0A84FF; color: #0A84FF;
font-size: 38rpx; font-size: 34rpx;
font-weight:bold font-weight: bold;
} }
.text_packQty {
color: #3315EB;
font-size: 40rpx;
font-weight: bold;
}
.text_balance { .text_balance {
font-size: 36rpx; font-size: 36rpx;
} }

2
src/mycomponents/balance/location.vue

@ -1,7 +1,7 @@
<template> <template>
<view class="card_view"> <view class="card_view">
<text class="card_location">{{ title }}</text> <text class="card_location">{{ title }}</text>
<text class="card_content" style="font-size: 37rpx">{{ locationCode }}</text> <text class="card_big_content" style="font-size: 40rpx">{{ locationCode }}</text>
</view> </view>
</template> </template>

30
src/mycomponents/balance/toLocation.vue

@ -1,21 +1,19 @@
<template> <template>
<view class="card_view "> <view class="card_view">
<text class="card_to_location">{{title}}</text> <text class="card_to_location">{{ title }}</text>
<text class="card_content ">{{locationCode}}</text> <text class="card_content">{{ locationCode }}</text>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const props = defineProps({ const props = defineProps({
locationCode: { locationCode: {
type: String, type: String
}, },
title: { title: {
type: String, type: String,
default: '库位' default: '库位'
}, }
})
})
</script> </script>
<style> <style></style>
</style>

4
src/mycomponents/item/itemCompareQty.vue

@ -3,8 +3,8 @@
<view style="flex: 1"> <view style="flex: 1">
<item :dataContent="dataContent"></item> <item :dataContent="dataContent"></item>
</view> </view>
<view style="width: 30%; display: flex; justify-content: flex-end; margin-right: 10rpx"> <view style="width: 40%; display: flex; justify-content: flex-end; margin-right: 10rpx">
<recommend-qty v-if="handleQty == 0" :dataContent="dataContent" :isShowStatus="false" :isShowStdPack="true" :objTextStyle="objTextStyle"></recommend-qty> <recommend-qty v-if="handleQty == 0" :dataContent="dataContent" :isShowStatus="false" :isShowStdPack="true"></recommend-qty>
<compare-qty v-else :dataContent="dataContent" :recommendQty="Number(dataContent.qty)" :handleQty="Number(handleQty)" :isShowStatus="false" :isShowPackUnit="isShowPackUnit"> </compare-qty> <compare-qty v-else :dataContent="dataContent" :recommendQty="Number(dataContent.qty)" :handleQty="Number(handleQty)" :isShowStatus="false" :isShowPackUnit="isShowPackUnit"> </compare-qty>
</view> </view>
</view> </view>

2
src/mycomponents/job/jobComMainDetailCard.vue

@ -1,7 +1,7 @@
<template> <template>
<view class=""> <view class="">
<view class="task_text" style="border-top: 1px solid #dedede; padding-top: 20rpx"> <view class="task_text" style="border-top: 1px solid #dedede; padding-top: 20rpx">
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty" :isShowPackUnit="false" :objTextStyle="{ fontWeight: 'bold', fontSize: '40rpx' }"></itemCompareQty> <itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty" :isShowPackUnit="false"></itemCompareQty>
<div> <div>
<pack v-if="isShowPack && dataContent.packingNumber != null" :packingCode="dataContent.packingNumber"> </pack> <pack v-if="isShowPack && dataContent.packingNumber != null" :packingCode="dataContent.packingNumber"> </pack>
<batch v-if="isShowBatch && dataContent.batch != null" :batch="dataContent.batch"></batch> <batch v-if="isShowBatch && dataContent.batch != null" :batch="dataContent.batch"></batch>

100
src/mycomponents/qty/recommendQty.vue

@ -1,58 +1,64 @@
<template> <template>
<view> <view>
<status v-if="isShowStatus" :status='dataContent.inventoryStatus'></status> <status v-if="isShowStatus" :status="dataContent.inventoryStatus"></status>
<view class="u-flex u-row center"> <view class="u-flex u-row center">
<view class="text_recommend " :style='objTextStyle'> <view class="text_recommend">
{{Number(dataContent.qty)}} {{ Number(dataContent.qty) }}
</view> </view>
<uom :uom="dataContent.uom"></uom> <uom :uom="dataContent.uom"></uom>
</view> <view v-if="dataContent.packQty != undefined" class="uni-flex uni-row">
<view> <view class="uom">/</view>
<pack-unit :dataContent="dataContent"></pack-unit> <view class="text_packQty">{{ calc(dataContent.qty, dataContent.packQty) }} </view>
</view> </view>
</view> </view>
<view>
<pack-unit :dataContent="dataContent"></pack-unit>
</view>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import packUnit from '@/mycomponents/qty/packUnit.vue' import packUnit from '@/mycomponents/qty/packUnit.vue'
import uom from '@/mycomponents/qty/uom.vue' import uom from '@/mycomponents/qty/uom.vue'
import status from '@/mycomponents/status/status.vue' import status from '@/mycomponents/status/status.vue'
const props = defineProps({
type: {
type: String,
default: 'default' //recommend: compare:
},
dataContent: { const props = defineProps({
type: Object, type: {
default: {} type: String,
}, default: 'default' // recommend: compare:
recommendQty: { },
type: Number,
default: 0
},
handleQty: { dataContent: {
type: Number, type: Object,
default: 0 default: {}
}, },
recommendQty: {
type: Number,
default: 0
},
isShowStatus: { handleQty: {
type: Boolean, type: Number,
default: true default: 0
}, },
isShowStdPack: {
type: Boolean,
default: true
},
objTextStyle:{
type: Object,
default: null
}
})
isShowStatus: {
type: Boolean,
default: true
},
isShowStdPack: {
type: Boolean,
default: true
},
objTextStyle: {
type: Object,
default: null
}
})
const calc = (qty, packQty) => {
return Math.ceil(Number(qty) / Number(packQty))
}
</script> </script>
<style lang="scss"> <style lang="scss"></style>
</style>

85
src/pages/fg/coms/comReceiptPopup.vue

@ -17,13 +17,12 @@
<view class="customerBorder" @click="showSelectLine"> <view class="customerBorder" @click="showSelectLine">
{{ productionLineName }} {{ productionLineName }}
</view> </view>
<u-select v-model="showProductLineSelect" mode="single-column" :list="productLineList" @confirm="confirmSelectLine"></u-select> <u-select v-model="showProductLineSelect" mode="mutil-column-auto" :list="productLineList" @confirm="confirmSelectLine"></u-select>
<view class=""> <view class="">
<image src="/static/icons/down.svg" mode="" style="width: 40rpx; height: 40rpx; margin-left: 20rpx" @click="showSelectLine"> </image> <image src="/static/icons/down.svg" mode="" style="width: 40rpx; height: 40rpx; margin-left: 20rpx" @click="showSelectLine"> </image>
</view> </view>
</view> </view>
<view class="split_line"></view> <view class="split_line"></view>
<view class="title" style="display: flex; align-items: center; padding: 10rpx"> <view class="title" style="display: flex; align-items: center; padding: 10rpx">
@ -31,6 +30,7 @@
<view class="customerBorder"> <view class="customerBorder">
{{ itemCode }} {{ itemCode }}
</view> </view>
<view v-if="planQty > 0">{{ planQty }}({{ getUomInfo(uom) }})</view>
<u-select v-model="showItemCodeSelect" mode="single-column" :list="itemCodeList" @confirm="confirmSelectItem"></u-select> <u-select v-model="showItemCodeSelect" mode="single-column" :list="itemCodeList" @confirm="confirmSelectItem"></u-select>
<view class=""> <view class="">
<image src="/static/icons/down.svg" mode="" style="width: 40rpx; height: 40rpx; margin-left: 20rpx" @click="showSelectItemCode"> </image> <image src="/static/icons/down.svg" mode="" style="width: 40rpx; height: 40rpx; margin-left: 20rpx" @click="showSelectItemCode"> </image>
@ -46,22 +46,23 @@
</view> </view>
</view> </view>
<view class="split_line"></view> <view class="split_line"></view>
<view class="title" style="display: flex; align-items: center; padding: 10rpx"> <!-- <view class="title " style="display: flex;align-items: center;padding: 10rpx;">
<text style="flex-shrink: 0; width: 25%">计划数量</text> <text style=" flex-shrink: 0; width: 25%;">计划数量</text>
<view class="customerBorder"> <view class="customerBorder">
{{ planQty }} {{planQty}}
</view> </view>
<view class=""> <view class="">
<image src="" mode="" style="width: 40rpx; height: 40rpx; margin-left: 20rpx"> </image> <image src="" mode="" style=" width: 40rpx;height: 40rpx;margin-left: 20rpx;">
</view> </image>
</view> </view>
</view> -->
<view class="split_line"></view> <view class="split_line"></view>
<view class="title" style="display: flex; align-items: center; padding: 10rpx"> <view class="title" style="display: flex; align-items: center; padding: 10rpx">
<text style="flex-shrink: 0; width: 25%">包装规格</text> <text style="flex-shrink: 0; width: 25%">包装规格</text>
<view class="customerBorder"> <view class="customerBorder">
{{ packUnit }} {{ packUnit }}
</view> </view>
<u-select v-model="showPackUnitSelect" mode="mutil-column-auto" :list="packUnitList" @confirm="confirmSelectPackUnit"></u-select> <u-select v-model="showPackUnitSelect" mode="mutil-column" :list="packUnitList" @confirm="confirmSelectPackUnit"></u-select>
<view class=""> <view class="">
<image src="/static/icons/down.svg" mode="" style="width: 40rpx; height: 40rpx; margin-left: 20rpx" @click="showSelectPackUnit"> </image> <image src="/static/icons/down.svg" mode="" style="width: 40rpx; height: 40rpx; margin-left: 20rpx" @click="showSelectPackUnit"> </image>
</view> </view>
@ -82,7 +83,7 @@
</template> </template>
<script> <script>
import { getIssueJobByProductionline, getPlaneInfoByproductLine, getPackUnitByItemCode } from '@/api/request2.js' import { getIssueJobByProductionline, getPlaneInfoByproductLine, getPackUnitByItemCode, getProductionlineAndWorkStation } from '@/api/request2.js'
import { getPackUnitName, getUomInfo } from '@/common/directory.js' import { getPackUnitName, getUomInfo } from '@/common/directory.js'
import { getCurrDate, getBatch8 } from '@/common/basic.js' import { getCurrDate, getBatch8 } from '@/common/basic.js'
@ -115,36 +116,7 @@ export default {
showPackUnitSelect: false, showPackUnitSelect: false,
itemCodeList: [], itemCodeList: [],
showItemCodeSelect: false, showItemCodeSelect: false,
packUnitList: [ packUnitList: []
{
value: 1,
label: '中国',
children: [
{
value: 2,
label: '广东'
},
{
value: 5,
label: '广西'
}
]
},
{
value: 8,
label: '美国',
children: [
{
value: 9,
label: '纽约'
},
{
value: 10,
label: '华盛顿'
}
]
}
]
} }
}, },
props: { props: {
@ -247,13 +219,13 @@ export default {
title: '加载中', title: '加载中',
mask: true mask: true
}) })
getIssueJobByProductionline() getProductionlineAndWorkStation()
.then((res) => { .then((res) => {
uni.hideLoading() uni.hideLoading()
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
res.data.forEach((item) => { // res.data.forEach(item => {
item.label = item.name // item.label = item.name
}) // })
this.productLineList = res.data this.productLineList = res.data
this.showProductLineSelect = true this.showProductLineSelect = true
} else { } else {
@ -285,7 +257,8 @@ export default {
uni.hideLoading() uni.hideLoading()
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
res.data.forEach((item) => { res.data.forEach((item) => {
item.label = item.itemCode item.label = `${item.itemCode}${item.planQty}${item.uom})`
item.value = item
}) })
this.itemCodeList = res.data this.itemCodeList = res.data
this.showItemCodeSelect = true this.showItemCodeSelect = true
@ -302,11 +275,17 @@ export default {
} }
}, },
confirmSelectItem(data) { confirmSelectItem(data) {
this.itemCode = data[0].label const productionPlan = data[0].value
const item = this.itemCodeList.find((res) => res.itemCode == this.itemCode) this.itemCode = productionPlan.itemCode
this.uom = item.uom // var item = this.itemCodeList.find(res => res.itemCode == this.itemCode)
this.planQty = item.planQty this.uom = productionPlan.uom
this.number = item.number this.planQty = productionPlan.planQty
this.number = productionPlan.number
// this.itemCode = data[0].label
// var item = this.itemCodeList.find(res => res.itemCode == this.itemCode)
// this.uom = item.uom
// this.planQty = item.planQty
// this.number = item.number
}, },
showSelectPackUnit() { showSelectPackUnit() {

781
src/uni_modules/vk-uview-ui/components/u-select/u-select.vue

@ -1,6 +1,6 @@
<template> <template>
<view class="u-select"> <view class="u-select">
<!-- <view class="u-select__action" :class="{ <!-- <view class="u-select__action" :class="{
'u-select--border': border 'u-select--border': border
}" @tap.stop="selectHandler"> }" @tap.stop="selectHandler">
<view class="u-select__action__icon" :class="{ <view class="u-select__action__icon" :class="{
@ -9,429 +9,414 @@
<u-icon name="arrow-down-fill" size="26" color="#c0c4cc"></u-icon> <u-icon name="arrow-down-fill" size="26" color="#c0c4cc"></u-icon>
</view> </view>
</view> --> </view> -->
<u-popup :blur="blur" :maskCloseAble="maskCloseAble" mode="bottom" :popup="false" v-model="popupValue" length="auto" :safeAreaInsetBottom="safeAreaInsetBottom" @close="close" :z-index="uZIndex"> <u-popup :blur="blur" :maskCloseAble="maskCloseAble" mode="bottom" :popup="false" v-model="popupValue" length="auto" :safeAreaInsetBottom="safeAreaInsetBottom" @close="close" :z-index="uZIndex">
<view class="u-select"> <view class="u-select">
<view class="u-select__header" @touchmove.stop.prevent=""> <view class="u-select__header" @touchmove.stop.prevent="">
<view <view class="u-select__header__cancel u-select__header__btn" :style="{ color: cancelColor }" hover-class="u-hover-class" :hover-stay-time="150" @tap.stop="getResult('cancel')">
class="u-select__header__cancel u-select__header__btn" {{ cancelText }}
:style="{ color: cancelColor }" </view>
hover-class="u-hover-class" <view class="u-select__header__title">
:hover-stay-time="150" {{ title }}
@tap.stop="getResult('cancel')" </view>
> <view class="u-select__header__confirm u-select__header__btn" :style="{ color: moving ? cancelColor : confirmColor }" hover-class="u-hover-class" :hover-stay-time="150" @touchmove.stop="" @tap.stop="getResult('confirm')">
{{cancelText}} {{ confirmText }}
</view> </view>
<view class="u-select__header__title"> </view>
{{title}} <view class="u-select__body">
</view> <picker-view @change="columnChange" class="u-select__body__picker-view" :value="defaultSelector" @pickstart="pickstart" @pickend="pickend">
<view <picker-view-column v-for="(item, index) in columnData" :key="index">
class="u-select__header__confirm u-select__header__btn" <view class="u-select__body__picker-view__item" v-for="(item1, index1) in item" :key="index1">
:style="{ color: moving ? cancelColor : confirmColor }" <view class="u-line-1">{{ item1[labelName] }}</view>
hover-class="u-hover-class" </view>
:hover-stay-time="150" </picker-view-column>
@touchmove.stop="" </picker-view>
@tap.stop="getResult('confirm')" </view>
> </view>
{{confirmText}} </u-popup>
</view> </view>
</view>
<view class="u-select__body">
<picker-view @change="columnChange" class="u-select__body__picker-view" :value="defaultSelector" @pickstart="pickstart" @pickend="pickend">
<picker-view-column v-for="(item, index) in columnData" :key="index">
<view class="u-select__body__picker-view__item" v-for="(item1, index1) in item" :key="index1">
<view class="u-line-1">{{ item1[labelName] }}</view>
</view>
</picker-view-column>
</picker-view>
</view>
</view>
</u-popup>
</view>
</template> </template>
<script> <script>
/** /**
* select 列选择器 * select 列选择器
* @description 此选择器用于单列多列多列联动的选择场景(从1.3.0版本起不建议使用Picker组件的单列和多列模式Select组件是专门为列选择而构造的组件更简单易用) * @description 此选择器用于单列多列多列联动的选择场景(从1.3.0版本起不建议使用Picker组件的单列和多列模式Select组件是专门为列选择而构造的组件更简单易用)
* @tutorial http://uviewui.com/components/select.html * @tutorial http://uviewui.com/components/select.html
* @property {String} mode 模式选择"single-column"-单列模式"mutil-column"-多列模式"mutil-column-auto"-多列联动模式 * @property {String} mode 模式选择"single-column"-单列模式"mutil-column"-多列模式"mutil-column-auto"-多列联动模式
* @property {Array} list 列数据数组形式见官网说明 * @property {Array} list 列数据数组形式见官网说明
* @property {Boolean} v-model 布尔值变量用于控制选择器的弹出与收起 * @property {Boolean} v-model 布尔值变量用于控制选择器的弹出与收起
* @property {Boolean} safe-area-inset-bottom 是否开启底部安全区适配(默认false) * @property {Boolean} safe-area-inset-bottom 是否开启底部安全区适配(默认false)
* @property {String} cancel-color 取消按钮的颜色默认#606266 * @property {String} cancel-color 取消按钮的颜色默认#606266
* @property {String} confirm-color 确认按钮的颜色(默认#2979ff) * @property {String} confirm-color 确认按钮的颜色(默认#2979ff)
* @property {String} confirm-text 确认按钮的文字 * @property {String} confirm-text 确认按钮的文字
* @property {String} cancel-text 取消按钮的文字 * @property {String} cancel-text 取消按钮的文字
* @property {String} default-value 提供的默认选中的下标见官网说明 * @property {String} default-value 提供的默认选中的下标见官网说明
* @property {Boolean} mask-close-able 是否允许通过点击遮罩关闭Picker(默认true) * @property {Boolean} mask-close-able 是否允许通过点击遮罩关闭Picker(默认true)
* @property {String Number} z-index 弹出时的z-index值(默认10075) * @property {String Number} z-index 弹出时的z-index值(默认10075)
* @property {String} value-name 自定义list数据的value属性名 1.3.6 * @property {String} value-name 自定义list数据的value属性名 1.3.6
* @property {String} label-name 自定义list数据的label属性名 1.3.6 * @property {String} label-name 自定义list数据的label属性名 1.3.6
* @property {String} child-name 自定义list数据的children属性名只对多列联动模式有效 1.3.7 * @property {String} child-name 自定义list数据的children属性名只对多列联动模式有效 1.3.7
* @event {Function} confirm 点击确定按钮返回当前选择的值 * @event {Function} confirm 点击确定按钮返回当前选择的值
* @example <u-select v-model="show" :list="list"></u-select> * @example <u-select v-model="show" :list="list"></u-select>
*/ */
export default { export default {
emits: ["update:modelValue", "input", "confirm","cancel"], emits: ['update:modelValue', 'input', 'confirm', 'cancel'],
props: { props: {
// //
value: { value: {
type: Boolean, type: Boolean,
default: false default: false
}, },
modelValue: { modelValue: {
type: Boolean, type: Boolean,
default: false default: false
}, },
// //
list: { list: {
type: Array, type: Array,
default() { default() {
return []; return []
} }
}, },
// //
border: { border: {
type: Boolean, type: Boolean,
default: true default: true
}, },
// "" // ""
cancelColor: { cancelColor: {
type: String, type: String,
default: '#606266' default: '#606266'
}, },
// "" // ""
confirmColor: { confirmColor: {
type: String, type: String,
default: '#2979ff' default: '#2979ff'
}, },
// z-index // z-index
zIndex: { zIndex: {
type: [String, Number], type: [String, Number],
default: 0 default: 0
}, },
safeAreaInsetBottom: { safeAreaInsetBottom: {
type: Boolean, type: Boolean,
default: false default: false
}, },
// Picker // Picker
maskCloseAble: { maskCloseAble: {
type: Boolean, type: Boolean,
default: true default: true
}, },
// //
defaultValue: { defaultValue: {
type: Array, type: Array,
default() { default() {
return [0]; return [0]
} }
}, },
// single-column-mutil-column-mutil-column-auto- // single-column-mutil-column-mutil-column-auto-
mode: { mode: {
type: String, type: String,
default: 'single-column' default: 'single-column'
}, },
// value // value
valueName: { valueName: {
type: String, type: String,
default: 'value' default: 'value'
}, },
// label // label
labelName: { labelName: {
type: String, type: String,
default: 'label' default: 'label'
}, },
// children // children
childName: { childName: {
type: String, type: String,
default: 'children' default: 'children'
}, },
// //
title: { title: {
type: String, type: String,
default: '' default: ''
}, },
// //
cancelText: { cancelText: {
type: String, type: String,
default: '取消' default: '取消'
}, },
// //
confirmText: { confirmText: {
type: String, type: String,
default: '确认' default: '确认'
}, },
// //
blur: { blur: {
type: [Number, String], type: [Number, String],
default: 0 default: 0
}, }
}, },
data() { data() {
return { return {
popupValue: false, popupValue: false,
// //
defaultSelector: [0], defaultSelector: [0],
// picker-view // picker-view
columnData: [], columnData: [],
// //
selectValue: [], selectValue: [],
// index // index
lastSelectIndex: [], lastSelectIndex: [],
// //
columnNum: 0, columnNum: 0,
// //
moving: false moving: false
}; }
}, },
watch: { watch: {
// select // select
value: { value: {
immediate: true, immediate: true,
handler(val) { handler(val) {
if(val) setTimeout(() => this.init(), 10); if (val) setTimeout(() => this.init(), 10)
this.popupValue = val; this.popupValue = val
} }
}, },
modelValue: { modelValue: {
immediate: true, immediate: true,
handler(val) { handler(val) {
if(val) setTimeout(() => this.init(), 10); if (val) setTimeout(() => this.init(), 10)
this.popupValue = val; this.popupValue = val
} }
}
},
computed: {
uZIndex() {
// z-index使
return this.zIndex ? this.zIndex : this.$u.zIndex.popup
}
},
methods: {
//
pickstart() {
// #ifdef MP-WEIXIN
this.moving = true
// #endif
}, },
}, //
computed: { pickend() {
uZIndex() { // #ifdef MP-WEIXIN
// z-index使 this.moving = false
return this.zIndex ? this.zIndex : this.$u.zIndex.popup; // #endif
}, },
}, init() {
methods: { this.setColumnNum()
// this.setDefaultSelector()
pickstart() { this.setColumnData()
// #ifdef MP-WEIXIN this.setSelectValue()
this.moving = true; },
// #endif //
}, setDefaultSelector() {
// // columnNum0
pickend() { this.defaultSelector = this.defaultValue.length == this.columnNum ? this.defaultValue : Array(this.columnNum).fill(0)
// #ifdef MP-WEIXIN this.lastSelectIndex = this.$u.deepClone(this.defaultSelector)
this.moving = false; },
// #endif //
}, setColumnNum() {
init() { // 1
this.setColumnNum(); if (this.mode == 'single-column') this.columnNum = 1
this.setDefaultSelector(); // this.list
this.setColumnData(); else if (this.mode == 'mutil-column') this.columnNum = this.list.length
this.setSelectValue(); // this.list
}, else if (this.mode == 'mutil-column-auto') {
// let num = 1
setDefaultSelector() { let column = this.list
// columnNum0 // children
this.defaultSelector = this.defaultValue.length == this.columnNum ? this.defaultValue : Array(this.columnNum).fill(0); while (column[0][this.childName]) {
this.lastSelectIndex = this.$u.deepClone(this.defaultSelector); column = column[0] ? column[0][this.childName] : {}
}, num++
// }
setColumnNum() { this.columnNum = num
// 1 }
if(this.mode == 'single-column') this.columnNum = 1; },
// this.list // picker
else if(this.mode == 'mutil-column') this.columnNum = this.list.length; setColumnData() {
// this.list let data = []
else if(this.mode == 'mutil-column-auto') { this.selectValue = []
let num = 1; if (this.mode == 'mutil-column-auto') {
let column = this.list; //
// children let column = this.list[this.defaultSelector.length ? this.defaultSelector[0] : 0]
while(column[0][this.childName]) { //
column = column[0] ? column[0][this.childName] : {}; for (let i = 0; i < this.columnNum; i++) {
num ++; // list
} if (i == 0) {
this.columnNum = num; data[i] = this.list
} column = column[this.childName]
}, } else {
// picker //
setColumnData() { data[i] = column
let data = []; column = column[this.defaultSelector[i]][this.childName]
this.selectValue = []; }
if(this.mode == 'mutil-column-auto') { }
// } else if (this.mode == 'single-column') {
let column = this.list[this.defaultSelector.length ? this.defaultSelector[0] : 0]; data[0] = this.list
// } else {
for (let i = 0; i < this.columnNum; i++) { data = this.list
// list }
if (i == 0) { this.columnData = data
data[i] = this.list; },
column = column[this.childName]; // defaultValue
} else { setSelectValue() {
// let tmp = null
data[i] = column; for (let i = 0; i < this.columnNum; i++) {
column = column[this.defaultSelector[i]][this.childName]; tmp = this.columnData[i][this.defaultSelector[i]]
} const data = {
} value: tmp ? tmp[this.valueName] : null,
} else if(this.mode == 'single-column') { label: tmp ? tmp[this.labelName] : null
data[0] = this.list; }
} else { //
data = this.list; if (tmp && tmp.extra) data.extra = tmp.extra
} this.selectValue.push(data)
this.columnData = data; }
}, },
// defaultValue //
setSelectValue() { columnChange(e) {
let tmp = null; let index = null
for(let i = 0; i < this.columnNum; i++) { const columnIndex = e.detail.value
tmp = this.columnData[i][this.defaultSelector[i]]; // push
let data = { this.selectValue = []
value: tmp ? tmp[this.valueName] : null, if (this.mode == 'mutil-column-auto') {
label: tmp ? tmp[this.labelName] : null //
}; this.lastSelectIndex.map((val, idx) => {
// if (val != columnIndex[idx]) index = idx
if(tmp && tmp.extra) data.extra = tmp.extra; })
this.selectValue.push(data) this.defaultSelector = columnIndex
} for (let i = index + 1; i < this.columnNum; i++) {
}, // children
// //
columnChange(e) { this.columnData[i] = this.columnData[i - 1][i - 1 == index ? columnIndex[index] : 0][this.childName]
let index = null; //
let columnIndex = e.detail.value; this.defaultSelector[i] = 0
// push }
this.selectValue = []; // this.columnDatacolumnChange
if(this.mode == 'mutil-column-auto') { // undefined
// columnIndex.map((item, index) => {
this.lastSelectIndex.map((val, idx) => { const data = this.columnData[index][columnIndex[index]]
if (val != columnIndex[idx]) index = idx; const tmp = {
}); value: data ? data[this.valueName] : null,
this.defaultSelector = columnIndex; label: data ? data[this.labelName] : null
for (let i = index + 1; i < this.columnNum; i++) { }
// children //
// if (data && data.extra !== undefined) tmp.extra = data.extra
this.columnData[i] = this.columnData[i - 1][i - 1 == index ? columnIndex[index] : 0][this.childName]; this.selectValue.push(tmp)
// })
this.defaultSelector[i] = 0; //
} this.lastSelectIndex = columnIndex
// this.columnDatacolumnChange } else if (this.mode == 'single-column') {
// undefined const data = this.columnData[0][columnIndex[0]]
columnIndex.map((item, index) => { //
let data = this.columnData[index][columnIndex[index]]; const tmp = {
let tmp = { value: data ? data[this.valueName] : null,
value: data ? data[this.valueName] : null, label: data ? data[this.labelName] : null
label: data ? data[this.labelName] : null, }
}; //
// if (data && data.extra !== undefined) tmp.extra = data.extra
if(data && data.extra !== undefined) tmp.extra = data.extra; this.selectValue.push(tmp)
this.selectValue.push(tmp); } else if (this.mode == 'mutil-column') {
//
}) columnIndex.map((item, index) => {
// const data = this.columnData[index][columnIndex[index]]
this.lastSelectIndex = columnIndex; //
} else if(this.mode == 'single-column') { const tmp = {
let data = this.columnData[0][columnIndex[0]]; value: data ? data[this.valueName] : null,
// label: data ? data[this.labelName] : null
let tmp = { }
value: data ? data[this.valueName] : null, //
label: data ? data[this.labelName] : null, if (data && data.extra !== undefined) tmp.extra = data.extra
}; this.selectValue.push(tmp)
// })
if(data && data.extra !== undefined) tmp.extra = data.extra; }
this.selectValue.push(tmp); },
} else if(this.mode == 'mutil-column') { close() {
// this.$emit('input', false)
columnIndex.map((item, index) => { this.$emit('update:modelValue', false)
let data = this.columnData[index][columnIndex[index]]; },
// //
let tmp = { getResult(event = null) {
value: data ? data[this.valueName] : null, // #ifdef MP-WEIXIN
label: data ? data[this.labelName] : null, if (this.moving) return
}; // #endif
// if (event) this.$emit(event, this.selectValue)
if(data && data.extra !== undefined) tmp.extra = data.extra; this.close()
this.selectValue.push(tmp); },
}) selectHandler() {
} this.$emit('click')
}, }
close() { }
this.$emit('input', false); }
this.$emit("update:modelValue", false);
},
//
getResult(event = null) {
// #ifdef MP-WEIXIN
if (this.moving) return;
// #endif
if (event) this.$emit(event, this.selectValue);
this.close();
},
selectHandler() {
this.$emit('click');
}
}
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import "../../libs/css/style.components.scss"; @import '../../libs/css/style.components.scss';
.u-select { .u-select {
&__action {
position: relative;
line-height: $u-form-item-height;
height: $u-form-item-height;
&__action { &__icon {
position: relative; position: absolute;
line-height: $u-form-item-height; right: 20rpx;
height: $u-form-item-height; top: 50%;
transition: transform 0.4s;
&__icon { transform: translateY(-50%);
position: absolute; z-index: 1;
right: 20rpx;
top: 50%;
transition: transform .4s;
transform: translateY(-50%);
z-index: 1;
&--reverse { &--reverse {
transform: rotate(-180deg) translateY(50%); transform: rotate(-180deg) translateY(50%);
} }
} }
} }
&__hader { &__hader {
&__title { &__title {
color: $u-content-color; color: $u-content-color;
} }
} }
&--border { &--border {
border-radius: 6rpx; border-radius: 6rpx;
border-radius: 4px; border-radius: 4px;
border: 1px solid $u-form-item-border-color; border: 1px solid $u-form-item-border-color;
} }
&__header { &__header {
@include vue-flex; @include vue-flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
height: 80rpx; height: 80rpx;
padding: 0 40rpx; padding: 0 40rpx;
} }
&__body { &__body {
width: 100%; width: 100%;
height: 300rpx; height: 500rpx;
overflow: hidden; overflow: hidden;
background-color: #fff; background-color: #fff;
&__picker-view { &__picker-view {
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
&__item { &__item {
@include vue-flex; @include vue-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 32rpx; font-size: 32rpx;
color: $u-main-color; color: $u-main-color;
padding: 0 8rpx; padding: 0 8rpx;
} }
} }
} }
} }
</style> </style>

Loading…
Cancel
Save