This commit is contained in:
2026-03-10 18:48:31 +08:00
31 changed files with 2957 additions and 257 deletions

View File

@ -0,0 +1,91 @@
import { LngContractPageModel, LngContractPageParams, LngContractPageResult } from './model/ContractPurLngModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
// Page = '/contract/contractPurLng/page',
Page = '/magic-api/contract/contractPurLng/page',
List = '/contract/contractPurLng/list',
Info = '/contract/contractPurLng/info',
LngContract = '/contract/contractPurLng',
DataLog = '/contract/contractPurLng/datalog',
}
/**
* @description: 查询LngContract分页列表
*/
export async function getLngContractPage(params: LngContractPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngContractPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取LngContract信息
*/
export async function getLngContract(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngContractPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增LngContract
*/
export async function addLngContract(lngContract: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.LngContract,
params: lngContract,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新LngContract
*/
export async function updateLngContract(lngContract: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.LngContract,
params: lngContract,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除LngContract批量删除
*/
export async function deleteLngContract(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.LngContract,
data: ids,
},
{
errorMessageMode: mode,
},
);
}

View File

@ -0,0 +1,50 @@
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: LngContract分页参数 模型
*/
export interface LngContractPageParams extends BasicPageParams {
id: string;
kNo: string;
kName: string;
cpName: string;
dateFrom: string;
dateTo: string;
comId: string;
approCode: string;
}
/**
* @description: LngContract分页返回值模型
*/
export interface LngContractPageModel {
id: string;
kNo: string;
kName: string;
cpName: string;
dateFrom: string;
dateTo: string;
comId: string;
approCode: string;
}
0;
/**
* @description: LngContract分页返回值结构
*/
export type LngContractPageResult = BasicFetchResult<LngContractPageModel>;

View File

@ -3,7 +3,8 @@ import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios'; import { ErrorMessageMode } from '/#/axios';
enum Api { enum Api {
Page = '/ship/meaPurInt/page', // Page = '/ship/meaPurInt/page',
Page = '/magic-api/ship/meaPurIntPageList',
List = '/ship/meaPurInt/list', List = '/ship/meaPurInt/list',
Info = '/ship/meaPurInt/info', Info = '/ship/meaPurInt/info',
LngMeaPurInt = '/ship/meaPurInt', LngMeaPurInt = '/ship/meaPurInt',

View File

@ -0,0 +1,136 @@
<template>
<div>
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
@visible-change="handleVisibleChange" >
<BasicTable @register="registerTable" class="OpsPurIntListModal" v-if="showTable"></BasicTable>
</BasicModal>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, unref, nextTick } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { getLngOpsPurIntPage} from '/@/api/ship/OpsPurInt';
const { t } = useI18n();
const codeFormSchema: FormSchema[] = [
{ field: 'ssNo', label: '船期编号', component: 'Input'},
{
field: 'dateFrom',
label: '卸港ETA',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
];
const columns: BasicColumn[] = [
{ title: t('船期编号'), dataIndex: 'ssNo', },
{ title: t('合同'), dataIndex: 'kName', },
{ title: t('交易主体'), dataIndex: 'comName', },
{ title: t('卸港ETA'), dataIndex: 'dateEta'},
{ title: t('接收站'), dataIndex: 'staName'},
{ title: t('供应商'), dataIndex: 'suName'},
];
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const isUpdate = ref(true);
const showTable = ref(false)
const rowId = ref('');
const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]);
const props = defineProps({
selectType: { type: String, default: 'radio' },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
showTable.value = true
setModalProps({ confirmLoading: false });
setPagination({'limit': 1,'size': 10,'page': 1});
isUpdate.value = !!data?.isUpdate;
});
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload,setPagination }] = useTable({
title: t('采购执行列表'),
api: getLngOpsPurIntPage,
columns,
bordered: true,
pagination: true,
canResize: false,
formConfig: {
labelCol:{span: 9, offSet:10},
schemas: codeFormSchema,
fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true,
},
immediate: false, // 设置为不立即调用
beforeFetch: (params) => {
return { ...params,page:params.limit};
},
rowSelection: {
type: props.selectType,
onChange: onSelectChange
},
});
const handleVisibleChange = async (visible: boolean) => {
if (visible) {
showTable.value = false
await nextTick();
await nextTick();
await nextTick();
nextTick(() => {
reload();
});
}
};
function onSelectChange(rowKeys: string[], e) {
selectedKeys.value = rowKeys;
selectedValues.value = e
}
const getTitle = computed(() => (!unref(isUpdate) ? t('采购执行列表') : t('')));
async function handleSubmit() {
if (!selectedValues.value.length) {
notification.warning({
message: t('提示'),
description: t('请选择采购执行')
});
return
}
closeModal();
emit('success', selectedValues.value);
}
</script>
<style >
.OpsPurIntListModal .basicCol{
position: inherit !important;
top: 0;
}
</style>
<style lang="less" scoped>
:deep( .ant-col-8:nth-child(2)) {
width: 360px !important;
max-width: 360px !important;;
}
:deep(.ant-col-8:nth-child(2) .ant-form-item-label) {
width: 80px !important;
}
</style>

View File

@ -109,7 +109,7 @@
selectedKeys.value = rowKeys; selectedKeys.value = rowKeys;
selectedValues.value = e selectedValues.value = e
} }
const getTitle = computed(() => (!unref(isUpdate) ? t(props.pageType == 'pur'?'管道气采购合同列表': '管道气销售合同列表') : t(''))); const getTitle = computed(() => (t(props.pageType == 'pur'?'管道气采购合同列表': '管道气销售合同列表')));
async function handleSubmit() { async function handleSubmit() {
if (!selectedValues.value.length) { if (!selectedValues.value.length) {

View File

@ -38,10 +38,10 @@
{ title: t('合同名称'), dataIndex: 'kName', width: 300}, { title: t('合同名称'), dataIndex: 'kName', width: 300},
{ title: t('关联类别'), dataIndex: 'relTypeName', width: 100}, { title: t('关联类别'), dataIndex: 'relTypeName', width: 100},
{ title: t('合同类别'), dataIndex: 'kTypeName1', width: 100}, { title: t('合同类别'), dataIndex: 'kTypeName1', width: 100},
{ title: t('合同主体'), dataIndex: 'comName', width: 250}, { title: t('合同主体'), dataIndex: 'comName', width: 120},
{ title: t('我方联系人'), dataIndex: 'empName', width: 140}, { title: t('我方联系人'), dataIndex: 'empName', width: 140},
{ title: t('联系电话'), dataIndex: 'tel', width: 140}, { title: t('联系电话'), dataIndex: 'tel', width: 140},
{ title: t('业务部门'), dataIndex: 'bDeptName', width: 140}, { title: t('业务部门'), dataIndex: 'bDeptName', width: 120},
{ title: t('附件'), dataIndex: 'file', width: 140}, { title: t('附件'), dataIndex: 'file', width: 140},
{ title: t('操作'), dataIndex: 'operation', width: 120, fixed: 'right',align: 'center'}, { title: t('操作'), dataIndex: 'operation', width: 120, fixed: 'right',align: 'center'},
]); ]);

View File

@ -7,7 +7,7 @@
</div> </div>
</template> </template>
<div v-for="(item, idx) in dataListPrice" class="tbStyle"> <div v-for="(item, idx) in dataListPrice" class="tbStyle">
<a-button type="primary" style="margin-bottom: 10px;" @click="handleDelete(idx)" v-if="!isDisable">删除</a-button> <DeleteOutlined style="margin-bottom: 10px;color:red" @click="handleDelete(idx)" v-if="!isDisable"/>
<a-row> <a-row>
<a-col :span="pageType=='pur'?8:16"> <a-col :span="pageType=='pur'?8:16">
<a-form-item name="kName"> <a-form-item name="kName">
@ -114,6 +114,7 @@
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import contractPurPngtListModal from '/@/components/common/contractPurPngtListModal.vue'; import contractPurPngtListModal from '/@/components/common/contractPurPngtListModal.vue';
import { DeleteOutlined} from '@ant-design/icons-vue';
const props = defineProps({ const props = defineProps({
isDisable: Boolean, isDisable: Boolean,
list: Array, list: Array,
@ -273,9 +274,10 @@
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.btnBox {
span { .tbStyle {
margin: 0 30px; border: 1px dashed #d9d9d9;
} padding: 10px;
margin-bottom: 10px;
} }
</style> </style>

View File

@ -49,7 +49,7 @@
const selectedKeys = ref<string[]>([]); const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]); const selectedValues = ref([]);
const props = defineProps({ const props = defineProps({
selectType: { type: String, default: 'checkbox' }, selectType: { type: String, default: 'radio' },
}); });
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
@ -93,7 +93,7 @@
selectedKeys.value = rowKeys; selectedKeys.value = rowKeys;
selectedValues.value = e selectedValues.value = e
} }
const getTitle = computed(() => (!unref(isUpdate) ? t('船期计划列表列表') : t(''))); const getTitle = computed(() => (!unref(isUpdate) ? t('船期计划列表') : t('')));
async function handleSubmit() { async function handleSubmit() {
if (!selectedValues.value.length) { if (!selectedValues.value.length) {

View File

@ -334,6 +334,14 @@ export const PAGE_CUSTOM_ROUTE: AppRouteRecordRaw[] = [{
title: (route) => route.query.formName title: (route) => route.query.formName
} }
}, },
{
path: '/ship/MeaPurInt/createForm',
name: 'MeaPurInt',
component: () => import('/@/views/ship/MeaPurInt/components/createForm.vue'),
meta: {
title: (route) => route.query.formName
}
},
] ]

