288 lines
9.6 KiB
Vue
288 lines
9.6 KiB
Vue
<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="80px"
|
||
label-suffix=":"
|
||
>
|
||
<el-form-item label="物料查询">
|
||
<el-input
|
||
v-model="query.material_code"
|
||
clearable
|
||
size="mini"
|
||
placeholder="物料编码、名称"
|
||
@keyup.enter.native="crud.toQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="批次号">
|
||
<el-input
|
||
v-model="query.pcsn"
|
||
clearable
|
||
size="mini"
|
||
placeholder="批次"
|
||
@keyup.enter.native="crud.toQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="桶码">
|
||
<el-input
|
||
v-model="query.bucket_code"
|
||
clearable
|
||
size="mini"
|
||
placeholder="载具编码"
|
||
@keyup.enter.native="crud.toQuery"
|
||
/>
|
||
</el-form-item>
|
||
<rrOperation />
|
||
</el-form>
|
||
</div>
|
||
<rrOperation />
|
||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||
<crudOperation :permission="permission">
|
||
<el-button
|
||
slot="right"
|
||
class="filter-item"
|
||
type="success"
|
||
icon="el-icon-printer"
|
||
size="mini"
|
||
:disabled="crud.selections.length !== 1"
|
||
@click="printTable"
|
||
>
|
||
桶标签
|
||
</el-button>
|
||
</crudOperation>
|
||
<el-dialog
|
||
:close-on-click-modal="false"
|
||
:before-close="crud.cancelCU"
|
||
:visible.sync="crud.status.cu > 0"
|
||
:title="crud.status.title"
|
||
width="1200px"
|
||
>
|
||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px">
|
||
<el-row>
|
||
<el-col :span="8">
|
||
<el-form-item label="物料编码" prop="material_code">
|
||
<el-select
|
||
v-model="form.material_code"
|
||
size="mini"
|
||
placeholder="全部"
|
||
style="width: 200px"
|
||
class="filter-item"
|
||
filterable
|
||
:disabled="crud.status.edit > 0"
|
||
@change="queryMater"
|
||
>
|
||
<el-option
|
||
v-for="item in materList"
|
||
:key="item.material_code"
|
||
:label="item.material_name"
|
||
:value="item.material_code"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
|
||
<el-col :span="8">
|
||
<el-form-item label="物料名称" prop="material_name">
|
||
<el-input v-model="form.material_name" disabled style="width: 200px;" />
|
||
</el-form-item>
|
||
</el-col>
|
||
|
||
<el-col :span="8">
|
||
<el-form-item label="物料规格" prop="material_spec">
|
||
<el-input v-model="form.material_spec" disabled style="width: 200px;" />
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
<el-row>
|
||
<el-col :span="8">
|
||
<el-form-item label="桶码" prop="bucket_code">
|
||
<el-input v-model="form.bucket_code" :disabled="crud.status.edit > 0" style="width: 200px;" />
|
||
</el-form-item>
|
||
</el-col>
|
||
|
||
<el-col :span="8">
|
||
<el-form-item label="物料批号" prop="pcsn">
|
||
<el-input v-model="form.pcsn" style="width: 200px;" />
|
||
</el-form-item>
|
||
</el-col>
|
||
|
||
<el-col :span="8">
|
||
<el-form-item label="物料重量" prop="qty">
|
||
<el-input-number v-model="form.qty" :precision="2" :controls="false" :min="1" style="width: 200px" />
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
<el-row>
|
||
<el-col :span="8">
|
||
<el-form-item label="桶自重" prop="qty">
|
||
<el-input-number v-model="form.bucket_weight" :precision="2" :controls="false" :min="1" style="width: 200px" />
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
</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"
|
||
style="width: 100%;"
|
||
@selection-change="crud.selectionChangeHandler"
|
||
>
|
||
<el-table-column type="selection" width="55" />
|
||
<el-table-column prop="bucket_code" label="桶码" :min-width="flexWidth('bucket_code',crud.data,'桶码')" />
|
||
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
|
||
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
|
||
<el-table-column prop="material_spec" label="物料规格" :min-width="flexWidth('material_spec',crud.data,'物料规格')" />
|
||
<el-table-column prop="pcsn" label="批次" :min-width="flexWidth('pcsn',crud.data,'批次')" />
|
||
<el-table-column prop="qty" label="重量" :formatter="crud.formatNum3" :min-width="100" />
|
||
<el-table-column prop="bucket_weight" label="桶自重" :formatter="crud.formatNum3" :min-width="100" />
|
||
<el-table-column prop="create_name" label="组桶人" :min-width="flexWidth('create_name',crud.data,'组桶人')" />
|
||
<el-table-column prop="create_time" label="组桶时间" :min-width="flexWidth('create_time',crud.data,'组桶时间')" />
|
||
<el-table-column
|
||
v-permission="['admin','Supplierbase:edit','Supplierbase:del']"
|
||
label="操作"
|
||
width="150px"
|
||
lign="center"
|
||
fixed="right"
|
||
>
|
||
<template slot-scope="scope">
|
||
<udOperation
|
||
:is-visiable-del="false"
|
||
:data="scope.row"
|
||
:permission="permission"
|
||
/>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<!--分页组件-->
|
||
<pagination />
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import crudBucked from '@/views/wms/basedata/bucked/bucked'
|
||
import crudGroup from '@/views/wms/basedata/group/group'
|
||
import CRUD, {crud, form, header, presenter} from '@crud/crud'
|
||
import crudOperation from '@crud/CRUD.operation'
|
||
import udOperation from '@crud/UD.operation'
|
||
import pagination from '@crud/Pagination'
|
||
import rrOperation from '@crud/RR.operation'
|
||
import {getLodop} from '@/assets/js/lodop/LodopFuncs'
|
||
|
||
const defaultForm = {
|
||
id: null,
|
||
bucket_code: null,
|
||
bucket_weight: null,
|
||
material_id: null,
|
||
pcsn: null,
|
||
qty: null,
|
||
qty_unit_id: null,
|
||
qty_unit_name: null,
|
||
create_id: null,
|
||
create_name: null,
|
||
create_time: null,
|
||
material_spec: null,
|
||
material_name: null
|
||
}
|
||
export default {
|
||
name: 'Bucked',
|
||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||
// 数据字典
|
||
dicts: [],
|
||
cruds() {
|
||
return CRUD({
|
||
title: '组桶记录',
|
||
url: 'api/bucked',
|
||
optShow: {
|
||
add: true,
|
||
edit: false,
|
||
del: false,
|
||
download: false,
|
||
reset: true
|
||
},
|
||
idField: 'id',
|
||
sort: 'id,desc',
|
||
crudMethod: { ...crudBucked }
|
||
})
|
||
},
|
||
data() {
|
||
return {
|
||
permission: {},
|
||
materList: [],
|
||
rules: {
|
||
material_code: [
|
||
{ required: true, message: '物料不能为空', trigger: 'blur' }
|
||
],
|
||
bucket_code: [
|
||
{ required: true, message: '桶码不能为空', trigger: 'blur' }
|
||
],
|
||
pcsn: [
|
||
{ required: true, message: '批次不能为空', trigger: 'blur' }
|
||
],
|
||
supp_code: [
|
||
{ required: true, message: '供应商不能为空', trigger: 'blur' }
|
||
]
|
||
}
|
||
}
|
||
},
|
||
created() {
|
||
crudGroup.queryMaterList({}).then(res => {
|
||
this.materList = res
|
||
})
|
||
},
|
||
methods: {
|
||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||
[CRUD.HOOK.beforeRefresh]() {
|
||
return true
|
||
},
|
||
queryMater(value) {
|
||
crudGroup.queryMater({ 'material_code': value }).then(row => {
|
||
this.form.material_spec = row.material_spec
|
||
this.form.material_name = row.material_name
|
||
this.form.material_id = row.material_id
|
||
}).catch(() => {
|
||
this.form.material_spec = ''
|
||
this.form.material_name = ''
|
||
this.form.material_code = ''
|
||
this.form.material_id = ''
|
||
})
|
||
},
|
||
printTable() {
|
||
const row = this.$refs.table.selection[0]
|
||
const LODOP = getLodop()
|
||
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
|
||
// 打印纸张大小设置https://www.it610.com/article/2094844.html
|
||
LODOP.PRINT_INIT('')
|
||
LODOP.SET_PRINT_PAGESIZE(1, '94mm', '119mm', '')
|
||
LODOP.ADD_PRINT_RECT('1mm', '3mm', '92mm', '117mm', 0, 1)
|
||
LODOP.ADD_PRINT_BARCODE('42.57mm', '15.05mm', '69.8mm', '23.97mm', '128A', row.bucket_code + '')
|
||
|
||
LODOP.PRINT()// 打印
|
||
// LODOP.PREVIEW()// 预览
|
||
// LODOP.PRINT_DESIGN()
|
||
this.crud.notify('打印成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||
this.crud.toQuery()
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
|
||
</style>
|