zn-admin-vue3-wcs/src/views/mapPage/realTimeMap/components/storeDialog.vue
2025-05-27 09:39:01 +08:00

183 lines
5.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<Dialog v-model="dialogVisible" title="库位信息" width="660" class="task-dialog">
<div class="store-dialog">
<div class="store-dialog-left">
<div
class="store-dialog-left-item ellipsis"
@click="changeStore(item, index)"
v-for="(item, index) in floorList"
:key="index"
:style="{
background: item.locationUseStatus == 1 ? '#F1BE0B' : '#4DC606',
border: selectIndex == index ? '2px solid #00329F' : '2px solid rgba(0,0,0,0)'
}"
>
<!-- 是否锁定 -->
<el-tooltip class="box-item" effect="light" content="已锁定" placement="top">
<el-icon class="lock-icon" color="#ce1126" size="22" v-if="item.locationLock === 0">
<Lock />
</el-icon>
</el-tooltip>
<!-- 是否禁用 -->
<el-tooltip content="已禁用" placement="top" effect="light">
<el-icon class="enable-icon" color="#ce1126" size="22" v-if="item.locationEnable === 0">
<WarnTriangleFilled />
</el-icon>
</el-tooltip>
<!-- 是否占用 -->
<el-tooltip content="已占用" placement="top" effect="light">
<el-icon
class="occupation-icon"
color="#ce1126"
size="22"
v-if="item.locationUseStatus === 1"
>
<RemoveFilled />
</el-icon>
</el-tooltip>
{{ item.locationNo || '--' }}
</div>
</div>
<el-form label-width="auto" ref="formRef">
<el-form-item label="库位编号">
<el-input v-model="floorList[selectIndex].locationNo" :disabled="true" />
</el-form-item>
<el-form-item label="区域">
<el-input v-model="floorList[selectIndex].areaName" :disabled="true" />
</el-form-item>
<el-form-item label="物料信息">
<el-input v-model="floorList[selectIndex].skuInfo" maxlength="30" show-word-limit />
</el-form-item>
<el-form-item label="状态">
<el-select v-model="floorList[selectIndex].locationUseStatus" placeholder="请选择状态">
<el-option label="空闲" :value="0" />
<el-option label="占用" :value="1" />
</el-select>
</el-form-item>
<el-form-item label="禁用库位">
<el-select
v-model="floorList[selectIndex].locationEnable"
placeholder="剧情选择是否禁用库位"
>
<el-option label="禁用" :value="0" />
<el-option label="启用" :value="1" />
</el-select>
</el-form-item>
</el-form>
</div>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script lang="ts" setup>
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
import * as MapApi from '@/api/map/map'
const dialogVisible = ref(false) // 弹窗的是否展示
const formLoading = ref(false) // 表单的加载中1修改时的数据加载2提交的按钮禁用
const formRef = ref() // 表单 Ref
const formData = ref({
locationNo: undefined, //库位编号
areaName: undefined, //区域名称
locationUseStatus: undefined, //库位状态 0空闲、1占用
locationEnable: undefined, //是否禁用0禁用、1启用
skuInfo: undefined //物料信息
})
const selectIndex = ref(0)
const floorList = ref([])
/** 打开弹窗 */
const open = async (data) => {
floorList.value = data.reverse()
selectIndex.value = 0
dialogVisible.value = true
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 提交表单 */
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
const submitForm = async () => {
// 提交请求
formLoading.value = true
try {
await MapApi.updateBatchHouseLocation(floorList.value)
message.success('操作成功')
emit('success')
dialogVisible.value = false
} finally {
formLoading.value = false
}
}
const changeStore = (item, index) => {
selectIndex.value = index
}
//前往任务管理页面
const { push } = useRouter()
</script>
<style lang="scss" scoped>
.store-dialog {
display: flex;
align-items: flex-end;
}
.store-dialog-left {
margin-right: 40px;
margin-bottom: 18px;
flex-shrink: 0;
.store-dialog-left-item {
width: 230px;
height: 56px;
line-height: 56px;
text-align: center;
margin-top: 3px;
font-family:
PingFangSC,
PingFang SC;
font-weight: 500;
font-size: 18px;
color: #0d162a;
cursor: pointer;
border: 1px solid rgba(0, 0, 0, 0);
position: relative;
}
.ellipsis {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
}
.lock-icon {
position: absolute;
top: 0;
left: 0;
}
.enable-icon {
position: absolute;
bottom: 0;
left: 0;
}
.occupation-icon {
position: absolute;
top: 0;
right: 0;
}
}
</style>