243 lines
8.3 KiB

<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<el-form
size="mini"
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="所属库区">
<el-cascader
placeholder="所属库区"
:options="sects"
:props="{ checkStrictly: true }"
clearable
class="filter-item"
@change="sectQueryChange"
/>
</el-form-item>
<el-form-item label="物料名称">
<el-input
v-model="query.material_name"
clearable
placeholder="物料编码、名称"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="托盘">
<label slot="label">托&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;盘:</label>
<el-input
v-model="query.storagevehicle_code"
clearable
placeholder="托盘号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="仓位名称">
<el-input
v-model="query.struct_name"
clearable
placeholder="仓位编码、名称"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="批次">
<label slot="label">批&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;次:</label>
<el-input
v-model="query.pcsn"
clearable
placeholder="批次"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :cell-style="{'text-align':'center'}" :header-cell-style="{'text-align':'center'}" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column v-if="false" prop="stockrecord_id" label="库存记录标识" />
<el-table-column v-if="false" prop="struct_id" label="仓位标识" />
<el-table-column prop="sect_name" label="所属库区" width="120" />
<el-table-column prop="struct_code" label="仓位编码" />
<el-table-column prop="struct_name" label="仓位名称" width="120" />
<el-table-column prop="vehicle_code" label="载具号" />
<el-table-column v-if="false" prop="material_id" label="物料标识" />
<el-table-column prop="material_code" label="物料编码" />
<el-table-column prop="material_name" label="物料名称" />
<el-table-column prop="workprocedure_name" label="物料工序" />
<el-table-column prop="is_full" label="是否满托">
<template slot-scope="scope">
<el-tag
:type="scope.row.is_full === '0' ? 'primary' : 'success'"
disable-transitions
>
{{ isFull(scope.row.is_full) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="instorage_time" label="入库时间" width="150" />
<el-table-column prop="stewing_time" label="静置时间(分钟)" width="150px" />
<el-table-column prop="stationary_state" label="静止状态">
<template slot-scope="scope">
<el-tag
:type="scope.row.stationary_state === '1' ? 'primary' : 'success'"
disable-transitions
>
{{ isStationary(scope.row.stationary_state) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="pcsn" label="批次" />
<el-table-column prop="canuse_qty" label="可用数">
<template slot-scope="scope">
{{ fun(scope.row.canuse_qty) }}
</template>
</el-table-column>
<el-table-column prop="frozen_qty" label="冻结数">
<template slot-scope="scope">
{{ fun(scope.row.frozen_qty) }}
</template>
</el-table-column>
<el-table-column prop="ivt_qty" label="库存数">
<template slot-scope="scope">
{{ fun(scope.row.ivt_qty) }}
</template>
</el-table-column>
<el-table-column prop="unit_name" label="单位" />
<el-table-column prop="mix_seq" label="黏次" />
<el-table-column v-permission="[]" label="操作" width="100px" align="center" fixed="right">
<!-- <template slot-scope="scope">
<el-button :disabled="scope.row.stationary_state === '1'" type="primary">静止完成</el-button>
</template>-->
<template slot-scope="scope">
<el-dropdown trigger="click" @command="handleCommand">
<span class="el-dropdown-link">
<i class="el-icon-menu" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :disabled="scope.row.stationary_state === '0'" :command="beforeHandleCommand(scope.$index, scope.row,'a')">强制完成</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudStructivt from '@/api/wms/st/ivt/structivt'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import crudStIvtSectattr from '@/api/wms/st/basedata/sectattr'
const defaultForm = { stockrecord_id: null, cascader: null, stor_id: null, sect_id: null, struct_id: null, vehicle_code: null, material_id: null, pcsn: null, canuse_qty: null, frozen_qty: null, ivt_qty: null, warehousing_qty: null, qty_unit_id: null, instorage_time: null, producetask_id: null, mix_seq: null, stewing_time: null }
export default {
name: 'Structivt',
components: { pagination, crudOperation, rrOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({ title: '库存查询', url: 'api/structivt', idField: 'stockrecord_id', sort: 'stockrecord_id,desc', crudMethod: { ...crudStructivt },
optShow: {
add: false,
edit: false,
del: false,
download: false,
reset: true
}
})
},
data() {
return {
sects: [],
permission: {
}
}
},
created() {
this.queryStorSect()
},
methods: {
fun(val) {
return Number(val).toFixed(2)
},
isStationary(val) {
if (val === '0') {
return '静止完成'
} else {
return '静止中'
}
},
isFull(val) {
if (val === '1') {
return '是'
} else {
return '否'
}
},
beforeHandleCommand(index, row, command) {
return {
'index': index,
'row': row,
'command': command
}
},
handleCommand(command) {
console.log(command.row)
crudStructivt.finishStationary(command.row).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
},
// 钩子:在获取表格数据之前执行,false 则npm代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
queryStorSect() {
crudStIvtSectattr.getSect().then(res => {
this.sects = res.content
})
},
hand(value) {
this.crud.toQuery()
},
sectQueryChange(val) {
if (val.length === 1) {
this.query.stor_id = val[0]
this.query.sect_id = ''
}
if (val.length === 0) {
this.query.sect_id = ''
this.query.stor_id = ''
}
if (val.length === 2) {
this.query.stor_id = val[0]
this.query.sect_id = val[1]
}
this.crud.toQuery()
}
}
}
</script>
<style scoped>
</style>