add:损益管理

This commit is contained in:
2025-05-29 08:51:21 +08:00
parent 797a06e8a9
commit a47fd8a3c4
22 changed files with 1994 additions and 11 deletions

View File

@@ -0,0 +1,435 @@
<template>
<el-dialog
:title="crud.status.title"
append-to-body
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
fullscreen
width="1200px"
@open="open"
@close="close"
>
<el-row v-show="crud.status.cu > 0" :gutter="20">
<el-col :span="20" style="border: 1px solid white">
<span />
</el-col>
<el-col :span="4">
<span>
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
</span>
</el-col>
</el-row>
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="85px" label-suffix=":">
<el-form-item label="单据号" prop="bill_code">
<label slot="label">单&nbsp;&nbsp;据&nbsp;号:</label>
<el-input v-model.trim="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px" />
</el-form-item>
<el-form-item label="仓库" prop="stor_id">
<label slot="label">仓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;库:</label>
<el-select
v-model="form.stor_id"
clearable
placeholder="仓库"
class="filter-item"
style="width: 210px"
:disabled="crud.status.view > 0"
>
<el-option
v-for="item in storlist"
:key="item.stor_id"
:label="item.stor_name"
:value="item.stor_id"
/>
</el-select>
</el-form-item>
<el-form-item label="损溢类型" prop="mol_type">
<el-select
v-model="form.mol_type"
style="width: 210px"
clearable
class="filter-item"
:disabled="crud.status.view > 0"
@change="typeChange"
>
<el-option
v-for="item in dict.ST_MOL_TYPE"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="明细数" prop="detail_count">
<label slot="label">明&nbsp;&nbsp;细&nbsp;数:</label>
<el-input v-model.trim="form.dtl_num" size="mini" disabled style="width: 210px" />
</el-form-item>
<el-form-item label="总重量" prop="total_qty">
<label slot="label">总&nbsp;&nbsp;重&nbsp;量:</label>
<el-input-number
v-model="form.total_qty"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<label slot="label">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</label>
<el-input v-model.trim="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="crud.status.view > 0" />
</el-form-item>
</el-form>
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
<div class="crud-opts2" style="margin-bottom: 5px;">
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
class="filter-item"
type="success"
icon="el-icon-check"
size="mini"
v-if="crud.status.cu > 0"
:disabled="form.stor_id === ''"
@click="queryStruct()"
>
选择货位库存
</el-button>
</span>
</div>
<!--表格渲染-->
<el-table
ref="table"
:data="form.tableData"
style="width: 100%;"
size="mini"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="struct_code" label="仓位编码" align="center" :min-width="flexWidth('struct_code',crud.data,'仓位编码')" />
<el-table-column prop="storagevehicle_code" label="载具号" align="center" :min-width="flexWidth('storagevehicle_code',crud.data,'载具号')" >
<template scope="scope">
<el-input v-show="!scope.row.edit && scope.row.is_add" v-model="scope.row.storagevehicle_code" size="mini" />
<span v-show="scope.row.edit">{{ scope.row.storagevehicle_code }}</span>
<span v-show="!scope.row.edit && !scope.row.is_add">{{ scope.row.storagevehicle_code }}</span>
</template>
</el-table-column>
<el-table-column prop="material_code" label="物料编码" align="center" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_name" label="物料名称" align="center" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="pcsn" label="批次号" align="center" :min-width="flexWidth('pcsn',crud.data,'批次号')" />
<el-table-column prop="ivt_qty" label="库存重量" align="center" :formatter="crud.formatNum3" :min-width="flexWidth('ivt_qty',crud.data,'库存重量')" />
<el-table-column prop="mol_qty" width="220" label="损溢重量" align="center" :min-width="flexWidth('mol_qty',crud.data,'损溢重量')" >
<template scope="scope">
<el-input-number v-model="scope.row.mol_qty" :disabled="scope.row.edit" :precision="3" :controls="false" :min="0" style="width: 120px" />
</template>
</el-table-column>
<el-table-column prop="qty_unit_name" label="单位" align="center" :min-width="flexWidth('qty_unit_name',crud.data,'单位')" />
<el-table-column v-if="crud.status.cu > 0" align="center" label="操作" width="190" fixed="right">
<template scope="scope">
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-delete"
@click.native.prevent="deleteRow(scope.$index, form.tableData)"
/>
<el-button
v-show="!scope.row.edit"
type="primary"
class="filter-item"
size="mini"
icon="el-icon-edit"
@click="handleEdit(scope.$index, scope.row)"
>编辑
</el-button>
<el-button
v-show="scope.row.edit"
type="success"
class="filter-item"
size="mini"
icon="el-icon-check"
@click="handleEdit(scope.$index, scope.row)"
>完成
</el-button>
</template>
</el-table-column>
</el-table>
<StructDiv ref="child" :sect-prop="defaultList" :dialog-show.sync="structShow" @tableChanged="tableChanged" />
</el-dialog>
</template>
<script>
import crudOperation from '@crud/CRUD.operation'
import CRUD, { crud, form } from '@crud/crud'
import crudStorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
import crudMoreOrless from '@/views/wms/st/moreorlessbill/moreorless'
import StructDiv from '@/views/wms/st/moreorlessbill/StructDiv'
const defaultForm = {
mol_id: '',
mol_code: '',
mol_type: '',
mol_inv_type: '1001',
stor_id: '',
status: '10',
total_qty: '0',
dtl_num: '0',
remark: '',
struct_id: '',
create_mode: '1',
tableData: []
}
export default {
name: 'AddDialog',
components: { crudOperation, StructDiv },
mixins: [crud(), form(defaultForm)],
dicts: ['io_bill_status', 'ST_MOL_TYPE'],
props: {
dialogShow: {
type: Boolean,
default: false
},
bussConfig: {
type: Object
},
openParam: {
type: Object
}
},
data() {
return {
dialogVisible: false,
materShow: false,
structShow: false,
materType: '',
mater_btn: true,
storlist: [],
defaultList: [],
rules: {
stor_id: [
{ required: true, message: '仓库不能为空', trigger: 'blur' }
],
mol_type: [
{ required: true, message: '损益类型不能为空', trigger: 'blur' }
],
bill_type: [
{ required: true, message: '业务类型不能为空', trigger: 'blur' }
],
biz_date: [
{ required: true, message: '业务日期不能为空', trigger: 'blur' }
]
}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
}
},
methods: {
open() {
// 查询原材料库的仓库
crudStorattr.getStor({}).then(res => {
this.storlist = res
})
},
[CRUD.HOOK.afterToEdit]() {
// 获取入库单明细
crudMoreOrless.queryMolDtl({ 'mol_id': this.form.mol_id }).then(res => {
this.form.tableData = res
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
row.isadd = false
row.edit = true
this.form.tableData.splice(i, 1, row)
}
})
},
[CRUD.HOOK.afterToView]() {
this.mater_btn = true
crudMoreOrless.queryMolDtl({ 'mol_id': this.form.mol_id }).then(res => {
this.form.tableData = res
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
row.edit = true
this.form.tableData.splice(i, 1, row)
}
})
},
close() {
this.$emit('AddChanged')
},
[CRUD.HOOK.beforeSubmit]() {
// 提交前校验
if (this.form.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
for (let i = 0; i < this.form.tableData.length; i++) {
if (!this.form.tableData[i].edit) {
this.crud.notify('尚有未完成编辑的物料明细序号' + (i + 1) + ',请检查!')
return false
}
const vehicle_code = this.form.tableData[i].storagevehicle_code
const same = this.form.tableData.some(mater => mater.storagevehicle_code !== vehicle_code)
if (same) {
this.crud.notify('存在不同载具号', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
},
billTypeChange(val) {
this.form.tableData = []
this.form.total_qty = 0
this.form.dtl_num = 0
},
resetTable() {
if (!this.form.struct_id) {
this.crud.notify('请先选择货物!')
return false
}
if (this.crud.status.add > 0) {
crudMoreOrless.getStructIvt({ 'struct_id': this.form.struct_id }).then(res => {
this.form.tableData = res
this.form.dtl_num = this.form.tableData.length
})
}
if (this.crud.status.edit > 0) {
crudMoreOrless.queryMolDtl({ 'mol_id': this.form.mol_id, 'struct_id': this.form.struct_id }).then(res => {
this.form.tableData = res
this.form.dtl_num = this.form.tableData.length
})
}
},
tableChanged(row) {
var dtl = {}
dtl.sect_code = row.turnout_sect_code
dtl.struct_code = row.turnout_struct_code
dtl.storagevehicle_code = row.storagevehicle_code
dtl.material_id = row.material_id
dtl.material_code = row.material_code
dtl.material_name = row.material_name
dtl.pcsn = row.pcsn
dtl.qty_unit_id = row.qty_unit_id
dtl.qty_unit_name = row.qty_unit_name
dtl.ivt_qty = row.qty
dtl.qty = row.qty
dtl.status = '10'
dtl.edit = false
dtl.mol_qty = 0
for (let i = 0; i < this.form.tableData.length; i++) {
var tableDatum = this.form.tableData[i]
if (tableDatum.struct_code === dtl.struct_code && tableDatum.material_id === dtl.material_id && tableDatum.pcsn === dtl.pcsn) {
} else {
this.form.tableData.push(dtl)
this.form.dtl_num = this.form.tableData.length
}
}
if (this.form.tableData.length === 0) {
this.form.tableData.push(dtl)
this.form.dtl_num = this.form.tableData.length
}
},
async queryMater(index, row) {
this.materShow = true
this.nowindex = index
this.nowrow = row
},
async queryStruct() {
if (!this.form.stor_id) {
this.crud.notify('请先选择仓库!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.defaultList = []
this.defaultList.push(this.form.stor_id)
this.structShow = true
this.$refs.child.getMsg(this.form.mol_type)
},
async insertdtl() {
this.form.tableData.push({ quality_scode: '02', ivt_qty: 0, mol_qty: 0, is_active: '1', ivt_level: '01', edit: false, is_add: true })
this.form.dtl_num = this.form.tableData.length
},
typeChange(val) {
if (val === '1') {
this.mater_btn = false
} else {
this.mater_btn = true
}
this.form.tableData = []
this.form.struct_id = ''
this.form.struct_code = ''
this.form.sect_id = ''
this.form.sect_name = ''
this.form.struct_name = ''
},
handleEdit(index, row) {
if (!row.edit) {
if (parseFloat(row.mol_qty) <= 0) {
this.crud.notify('不允许损溢数量为0', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.material_id) {
this.crud.notify('物料不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.storagevehicle_code) {
this.crud.notify('载具号不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.pcsn) {
this.crud.notify('批次不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (this.form.mol_type === '1' && (parseFloat(row.ivt_qty) < parseFloat(row.mol_qty))) {
this.crud.notify('不允许损数量大于库存数量!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
// 修改行的编辑状态
row.edit = !row.edit
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
if (row.edit) {
this.form.total_qty = 0
this.form.tableData.forEach((item) => {
this.form.total_qty = this.form.total_qty + item.mol_qty
})
}
},
deleteRow(index, rows) {
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].mol_qty)
rows.splice(index, 1)
this.form.dtl_num = this.form.tableData.length
}
}
}
</script>
<style>
.crud-opts2 {
padding: 4px 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>

View File

@@ -0,0 +1,231 @@
<template>
<el-dialog
title="库存选择"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
width="1000px"
@close="close"
@open="open"
>
<!-- 搜索 -->
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="库区查询">
<el-cascader
v-model="defaultList"
placeholder="库区"
:options="sects"
:props="{ checkStrictly: true }"
@change="sectQueryChange"
/>
</el-form-item>
<el-form-item label="货位编码">
<el-input
v-model="query.struct_code"
clearable
size="mini"
placeholder="货位号模糊查询"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="物料编码">
<el-input
v-model="query.material_code"
clearable
size="mini"
placeholder="物料"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="批次">
<el-input
v-model="query.pcsn"
clearable
size="mini"
placeholder="批次"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@select="handleSelectionChange"
@select-all="onSelectAll"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="turnout_sect_name" label="库区名称" :min-width="flexWidth('turnout_sect_name',crud.data,'库区名称')" />
<el-table-column prop="turnout_struct_code" label="货位编码" :min-width="flexWidth('turnout_struct_code',crud.data,'货位编码')" />
<el-table-column prop="storagevehicle_code" label="载具编码" :min-width="flexWidth('storagevehicle_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="pcsn" label="批次" :min-width="flexWidth('pcsn',crud.data,'批次')" />
<el-table-column prop="qty" label="重量" :formatter="crud.formatNum3" :min-width="flexWidth('qty',crud.data,'重量')" />
<el-table-column prop="frozen_qty" label="冻结数量" :formatter="crud.formatNum3" :min-width="flexWidth('frozen_qty',crud.data,'冻结数量')" />
<el-table-column prop="qty_unit_name" label="重量单位" :min-width="flexWidth('qty_unit_name',crud.data,'重量单位')" />
</el-table>
<!--分页组件-->
<pagination />
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</el-dialog>
</template>
<script>
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import crudSectattr from '@/views/wms/basedata/sectattr/sectattr'
export default {
name: 'StructDiv',
components: { crudOperation, rrOperation, pagination },
cruds() {
return CRUD({
title: '库存物料',
optShow: {},
url: 'api/moveStor/getCanuseIvt',
idField: 'struct_id',
sort: 'storagevehicleext_id,desc'
})
},
mixins: [presenter(), header()],
dicts: ['d_lock_type'],
props: {
dialogShow: {
type: Boolean,
default: false
},
sectProp: {
type: Array
}
},
data() {
return {
sects: [],
defaultList: [],
dialogVisible: false,
sect: {},
mol_type: '',
checkrow: {},
rows: []
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
sectProp: {
handler(newValue, oldValue) {
this.defaultList = newValue
}
}
},
methods: {
open() {
this.crud.resetQuery(false)
crudSectattr.getSect({ 'stor_id': this.defaultList[0] }).then(res => {
this.sects = res.content
})
if (this.sect) {
this.query.sect = this.sect
if (this.sect.length === 1) {
this.query.stor_id = this.sect[0]
this.query.sect_id = ''
}
if (this.sect.length === 0) {
this.query.sect_id = ''
this.query.stor_id = ''
}
if (this.sect.length === 2) {
this.query.stor_id = this.sect[0]
this.query.sect_id = this.sect[1]
}
}
this.query.is_used = '1'
this.query.is_delete = '0'
this.query.stor_id = this.defaultList[0]
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()
},
handleSelectionChange(val, row) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
this.checkrow = row
} else {
this.checkrow = row
}
},
/**
* 接受父组件传值
* @param msg
*/
getMsg(msg) {
this.mol_type = msg
},
lockFormat(row, column) {
return this.dict.label.d_lock_type[row.lock_type]
},
onSelectAll() {
this.$refs.table.clearSelection()
},
close() {
this.sects = null
this.$emit('update:dialogShow', false)
},
submit() {
this.rows = this.$refs.table.selection
if (this.rows.length <= 0) {
this.$message('请先勾选仓位')
return
}
if (this.checkrow.frozen_qty !== 0) {
this.$message('请选择冻结数量为0的库存')
return
}
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.checkrow)
}
}
}
</script>

View File

@@ -0,0 +1,327 @@
<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.mol_code"
size="mini"
clearable
placeholder="单据编码"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="货位编码">
<el-input
v-model="query.struct_code"
size="mini"
clearable
placeholder="货位编码"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="所属仓库">
<el-select
v-model="query.stor_id"
clearable
size="mini"
placeholder="全部"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in storlist"
:key="item.stor_id"
:label="item.stor_name"
:value="item.stor_id"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
/>
</el-form-item>
<el-form-item label="损溢类型">
<el-select
v-model="query.mol_type"
clearable
size="mini"
placeholder="损溢类型"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.ST_MOL_TYPE"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="单据类型">
<el-select
v-model="query.mol_inv_type"
clearable
size="mini"
placeholder="单据类型"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.MOL_INV_TYPE"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="单据状态">
<el-select
v-model="query.status"
clearable
size="mini"
placeholder="单据状态"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.MOL_BILL_STATUS"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<rrOperation />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="warning"
:disabled="confirm_flag"
icon="el-icon-check"
size="mini"
@click="confirm"
>
强制确认
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:max-height="590"
size="mini"
:data="crud.data"
highlight-current-row
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
@current-change="handleCurrentChange"
@select="handleSelectionChange"
@select-all="onSelectAll"
>
<el-table-column
label="操作"
width="115"
align="center"
fixed="right"
>
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
:disabled-edit="canUd(scope.row)"
:disabled-dle="canUd(scope.row)"
/>
</template>
</el-table-column>
<el-table-column :selectable="checkboxT" type="selection" width="55" />
<el-table-column prop="mol_code" label="损溢单号" :min-width="flexWidth('mol_code',crud.data,'损溢单号')">
<template slot-scope="scope">
<el-link type="warning" @click="crud.toView(scope.row)">{{ scope.row.mol_code }}</el-link>
</template>
</el-table-column>
<el-table-column :formatter="billTypeFormat" prop="mol_inv_type" label="单据类型" :min-width="flexWidth('mol_inv_type',crud.data,'单据类型')" />
<el-table-column :formatter="typeFormat" prop="mol_type" label="损溢类型" :min-width="flexWidth('mol_type',crud.data,'损溢类型')" />
<el-table-column label="明细数" align="center" prop="dtl_num" :min-width="flexWidth('dtl_num',crud.data,'明细数')" />
<el-table-column label="损益重量" align="center" prop="total_qty" :min-width="flexWidth('total_qty',crud.data,'损益重量')" >
<template slot-scope="scope">
{{ fun(scope.row.total_qty) }}
</template>
</el-table-column>
<el-table-column :formatter="stateFormat" prop="status" label="单据状态" :min-width="flexWidth('status',crud.data,'单据状态')" />
<el-table-column prop="create_mode" :formatter="create_modeFormat" label="生成方式" :min-width="flexWidth('create_mode',crud.data,'生成方式')" />
<el-table-column label="制单人" align="center" prop="input_optname" :min-width="flexWidth('input_optname',crud.data,'制单人')" />
<el-table-column label="制单时间" align="center" prop="input_time" :min-width="flexWidth('input_time',crud.data,'制单时间')" />
<el-table-column label="确认人" align="center" prop="confirm_optname" :min-width="flexWidth('confirm_optname',crud.data,'确认人')" />
<el-table-column label="确认时间" align="center" prop="confirm_time" :min-width="flexWidth('confirm_time',crud.data,'确认时间')" />
<el-table-column label="备注" align="center" prop="remark" :min-width="flexWidth('remark',crud.data,'备注')" />
</el-table>
<!--分页组件-->
<pagination />
</div>
<AddDialog @AddChanged="querytable" />
</div>
</template>
<script>
import crudMoreOrless from '@/views/wms/st/moreorlessbill/moreorless'
import CRUD, { crud, 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 DateRangePicker from '@/components/DateRangePicker/index'
import AddDialog from '@/views/wms/st/moreorlessbill/AddDialog'
import { mapGetters } from 'vuex'
import crudStorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
export default {
name: 'MoreOrLess',
components: { AddDialog, crudOperation, rrOperation, udOperation, pagination, DateRangePicker },
cruds() {
return CRUD({
title: '',
optShow: { add: true, reset: true },
props: {
// 每页数据条数
size: 20
},
idField: 'mol_id',
url: '/api/moreorLess',
crudMethod: { ...crudMoreOrless }
})
},
mixins: [presenter(), header(), crud()],
// 数据字典
dicts: ['MOL_BILL_STATUS', 'ST_CREATE_MODE', 'ST_MOL_TYPE', 'MOL_INV_TYPE'],
data() {
return {
height: document.documentElement.clientHeight - 180 + 'px;',
permission: {
add: ['admin', 'user:add'],
edit: ['admin', 'user:edit'],
del: ['admin', 'user:del']
},
confirm_flag: true,
currentRow: null,
storlist: [],
statuslist: []
}
},
computed: {
...mapGetters([
'user'
])
},
mounted: function() {
const that = this
window.onresize = function temp() {
that.height = document.documentElement.clientHeight - 180 + 'px;'
}
},
created() {
crudStorattr.getStor({}).then(res => {
this.storlist = res
})
},
methods: {
fun(val) {
return Number(val).toFixed(3)
},
canUd(row) {
return row.status !== '10'
},
handleSelectionChange(val, row) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
this.buttonChange(row)
} else if (val.length === 1) {
this.buttonChange(row)
} else {
this.handleCurrentChange(null)
}
},
onSelectAll() {
this.$refs.table.clearSelection()
this.handleCurrentChange(null)
},
buttonChange(current) {
if (current !== null) {
this.currentRow = current
if (current.bill_status !== '99') {
this.confirm_flag = false
} else {
this.confirm_flag = true
}
}
}
,
querytable() {
this.onSelectAll()
this.crud.toQuery()
this.handleCurrentChange(null)
},
handleCurrentChange(currentRow) {
if (currentRow === null) {
this.currentRow = {}
this.confirm_flag = true
}
},
stateFormat(row, column) {
return this.dict.label.MOL_BILL_STATUS[row.status]
},
typeFormat(row, column) {
return this.dict.label.ST_MOL_TYPE[row.mol_type]
},
billTypeFormat(row, column) {
return this.dict.label.MOL_INV_TYPE[row.mol_inv_type]
},
create_modeFormat(row, column) {
return this.dict.label.ST_CREATE_MODE[row.create_mode]
},
checkboxT(row) {
return row.status !== '99'
},
confirm() {
if (!this.currentRow) {
this.crud.notify('请选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
return
}
crudMoreOrless.confirm(this.currentRow).then(res => {
this.crud.notify('单据确认成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.refresh()
})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 10px;
}
</style>

View File

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

View File

@@ -206,7 +206,7 @@
</template>
</el-table-column>
</el-table>
<AddDtl :dialog-show.sync="dtlShow" :stor-id="storId" @tableChanged="tableChanged" />
<AddDtl :dialog-show.sync="dtlShow" :sect-list="sectList" :stor-id="storId" @tableChanged="tableChanged" />
<StructDiv ref="child" :stor-id="storId" :dialog-show.sync="structShow" @tableChanged="structChanged" />
</el-dialog>
</template>
@@ -220,9 +220,9 @@ import crudUserStor from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
const defaultForm = {
bill_code: '',
stor_id: '1582991156504039424',
stor_code: 'AC01',
stor_name: '兰州仓库',
stor_id: '',
stor_code: '',
stor_name: '',
block_num: null,
bill_status: '10',
total_qty: '0',
@@ -255,6 +255,7 @@ export default {
storId: null,
nowindex: '',
storlist: [],
sectList: [],
invtypelist: [],
rules: {
stor_id: [
@@ -323,7 +324,9 @@ export default {
if (!this.form.stor_id) {
return this.crud.notify('请先选择仓库!', CRUD.NOTIFICATION_TYPE.INFO)
}
this.sectList = []
this.storId = this.form.stor_id
this.sectList.push(this.storId)
this.dtlShow = true
},
async queryStruct(index, row) {

View File

@@ -96,7 +96,6 @@
import CRUD, { header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import movestor from '@/views/wms/st/movebill/movestor'
import crudSectattr from '@/views/wms/basedata/sectattr/sectattr'
export default {
@@ -129,6 +128,9 @@ export default {
},
storId: {
type: String
},
sectList: {
type: Array
}
},
dicts: ['ST_QUALITY_SCODE', 'ST_IVT_LEVEL', 'is_usable'],
@@ -138,7 +140,7 @@ export default {
opendtlParam: '',
sects: [],
rows: [],
defaultList: ['1582991156504039424', '1582991348217286656']
defaultList: []
}
},
watch: {
@@ -151,6 +153,11 @@ export default {
handler(newValue, oldValue) {
this.opendtlParam = newValue
}
},
sectList: {
handler(newValue, oldValue) {
this.defaultList === newValue
}
}
},
methods: {