备件库存查询

This commit is contained in:
2022-06-28 15:57:03 +08:00
parent 5c7537009b
commit 645cf8cfe5
8 changed files with 679 additions and 3 deletions

View File

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

View File

@@ -0,0 +1,154 @@
<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_code"
clearable
placeholder="编码、名称"
/>
</el-form-item>
<el-form-item label="按备件" label-width="120px">
<el-switch v-model="query.is_all" active-value="1" inactive-value="0" @change="crud.toQuery()" />
</el-form-item>
<rrOperation />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-check"
size="mini"
@click="downdtl"
>
导出Excel
</el-button>
</crudOperation>
<!--表格渲染-->
<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="sect_code" label="库区编码" />
<el-table-column prop="sect_name" label="库区名称" />
<el-table-column prop="material_code" label="物料编码" />
<el-table-column prop="material_name" label="名称" />
<el-table-column prop="material_model" label="型号" />
<el-table-column prop="material_spec" label="技术规格" />
<el-table-column prop="pcsn" label="批次" />
<el-table-column prop="ivt_qty" label="库存数" />
<el-table-column prop="qty_unit_name" label="单位" />
<el-table-column prop="instorage_time" label="入库时间" width="150px" />
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudDevicesparepartivt from '@/api/wms/sb/devicesparepartivt'
import CRUD, { presenter, header, form, crud } 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 crudSectattr from '@/api/wms/basedata/st/sectattr'
import { download } from '@/api/data'
import { downloadFile } from '@/utils'
const defaultForm = { stockrecord_id: null, sparepart_only_id: null, material_id: null, pcsn: null, stor_id: null, stor_name: null, struct_id: null, struct_code: null, struct_name: null, ivt_qty: null, qty_unit_id: null, qty_unit_name: null, instorage_time: null }
export default {
name: 'Deviceivtquery',
components: { pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
title: '备件库存查询',
url: 'api/devicesparepartivt',
idField: 'stockrecord_id',
sort: 'stockrecord_id,desc',
crudMethod: { ...crudDevicesparepartivt },
optShow: {
add: false,
edit: false,
del: false,
download: false,
reset: true
}
})
},
data() {
return {
sects: [],
permission: {
}
}
},
created() {
crudSectattr.getSect({ 'is_attachment': '1' }).then(res => {
this.sects = res.content
})
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
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()
},
downdtl() {
if (this.currentRow !== null) {
crud.downloadLoading = true
download('/api/devicesparepartivt/download', this.crud.query).then(result => {
downloadFile(result, '备件库存', 'xlsx')
crud.downloadLoading = false
}).catch(() => {
crud.downloadLoading = false
})
}
}
}
}
</script>
<style scoped>
</style>

View File

@@ -236,9 +236,9 @@ export default {
}
},
created() {
crudSectattr.getSect().then(res => {
this.sects = res.content
})
// crudSectattr.getSect().then(res => {
// this.sects = res.content
// })
crudSectattr.getSect({ 'is_materialstore': '1' }).then(res => {
this.sects = res.content
})