View File

@ -566,7 +566,9 @@
}) })
}) })
dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo') dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo')
getContractFact() setTimeout(() => {
getContractFact()
});
} }
const getContractFact = async () => { const getContractFact = async () => {
let a = [] let a = []
@ -576,15 +578,33 @@
} }
}) })
if(a.length == 1) { if(a.length == 1) {
spinning.value = true
try {
const res = await getLngContractFact(a[0].kFactId) const res = await getLngContractFact(a[0].kFactId)
spinning.value = false
formState.kNo = formState.kNo ? formState.kNo : res?.kNo formState.kNo = formState.kNo ? formState.kNo : res?.kNo
formState.kName = formState.kName ? formState.kName : res?.kName formState.kName = formState.kName ? formState.kName : res?.kName
formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode
formState.curCode = formState.curCode ? formState.curCode : res?.curCode formState.curCode = formState.curCode ? formState.curCode : res?.curCode
formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null) formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null)
formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null) formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null)
formState.cpName = formState.cpName ? formState.cpName : (res?.lngContractFactCpList || [])[0]?.cpName let arr = res?.lngContractFactCpList || []
formState.cpCode = formState.cpCode ? formState.cpCode : (res?.lngContractFactCpList || [])[0]?.cpCode let arrSales = []
let arrSupplier = []
arr.forEach(v=> {
if (v.cpTableName == 'lng_customer') {
arrSales.push(v)
}
if (v.cpTableName == 'lng_supplier') {
arrSupplier.push(v)
}
})
formState.cpName = formState.cpName ? formState.cpName : arrSupplier[0]?.cpName
formState.cpCode = formState.cpCode ? formState.cpCode : arrSupplier[0]?.cpCode
} catch (error) {
spinning.value = false
}
} }
} }
const handleSuccessStation = (val) => { const handleSuccessStation = (val) => {

View File

@ -620,7 +620,9 @@
}) })
}) })
dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo') dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo')
getContractFact() setTimeout(() => {
getContractFact()
});
} }
const getContractFact = async () => { const getContractFact = async () => {
let a = [] let a = []
@ -630,15 +632,33 @@
} }
}) })
if(a.length == 1) { if(a.length == 1) {
spinning.value = true
try {
const res = await getLngContractFact(a[0].kFactId) const res = await getLngContractFact(a[0].kFactId)
spinning.value = false
formState.kNo = formState.kNo ? formState.kNo : res?.kNo formState.kNo = formState.kNo ? formState.kNo : res?.kNo
formState.kName = formState.kName ? formState.kName : res?.kName formState.kName = formState.kName ? formState.kName : res?.kName
formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode
formState.curCode = formState.curCode ? formState.curCode : res?.curCode formState.curCode = formState.curCode ? formState.curCode : res?.curCode
formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null) formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null)
formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null) formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null)
formState.cpName = formState.cpName ? formState.cpName : (res?.lngContractFactCpList || [])[0]?.cpName let arr = res?.lngContractFactCpList || []
formState.cpCode = formState.cpCode ? formState.cpCode : (res?.lngContractFactCpList || [])[0]?.cpCode let arrSales = []
let arrSupplier = []
arr.forEach(v=> {
if (v.cpTableName == 'lng_customer') {
arrSales.push(v)
}
if (v.cpTableName == 'lng_supplier') {
arrSupplier.push(v)
}
})
formState.cpName = formState.cpName ? formState.cpName : arrSupplier[0]?.cpName
formState.cpCode = formState.cpCode ? formState.cpCode : arrSupplier[0]?.cpCode
} catch (error) {
spinning.value = false
}
} }
} }
function unique(arr, u_key) { function unique(arr, u_key) {

View File

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

View File

@ -0,0 +1,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 { addLngContract, getLngContract, updateLngContract, deleteLngContract } from '/@/api/contract/ContractPurLng';
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 getLngContract(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 updateLngContract(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 addLngContract(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 deleteLngContract([id]);
}
defineExpose({
setFieldsValue,
resetFields,
validate,
add,
update,
setFormDataFromId,
setDisabledForm,
setMenuPermission,
setWorkFlowForm,
getRowKey,
getFormModel,
handleDelete
});
</script>

View File

@ -0,0 +1,486 @@
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: 'kName',
label: '合同号/名称',
component: 'Input',
},
{
field: 'cpName',
label: '供应商',
component: 'Input',
},
{
field: 'comId',
label: '合同主体',
component: 'Select',
componentProps: {
showSearch: true,
optionFilterProp: 'label',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
options: [
// { label: '全部', value: '' },
],
placeholder: '请选择',
allowClear: true,
getPopupContainer: () => document.body,
},
},
{
field: 'approCode',
label: '审批状态',
component: 'XjrSelect',
componentProps: {
datasourceType: 'dic',
params: { itemId: '1990669393069129729' },
labelField: 'name',
valueField: 'value',
getPopupContainer: () => document.body,
},
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'kNo',
title: '合同号',
componentType: 'input',
align: 'left',
width: 200,
sorter: true,
},
{
dataIndex: 'kName',
title: '合同名称',
componentType: 'input',
align: 'left',
width: 250,
sorter: true,
},
{
dataIndex: 'cpName',
title: '供应商',
componentType: 'input',
align: 'left',
width: 150,
sorter: true,
},
{
dataIndex: 'dateFrom',
title: '有效期开始',
componentType: 'input',
align: 'left',
width: 120,
sorter: true,
},
{
dataIndex: 'dateTo',
title: '有效期结束',
componentType: 'input',
align: 'left',
width: 120,
sorter: true,
},
{
dataIndex: 'comName',
title: '合同主体',
componentType: 'input',
align: 'left',
width: 120,
sorter: true,
},
{
dataIndex: 'approName',
title: '状态',
componentType: 'select',
align: 'left',
width: 80,
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: '50402ed57f3d4638980b14dc48745da8',
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',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '0690cd799b9a453f887c615e745ecec8',
field: 'kNo',
label: '合同号',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入合同号',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '5caa2a5cf9ae4c799e7059d1fe19a2c1',
field: 'kName',
label: '合同名称',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入合同名称',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '46253e7e8c6e48fdb1a5b790551e68ac',
field: 'cpName',
label: '供应商',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入供应商',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'be6d87b093f24ef087067bcc8ba8ff3d',
field: 'dateFrom',
label: '有效期开始',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入有效期开始',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '5cdc1bbb995b413f88ad1758157770e8',
field: 'dateTo',
label: '有效期结束',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入有效期结束',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'dc2c739a59c348c1b5017af73c86cc88',
field: 'comId',
label: '合同主体',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入合同主体',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '97ffb13559eb4726bc2cc8436ee5eac5',
field: 'approCode',
label: '审批状态',
type: 'select',
component: 'XjrSelect',
colProps: { span: 24 },
componentProps: {
width: '100%',
span: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请选择下拉选择审批状态',
sepTextField: '',
showLabel: true,
showSearch: false,
clearable: false,
disabled: true,
mode: '',
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' },
],
defaultSelect: 'WTJ',
datasourceType: 'dic',
params: { itemId: '1990669393069129729' },
labelField: 'name',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
},
dicOptions: [],
required: false,
rules: [],
events: {},
isShow: true,
itemId: '1990669393069129729',
style: { width: '100%' },
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};

View File

@ -0,0 +1,532 @@
<template>
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap formViewStyle">
<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="kNo">
<a-input v-model:value="formState.kNo" :disabled="isDisable" style="width: 65%" /><a-button v-if="!isDisable" type="primary" @click="onContract">关联合同</a-button>
</a-form-item>
</a-col>
<a-col :span="16">
<a-form-item label="合同名称" name="kName" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
<a-input v-model:value="formState.kName" placeholder="请输入合同名称" :disabled="isDisable"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同期限" name="kPeriod">
<a-select v-model:value="formState.kPeriod" :disabled="isDisable" placeholder="请选择合同期限" style="width: 100%" allow-clear @change="periodTypeCodeChange">
<a-select-option v-for="item in optionSelect.kPeriodList" :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="dateFrom">
<a-date-picker v-model:value="formState.dateFrom" style="width: 100%" @change="dateChange(formState.dateFrom, 'dateFrom')" :disabled="isDisable" :disabled-date="disabledDateStart" placeholder="请选择开始日期" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="有效期结束" name="dateTo">
<a-date-picker v-model:value="formState.dateTo" style="width: 100%" @change="dateChange(formState.dateTo, 'dateTo')" :disabled="isDisable" :disabled-date="disabledDateEnd" placeholder="请选择结束日期" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同签订日期" name="dateSign">
<a-date-picker v-model:value="formState.dateSign" style="width: 100%" :disabled="isDisable" placeholder="请选择合同签订日期" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="确认函开始日" name="dateCfmFrom">
<a-date-picker v-model:value="formState.dateCfmFrom" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateCfmStart" placeholder="请选择确认函开始日" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="确认函结束日" name="dateCfmTo">
<a-date-picker v-model:value="formState.dateCfmTo" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateCfmEnd" placeholder="请选择确认函结束日" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="供应商" name="cpName">
<a-input-search v-model:value="formState.cpName" :disabled="isDisable" placeholder="请选择供应商" readonly @search="onSearchSupplier"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="长协/现货/年度合同" name="longSpotCode">
<a-select v-model:value="formState.lngContractPurLngList[0].longSpotCode" :disabled="isDisable" placeholder="请选择" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.longSpotCodeList" :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="prcTypeCode">
<a-select v-model:value="formState.lngContractPurLngList[0].prcTypeCode" :disabled="isDisable" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.prcTypeCodeList" :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="empName">
<a-input-search v-model:value="formState.empName" :disabled="isDisable" placeholder="请选择业务联系人" readonly @search="onSearchUser"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="业务部门" name="bDeptName">
<a-input-search v-model:value="formState.bDeptName" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同主体" name="comName">
<a-input v-model:value="formState.comName" disabled />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="状态" name="approCode">
<a-select v-model:value="formState.approCode" disabled style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.approCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</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>
<Card title="关联合同信息" :bordered="false" >
<correlationContractFactList :list="dataListContractFact" :disabled="isDisable" @change="getApproContractFactList"></correlationContractFactList>
</Card>
<Card title="签报列表" :bordered="false" >
<correlationApproList :list="dataListAppro" :disabled="isDisable" @change="getApproList"></correlationApproList>
</Card>
</a-form>
</div>
<deptUserModal @register="register" @success="handleSuccess"/>
<contractFactListModal @register="registerContractFact" @success="handleSuccessContractFact" />
<supplierListModal @register="registerSupplier" @success="handleSuccessSupplier" selectType="radio" />
</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 { 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 { addLngContract,updateLngContract, getLngContract} from '/@/api/contract/ContractPurLng';
import { getLngContractFact } from '/@/api/contract/ContractFact';
import { getAllCurrency } from '/@/api/contract/ContractFact';
import { getLngAppro,getCompDept } from '/@/api/approve/Appro';
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 deptUserModal from '/@/components/common/deptUserModal.vue';
import correlationApproList from '/@/components/common/correlationApproList.vue';
import correlationContractFactList from '/@/components/common/correlationContractFactList.vue';
import contractFactListModal from '/@/components/common/contractFactListModal.vue';
import supplierListModal from '/@/components/common/supplierListModal.vue';
import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const tableName = 'ContractPurLng';
const columnName = 'ContractPurLng'
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 contractQty = ref()
const spinning = ref(false);
const curIdx = ref(null)
const { notification } = useMessage();
const { t } = useI18n();
const isExpend=ref(false)
const formState = reactive({
approCode: 'WTJ',
typeCode: 'PL',
onlineSign: 'N',
cpTableName: 'lng_supplie',
curCode: 'CNY',
lngContractPurLngList: [{uomCode: 'TON'}]
});
const [register, { openModal:openModal}] = useModal();
const [registerContractFact, { openModal:openModalContractFact}] = useModal();
const [registerSupplier, { openModal:openModalSupplier}] = useModal();
const rules= reactive({
kNo: [{ required: true, message: "该项为必填项", trigger: 'change' }],
kName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
cpName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
dateTo:[{ required: true, message: "该项为必填项", trigger: 'change' }],
dateFrom:[{ required: true, message: "该项为必填项", trigger: 'change' }],
});
const layout = {
labelCol: { span: 8 },
wrapperCol: { span: 16 },
}
const dataFile = ref([]);
const dataListAppro = ref([])
const dataListContractFact = ref([])
let optionSelect= reactive({
approCodeList: [],
kPeriodList: [],
longSpotCodeList: [],
prcTypeCodeList: []
});
watch(
() => props.id,
(val) => {
if (val) {
getInfo(val)
}
},
{
immediate: true
}
);
watch(
() => props.disabled,
(val) => {
isDisable.value = val
},
{
immediate: true
}
);
onMounted(() => {
getOption()
if (pageId.value) {
getInfo(pageId.value)
} else {
formState.empName = userInfo.name
formState.empId = userInfo.id
formState.tel = userInfo.mobile
}
});
const periodTypeCodeChange = (val) => {
if (val !== 'Y') {
formState.dateFrom = dayjs('2000-01-01')
formState.dateTo = dayjs('2999-12-31')
}
}
const uploadListChange = (val) => {
dataFile.value = val
}
async function getInfo(id) {
spinning.value = true
try {
let data = await getLngContract(id)
spinning.value = false
Object.assign(formState, {...data})
Object.assign(dataFile.value, formState.lngFileUploadList || [])
Object.assign(dataListContractFact.value, formState.lngContractFactList || [])
Object.assign(dataListAppro.value, formState.lngApproVoList || [])
formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null
formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null
formState.dateSign = formState.dateSign ? dayjs(formState.dateSign) : null
formState.dateCfmFrom = formState.dateCfmFrom ? dayjs(formState.dateCfmFrom) : null
formState.dateCfmTo = formState.dateCfmTo ? dayjs(formState.dateCfmTo) : null
formState.lngContractPurLngList = formState?.lngContractPurLngList || [{}]
dataListAppro.value.forEach(v => {
v.approId = v.id
})
dataListContractFact.value.forEach(v => {
v.kFactId = v.id
})
} catch (error) {
console.log(error, 'error')
spinning.value = false
}
}
async function getOption() {
optionSelect.kPeriodList = await getDictionary('LNG_K_PER')
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
optionSelect.longSpotCodeList = await getDictionary('LNG_LONG_D')
optionSelect.prcTypeCodeList = await getDictionary('LNG_PRC')
if (!pageId.value) {
getCompDeptInfo(userInfo.id)
}
}
const getCompDeptInfo = async (id, deptId)=> {
const res = await getCompDept(id, deptId)
formState.bDeptName = res?.dept?.name
formState.bDeptId = res?.dept?.id
if (!pageId.value) {
formState.comName = res?.comp?.name
formState.comId = res?.comp?.id
}
}
const getApproList = (val) => {
dataListAppro.value = val
}
const getApproContractFactList = (val) => {
dataListContractFact.value = val
}
const dateChange = (val, k) => {
if (!val) {
if (k=='dateFrom') {
formState.dateFrom = dayjs(new Date())
setTimeout(() => {
formState.dateFrom = null
}, );
}
if (k=='dateTo') {
formState.dateTo = dayjs(new Date())
setTimeout(() => {
formState.dateTo = null
}, );
}
}
}
const disabledDateStart = (startValue) => {
const endValue = formState?.dateTo;
if (!startValue || !endValue) {
return false
}
return startValue.valueOf() >= endValue.valueOf();
}
const disabledDateEnd = (endValue) => {
const startValue = formState?.dateFrom;
if (!endValue || !startValue) {
return false
}
return endValue.valueOf() <= startValue.valueOf();
}
const disabledDateCfmStart = (startValue) => {
const endValue = formState?.dateCfmTo;
if (!startValue || !endValue) {
return false
}
return startValue.valueOf() >= endValue.valueOf();
}
const disabledDateCfmEnd = (endValue) => {
const startValue = formState?.dateCfmFrom;
if (!endValue || !startValue) {
return false
}
return endValue.valueOf() <= startValue.valueOf();
}
const onSearchSupplier = () => {
openModalSupplier(true,{isUpdate: false})
}
const onSearchUser = (val)=> {
openModal(true,{isUpdate: false})
}
const onContract = (val)=> {
openModalContractFact(true,{isUpdate: false})
}
const handleSuccess = (val, deptId) => {
formState.empName = val[0].name
formState.empId = val[0].id
formState.tel = val[0].mobile
getCompDeptInfo(formState.empId, deptId)
}
const handleSuccessSupplier = (val) => {
formState.cpCode = val[0].suCode
formState.cpName = val[0].suName
}
const handleSuccessContractFact = (val) => {
val.forEach(v => {
v.kFactId = v.id
v.id = null
})
if (!dataListContractFact.value.length) {
dataListContractFact.value = val
getContractFact()
return
}
let arr = []
val.forEach(v => {
dataListContractFact.value.forEach(i => {
if (v.kNo == i.kNo){
message.warning(v.kNo + '已重复, 合同不需要重复选择')
} else {
arr.push(v)
}
})
})
dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo')
setTimeout(() => {
getContractFact()
});
}
const getContractFact = async () => {
let a = []
dataListContractFact.value.forEach(v=>{
if (v.relTypeCode == 'M') {
a.push(v)
}
})
if(a.length == 1) {
spinning.value = true
try {
const res = await getLngContractFact(a[0].kFactId)
spinning.value = false
formState.kNo = formState.kNo ? formState.kNo : res?.kNo
formState.kName = formState.kName ? formState.kName : res?.kName
formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode
formState.curCode = formState.curCode ? formState.curCode : res?.curCode
formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null)
formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null)
let arr = res?.lngContractFactCpList || []
let arrSales = []
let arrSupplier = []
arr.forEach(v=> {
if (v.cpTableName == 'lng_customer') {
arrSales.push(v)
}
if (v.cpTableName == 'lng_supplier') {
arrSupplier.push(v)
}
})
formState.cpName = formState.cpName ? formState.cpName : arrSupplier[0]?.cpName
formState.cpCode = formState.cpCode ? formState.cpCode : arrSupplier[0]?.cpCode
} catch (error) {
spinning.value = false
}
}
}
function unique(arr, u_key) {
const map = new Map()
arr.forEach((item, index) => {
if (!map.has(item[u_key])) {
map.set(item[u_key], item)
}
})
return [...map.values()]
}
function close() {
tabStore.closeTab(currentRoute.value, router);
}
async function getFormValue() {
return formState
}
async function handleSubmit(type) {
try {
await formRef.value.validateFields();
dataListAppro.value.forEach((v,idx)=>{
v.tableName = 'Ing_contract'
v.sort = idx
})
dataListContractFact.value.forEach((v,idx)=> {
v.sort = idx
})
let obj = {
...formState,
lngFileUploadList: dataFile.value,
lngContractFactRelList: dataListContractFact.value,
lngContractApproRelList: dataListAppro.value,
lngContractPurLngList: [
{
...formState.lngContractPurLngList[0],
"kId": formState.id,
}
],
salesAreaCode: '',
approCode: pageType.value=='update' ? 'WTJ' : formState.approCode
}
spinning.value = true;
let request = !formState.id ? addLngContract :updateLngContract
try {
const data = await request(obj);
// 新增保存
if (data?.id) {
getInfo(data?.id)
}
// 同意保存不提示
if (!type) {
notification.success({
message: '提示',
description: data?.id ? t('新增成功!') : t('修改成功!')
}); //提示消息
}
return data?.id ? data : obj
} finally {
spinning.value = false;
}
} catch (errorInfo) {
console.log(errorInfo, '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;
}
.tip {
text-align: center;
margin-bottom: 15px;
color: #5e95ff;
cursor: pointer;
}
.inputCSS {
display: flex;
align-items: center;
}
</style>

View File

@ -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: '50402ed57f3d4638980b14dc48745da8',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '合同号',
fieldId: 'kNo',
isSubTable: false,
showChildren: true,
type: 'input',
key: '0690cd799b9a453f887c615e745ecec8',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '合同名称',
fieldId: 'kName',
isSubTable: false,
showChildren: true,
type: 'input',
key: '5caa2a5cf9ae4c799e7059d1fe19a2c1',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '供应商',
fieldId: 'cpName',
isSubTable: false,
showChildren: true,
type: 'input',
key: '46253e7e8c6e48fdb1a5b790551e68ac',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '有效期开始',
fieldId: 'dateFrom',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'be6d87b093f24ef087067bcc8ba8ff3d',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '有效期结束',
fieldId: 'dateTo',
isSubTable: false,
showChildren: true,
type: 'input',
key: '5cdc1bbb995b413f88ad1758157770e8',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '合同主体',
fieldId: 'comId',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'dc2c739a59c348c1b5017af73c86cc88',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '审批状态',
fieldId: 'approCode',
isSubTable: false,
showChildren: true,
type: 'select',
key: '97ffb13559eb4726bc2cc8436ee5eac5',
children: [],
},
];

View File

@ -0,0 +1,530 @@
<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>
<ContractPurLngModal @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('/contract/contractPurLng/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 { getLngContractPage, deleteLngContract} from '/@/api/contract/ContractPurLng';
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 { getLngContract } from '/@/api/contract/ContractPurLng';
import { useModal,BasicModal } from '/@/components/Modal';
import LookProcess from '/@/views/workflow/task/components/LookProcess.vue';
import LaunchProcess from '/@/views/workflow/task/components/LaunchProcess.vue';
import ApprovalProcess from '/@/views/workflow/task/components/ApprovalProcess.vue';
import { getDraftInfo } from '/@/api/workflow/process';
import { isValidJSON } from '/@/utils/event/design';
import ContractPurLngModal from './components/ContractPurLngModal.vue';
import {formConfig, searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
import FlowRecord from '/@/views/workflow/task/components/flow/FlowRecord.vue';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
import { getAllCom} from '/@/api/contract/ContractPurInt';
import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
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([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"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":"startwork","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"查看流转记录","code":"flowRecord","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"变更","code":"update","icon":"ant-design:edit-filled","isDefault":true},{"isUse":true,"name":"审批","code":"approve","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData','update','approve', '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,startwork : handleStartwork,flowRecord : handleFlowRecord,update : handleUpdate,approve : handleApprove,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 visibleLookProcessRef = ref(false);
const processIdRef = ref('');
const visibleLaunchProcessRef = ref(false);
const schemaIdRef = ref('');
const formDataRef = ref();
const rowKeyData = ref();
const draftsId = ref();
const visibleApproveProcessRef = ref(false);
const taskIdRef = ref('');
const visibleFlowRecordModal = ref(false);
const [registerModal, { openModal }] = useModal();
const formName='国内LNG采购合同';
const [registerTable, { reload, }] = useTable({
title: '' || (formName + '列表'),
api: getLngContractPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [],
showResetButton: false,
},
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,
id: record.id,
readonly: 1,
}
});
} else if (schemaId && !taskIds && processId) {
router.push({
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
query: {
readonly: 1,
taskId: '',
formName: formName,
formId:currentRoute.value.meta.formId,
id: record.id,
}
});
} else {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'contract/ContractPurLng',
formName: "查看"+formName,
formId:currentRoute.value.meta.formId,
type:'view',
id: record.id,
disabled: 1,
}
});
}
// router.push({
// path: '/form/ContractPurLng/' + record.id + '/viewForm',
// query: {
// formPath: 'contract/ContractPurLng',
// 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',
query: {
formPath: 'contract/ContractPurLng',
formName: "新建"+formName,
}
});
} else {
router.push({
path: '/form/ContractPurLng/0/createForm',
query: {
formPath: 'contract/ContractPurLng',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleEdit(record: Recordable) {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'contract/ContractPurLng',
formName: "编辑"+formName,
formId:currentRoute.value.meta.formId,
type:'edit',
id: record.id
}
});
} else {
router.push({
path: '/form/ContractPurLng/' + record.id + '/updateForm',
query: {
formPath: 'contract/ContractPurLng',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleUpdate(record: Recordable) {
const { processId, taskIds, schemaId } = record.workflowData || {};
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'contract/ContractPurLng',
formName: "变更"+formName,
formId:currentRoute.value.meta.formId,
type:'update',
id: record.id,
processId: processId
}
});
}
}
function handleApprove(record: Recordable) {
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,
id: record.id
}
});
}
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认删除?',
okText: '确认',
cancelText: '取消',
onOk() {
deleteLngContract(ids).then((_) => {
handleSuccess();
notification.success({
message: '提示',
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[] {
let actionsList: ActionItem[] = [];
let editAndDelBtn: ActionItem[] = [];
let updateBtn: ActionItem[] = [];
let approveBtn: ActionItem[] = [];
let hasFlowRecord = false;
actionButtonConfig.value?.map((button) => {
if (['view', 'copyData','datalog'].includes(button.code)) {
actionsList.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['edit', 'delete'].includes(button.code)) {
editAndDelBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['update'].includes(button.code)) {
updateBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['approve'].includes(button.code)) {
approveBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (button.code === 'flowRecord') hasFlowRecord = true;
});
// 未提交或已驳回
if (record.approCode == 'WTJ' || record.approCode == 'YBH' ) {
actionsList = actionsList.concat(editAndDelBtn);
if (record.createUserId !== userInfo.id) {
let idx = actionsList.findIndex(v =>v.tooltip == '删除')
idx > -1 && actionsList.splice(idx, 1)
}
}
// 审批中SPZ
if (record.workflowData?.editable) {
actionsList = actionsList.concat(approveBtn);
}
// 已审批
if (record.approCode == 'YSP') {
actionsList = actionsList.concat(updateBtn);
}
// if (record.workflowData?.enabled) {
// //与工作流有关联的表单
// if (record.workflowData.status) {
// actionsList.unshift(setIndexFlowStatus(record.workflowData))
// } else {
// actionsList = actionsList.concat(editAndDelBtn);
// }
// } else {
// if (!record.workflowData?.processId) {
// //与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
// actionsList = actionsList.concat(editAndDelBtn);
// }
// }
return actionsList;
}
function handleStartwork(record: Recordable) {
const { processId, schemaId } = record.workflowData;
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
readonly: 1,
taskId: '',
formName: formName
}
});
}
function handleFlowRecord(record: Recordable) {
if (record.workflowData) {
visibleFlowRecordModal.value = true;
processIdRef.value = record.workflowData?.processId;
}
}
async function handleLaunchProcess(record: Recordable) {
const schemaId=record.workflowData?.schemaId||schemaIdComputedRef.value;
if(schemaId){
if(record.workflowData?.draftId){
let res = await getDraftInfo(record.workflowData.draftId);
if (isValidJSON(res.formData)) {
localStorage.setItem('draftsJsonStr', res.formData);
router.push({
path: '/flow/' + schemaId + '/'+record.workflowData.draftId+'/createFlow'
});
return;
}
}
const result = await getLngContract(record['id']);
const form={};
const key="form_"+schemaId+"_"+record['id'];
form[key]=result;
localStorage.setItem('formJsonStr', JSON.stringify(form));
router.push({
path: '/flow/' + schemaId + '/0/createFlow',
query: {
fromKey: key
}
});
}
}
function handleApproveProcess(record: Recordable) {
const { processId, taskIds, schemaId } = record.workflowData;
router.push({
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
query: {
taskId: taskIds[0],
formName: formName
}
});
}
function handleCloseLaunch() {
visibleLaunchProcessRef.value = false;
reload();
}
function handleCloseApproval() {
visibleApproveProcessRef.value = false;
reload();
}
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;
}
:deep( .ant-col-8:nth-child(4)) {
width: 320px !important;
max-width: 320px !important;;
}
:deep(.ant-col-8:nth-child(4) .ant-form-item-label) {
width: 80px !important;
}
:deep(.ant-col-8:nth-child(5) .ant-select-selector) {
width: 172px !important;
}
</style>

View File

@ -515,7 +515,9 @@
}) })
}) })
dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo') dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo')
getContractFact() setTimeout(() => {
getContractFact()
});
} }
const getContractFact = async () => { const getContractFact = async () => {
let a = [] let a = []
@ -525,14 +527,32 @@
} }
}) })
if(a.length == 1) { if(a.length == 1) {
spinning.value = true
try {
const res = await getLngContractFact(a[0].id || a[0].idNew) const res = await getLngContractFact(a[0].id || a[0].idNew)
spinning.value = false
formState.kNo = formState.kNo ? formState.kNo : res?.kNo formState.kNo = formState.kNo ? formState.kNo : res?.kNo
formState.kName = formState.kName ? formState.kName : res?.kName formState.kName = formState.kName ? formState.kName : res?.kName
formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode
formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null) formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null)
formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null) formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null)
formState.cpName = formState.cpName ? formState.cpName : (res?.lngContractFactCpList || [])[0]?.cpName let arr = res?.lngContractFactCpList || []
formState.cpCode = formState.cpCode ? formState.cpCode : (res?.lngContractFactCpList || [])[0]?.cpCode let arrSales = []
let arrSupplier = []
arr.forEach(v=> {
if (v.cpTableName == 'lng_customer') {
arrSales.push(v)
}
if (v.cpTableName == 'lng_supplier') {
arrSupplier.push(v)
}
})
formState.cpName = formState.cpName ? formState.cpName : arrSupplier[0]?.cpName
formState.cpCode = formState.cpCode ? formState.cpCode : arrSupplier[0]?.cpCode
} catch (error) {
spinning.value = false
}
} }
} }
const cancel = () => { const cancel = () => {

View File

@ -545,7 +545,9 @@
}) })
}) })
dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo') dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo')
getContractFact() setTimeout(() => {
getContractFact()
});
} }
const getContractFact = async () => { const getContractFact = async () => {
@ -556,14 +558,32 @@
} }
}) })
if(a.length == 1) { if(a.length == 1) {
spinning.value = true
try {
const res = await getLngContractFact(a[0].kFactId) const res = await getLngContractFact(a[0].kFactId)
spinning.value = false
formState.kNo = formState.kNo ? formState.kNo : res?.kNo formState.kNo = formState.kNo ? formState.kNo : res?.kNo
formState.kName = formState.kName ? formState.kName : res?.kName formState.kName = formState.kName ? formState.kName : res?.kName
formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode
formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null) formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null)
formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null) formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null)
formState.cpName = formState.cpName ? formState.cpName : (res?.lngContractFactCpList || [])[0]?.cpName let arr = res?.lngContractFactCpList || []
formState.cpCode = formState.cpCode ? formState.cpCode : (res?.lngContractFactCpList || [])[0]?.cpCode let arrSales = []
let arrSupplier = []
arr.forEach(v=> {
if (v.cpTableName == 'lng_customer') {
arrSales.push(v)
}
if (v.cpTableName == 'lng_supplier') {
arrSupplier.push(v)
}
})
formState.cpName = formState.cpName ? formState.cpName : arrSales[0]?.cpName
formState.cpCode = formState.cpCode ? formState.cpCode : arrSales[0]?.cpCode
} catch (error) {
spinning.value = false
}
} }
} }
const handleSuccessDownLoad = async (val, type) => { const handleSuccessDownLoad = async (val, type) => {

View File

@ -622,7 +622,9 @@
}) })
}) })
dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo') dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo')
getContractFact() setTimeout(() => {
getContractFact()
});
} }
const getContractFact = async () => { const getContractFact = async () => {
let a = [] let a = []
@ -632,15 +634,33 @@
} }
}) })
if(a.length == 1) { if(a.length == 1) {
spinning.value = true
try {
const res = await getLngContractFact(a[0].kFactId) const res = await getLngContractFact(a[0].kFactId)
spinning.value = false
formState.kNo = formState.kNo ? formState.kNo : res?.kNo formState.kNo = formState.kNo ? formState.kNo : res?.kNo
formState.kName = formState.kName ? formState.kName : res?.kName formState.kName = formState.kName ? formState.kName : res?.kName
formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode
formState.curCode = formState.curCode ? formState.curCode : res?.curCode formState.curCode = formState.curCode ? formState.curCode : res?.curCode
formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null) formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null)
formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null) formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null)
formState.cpName = formState.cpName ? formState.cpName : (res?.lngContractFactCpList || [])[0]?.cpName let arr = res?.lngContractFactCpList || []
formState.cpCode = formState.cpCode ? formState.cpCode : (res?.lngContractFactCpList || [])[0]?.cpCode let arrSales = []
let arrSupplier = []
arr.forEach(v=> {
if (v.cpTableName == 'lng_customer') {
arrSales.push(v)
}
if (v.cpTableName == 'lng_supplier') {
arrSupplier.push(v)
}
})
formState.cpName = formState.cpName ? formState.cpName : arrSales[0]?.cpName
formState.cpCode = formState.cpCode ? formState.cpCode : arrSales[0]?.cpCode
} catch (error) {
spinning.value = false
}
} }
} }
function unique(arr, u_key) { function unique(arr, u_key) {

View File

@ -471,7 +471,9 @@
}) })
}) })
dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo') dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo')
getContractFact() setTimeout(() => {
getContractFact()
});
} }
const getContractFact = async () => { const getContractFact = async () => {
let a = [] let a = []
@ -481,14 +483,32 @@
} }
}) })
if(a.length == 1) { if(a.length == 1) {
spinning.value = true
try {
const res = await getLngContractFact(a[0].id || a[0].idNew) const res = await getLngContractFact(a[0].id || a[0].idNew)
spinning.value = false
formState.kNo = formState.kNo ? formState.kNo : res?.kNo formState.kNo = formState.kNo ? formState.kNo : res?.kNo
formState.kName = formState.kName ? formState.kName : res?.kName formState.kName = formState.kName ? formState.kName : res?.kName
formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode
formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null) formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null)
formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null) formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null)
formState.cpName = formState.cpName ? formState.cpName : (res?.lngContractFactCpList || [])[0]?.cpName let arr = res?.lngContractFactCpList || []
formState.cpCode = formState.cpCode ? formState.cpCode : (res?.lngContractFactCpList || [])[0]?.cpCode let arrSales = []
let arrSupplier = []
arr.forEach(v=> {
if (v.cpTableName == 'lng_customer') {
arrSales.push(v)
}
if (v.cpTableName == 'lng_supplier') {
arrSupplier.push(v)
}
})
formState.cpName = formState.cpName ? formState.cpName : arrSales[0]?.cpName
formState.cpCode = formState.cpCode ? formState.cpCode : arrSales[0]?.cpCode
} catch (error) {
spinning.value = false
}
} }
} }
function unique(arr, u_key) { function unique(arr, u_key) {

View File

@ -584,9 +584,11 @@
}) })
}) })
dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo') dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo')
getContractFact() setTimeout(() => {
getContractFact()
});
} }
const getContractFact = async () => { const getContractFact = async () => {
let a = [] let a = []
dataListContractFact.value.forEach(v=>{ dataListContractFact.value.forEach(v=>{
if (v.relTypeCode == 'M') { if (v.relTypeCode == 'M') {
@ -594,15 +596,33 @@
} }
}) })
if(a.length == 1) { if(a.length == 1) {
spinning.value = true
try {
const res = await getLngContractFact(a[0].kFactId) const res = await getLngContractFact(a[0].kFactId)
spinning.value = false
formState.kNo = formState.kNo ? formState.kNo : res?.kNo formState.kNo = formState.kNo ? formState.kNo : res?.kNo
formState.kName = formState.kName ? formState.kName : res?.kName formState.kName = formState.kName ? formState.kName : res?.kName
formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode formState.kPeriod = formState.kPeriod ? formState.kPeriod : res?.periodTypeCode
formState.curCode = formState.curCode ? formState.curCode : res?.curCode formState.curCode = formState.curCode ? formState.curCode : res?.curCode
formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null) formState.dateFrom = formState.dateFrom ? formState.dateFrom : (res?.dateFrom ? dayjs(res?.dateFrom) : null)
formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null) formState.dateTo = formState.dateTo ? formState.dateTo : (res?.dateTo ? dayjs(res?.dateTo) : null)
formState.cpName = formState.cpName ? formState.cpName : (res?.lngContractFactCpList || [])[0]?.cpName let arr = res?.lngContractFactCpList || []
formState.cpCode = formState.cpCode ? formState.cpCode : (res?.lngContractFactCpList || [])[0]?.cpCode let arrSales = []
let arrSupplier = []
arr.forEach(v=> {
if (v.cpTableName == 'lng_customer') {
arrSales.push(v)
}
if (v.cpTableName == 'lng_supplier') {
arrSupplier.push(v)
}
})
formState.cpName = formState.cpName ? formState.cpName : arrSupplier[0]?.cpName
formState.cpCode = formState.cpCode ? formState.cpCode : arrSupplier[0]?.cpCode
} catch (error) {
spinning.value = false
}
} }
} }
const handleSuccessDownLoad = (val, type) => { const handleSuccessDownLoad = (val, type) => {

View File

@ -7,17 +7,17 @@ export const formConfig = {
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{ // {
field: 'dateFrom', // field: 'dateFrom',
label: '申请日期', // label: '申请日期',
component: 'RangePicker', // component: 'RangePicker',
componentProps: { // componentProps: {
format: 'YYYY-MM-DD', // format: 'YYYY-MM-DD',
style: { width: '100%' }, // style: { width: '100%' },
allowClear: true, // allowClear: true,
getPopupContainer: () => document.body, // getPopupContainer: () => document.body,
}, // },
}, // },
{ {
field: 'priceDesc', field: 'priceDesc',
label: '申请说明', label: '申请说明',

View File

@ -6,17 +6,17 @@ export const formConfig = {
}; };
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{ // {
field: 'dateFrom', // field: 'dateFrom',
label: '申请日期', // label: '申请日期',
component: 'RangePicker', // component: 'RangePicker',
componentProps: { // componentProps: {
format: 'YYYY-MM-DD', // format: 'YYYY-MM-DD',
style: { width: '100%' }, // style: { width: '100%' },
allowClear: true, // allowClear: true,
getPopupContainer: () => document.body, // getPopupContainer: () => document.body,
}, // },
}, // },
{ {
field: 'priceDesc', field: 'priceDesc',
label: '申请说明', label: '申请说明',

View File

@ -16,6 +16,7 @@ export const customFormConfig = {
'ContractTransPng', 'ContractTransPng',
'ContractProc', 'ContractProc',
'PricePurPngApp', 'PricePurPngApp',
'PriceSalesPngApp' 'PriceSalesPngApp',
'ContractPurLng'
], ],
}; };

View File

@ -10,108 +10,65 @@ export const searchFormSchema: FormSchema[] = [
field: 'dateMea', field: 'dateMea',
label: '计量时间', label: '计量时间',
component: 'Input', component: 'Input',
}, }
{
field: 'typeCode',
label: '计量类型',
component: 'Input',
},
{
field: 'inspName',
label: '商检公司',
component: 'Input',
},
{
field: 'id',
label: 'id',
component: 'Input',
},
{
field: 'qtyMmbtu',
label: '热值MMBtu',
component: 'Input',
},
{
field: 'qtyGj',
label: '热值GJ',
component: 'Input',
},
{
field: 'qtyTon',
label: '重量(吨)',
component: 'Input',
},
{
field: 'qtyM3L',
label: '液态体积(方)',
component: 'Input',
},
{
field: 'qtyM3',
label: '气态体积(方)',
component: 'Input',
},
{
field: 'rateTonM3L',
label: '密度(吨/液态方)',
component: 'Input',
},
{
field: 'rateTonGj',
label: '热值比(吨/GJ)',
component: 'Input',
},
{
field: 'rateM3Gj',
label: '热值比(气态方/GJ)',
component: 'Input',
},
{
field: 'rateTonM3',
label: '气化率(吨/气态方)',
component: 'Input',
},
{
field: 'note',
label: '备注',
component: 'Input',
},
]; ];
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
dataIndex: 'id', dataIndex: 'ssNo',
title: 'id', title: '船期计划编号',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 120,
sorter: true, sorter: true,
}, },
{
dataIndex: 'kName',
title: '合同',
componentType: 'input',
align: 'left',
width: 150,
sorter: true,
},
{
dataIndex: 'suName',
title: '供应商',
componentType: 'input',
align: 'left',
width: 150,
sorter: true,
},
{
dataIndex: 'staName',
title: '接收站',
componentType: 'input',
align: 'left',
width: 120,
sorter: true,
},
{
dataIndex: 'typeName',
title: '计量类型',
componentType: 'input',
align: 'left',
width: 100,
sorter: true,
},
{ {
dataIndex: 'dateMea', dataIndex: 'dateMea',
title: '计量时间', title: '计量时间',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 120,
sorter: true, sorter: true,
}, },
{
dataIndex: 'typeCode',
title: '计量类型',
componentType: 'input',
align: 'left',
sorter: true,
},
{ {
dataIndex: 'qtyMmbtu', dataIndex: 'qtyMmbtu',
title: '热值MMBtu', title: '热值MMBtu',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 120,
sorter: true, sorter: true,
}, },
@ -120,7 +77,7 @@ export const columns: BasicColumn[] = [
title: '热值GJ', title: '热值GJ',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 120,
sorter: true, sorter: true,
}, },
@ -129,34 +86,7 @@ export const columns: BasicColumn[] = [
title: '重量(吨)', title: '重量(吨)',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 120,
sorter: true,
},
{
dataIndex: 'qtyM3L',
title: '液态体积(方)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyM3',
title: '气态体积(方)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'rateTonM3L',
title: '密度(吨/液态方)',
componentType: 'input',
align: 'left',
sorter: true, sorter: true,
}, },
@ -165,45 +95,20 @@ export const columns: BasicColumn[] = [
title: '热值比(吨/GJ)', title: '热值比(吨/GJ)',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 120,
sorter: true, sorter: true,
}, },
{ {
dataIndex: 'rateM3Gj', dataIndex: 'rateM3Gj',
title: '热值比(气态方/GJ)', title: '热值比(方/GJ)',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
sorter: true, sorter: true,
width: 120,
}, },
{
dataIndex: 'rateTonM3',
title: '气化率(吨/气态方)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'inspName',
title: '商检公司',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'note',
title: '备注',
componentType: 'input',
align: 'left',
sorter: true,
},
]; ];
//表单事件 //表单事件
export const formEventConfigs = { export const formEventConfigs = {

View File

@ -0,0 +1,353 @@
<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="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="comName">
<a-input v-model:value="formState.comName" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同" name="kName">
<a-input v-model:value="formState.kName" disabled />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="供应商" name="suName">
<a-input v-model:value="formState.suName" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="接收站" name="staName">
<a-input-search v-model:value="formState.staName" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="卸港ETA" name="dateEta">
<a-date-picker v-model:value="formState.dateEta" style="width: 100%" disabled />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="计量类型" name="typeCode">
<a-select v-model:value="formState.typeCode" :disabled="isDisable" 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="dateMea">
<a-date-picker v-model:value="formState.dateMea" style="width: 100%" placeholder="请选择" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="商检公司" name="inspName">
<a-input v-model:value="formState.inspName" style="width: 100%" :disabled="isDisable" placeholder="请输入" />
</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%" placeholder="请输入"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="热值(GJ)" name="qtyGj">
<input-number v-model:value="formState.qtyGj" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" placeholder="请输入"/>
</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%" placeholder="请输入"/>
</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%" placeholder="请输入"/>
</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%" placeholder="请输入"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="密度(吨/方)" name="rateTonM3L">
<input-number v-model:value="formState.rateTonM3L" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" placeholder="请输入"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="热值比(吨/GJ)" name="rateTonGj">
<input-number v-model:value="formState.rateTonGj" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" placeholder="请输入"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="热值比(方/GJ)" name="rateM3Gj">
<input-number v-model:value="formState.rateM3Gj" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" placeholder="请输入"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="气化率(吨/方)" name="rateTonM3">
<input-number v-model:value="formState.rateTonM3" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" placeholder="请输入"/>
</a-form-item>
</a-col>
<a-col :span="22">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.note" :disabled="isDisable" placeholder="请输入备注最多200字" :maxlength="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>
<OpsPurIntListModal @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 { addLngMeaPurInt,updateLngMeaPurInt, getLngMeaPurInt} from '/@/api/ship/MeaPurInt';
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 OpsPurIntListModal from '/@/components/common/OpsPurIntListModal.vue';
import { useUserStore } from '/@/store/modules/user';
import { getLngOpsPurInt} from '/@/api/ship/OpsPurInt';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const tableName = 'MeaPurInt';
const columnName = 'MeaPurInt'
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 spinning = ref(false);
const { notification } = useMessage();
const { t } = useI18n()
const formState = reactive({
approCode: 'WTJ'
});
const [registerShip, { openModal:openModalShip}] = useModal();
const rules= reactive({
ssNo: [{ required: true, message: "该项为必填项", trigger: 'change' }],
typeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
dateMea: [{ required: true, message: "该项为必填项", trigger: 'change' }],
qtyMmbtu: [{ required: true, message: "该项为必填项", trigger: 'change' }],
qtyGj: [{ required: true, message: "该项为必填项", trigger: 'change' }],
qtyTon: [{ required: true, message: "该项为必填项", trigger: 'change' }],
});
const layout = {
labelCol: { span: 8 },
wrapperCol: { span: 16 },
}
const dataFile = ref([]);
let optionSelect= reactive({
typeCodeList: [],
comIdList: [],
});
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) {
getInfo(pageId.value)
}
});
const uploadListChange = (val) => {
dataFile.value = val
}
async function getInfo(id) {
spinning.value = true
try {
let data = await getLngMeaPurInt(id)
spinning.value = false
Object.assign(formState, {...data})
Object.assign(dataFile.value, formState.lngFileUploadList || [])
formState.dateEta = formState.dateEta ? dayjs(formState.dateEta) : null
formState.dateMea = formState.dateMea ? dayjs(formState.dateMea) : null
} catch (error) {
spinning.value = false
}
}
async function getOption() {
optionSelect.typeCodeList = await getDictionary('LNG_MEA_I')
}
const onSearchShip = () => {
openModalShip(true,{isUpdate: false})
}
const handleSuccessShip = (val) => {
formState.ssNo = val[0].ssNo
formState.opsId = val[0].id
getLngShipInfo(val[0].id)
}
const getLngShipInfo = async (id) => {
try {
spinning.value = true
let data = await getLngOpsPurInt(id)
spinning.value = false
formState.comId = data.comId
formState.comName = data.comName
formState.kId = data.kId
formState.kName = data.kName
formState.suCode = data.suCode
formState.suName = data.suName
formState.staCode = data.staCode
formState.staName = data.staName
formState.dateMea = data.dateEta ? dayjs(data.dateEta) : null
formState.dateEta = data.dateEta ? dayjs(data.dateEta) : null
formState.inspName = data.inspName
} catch (error) {
spinning.value = false
}
}
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 ? addLngMeaPurInt :updateLngMeaPurInt
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>

