2024-07-19 13:46:52 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div style="margin-bottom: 10px">
|
|
|
|
|
|
<el-config-provider :locale="zhCn">
|
2024-08-04 23:06:03 +08:00
|
|
|
|
<el-row>
|
|
|
|
|
|
<el-input v-model="locationIdQuery" style="width: 256px; margin-right: 10px;" placeholder="库位"
|
|
|
|
|
|
:suffix-icon="Search" />
|
2024-07-19 13:46:52 +08:00
|
|
|
|
<el-button type="primary" @click="search()">搜索</el-button>
|
|
|
|
|
|
<el-button type="warning" @click="reset()">重置</el-button>
|
2024-08-04 23:06:03 +08:00
|
|
|
|
<!-- <el-button type="success" @click="exportExcel()">导出信息</el-button> -->
|
2024-07-19 13:46:52 +08:00
|
|
|
|
</el-row>
|
|
|
|
|
|
<br />
|
2024-08-04 23:06:03 +08:00
|
|
|
|
<el-table :data="locations" stripe border v-loading="loading" class="table-class" max-height="550px"
|
2024-07-19 13:46:52 +08:00
|
|
|
|
highlight-current-row @row-click="getCurrentRow" :header-cell-style="{ 'text-align': 'center' }"
|
|
|
|
|
|
:cell-style="{ 'text-align': 'center' }">
|
|
|
|
|
|
<el-table-column width="65px" fixed="left">
|
|
|
|
|
|
<template v-slot="scope">
|
2024-08-04 23:06:03 +08:00
|
|
|
|
<el-radio :label="scope.row.locationId" v-model="locationId"> </el-radio>
|
2024-07-19 13:46:52 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
2024-08-04 23:06:03 +08:00
|
|
|
|
<el-table-column prop="locationId" label="库位" fixed="left" :formatter="locationFormat" min-width="180px"
|
|
|
|
|
|
show-overflow-tooltip />
|
|
|
|
|
|
<el-table-column prop="areaId" label="库区" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="equipmentId" label="设备号" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="locationType" label="库位类型" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="wRow" label="排" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="wCol" label="列" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="wLayer" label="层" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="wDepth" label="深度" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="isLock" label="锁定" :formatter="isLockFormat" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="locationStatus" label="状态" :formatter="locationStatusFormat" min-width="120px" />
|
|
|
|
|
|
<el-table-column prop="vehicleId" label="料箱" min-width="120px" show-overflow-tooltip />
|
2024-07-19 13:46:52 +08:00
|
|
|
|
<el-table-column fixed="right" label="操作" width="120px" v-if="selVehicle == null">
|
|
|
|
|
|
<template v-slot="scope">
|
2024-08-04 23:06:03 +08:00
|
|
|
|
<el-button plain type="primary" @click="editCurrentRowLocation(scope.row)">编辑</el-button>
|
2024-07-19 13:46:52 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
<br />
|
|
|
|
|
|
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 25, 50]"
|
|
|
|
|
|
:small="false" :disabled="false" :background="false" :default-page-size="10"
|
|
|
|
|
|
layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="search"
|
|
|
|
|
|
@current-change="search" />
|
2024-08-04 23:06:03 +08:00
|
|
|
|
<el-dialog v-model="dialogVisible" title="库位信息" width="40%" draggable :show-close="false">
|
|
|
|
|
|
<el-form ref="locationFormRef" :model="locationFormEntity" :label-position="labelPosition"
|
|
|
|
|
|
label-width="100px" style="max-width: 100%" :rules="rules" status-icon>
|
2024-07-19 13:46:52 +08:00
|
|
|
|
<el-row :gutter="16">
|
|
|
|
|
|
<el-col :span="12" :offset="0">
|
2024-08-04 23:06:03 +08:00
|
|
|
|
<el-form-item label="库位" prop="locationId">
|
|
|
|
|
|
<el-input v-model="locationFormEntity.locationId" :formatter="locationFormat"
|
|
|
|
|
|
disabled />
|
2024-07-19 13:46:52 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="12">
|
2024-08-04 23:06:03 +08:00
|
|
|
|
<el-form-item label="类型" prop="locationType">
|
|
|
|
|
|
<el-input v-model="locationFormEntity.locationType" disabled />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
<el-row :gutter="16">
|
|
|
|
|
|
<el-col :span="12" :offset="0">
|
|
|
|
|
|
<el-form-item label="库区" prop="areaId">
|
|
|
|
|
|
<el-input v-model="locationFormEntity.areaId" disabled />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
|
<el-form-item label="设备号" prop="equipmentId">
|
|
|
|
|
|
<el-input v-model="locationFormEntity.equipmentId" disabled />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
<el-row :gutter="16">
|
|
|
|
|
|
<el-col :span="12" :offset="0">
|
|
|
|
|
|
<el-form-item label="排" prop="wRow">
|
|
|
|
|
|
<el-input v-model="locationFormEntity.wRow" disabled />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
|
<el-form-item label="列" prop="wCol">
|
|
|
|
|
|
<el-input v-model="locationFormEntity.wCol" disabled />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
<el-row :gutter="16">
|
|
|
|
|
|
<el-col :span="12" :offset="0">
|
|
|
|
|
|
<el-form-item label="层" prop="wLayer">
|
|
|
|
|
|
<el-input v-model="locationFormEntity.wLayer" disabled />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
|
<el-form-item label="深度" prop="wDepth">
|
|
|
|
|
|
<el-input v-model="locationFormEntity.wDepth" disabled />
|
2024-07-19 13:46:52 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
<el-row :gutter="16">
|
|
|
|
|
|
<el-col :span="12" :offset="0">
|
2024-08-04 23:06:03 +08:00
|
|
|
|
<el-form-item label="锁定" prop="isLock">
|
|
|
|
|
|
<el-select-v2 v-model="locationFormEntity.isLock" placeholder="请选择是否锁定"
|
|
|
|
|
|
:options="isLockOptions"></el-select-v2>
|
2024-07-19 13:46:52 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="12">
|
2024-08-04 23:06:03 +08:00
|
|
|
|
<el-form-item label="状态" prop="locationStatus">
|
|
|
|
|
|
<el-select-v2 v-model="locationFormEntity.locationStatus" placeholder="请选择库位状态"
|
|
|
|
|
|
:options="locationStatusOptions"></el-select-v2>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
<el-row :gutter="16">
|
|
|
|
|
|
<el-col :span="12" :offset="0">
|
|
|
|
|
|
<el-form-item label="料箱" prop="vehicleId">
|
|
|
|
|
|
<el-input v-model="locationFormEntity.vehicleId" />
|
2024-07-19 13:46:52 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<span class="dialog-footer">
|
|
|
|
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
2024-08-04 23:06:03 +08:00
|
|
|
|
<el-button type="primary" @click="submitLocationInfo(locationFormEntity)">
|
2024-07-19 13:46:52 +08:00
|
|
|
|
确定
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</el-config-provider>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-08-04 23:06:03 +08:00
|
|
|
|
import { getLocations, updateLocation } from '@/api/location.js'
|
|
|
|
|
|
import { Search } from '@element-plus/icons-vue'
|
2024-07-19 13:46:52 +08:00
|
|
|
|
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
|
|
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
|
|
|
import { ref, reactive } from 'vue'
|
2024-08-04 23:06:03 +08:00
|
|
|
|
import { locationStatusFormatter, locationFormatter } from '@/utils/formatter.js'
|
2024-07-19 13:46:52 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'locationsTable',
|
2024-08-04 23:06:03 +08:00
|
|
|
|
// props: ['selVehicle'],
|
|
|
|
|
|
// emits: ['update:selVehicle'],
|
2024-07-19 13:46:52 +08:00
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2024-08-04 23:06:03 +08:00
|
|
|
|
locations: [],
|
2024-07-19 13:46:52 +08:00
|
|
|
|
currentPage: 1,
|
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
|
total: 0,
|
2024-08-04 23:06:03 +08:00
|
|
|
|
locationIdQuery: '',
|
2024-07-19 13:46:52 +08:00
|
|
|
|
loading: true,
|
|
|
|
|
|
dialogVisible: false,
|
2024-08-04 23:06:03 +08:00
|
|
|
|
locationId: '',
|
|
|
|
|
|
locationFormEntity: reactive({}),
|
2024-07-19 13:46:52 +08:00
|
|
|
|
labelPosition: 'top',
|
2024-08-04 23:06:03 +08:00
|
|
|
|
locationFormRef: ref(),
|
2024-07-19 13:46:52 +08:00
|
|
|
|
rules: reactive({
|
2024-08-04 23:06:03 +08:00
|
|
|
|
locationId: [
|
|
|
|
|
|
{ required: true, message: '请输入库位号' }
|
2024-07-19 13:46:52 +08:00
|
|
|
|
],
|
|
|
|
|
|
}),
|
2024-08-04 23:06:03 +08:00
|
|
|
|
// 锁定
|
|
|
|
|
|
isLockOptions: [
|
2024-07-19 13:46:52 +08:00
|
|
|
|
{
|
|
|
|
|
|
value: 0,
|
2024-08-04 23:06:03 +08:00
|
|
|
|
label: '正常'
|
2024-07-19 13:46:52 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
value: 1,
|
2024-08-04 23:06:03 +08:00
|
|
|
|
label: '锁定'
|
2024-07-19 13:46:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
],
|
2024-08-04 23:06:03 +08:00
|
|
|
|
// 状态
|
|
|
|
|
|
locationStatusOptions: [
|
2024-07-19 13:46:52 +08:00
|
|
|
|
{
|
2024-08-04 23:06:03 +08:00
|
|
|
|
value: 0,
|
|
|
|
|
|
label: '空闲'
|
2024-07-19 13:46:52 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-08-04 23:06:03 +08:00
|
|
|
|
value: 1,
|
|
|
|
|
|
label: '占用'
|
2024-07-19 13:46:52 +08:00
|
|
|
|
},
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
this.search()
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
search() {
|
|
|
|
|
|
this.loading = true
|
|
|
|
|
|
const tableRequest = {
|
|
|
|
|
|
pageNo: this.currentPage,
|
|
|
|
|
|
pageSize: this.pageSize,
|
2024-08-04 23:06:03 +08:00
|
|
|
|
locationId: this.locationIdQuery.trim()
|
2024-07-19 13:46:52 +08:00
|
|
|
|
}
|
2024-08-04 23:06:03 +08:00
|
|
|
|
getLocations(tableRequest).then(res => {
|
2024-07-19 13:46:52 +08:00
|
|
|
|
const tableResponse = res.data
|
2024-08-04 23:06:03 +08:00
|
|
|
|
if (tableResponse.code == 0) {
|
|
|
|
|
|
this.locations = tableResponse.returnData.lists
|
|
|
|
|
|
this.total = tableResponse.returnData.total
|
|
|
|
|
|
} else {
|
2024-07-19 13:46:52 +08:00
|
|
|
|
ElMessage.error(tableResponse.message)
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch(err => {
|
2024-08-04 23:06:03 +08:00
|
|
|
|
ElMessage.error('查询库位信息错误' + err.message)
|
2024-07-19 13:46:52 +08:00
|
|
|
|
})
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
},
|
2024-08-04 23:06:03 +08:00
|
|
|
|
locationStatusFormat: (row, column, cellValue, index) => {
|
|
|
|
|
|
return locationStatusFormatter(cellValue)
|
2024-07-19 13:46:52 +08:00
|
|
|
|
},
|
|
|
|
|
|
locationFormat: (row, column, cellValue, index) => {
|
|
|
|
|
|
return locationFormatter(cellValue)
|
|
|
|
|
|
},
|
2024-08-04 23:06:03 +08:00
|
|
|
|
isLockFormat: (row, column, cellValue, index) => {
|
2024-07-19 13:46:52 +08:00
|
|
|
|
if (cellValue == 0) {
|
2024-08-04 23:06:03 +08:00
|
|
|
|
return '正常'
|
2024-07-19 13:46:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (cellValue == 1) {
|
2024-08-04 23:06:03 +08:00
|
|
|
|
return '锁定'
|
2024-07-19 13:46:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
reset() {
|
2024-08-04 23:06:03 +08:00
|
|
|
|
this.locationIdQuery = ''
|
2024-07-19 13:46:52 +08:00
|
|
|
|
this.search()
|
|
|
|
|
|
},
|
2024-08-04 23:06:03 +08:00
|
|
|
|
editCurrentRowLocation(row) {
|
|
|
|
|
|
this.locationFormEntity = {
|
|
|
|
|
|
locationId: row.locationId,
|
|
|
|
|
|
areaId: row.areaId,
|
|
|
|
|
|
equipmentId: row.equipmentId,
|
|
|
|
|
|
locationType: row.locationType,
|
|
|
|
|
|
wRow: row.wRow,
|
|
|
|
|
|
wCol: row.wCol,
|
|
|
|
|
|
wLayer: row.wLayer,
|
|
|
|
|
|
wDepth: row.wDepth,
|
|
|
|
|
|
isLock: row.isLock,
|
|
|
|
|
|
locationStatus: row.locationStatus,
|
|
|
|
|
|
vehicleId: row.vehicleId
|
|
|
|
|
|
}
|
2024-07-19 13:46:52 +08:00
|
|
|
|
this.dialogVisible = true
|
|
|
|
|
|
},
|
2024-08-04 23:06:03 +08:00
|
|
|
|
submitLocationInfo(formData) {
|
2024-07-19 13:46:52 +08:00
|
|
|
|
const request = {
|
2024-08-04 23:06:03 +08:00
|
|
|
|
locationId: formData.locationId,
|
|
|
|
|
|
areaId: formData.areaId,
|
|
|
|
|
|
equipmentId: formData.equipmentId,
|
|
|
|
|
|
locationType: formData.locationType,
|
|
|
|
|
|
wRow: formData.wRow,
|
|
|
|
|
|
wCol: formData.wCol,
|
|
|
|
|
|
wLayer: formData.wLayer,
|
|
|
|
|
|
wDepth: formData.wDepth,
|
|
|
|
|
|
isLock: formData.isLock,
|
|
|
|
|
|
locationStatus: formData.locationStatus,
|
|
|
|
|
|
vehicleId: formData.vehicleId
|
2024-07-19 13:46:52 +08:00
|
|
|
|
}
|
2024-08-04 23:06:03 +08:00
|
|
|
|
updateLocation(request).then(res => {
|
2024-07-19 13:46:52 +08:00
|
|
|
|
if (res.data.code == 0) {
|
|
|
|
|
|
this.dialogVisible = false
|
|
|
|
|
|
ElMessage({
|
2024-08-04 23:06:03 +08:00
|
|
|
|
message: '更新库位信息成功',
|
2024-07-19 13:46:52 +08:00
|
|
|
|
type: 'success',
|
|
|
|
|
|
})
|
|
|
|
|
|
this.search()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
ElMessage.error(res.data.message)
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch(err => {
|
2024-08-04 23:06:03 +08:00
|
|
|
|
ElMessage.error('更新库位信息失败:' + err)
|
2024-07-19 13:46:52 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
getCurrentRow(row) {
|
2024-08-04 23:06:03 +08:00
|
|
|
|
this.locationId = row.locationId
|
|
|
|
|
|
// this.$emit('update:selVehicle', row)
|
2024-07-19 13:46:52 +08:00
|
|
|
|
},
|
2024-08-04 23:06:03 +08:00
|
|
|
|
// exportExcel() {
|
|
|
|
|
|
// const request = {
|
|
|
|
|
|
// vehicleId: formData.vehicleId,
|
|
|
|
|
|
// currentLocation: formData.currentLocation,
|
|
|
|
|
|
// isEmpty: formData.isEmpty,
|
|
|
|
|
|
// vehicleStatus: formData.vehicleStatus
|
|
|
|
|
|
// }
|
|
|
|
|
|
// downloadVehicleExcel(request).then(res => {
|
|
|
|
|
|
// const link = document.createElement('a');//创建a标签
|
|
|
|
|
|
// try {
|
|
|
|
|
|
// // let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
|
|
|
|
|
// let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据
|
|
|
|
|
|
// // let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //拆解获取文件名,如果后端有给返回文件名的话
|
|
|
|
|
|
// let _fileName = "导出料箱信息" + dateFormatter(new Date) + ".xlsx"
|
|
|
|
|
|
// link.style.display = 'none'//隐藏
|
2024-07-19 13:46:52 +08:00
|
|
|
|
|
2024-08-04 23:06:03 +08:00
|
|
|
|
// // 兼容不同浏览器的URL对象
|
|
|
|
|
|
// const url = window.URL || window.webkitURL || window.moxURL
|
|
|
|
|
|
// link.href = url.createObjectURL(blob)
|
|
|
|
|
|
// link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1))
|
|
|
|
|
|
// document.body.appendChild(link)
|
|
|
|
|
|
// link.click()
|
|
|
|
|
|
// document.body.removeChild(link)
|
|
|
|
|
|
// url.revokeObjectURL(link.href)//移除url对象
|
|
|
|
|
|
// } catch (e) {
|
|
|
|
|
|
// ElMessage({
|
|
|
|
|
|
// message: '下载文件失败:: ' + e,
|
|
|
|
|
|
// type: 'error',
|
|
|
|
|
|
// showClose: true
|
|
|
|
|
|
// })
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }).catch(err => {
|
|
|
|
|
|
// ElMessage({
|
|
|
|
|
|
// message: '导出失败:: ' + err,
|
|
|
|
|
|
// type: 'error',
|
|
|
|
|
|
// showClose: true
|
|
|
|
|
|
// })
|
|
|
|
|
|
// })
|
|
|
|
|
|
// },
|
2024-07-19 13:46:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.el-pagination {
|
|
|
|
|
|
padding-left: 5px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-row .el-button {
|
|
|
|
|
|
width: 72px;
|
|
|
|
|
|
margin-left: 0px;
|
|
|
|
|
|
margin-right: 5px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.table-class {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
/* font-size: 5px; */
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-row .el-form-item {
|
|
|
|
|
|
width: 10% inherit;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-row .el-form-item .el-select-v2 {
|
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-row .el-form-item .el-input-number {
|
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-row .el-form-item .el-button {
|
|
|
|
|
|
margin: auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|