添加停用校验并且添加全部添加物料功能及全部移除物料功能

This commit is contained in:
yangjun 2025-10-30 15:34:13 +08:00
parent 9aaa7a724e
commit a962915119
7 changed files with 448 additions and 18 deletions

View File

@ -143,6 +143,55 @@ export const columns3: BasicColumn[] = [
},
];
export const columns4: BasicColumn[] = [
{
title: '物料',
align: "center",
dataIndex: 'materialName'
},
{
title: '物料编码',
align: "center",
dataIndex: 'materialNo'
},
{
title: '规格型号',
align: "center",
dataIndex: 'specificationModel'
},
{
title: '一级分类',
align: "center",
dataIndex: 'categoryId_dictText'
},
{
title: '二级分类',
align: "center",
dataIndex: 'typeId_dictText'
},
{
title: '三级分类',
align: "center",
dataIndex: 'medicationId_dictText'
},
{
title: '库存数量',
align: "center",
dataIndex: 'kcsl'
},
{
title: '物料上限',
align: "center",
dataIndex: 'upperLimit'
},
{
title: '物料下限',
align: "center",
dataIndex: 'lowerLimit'
},
];
//列表数据
export const ckcolumns: BasicColumn[] = [
{

View File

@ -67,7 +67,9 @@
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" v-auth="'warehouseMaterialInfo:bl_warehouse_material_info:add'" @click="handleAdd"
preIcon="ant-design:plus-outlined"> 选择物料</a-button>
preIcon="ant-design:plus-outlined"> 添加物料</a-button>
<a-button type="primary" v-auth="'warehouseMaterialInfo:bl_warehouse_material_info:add'" @click="handleDel"
preIcon="ant-design:plus-outlined"> 移除物料</a-button>
</template>
<!--操作栏-->
<template #action="{ record }">
@ -78,8 +80,10 @@
</BasicTable>
<!-- 表单区域 -->
<BlWarehouseMaterialInfoModal ref="registerModal" @success="handleSuccess"></BlWarehouseMaterialInfoModal>
<!-- 选择物料 -->
<!-- 添加物料 -->
<CheckWuliaoModal ref="registerAddModal" @success="handleSuccess"></CheckWuliaoModal>
<!-- 移除物料 -->
<DelWuliaoModal ref="registerDelModal" @success="handleSuccess"></DelWuliaoModal>
<!-- 出入库详情 -->
<NuWarehouseMaterialCrkInfoListModal ref="registerCrkModal" @success="handleSuccess">
</NuWarehouseMaterialCrkInfoListModal>
@ -95,6 +99,7 @@ import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './BlWa
import { downloadFile } from '/@/utils/common/renderUtils';
import BlWarehouseMaterialInfoModal from './components/BlWarehouseMaterialInfoModal.vue'
import CheckWuliaoModal from './components/CheckWuliaoModal.vue'
import DelWuliaoModal from './components/DelWuliaoModal.vue'
import NuWarehouseMaterialCrkInfoListModal from '/@/views/invoicing/warehouseMaterialInfo/NuWarehouseMaterialCrkInfoListModal.vue'
import { useUserStore } from '/@/store/modules/user';
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
@ -109,6 +114,7 @@ const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const registerAddModal = ref();
const registerDelModal = ref();
const registerCrkModal = ref();
const userStore = useUserStore();
const { createConfirm } = useMessage();
@ -172,6 +178,14 @@ function handleAdd() {
registerAddModal.value.disableSubmit = false;
registerAddModal.value.edit(params);
}
/**
* 新增事件
*/
function handleDel() {
var params = { nuId: queryParam.nuId }
registerDelModal.value.disableSubmit = false;
registerDelModal.value.edit(params);
}
/**
* 编辑事件

View File

@ -56,7 +56,7 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
const { createConfirm , createMessage } = useMessage();
const formRef = ref();
const queryParam = reactive<any>({areaFlag:'3'});
@ -154,26 +154,37 @@ const { createConfirm } = useMessage();
},
];
}
function handleQyty(record,izEnabled) {
async function handleQyty(record,izEnabled) {
var title = "是否启用";
var content = "是否启用此仓库";
var sfjx = "0";
if(izEnabled == '5'){
title = "是否停用";
content = "是否停用此仓库";
await defHttp.get({ url: '/invoicing/blWarehouseMaterialInfo/sfkytyList', params: { nuId: record.nuId} }).then(res => {
console.log("🚀 ~ handleQyty ~ res:", res.total)
if(res.total > 0){
sfjx = "1";
}
});
}
createConfirm({
iconType: 'warning',
title: title,
content: content,
okText: '确认',
cancelText: '取消',
onOk: () => {
defHttp.put({ url: '/nuBaseInfo/nuBaseInfo/edit', params: { id: record.id,status:izEnabled} }).then(res => {
handleSuccess();
});
}
});
if(sfjx == '1'){
createMessage.error("此仓库下的物料库存不为零,请将物料的库存归零后再进行操作!");
return;
}
// createConfirm({
// iconType: 'warning',
// title: title,
// content: content,
// okText: '',
// cancelText: '',
// onOk: () => {
// defHttp.put({ url: '/nuBaseInfo/nuBaseInfo/edit', params: { id: record.id,status:izEnabled} }).then(res => {
// handleSuccess();
// });
// }
// });
}

View File

@ -210,10 +210,18 @@ import { defHttp } from '/@/utils/http/axios';
})
// emit('ok',selectedRows.value);
}
function submitAllForm() {
defHttp.post({url:'/invoicing/blWarehouseMaterialInfo/addAllWuliao',params:{nuId:formData.nuId}}).then(res=>{
console.log("🚀 ~ submitForm ~ res:", res)
emit('ok');
})
// emit('ok',selectedRows.value);
}
defineExpose({
edit,
submitForm,
submitAllForm
});

View File

@ -4,7 +4,8 @@
<CheckWuliaoForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></CheckWuliaoForm>
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">确认</a-button>
<a-button type="primary" style="margin-right: 8px" @click="handleAllOk" v-if="!disableSubmit">添加全部</a-button>
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">添加</a-button>
</template>
</a-drawer>
</template>
@ -37,7 +38,7 @@
* @param record
*/
function edit(record) {
title.value = '选择物料';
title.value = '添加物料';
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
@ -50,6 +51,12 @@
function handleOk() {
registerForm.value.submitForm();
}
/**
* 确定按钮点击事件
*/
function handleAllOk() {
registerForm.value.submitAllForm();
}
/**
* form保存回调事件

View File

@ -0,0 +1,254 @@
<template>
<div>
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="paramWlxx">
<template #label><span title="物料信息">物料信息</span></template>
<a-input placeholder="请填写物料信息" v-model:value="queryParam.paramWlxx" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)"/>
</template>
<template v-slot:bodyCell="{ column, record, index, text }">
</template>
</BasicTable>
</div>
</template>
<script lang="ts" name="materialInfo-nuConfigMaterialInfo" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns4 } from '../BlWarehouseMaterialInfo.data';
import { list, batchDelete } from '../BlWarehouseMaterialInfo.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { useUserStore } from '/@/store/modules/user';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage,createConfirm } = useMessage();
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const userStore = useUserStore();
const emit = defineEmits(['register', 'ok']);
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({})},
formBpm: { type: Boolean, default: true }
});
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: 'nu_config_material_info',
api: list,
columns: columns4,
canResize:false,
useSearchForm: false,
immediate: false,
showActionColumn: false,
showTableSetting: false,
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: async (params) => {
return Object.assign(params, queryParam);
},
},
});
const formData = reactive<Record<string, any>>({
id: '',
nuId: '',
wlId: '',
upperLimit: '',
lowerLimit: '',
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys, selectedRows }] = tableContext;
const labelCol = reactive({
xs:24,
sm:4,
xl:6,
xxl:4
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
},
];
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
selectedRowKeys.value = [];
//
reload();
}
async function edit(record) {
console.log("🚀 ~ edit ~ record:", record)
selectedRowKeys.value = [];
selectedRows.value = [];
nextTick(() => {
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//
Object.assign(formData, tmpData);
});
// var checkId = "";
// for(let item of record){
// checkId += item.id + ",";
// }
// if(checkId.length > 0){
// checkId = checkId.substring(0,checkId.length - 1);
// }
queryParam.nuId = formData.nuId;
reload();
}
function submitForm() {
var list = selectedRows.value;
if(list.length == 0){
createMessage.warning('请选择想要移除的物料!');
return;
}
var ids = "";
for(let item of list){
if(parseFloat(item.kcsl) == 0){
ids += item.id + ",";
}else{
createMessage.warning('库存数量大于0的物料不予移除,请重新选择!');
return;
}
}
if(ids.length == 0){
createMessage.warning('请选择想要移除的物料,库存数量大于0的物料不予移除');
return;
}
if(ids.length > 0){
ids = ids.substring(0,ids.length - 1);
}
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
defHttp.get({url:'/invoicing/blWarehouseMaterialInfo/deleteBatch',params:{ids}}).then(res=>{
console.log("🚀 ~ submitForm ~ res:", res)
emit('ok');
})
}
});
// batchDelete(ids,emit('ok'))
// emit('ok',selectedRows.value);
}
function handleAllDel() {
defHttp.get({url:'/invoicing/blWarehouseMaterialInfo/deleteAllWuliao',params:{nuId:formData.nuId}}).then(res=>{
emit('ok');
})
}
defineExpose({
edit,
submitForm,
handleAllDel
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust{
min-width: 100px !important;
}
.query-group-split-cust{
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help){
margin-bottom: 16px;
height: 32px;
}
:deep(.ant-picker),:deep(.ant-input-number){
width: 100%;
}
}
</style>

View File

@ -0,0 +1,87 @@
<template>
<a-drawer :title="title" :width="width" v-model:visible="visible" :closable="true"
:footer-style="{ textAlign: 'right' }" @close="handleCancel">
<DelWuliaoForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></DelWuliaoForm>
<template #footer>
<a-button type="primary" style="margin-right: 8px" @click="handleCancel">关闭</a-button>
<a-button type="primary" style="margin-right: 8px" @click="handleAllDel" v-if="!disableSubmit">移除全部</a-button>
<a-button type="primary" @click="handleOk" v-if="!disableSubmit">移除</a-button>
</template>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import DelWuliaoForm from './DelWuliaoForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
const title = ref<string>('');
const width = ref<string>('80%');
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 新增
*/
function add() {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add();
});
}
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = '移除物料';
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
function handleAllDel() {
registerForm.value.handleAllDel();
}
/**
* form保存回调事件
*/
function submitCallback(record) {
console.log("🚀 11111~ submitCallback ~ record:", record)
handleCancel();
emit('success',record);
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
defineExpose({
add,
edit,
disableSubmit,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>