Commit 6a8a1691 by 董晓奇

(3)报废车入库的时候需要挂载明细,该单据入库后和预处理页面根据明细进行校验,已入库的可以进行作业。

处理思路,采购入库的时候增加独立菜单,报废车采购入库,需要上传采购入库明细,明细见仓库模板---待定

1.添加明细行中查看关联报废车按钮
2.将报废车入库与采购入库通过单据类型字段分开
3.添加清理数据表sql文件
4.添加报废车关联校验接口
5.去除不能修改用户和重置密码的限制
parent d618696e
......@@ -44,7 +44,7 @@ VITE_GLOB_API_URL_PREFIX =
VITE_USE_PWA = false
# 是否启用官网代码
VITE_GLOB_PRODUCTION = true
VITE_GLOB_PRODUCTION = false
# 帆软服务地址
VITE_GLOB_FINE_REPORT_URL = http://127.0.0.1:8075
......@@ -44,7 +44,7 @@ VITE_GLOB_API_URL_PREFIX =
VITE_USE_PWA = false
# 是否启用官网代码
VITE_GLOB_PRODUCTION = true
VITE_GLOB_PRODUCTION = false
# 帆软服务地址
VITE_GLOB_FINE_REPORT_URL = http://127.0.0.1:8075
import { MesWarehouseInPageModel, MesWarehouseInPageParams, MesWarehouseInPageResult } from './model/BfccgrkModel';
import {
MesWarehouseInPageModel,
MesWarehouseInPageParams,
MesWarehouseInPageResult,
} from './model/BfccgrkModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
......@@ -8,16 +11,17 @@ enum Api {
List = '/ckgl/bfccgrk/list',
Info = '/ckgl/bfccgrk/info',
MesWarehouseIn = '/ckgl/bfccgrk',
Export = '/ckgl/bfccgrk/export',
ListByBfc = '/magic-api/getBfcListByids',
}
/**
* @description: 查询MesWarehouseIn分页列表
*/
export async function getMesWarehouseInPage(params: MesWarehouseInPageParams, mode: ErrorMessageMode = 'modal') {
export async function getMesWarehouseInPage(
params: MesWarehouseInPageParams,
mode: ErrorMessageMode = 'modal',
) {
return defHttp.get<MesWarehouseInPageResult>(
{
url: Api.Page,
......@@ -47,7 +51,10 @@ export async function getMesWarehouseIn(id: String, mode: ErrorMessageMode = 'mo
/**
* @description: 新增MesWarehouseIn
*/
export async function addMesWarehouseIn(mesWarehouseIn: Recordable, mode: ErrorMessageMode = 'modal') {
export async function addMesWarehouseIn(
mesWarehouseIn: Recordable,
mode: ErrorMessageMode = 'modal',
) {
return defHttp.post<boolean>(
{
url: Api.MesWarehouseIn,
......@@ -62,7 +69,10 @@ export async function addMesWarehouseIn(mesWarehouseIn: Recordable, mode: ErrorM
/**
* @description: 更新MesWarehouseIn
*/
export async function updateMesWarehouseIn(mesWarehouseIn: Recordable, mode: ErrorMessageMode = 'modal') {
export async function updateMesWarehouseIn(
mesWarehouseIn: Recordable,
mode: ErrorMessageMode = 'modal',
) {
return defHttp.put<boolean>(
{
url: Api.MesWarehouseIn,
......@@ -89,15 +99,10 @@ export async function deleteMesWarehouseIn(ids: string[], mode: ErrorMessageMode
);
}
/**
* @description: 导出MesWarehouseIn
*/
export async function exportMesWarehouseIn(
params?: object,
mode: ErrorMessageMode = 'modal'
) {
export async function exportMesWarehouseIn(params?: object, mode: ErrorMessageMode = 'modal') {
return defHttp.download(
{
url: Api.Export,
......@@ -111,4 +116,10 @@ export async function exportMesWarehouseIn(
);
}
export async function getBfcListByids(ids: string) {
return defHttp.get<any>({
url: Api.ListByBfc,
params: { ids },
isTransformResponse: false, // 关闭自动转换,直接获取原始响应数据
});
}
<template>
<BasicModal
:height="1080"
v-bind="$attrs" @register="registerModal" :title="getTitle"
@ok="handleSubmit" @cancel="handleClose" >
v-bind="$attrs"
@register="registerModal"
:title="getTitle"
@ok="handleSubmit"
@cancel="handleClose"
>
<ModalForm ref="formRef" v-model:value="state.formModel" :fromPage="FromPageType.MENU" />
<template #footer v-if=" !state.isView">
<template #footer v-if="!state.isView">
<template v-for="(item, index) in sortBy(formButtons, 'index')" :key="item.key">
<template v-if="item.isShow">
<CustomButtonModal v-if="item.type == CustomButtonModalType.Modal" :info="item" />
......@@ -23,28 +24,45 @@
</template>
</template>
</BasicModal>
<ShowBfcModal @register="registerBfcModal" />
</template>
<script lang="ts" setup>
import { ref, computed, reactive, provide, Ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { ref, computed, reactive, provide, Ref, onMounted, onUnmounted } from 'vue';
import { BasicModal, useModal, useModalInner } from '/@/components/Modal';
import { CustomButtonModalType } from '/@/enums/userEnum';
import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { formProps ,formButtons } from './config';
import { formProps, formButtons } from './config';
import ModalForm from './Form.vue';
import { FromPageType } from '/@/enums/workflowEnum';
import { sortBy } from 'lodash-es';
import { executeCurFormEvent } from '/@/utils/event/data';
import ShowBfcModal from './ShowBfcModal.vue';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [registerBfcModal, { openModal: openBfcModal }] = useModal();
const showBfcModal = (rowData: any) => {
openBfcModal(true, {
bfcIds: rowData.bfcIds,
bfcCodes: rowData.bfcCodes,
});
};
// 挂载到 window 供按钮配置调用(组件卸载时移除)
onMounted(() => {
window.showBfcModal = showBfcModal;
});
onUnmounted(() => {
delete window.showBfcModal;
});
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const formRef = ref();
const isCopy = ref<boolean>(false)
const isCopy = ref<boolean>(false);
const state = reactive({
formModel: {},
isUpdate: true,
......@@ -58,10 +76,11 @@
await handleInner(data);
});
const getTitle = computed(() => (state.isView ? '查看' : state.isUpdate ? '编辑' : isCopy.value ? '复制数据' : '新增'));
const getTitle = computed(() =>
state.isView ? '查看' : state.isUpdate ? '编辑' : isCopy.value ? '复制数据' : '新增',
);
async function handleInner(data){
async function handleInner(data) {
state.isUpdate = !!data?.isUpdate;
state.isView = !!data?.isView;
isCopy.value = !!data?.isCopy;
......@@ -73,7 +92,8 @@
showOkBtn: false,
canFullscreen: true,
width: 1980,
footer: state.isView ? null : undefined,defaultFullscreen:true,
footer: state.isView ? null : undefined,
defaultFullscreen: true,
});
if (state.isUpdate || state.isView || isCopy.value) {
......@@ -85,10 +105,9 @@
await formRef.value.setFormDataFromId(state.rowId);
} else {
formRef.value.resetFields();
}
}
async function saveModal() {
let saveSuccess = false;
try {
......@@ -140,15 +159,14 @@
emit('success');
}
} finally {
setModalProps({ confirmLoading: false });
}
}
function customClick(item) {
if (item.key == 'confirm') {
handleSubmit();
} else if (item.key == 'cancel' && props.formType !== 'normal') {
} else if (item.key == 'cancel') {
handleClose();
closeModal();
} else if (item.key == 'reset') {
......@@ -157,10 +175,8 @@
executeCurFormEvent(item.event, state.formModel, true);
}
}
function handleClose() {
formRef.value.resetFields();
}
</script>
\ No newline at end of file
<template>
<div class="pt-4">
<SimpleForm
ref="systemFormRef"
:formProps="data.formDataProps"
:formModel="state.formModel"
:isWorkFlow="props.fromPage!=FromPageType.MENU"
:isWorkFlow="props.fromPage != FromPageType.MENU"
:isCamelCase="true"
@model-change="handleChange"
/>
......@@ -21,7 +20,12 @@
import { usePermission } from '/@/hooks/web/usePermission';
import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue';
import { FromPageType } from '/@/enums/workflowEnum';
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent';
import {
createFormEvent,
getFormDataEvent,
loadFormEvent,
submitFormEvent,
} from '/@/hooks/web/useFormEvent';
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
import { useRouter } from 'vue-router';
......@@ -29,7 +33,7 @@
const { filterFormSchemaAuth } = usePermission();
const RowKey = 'id';
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'update:value']);
const emits = defineEmits(['changeUploadComponentIds', 'loadingCompleted', 'update:value']);
const props = defineProps({
fromPage: {
type: Number,
......@@ -42,7 +46,7 @@
});
const state = reactive({
formModel: {},
formInfo:{formId:'',formName:''}
formInfo: { formId: '', formName: '' },
});
const { currentRoute } = useRouter();
watch(
......@@ -59,17 +63,35 @@
try {
if (props.fromPage == FromPageType.MENU) {
setMenuPermission();
if(currentRoute.value.meta){
state.formInfo.formName = currentRoute.value.meta.title&&isString(currentRoute.value.meta.title)?currentRoute.value.meta.title:'';
state.formInfo.formId = currentRoute.value.meta.formId&&isString(currentRoute.value.meta.formId)?currentRoute.value.meta.formId:'';
if (currentRoute.value.meta) {
state.formInfo.formName =
currentRoute.value.meta.title && isString(currentRoute.value.meta.title)
? currentRoute.value.meta.title
: '';
state.formInfo.formId =
currentRoute.value.meta.formId && isString(currentRoute.value.meta.formId)
? currentRoute.value.meta.formId
: '';
}
await createFormEvent(formEventConfigs, state.formModel,
await createFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:初始化表单
await nextTick();
await loadFormEvent(formEventConfigs, state.formModel,
await loadFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:加载表单
} else if (props.fromPage == FromPageType.FLOW) {
emits('loadingCompleted'); //告诉系统表单已经加载完毕
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
......@@ -78,15 +100,28 @@
} else if (props.fromPage == FromPageType.DESKTOP) {
// 桌面设计 表单事件需要执行
emits('loadingCompleted'); //告诉系统表单已经加载完毕
await createFormEvent(formEventConfigs, state.formModel,
await createFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:初始化表单
await loadFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:加载表单
}
} catch (error) {}
});
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function setMenuPermission() {
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
......@@ -107,19 +142,25 @@
}
return values;
}
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
async function setFormDataFromId(rowId) {
try {
const record = await getMesWarehouseIn(rowId);
setFieldsValue(record);
state.formModel = record;
await getFormDataEvent(formEventConfigs, state.formModel,
await getFormDataEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:获取表单数据
} catch (error) {
}
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:获取表单数据
} catch (error) {}
}
// 辅助返回表单数据
async function getFieldsValue() {
let values = [];
......@@ -135,45 +176,64 @@
}
return values;
}
// 辅助设置表单数据
function setFieldsValue(record) {
systemFormRef.value.setFieldsValue(record);
}
// 重置表单数据
async function resetFields() {
await systemFormRef.value.resetFields();
}
// 设置表单数据全部为Disabled 【查看】
async function setDisabledForm( ) {
async function setDisabledForm() {
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas));
}
// 获取行键值
function getRowKey() {
return RowKey;
}
// 更新api表单数据
async function update({ values, rowId }) {
try {
values[RowKey] = rowId;
state.formModel = values;
let saveVal = await updateMesWarehouseIn(values);
await submitFormEvent(formEventConfigs, state.formModel,
await submitFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 新增api表单数据
async function add(values) {
try {
state.formModel = values;
let saveVal = await addMesWarehouseIn(values);
await submitFormEvent(formEventConfigs, state.formModel,
await submitFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async function setWorkFlowForm(obj: WorkFlowFormParams) {
try {
......@@ -189,16 +249,30 @@
state.formModel = formModels;
setFieldsValue(formModels);
} catch (error) {}
await createFormEvent(formEventConfigs, state.formModel,
await createFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:初始化表单
await loadFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:加载表单
}
function handleChange(val) {
emits('update:value', val);
}
async function sendMessageForAllIframe() {
try {
if (systemFormRef.value && systemFormRef.value.sendMessageForAllIframe) {
......@@ -206,6 +280,7 @@
}
} catch (error) {}
}
defineExpose({
setFieldsValue,
resetFields,
......@@ -218,8 +293,6 @@
setWorkFlowForm,
getRowKey,
getFieldsValue,
sendMessageForAllIframe
sendMessageForAllIframe,
});
</script>
\ No newline at end of file
<template>
<BasicModal
v-bind="$attrs"
@register="registerModal"
title="关联报废车"
width="800px"
:footer="null"
:loading="loading"
zIndex="9999"
>
<div v-if="loading" class="empty-text">加载中...</div>
<div v-else-if="bfcList.length === 0" class="empty-text">暂无关联报废车</div>
<a-table
v-else
:data-source="bfcList"
:columns="columns"
:pagination="false"
row-key="plate_number"
bordered
/>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { getBfcListByids } from '/@/api/ckgl/bfccgrk';
import { useMessage } from '/@/hooks/web/useMessage';
const { notification } = useMessage();
const bfcList = ref<any[]>([]);
const loading = ref(false);
const columns = [
{ title: '车牌号', dataIndex: 'plate_number', key: 'plate_number' },
{ title: '批次号', dataIndex: 'batch_no', key: 'batch_no' },
{ title: '车辆类型', dataIndex: 'vehicle_type', key: 'vehicle_type' },
{ title: '品牌型号', dataIndex: 'brand_model', key: 'brand_model' },
{ title: '重量(kg)', dataIndex: 'weight_kg', key: 'weight_kg' },
{ title: '创建日期', dataIndex: 'create_date', key: 'create_date' },
];
const [registerModal] = useModalInner(async (data) => {
const { bfcIds } = data;
if (!bfcIds) {
bfcList.value = [];
return;
}
loading.value = true;
try {
const res = await getBfcListByids(bfcIds);
console.log(res);
// 直接使用 res,因为后端返回的就是数组
bfcList.value = Array.isArray(res) ? res : [];
} catch (error) {
notification.error({ message: '请求失败', description: (error as Error).message });
bfcList.value = [];
} finally {
loading.value = false;
}
});
</script>
<style scoped>
.empty-text {
text-align: center;
padding: 40px 0;
color: #999;
}
</style>
......@@ -1193,6 +1193,37 @@ export const formProps: FormProps = {
},
},
{
key: 'c2ebafaed93d4fd6862b02da913f0e30',
title: '报废车车牌',
dataIndex: 'bfcCodes',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入报废车车牌',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: true,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '8ea1afc68d394f818b139e6b14622088',
title: '报废车id',
dataIndex: 'bfcIds',
......@@ -1202,12 +1233,12 @@ export const formProps: FormProps = {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入报废车id报废车id报废车id',
placeholder: '请输入报废车id',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
disabled: true,
allowClear: false,
showLabel: true,
required: false,
......@@ -1215,7 +1246,7 @@ export const formProps: FormProps = {
events: {},
listStyle: '',
isSave: false,
isShow: true,
isShow: false,
scan: false,
bordered: true,
isShowAi: false,
......@@ -1255,6 +1286,12 @@ export const formProps: FormProps = {
mainComponent:
'{"key":"8ea1afc68d394f818b139e6b14622088","table":"mes_warehouse_in_info","field":"bfc_ids"}',
},
{
name: 'plateNumbers',
component: '{"table":"table_96346","field":"platenumbers9576"}',
mainComponent:
'{"key":"c2ebafaed93d4fd6862b02da913f0e30","table":"mes_warehouse_in_info","field":"bfc_codes"}',
},
],
modalWidth: 900,
modalWidthUnit: 'px',
......@@ -1274,6 +1311,20 @@ export const formProps: FormProps = {
],
type: 2,
},
{
key: 'button1774255831447',
label: '查看关联报废车',
icon: 'ant-design:align-left-outlined',
event: [
{
operateType: 2,
operateConfig: {
js: 'window.showBfcModal && window.showBfcModal(curRowData)',
},
},
],
type: 1,
},
],
topButtonList: [],
isExport: false,
......
......@@ -92,6 +92,10 @@ declare global {
[elem: string]: any;
}
}
interface Window {
showBfcModal?: (rowData: any) => void;
}
}
declare module 'vue' {
......
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