fix:预警配置功能调整,新增安全上下限,已读未读等功能

This commit is contained in:
zhengxuming
2025-07-17 14:54:32 +08:00
parent d5e38b8ab3
commit e58fefcab9
22 changed files with 480 additions and 260 deletions

View File

@@ -45,22 +45,22 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="安全库存天数" prop="safe_days">
<el-form-item label="超期天数" prop="safe_days">
<el-input v-model="form.safe_days" style="width: 200px;" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="安全库存数量" prop="safe_qty">
<el-input v-model="form.safe_qty" style="width: 200px;" />
<el-form-item label="安全库存数量下限" prop="safe_qty_lower_limit">
<el-input v-model="form.safe_qty_lower_limit" style="width: 200px;" />
</el-form-item>
</el-col>
<!-- <el-col :span="8">
<el-form-item label="表达式" prop="cron">
<el-input v-model="form.cron" style="width: 200px;" />
<el-col :span="8">
<el-form-item label="安全库存数量上限" prop="safe_qty_upper_limit">
<el-input v-model="form.safe_qty_upper_limit" style="width: 200px;" />
</el-form-item>
</el-col>-->
</el-col>
<el-col :span="8">
<el-form-item label="通知类型" prop="notify_type">
<el-select v-model="form.notify_type" filterable placeholder="请选择">
@@ -73,8 +73,10 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="描述" prop="remark">
<el-form-item label="备注" prop="remark">
<el-input
v-model="form.remark"
type="textarea"
@@ -142,23 +144,30 @@ import crudBsrealstorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorat
import crudStorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
const defaultForm = {
bill_code: '',
stor_code: '',
bill_status: '10',
total_qty: '0',
detail_count: '0',
bill_type: '',
remark: '',
biz_date: new Date(),
create_mode: '',
tableData: []
id: null,
name: null,
stor_code: null,
safe_qty_lower_limit: null,
safe_qty_upper_limit: null,
safe_days: null,
remark: null,
is_active: null,
is_delete: null,
create_id: null,
create_name: null,
create_time: null,
update_id: null,
update_name: null,
update_time: null,
cron: null,
notify_type: null
}
export default {
name: 'AddDialog',
components: { AddMaterial },
mixins: [crud(), form(defaultForm)],
dicts: ['io_bill_status', 'ST_QUALITY_SCODE', 'ST_INV_IN_TYPE', 'NOTIFY_TYPE'],
dicts: ['ST_INV_IN_TYPE', 'NOTIFY_TYPE'],
props: {
dialogShow: {
type: Boolean,
@@ -186,7 +195,7 @@ export default {
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
handler(newValue) {
this.dialogVisible = newValue
}
}
@@ -217,43 +226,21 @@ export default {
})
},
[CRUD.HOOK.afterToAdd]() {
this.bill_btn = false
this.mater_btn = false
},
[CRUD.HOOK.afterToView]() {
this.bill_btn = true
this.mater_btn = true
stIvtForewarningconfig.getWarningMaterial({ 'bill_code': this.form.id }).then(res => {
this.form.tableData = res
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
this.form.tableData.splice(i, 1, row)
}
})
[CRUD.HOOK.afterSubmit]() {
},
[CRUD.HOOK.beforeSubmit]() {
// 提交前校验
if (this.form.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
},
billTypeChange(val) {
if (val === '000101') {
this.bill_btn = false
this.mater_btn = true
} else if (val === '000102') {
this.bill_btn = true
this.mater_btn = false
} else {
this.bill_btn = true
this.mater_btn = true
if (this.form.safe_qty_upper_limit !== '' && this.form.safe_qty_lower_limit !== '' &&
this.form.safe_qty_upper_limit < this.form.safe_qty_lower_limit) {
this.crud.notify('下限不能大于上限', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
this.form.tableData = []
this.form.total_qty = 0
this.form.detail_count = 0
},
fun(val) {
return Number(val).toFixed(3)

View File

@@ -21,9 +21,10 @@
:value="item.stor_code"
/>
</el-select> <label class="el-form-item-label">安全库存数量</label>
<el-input v-model="query.safe_qty" clearable placeholder="安全库存数量" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<label class="el-form-item-label">安全库存天数</label>
<el-input v-model="query.safe_days" clearable placeholder="安全库存天数" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<el-input v-model="query.safe_qty_lower_limit" clearable placeholder="安全库存数量下限" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<el-input v-model="query.safe_qty_upper_limit" clearable placeholder="安全库存数量上限" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<label class="el-form-item-label">超期天数</label>
<el-input v-model="query.safe_days" clearable placeholder="超期天数" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<label class="el-form-item-label">通知类型</label>
<el-select
v-model="query.notify_type"
@@ -51,72 +52,6 @@
:title="crud.status.title"
width="80%"
>
<el-form ref="form" :model="form" label-width="100px" :rules="rules" class="custom-form-spacing">
<el-row>
<el-col :span="8">
<el-form-item label="方案名称" prop="name">
<el-input v-model="form.name" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="仓库名称" prop="stor_code">
<el-select
v-model="form.stor_code"
placeholder=""
style="width: 200px"
>
<el-option
v-for="item in stors"
:key="item.stor_code"
:label="item.stor_name"
:value="item.stor_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="安全库存天数" prop="safe_days">
<el-input v-model="form.safe_days" style="width: 200px;" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="安全库存数量" prop="safe_qty">
<el-input v-model="form.safe_qty" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="表达式" prop="cron">
<el-input v-model="form.cron" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="通知类型" prop="notify_type">
<el-select v-model="form.notify_type" filterable placeholder="请选择">
<el-option
v-for="item in dict.NOTIFY_TYPE"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="描述" prop="remark">
<el-input
v-model="form.remark"
type="textarea"
:rows="3"
style="width: 400px;"
/>
</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>
@@ -127,8 +62,9 @@
<el-table-column type="selection" width="55" />
<el-table-column prop="name" label="方案名称" :min-width="flexWidth('name',crud.data,'方案名称')" />
<el-table-column prop="stor_name" label="仓库名称" :min-width="flexWidth('stor_name',crud.data,'仓库名称')" />
<el-table-column prop="safe_qty" label="安全库存数量" :min-width="flexWidth('safe_qty',crud.data,'安全库存数量')" />
<el-table-column prop="safe_days" label="安全库存天" :min-width="flexWidth('safe_days',crud.data,'安全库存天数')" />
<el-table-column prop="safe_qty_lower_limit" label="安全数量下限" :min-width="flexWidth('safe_qty_lower_limit',crud.data,'安全数量下限')" />
<el-table-column prop="safe_qty_upper_limit" label="安全数量上限" :min-width="flexWidth('safe_qty_upper_limit',crud.data,'安全数量上限')" />
<el-table-column prop="safe_days" label="超期天数" :min-width="flexWidth('safe_days',crud.data,'超期天数')" />
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
<el-table-column label="是否启用" align="center" prop="is_active">
<template slot-scope="scope">
@@ -164,7 +100,7 @@
<script>
import crudStIvtForewarningconfig from './stIvtForewarningconfig'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
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'
@@ -173,28 +109,10 @@ import crudStorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
import AddDialog from '@/views/wms/forewarning_management/forewarning_config/AddDialog.vue'
import stIvtForewarningconfig from '@/views/wms/forewarning_management/forewarning_config/stIvtForewarningconfig'
const defaultForm = {
id: null,
name: null,
stor_code: null,
safe_qty: null,
safe_days: null,
remark: null,
is_active: null,
is_delete: null,
create_id: null,
create_name: null,
create_time: null,
update_id: null,
update_name: null,
update_time: null,
cron: null,
notify_type: null
}
export default {
name: 'StIvtForewarningconfig',
components: { AddDialog, pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
mixins: [presenter(), header(), crud()],
dicts: ['NOTIFY_TYPE'],
cruds() {
return CRUD({
@@ -220,8 +138,9 @@ export default {
queryTypeOptions: [
{ key: 'name', display_name: '方案名称' },
{ key: 'stor_code', display_name: '仓库编码' },
{ key: 'safe_qty', display_name: '安全库存数量' },
{ key: 'safe_days', display_name: '安全库存数' },
{ key: 'safe_qty_lower_limit', display_name: '安全库存数量下限' },
{ key: 'safe_qty_upper_limit', display_name: '安全库存数量上限' },
{ key: 'safe_days', display_name: '超期天数' },
{ key: 'notify_type', display_name: '通知类型' }
],
stors: []
@@ -238,6 +157,7 @@ export default {
return true
},
querytable() {
this.$refs.table.clearSelection()
this.crud.toQuery()
},
changeEnabled(data, val) {

View File

@@ -21,10 +21,34 @@
:value="item.stor_code"
/>
</el-select>
<label class="el-form-item-label">已读/未读</label>
<el-select
v-model="query.is_read"
placeholder=""
style="width: 200px"
>
<el-option
v-for="item in readList"
:key="item.key"
:label="item.label"
:value="item.key"
/>
</el-select>
<rrOperation :crud="crud" />
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
@click="read"
>
已读
</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" />
@@ -33,10 +57,22 @@
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="stor_code" label="仓库编码" :min-width="flexWidth('stor_code',crud.data,'仓库编码')" />
<el-table-column prop="stor_name" label="仓库名称" :min-width="flexWidth('stor_name',crud.data,'仓库名称')" />
<el-table-column prop="sect_code" label="库区编码" :min-width="flexWidth('sect_code',crud.data,'库区编码')" />
<el-table-column prop="sect_name" label="库区名称" :min-width="flexWidth('sect_name',crud.data,'库区名称')" />
<el-table-column prop="struct_code" label="仓位编码" :min-width="flexWidth('struct_code',crud.data,'仓位编码')" />
<el-table-column prop="struct_name" label="仓位名称" :min-width="flexWidth('struct_name',crud.data,'仓位名称')" />
<el-table-column prop="insert_time" label="入库时间" :min-width="flexWidth('insert_time',crud.data,'入库时间')" />
<el-table-column prop="overdue_days" label="超时天数" :min-width="flexWidth('overdue_days',crud.data,'超时天数')" />
<el-table-column prop="safe_days" label="安全天数" :min-width="flexWidth('safe_days',crud.data,'安全天数')" />
<el-table-column label="已读/未读" align="center" prop="is_read" :min-width="flexWidth('is_read',crud.data,'已读/未读')">
<template #default="scope">
<span :style="{ color: getColor(scope.row.is_read) }">{{ scope.row.is_read?'已读':'未读' }}</span>
</template>
</el-table-column>
<el-table-column prop="create_time" label="预警时间" :min-width="flexWidth('create_time',crud.data,'预警时间')" />
<!--
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
-->
</el-table>
<!--分页组件-->
<pagination />
@@ -102,7 +138,11 @@ export default {
{ key: 'material_name', display_name: '物料名称' },
{ key: 'stor_code', display_name: '仓位编码' }
],
stors: []
stors: [],
readList: [
{ key: '1', label: '已读' },
{ key: '0', label: '未读' }
]
}
},
created() {
@@ -114,6 +154,33 @@ export default {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
read() {
const res = this.$refs.table.selection
if (!res || res.length < 1) {
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.fullscreenLoading = true
const ids = []
if (res instanceof Array) {
res.forEach(val => {
ids.push(val.id)
})
} else {
ids.push(res.id)
}
crudStIvtOverdueforewarning.read(ids).then(res => {
this.crud.notify('操作成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).finally(() => {
this.fullscreenLoading = false
this.crud.toQuery()
})
},
getColor(is_read) {
if (is_read === false) {
return 'red'
}
}
}
}

View File

@@ -24,4 +24,12 @@ export function edit(data) {
})
}
export default { add, edit, del }
export function read(data) {
return request({
url: 'api/stIvtOverdueforewarning/read',
method: 'post',
data
})
}
export default { add, edit, del, read }

View File

@@ -21,10 +21,34 @@
:value="item.stor_code"
/>
</el-select>
<label class="el-form-item-label">已读/未读</label>
<el-select
v-model="query.is_read"
placeholder=""
style="width: 200px"
>
<el-option
v-for="item in readList"
:key="item.key"
:label="item.label"
:value="item.key"
/>
</el-select>
<rrOperation :crud="crud" />
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
@click="read"
>
已读
</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" />
@@ -33,9 +57,22 @@
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="stor_code" label="仓库编码" :min-width="flexWidth('stor_code',crud.data,'仓库编码')" />
<el-table-column prop="stor_name" label="仓库名称" :min-width="flexWidth('stor_name',crud.data,'仓库名称')" />
<el-table-column prop="sect_code" label="库区编码" :min-width="flexWidth('sect_code',crud.data,'库区编码')" />
<el-table-column prop="sect_name" label="库区名称" :min-width="flexWidth('sect_name',crud.data,'库区名称')" />
<el-table-column prop="struct_code" label="仓位编码" :min-width="flexWidth('struct_code',crud.data,'仓位编码')" />
<el-table-column prop="struct_name" label="仓位名称" :min-width="flexWidth('struct_name',crud.data,'仓位名称')" />
<el-table-column prop="current_qty" label="当前数量" :min-width="flexWidth('current_qty',crud.data,'当前数量')" />
<el-table-column prop="safe_qty" label="安全数量" :min-width="flexWidth('safe_qty',crud.data,'安全数量')" />
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
<el-table-column prop="safe_qty_lower_limit" label="安全数量下限" :min-width="flexWidth('safe_qty_lower_limit',crud.data,'安全数量下限')" />
<el-table-column prop="safe_qty_upper_limit" label="安全数量上限" :min-width="flexWidth('safe_qty_upper_limit',crud.data,'安全数量上限')" />
<el-table-column label="已读/未读" align="center" prop="is_read" :min-width="flexWidth('is_read',crud.data,'已读/未读')">
<template #default="scope">
<span :style="{ color: getColor(scope.row.is_read) }">{{ scope.row.is_read?'已读':'未读' }}</span>
</template>
</el-table-column>
<el-table-column prop="create_time" label="预警时间" :min-width="flexWidth('create_time',crud.data,'预警时间')" />
<!--
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" />
-->
</el-table>
<!--分页组件-->
<pagination />
@@ -58,7 +95,8 @@ const defaultForm = {
material_name: null,
stor_code: null,
current_qty: null,
safe_qty: null,
safe_qty_lower_limit: null,
safe_qty_upper_limit: null,
remark: null,
is_delete: null,
create_id: null,
@@ -100,7 +138,11 @@ export default {
{ key: 'material_name', display_name: '物料名称' },
{ key: 'stor_code', display_name: '仓位编码' }
],
stors: []
stors: [],
readList: [
{ key: '1', label: '已读' },
{ key: '0', label: '未读' }
]
}
},
created() {
@@ -112,6 +154,33 @@ export default {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
read() {
const res = this.$refs.table.selection
if (!res || res.length < 1) {
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.fullscreenLoading = true
const ids = []
if (res instanceof Array) {
res.forEach(val => {
ids.push(val.id)
})
} else {
ids.push(res.id)
}
crudStIvtSafetyforewarning.read(ids).then(res => {
this.crud.notify('操作成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
}).finally(() => {
this.fullscreenLoading = false
this.crud.toQuery()
})
},
getColor(is_read) {
if (is_read === false) {
return 'red'
}
}
}
}

View File

@@ -23,5 +23,12 @@ export function edit(data) {
data
})
}
export function read(data) {
return request({
url: 'api/stIvtSafetyforewarning/read',
method: 'post',
data
})
}
export default { add, edit, del }
export default { add, edit, del, read }