国网\自有

This commit is contained in:
‘huanghaiixia’
2026-03-25 16:00:32 +08:00
parent 659dbb171d
commit 6d09d49d85
17 changed files with 4070 additions and 0 deletions

View File

@ -0,0 +1,91 @@
import { LngInventoryPngNationPageModel, LngInventoryPngNationPageParams, LngInventoryPngNationPageResult } from './model/LngInventoryPngNaModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
// Page = '/inventory/lngInventoryPngNa/page',
Page = '/magic-api/inventory/lngInventoryPngNa/page',
List = '/inventory/lngInventoryPngNa/list',
Info = '/inventory/lngInventoryPngNa/info',
LngInventoryPngNation = '/inventory/lngInventoryPngNa',
DataLog = '/inventory/lngInventoryPngNa/datalog',
}
/**
* @description: 查询LngInventoryPngNation分页列表
*/
export async function getLngInventoryPngNationPage(params: LngInventoryPngNationPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngInventoryPngNationPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取LngInventoryPngNation信息
*/
export async function getLngInventoryPngNation(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngInventoryPngNationPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增LngInventoryPngNation
*/
export async function addLngInventoryPngNation(lngInventoryPngNation: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.LngInventoryPngNation,
params: lngInventoryPngNation,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新LngInventoryPngNation
*/
export async function updateLngInventoryPngNation(lngInventoryPngNation: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.LngInventoryPngNation,
params: lngInventoryPngNation,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除LngInventoryPngNation批量删除
*/
export async function deleteLngInventoryPngNation(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.LngInventoryPngNation,
data: ids,
},
{
errorMessageMode: mode,
},
);
}

View File

@ -0,0 +1,74 @@
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: LngInventoryPngNation分页参数 模型
*/
export interface LngInventoryPngNationPageParams extends BasicPageParams {
id: string;
datePlan: string;
dateMea: string;
qtyBeginGj: string;
qtyInGj: string;
qtyOutGj: string;
qtyAdjGj: string;
qtyEndGj: string;
qtyBeginM3: string;
qtyInM3: string;
qtyOutM3: string;
qtyAdjM3: string;
qtyEndM3: string;
comId: string;
}
/**
* @description: LngInventoryPngNation分页返回值模型
*/
export interface LngInventoryPngNationPageModel {
id: string;
datePlan: string;
dateMea: string;
qtyBeginGj: string;
qtyInGj: string;
qtyOutGj: string;
qtyAdjGj: string;
qtyEndGj: string;
qtyBeginM3: string;
qtyInM3: string;
qtyOutM3: string;
qtyAdjM3: string;
qtyEndM3: string;
comId: string;
}
0;
/**
* @description: LngInventoryPngNation分页返回值结构
*/
export type LngInventoryPngNationPageResult = BasicFetchResult<LngInventoryPngNationPageModel>;

View File

@ -0,0 +1,91 @@
import { LngInventoryPngZyPageModel, LngInventoryPngZyPageParams, LngInventoryPngZyPageResult } from './model/LngInventoryPngZyModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
// Page = '/inventory/lngInventoryPngZy/page',
Page = '/magic-api/inventory/lngInventoryPngZy/page',
List = '/inventory/lngInventoryPngZy/list',
Info = '/inventory/lngInventoryPngZy/info',
LngInventoryPngZy = '/inventory/lngInventoryPngZy',
DataLog = '/inventory/lngInventoryPngZy/datalog',
}
/**
* @description: 查询LngInventoryPngZy分页列表
*/
export async function getLngInventoryPngZyPage(params: LngInventoryPngZyPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngInventoryPngZyPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取LngInventoryPngZy信息
*/
export async function getLngInventoryPngZy(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngInventoryPngZyPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增LngInventoryPngZy
*/
export async function addLngInventoryPngZy(lngInventoryPngZy: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.LngInventoryPngZy,
params: lngInventoryPngZy,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新LngInventoryPngZy
*/
export async function updateLngInventoryPngZy(lngInventoryPngZy: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.LngInventoryPngZy,
params: lngInventoryPngZy,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除LngInventoryPngZy批量删除
*/
export async function deleteLngInventoryPngZy(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.LngInventoryPngZy,
data: ids,
},
{
errorMessageMode: mode,
},
);
}

View File

@ -0,0 +1,78 @@
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: LngInventoryPngZy分页参数 模型
*/
export interface LngInventoryPngZyPageParams extends BasicPageParams {
id: string;
staCode: string;
datePlan: string;
dateMea: string;
qtyBeginGj: string;
qtyInGj: string;
qtyOutGj: string;
qtyAdjGj: string;
qtyEndGj: string;
qtyBeginM3: string;
qtyInM3: string;
qtyOutM3: string;
qtyEndM3: string;
qtyAdjM3: string;
comId: string;
}
/**
* @description: LngInventoryPngZy分页返回值模型
*/
export interface LngInventoryPngZyPageModel {
id: string;
staCode: string;
datePlan: string;
dateMea: string;
qtyBeginGj: string;
qtyInGj: string;
qtyOutGj: string;
qtyAdjGj: string;
qtyEndGj: string;
qtyBeginM3: string;
qtyInM3: string;
qtyOutM3: string;
qtyEndM3: string;
qtyAdjM3: string;
comId: string;
}
0;
/**
* @description: LngInventoryPngZy分页返回值结构
*/
export type LngInventoryPngZyPageResult = BasicFetchResult<LngInventoryPngZyPageModel>;

View File

@ -382,6 +382,22 @@ export const PAGE_CUSTOM_ROUTE: AppRouteRecordRaw[] = [{
title: (route) => (route.query.formName)
}
},
{
path: '/inventory/LngInventoryPngNa/createForm',
name: 'LngInventoryPngNa',
component: () => import('/@/views/inventory/LngInventoryPngNa/components/createForm.vue'),
meta: {
title: (route) => (route.query.formName)
}
},
{
path: '/inventory/LngInventoryPngZy/createForm',
name: 'LngInventoryPngZy',
component: () => import('/@/views/inventory/LngInventoryPngZy/components/createForm.vue'),
meta: {
title: (route) => (route.query.formName)
}
},
]

View File

@ -0,0 +1,224 @@
<template>
<SimpleForm
ref="systemFormRef"
:formProps="data.formDataProps"
:formModel="{}"
:isWorkFlow="props.fromPage!=FromPageType.MENU"
/>
</template>
<script lang="ts" setup>
import { reactive, ref,onBeforeMount,onMounted } from 'vue';
import { formProps, formEventConfigs ,formConfig} from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addLngInventoryPngNation, getLngInventoryPngNation, updateLngInventoryPngNation, deleteLngInventoryPngNation } from '/@/api/inventory/LngInventoryPngNa';
import { cloneDeep } from 'lodash-es';
import { FormDataProps } from '/@/components/Designer/src/types';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { FromPageType } from '/@/enums/workflowEnum';
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';
const { filterFormSchemaAuth } = usePermission();
const { mergeFormSchemas,mergeFormEventConfigs } = useFormConfig();
const { currentRoute } = useRouter();
const RowKey = 'id';
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
const props = defineProps({
fromPage: {
type: Number,
default: FromPageType.MENU,
},
});
const systemFormRef = ref();
const data: { formDataProps: FormDataProps } = reactive({
formDataProps: {schemas:[]} as FormDataProps,
});
const state = reactive({
formModel: {},
});
let customFormEventConfigs=[];
onMounted(async () => {
try {
// 合并渲染覆盖配置中的字段配置、表单事件配置
await mergeCustomFormRenderConfig();
if (props.fromPage == FromPageType.MENU) {
setMenuPermission();
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
} else if (props.fromPage == FromPageType.FLOW) {
emits('loadingCompleted'); //告诉系统表单已经加载完毕
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
} else if (props.fromPage == FromPageType.PREVIEW) {
// 预览 无需权限,表单事件也无需执行
} else if (props.fromPage == FromPageType.DESKTOP) {
// 桌面设计 表单事件需要执行
emits('loadingCompleted'); //告诉系统表单已经加载完毕
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
emits('form-mounted', formProps);
} catch (error) {
}
});
async function mergeCustomFormRenderConfig() {
let cloneProps=cloneDeep(formProps);
let fEventConfigs=cloneDeep(formEventConfigs);
if (formConfig.useCustomConfig) {
if(props.fromPage !== FromPageType.FLOW){
let formPath=currentRoute.value.query.formPath;
//1.合并字段配置
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formPath:formPath});
//2.合并表单事件配置
fEventConfigs=await mergeFormEventConfigs({formEventConfigs:fEventConfigs,formPath:formPath});
}
}
data.formDataProps=cloneProps;
customFormEventConfigs=fEventConfigs;
}
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function setMenuPermission() {
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
}
// 校验form 通过返回表单数据
async function validate() {
let values = [];
try {
values = await systemFormRef.value?.validate();
//添加隐藏组件
if (data.formDataProps.hiddenComponent?.length) {
data.formDataProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
} finally {
}
return values;
}
// 根据行唯一ID查询行数据并设置表单数据 【编辑】
async function setFormDataFromId(rowId, skipUpdate) {
try {
const record = await getLngInventoryPngNation(rowId);
if (skipUpdate) {
return record;
}
setFieldsValue(record);
state.formModel = record;
await getFormDataEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
return record;
} catch (error) {
}
}
// 辅助设置表单数据
function setFieldsValue(record) {
systemFormRef.value.setFieldsValue(record);
}
// 重置表单数据
async function resetFields() {
await systemFormRef.value.resetFields();
}
// 设置表单数据全部为Disabled 【查看】
async function setDisabledForm(isDisabled) {
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas),isDisabled);
}
// 获取行键值
function getRowKey() {
return RowKey;
}
// 更新api表单数据
async function update({ values, rowId }) {
try {
values[RowKey] = rowId;
state.formModel = values;
let saveVal = await updateLngInventoryPngNation(values);
await submitFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 新增api表单数据
async function add(values) {
try {
state.formModel = values;
let saveVal = await addLngInventoryPngNation(values);
await submitFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async function setWorkFlowForm(obj: WorkFlowFormParams) {
try {
const cloneProps=cloneDeep(formProps);
customFormEventConfigs=cloneDeep(formEventConfigs);
if (formConfig.useCustomConfig) {
const parts = obj.formConfigKey.split('_');
const formId=parts[1];
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formId:formId});
customFormEventConfigs=await mergeFormEventConfigs({formEventConfigs:customFormEventConfigs,formId:formId});
}
let flowData = changeWorkFlowForm(cloneProps, obj);
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
data.formDataProps = buildOptionJson;
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
if (isViewProcess) {
setDisabledForm(); //查看
}
state.formModel = formModels;
if(formModels[RowKey]) {
setFormDataFromId(formModels[RowKey], false)
} else {
setFieldsValue(formModels)
}
} catch (error) {}
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
function getFormModel() {
return systemFormRef.value.formModel
}
async function handleDelete(id) {
return await deleteLngInventoryPngNation([id]);
}
defineExpose({
setFieldsValue,
resetFields,
validate,
add,
update,
setFormDataFromId,
setDisabledForm,
setMenuPermission,
setWorkFlowForm,
getRowKey,
getFormModel,
handleDelete
});
</script>

View File

@ -0,0 +1,110 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, reactive } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { formProps } from './config';
import ModalForm from './Form.vue';
import { FromPageType } from '/@/enums/workflowEnum';
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const formRef = ref();
const state = reactive({
formModel: {},
isUpdate: true,
isView: false,
isCopy: false,
rowId: '',
});
const { t } = useI18n();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
state.isUpdate = !!data?.isUpdate;
state.isView = !!data?.isView;
state.isCopy = !!data?.isCopy;
setModalProps({
destroyOnClose: true,
maskClosable: false,
showCancelBtn: !state.isView,
showOkBtn: !state.isView,
canFullscreen: true,
width: 900,
});
if (state.isUpdate || state.isView || state.isCopy) {
state.rowId = data.id;
if (state.isView) {
await formRef.value.setDisabledForm();
}
await formRef.value.setFormDataFromId(state.rowId);
} else {
formRef.value.resetFields();
}
});
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
async function saveModal() {
let saveSuccess = false;
try {
const values = await formRef.value?.validate();
//添加隐藏组件
if (formProps.hiddenComponent?.length) {
formProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
if (values !== false) {
try {
if (!state.isUpdate || state.isCopy) {
saveSuccess = await formRef.value.add(values);
} else {
saveSuccess = await formRef.value.update({ values, rowId: state.rowId });
}
return saveSuccess;
} catch (error) {}
}
} catch (error) {
return saveSuccess;
}
}
async function handleSubmit() {
try {
const saveSuccess = await saveModal();
setModalProps({ confirmLoading: true });
if (saveSuccess) {
if (!state.isUpdate || state.isCopy) {
//false 新增
notification.success({
message: 'Tip',
description: t('新增成功!'),
}); //提示消息
} else {
notification.success({
message: 'Tip',
description: t('修改成功!'),
}); //提示消息
}
closeModal();
formRef.value.resetFields();
emit('success');
}
} finally {
setModalProps({ confirmLoading: false });
}
}
function handleClose() {
formRef.value.resetFields();
}
</script>

View File

@ -0,0 +1,709 @@
import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
export const formConfig = {
useCustomConfig: false,
};
export const searchFormSchema: FormSchema[] = [
{
field: 'dateFrom',
label: '计量日期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'comId',
label: '公司',
component: 'Select',
componentProps: {
showSearch: true,
optionFilterProp: 'label',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
options: [],
placeholder: '请选择',
allowClear: true,
getPopupContainer: () => document.body,
}
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'datePlan',
title: '计划日期',
componentType: 'input',
align: 'left',
width: 110,
sorter: true,
},
{
dataIndex: 'dateMea',
title: '计量日期',
componentType: 'input',
align: 'left',
width: 110,
sorter: true,
},
{
dataIndex: 'qtyBeginGj',
title: '前日管存(吉焦)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyInGj',
title: '当日上载量(吉焦)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyOutGj',
title: '当日下载量(吉焦)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyAdjGj',
title: '手工调整量(吉焦)',
componentType: 'input',
align: 'left',
width: 140,
sorter: true,
},
{
dataIndex: 'qtyEndGj',
title: '当日管存(吉焦)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyBeginM3',
title: '前日管存(方)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyInM3',
title: '当日上载量(方)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyOutM3',
title: '当日下载量(方)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyAdjM3',
title: '手工调整量(方)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyEndM3',
title: '当日管存(方)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'comName',
title: '公司',
componentType: 'input',
align: 'left',
width: 120,
sorter: true,
},
];
//表单事件
export const formEventConfigs = {
0: [
{
type: 'circle',
color: '#2774ff',
text: '开始节点',
icon: '#icon-kaishi',
bgcColor: '#D8E5FF',
isUserDefined: false,
},
{
color: '#F6AB01',
icon: '#icon-chushihua',
text: '初始化表单',
bgcColor: '#f9f5ea',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
1: [
{
color: '#B36EDB',
icon: '#icon-shujufenxi',
text: '获取表单数据',
detail: '(新增无此操作)',
bgcColor: '#F8F2FC',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
2: [
{
color: '#F8625C',
icon: '#icon-jiazai',
text: '加载表单',
bgcColor: '#FFF1F1',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
3: [
{
color: '#6C6AE0',
icon: '#icon-jsontijiao',
text: '提交表单',
bgcColor: '#F5F4FF',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
4: [
{
type: 'circle',
color: '#F8625C',
text: '结束节点',
icon: '#icon-jieshuzhiliao',
bgcColor: '#FFD6D6',
isLast: true,
isUserDefined: false,
},
],
};
export const formProps: FormProps = {
labelCol: { span: 3, offset: 0 },
labelAlign: 'right',
layout: 'horizontal',
size: 'default',
schemas: [
{
key: 'd9b0647c7aaa4609bc781b3028e0c7b0',
field: 'id',
label: 'id',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入id',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '3b142a1e9eaf475f8af5350bc32a9031',
field: 'datePlan',
label: '计划日期',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入计划日期',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'fac5092d6db44230b4d79eb2ba863ad4',
field: 'dateMea',
label: '计量日期',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入计量日期',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '4bc6534677fb466aa501222edb6d4147',
field: 'qtyBeginGj',
label: '前日管存(吉焦)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入前日管存(吉焦)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '66fca81b3a224629ad68b03d17e3025e',
field: 'qtyInGj',
label: '当日上载量(吉焦)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入当日上载量(吉焦)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '54f77ae6d7d84f4082c60a8bc10430c1',
field: 'qtyOutGj',
label: '当日下载量(吉焦)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入当日下载量(吉焦)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '1a80a9aa96bb4458a9da70151b17a983',
field: 'qtyAdjGj',
label: '手工调整量(吉焦)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入手工调整量(吉焦)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '42b7f746637c4706a15597a8b21ecec3',
field: 'qtyEndGj',
label: '当日管存(吉焦)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入当日管存(吉焦)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'f99a3831062144afa951180a6d276396',
field: 'qtyBeginM3',
label: '前日管存(方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入前日管存(方)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'd2175714f19c4335a8ec52c15994e7bb',
field: 'qtyInM3',
label: '当日上载量(方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入当日上载量(方)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '8d2786ad2545458a9b1003eacfd50524',
field: 'qtyOutM3',
label: '当日下载量(方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入当日下载量(方)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '3640f82aca7b41acb6c3a9b0edba6f73',
field: 'qtyAdjM3',
label: '手工调整量(方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入手工调整量(方)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '8efb783f4a9c49a0a1b3d61e132bfd22',
field: 'qtyEndM3',
label: '当日管存(方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入当日管存(方)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '8d905b348d33490ea2388a75eb7a01bd',
field: 'comId',
label: '公司',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入公司',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};

View File

@ -0,0 +1,281 @@
<template>
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap formViewStyle pdcss">
<div class="top-toolbar" >
<a-button style="margin-right: 10px" @click="close">
<slot name="icon"><close-outlined /></slot>关闭
</a-button>
<template v-if="pageType!=='view'">
<a-button style="margin-right: 10px" type="primary" @click="handleSubmit">
<slot name="icon"><save-outlined /></slot>保存
</a-button>
</template>
</div>
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<Card title="基础信息" :bordered="false" >
<a-row>
<a-col :span="8">
<a-form-item label="公司" name="comId">
{{ formState.comName }}
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="计划日期" name="datePlan">
{{formState.datePlan ? dayjs(formState.datePlan).format('YYYY-MM-DD') : null }}
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="计量日期" name="dateMea">
{{formState.dateMea ? dayjs(formState.dateMea).format('YYYY-MM-DD') : null}}
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="前日管存(吉焦)" name="qtyBeginGj">
<input-number v-model:value="formState.qtyBeginGj" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="当日上载量(吉焦)" name="qtyInGj">
<input-number v-model:value="formState.qtyInGj" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="当日下载量(吉焦)" name="qtyOutGj">
<input-number v-model:value="formState.qtyOutGj" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="手工调整量(吉焦)" name="qtyAdjGj">
<input-number v-model:value="formState.qtyAdjGj" :digits="3" :disabled="isDisable" @blur="numCount('qtyAdjGj')" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="当日管存(吉焦)" name="qtyEndGj">
<input-number v-model:value="formState.qtyEndGj" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-item label="前日管存(方)" name="qtyBeginM3">
<input-number v-model:value="formState.qtyBeginM3" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="当日上载量(方)" name="qtyInM3">
<input-number v-model:value="formState.qtyInM3" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="当日下载量(方)" name="qtyOutM3">
<input-number v-model:value="formState.qtyOutM3" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="手工调整量(方)" name="qtyAdjM3">
<input-number v-model:value="formState.qtyAdjM3" :disabled="isDisable" :digits="3" @blur="numCount('qtyAdjM3')" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="当日管存(方)" name="qtyEndM3">
<input-number v-model:value="formState.qtyEndM3" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.note" :disabled="isDisable" :maxLength="200" placeholder="请输入内容最多200字" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
</a-row>
</Card>
<Card title="附件信息" :bordered="false" >
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
</Card>
</a-form>
</div>
</a-spin>
</template>
<script lang="ts" setup>
import { Card } from 'ant-design-vue';
import { useRouter } from 'vue-router';
import { FromPageType, RecordType } from '/@/enums/workflowEnum';
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
import { SendOutlined, SaveOutlined, CloseOutlined, } from '@ant-design/icons-vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
import useEventBus from '/@/hooks/event/useEventBus';
import type { Rule } from 'ant-design-vue/es/form';
import { getDictionary } from '/@/api/sales/Customer';
import { useModal } from '/@/components/Modal';
import { addLngInventoryPngNation,updateLngInventoryPngNation, getLngInventoryPngNation,} from '/@/api/inventory/lngInventoryPngNa';
import dayjs from 'dayjs';
import { getAppEnvConfig } from '/@/utils/env';
import { message } from 'ant-design-vue';
import UploadList from '/@/components/Form/src/components/UploadList.vue';
import { getAllCom} from '/@/api/contract/ContractPurInt';
const tableName = 'LngInventoryPngNa';
const columnName = 'LngInventoryPngNa'
const formType = ref('2'); // 0 新建 1 修改 2 查看
const formRef = ref();
const props = defineProps({
disabled: false,
id: ''
});
const { bus, FORM_LIST_MODIFIED } = useEventBus();
const router = useRouter();
const { currentRoute } = router;
const isDisable = ref(false);
const { formPath } = currentRoute.value.query;
const pathArr = [];
const tabStore = useMultipleTabStore();
const formProps = ref(null);
const formId = ref(currentRoute.value?.params?.id);
const pageType = ref(currentRoute.value.query?.type);
const pageId = ref(currentRoute.value.query?.id)
const pageSource = ref(currentRoute.value.query?.pageSource)
const spinning = ref(false);
const { notification } = useMessage();
const { t } = useI18n()
const oldFormState = reactive({})
const formState = reactive({
});
const rules= reactive({
qtyAdjGj: [{ required: true, message: "该项为必填项", trigger: 'change' }],
qtyAdjM3: [{ required: true, message: "该项为必填项", trigger: 'change' }],
});
const layout = {
labelCol: { span: 8 },
wrapperCol: { span: 16 },
}
const dataFile = ref([]);
watch(
() => props.id,
(val) => {
if (val) {
getInfo(val)
}
},
{
immediate: true
}
);
watch(
() => props.disabled,
(val) => {
isDisable.value = val
},
{
immediate: true
}
);
onMounted(() => {
isDisable.value = pageType.value == 'view'
if (pageId.value) {
getInfo(pageId.value)
}
});
const uploadListChange = (val) => {
dataFile.value = val
}
async function getInfo(id) {
spinning.value = true
try {
let data = await getLngInventoryPngNation(id)
spinning.value = false
Object.assign(formState, {...data})
oldFormState.qtyAdjGj = data.qtyAdjGj
oldFormState.qtyAdjM3 = data.qtyAdjM3
Object.assign(dataFile.value, formState.lngFileUploadList || [])
} catch (error) {
spinning.value = false
}
}
const numCount = (k) => {
if (k == 'qtyAdjGj' && Number(oldFormState.qtyAdjGj) !== Number(formState.qtyAdjGj)) {
formState.qtyEndGj = Number(formState.qtyInGj || 0) - Number(formState.qtyOutGj || 0)+ Number(formState.qtyBeginGj || 0)
}
if (k == 'qtyAdjM3' && Number(oldFormState.qtyAdjM3) !== Number(formState.qtyAdjM3)) {
formState.qtyEndM3 = Number(formState.qtyInM3 || 0) - Number(formState.qtyOutM3 || 0)+ Number(formState.qtyBeginM3 || 0)
}
}
function close() {
tabStore.closeTab(currentRoute.value, router);
}
async function getFormValue() {
return formState
}
async function handleSubmit(type) {
try {
await formRef.value.validateFields();
let obj = {
...formState,
qtyEndGj: formState.qtyEndGj ? formState.qtyEndGj.toFixed(3) : formState.qtyEndGj,
qtyEndM3: formState.qtyEndM3 ? formState.qtyEndM3.toFixed(3) : formState.qtyEndM3,
lngFileUploadList: dataFile.value,
}
spinning.value = true;
let request = !formState.id ? addLngInventoryPngNation :updateLngInventoryPngNation
try {
const data = await request(obj);
notification.success({
message: '提示',
description: data?.id ? t('新增成功!') : t('修改成功!')
}); //提示消息
setTimeout(() => {
bus.emit(FORM_LIST_MODIFIED, {});
close();
}, 500);
} finally {
spinning.value = false;
}
} catch (errorInfo) {
spinning.value = false;
errorInfo?.errorFields?.length && notification.warning({
message: '提示',
description: '请完善信息'
});
return false
}
}
defineExpose({
handleSubmit,
getFormValue
});
</script>
<style lang="less" scoped>
:deep(.ant-form-item .ant-form-item-label) {
width: 135px !important;
max-width: 135px !important;
}
.page-bg-wrap {
background-color: #fff;
}
.top-toolbar {
min-height: 44px;
margin-bottom: 12px;
border-bottom: 1px solid #eee;
}
.pdcss {
padding:0px 12px 6px 12px !important;
}
</style>

View File

@ -0,0 +1,212 @@
export const permissionList = [
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: 'id',
fieldId: 'id',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'd9b0647c7aaa4609bc781b3028e0c7b0',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '计划日期',
fieldId: 'datePlan',
isSubTable: false,
showChildren: true,
type: 'input',
key: '3b142a1e9eaf475f8af5350bc32a9031',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '计量日期',
fieldId: 'dateMea',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'fac5092d6db44230b4d79eb2ba863ad4',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '前日管存(吉焦)',
fieldId: 'qtyBeginGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '4bc6534677fb466aa501222edb6d4147',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '当日上载量(吉焦)',
fieldId: 'qtyInGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '66fca81b3a224629ad68b03d17e3025e',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '当日下载量(吉焦)',
fieldId: 'qtyOutGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '54f77ae6d7d84f4082c60a8bc10430c1',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '手工调整量(吉焦)',
fieldId: 'qtyAdjGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '1a80a9aa96bb4458a9da70151b17a983',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '当日管存(吉焦)',
fieldId: 'qtyEndGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '42b7f746637c4706a15597a8b21ecec3',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '前日管存(方)',
fieldId: 'qtyBeginM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'f99a3831062144afa951180a6d276396',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '当日上载量(方)',
fieldId: 'qtyInM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'd2175714f19c4335a8ec52c15994e7bb',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '当日下载量(方)',
fieldId: 'qtyOutM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: '8d2786ad2545458a9b1003eacfd50524',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '手工调整量(方)',
fieldId: 'qtyAdjM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: '3640f82aca7b41acb6c3a9b0edba6f73',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '当日管存(方)',
fieldId: 'qtyEndM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: '8efb783f4a9c49a0a1b3d61e132bfd22',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '公司',
fieldId: 'comId',
isSubTable: false,
showChildren: true,
type: 'input',
key: '8d905b348d33490ea2388a75eb7a01bd',
children: [],
},
];

View File

@ -0,0 +1,288 @@
<template>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
<template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
<a-button v-else :type="button.type">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
</template>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
<TableAction :actions="getActions(record)" />
</template>
</template>
</BasicTable>
<LngInventoryPngNaModal @register="registerModal" @success="handleSuccess" />
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
</PageWrapper>
</template>
<script lang="ts" setup>
const modalVisible = ref(false);
const logId = ref('')
const logPath = ref('/inventory/lngInventoryPngNa/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted, watch} from 'vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngInventoryPngNationPage, deleteLngInventoryPngNation} from '/@/api/inventory/LngInventoryPngNa';
import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { useRouter } from 'vue-router';
import { setIndexFlowStatus } from '/@/utils/flow/index'
import { getLngInventoryPngNation } from '/@/api/inventory/LngInventoryPngNa';
import { useModal } from '/@/components/Modal';
import LngInventoryPngNaModal from './components/LngInventoryPngNaModal.vue';
import {formConfig, searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
import { getAllCom} from '/@/api/contract/ContractPurInt';
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
const { notification } = useMessage();
const { t } = useI18n();
defineEmits(['register']);
const { filterColumnAuth, filterButtonAuth } = usePermission();
const { mergeColumns,mergeSearchFormSchema,mergeButtons } = useFormConfig();
const filterColumns = cloneDeep(filterColumnAuth(columns));
const customConfigColums =ref(filterColumns);
const customSearchFormSchema =ref(searchFormSchema);
const tableRef = ref();
//所有按钮
const buttons = ref([{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},{"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true,"isUse":true},{"name":"调整","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord',]);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {refresh : handleRefresh,view : handleView,datalog : handleDatalog,edit : handleEdit}
const { currentRoute } = useRouter();
const tableData = ref([])
const router = useRouter();
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const [registerModal, { openModal }] = useModal();
const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, setTableData }] = useTable({
title: '' || (formName + '列表'),
api: getLngInventoryPngNationPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page: params.limit };
},
afterFetch: (res) => {
tableData.value = res || []
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 140,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
tableSetting: {
size: false,
setting: false,
},
});
watch(
() => tableData.value,
(val) => {
if (val) {
let arr = DataFormat.format(val, [
FormatOption.createQty('qtyBeginGj'),
FormatOption.createQty('qtyInGj'),
FormatOption.createQty('qtyOutGj'),
FormatOption.createQty('qtyAdjGj'),
FormatOption.createQty('qtyEndGj'),
FormatOption.createQty('qtyBeginM3'),
FormatOption.createQty('qtyInM3'),
FormatOption.createQty('qtyOutM3'),
FormatOption.createQty('qtyAdjM3'),
FormatOption.createQty('qtyEndM3'),
]);
if (arr.length) {
setTableData(arr)
}
}
},
{
immediate: true,
deep: true,
}
);
function dbClickRow(record) {
router.push({
path: '/inventory/LngInventoryPngNa/createForm',
query: {
formPath: 'inventory/LngInventoryPngNa',
formName: '查看'+formName,
formId:currentRoute.value.meta.formId,
id: record.id,
type: 'view'
}
});
}
function buttonClick(code) {
btnEvent[code]();
}
function handleEdit (record: Recordable) {
router.push({
path: '/inventory/LngInventoryPngNa/createForm',
query: {
formPath: 'inventory/LngInventoryPngNa',
formName: '调整'+formName,
formId:currentRoute.value.meta.formId,
id: record.id,
type: 'edit'
}
});
}
function handleDatalog (record: Recordable) {
modalVisible.value = true
logId.value = record.id
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
onMounted(async() => {
let res = await getAllCom() || []
customSearchFormSchema.value.forEach(v => {
if (v.field == 'comId') {
v.componentProps.options = res.map(v=> {
return {
label: v.shortName,
value: v.id
}
})
}
});
if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh);
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
mergeCustomListRenderConfig();
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
bus.off(FLOW_PROCESSED, handleRefresh);
bus.off(CREATE_FLOW, handleRefresh);
} else {
bus.off(FORM_LIST_MODIFIED, handleRefresh);
}
});
function getActions(record: Recordable):ActionItem[] {
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
if (!record.workflowData?.processId) {
return {
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
if (button.code === 'view') {
return {
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
return {};
}
}
});
return actionsList;
}
async function mergeCustomListRenderConfig(){
if (formConfig.useCustomConfig) {
let formId=currentRoute.value.meta.formId;
//1.合并展示字段配置
let cols= await mergeColumns(customConfigColums.value,formId);
customConfigColums.value=cols;
//2.合并搜索字段配置
let sFormSchema= await mergeSearchFormSchema(customSearchFormSchema.value,formId);
customSearchFormSchema.value=sFormSchema;
//3.合并按钮配置
let btns= await mergeButtons(buttons.value,formId);
buttons.value=btns;
}
};
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
:deep( .ant-col-8:nth-child(1)) {
width: 320px !important;
max-width: 320px !important;
}
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
width: 80px !important;
}
</style>

View File

@ -0,0 +1,224 @@
<template>
<SimpleForm
ref="systemFormRef"
:formProps="data.formDataProps"
:formModel="{}"
:isWorkFlow="props.fromPage!=FromPageType.MENU"
/>
</template>
<script lang="ts" setup>
import { reactive, ref,onBeforeMount,onMounted } from 'vue';
import { formProps, formEventConfigs ,formConfig} from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addLngInventoryPngZy, getLngInventoryPngZy, updateLngInventoryPngZy, deleteLngInventoryPngZy } from '/@/api/inventory/LngInventoryPngZy';
import { cloneDeep } from 'lodash-es';
import { FormDataProps } from '/@/components/Designer/src/types';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { FromPageType } from '/@/enums/workflowEnum';
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';
const { filterFormSchemaAuth } = usePermission();
const { mergeFormSchemas,mergeFormEventConfigs } = useFormConfig();
const { currentRoute } = useRouter();
const RowKey = 'id';
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
const props = defineProps({
fromPage: {
type: Number,
default: FromPageType.MENU,
},
});
const systemFormRef = ref();
const data: { formDataProps: FormDataProps } = reactive({
formDataProps: {schemas:[]} as FormDataProps,
});
const state = reactive({
formModel: {},
});
let customFormEventConfigs=[];
onMounted(async () => {
try {
// 合并渲染覆盖配置中的字段配置、表单事件配置
await mergeCustomFormRenderConfig();
if (props.fromPage == FromPageType.MENU) {
setMenuPermission();
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
} else if (props.fromPage == FromPageType.FLOW) {
emits('loadingCompleted'); //告诉系统表单已经加载完毕
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
} else if (props.fromPage == FromPageType.PREVIEW) {
// 预览 无需权限,表单事件也无需执行
} else if (props.fromPage == FromPageType.DESKTOP) {
// 桌面设计 表单事件需要执行
emits('loadingCompleted'); //告诉系统表单已经加载完毕
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
emits('form-mounted', formProps);
} catch (error) {
}
});
async function mergeCustomFormRenderConfig() {
let cloneProps=cloneDeep(formProps);
let fEventConfigs=cloneDeep(formEventConfigs);
if (formConfig.useCustomConfig) {
if(props.fromPage !== FromPageType.FLOW){
let formPath=currentRoute.value.query.formPath;
//1.合并字段配置
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formPath:formPath});
//2.合并表单事件配置
fEventConfigs=await mergeFormEventConfigs({formEventConfigs:fEventConfigs,formPath:formPath});
}
}
data.formDataProps=cloneProps;
customFormEventConfigs=fEventConfigs;
}
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function setMenuPermission() {
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
}
// 校验form 通过返回表单数据
async function validate() {
let values = [];
try {
values = await systemFormRef.value?.validate();
//添加隐藏组件
if (data.formDataProps.hiddenComponent?.length) {
data.formDataProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
} finally {
}
return values;
}
// 根据行唯一ID查询行数据并设置表单数据 【编辑】
async function setFormDataFromId(rowId, skipUpdate) {
try {
const record = await getLngInventoryPngZy(rowId);
if (skipUpdate) {
return record;
}
setFieldsValue(record);
state.formModel = record;
await getFormDataEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
return record;
} catch (error) {
}
}
// 辅助设置表单数据
function setFieldsValue(record) {
systemFormRef.value.setFieldsValue(record);
}
// 重置表单数据
async function resetFields() {
await systemFormRef.value.resetFields();
}
// 设置表单数据全部为Disabled 【查看】
async function setDisabledForm(isDisabled) {
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas),isDisabled);
}
// 获取行键值
function getRowKey() {
return RowKey;
}
// 更新api表单数据
async function update({ values, rowId }) {
try {
values[RowKey] = rowId;
state.formModel = values;
let saveVal = await updateLngInventoryPngZy(values);
await submitFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 新增api表单数据
async function add(values) {
try {
state.formModel = values;
let saveVal = await addLngInventoryPngZy(values);
await submitFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async function setWorkFlowForm(obj: WorkFlowFormParams) {
try {
const cloneProps=cloneDeep(formProps);
customFormEventConfigs=cloneDeep(formEventConfigs);
if (formConfig.useCustomConfig) {
const parts = obj.formConfigKey.split('_');
const formId=parts[1];
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formId:formId});
customFormEventConfigs=await mergeFormEventConfigs({formEventConfigs:customFormEventConfigs,formId:formId});
}
let flowData = changeWorkFlowForm(cloneProps, obj);
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
data.formDataProps = buildOptionJson;
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
if (isViewProcess) {
setDisabledForm(); //查看
}
state.formModel = formModels;
if(formModels[RowKey]) {
setFormDataFromId(formModels[RowKey], false)
} else {
setFieldsValue(formModels)
}
} catch (error) {}
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
function getFormModel() {
return systemFormRef.value.formModel
}
async function handleDelete(id) {
return await deleteLngInventoryPngZy([id]);
}
defineExpose({
setFieldsValue,
resetFields,
validate,
add,
update,
setFormDataFromId,
setDisabledForm,
setMenuPermission,
setWorkFlowForm,
getRowKey,
getFormModel,
handleDelete
});
</script>

View File

@ -0,0 +1,110 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, reactive } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { formProps } from './config';
import ModalForm from './Form.vue';
import { FromPageType } from '/@/enums/workflowEnum';
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const formRef = ref();
const state = reactive({
formModel: {},
isUpdate: true,
isView: false,
isCopy: false,
rowId: '',
});
const { t } = useI18n();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
state.isUpdate = !!data?.isUpdate;
state.isView = !!data?.isView;
state.isCopy = !!data?.isCopy;
setModalProps({
destroyOnClose: true,
maskClosable: false,
showCancelBtn: !state.isView,
showOkBtn: !state.isView,
canFullscreen: true,
width: 900,
});
if (state.isUpdate || state.isView || state.isCopy) {
state.rowId = data.id;
if (state.isView) {
await formRef.value.setDisabledForm();
}
await formRef.value.setFormDataFromId(state.rowId);
} else {
formRef.value.resetFields();
}
});
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
async function saveModal() {
let saveSuccess = false;
try {
const values = await formRef.value?.validate();
//添加隐藏组件
if (formProps.hiddenComponent?.length) {
formProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
if (values !== false) {
try {
if (!state.isUpdate || state.isCopy) {
saveSuccess = await formRef.value.add(values);
} else {
saveSuccess = await formRef.value.update({ values, rowId: state.rowId });
}
return saveSuccess;
} catch (error) {}
}
} catch (error) {
return saveSuccess;
}
}
async function handleSubmit() {
try {
const saveSuccess = await saveModal();
setModalProps({ confirmLoading: true });
if (saveSuccess) {
if (!state.isUpdate || state.isCopy) {
//false 新增
notification.success({
message: 'Tip',
description: t('新增成功!'),
}); //提示消息
} else {
notification.success({
message: 'Tip',
description: t('修改成功!'),
}); //提示消息
}
closeModal();
formRef.value.resetFields();
emit('success');
}
} finally {
setModalProps({ confirmLoading: false });
}
}
function handleClose() {
formRef.value.resetFields();
}
</script>

View File

@ -0,0 +1,752 @@
import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
export const formConfig = {
useCustomConfig: false,
};
export const searchFormSchema: FormSchema[] = [
{
field: 'dateFrom',
label: '计量日期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'comId',
label: '公司',
component: 'Select',
componentProps: {
showSearch: true,
optionFilterProp: 'label',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
options: [],
placeholder: '请选择',
allowClear: true,
getPopupContainer: () => document.body,
}
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'staName',
title: '接收站',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'datePlan',
title: '计划日期',
componentType: 'input',
align: 'left',
width: 110,
sorter: true,
},
{
dataIndex: 'dateMea',
title: '计量日期',
componentType: 'input',
align: 'left',
width: 110,
sorter: true,
},
{
dataIndex: 'qtyBeginGj',
title: '前日管存(吉焦)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyInGj',
title: '当日上载量(吉焦)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyOutGj',
title: '当日下载量(吉焦)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyAdjGj',
title: '手工调整量(吉焦)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyEndGj',
title: '当日管存(吉焦)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyBeginM3',
title: '前日管存(方)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyInM3',
title: '当日上载量(方)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyOutM3',
title: '当日下载量(方)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyEndM3',
title: '当日管存(方)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'qtyAdjM3',
title: '手工调整量(方)',
componentType: 'input',
align: 'left',
width: 130,
sorter: true,
},
{
dataIndex: 'comName',
title: '公司',
componentType: 'input',
align: 'left',
width: 120,
sorter: true,
},
];
//表单事件
export const formEventConfigs = {
0: [
{
type: 'circle',
color: '#2774ff',
text: '开始节点',
icon: '#icon-kaishi',
bgcColor: '#D8E5FF',
isUserDefined: false,
},
{
color: '#F6AB01',
icon: '#icon-chushihua',
text: '初始化表单',
bgcColor: '#f9f5ea',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
1: [
{
color: '#B36EDB',
icon: '#icon-shujufenxi',
text: '获取表单数据',
detail: '(新增无此操作)',
bgcColor: '#F8F2FC',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
2: [
{
color: '#F8625C',
icon: '#icon-jiazai',
text: '加载表单',
bgcColor: '#FFF1F1',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
3: [
{
color: '#6C6AE0',
icon: '#icon-jsontijiao',
text: '提交表单',
bgcColor: '#F5F4FF',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
4: [
{
type: 'circle',
color: '#F8625C',
text: '结束节点',
icon: '#icon-jieshuzhiliao',
bgcColor: '#FFD6D6',
isLast: true,
isUserDefined: false,
},
],
};
export const formProps: FormProps = {
labelCol: { span: 3, offset: 0 },
labelAlign: 'right',
layout: 'horizontal',
size: 'default',
schemas: [
{
key: 'b47dd381770d47da9ca49f9d21d38b2c',
field: 'id',
label: 'id',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入id',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'e51a332292714f788f7890c977f72a59',
field: 'staCode',
label: '接收站',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入接收站',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '6b109c2beb2840dda3b4b5d85a844b96',
field: 'datePlan',
label: '计划日期',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入计划日期',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '9dcc0bbb53904da49d928e4da4860761',
field: 'dateMea',
label: '计量日期',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入计量日期',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'e647efec0a294898858a162b0509aaa5',
field: 'qtyBeginGj',
label: '前日管存(吉焦)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入前日管存(吉焦)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '450f669e343546d5aeffd0440ab2506a',
field: 'qtyInGj',
label: '当日上载量(吉焦)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入当日上载量(吉焦)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'e3f50b78be2a47d7ba9601322161f40b',
field: 'qtyOutGj',
label: '当日下载量(吉焦)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入当日下载量(吉焦)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'e590781b52504a499134e5e42b6c6d9b',
field: 'qtyAdjGj',
label: '手工调整量(吉焦)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入手工调整量(吉焦)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '29083b2910854f2a8949d6c63c882509',
field: 'qtyEndGj',
label: '当日管存(吉焦)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入当日管存(吉焦)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '54f46bcb72384f3ebc0e03474210ca64',
field: 'qtyBeginM3',
label: '前日管存(方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入前日管存(方)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '08e29c82735f4b88862e2f5a5fb7c311',
field: 'qtyInM3',
label: '当日上载量(方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入当日上载量(方)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '68b2dcdec4e146e38b2d0163cef1d2f5',
field: 'qtyOutM3',
label: '当日下载量(方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入当日下载量(方)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '6f71731861734aa5a18e5eb1ca58624e',
field: 'qtyEndM3',
label: '当日管存(方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入当日管存(方)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '85189d1a6d8642cf8d7ff166ccc97a04',
field: 'qtyAdjM3',
label: '手工调整量(方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入手工调整量(方)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'f66d2947ad134056bdf7f7ab7e1489f8',
field: 'comId',
label: '公司',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入公司',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};

View File

@ -0,0 +1,295 @@
<template>
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap formViewStyle pdcss">
<div class="top-toolbar" >
<a-button style="margin-right: 10px" @click="close">
<slot name="icon"><close-outlined /></slot>关闭
</a-button>
<template v-if="pageType!=='view'">
<a-button style="margin-right: 10px" type="primary" @click="handleSubmit">
<slot name="icon"><save-outlined /></slot>保存
</a-button>
</template>
</div>
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<Card title="基础信息" :bordered="false" >
<a-row>
<a-col :span="8">
<a-form-item label="公司" name="comId">
{{ formState.comName }}
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="计划日期" name="datePlan">
{{formState.datePlan ? dayjs(formState.datePlan).format('YYYY-MM-DD') : null }}
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="计量日期" name="dateMea">
{{formState.dateMea ? dayjs(formState.dateMea).format('YYYY-MM-DD') : null}}
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="接收站" name="staName">
{{formState.staName}}
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-item label="前日管存(吉焦)" name="qtyBeginGj">
<input-number v-model:value="formState.qtyBeginGj" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="当日上载量(吉焦)" name="qtyInGj">
<input-number v-model:value="formState.qtyInGj" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="当日下载量(吉焦)" name="qtyOutGj">
<input-number v-model:value="formState.qtyOutGj" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="手工调整量(吉焦)" name="qtyAdjGj">
<input-number v-model:value="formState.qtyAdjGj" :digits="3" :disabled="isDisable" @focus="numFocus('qtyAdjGj',formState.qtyAdjGj)" @blur="numCount('qtyAdjGj')" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="当日管存(吉焦)" name="qtyEndGj">
<input-number v-model:value="formState.qtyEndGj" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-item label="前日管存(方)" name="qtyBeginM3">
<input-number v-model:value="formState.qtyBeginM3" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="当日上载量(方)" name="qtyInM3">
<input-number v-model:value="formState.qtyInM3" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="当日下载量(方)" name="qtyOutM3">
<input-number v-model:value="formState.qtyOutM3" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="手工调整量(方)" name="qtyAdjM3">
<input-number v-model:value="formState.qtyAdjM3" :disabled="isDisable" :digits="3" @focus="numFocus('qtyAdjM3',formState.qtyAdjM3)" @blur="numCount('qtyAdjM3')" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="当日管存(方)" name="qtyEndM3">
<input-number v-model:value="formState.qtyEndM3" :digits="3" disabled style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.note" :disabled="isDisable" :maxLength="200" placeholder="请输入内容最多200字" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
</a-row>
</Card>
<Card title="附件信息" :bordered="false" >
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
</Card>
</a-form>
</div>
</a-spin>
</template>
<script lang="ts" setup>
import { Card } from 'ant-design-vue';
import { useRouter } from 'vue-router';
import { FromPageType, RecordType } from '/@/enums/workflowEnum';
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
import { SendOutlined, SaveOutlined, CloseOutlined, } from '@ant-design/icons-vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
import useEventBus from '/@/hooks/event/useEventBus';
import type { Rule } from 'ant-design-vue/es/form';
import { getDictionary } from '/@/api/sales/Customer';
import { useModal } from '/@/components/Modal';
import { addLngInventoryPngZy,updateLngInventoryPngZy, getLngInventoryPngZy,} from '/@/api/inventory/LngInventoryPngZy';
import dayjs from 'dayjs';
import { getAppEnvConfig } from '/@/utils/env';
import { message } from 'ant-design-vue';
import UploadList from '/@/components/Form/src/components/UploadList.vue';
import { getAllCom} from '/@/api/contract/ContractPurInt';
const tableName = 'LngInventoryPngZy';
const columnName = 'LngInventoryPngZy'
const formType = ref('2'); // 0 新建 1 修改 2 查看
const formRef = ref();
const props = defineProps({
disabled: false,
id: ''
});
const { bus, FORM_LIST_MODIFIED } = useEventBus();
const router = useRouter();
const { currentRoute } = router;
const isDisable = ref(false);
const { formPath } = currentRoute.value.query;
const pathArr = [];
const tabStore = useMultipleTabStore();
const formProps = ref(null);
const formId = ref(currentRoute.value?.params?.id);
const pageType = ref(currentRoute.value.query?.type);
const pageId = ref(currentRoute.value.query?.id)
const pageSource = ref(currentRoute.value.query?.pageSource)
const spinning = ref(false);
const { notification } = useMessage();
const { t } = useI18n()
const oldFormState = reactive({})
const formState = reactive({
});
const rules= reactive({
qtyAdjGj: [{ required: true, message: "该项为必填项", trigger: 'change' }],
qtyAdjM3: [{ required: true, message: "该项为必填项", trigger: 'change' }],
});
const layout = {
labelCol: { span: 8 },
wrapperCol: { span: 16 },
}
const dataFile = ref([]);
watch(
() => props.id,
(val) => {
if (val) {
getInfo(val)
}
},
{
immediate: true
}
);
watch(
() => props.disabled,
(val) => {
isDisable.value = val
},
{
immediate: true
}
);
onMounted(() => {
isDisable.value = pageType.value == 'view'
if (pageId.value) {
getInfo(pageId.value)
}
});
const uploadListChange = (val) => {
dataFile.value = val
}
async function getInfo(id) {
spinning.value = true
try {
let data = await getLngInventoryPngZy(id)
spinning.value = false
Object.assign(formState, {...data})
oldFormState.qtyAdjGj = data.qtyAdjGj
oldFormState.qtyAdjM3 = data.qtyAdjM3
Object.assign(dataFile.value, formState.lngFileUploadList || [])
} catch (error) {
spinning.value = false
}
}
const numFocus = (k, val) => {
oldFormState[k] = val
}
const numCount = (k) => {
if (k == 'qtyAdjGj' && Number(oldFormState.qtyAdjGj) !== Number(formState.qtyAdjGj)) {
formState.qtyEndGj = Number(formState.qtyBeginGj || 0) + Number(formState.qtyInGj || 0) - Number(formState.qtyOutGj || 0)+ Number(formState.qtyAdjGj || 0)
}
if (k == 'qtyAdjM3' && Number(oldFormState.qtyAdjM3) !== Number(formState.qtyAdjM3)) {
formState.qtyEndM3 = Number(formState.qtyBeginM3 || 0) + Number(formState.qtyInM3 || 0) - Number(formState.qtyOutM3 || 0)+ Number(formState.qtyAdjM3 || 0)
}
}
function close() {
tabStore.closeTab(currentRoute.value, router);
}
async function getFormValue() {
return formState
}
async function handleSubmit(type) {
try {
await formRef.value.validateFields();
let rateM3GjValue = Number(formState.qtyEndGj) ? (Number(formState.qtyEndM3)/Number(formState.qtyEndGj)) : null
let obj = {
...formState,
qtyEndGj: formState.qtyEndGj ? formState.qtyEndGj.toFixed(3) : formState.qtyEndGj,
qtyEndM3: formState.qtyEndM3 ? formState.qtyEndM3.toFixed(3) : formState.qtyEndM3,
rateM3Gj: rateM3GjValue ? rateM3GjValue.toFixed(6): null,
datePlan: formState.datePlan ? dayjs(formState.datePlan).format('YYYY-MM-DD HH:mm:ss') : null,
dateMea: formState.dateMea ? dayjs(formState.dateMea).format('YYYY-MM-DD HH:mm:ss') : null,
lngFileUploadList: dataFile.value,
}
spinning.value = true;
let request = !formState.id ? addLngInventoryPngZy :updateLngInventoryPngZy
try {
const data = await request(obj);
notification.success({
message: '提示',
description: data?.id ? t('新增成功!') : t('修改成功!')
}); //提示消息
setTimeout(() => {
bus.emit(FORM_LIST_MODIFIED, {});
close();
}, 500);
} finally {
spinning.value = false;
}
} catch (errorInfo) {
spinning.value = false;
errorInfo?.errorFields?.length && notification.warning({
message: '提示',
description: '请完善信息'
});
return false
}
}
defineExpose({
handleSubmit,
getFormValue
});
</script>
<style lang="less" scoped>
:deep(.ant-form-item .ant-form-item-label) {
width: 135px !important;
max-width: 135px !important;
}
.page-bg-wrap {
background-color: #fff;
}
.top-toolbar {
min-height: 44px;
margin-bottom: 12px;
border-bottom: 1px solid #eee;
}
.pdcss {
padding:0px 12px 6px 12px !important;
}
</style>

View File

@ -0,0 +1,227 @@
export const permissionList = [
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: 'id',
fieldId: 'id',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'b47dd381770d47da9ca49f9d21d38b2c',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '接收站',
fieldId: 'staCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'e51a332292714f788f7890c977f72a59',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '计划日期',
fieldId: 'datePlan',
isSubTable: false,
showChildren: true,
type: 'input',
key: '6b109c2beb2840dda3b4b5d85a844b96',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '计量日期',
fieldId: 'dateMea',
isSubTable: false,
showChildren: true,
type: 'input',
key: '9dcc0bbb53904da49d928e4da4860761',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '前日管存(吉焦)',
fieldId: 'qtyBeginGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'e647efec0a294898858a162b0509aaa5',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '当日上载量(吉焦)',
fieldId: 'qtyInGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '450f669e343546d5aeffd0440ab2506a',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '当日下载量(吉焦)',
fieldId: 'qtyOutGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'e3f50b78be2a47d7ba9601322161f40b',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '手工调整量(吉焦)',
fieldId: 'qtyAdjGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'e590781b52504a499134e5e42b6c6d9b',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '当日管存(吉焦)',
fieldId: 'qtyEndGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '29083b2910854f2a8949d6c63c882509',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '前日管存(方)',
fieldId: 'qtyBeginM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: '54f46bcb72384f3ebc0e03474210ca64',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '当日上载量(方)',
fieldId: 'qtyInM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: '08e29c82735f4b88862e2f5a5fb7c311',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '当日下载量(方)',
fieldId: 'qtyOutM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: '68b2dcdec4e146e38b2d0163cef1d2f5',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '当日管存(方)',
fieldId: 'qtyEndM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: '6f71731861734aa5a18e5eb1ca58624e',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '手工调整量(方)',
fieldId: 'qtyAdjM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: '85189d1a6d8642cf8d7ff166ccc97a04',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '公司',
fieldId: 'comId',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'f66d2947ad134056bdf7f7ab7e1489f8',
children: [],
},
];

View File

@ -0,0 +1,288 @@
<template>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
<template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
<a-button v-else :type="button.type">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
</template>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
<TableAction :actions="getActions(record)" />
</template>
</template>
</BasicTable>
<LngInventoryPngZyModal @register="registerModal" @success="handleSuccess" />
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
</PageWrapper>
</template>
<script lang="ts" setup>
const modalVisible = ref(false);
const logId = ref('')
const logPath = ref('/inventory/lngInventoryPngZy/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted, watch} from 'vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngInventoryPngZyPage, deleteLngInventoryPngZy} from '/@/api/inventory/LngInventoryPngZy';
import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { useRouter } from 'vue-router';
import { setIndexFlowStatus } from '/@/utils/flow/index'
import { getLngInventoryPngZy } from '/@/api/inventory/LngInventoryPngZy';
import { useModal } from '/@/components/Modal';
import LngInventoryPngZyModal from './components/LngInventoryPngZyModal.vue';
import {formConfig, searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
import { getAllCom} from '/@/api/contract/ContractPurInt';
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
const { notification } = useMessage();
const { t } = useI18n();
defineEmits(['register']);
const { filterColumnAuth, filterButtonAuth } = usePermission();
const { mergeColumns,mergeSearchFormSchema,mergeButtons } = useFormConfig();
const filterColumns = cloneDeep(filterColumnAuth(columns));
const customConfigColums =ref(filterColumns);
const customSearchFormSchema =ref(searchFormSchema);
const tableRef = ref();
//所有按钮
const buttons = ref([{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},{"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true,"isUse":true},{"name":"调整","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {refresh : handleRefresh,view : handleView,datalog : handleDatalog,edit : handleEdit,}
const { currentRoute } = useRouter();
const router = useRouter();
const tableData = ref([])
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const [registerModal, { openModal }] = useModal();
const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, setTableData }] = useTable({
title: '' || (formName + '列表'),
api: getLngInventoryPngZyPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: false,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page: params.limit};
},
afterFetch: (res) => {
tableData.value = res || []
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 140,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
tableSetting: {
size: false,
setting: false,
},
});
watch(
() => tableData.value,
(val) => {
if (val) {
let arr = DataFormat.format(val, [
FormatOption.createQty('qtyBeginGj'),
FormatOption.createQty('qtyInGj'),
FormatOption.createQty('qtyOutGj'),
FormatOption.createQty('qtyAdjGj'),
FormatOption.createQty('qtyEndGj'),
FormatOption.createQty('qtyBeginM3'),
FormatOption.createQty('qtyInM3'),
FormatOption.createQty('qtyOutM3'),
FormatOption.createQty('qtyEndM3'),
FormatOption.createQty('qtyAdjM3'),
]);
if (arr.length) {
setTableData(arr)
}
}
},
{
immediate: true,
deep: true,
}
);
function dbClickRow(record) {
router.push({
path: '/inventory/LngInventoryPngZy/createForm',
query: {
formPath: 'inventory/LngInventoryPngZy',
formName: '查看'+formName,
formId:currentRoute.value.meta.formId,
id: record.id,
type: 'view'
}
});
}
function buttonClick(code) {
btnEvent[code]();
}
function handleEdit (record: Recordable) {
router.push({
path: '/inventory/LngInventoryPngZy/createForm',
query: {
formPath: 'inventory/LngInventoryPngZy',
formName: '调整'+formName,
formId:currentRoute.value.meta.formId,
id: record.id,
type: 'edit'
}
});
}
function handleDatalog (record: Recordable) {
modalVisible.value = true
logId.value = record.id
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
onMounted(async() => {
let res = await getAllCom() || []
customSearchFormSchema.value.forEach(v => {
if (v.field == 'comId') {
v.componentProps.options = res.map(v=> {
return {
label: v.shortName,
value: v.id
}
})
}
});
if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh);
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
mergeCustomListRenderConfig();
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
bus.off(FLOW_PROCESSED, handleRefresh);
bus.off(CREATE_FLOW, handleRefresh);
} else {
bus.off(FORM_LIST_MODIFIED, handleRefresh);
}
});
function getActions(record: Recordable):ActionItem[] {
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
if (!record.workflowData?.processId) {
return {
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
if (button.code === 'view') {
return {
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
return {};
}
}
});
return actionsList;
}
async function mergeCustomListRenderConfig(){
if (formConfig.useCustomConfig) {
let formId=currentRoute.value.meta.formId;
//1.合并展示字段配置
let cols= await mergeColumns(customConfigColums.value,formId);
customConfigColums.value=cols;
//2.合并搜索字段配置
let sFormSchema= await mergeSearchFormSchema(customSearchFormSchema.value,formId);
customSearchFormSchema.value=sFormSchema;
//3.合并按钮配置
let btns= await mergeButtons(buttons.value,formId);
buttons.value=btns;
}
};
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
:deep( .ant-col-8:nth-child(1)) {
width: 320px !important;
max-width: 320px !important;
}
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
width: 80px !important;
}
</style>