前端优化
This commit is contained in:
parent
f41f130077
commit
b90b620d2e
|
|
@ -2,7 +2,7 @@ import request from "@/http/request";
|
|||
|
||||
const getTaskRecords = (params) => {
|
||||
return request({
|
||||
url: '/record/getTaskRecords',
|
||||
url: '/record/getTaskRecordByPage',
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import request from "@/http/request";
|
|||
|
||||
const sendGoodsInTask = (params) => {
|
||||
return request({
|
||||
url: '/task/sendGoodsInTask',
|
||||
url: '/task/requestIn',
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
|
|
@ -10,7 +10,7 @@ const sendGoodsInTask = (params) => {
|
|||
|
||||
const sendGoodsOutTask = (params) => {
|
||||
return request({
|
||||
url: '/task/sendGoodsOutTask',
|
||||
url: '/task/requestOut',
|
||||
method: 'post',
|
||||
data: params
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import axios from 'axios'
|
||||
|
||||
const request = axios.create({
|
||||
baseURL: 'http://10.18.61.7:12315/wms',
|
||||
baseURL: 'http://localhost:12315/wms',
|
||||
timeout: 5000
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
</legend>
|
||||
<el-table :data="tempTasks" stripe border class="table-class" max-height="684px"
|
||||
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }">
|
||||
<el-table-column prop="goodsType" label="型号" fixed="left" min-width="120px" />
|
||||
<el-table-column prop="specification" label="规格" fixed="left" min-width="120px" />
|
||||
<el-table-column prop="batchNo" label="批次号" min-width="120px" />
|
||||
<el-table-column prop="quantity" label="数量" min-width="120px" />
|
||||
<el-table-column prop="barCode" label="条码" min-width="120px" />
|
||||
<el-table-column prop="standId" label="入库站台" min-width="120px" />
|
||||
<el-table-column prop="position" label="入库位置" min-width="120px" />
|
||||
<el-table-column prop="vehicleId" label="载具号" fixed="left" min-width="120px" />
|
||||
<el-table-column prop="goodsId" label="物料编号" fixed="left" min-width="120px" />
|
||||
<el-table-column prop="goodsNum" label="数量" min-width="120px" />
|
||||
<el-table-column prop="goodsName" label="物料名称" min-width="120px" />
|
||||
<el-table-column prop="singleWeight" label="单个物料重量" min-width="120px" />
|
||||
<el-table-column prop="weight" label="物料总重量" min-width="120px" />
|
||||
<el-table-column prop="originPoint" label="入库站点" min-width="120px" />
|
||||
<el-table-column fixed="right" label="操作" width="120px">
|
||||
<template #default>
|
||||
<el-button plain type="primary" @click="deleteRowTask(row)">删除</el-button>
|
||||
|
|
@ -30,50 +30,63 @@
|
|||
<el-form ref="taskInRequestRef" :model="taskInRequestEntity" :label-position="labelPosition"
|
||||
label-width="100px" style="max-width: 100%" :rules="rules" status-icon>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="24" :offset="0">
|
||||
<el-form-item label="条码号" prop="barCode">
|
||||
<el-input v-model="taskInRequestEntity.barCode" />
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="载具号" prop="vehicleId">
|
||||
<el-input v-model="taskInRequestEntity.vehicleId" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料编号" prop="goodsId">
|
||||
<el-input v-model="taskInRequestEntity.goodsId" :disabled="disabledEmpty"
|
||||
clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="型号" prop="goodsType">
|
||||
<el-input v-model="taskInRequestEntity.goodsType" />
|
||||
<el-form-item label="数量" prop="goodsNum">
|
||||
<el-input-number v-model.number="taskInRequestEntity.goodsNum" clearable
|
||||
controls-position="right" :min="1" :disabled="disabledEmpty"
|
||||
@blur="calWeight(taskInRequestEntity)"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规格" prop="specification">
|
||||
<el-input v-model="taskInRequestEntity.specification" />
|
||||
<el-form-item label="物料名称" prop="goodsName">
|
||||
<el-input v-model="taskInRequestEntity.goodsName" :disabled="disabledEmpty"
|
||||
clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="批次号" prop="batchNo">
|
||||
<el-input v-model="taskInRequestEntity.batchNo" />
|
||||
<el-form-item label="单个物料重量" prop="singleWeight">
|
||||
<el-input-number v-model.number="taskInRequestEntity.singleWeight" clearable
|
||||
controls-position="right" :min="0" :precision="3" :disabled="disabledEmpty"
|
||||
@blur="calWeight(taskInRequestEntity)"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="数量" prop="quantity">
|
||||
<el-input-number v-model.number="taskInRequestEntity.quantity" clearable
|
||||
controls-position="right" :min="1"></el-input-number>
|
||||
<el-form-item label="物料总重量" prop="weight">
|
||||
<el-input-number v-model.number="taskInRequestEntity.weight" clearable
|
||||
controls-position="right" :min="0" :precision="3"
|
||||
:disabled="disabledEmpty"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="入库位置" prop="position">
|
||||
<el-select-v2 v-model="taskInRequestEntity.position" placeholder="请选择入库位置"
|
||||
:options="positionOptions" :disabled="disabledEmpty"></el-select-v2>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="入库站台" prop="standId">
|
||||
<el-select-v2 v-model="taskInRequestEntity.standId" placeholder="请选择入库站台"
|
||||
<el-form-item label="入库站点" prop="originPoint">
|
||||
<el-select-v2 v-model="taskInRequestEntity.originPoint" placeholder="请选择入库站点"
|
||||
:options="standOptions"></el-select-v2>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否空托" prop="isEmpty">
|
||||
<el-select-v2 v-model="taskInRequestEntity.isEmpty" placeholder="请选择入库类型"
|
||||
:options="stockTypeOptions"
|
||||
@change="autoCompleteEmptyInfo(taskInRequestEntity)"></el-select-v2>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16" class="btn-area">
|
||||
<el-col :span="8" :offset="0">
|
||||
|
|
@ -103,10 +116,10 @@
|
|||
|
||||
<script setup>
|
||||
import { sendGoodsInTask } from '@/api/task'
|
||||
import { genTaskId } from '@/utils/stringUtils'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import store from '@/store'
|
||||
const taskInRequestRef = ref()
|
||||
</script>
|
||||
|
||||
|
|
@ -117,63 +130,47 @@ export default {
|
|||
return {
|
||||
labelPosition: "top",
|
||||
tempTasks: [],
|
||||
tempStandId: '',
|
||||
tempVehicleId: '',
|
||||
tempOriginPoint: '',
|
||||
totalWeight: 0,
|
||||
isEmptyTask: false,
|
||||
disabledEmpty: false,
|
||||
taskInRequestEntity: reactive({
|
||||
barCode: '',// 条码号
|
||||
goodsType: '',// 型号
|
||||
specification: '',// 规格
|
||||
batchNo: '',// 批次号
|
||||
quantity: 1,// 数量
|
||||
weight: 1.0,// 零件重量
|
||||
position: null,
|
||||
standId: null
|
||||
vehicleId: '',
|
||||
originPoint: 'R1',
|
||||
goodsId: '',
|
||||
goodsName: '',
|
||||
singleWeight: 0,
|
||||
goodsNum: 1,
|
||||
weight: 0,
|
||||
isEmpty: '1'
|
||||
}),
|
||||
rules: reactive({
|
||||
barCode: [
|
||||
{ required: true, message: '请扫描条码号' }
|
||||
vehicleId: [
|
||||
{ required: true, message: '请输入载具号' }
|
||||
],
|
||||
goodsType: [
|
||||
{ required: true, message: '请输入型号' }
|
||||
goodsId: [
|
||||
{ required: true, message: '请输入物料号' }
|
||||
],
|
||||
specification: [
|
||||
{ required: true, message: '请输入规格' }
|
||||
],
|
||||
batchNo: [
|
||||
{ required: true, message: '请输入批次号' }
|
||||
],
|
||||
quantity: [
|
||||
goodsNum: [
|
||||
{ required: true, message: '请输入数量' },
|
||||
{ type: 'number', message: '请输入数字' }
|
||||
],
|
||||
position: [
|
||||
{ required: true, message: '请选择入库位置' }
|
||||
],
|
||||
standId: [
|
||||
{ required: true, message: '请选择入库站台' }
|
||||
],
|
||||
]
|
||||
}),
|
||||
standOptions: [
|
||||
{
|
||||
value: "R1",
|
||||
label: '入库站台1'
|
||||
},
|
||||
{
|
||||
value: "R2",
|
||||
label: '入库站台2'
|
||||
}
|
||||
],
|
||||
positionOptions: [
|
||||
stockTypeOptions: [
|
||||
{
|
||||
value: 1,
|
||||
label: '1号位置'
|
||||
value: '0',
|
||||
label: '空载具入库'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: '2号位置'
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: '3号位置'
|
||||
value: '1',
|
||||
label: '带料入库'
|
||||
}
|
||||
],
|
||||
}
|
||||
|
|
@ -181,6 +178,28 @@ export default {
|
|||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
autoCompleteEmptyInfo(taskInRequestEntity) {// 自动补全空托入库信息
|
||||
if (taskInRequestEntity.isEmpty == '0') {// 空托入库
|
||||
taskInRequestEntity.goodsId = 'empty'
|
||||
taskInRequestEntity.goodsName = '空载具'
|
||||
taskInRequestEntity.goodsNum = 1
|
||||
taskInRequestEntity.singleWeight = 0
|
||||
taskInRequestEntity.weight = 0
|
||||
this.disabledEmpty = true
|
||||
} else {
|
||||
taskInRequestEntity.goodsId = ''
|
||||
taskInRequestEntity.goodsName = ''
|
||||
taskInRequestEntity.goodsNum = 1
|
||||
taskInRequestEntity.singleWeight = 0
|
||||
taskInRequestEntity.weight = 0
|
||||
this.disabledEmpty = false
|
||||
}
|
||||
},
|
||||
calWeight(taskInRequestEntity) {
|
||||
if (taskInRequestEntity.singleWeight != null | undefined) {
|
||||
taskInRequestEntity.weight = taskInRequestEntity.singleWeight * taskInRequestEntity.goodsNum
|
||||
}
|
||||
},
|
||||
addTempTasks(taskInRequestRef) {// 生成入库任务
|
||||
if (!taskInRequestRef) return
|
||||
taskInRequestRef.validate((valid) => {
|
||||
|
|
@ -191,33 +210,64 @@ export default {
|
|||
})
|
||||
return
|
||||
}
|
||||
if (this.tempStandId != '' && this.tempStandId != this.taskInRequestEntity.standId) {
|
||||
if (this.isEmptyTask != null | undefined) {
|
||||
if (this.isEmptyTask) {
|
||||
ElMessage({
|
||||
message: '当前载具已绑定空载具入库',
|
||||
type: 'warning',
|
||||
})
|
||||
return
|
||||
} else {
|
||||
if (this.taskInRequestEntity.isEmpty == '1' && this.tempTasks.length != 0) {
|
||||
ElMessage({
|
||||
message: '当前载具已绑定过任务,不允许再绑定空载具入库',
|
||||
type: 'warning',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.tempOriginPoint != '' && this.tempOriginPoint != this.taskInRequestEntity.originPoint) {
|
||||
ElMessage({
|
||||
message: '入库站台不一致!',
|
||||
type: 'warning',
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.tempTasks.find((task) => task.position == this.taskInRequestEntity.position) != null) {
|
||||
if (this.tempVehicleId != '' && this.tempVehicleId != this.taskInRequestEntity.vehicleId) {
|
||||
ElMessage({
|
||||
message: '入库位置重复!',
|
||||
message: '载具号不一致',
|
||||
type: 'warning',
|
||||
})
|
||||
return
|
||||
}
|
||||
this.tempStandId = this.taskInRequestEntity.standId
|
||||
this.tempVehicleId = this.taskInRequestEntity.vehicleId
|
||||
this.tempOriginPoint = this.taskInRequestEntity.originPoint
|
||||
this.totalWeight = this.totalWeight + this.taskInRequestEntity.weight
|
||||
if (this.taskInRequestEntity.isEmpty == '0') {
|
||||
this.isEmptyTask = true
|
||||
} else {
|
||||
this.isEmptyTask = false
|
||||
}
|
||||
const tempTask = {
|
||||
barCode: this.taskInRequestEntity.barCode,// 条码号
|
||||
goodsType: this.taskInRequestEntity.goodsType,// 型号
|
||||
specification: this.taskInRequestEntity.specification,// 规格
|
||||
batchNo: this.taskInRequestEntity.batchNo,// 批次号
|
||||
quantity: this.taskInRequestEntity.quantity,// 数量
|
||||
position: this.taskInRequestEntity.position,
|
||||
standId: this.taskInRequestEntity.standId,
|
||||
vehicleId: this.taskInRequestEntity.vehicleId,
|
||||
originPoint: this.taskInRequestEntity.originPoint,
|
||||
goodsId: this.taskInRequestEntity.goodsId,
|
||||
goodsName: this.taskInRequestEntity.goodsName,
|
||||
singleWeight: this.taskInRequestEntity.singleWeight,
|
||||
goodsNum: this.taskInRequestEntity.goodsNum,
|
||||
weight: this.taskInRequestEntity.weight
|
||||
}
|
||||
this.tempTasks.push(tempTask)
|
||||
taskInRequestRef.resetFields()
|
||||
// 清空物料相关信息
|
||||
if (!this.isEmptyTask) {
|
||||
this.taskInRequestEntity.goodsId = ''
|
||||
this.taskInRequestEntity.goodsName = ''
|
||||
this.taskInRequestEntity.goodsNum = 1
|
||||
this.taskInRequestEntity.singleWeight = 0
|
||||
this.taskInRequestEntity.weight = 0
|
||||
this.taskInRequestEntity.isEmpty = '1'
|
||||
this.disabledEmpty = false
|
||||
}
|
||||
ElMessage({
|
||||
message: '绑定成功!',
|
||||
type: 'success',
|
||||
|
|
@ -226,10 +276,11 @@ export default {
|
|||
},
|
||||
submitGoodsInTask(formEl) {// 下发入库任务
|
||||
const inParams = {
|
||||
standId: this.tempStandId,
|
||||
taskId: genTaskId(''),
|
||||
taskType: 1,
|
||||
detailTaskInfoList: this.tempTasks
|
||||
vehicleId: this.tempVehicleId,
|
||||
originPoint: this.tempOriginPoint,
|
||||
totalWeight: this.totalWeight,
|
||||
userName: store.getters.getUserName,
|
||||
goodsList: this.isEmptyTask == false && this.tempTasks.length > 0 ? this.tempTasks : null
|
||||
}
|
||||
sendGoodsInTask(inParams).then(res => {
|
||||
if (res.data.code == 0) {
|
||||
|
|
@ -238,8 +289,12 @@ export default {
|
|||
type: 'success',
|
||||
})
|
||||
this.tempTasks = []
|
||||
this.tempStandId = ''
|
||||
this.tempVehicleId = ''
|
||||
this.tempOriginPoint = ''
|
||||
this.totalWeight = 0
|
||||
this.isEmptyTask == false
|
||||
formEl.resetFields()
|
||||
this.disabledEmpty = false
|
||||
} else {
|
||||
ElMessage.error(res.data.message)
|
||||
}
|
||||
|
|
@ -255,7 +310,10 @@ export default {
|
|||
deleteRowTask(row) {// 删除当前行的入库任务
|
||||
this.tempTasks.splice(this.tempTasks.indexOf(row), 1)
|
||||
if (this.tempTasks.length == 0) {
|
||||
this.tempVehicleNo = ''
|
||||
this.tempVehicleId = ''
|
||||
this.tempOriginPoint = ''
|
||||
this.totalWeight = 0
|
||||
this.isEmptyTask = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
<div style="margin-bottom: 15px">
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-row>
|
||||
<el-input v-model="goodsTypeQuery" style="width: 256px; margin-right: 10px;" placeholder="型号" />
|
||||
<el-input v-model="specificationQuery" style="width: 256px; margin-right: 10px;" placeholder="规格" />
|
||||
<el-input v-model="vehicleIdQuery" style="width: 256px; margin-right: 10px;" placeholder="载具号" />
|
||||
<el-input v-model="goodsIdQuery" style="width: 256px; margin-right: 10px;" placeholder="物料编号" />
|
||||
<el-button type="primary" @click="search()">搜索</el-button>
|
||||
<el-button type="warning" @click="reset()">重置</el-button>
|
||||
<el-button type="success" @click="exportExcel()">导出记录</el-button>
|
||||
|
|
@ -56,8 +56,8 @@ export default {
|
|||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
goodsTypeQuery: '',
|
||||
specificationQuery: '',
|
||||
goodsIdQuery: '',
|
||||
vehicleIdQuery: '',
|
||||
loading: true
|
||||
}
|
||||
},
|
||||
|
|
@ -85,24 +85,21 @@ export default {
|
|||
},
|
||||
search() {
|
||||
this.loading = true
|
||||
this.pageInfo.pageNum = this.currentPage
|
||||
this.pageInfo.pageSize = this.pageSize
|
||||
const tableRequest = {
|
||||
page: this.pageInfo,
|
||||
param: {
|
||||
taskType: 1,
|
||||
goodsType: this.goodsTypeQuery.trim(),
|
||||
specification: this.specificationQuery.trim(),
|
||||
userName: store.getters.getUserName
|
||||
}
|
||||
pageNo: this.currentPage,
|
||||
pageSize: this.pageSize,
|
||||
taskType: 1,
|
||||
goodsId: this.goodsIdQuery.trim(),
|
||||
vehicleId: this.vehicleIdQuery.trim()
|
||||
}
|
||||
getTaskRecords(tableRequest).then(res => {
|
||||
console.log(res.data)
|
||||
const tableResponse = res.data
|
||||
if (tableResponse.code != 0) {
|
||||
ElMessage.error(tableResponse.message)
|
||||
}
|
||||
this.tasks = tableResponse.rows
|
||||
this.total = tableResponse.total
|
||||
this.tasks = tableResponse.returnData.lists
|
||||
this.total = tableResponse.returnData.total
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
ElMessage.error('查询任务记录错误')
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div style="margin-bottom: 10px">
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-row>
|
||||
<el-input v-model="queryKey" style="width: 256px; margin-right: 10px;" placeholder="型号/规格/批次号"
|
||||
<el-input v-model="goodsIdQuery" style="width: 256px; margin-right: 10px;" placeholder="物料编号"
|
||||
:suffix-icon="Search" />
|
||||
<el-button type="primary" @click="search()">搜索</el-button>
|
||||
<el-button type="warning" @click="reset()">重置</el-button>
|
||||
|
|
@ -17,17 +17,13 @@
|
|||
<el-radio :label="scope.row.stockId" v-model="stockId"> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="goodsType" label="型号" fixed="left" min-width="120px" />
|
||||
<el-table-column prop="specification" label="规格" fixed="left" min-width="120px" />
|
||||
<el-table-column prop="barcode" label="条码号" min-width="120px" />
|
||||
<el-table-column prop="batchNo" label="批次号" min-width="120px" />
|
||||
<el-table-column prop="originNum" label="入库数量" min-width="120px" />
|
||||
<el-table-column prop="realNum" label="实际数量" min-width="120px" />
|
||||
<el-table-column prop="vehicleId" label="型号" fixed="left" min-width="120px" />
|
||||
<el-table-column prop="goodsRelated.goodsId" label="规格" fixed="left" min-width="120px" />
|
||||
<el-table-column prop="locationId" label="库位" :formatter="locationFormat" min-width="120px" />
|
||||
<el-table-column prop="isInventory" label="是否盘点" min-width="120px" />
|
||||
<el-table-column prop="orderId" label="订单号" min-width="120px" />
|
||||
<el-table-column prop="createTime" label="上架时间" :formatter="timeFormat" min-width="140px" />
|
||||
<el-table-column prop="goodsStatus" label="物料状态" :formatter="goodsStatusFormat" min-width="120px" />
|
||||
<el-table-column prop="goodsRelated.goodsStatus" label="物料状态" :formatter="goodsStatusFormat" min-width="120px" />
|
||||
<el-table-column prop="stockStatus" label="库存状态" :formatter="stockStatusFormat" fixed="right"
|
||||
min-width="120px" />
|
||||
<el-table-column fixed="right" label="操作" width="120px" v-if="selStock == null">
|
||||
|
|
@ -145,6 +141,7 @@ export default {
|
|||
pageSize: 10,
|
||||
total: 0,
|
||||
queryKey: '',
|
||||
goodsIdQuery: '',
|
||||
loading: true,
|
||||
stockId: '',
|
||||
stockFormRef: ref(),
|
||||
|
|
@ -283,19 +280,18 @@ export default {
|
|||
},
|
||||
search() {
|
||||
this.loading = true
|
||||
this.pageInfo.pageNum = this.currentPage
|
||||
this.pageInfo.pageSize = this.pageSize
|
||||
const tableRequest = {
|
||||
page: this.pageInfo,
|
||||
param: this.queryKey.trim(),
|
||||
const request = {
|
||||
pageNo: this.currentPage,
|
||||
pageSize: this.pageSize,
|
||||
goodsId: this.goodsIdQuery.trim()
|
||||
}
|
||||
getAllStocks(tableRequest).then(res => {
|
||||
getAllStocks(request).then(res => {
|
||||
const tableResponse = res.data
|
||||
if (tableResponse.code != 0) {
|
||||
console.log(tableResponse.code + ':' + tableResponse.message)
|
||||
ElMessage.error(tableResponse.message)
|
||||
}
|
||||
this.displayStocks = tableResponse.rows
|
||||
this.displayStocks = tableResponse.lists
|
||||
this.total = tableResponse.total
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
|
|
|
|||
359
src/layout/vehicles.vue
Normal file
359
src/layout/vehicles.vue
Normal file
|
|
@ -0,0 +1,359 @@
|
|||
<template>
|
||||
<div style="margin-bottom: 10px">
|
||||
<el-config-provider :locale="zhCn">
|
||||
<el-row style="margin-top: 10px;">
|
||||
<el-input v-model="vehicleIdQuery" style="width: 256px; margin-right: 10px;" placeholder="零件号" />
|
||||
<el-button type="primary" @click="search()">搜索</el-button>
|
||||
<el-button type="warning" @click="reset()">重置</el-button>
|
||||
<el-button type="success" @click="exportExcel()">导出信息</el-button>
|
||||
</el-row>
|
||||
<br />
|
||||
<el-table :data="partInfos" stripe border v-loading="loading" class="table-class" max-height="650px"
|
||||
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">
|
||||
<el-radio :label="scope.row.material" v-model="material"> </el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="material" label="零件号" fixed="left" sortable min-width="120px" />
|
||||
<el-table-column prop="itemDesc" label="描述" fixed="left" min-width="120px" />
|
||||
<el-table-column prop="category" label="零件类型" fixed="left" sortable min-width="120px" />
|
||||
<el-table-column prop="categoryRemark" label="策略" min-width="120px" />
|
||||
<el-table-column prop="unloadPlace" label="卸货点" min-width="120px" />
|
||||
<el-table-column prop="kittingPoint" label="配料点" min-width="120px" />
|
||||
<el-table-column prop="property" label="可用性" min-width="120px" />
|
||||
<el-table-column prop="vendorId" label="供应商代码" min-width="120px" />
|
||||
<el-table-column prop="dataOwner" label="数据负责人" min-width="120px" />
|
||||
<el-table-column prop="partWeight" label="重量" min-width="120px" />
|
||||
<el-table-column prop="storageLocation" label="库位" min-width="120px" />
|
||||
<el-table-column prop="storageType" label="存储类型" min-width="120px" />
|
||||
<el-table-column prop="storageBin" label="BIN位" min-width="120px" />
|
||||
<el-table-column prop="vendorNameEN" label="供应商名称(英文)" min-width="120px" />
|
||||
<el-table-column prop="vendorNameCN" label="供应商名称(中文)" min-width="120px" />
|
||||
<el-table-column prop="vendorCountry" label="供应商国家/地区" min-width="120px" />
|
||||
<el-table-column prop="SLED" label="SLED" min-width="120px" />
|
||||
<el-table-column prop="updateDate" label="更新日期" min-width="120px" />
|
||||
<el-table-column fixed="right" label="操作" width="240px">
|
||||
<template v-slot="scope">
|
||||
<el-button plain type="primary" @click="editCurrentRowGoods(scope.row)">编辑</el-button>
|
||||
<el-button plain type="danger" @click="deleteCurrentRowGoods(scope.row)">删除</el-button>
|
||||
</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" />
|
||||
<el-dialog v-model="dialogVisible" title="物料信息" width="40%" draggable :show-close="false">
|
||||
<el-form ref="goodsFormRef" :model="goodsFormEntity" :label-position="labelPosition" label-width="100px"
|
||||
style="max-width: 100%" :rules="rules" status-icon>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="零件号" prop="material">
|
||||
<el-input v-model="goodsFormEntity.material" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="描述" prop="itemDesc">
|
||||
<el-input v-model="goodsFormEntity.itemDesc" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="零件类型" prop="category">
|
||||
<el-input v-model="goodsFormEntity.category" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="策略" prop="categoryRemark">
|
||||
<el-input v-model="goodsFormEntity.categoryRemark" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="卸货点" prop="unloadPlace">
|
||||
<el-input v-model="goodsFormEntity.unloadPlace" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="配料点" prop="kittingPoint">
|
||||
<el-input v-model="goodsFormEntity.kittingPoint" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="可用性" prop="property">
|
||||
<el-input v-model="goodsFormEntity.property" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供应商代码" prop="vendorId">
|
||||
<el-input v-model="goodsFormEntity.vendorId" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="数据负责人" prop="dataOwner">
|
||||
<el-input v-model="goodsFormEntity.dataOwner" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="重量" prop="partWeight">
|
||||
<el-input v-model="goodsFormEntity.partWeight" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="库位" prop="storageLocation">
|
||||
<el-input v-model="goodsFormEntity.storageLocation" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="存储类型" prop="storageType">
|
||||
<el-input v-model="goodsFormEntity.storageType" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="BIN位" prop="storageBin">
|
||||
<el-input v-model="goodsFormEntity.storageBin" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供应商名称(英文)" prop="vendorNameEN">
|
||||
<el-input v-model="goodsFormEntity.vendorNameEN" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="供应商名称(中文)" prop="vendorNameCN">
|
||||
<el-input v-model="goodsFormEntity.vendorNameCN" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供应商国家/地区" prop="vendorCountry">
|
||||
<el-input v-model="goodsFormEntity.vendorCountry" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="SLED" prop="SLED">
|
||||
<el-input-number v-model.number="goodsFormEntity.SLED" clearable controls-position="right"
|
||||
:min="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="更新日期" prop="updateDate">
|
||||
<el-input v-model="goodsFormEntity.updateDate" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitGoodsInfo(goodsFormEntity)">
|
||||
确定
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-config-provider>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getPartInfo, updatePartInfo, deleteCurrentPartInfo } from '@/api/goods.js'
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
import { dateFormatter } from '@/utils/formatter.js'
|
||||
import UploadExcelPart from '@/excel/UploadExcelPart.vue'
|
||||
import { downloadMaterialExcel } from '@/api/excel.js'
|
||||
</script>
|
||||
<script>
|
||||
export default {
|
||||
name: 'goods',
|
||||
data() {
|
||||
return {
|
||||
partInfos: [],
|
||||
pageInfo: {},
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
queryKey: '',
|
||||
loading: true,
|
||||
dialogVisible: false,
|
||||
material: '',
|
||||
goodsFormEntity: reactive({}),
|
||||
labelPosition: 'top',
|
||||
goodsFormRef: ref(),
|
||||
rules: reactive({})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.search()
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
this.loading = true
|
||||
this.pageInfo.pageNum = this.currentPage
|
||||
this.pageInfo.pageSize = this.pageSize
|
||||
const tableRequest = {
|
||||
page: this.pageInfo,
|
||||
param: {
|
||||
material: this.queryKey.trim()
|
||||
},
|
||||
}
|
||||
getPartInfo(tableRequest).then(res => {
|
||||
const tableResponse = res.data
|
||||
if (tableResponse.code != 0) {
|
||||
console.log(tableResponse.code + ':' + tableResponse.message)
|
||||
ElMessage.error(tableResponse.message)
|
||||
}
|
||||
this.partInfos = tableResponse.rows
|
||||
this.total = tableResponse.total
|
||||
}).catch(err => {
|
||||
ElMessage.error('查询物料错误' + err.message)
|
||||
})
|
||||
this.loading = false
|
||||
},
|
||||
dateFormat: (row, column, cellValue, index) => {
|
||||
return dateFormatter(cellValue)
|
||||
},
|
||||
reset() {
|
||||
this.queryKey = ''
|
||||
this.search
|
||||
},
|
||||
// getCurrentPageGoods() {
|
||||
// this.currentGoods = this.displayGoods.slice((this.currentPage - 1) * this.pageSize, this.currentPage * this.pageSize)
|
||||
// },
|
||||
editCurrentRowGoods(row) {
|
||||
this.goodsFormEntity = row
|
||||
this.dialogVisible = true
|
||||
},
|
||||
deleteCurrentRowGoods(row) {
|
||||
this.material = row.material
|
||||
const goods = {
|
||||
material: row.material
|
||||
}
|
||||
deleteCurrentPartInfo(goods).then(res => {
|
||||
if (res.data.code == 0) {
|
||||
ElMessage({
|
||||
message: '删除零件信息成功',
|
||||
type: 'success',
|
||||
})
|
||||
this.search()
|
||||
} else {
|
||||
ElMessage.error(res.data.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
ElMessage.error('删除零件信息失败:' + err)
|
||||
})
|
||||
},
|
||||
submitGoodsInfo(formData) {
|
||||
updatePartInfo(formData).then(res => {
|
||||
if (res.data.code == 0) {
|
||||
this.dialogVisible = false
|
||||
ElMessage({
|
||||
message: '更新零件信息成功',
|
||||
type: 'success',
|
||||
})
|
||||
this.search()
|
||||
} else {
|
||||
ElMessage.error(res.data.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
ElMessage.error('更新零件信息失败')
|
||||
})
|
||||
},
|
||||
getCurrentRow(row) {
|
||||
this.goodsId = row.goodsId
|
||||
},
|
||||
exportExcel() {
|
||||
downloadMaterialExcel().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'//隐藏
|
||||
|
||||
// 兼容不同浏览器的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
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
// watch: {
|
||||
// currentPage() {
|
||||
// this.getCurrentPageGoods()
|
||||
// },
|
||||
// pageSize() {
|
||||
// this.getCurrentPageGoods()
|
||||
// }
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-pagination {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.el-row .el-button {
|
||||
width: 72px;
|
||||
margin-left: 0px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.table-class {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.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>
|
||||
Loading…
Reference in New Issue
Block a user