View File

@ -29,7 +29,7 @@
const logId = ref('') const logId = ref('')
const logPath = ref('/ship/meaPurInt/datalog'); const logPath = ref('/ship/meaPurInt/datalog');
import { DataLog } from '/@/components/pcitc'; import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted, createVNode, } from 'vue'; import { ref, computed, onMounted, onUnmounted, createVNode, watch} from 'vue';
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
@ -50,7 +50,7 @@
import useEventBus from '/@/hooks/event/useEventBus'; import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es'; import { cloneDeep } from 'lodash-es';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus(); const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
const { notification } = useMessage(); const { notification } = useMessage();
@ -65,7 +65,7 @@
const tableRef = ref(); 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":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]); 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":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true},{"isUse":true,"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true}]);
//展示在列表内的按钮 //展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']); const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
const buttonConfigs = computed(()=>{ const buttonConfigs = computed(()=>{
@ -80,8 +80,8 @@
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code)); return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
}); });
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,delete : handleDelete,} const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,delete : handleDelete,datalog : handleDatalog}
const tableData = ref([])
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
const router = useRouter(); const router = useRouter();
const formIdComputedRef = ref(); const formIdComputedRef = ref();
@ -90,8 +90,8 @@
schemaIdComputedRef.value = currentRoute.value.meta.schemaId schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const defaultDate = ref([dayjs().startOf('year').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')]); const defaultDate = ref([dayjs().startOf('year').format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')]);
const [registerModal, { openModal }] = useModal(); const [registerModal, { openModal }] = useModal();
const formName='国际采购计量'; const formName=currentRoute.value.meta?.title
const [registerTable, { reload, }] = useTable({ const [registerTable, { reload, setTableData }] = useTable({
title: '' || (formName + '列表'), title: '' || (formName + '列表'),
api: getLngMeaPurIntPage, api: getLngMeaPurIntPage,
rowKey: 'id', rowKey: 'id',
@ -102,7 +102,7 @@
}, },
schemas: [ schemas: [
{ {
field: 'dateEta', field: 'dateMea',
label: '计量日期', label: '计量日期',
component: 'RangePicker', component: 'RangePicker',
defaultValue: defaultDate.value, defaultValue: defaultDate.value,
@ -124,14 +124,15 @@
}, },
], ],
fieldMapToTime: [['dateEta', ['startDate', 'endDate'], 'YYYY-MM-DD']], fieldMapToTime: [['dateMea', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true, showResetButton: true,
}, },
immediate: false, immediate: false,
beforeFetch: (params) => { beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' }; return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
}, },
afterFetch: (res) => { afterFetch: (res) => {
tableData.value = res || []
tableRef.value.setToolBarWidth(); tableRef.value.setToolBarWidth();
}, },
@ -140,7 +141,7 @@
striped: false, striped: false,
actionColumn: { actionColumn: {
width: 160, width: 140,
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
slots: { customRender: 'action' }, slots: { customRender: 'action' },
@ -151,41 +152,39 @@
}, },
}); });
watch(
() => tableData.value,
(val) => {
if (val) {
let arr = DataFormat.format(val, [
FormatOption.createQty('qtyMmbtu'),
FormatOption.createQty('qtyGj'),
FormatOption.createQty('qtyTon'),
FormatOption.createQty('rateTonGj'),
FormatOption.createQty('rateM3Gj'),
function dbClickRow(record) { ]);
if (!actionButtonConfig?.value.some(element => element.code == 'view')) { if (arr.length) {
return; setTableData(arr)
}
}
},
{
immediate: true,
deep: true,
} }
const { processId, taskIds, schemaId } = record.workflowData || {}; );
if (taskIds && taskIds.length) { function dbClickRow(record) {
router.push({ router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow', path: '/ship/MeaPurInt/createForm',
query: { 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/MeaPurInt/' + record.id + '/viewForm',
query: {
formPath: 'ship/MeaPurInt', formPath: 'ship/MeaPurInt',
formName: formName, formName: formName,
formId:currentRoute.value.meta.formId formId:currentRoute.value.meta.formId,
} id: record.id,
}); type: 'view'
} }
});
} }
function buttonClick(code) { function buttonClick(code) {
@ -204,7 +203,7 @@
}); });
} else { } else {
router.push({ router.push({
path: '/form/MeaPurInt/0/createForm', path: '/ship/MeaPurInt/createForm',
query: { query: {
formPath: 'ship/MeaPurInt', formPath: 'ship/MeaPurInt',
formName: formName, formName: formName,
@ -217,11 +216,13 @@
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
router.push({ router.push({
path: '/form/MeaPurInt/' + record.id + '/updateForm', path: '/ship/MeaPurInt/createForm',
query: { query: {
formPath: 'ship/MeaPurInt', formPath: 'ship/MeaPurInt',
formName: formName, formName: formName,
formId:currentRoute.value.meta.formId formId:currentRoute.value.meta.formId,
id: record.id,
type: 'edit'
} }
}); });
} }
@ -239,7 +240,7 @@
deleteLngMeaPurInt(ids).then((_) => { deleteLngMeaPurInt(ids).then((_) => {
handleSuccess(); handleSuccess();
notification.success({ notification.success({
message: 'Tip', message: '提示',
description: t('删除成功!'), description: t('删除成功!'),
}); });
}); });

View File

@ -17,7 +17,7 @@
<a-row> <a-row>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="船期编号" name="ssNo"> <a-form-item label="船期编号" name="ssNo">
<a-input-search v-model:value="formState.ssNo" :disabled="isDisable || pageType" placeholder="请选择船期" readonly @search="onSearchShip"/> <a-input-search v-model:value="formState.ssNo" :disabled="Boolean(isDisable || pageType ) " placeholder="请选择船期" readonly @search="onSearchShip"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
@ -400,8 +400,8 @@
const userStore = useUserStore(); const userStore = useUserStore();
const userInfo = userStore.getUserInfo; const userInfo = userStore.getUserInfo;
const tableName = 'ShipSchedule'; const tableName = 'OpsPurInt';
const columnName = 'ShipSchedule' const columnName = 'OpsPurInt'
const formType = ref('2'); // 0 新建 1 修改 2 查看 const formType = ref('2'); // 0 新建 1 修改 2 查看
const formRef = ref(); const formRef = ref();
@ -423,13 +423,14 @@
const formId = ref(currentRoute.value?.params?.id); const formId = ref(currentRoute.value?.params?.id);
const pageType = ref(currentRoute.value.query?.type); const pageType = ref(currentRoute.value.query?.type);
const pageId = ref(currentRoute.value.query?.id) const pageId = ref(currentRoute.value.query?.id)
const pageSource = ref(currentRoute.value.query?.pageSource)
const spinning = ref(false); const spinning = ref(false);
const { notification } = useMessage(); const { notification } = useMessage();
const { t } = useI18n() const { t } = useI18n()
const formState = reactive({ const formState = reactive({
approCode: 'WTJ' approCode: 'WTJ',
frtSign: 'N'
}); });
const [register, { openModal:openModal}] = useModal(); const [register, { openModal:openModal}] = useModal();
const [registerContractPurInt, { openModal:openModalContractPurInt}] = useModal(); const [registerContractPurInt, { openModal:openModalContractPurInt}] = useModal();
@ -486,7 +487,7 @@
isDisable.value = pageType.value == 'view' isDisable.value = pageType.value == 'view'
getOption() getOption()
if (pageId.value) { if (pageId.value) {
getInfo(pageId.value) pageSource.value ? getLngShipInfo(pageId.value) :getInfo(pageId.value)
} else { } else {
formState.empName = userInfo.name formState.empName = userInfo.name
formState.empId = userInfo.id formState.empId = userInfo.id
@ -663,6 +664,8 @@
spinning.value = true spinning.value = true
let data = await getLngShipSchedule(id) let data = await getLngShipSchedule(id)
spinning.value = false spinning.value = false
formState.ssNo = data.ssNo
formState.ssId = data.id
formState.comId = data.comId formState.comId = data.comId
formState.kId = data.kId formState.kId = data.kId
formState.kName = data.kName formState.kName = data.kName

View File

@ -17,7 +17,7 @@
<a-row> <a-row>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="船期编号" name="ssNo"> <a-form-item label="船期编号" name="ssNo">
<a-input-search v-model:value="formState.ssNo" :disabled="isDisable || pageType" placeholder="请选择船期" readonly @search="onSearchShip"/> <a-input-search v-model:value="formState.ssNo" :disabled="Boolean(isDisable || pageType ) " placeholder="请选择船期" readonly @search="onSearchShip"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
@ -369,8 +369,8 @@
const userStore = useUserStore(); const userStore = useUserStore();
const userInfo = userStore.getUserInfo; const userInfo = userStore.getUserInfo;
const tableName = 'ShipSchedule'; const tableName = 'OpsSalesInt';
const columnName = 'ShipSchedule' const columnName = 'OpsSalesInt'
const formType = ref('2'); // 0 新建 1 修改 2 查看 const formType = ref('2'); // 0 新建 1 修改 2 查看
const formRef = ref(); const formRef = ref();
@ -392,13 +392,14 @@
const formId = ref(currentRoute.value?.params?.id); const formId = ref(currentRoute.value?.params?.id);
const pageType = ref(currentRoute.value.query?.type); const pageType = ref(currentRoute.value.query?.type);
const pageId = ref(currentRoute.value.query?.id) const pageId = ref(currentRoute.value.query?.id)
const pageSource = ref(currentRoute.value.query?.pageSource)
const spinning = ref(false); const spinning = ref(false);
const { notification } = useMessage(); const { notification } = useMessage();
const { t } = useI18n() const { t } = useI18n()
const formState = reactive({ const formState = reactive({
approCode: 'WTJ' approCode: 'WTJ',
frtSign: 'N'
}); });
const [register, { openModal:openModal}] = useModal(); const [register, { openModal:openModal}] = useModal();
const [registerContractPurInt, { openModal:openModalContractPurInt}] = useModal(); const [registerContractPurInt, { openModal:openModalContractPurInt}] = useModal();
@ -456,7 +457,7 @@
isDisable.value = pageType.value == 'view' isDisable.value = pageType.value == 'view'
getOption() getOption()
if (pageId.value) { if (pageId.value) {
getInfo(pageId.value) pageSource.value ? getLngShipInfo(pageId.value) :getInfo(pageId.value)
} else { } else {
formState.empName = userInfo.name formState.empName = userInfo.name
formState.empId = userInfo.id formState.empId = userInfo.id
@ -627,6 +628,8 @@
spinning.value = true spinning.value = true
let data = await getLngShipSchedule(id) let data = await getLngShipSchedule(id)
spinning.value = false spinning.value = false
formState.ssNo = data.ssNo
formState.ssId = data.id
formState.comId = data.comId formState.comId = data.comId
formState.kId = data.kId formState.kId = data.kId
formState.kName = data.kName formState.kName = data.kName

View File

@ -255,8 +255,9 @@
formPath: 'ship/OpsPurInt', formPath: 'ship/OpsPurInt',
formName: record.opsPurId ? '编辑采购执行' : '新建采购执行', formName: record.opsPurId ? '编辑采购执行' : '新建采购执行',
formId:currentRoute.value.meta.formId, formId:currentRoute.value.meta.formId,
id: record.opsPurId, id: record.opsPurId ? record.opsPurId : record.id,
type: record.opsPurId ? 'edit' : '' type: record.opsPurId ? 'edit' : '',
pageSource: record.opsPurId ? null : 'ship'
} }
}); });
@ -268,8 +269,9 @@
formPath: 'ship/OpsSalesInt', formPath: 'ship/OpsSalesInt',
formName: record.opsSalesId ? '编辑销售执行' : '新建销售执行', formName: record.opsSalesId ? '编辑销售执行' : '新建销售执行',
formId:currentRoute.value.meta.formId, formId:currentRoute.value.meta.formId,
id: record.opsSalesId, id: record.opsSalesId? record.opsSalesId : record.id,
type: record.opsSalesId ? 'edit' : '' type: record.opsSalesId ? 'edit' : '',
pageSource: record.opsSalesId ? null : 'ship'
} }
}); });
} }