代码更新
This commit is contained in:
233
mes/qd/src/views/wms/basedata/em/bjsafeivt/index.vue
Normal file
233
mes/qd/src/views/wms/basedata/em/bjsafeivt/index.vue
Normal file
@@ -0,0 +1,233 @@
|
||||
<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-select
|
||||
v-model="query.stor_id"
|
||||
placeholder="所属仓库"
|
||||
clearable
|
||||
class="filter-item"
|
||||
@change="storChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stors"
|
||||
:key="item.stor_id"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料类型">
|
||||
<treeselect
|
||||
v-model="query.material_type_id"
|
||||
:load-options="loadClass"
|
||||
:options="classes"
|
||||
class="filter-item"
|
||||
style="width: 200px;"
|
||||
placeholder="物料类型"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="模糊搜索">
|
||||
<el-input
|
||||
v-model="query.search"
|
||||
clearable
|
||||
style="width: 200px"
|
||||
size="mini"
|
||||
placeholder="输入物料编码或名称"
|
||||
prefix-icon="el-icon-search"
|
||||
class="filter-item"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
@click="save"
|
||||
>
|
||||
保存
|
||||
</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 prop="stor_code" label="仓库编码" />
|
||||
<el-table-column prop="stor_name" label="仓库名称" />
|
||||
<el-table-column prop="material_code" label="物料编码" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="material_name" label="物料名称" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="safe_ivt_down" label="安全库存下限" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="crud.data[scope.$index].safe_ivt_down"
|
||||
size="small"
|
||||
:controls="false"
|
||||
controls-position="right"
|
||||
precision="3"
|
||||
:min="0"
|
||||
@change="change($event,crud.data[scope.$index],scope.$index)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="safe_ivt_up" label="安全库存上限" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number
|
||||
v-model="crud.data[scope.$index].safe_ivt_up"
|
||||
size="small"
|
||||
:controls="false"
|
||||
controls-position="right"
|
||||
precision="3"
|
||||
:min="0"
|
||||
@change="change($event,crud.data[scope.$index],scope.$index)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="qty_unit_name" label="单位" />
|
||||
<el-table-column prop="set_time" label="设置时间" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="set_name" label="设置人" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudMaterialsafeivt from '@/api/wms/basedata/st/materialsafeivt'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudStorattr from '@/api/wms/basedata/st/storattr'
|
||||
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import crudClassstandard from '@/api/wms/basedata/master/classstandard'
|
||||
import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
|
||||
|
||||
const defaultForm = {
|
||||
stor_id: null,
|
||||
material_id: null,
|
||||
safe_ivt_down: null,
|
||||
safe_ivt_up: null,
|
||||
qty_unit_id: null,
|
||||
qty_unit_name: null,
|
||||
set_id: null,
|
||||
set_name: null,
|
||||
set_time: null
|
||||
}
|
||||
export default {
|
||||
name: 'Bjsafeivt',
|
||||
components: { pagination, crudOperation, rrOperation, Treeselect },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '安全库存',
|
||||
optShow: { reset: true },
|
||||
url: 'api/materialsafeivt/bjsafeivt',
|
||||
idField: 'material_id',
|
||||
sort: 'material_id,desc',
|
||||
crudMethod: { ...crudMaterialsafeivt }
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
stors: [],
|
||||
classes: [],
|
||||
class_idStr: null,
|
||||
materOpt_code: '23',
|
||||
stor_id: '',
|
||||
permission: {},
|
||||
rules: {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudStorattr.getStor({ 'is_attachment': '1' }).then(res => {
|
||||
this.stors = res.content
|
||||
})
|
||||
const param = {
|
||||
'materOpt_code': this.materOpt_code
|
||||
}
|
||||
crudMaterialbase.getMaterOptType(param).then(res => {
|
||||
this.class_idStr = res.class_idStr
|
||||
this.crud.query.class_idStr = this.class_idStr
|
||||
this.queryClassId()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
queryClassId() {
|
||||
const param = {
|
||||
'class_idStr': this.class_idStr
|
||||
}
|
||||
crudClassstandard.queryClassById(param).then(res => {
|
||||
this.classes = res.content.map(obj => {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
},
|
||||
// 获取弹窗内部门数据
|
||||
loadClass({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
setTimeout(() => {
|
||||
callback()
|
||||
}, 100)
|
||||
})
|
||||
}
|
||||
},
|
||||
save() {
|
||||
if (this.stor_id === '') {
|
||||
this.crud.notify('请选择仓库', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
const data = {}
|
||||
data.stor_id = this.stor_id
|
||||
data.rows = this.crud.data
|
||||
crudMaterialsafeivt.insertSafeBj(data).then(() => {
|
||||
this.crud.dleChangePage(1)
|
||||
this.crud.editSuccessNotify()
|
||||
this.crud.refresh()
|
||||
})
|
||||
},
|
||||
storChange(val) {
|
||||
this.stor_id = val
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user