123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <template>
- <dialog-base class="dialog-body" ref="baseDialog" title="选择批次">
- <uni-section title="请选择批次" type="square">
- <uni-data-select v-model="selectedLot" :localdata="lotList" :clear="false"
- ></uni-data-select>
- </uni-section>
- <view class="add-btn-container uni-row">
- <button type="primary" class="btn" @click="handleConfirm">确认</button>
- </view>
- </dialog-base>
- </template>
- <script setup>
- import {
- ref,
- getCurrentInstance
- } from 'vue'
- const baseDialog = ref(null)
- const emit = defineEmits(['submit'])
- const lotList = ref([])
- const selectedLot = ref(null)
- const open = (data) => {
- console.log(data)
- baseDialog.value.open();
- for (var i = 0; i < data.length; i++) {
- lotList.value[i] = {
- text: data[i].label,
- value: data[i].value
- }
- }
- console.log(lotList.value)
- selectedLot.value = lotList.value[0].value
- }
- const close = () => {
- baseDialog.value.close()
- }
- defineExpose({
- open
- })
- function handleConfirm() {
- let index = lotList.value.findIndex(item =>item.value == selectedLot.value)
- close();
- emit('submit',lotList.value[index]);
- }
- </script>
- <style lang="scss">
- .selected {
- border: 3rpx solid #1684fc;
- border-radius: 8rpx;
- }
- .dialog-body {
- overflow: auto;
- .list-title {
- margin: 10rpx 0 20rpx 0;
- .label {
- font-size: 32rpx;
- font-weight: bold;
- }
- }
- .prompt {
- color: red;
- margin: 8rpx auto 0;
- }
- .list-container {
- width: 94%;
- display: flex;
- align-items: flex-start;
- margin: 10rpx auto;
- padding: 8px 2% 16px 2%;
- border-radius: 8rpx;
- .list-container-item {
- width: 100%;
- border-bottom: 1px solid #e1e1e1;
- border-left: 1px solid #e1e1e1;
- border-right: 1px solid #e1e1e1;
- padding: 12rpx 8rpx;
- box-sizing: border-box;
- .label {
- font-size: 28rpx;
- color: gray;
- width: 140rpx;
- &.value {
- flex: 1;
- }
- }
- }
- }
- .add-btn-container {
- margin-top: 32rpx;
- .btn {
- flex: 1;
- }
- }
- }
- .selectedProcess {
- width: 88%;
- margin: 20rpx auto 40rpx;
- }
- </style>
|