Commit 1f97b369 by 王宝涛

feat(ccbg): 新增拆车物料入库功能

- 添加拆车物料入库API接口定义
- 实现拆车物料入库功能组件InWarehouse.vue
- 在主页面集成入库功能入口和事件处理
- 更新按钮配置支持入库操作
- 移除配置文件中的默认选择设置
- 优化表格操作按钮样式配置
parent d363e533
...@@ -8,7 +8,7 @@ enum Api { ...@@ -8,7 +8,7 @@ enum Api {
List = '/chaiche/ccbg/list', List = '/chaiche/ccbg/list',
Info = '/chaiche/ccbg/info', Info = '/chaiche/ccbg/info',
MesCheliangBg = '/chaiche/ccbg', MesCheliangBg = '/chaiche/ccbg',
InWarehouse = '/chaiche/ccbg/in-warehouse',
} }
...@@ -88,6 +88,19 @@ export async function deleteMesCheliangBg(ids: string[], mode: ErrorMessageMode ...@@ -88,6 +88,19 @@ export async function deleteMesCheliangBg(ids: string[], mode: ErrorMessageMode
); );
} }
/**
* @description: 拆车物料入库
*/
export async function inWarehouse(wlList: Recordable[], mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.InWarehouse,
params: wlList,
},
{
errorMessageMode: mode,
},
);
}
...@@ -135,4 +135,3 @@ ...@@ -135,4 +135,3 @@
</script> </script>
\ No newline at end of file
<template>
<BasicModal
:height="600"
:width="900"
v-bind="$attrs" @register="registerModal" :title="getTitle"
@ok="handleSubmit" @cancel="handleClose" >
<div style="margin: 20px;">
<a-button type="primary" style="margin-bottom: 10px; margin-right: 10px;" @click="handleAllInWarehouse">全部入库</a-button>
<a-button type="primary" style="margin-bottom: 10px;" @click="handleCancelInWarehouse">取消全部入库</a-button>
<a-table bordered :data-source="dataSource" :columns="columns" :pagination="false" >
<template #bodyCell="{ column, text, record, index }">
<template v-if="column.key === 'index'">
{{ index + 1 }}
</template>
<template v-if="column.dataIndex === 'bcrksl'">
<a-input-number v-model:value="record.bcrksl" :min="0" :max="record.sl - record.yrlsl" />
</template>
</template>
</a-table>
</div>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, onMounted, reactive, provide, Ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { getMesCheliangBg, inWarehouse } from '/@/api/chaiche/ccbg';
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const formRef = ref();
const isCopy = ref<boolean>(false)
const state = reactive({
formModel: {},
isUpdate: true,
isView: false,
rowId: '',
});
provide<Ref<boolean>>('isCopy', isCopy);
const [registerModal, { closeModal }] = useModalInner(async () => {
});
const props = defineProps(['recordId'])
const getTitle = computed(() => ('拆车物料入库'));
const dataSource = ref([]);
const columns = reactive([
{
title: '序号',
dataIndex: 'index',
key: 'index',
align: 'center',
},
{
title: '物料名称',
dataIndex: 'cpmc',
key: 'cpmc',
},
{
title: '物料编码',
dataIndex: 'cpbh',
key: 'cpbh',
},
{
title: '单位',
dataIndex: 'dw',
key: 'dw',
},
{
title: '总数量',
dataIndex: 'sl',
key: 'sl',
},
{
title: '已入库数量',
dataIndex: 'yrlsl',
key: 'yrlsl',
},
{
title: '本次入库数量',
dataIndex: 'bcrksl',
key: 'bcrksl',
},
]);
onMounted(async () => {
const recordInfo = await getMesCheliangBg(props.recordId);
recordInfo.mesCheliangBgCpList.forEach(item => {
item.bcrksl = 0;
})
dataSource.value = recordInfo.mesCheliangBgCpList;
})
function handleAllInWarehouse() {
dataSource.value.forEach(item => {
item.bcrksl = item.sl - item.yrlsl;
});
}
function handleCancelInWarehouse() {
dataSource.value.forEach(item => {
item.bcrksl = 0;
});
}
async function handleSubmit() {
await inWarehouse(dataSource.value);
notification.success({
message: 'Tip',
description: '入库成功',
});
handleClose();
}
function handleClose() {
emit('success')
}
</script>
...@@ -513,7 +513,6 @@ export const formProps: FormProps = { ...@@ -513,7 +513,6 @@ export const formProps: FormProps = {
datasourceType: 'dic', datasourceType: 'dic',
labelField: 'name', labelField: 'name',
valueField: 'value', valueField: 'value',
defaultSelect: null,
apiConfig: { apiConfig: {
path: 'CodeGeneration/selection', path: 'CodeGeneration/selection',
method: 'GET', method: 'GET',
......
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
<CcbgModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel"/> <CcbgModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel"/>
<InWarehouse v-if="showInWarehouse" :visible="showInWarehouse" :recordId="recordId"
@success="handleInWarehouseSuccess" @cancel="handleInWarehouseCancel"/>
...@@ -84,6 +86,7 @@ ...@@ -84,6 +86,7 @@
import CcbgModal from './components/CcbgModal.vue'; import CcbgModal from './components/CcbgModal.vue';
import InWarehouse from './components/InWarehouse.vue';
...@@ -103,7 +106,8 @@ ...@@ -103,7 +106,8 @@
const showInWarehouse = ref(false);
const recordId = ref(null);
const listSpliceNum = ref(3); //操作列最先展示几个 const listSpliceNum = ref(3); //操作列最先展示几个
...@@ -133,7 +137,7 @@ ...@@ -133,7 +137,7 @@
//展示在列表内的按钮 //展示在列表内的按钮
const actionButtons = ref<string[]>(["view","inWarehouse","delete"]); const actionButtons = ref<string[]>(["view","inWarehouse","delete"]);
const buttonConfigs = computed(()=>{ const buttonConfigs = computed(()=>{
const list = [{"buttonId":"2018972431831822336","name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"buttonId":"2018972431831822337","name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true},{"buttonId":"2019669737161912320","name":"入库","code":"inWarehouse","icon":"ant-design:home-twotone","isDefault":false,"isUse":true,"setting":[],"showType":"inline","buttonType":"modal"},{"buttonId":"2018972431831822339","name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}] const list = [{"buttonId":"2018972431831822336","name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"buttonId":"2018972431831822337","name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true},{"buttonId":"2019669737161912320","name":"入库","code":"inWarehouse","icon":"ant-design:home-twotone","isDefault":false,"isUse":true,"setting":[],"showType":"inline","buttonType":"primary"},{"buttonId":"2018972431831822339","name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]
return filterButtonAuth(list); return filterButtonAuth(list);
}) })
...@@ -145,7 +149,7 @@ ...@@ -145,7 +149,7 @@
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code)); return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
}); });
const btnEvent = {view : handleView,add : handleAdd,delete : handleDelete,} const btnEvent = {view : handleView,add : handleAdd,delete : handleDelete,inWarehouse : handleInWarehouse}
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
...@@ -262,7 +266,10 @@ ...@@ -262,7 +266,10 @@
}); });
} }
function handleInWarehouse(record: Recordable) {
showInWarehouse.value = true;
recordId.value = record.id;
}
...@@ -310,6 +317,13 @@ ...@@ -310,6 +317,13 @@
handleCloseFormEnableLocke(buttonConfigs.value, 'edit'); handleCloseFormEnableLocke(buttonConfigs.value, 'edit');
} }
function handleInWarehouseSuccess() {
showInWarehouse.value = false;
}
function handleInWarehouseCancel() {
showInWarehouse.value = false;
}
function handleView(record: Recordable) { function handleView(record: Recordable) {
let info={ let info={
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment