ckgl/pages/whiteEmbryo/w-libraryLocation.vue
2024-12-26 16:45:53 +08:00

189 lines
4.7 KiB
Vue

<script lang="ts" setup>
import { ref } from 'vue'
const showPop = ref(false)
const list = ref([{}] as any[])
const form = ref({ list: [{}] } as any)
const showPicker = ref(false)
const popuList = ref([] as any[])
const onClickLeft = () => {
history.back()
}
const onClickRight = () => {
showPop.value = true
}
const edit = (item : any) => {
console.log(item)
showPop.value = true
}
const onSubmit = () => {
}
//选择框事件
const choosePic = (type : any, index : any) => {
showPicker.value = true
}
//选择框确认
const pickerConfirm = (val : any) => {
form.value.name = val.selectedValues[0]
showPickerCancel()
}
//取消
const showPickerCancel = () => {
showPicker.value = false
}
//弹窗开启事件
const handleOpen = () => {
popuList.value = []
}
</script>
<template>
<view class="flex">
<van-nav-bar title="库位号维护" left-text="返回" left-arrow right-text="新增" @click-left="onClickLeft"
@click-right="onClickRight" />
<view class="content">
<view class="grid-container">
<view class="grid-item">库位号</view>
<view class="grid-item">位置</view>
<view class="grid-item">状态</view>
<view class="grid-item">操作</view>
</view>
<view class="grid-container" v-for="(item,index) in list" :key="index">
<view class="grid-item">{{item.name}}</view>
<view class="grid-item">{{item.name}}</view>
<view class="grid-item">{{item.id}}</view>
<view class="grid-item"><span style="color: #35a5f7" @click="edit(item)">编辑</span> &nbsp;&nbsp; <span
style="color: red">删除
</span></view>
</view>
</view>
</view>
<van-popup v-model:show="showPop" style="width: 80%" round>
<view>
<h3 style="text-align: center">新增</h3>
<van-form @submit="onSubmit">
<van-cell-group inset>
<van-field v-model="form.name" name="货架号" label="货架号" colon class="bor-b" label-width="5em"
:rules="[{ required: true, message: '请填写' }]" />
<van-field v-model="form.name" name="列号" label="列号" colon class="bor-b" label-width="5em"
:rules="[{ required: true, message: '请填写' }]" />
<van-field v-model="form.name" name="层号" label="层号" colon class="bor-b" label-width="5em"
:rules="[{ required: true, message: '请填写' }]" />
<van-field v-model="form.name" name="库位号" label="库位号" colon readonly label-width="5em" />
<van-field v-model="form.name" name="所在仓库" label="所在仓库" colon readonly class="bor"
@click="choosePic" label-width="5em" />
<van-field v-model="form.name" name="最大存储量" label="最大存储量" colon class="bor-b" label-width="5em" />
<van-field name="状态" label="状态" colon label-width="5em"
:rules="[{ required: true, message: '请选择' }]" class="nonBom">
<template #input>
<van-radio-group v-model="form.type1" direction="horizontal">
<van-radio name="1">启用</van-radio>
<van-radio name="2">禁用</van-radio>
</van-radio-group>
</template>
</van-field>
</van-cell-group>
<view class="a-c">
<van-button type="danger" @click="showPop=false">取消</van-button>
<van-button type="primary" native-type="submit">确认</van-button>
</view>
</van-form>
</view>
</van-popup>
<!--选择框-->
<van-popup v-model:show="showPicker" round position="bottom" @open="handleOpen">
<van-picker show-toolbar :columns="popuList" @confirm="pickerConfirm" @cancel="showPickerCancel"
ref="pickerRef" />
</van-popup>
</template>
<style scoped lang="scss">
.flex {
display: flex;
flex-direction: column;
height: 100vh;
width: 100vw;
.van-nav-bar {
width: 100%;
}
.content {
flex: 1;
padding: 0 10px;
.grid-container {
display: grid;
grid-template-columns: 2fr 1.2fr 1.2fr 2fr;
.grid-item {
border: 1px solid #f2f2f2;
text-align: center;
::v-deep(.van-cell) {
padding: 0 5px;
}
}
}
.card {
margin: 10px 15px;
padding: 5px;
border: 1px solid #02a7f0;
border-radius: 10px;
}
}
}
.a-b {
display: flex;
margin-bottom: 10px;
::v-deep .van-cell {
padding: 0;
}
}
::v-deep .van-field {
font-size: 16px;
}
.bor-b {
::v-deep .van-field__control {
border-bottom: 1px solid #d7d7d7;
}
}
.nonBom {
::v-deep .van-field__control {
border-bottom: none;
}
}
::v-deep .van-field__label {
text-align: end;
}
.a-c {
display: flex;
align-items: center;
justify-content: space-around;
margin: 15px;
::v-deep .van-button--normal {
padding: 5px;
height: 30px;
}
}
.bor {
::v-deep .van-field__control {
border: 1px solid #d7d7d7;
text-align: center;
}
}
</style>