入库出库
This commit is contained in:
90
src/api/inventory/LngInventoryIn/index.ts
Normal file
90
src/api/inventory/LngInventoryIn/index.ts
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import { LngInventoryInPageModel, LngInventoryInPageParams, LngInventoryInPageResult } from './model/LngInventoryInModel';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { ErrorMessageMode } from '/#/axios';
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
Page = '/inventory/lngInventoryIn/page',
|
||||||
|
List = '/inventory/lngInventoryIn/list',
|
||||||
|
Info = '/inventory/lngInventoryIn/info',
|
||||||
|
LngInventoryIn = '/inventory/lngInventoryIn',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DataLog = '/inventory/lngInventoryIn/datalog',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 查询LngInventoryIn分页列表
|
||||||
|
*/
|
||||||
|
export async function getLngInventoryInPage(params: LngInventoryInPageParams, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<LngInventoryInPageResult>(
|
||||||
|
{
|
||||||
|
url: Api.Page,
|
||||||
|
params,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取LngInventoryIn信息
|
||||||
|
*/
|
||||||
|
export async function getLngInventoryIn(id: String, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<LngInventoryInPageModel>(
|
||||||
|
{
|
||||||
|
url: Api.Info,
|
||||||
|
params: { id },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 新增LngInventoryIn
|
||||||
|
*/
|
||||||
|
export async function addLngInventoryIn(lngInventoryIn: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.post<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngInventoryIn,
|
||||||
|
params: lngInventoryIn,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 更新LngInventoryIn
|
||||||
|
*/
|
||||||
|
export async function updateLngInventoryIn(lngInventoryIn: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.put<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngInventoryIn,
|
||||||
|
params: lngInventoryIn,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 删除LngInventoryIn(批量删除)
|
||||||
|
*/
|
||||||
|
export async function deleteLngInventoryIn(ids: string[], mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.delete<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngInventoryIn,
|
||||||
|
data: ids,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngInventoryIn分页参数 模型
|
||||||
|
*/
|
||||||
|
export interface LngInventoryInPageParams extends BasicPageParams {
|
||||||
|
typeCode: string;
|
||||||
|
|
||||||
|
staCode: string;
|
||||||
|
|
||||||
|
dateIn: string;
|
||||||
|
|
||||||
|
suCode: string;
|
||||||
|
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
qtyUnloadMmbtu: string;
|
||||||
|
|
||||||
|
qtyUnloadTon: string;
|
||||||
|
|
||||||
|
qtyUnloadM3L: string;
|
||||||
|
|
||||||
|
qtyUnloadM3: string;
|
||||||
|
|
||||||
|
qtyUnloadGj: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngInventoryIn分页返回值模型
|
||||||
|
*/
|
||||||
|
export interface LngInventoryInPageModel {
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
typeCode: string;
|
||||||
|
|
||||||
|
staCode: string;
|
||||||
|
|
||||||
|
dateIn: string;
|
||||||
|
|
||||||
|
qtyUnloadMmbtu: string;
|
||||||
|
|
||||||
|
qtyUnloadTon: string;
|
||||||
|
|
||||||
|
qtyUnloadM3L: string;
|
||||||
|
|
||||||
|
qtyUnloadM3: string;
|
||||||
|
|
||||||
|
qtyUnloadGj: string;
|
||||||
|
|
||||||
|
suCode: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngInventoryIn分页返回值结构
|
||||||
|
*/
|
||||||
|
export type LngInventoryInPageResult = BasicFetchResult<LngInventoryInPageModel>;
|
||||||
90
src/api/inventory/LngInventoryOut/index.ts
Normal file
90
src/api/inventory/LngInventoryOut/index.ts
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import { LngInventoryOutPageModel, LngInventoryOutPageParams, LngInventoryOutPageResult } from './model/LngInventoryOutModel';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { ErrorMessageMode } from '/#/axios';
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
Page = '/inventory/lngInventoryOut/page',
|
||||||
|
List = '/inventory/lngInventoryOut/list',
|
||||||
|
Info = '/inventory/lngInventoryOut/info',
|
||||||
|
LngInventoryOut = '/inventory/lngInventoryOut',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DataLog = '/inventory/lngInventoryOut/datalog',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 查询LngInventoryOut分页列表
|
||||||
|
*/
|
||||||
|
export async function getLngInventoryOutPage(params: LngInventoryOutPageParams, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<LngInventoryOutPageResult>(
|
||||||
|
{
|
||||||
|
url: Api.Page,
|
||||||
|
params,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取LngInventoryOut信息
|
||||||
|
*/
|
||||||
|
export async function getLngInventoryOut(id: String, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<LngInventoryOutPageModel>(
|
||||||
|
{
|
||||||
|
url: Api.Info,
|
||||||
|
params: { id },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 新增LngInventoryOut
|
||||||
|
*/
|
||||||
|
export async function addLngInventoryOut(lngInventoryOut: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.post<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngInventoryOut,
|
||||||
|
params: lngInventoryOut,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 更新LngInventoryOut
|
||||||
|
*/
|
||||||
|
export async function updateLngInventoryOut(lngInventoryOut: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.put<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngInventoryOut,
|
||||||
|
params: lngInventoryOut,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 删除LngInventoryOut(批量删除)
|
||||||
|
*/
|
||||||
|
export async function deleteLngInventoryOut(ids: string[], mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.delete<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngInventoryOut,
|
||||||
|
data: ids,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngInventoryOut分页参数 模型
|
||||||
|
*/
|
||||||
|
export interface LngInventoryOutPageParams extends BasicPageParams {
|
||||||
|
typeCode: string;
|
||||||
|
|
||||||
|
staCode: string;
|
||||||
|
|
||||||
|
dateOut: string;
|
||||||
|
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
qtyGj: string;
|
||||||
|
|
||||||
|
qtyTon: string;
|
||||||
|
|
||||||
|
qtyM3: string;
|
||||||
|
|
||||||
|
amount: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngInventoryOut分页返回值模型
|
||||||
|
*/
|
||||||
|
export interface LngInventoryOutPageModel {
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
typeCode: string;
|
||||||
|
|
||||||
|
staCode: string;
|
||||||
|
|
||||||
|
dateOut: string;
|
||||||
|
|
||||||
|
qtyGj: string;
|
||||||
|
|
||||||
|
qtyTon: string;
|
||||||
|
|
||||||
|
qtyM3: string;
|
||||||
|
|
||||||
|
amount: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngInventoryOut分页返回值结构
|
||||||
|
*/
|
||||||
|
export type LngInventoryOutPageResult = BasicFetchResult<LngInventoryOutPageModel>;
|
||||||
@ -366,6 +366,14 @@ export const PAGE_CUSTOM_ROUTE: AppRouteRecordRaw[] = [{
|
|||||||
title: (route) => (route.query.formName || '短信记录')
|
title: (route) => (route.query.formName || '短信记录')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/inventory/LngInventoryIn/createForm',
|
||||||
|
name: 'LngInventoryIn',
|
||||||
|
component: () => import('/@/views/inventory/LngInventoryIn/components/createForm.vue'),
|
||||||
|
meta: {
|
||||||
|
title: (route) => (route.query.formName)
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -112,7 +112,7 @@
|
|||||||
const taskIdRef = ref('');
|
const taskIdRef = ref('');
|
||||||
const visibleFlowRecordModal = ref(false);
|
const visibleFlowRecordModal = ref(false);
|
||||||
const [registerModal, { openModal }] = useModal();
|
const [registerModal, { openModal }] = useModal();
|
||||||
const formName='国内LNG采购合同';
|
const formName=currentRoute.value.meta?.title;
|
||||||
const [registerTable, { reload, }] = useTable({
|
const [registerTable, { reload, }] = useTable({
|
||||||
title: '' || (formName + '列表'),
|
title: '' || (formName + '列表'),
|
||||||
api: getLngContractPage,
|
api: getLngContractPage,
|
||||||
@ -123,7 +123,7 @@
|
|||||||
gutter: 16,
|
gutter: 16,
|
||||||
},
|
},
|
||||||
schemas: customSearchFormSchema,
|
schemas: customSearchFormSchema,
|
||||||
fieldMapToTime: [],
|
fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
|
||||||
showResetButton: false,
|
showResetButton: false,
|
||||||
},
|
},
|
||||||
beforeFetch: (params) => {
|
beforeFetch: (params) => {
|
||||||
|
|||||||
224
src/views/inventory/LngInventoryIn/components/Form.vue
Normal file
224
src/views/inventory/LngInventoryIn/components/Form.vue
Normal 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 { addLngInventoryIn, getLngInventoryIn, updateLngInventoryIn, deleteLngInventoryIn } from '/@/api/inventory/LngInventoryIn';
|
||||||
|
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 getLngInventoryIn(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 updateLngInventoryIn(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 addLngInventoryIn(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 deleteLngInventoryIn([id]);
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
setFieldsValue,
|
||||||
|
resetFields,
|
||||||
|
validate,
|
||||||
|
add,
|
||||||
|
update,
|
||||||
|
setFormDataFromId,
|
||||||
|
setDisabledForm,
|
||||||
|
setMenuPermission,
|
||||||
|
setWorkFlowForm,
|
||||||
|
getRowKey,
|
||||||
|
getFormModel,
|
||||||
|
handleDelete
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@ -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>
|
||||||
556
src/views/inventory/LngInventoryIn/components/config.ts
Normal file
556
src/views/inventory/LngInventoryIn/components/config.ts
Normal file
@ -0,0 +1,556 @@
|
|||||||
|
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,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'staName',
|
||||||
|
label: '接收站',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'typeName',
|
||||||
|
title: '入库类型',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'ssNo',
|
||||||
|
title: '船期编号',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'staName',
|
||||||
|
title: '接收站',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'dateIn',
|
||||||
|
title: '入库日期',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'qtyMmbtu',
|
||||||
|
title: '入库热值(MMBtu)',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'qtyTon',
|
||||||
|
title: '入库重量(吨)',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'qtyM3L',
|
||||||
|
title: '入库体积(标方)',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'qtyM3',
|
||||||
|
title: '入库体积(方)',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'qtyGj',
|
||||||
|
title: '入库热值(吉焦)',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'kName',
|
||||||
|
title: '合同',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'suName',
|
||||||
|
title: '供应商',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'comName',
|
||||||
|
title: '公司',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
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: 'ac1418db9f3f4c6f8914a5e8efe5434d',
|
||||||
|
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: '466d90ea02e44444b372eb326c6fa5cc',
|
||||||
|
field: 'typeCode',
|
||||||
|
label: '入库类型',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入入库类型',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '468932b802e349c6a860b3f4f11bedd2',
|
||||||
|
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: '请输入接收站',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'f6a0ca29c2de4e1c8f4cfdc1cb2589e3',
|
||||||
|
field: 'dateIn',
|
||||||
|
label: '入库日期',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入入库日期',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'aa14d4672e9f4d799ac9df94222bd34c',
|
||||||
|
field: 'qtyUnloadMmbtu',
|
||||||
|
label: '入库热值(MMBtu)',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入入库热值(MMBtu)',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'bfa65959cbd0461a883b9e68312af2ed',
|
||||||
|
field: 'qtyUnloadTon',
|
||||||
|
label: '入库重量(吨)',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入入库重量(吨)',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '2a8f62a8ebda4ff989fa25d8d54e7e09',
|
||||||
|
field: 'qtyUnloadM3L',
|
||||||
|
label: '入库体积(标方)',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入入库体积(标方)',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'd8b3ed3faa4447429d21e02b7cd7e04a',
|
||||||
|
field: 'qtyUnloadM3',
|
||||||
|
label: '入库体积(方)',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入入库体积(方)',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '2207b761f3174315b7aa1210e46520ad',
|
||||||
|
field: 'qtyUnloadGj',
|
||||||
|
label: '入库热值(吉焦)',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入入库热值(吉焦)',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'd0586501498a4919af8468af574fdd83',
|
||||||
|
field: 'suCode',
|
||||||
|
label: '供应商',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入供应商',
|
||||||
|
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: [],
|
||||||
|
};
|
||||||
529
src/views/inventory/LngInventoryIn/components/createForm.vue
Normal file
529
src/views/inventory/LngInventoryIn/components/createForm.vue
Normal file
@ -0,0 +1,529 @@
|
|||||||
|
<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="comName">
|
||||||
|
<a-select v-model:value="formState.comId" disabled placeholder="请选择" style="width: 100%" allow-clear>
|
||||||
|
<a-select-option v-for="item in optionSelect.comIdList" :key="item.value" :value="item.value">
|
||||||
|
{{ item.label }}
|
||||||
|
</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="接收站" name="staName">
|
||||||
|
<a-input-search v-model:value="formState.staName" :disabled="isDisable" placeholder="请选择接收站" readonly @search="onSearchStation"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="入库存类型" name="typeCode">
|
||||||
|
<a-select v-model:value="formState.typeCode" disabled placeholder="" style="width: 100%" allow-clear>
|
||||||
|
<a-select-option v-for="item in optionSelect.typeCodeList" :key="item.code" :value="item.code">
|
||||||
|
{{ item.name }}
|
||||||
|
</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="船期编号" name="ssNo">
|
||||||
|
<a-input-search v-model:value="formState.ssNo" :disabled="Boolean(isDisable || pageType ) " placeholder="请选择船期" readonly @search="onSearchShip"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="采购合同" name="kName">
|
||||||
|
<a-input-search v-model:value="formState.kName" :disabled="isDisable" placeholder="请选择合同" readonly @search="onContract"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="供应商" name="suName">
|
||||||
|
<a-input-search v-model:value="formState.suName" disabled/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="入库" name="dateIn">
|
||||||
|
<a-date-picker :inputReadOnly="true" v-model:value="formState.dateIn" style="width: 100%" :disabled="isDisable" placeholder="请选择日期" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</Card>
|
||||||
|
<Card title="" :bordered="false" >
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="卸港热值(MMBtu)" name="qtyUnloadMmbtu">
|
||||||
|
<input-number v-model:value="formState.qtyUnloadMmbtu" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="卸港热值(吉焦)" name="qtyUnloadGj">
|
||||||
|
<input-number v-model:value="formState.qtyUnloadGj" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="卸港重量(吨)" name="qtyUnloadTon">
|
||||||
|
<input-number v-model:value="formState.qtyUnloadTon" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="卸港体积(标方)" name="qtyUnloadM3L">
|
||||||
|
<input-number v-model:value="formState.qtyUnloadM3L" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="卸港体积(方)" name="qtyUnloadM3">
|
||||||
|
<input-number v-model:value="formState.qtyUnloadM3" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="损耗比例%" name="rateLost">
|
||||||
|
<input-number v-model:value="formState.rateLost" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="损耗热值(MMBtu)" name="qtyLostMmbtu">
|
||||||
|
<input-number v-model:value="formState.qtyLostMmbtu" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="损耗热值(吉焦)" name="qtyLostGj">
|
||||||
|
<input-number v-model:value="formState.qtyLostGj" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="损耗重量(吨)" name="qtyLostTon">
|
||||||
|
<input-number v-model:value="formState.qtyLostTon" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="损耗体积(标方)" name="qtyLostM3L">
|
||||||
|
<input-number v-model:value="formState.qtyLostM3L" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="损耗体积(方)" name="qtyLostM3">
|
||||||
|
<input-number v-model:value="formState.qtyLostM3" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="入库热值(MMBtu)" name="qtyMmbtu">
|
||||||
|
<input-number v-model:value="formState.qtyMmbtu" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="入库热值(吉焦)" name="qtyGj">
|
||||||
|
<input-number v-model:value="formState.qtyGj" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="入库重量(吨)" name="qtyTon">
|
||||||
|
<input-number v-model:value="formState.qtyTon" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="入库体积(标方)" name="qtyM3L">
|
||||||
|
<input-number v-model:value="formState.qtyM3L" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="入库体积(方)" name="qtyM3">
|
||||||
|
<input-number v-model:value="formState.qtyM3" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
</Card>
|
||||||
|
<Card title="" :bordered="false" >
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="结算币种" name="curCode">
|
||||||
|
<a-select v-model:value="formState.curCode" :disabled="isDisable" placeholder="请选择币种" style="width: 100%" allow-clear>
|
||||||
|
<a-select-option v-for="item in optionSelect.curCodeList" :key="item.code" :value="item.code">
|
||||||
|
{{ item.fullName }}
|
||||||
|
</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="结算币种单价(/MMBtu)" name="priceMmbtu">
|
||||||
|
<input-number v-model:value="formState.priceMmbtu" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="结算币种金额" name="amountCurr">
|
||||||
|
<input-number v-model:value="formState.amountCurr" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="购汇汇率" name="rateExPur">
|
||||||
|
<input-number v-model:value="formState.rateExPur" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="入库金额/纯货值(元)" name="amount">
|
||||||
|
<input-number v-model:value="formState.amount" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="入库价格(元/吨)" name="priceTon">
|
||||||
|
<input-number v-model:value="formState.priceTon" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="入库价格(元/吉焦)" name="priceGj">
|
||||||
|
<input-number v-model:value="formState.priceGj" :disabled="isDisable" :digits="3" :min="0" 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>
|
||||||
|
<contractPurIntListModal @register="registerContractPurInt" @success="handleSuccessContractPurInt" selectType="radio" pageType="pur"/>
|
||||||
|
<lngStationModal @register="registerStation" @success="handleSuccessStation"/>
|
||||||
|
<shipScheduleListModal @register="registerShip" @success="handleSuccessShip" />
|
||||||
|
</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 { getAllPriceTerm} from '/@/api/contract/ContractPurInt';
|
||||||
|
import { addLngOpsPurInt,updateLngOpsPurInt, getLngOpsPurInt} from '/@/api/ship/OpsPurInt';
|
||||||
|
import { getAllCurrency } from '/@/api/contract/ContractFact';
|
||||||
|
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 contractPurIntListModal from '../../../../components/common/contractPurIntListModal.vue';
|
||||||
|
import lngStationModal from '/@/components/common/lngStationModal.vue';
|
||||||
|
import shipScheduleListModal from '/@/components/common/shipScheduleListModal.vue';
|
||||||
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
|
import { getAllCom} from '/@/api/contract/ContractPurInt';
|
||||||
|
import type { CascaderProps } from 'ant-design-vue';
|
||||||
|
import { getAreaList, getAreaInfo} from '/@/api/mdm/CountryRegion';
|
||||||
|
import {getCompDept } from '/@/api/approve/Appro';
|
||||||
|
import { getLngShipSchedule} from '/@/api/ship/ShipSchedule';
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const userInfo = userStore.getUserInfo;
|
||||||
|
|
||||||
|
const tableName = 'OpsPurInt';
|
||||||
|
const columnName = 'OpsPurInt'
|
||||||
|
|
||||||
|
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 formState = reactive({
|
||||||
|
approCode: 'WTJ',
|
||||||
|
frtSign: 'N'
|
||||||
|
});
|
||||||
|
const [register, { openModal:openModal}] = useModal();
|
||||||
|
const [registerContractPurInt, { openModal:openModalContractPurInt}] = useModal();
|
||||||
|
const [registerStation, { openModal:openModalStation}] = useModal();
|
||||||
|
const [registerPort, { openModal:openModalPort}] = useModal();
|
||||||
|
const [registerShip, { openModal:openModalShip}] = useModal();
|
||||||
|
|
||||||
|
const rules= reactive({
|
||||||
|
ssNo: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||||
|
comId: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||||
|
ssTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||||
|
curCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||||
|
dateEta: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||||
|
kName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||||
|
staName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||||
|
dateOps: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||||
|
frtSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||||
|
insurSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||||
|
});
|
||||||
|
const layout = {
|
||||||
|
labelCol: { span: 8 },
|
||||||
|
wrapperCol: { span: 16 },
|
||||||
|
}
|
||||||
|
const dataFile = ref([]);
|
||||||
|
let optionSelect= reactive({
|
||||||
|
signList: [],
|
||||||
|
comIdList: [],
|
||||||
|
ssTypeCodeList: [],
|
||||||
|
typeCodeList: [],
|
||||||
|
curCodeList: [],
|
||||||
|
prcTermCodeList: [],
|
||||||
|
});
|
||||||
|
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'
|
||||||
|
getOption()
|
||||||
|
if (pageId.value) {
|
||||||
|
pageSource.value ? getLngShipInfo(pageId.value) :getInfo(pageId.value)
|
||||||
|
} else {
|
||||||
|
getOptionParams()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const uploadListChange = (val) => {
|
||||||
|
dataFile.value = val
|
||||||
|
}
|
||||||
|
async function getInfo(id) {
|
||||||
|
spinning.value = true
|
||||||
|
try {
|
||||||
|
let data = await getLngOpsPurInt(id)
|
||||||
|
spinning.value = false
|
||||||
|
Object.assign(formState, {...data})
|
||||||
|
Object.assign(dataFile.value, formState.lngFileUploadList || [])
|
||||||
|
formState.dateNor = formState.dateNor ? dayjs(formState.dateNor) : null
|
||||||
|
getOptionParams()
|
||||||
|
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
spinning.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function getOption() {
|
||||||
|
optionSelect.signList = await getDictionary('LNG_YN')
|
||||||
|
optionSelect.ssTypeCodeList = await getDictionary('LNG_SHP_S')
|
||||||
|
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
|
||||||
|
optionSelect.typeCodeList = await getDictionary('LNG_INV_I')
|
||||||
|
if (!pageId.value) {
|
||||||
|
getCompDeptInfo(userInfo.id)
|
||||||
|
}
|
||||||
|
let res = await getAllCom() || []
|
||||||
|
optionSelect.comIdList = res.map(v=> {
|
||||||
|
return {
|
||||||
|
label: v.shortName,
|
||||||
|
value: v.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
async function getOptionParams() {
|
||||||
|
optionSelect.curCodeList = await getAllCurrency({eid: formState.curCode})
|
||||||
|
}
|
||||||
|
const numCount = () => {
|
||||||
|
formState.amountCurrEst = (Number(formState.qtyMmbtu) || 0) * (Number(formState.priceCurrEst) || 0)
|
||||||
|
formState.amountCurrEst = formState.amountCurrEst ? formState.amountCurrEst.toFixed(2) : ''
|
||||||
|
}
|
||||||
|
const numChange = () => {
|
||||||
|
formState.amountCurr = (Number(formState.qtySettleMmbtu) || 0) * (Number(formState.priceCurr) || 0)
|
||||||
|
formState.amountCurr = formState.amountCurr ? formState.amountCurr.toFixed(2) : ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const onSearchShip = () => {
|
||||||
|
openModalShip(true,{isUpdate: false})
|
||||||
|
}
|
||||||
|
const onSearchStation = (val)=> {
|
||||||
|
openModalStation(true,{isUpdate: false})
|
||||||
|
}
|
||||||
|
|
||||||
|
const onContract = (val)=> {
|
||||||
|
openModalContractPurInt(true,{isUpdate: false})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSuccessStation = (val) => {
|
||||||
|
formState.staCode = val[0].code
|
||||||
|
formState.staName = val[0].fullName
|
||||||
|
}
|
||||||
|
const handleSuccessShip = (val) => {
|
||||||
|
|
||||||
|
formState.ssNo = val[0].ssNo
|
||||||
|
formState.ssId = val[0].id
|
||||||
|
getLngShipInfo(val[0].id)
|
||||||
|
}
|
||||||
|
const getLngShipInfo = async (id) => {
|
||||||
|
try {
|
||||||
|
spinning.value = true
|
||||||
|
let data = await getLngShipSchedule(id)
|
||||||
|
spinning.value = false
|
||||||
|
formState.ssNo = data.ssNo
|
||||||
|
formState.ssId = data.id
|
||||||
|
formState.comId = data.comId
|
||||||
|
formState.kId = data.kId
|
||||||
|
formState.kName = data.kName
|
||||||
|
formState.longSpotCode = data.longSpotCode
|
||||||
|
formState.suCode = data.suCode
|
||||||
|
formState.suName = data.suName
|
||||||
|
formState.staCode = data.staCode
|
||||||
|
formState.staName = data.staName
|
||||||
|
formState.sourceName = data.sourceName
|
||||||
|
formState.empId = data.empId
|
||||||
|
formState.empName = data.empName
|
||||||
|
formState.empTel = data.empTel
|
||||||
|
formState.prcTermCode = data.prcTermCode
|
||||||
|
formState.shipCode = data.shipCode
|
||||||
|
formState.shipName = data.shipName
|
||||||
|
formState.dateNor = data.dateNor ? dayjs(data.dateNor) : null
|
||||||
|
formState.portUnloading1Code = data.portUnloading1Code
|
||||||
|
formState.portUnloading1Name = data.portUnloading1Name
|
||||||
|
formState.dateEta = data.dateEta ? dayjs(data.dateEta) : null
|
||||||
|
formState.dateEtb = data.dateEtb ? dayjs(data.dateEtb) : null
|
||||||
|
formState.dateEtc = data.dateEtc ? dayjs(data.dateEtc) : null
|
||||||
|
formState.dateEtd = data.dateEtd ? dayjs(data.dateEtd) : null
|
||||||
|
formState.qtyMmbtu = data.qtyMmbtu
|
||||||
|
formState.qtyGj = data.qtyGj
|
||||||
|
formState.qtyTon = data.qtyTon
|
||||||
|
formState.qtyM3 = data.qtyM3
|
||||||
|
formState.curCode = data.curCode
|
||||||
|
formState.rateEx = data.rateEx
|
||||||
|
formState.priceCurrEst = data.priceCurrEst
|
||||||
|
formState.amountCurrEst = data.amountCurrEst
|
||||||
|
|
||||||
|
if (pageSource.value) {
|
||||||
|
getOptionParams()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
spinning.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const handleSuccessContractPurInt = (val) => {
|
||||||
|
formState.kId = val[0].id
|
||||||
|
formState.kName = val[0].kName
|
||||||
|
formState.comId = val[0].comId
|
||||||
|
formState.suCode = val[0].suCode
|
||||||
|
formState.suName = val[0].suSname
|
||||||
|
formState.longSpotCode = val[0].longSpotCode
|
||||||
|
formState.prcTermCode = val[0].prcTermCode
|
||||||
|
formState.sourceName = val[0].sourceName
|
||||||
|
}
|
||||||
|
function close() {
|
||||||
|
tabStore.closeTab(currentRoute.value, router);
|
||||||
|
}
|
||||||
|
async function getFormValue() {
|
||||||
|
return formState
|
||||||
|
}
|
||||||
|
async function handleSubmit(type) {
|
||||||
|
try {
|
||||||
|
await formRef.value.validateFields();
|
||||||
|
let obj = {
|
||||||
|
...formState,
|
||||||
|
salesAreaCode: formState.salesAreaCode ? formState.salesAreaCode[formState.salesAreaCode.length -1] : '',
|
||||||
|
lngFileUploadList: dataFile.value,
|
||||||
|
}
|
||||||
|
spinning.value = true;
|
||||||
|
let request = !formState.id ? addLngOpsPurInt :updateLngOpsPurInt
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
:deep(.formItemWarp .ant-form-item-label > label) {
|
||||||
|
white-space: normal !important;
|
||||||
|
word-break: break-word !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -0,0 +1,152 @@
|
|||||||
|
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: 'ac1418db9f3f4c6f8914a5e8efe5434d',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '入库类型',
|
||||||
|
fieldId: 'typeCode',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '466d90ea02e44444b372eb326c6fa5cc',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '接收站',
|
||||||
|
fieldId: 'staCode',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '468932b802e349c6a860b3f4f11bedd2',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '入库日期',
|
||||||
|
fieldId: 'dateIn',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: 'f6a0ca29c2de4e1c8f4cfdc1cb2589e3',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '入库热值(MMBtu)',
|
||||||
|
fieldId: 'qtyUnloadMmbtu',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: 'aa14d4672e9f4d799ac9df94222bd34c',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '入库重量(吨)',
|
||||||
|
fieldId: 'qtyUnloadTon',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: 'bfa65959cbd0461a883b9e68312af2ed',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '入库体积(标方)',
|
||||||
|
fieldId: 'qtyUnloadM3L',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '2a8f62a8ebda4ff989fa25d8d54e7e09',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '入库体积(方)',
|
||||||
|
fieldId: 'qtyUnloadM3',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: 'd8b3ed3faa4447429d21e02b7cd7e04a',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '入库热值(吉焦)',
|
||||||
|
fieldId: 'qtyUnloadGj',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '2207b761f3174315b7aa1210e46520ad',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '供应商',
|
||||||
|
fieldId: 'suCode',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: 'd0586501498a4919af8468af574fdd83',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
327
src/views/inventory/LngInventoryIn/index.vue
Normal file
327
src/views/inventory/LngInventoryIn/index.vue
Normal file
@ -0,0 +1,327 @@
|
|||||||
|
<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>
|
||||||
|
<LngInventoryInModal @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/lngInventoryIn/datalog');
|
||||||
|
import { DataLog } from '/@/components/pcitc';
|
||||||
|
import { ref, computed, onMounted, onUnmounted, createVNode,
|
||||||
|
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
|
import { Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||||
|
import { getLngInventoryInPage, deleteLngInventoryIn} from '/@/api/inventory/LngInventoryIn';
|
||||||
|
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 { getLngInventoryIn } from '/@/api/inventory/LngInventoryIn';
|
||||||
|
import { useModal } from '/@/components/Modal';
|
||||||
|
import LngInventoryInModal from './components/LngInventoryInModal.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';
|
||||||
|
|
||||||
|
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":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true,"type":"primary"},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"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":"delete","icon":"ant-design:delete-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 = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,datalog : handleDatalog,delete : handleDelete,}
|
||||||
|
|
||||||
|
const { currentRoute } = useRouter();
|
||||||
|
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, }] = useTable({
|
||||||
|
title: '' || (formName + '列表'),
|
||||||
|
api: getLngInventoryInPage,
|
||||||
|
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) => {
|
||||||
|
tableRef.value.setToolBarWidth();
|
||||||
|
|
||||||
|
},
|
||||||
|
useSearchForm: true,
|
||||||
|
showTableSetting: true,
|
||||||
|
|
||||||
|
striped: false,
|
||||||
|
actionColumn: {
|
||||||
|
width: 160,
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
slots: { customRender: 'action' },
|
||||||
|
},
|
||||||
|
tableSetting: {
|
||||||
|
size: false,
|
||||||
|
setting: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function dbClickRow(record) {
|
||||||
|
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||||
|
if (taskIds && taskIds.length) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
taskId: taskIds[0],
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (schemaId && !taskIds && processId) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
readonly: 1,
|
||||||
|
taskId: '',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/form/LngInventoryIn/' + record.id + '/viewForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'inventory/LngInventoryIn',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buttonClick(code) {
|
||||||
|
|
||||||
|
btnEvent[code]();
|
||||||
|
}
|
||||||
|
function handleDatalog (record: Recordable) {
|
||||||
|
modalVisible.value = true
|
||||||
|
logId.value = record.id
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
if (schemaIdComputedRef.value) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/inventory/LngInventoryIn/createForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'inventory/LngInventoryIn',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
|
||||||
|
router.push({
|
||||||
|
path: '/form/LngInventoryIn/' + record.id + '/updateForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'inventory/LngInventoryIn',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleDelete(record: Recordable) {
|
||||||
|
deleteList([record.id]);
|
||||||
|
}
|
||||||
|
function deleteList(ids) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示信息',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
content: '是否确认删除?',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk() {
|
||||||
|
deleteLngInventoryIn(ids).then((_) => {
|
||||||
|
handleSuccess();
|
||||||
|
notification.success({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('删除成功!'),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onCancel() {},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
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>
|
||||||
224
src/views/inventory/LngInventoryOut/components/Form.vue
Normal file
224
src/views/inventory/LngInventoryOut/components/Form.vue
Normal 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 { addLngInventoryOut, getLngInventoryOut, updateLngInventoryOut, deleteLngInventoryOut } from '/@/api/inventory/LngInventoryOut';
|
||||||
|
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 getLngInventoryOut(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 updateLngInventoryOut(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 addLngInventoryOut(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 deleteLngInventoryOut([id]);
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
setFieldsValue,
|
||||||
|
resetFields,
|
||||||
|
validate,
|
||||||
|
add,
|
||||||
|
update,
|
||||||
|
setFormDataFromId,
|
||||||
|
setDisabledForm,
|
||||||
|
setMenuPermission,
|
||||||
|
setWorkFlowForm,
|
||||||
|
getRowKey,
|
||||||
|
getFormModel,
|
||||||
|
handleDelete
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@ -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>
|
||||||
473
src/views/inventory/LngInventoryOut/components/config.ts
Normal file
473
src/views/inventory/LngInventoryOut/components/config.ts
Normal file
@ -0,0 +1,473 @@
|
|||||||
|
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,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'staName',
|
||||||
|
label: '接收站',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'typeName',
|
||||||
|
title: '出库类型',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'staName',
|
||||||
|
title: '接收站',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'dateOut',
|
||||||
|
title: '出库日期',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'qtyGj',
|
||||||
|
title: '出库量(吉焦)',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'qtyTon',
|
||||||
|
title: '出库量(吨)',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'qtyM3',
|
||||||
|
title: '出库量(方)',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'amount',
|
||||||
|
title: '出库金额',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'kName',
|
||||||
|
title: '销售合同',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'cuName',
|
||||||
|
title: '客户名称',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'comName',
|
||||||
|
title: '公司名称',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
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: '31d714b2242944c2b841b67eb3346877',
|
||||||
|
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: '4241e590fd0e4a40ac09928d19ccdd49',
|
||||||
|
field: 'typeCode',
|
||||||
|
label: '出库类型',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入出库类型',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '7adf7ffe4cc147cd9cc9dc3a13ecf1ef',
|
||||||
|
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: '请输入接收站',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'b6775a5591a343ae98a6aab8f7ea43a4',
|
||||||
|
field: 'dateOut',
|
||||||
|
label: '出库日期',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入出库日期',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '918370e0dca4403e85270a20c9bc866e',
|
||||||
|
field: 'qtyGj',
|
||||||
|
label: '出库量 (吉焦)',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入出库量 (吉焦)',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'e35ba05e28004b649b15d1a03a077d3a',
|
||||||
|
field: 'qtyTon',
|
||||||
|
label: '出库量(吨)',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入出库量(吨)',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '87b5481c8c22422f84f7d5800b0158ba',
|
||||||
|
field: 'qtyM3',
|
||||||
|
label: '出库量(方)',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入出库量(方)',
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'cad682d905e24396b00ed2f1178d6ac3',
|
||||||
|
field: 'amount',
|
||||||
|
label: '出库金额',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入出库金额',
|
||||||
|
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: [],
|
||||||
|
};
|
||||||
@ -0,0 +1,122 @@
|
|||||||
|
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: '31d714b2242944c2b841b67eb3346877',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '出库类型',
|
||||||
|
fieldId: 'typeCode',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '4241e590fd0e4a40ac09928d19ccdd49',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '接收站',
|
||||||
|
fieldId: 'staCode',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '7adf7ffe4cc147cd9cc9dc3a13ecf1ef',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '出库日期',
|
||||||
|
fieldId: 'dateOut',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: 'b6775a5591a343ae98a6aab8f7ea43a4',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '出库量 (吉焦)',
|
||||||
|
fieldId: 'qtyGj',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '918370e0dca4403e85270a20c9bc866e',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '出库量(吨)',
|
||||||
|
fieldId: 'qtyTon',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: 'e35ba05e28004b649b15d1a03a077d3a',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '出库量(方)',
|
||||||
|
fieldId: 'qtyM3',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '87b5481c8c22422f84f7d5800b0158ba',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '出库金额',
|
||||||
|
fieldId: 'amount',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: 'cad682d905e24396b00ed2f1178d6ac3',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
327
src/views/inventory/LngInventoryOut/index.vue
Normal file
327
src/views/inventory/LngInventoryOut/index.vue
Normal file
@ -0,0 +1,327 @@
|
|||||||
|
<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>
|
||||||
|
<LngInventoryOutModal @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/lngInventoryOut/datalog');
|
||||||
|
import { DataLog } from '/@/components/pcitc';
|
||||||
|
import { ref, computed, onMounted, onUnmounted, createVNode,
|
||||||
|
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
|
import { Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||||
|
import { getLngInventoryOutPage, deleteLngInventoryOut} from '/@/api/inventory/LngInventoryOut';
|
||||||
|
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 { getLngInventoryOut } from '/@/api/inventory/LngInventoryOut';
|
||||||
|
import { useModal } from '/@/components/Modal';
|
||||||
|
import LngInventoryOutModal from './components/LngInventoryOutModal.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';
|
||||||
|
|
||||||
|
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":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true,"type":"primary"},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"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":"delete","icon":"ant-design:delete-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 = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,datalog : handleDatalog,delete : handleDelete,}
|
||||||
|
|
||||||
|
const { currentRoute } = useRouter();
|
||||||
|
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, }] = useTable({
|
||||||
|
title: '' || (formName + '列表'),
|
||||||
|
api: getLngInventoryOutPage,
|
||||||
|
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) => {
|
||||||
|
tableRef.value.setToolBarWidth();
|
||||||
|
|
||||||
|
},
|
||||||
|
useSearchForm: true,
|
||||||
|
showTableSetting: true,
|
||||||
|
|
||||||
|
striped: false,
|
||||||
|
actionColumn: {
|
||||||
|
width: 160,
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
slots: { customRender: 'action' },
|
||||||
|
},
|
||||||
|
tableSetting: {
|
||||||
|
size: false,
|
||||||
|
setting: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function dbClickRow(record) {
|
||||||
|
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||||
|
if (taskIds && taskIds.length) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
taskId: taskIds[0],
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (schemaId && !taskIds && processId) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
readonly: 1,
|
||||||
|
taskId: '',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/form/LngInventoryOut/' + record.id + '/viewForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'inventory/LngInventoryOut',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buttonClick(code) {
|
||||||
|
|
||||||
|
btnEvent[code]();
|
||||||
|
}
|
||||||
|
function handleDatalog (record: Recordable) {
|
||||||
|
modalVisible.value = true
|
||||||
|
logId.value = record.id
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
if (schemaIdComputedRef.value) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/form/LngInventoryOut/0/createForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'inventory/LngInventoryOut',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
|
||||||
|
router.push({
|
||||||
|
path: '/form/LngInventoryOut/' + record.id + '/updateForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'inventory/LngInventoryOut',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleDelete(record: Recordable) {
|
||||||
|
deleteList([record.id]);
|
||||||
|
}
|
||||||
|
function deleteList(ids) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示信息',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
content: '是否确认删除?',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk() {
|
||||||
|
deleteLngInventoryOut(ids).then((_) => {
|
||||||
|
handleSuccess();
|
||||||
|
notification.success({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('删除成功!'),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onCancel() {},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
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>
|
||||||
Reference in New Issue
Block a user