add:空木箱库

This commit is contained in:
2025-08-07 16:16:57 +08:00
parent 61f7877fbd
commit dea92901bd
30 changed files with 1171 additions and 273 deletions

View File

@@ -68,6 +68,16 @@
@change="hand"
/>
</el-form-item>
<el-form-item label="是否有货">
<el-switch
v-model="query.isHasGoods"
active-value="0"
inactive-value="1"
active-color="#C0CCDA"
inactive-color="#409EFF"
@change="hand"
/>
</el-form-item>
<rrOperation :crud="crud" />
</el-form>
</div>

View File

@@ -0,0 +1,246 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="90px"
label-suffix=":"
>
<el-form-item label="木箱信息">
<el-input
v-model="query.box_info"
clearable
placeholder="输入木箱信息"
style="width: 185px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="备货状态">
<el-select
v-model="query.stock_plan_status"
clearable
filterable
size="mini"
class="filter-item"
style="width: 185px;"
>
<el-option
v-for="item in dict.stock_plan_status"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<rrOperation :crud="crud" />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表单组件-->
<el-dialog
:close-on-click-modal="false"
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0"
:title="crud.status.title"
width="500px"
>
<br>
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="120px">
<el-form-item label="木箱规格" prop="box_spec">
<el-input
v-model="form.box_spec"
style="width: 300px;"
clearable
@click.native="openMaterialDialog"
/>
</el-form-item>
<el-form-item label="木箱规格名称" prop="box_spec_name">
<el-input v-model="form.box_spec_name" disabled style="width: 300px;" />
</el-form-item>
<el-form-item label="备货数量" prop="stock_up_num">
<el-input
v-model.number="form.stock_up_num"
style="width: 300px;"
oninput="this.value = this.value.replace(/[^0-9]/g, '')"
placeholder="请输入大于等于1的整数"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
size="mini"
:row-style="rowStyle"
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="box_spec" label="木箱规格" width="140px" show-overflow-tooltip />
<el-table-column prop="box_spec_name" label="木箱规格名称" width="200px" show-overflow-tooltip />
<el-table-column prop="stock_up_num" label="木箱备货数量" width="100px" show-overflow-tooltip />
<el-table-column prop="stock_plan_status" label="备货状态" show-overflow-tooltip>
<template slot-scope="scope">
{{ dict.label.stock_plan_status[scope.row.stock_plan_status] }}
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" width="150px" show-overflow-tooltip />
<el-table-column prop="created_name" label="创建人" min-width="150" show-overflow-tooltip />
<el-table-column prop="created_time" label="创建时间" min-width="150" show-overflow-tooltip />
<el-table-column prop="update_name" label="修改人" min-width="150" show-overflow-tooltip />
<el-table-column prop="update_time" label="修改时间" min-width="150" show-overflow-tooltip />
<el-table-column v-permission="[]" label="操作" width="200px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
style="display: inline"
:data="scope.row"
:permission="permission"
:is-visiable-del="false"
/>
<el-button slot="right" size="mini" type="text" icon="el-icon-success" @click="doOperate(scope.row)">完成</el-button>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
<mater-dialog
:key="materialDialogKey"
ref="materDialog"
:dialog-show="dialogMaterialVisible"
is-single
mater-opt-code="木箱"
@handleSetMaterialValue="handleSetMaterialValue"
/>
</div>
</template>
<script>
import crudStockUpPlan from './stock_up_plan'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import MaterDialog from '../MaterDialog'
const defaultForm = {
stockup_plan_id: null,
box_spec: null,
box_spec_name: null,
stock_up_num: 1,
stock_plan_status: null,
remark: null,
create_id: null,
create_name: null,
create_time: null,
update_id: null,
update_name: null,
update_time: null
}
export default {
name: 'StockUpPlan',
components: { pagination, crudOperation, rrOperation, udOperation, MaterDialog },
dicts: ['stock_plan_status'],
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
title: '木箱备货计划',
url: 'api/bstIvtBoxStockUpPlan',
idField: 'stockup_plan_id',
sort: 'stockup_plan_id,desc',
crudMethod: { ...crudStockUpPlan },
optShow: {
add: true,
edit: true,
del: true,
download: false,
reset: true
}
})
},
data() {
return {
permission: {},
dialogMaterialVisible: false,
materialDialogKey: 0,
rules: {
box_spec: [
{ required: true, message: '木箱规格不能为空', trigger: 'blur' }
],
box_spec_name: [
{ required: true, message: '木箱规格名称不能为空', trigger: 'blur' }
],
stock_up_num: [
{ required: true, message: '木箱备货数量不能为空', trigger: 'blur' }
]
}
}
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
doOperate(row) {
crudStockUpPlan.finish(row).then(res => {
this.crud.toQuery()
this.crud.notify('操作成功', 'success')
})
},
handleBoxNoBlur(value) {
console.log(value)
if (!value || value.trim() === '') {
this.form.current_layer_count = 0
} else {
const boxNoArray = value.split(',')
this.form.current_layer_count = boxNoArray.length
}
},
openMaterialDialog() {
if (this.crud.status.edit > 0) return // 如果是编辑状态,则不允许重新选择
this.dialogMaterialVisible = true
this.materialDialogKey += 1
},
handleSetMaterialValue(material) {
this.form.box_spec = material.material_code
this.form.box_spec_name = material.material_name
this.dialogMaterialVisible = false
},
rowStyle({ row, index }) {
const backgroun = {}
if (row.container_name != null && row.update_time != null && row.update_time != undefined) {
const now = new Date()
const before = new Date(row.update_time)
const diff = now.getTime() - before.getTime()
const min = Math.floor(diff / (1000 * 60))
console.log(min)
if (min > 120) {
backgroun.background = 'red'
}
}
return backgroun
},
hand(value) {
this.crud.toQuery()
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,35 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/bstIvtBoxStockUpPlan',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/bstIvtBoxStockUpPlan',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/bstIvtBoxStockUpPlan',
method: 'put',
data
})
}
export function finish(data) {
return request({
url: 'api/bstIvtBoxStockUpPlan/finish',
method: 'post',
data
})
}
export default { add, edit, del, finish }