采运销关联

This commit is contained in:
‘huanghaiixia’
2026-04-02 18:21:21 +08:00
parent b3b6157716
commit e896cefe31
11 changed files with 2306 additions and 1 deletions

View File

@ -0,0 +1,113 @@
import { LngContractSalesPngPointPageModel, LngContractSalesPngPointPageParams, LngContractSalesPngPointPageResult } from './model/ContractSalesPngPurModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
// Page = '/contract/contractSalesPngPur/page',
Page = '/magic-api/contract/contractSalesPngPoint/pageList',
List = '/contract/contractSalesPngPur/list',
Info = '/contract/contractSalesPngPur/info',
LngContractSalesPngPoint = '/contract/contractSalesPngPur',
selectPcPageList = '/magic-api/contract/contractSalesPngPoint/selectPcPageList',
selectScPageList = '/magic-api/contract/contractSalesPngPoint/selectScPageList',
DataLog = '/contract/contractSalesPngPur/datalog',
}
// 销售合同
export async function getContractScPageList(ksppId: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngContractSalesPngPointPageModel>(
{
url: Api.selectScPageList,
params: { ksppId },
},
{
errorMessageMode: mode,
},
);
}
export async function getContractSalesPngPoint(params: LngContractSalesPngPointPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngContractSalesPngPointPageResult>(
{
url: Api.selectPcPageList,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 查询LngContractSalesPngPoint分页列表
*/
export async function getLngContractSalesPngPointPage(params: LngContractSalesPngPointPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngContractSalesPngPointPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取LngContractSalesPngPoint信息
*/
export async function getLngContractSalesPngPoint(ksppId: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngContractSalesPngPointPageModel>(
{
url: Api.Info,
params: { ksppId },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增LngContractSalesPngPoint
*/
export async function addLngContractSalesPngPoint(lngContractSalesPngPoint: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.LngContractSalesPngPoint,
params: lngContractSalesPngPoint,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新LngContractSalesPngPoint
*/
export async function updateLngContractSalesPngPoint(lngContractSalesPngPoint: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.LngContractSalesPngPoint,
params: lngContractSalesPngPoint,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除LngContractSalesPngPoint批量删除
*/
export async function deleteLngContractSalesPngPoint(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.LngContractSalesPngPoint,
data: ids,
},
{
errorMessageMode: mode,
},
);
}

View File

@ -0,0 +1,63 @@
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: LngContractSalesPngPoint分页参数 模型
*/
export interface LngContractSalesPngPointPageParams extends BasicPageParams {
id: string;
createUserId: string;
kId: string;
createDate: string;
pointDelyCode: string;
modifyDate: string;
note: string;
ruleUserId: string;
deptId: string;
transSign: string;
pointTransCode: string;
}
/**
* @description: LngContractSalesPngPoint分页返回值模型
*/
export interface LngContractSalesPngPointPageModel {
id: string;
createUserId: string;
kId: string;
createDate: string;
pointDelyCode: string;
modifyDate: string;
note: string;
ruleUserId: string;
deptId: string;
transSign: string;
pointTransCode: string;
}
0;
/**
* @description: LngContractSalesPngPoint分页返回值结构
*/
export type LngContractSalesPngPointPageResult =
BasicFetchResult<LngContractSalesPngPointPageModel>;

View File

@ -0,0 +1,141 @@
<template>
<div>
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
@visible-change="handleVisibleChange" >
<BasicTable @register="registerTable" class="ContractPurIntListModal" 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 { getContractSalesPngPoint } from '/@/api/contract/contractSalesPngPur';
const { t } = useI18n();
const comId = ref('')
const codeFormSchema: FormSchema[] = [
{
field: 'dateFrom',
label: '有效期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
];
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const isUpdate = ref(true);
const rowId = ref('');
const showTable = ref(false)
const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]);
const props = defineProps({
selectType: { type: String, default: 'checkbox' },
pageType: String
});
let columns: BasicColumn[] = [
{ title: t('合同号'), dataIndex: 'kpNo', },
{ title: t('合同名称'), dataIndex: 'kpName', },
{ title: '供应商', dataIndex: 'suName',},
{ title: '有效期开始',dataIndex: 'dateFrom', width: 120,},
{ title: '有效期结束',dataIndex: 'dateTo', width: 120},
{ title: t('合同主体'), dataIndex: 'comName', },
{ title: t('上载点'), dataIndex: 'pointUpName'},
];
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
showTable.value = true
comId.value = data.comId
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: getContractSalesPngPoint,
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, comId: comId.value};
},
rowSelection: {
type: props.selectType,
onChange: onSelectChange
},
});
const handleVisibleChange = async (visible: boolean) => {
if (visible) {
showTable.value = false
await nextTick();
await nextTick();
await nextTick();
nextTick(() => {
reload({searchInfo:{'limit':1,'size':10,'page':1}});
});
}
};
function onSelectChange(rowKeys: string[], e) {
selectedKeys.value = rowKeys;
selectedValues.value = e
}
const getTitle = computed(() => (t('管道气采购合同列表')));
async function handleSubmit() {
if (!selectedValues.value.length) {
notification.warning({
message: t('提示'),
description: t('请选择合同')
});
return
}
closeModal();
emit('success', selectedValues.value);
}
</script>
<style >
.ContractPurIntListModal .basicCol{
position: inherit !important;
top: 0;
}
</style>
<style lang="less" scoped>
:deep( .ant-col-8:nth-child(1)) {
width: 360px !important;
max-width: 360px !important;;
}
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
width: 80px !important;
}
</style>

View File

@ -22,7 +22,7 @@
<template #label>
<span><span style="color:red">*</span>价格生效年月</span>
</template>
<a-date-picker :inputReadOnly="true" v-model:value="item.dateFrom" format="YYYY-MM-DD" :value-format="'YYYY-MM-DD'" style="width: 100%" :disabled="isDisable" placeholder="请选择日期" />
<a-date-picker :inputReadOnly="true" v-model:value="item.dateFrom" picker="month" style="width: 100%" :disabled="isDisable" placeholder="请选择日期" />
</a-form-item>
</a-col>
<a-col :span="8" v-if="pageType=='pur'">

View File

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

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: '提示',
description: t('新增成功!'),
}); //提示消息
} else {
notification.success({
message: '提示',
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 { addLngContractSalesPngPoint, getLngContractSalesPngPoint, updateLngContractSalesPngPoint, deleteLngContractSalesPngPoint } from '/@/api/contract/ContractSalesPngPur';
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 getLngContractSalesPngPoint(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 updateLngContractSalesPngPoint(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 addLngContractSalesPngPoint(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 deleteLngContractSalesPngPoint([id]);
}
defineExpose({
setFieldsValue,
resetFields,
validate,
add,
update,
setFormDataFromId,
setDisabledForm,
setMenuPermission,
setWorkFlowForm,
getRowKey,
getFormModel,
handleDelete
});
</script>

View File

@ -0,0 +1,694 @@
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: 'ksName',
label: '销售合同号/名称',
component: 'Input',
},
{
field: 'cuName',
label: '客户',
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'cuName',
title: '客户',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'ksNo',
title: '销售合同号',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'kpName',
title: '销售合同名称',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'pointDelyName',
title: '下载点',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'dateFrom',
title: '销售合同有效期开始',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'dateTo',
title: '销售合同有效期结束',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'suName',
title: '供应商',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'pointUpName',
title: '上载点',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'ksName',
title: '采购合同',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'suYsName',
title: '托运商',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'ktpName',
title: '运输合同',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'comName',
title: '合同主体',
componentType: 'input',
align: 'left',
sorter: true,
},
];
//表单事件
export const formEventConfigs = {
0: [
{
type: 'circle',
color: '#2774ff',
text: '开始节点',
icon: '#icon-kaishi',
bgcColor: '#D8E5FF',
isUserDefined: false,
},
{
color: '#F6AB01',
icon: '#icon-chushihua',
text: '初始化表单',
bgcColor: '#f9f5ea',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
1: [
{
color: '#B36EDB',
icon: '#icon-shujufenxi',
text: '获取表单数据',
detail: '(新增无此操作)',
bgcColor: '#F8F2FC',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
2: [
{
color: '#F8625C',
icon: '#icon-jiazai',
text: '加载表单',
bgcColor: '#FFF1F1',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
3: [
{
color: '#6C6AE0',
icon: '#icon-jsontijiao',
text: '提交表单',
bgcColor: '#F5F4FF',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
4: [
{
type: 'circle',
color: '#F8625C',
text: '结束节点',
icon: '#icon-jieshuzhiliao',
bgcColor: '#FFD6D6',
isLast: true,
isUserDefined: false,
},
],
};
export const formProps: FormProps = {
labelCol: { span: 3, offset: 0 },
labelAlign: 'right',
layout: 'horizontal',
size: 'default',
schemas: [
{
key: '099a7c94e61348e190cf953f39d03075',
field: 'id',
label: 'id',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入id',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '26e6b9a891894f36b32d12c6980d861d',
field: 'createUserId',
label: '客户',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入客户',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '97b10c6ff8e34c8ebfd909837578cb70',
field: 'kId',
label: '销售合同号',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入销售合同号',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'c3b0c9629a6b42949f4714dd9ebf0927',
field: 'createDate',
label: '销售合同名称',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入销售合同名称',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '4ab1b6f5ae5c4eac95df041261fbc641',
field: 'pointDelyCode',
label: '下载点',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入下载点',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '09f7ea6f69cb4e9291bed72bd0b25e20',
field: 'modifyDate',
label: '销售合同有效期开始',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入销售合同有效期开始',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '5b457a72ec2d42369c8af2974d2bdd91',
field: 'note',
label: '销售合同有效期结束',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入销售合同有效期结束',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '17f189a0b07b463ba37f7aacb08c2e35',
field: 'ruleUserId',
label: '供应商',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入供应商',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '2363e0c349db47e7b4071d02af617086',
field: 'deptId',
label: '上载点',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入上载点',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'e4b8e7cb7c064a24be5666f39297492c',
field: 'transSign',
label: '采购合同',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入采购合同',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '6d8a64879c3f4ab78301709772e42fae',
field: 'pointTransCode',
label: '托运商',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入托运商',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '34e71585c82c4b7c8e4b950f924116ef',
label: '表格组件',
field: 'lngContractSalesPngPointPurList',
type: 'form',
component: 'SubForm',
required: true,
colProps: { span: 24 },
componentProps: {
mainKey: 'lngContractSalesPngPointPurList',
columns: [
{
key: '35b4306b3bd640668fec95ba9a82fdc7',
title: '供应商',
dataIndex: 'suCode',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入供应商',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
},
},
{ title: '操作', key: 'action', fixed: 'right', width: '50px' },
],
span: '24',
preloadType: 'api',
apiConfig: {},
itemId: '',
dicOptions: [],
useSelectButton: false,
buttonName: '选择数据',
showLabel: true,
showComponentBorder: true,
showFormBorder: true,
showIndex: false,
isShow: true,
multipleHeads: [],
},
},
{
key: '85871c5877a047749ec8f25bde5ab379',
label: '表格组件',
field: 'lngContractSalesPngPointTransList',
type: 'form',
component: 'SubForm',
required: true,
colProps: { span: 24 },
componentProps: {
mainKey: 'lngContractSalesPngPointTransList',
columns: [
{
key: 'e5a91a5a0299403cbff6e9e242bdd931',
title: '托运商',
dataIndex: 'suCode',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入托运商',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
},
},
{ title: '操作', key: 'action', fixed: 'right', width: '50px' },
],
span: '24',
preloadType: 'api',
apiConfig: {},
itemId: '',
dicOptions: [],
useSelectButton: false,
buttonName: '选择数据',
showLabel: true,
showComponentBorder: true,
showFormBorder: true,
showIndex: false,
isShow: true,
multipleHeads: [],
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};

View File

@ -0,0 +1,434 @@
<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="cuName">
{{ formState.cuName }}
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="销售合同名称" name="ksName">
{{ formState.ksName }}
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="下载点" name="pointDelyName">
{{ formState.pointDelyName }}
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="有效期开始" name="dateFrom">
{{ formState.dateFrom }}
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="有效期结束" name="dateTo">
{{ formState.dateTo }}
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同主体" name="comName">
{{ formState.comName }}
</a-form-item>
</a-col>
</a-row>
</Card>
<Card :bordered="false" >
<template #title>
<div style="display: flex; align-items: center;">
<span style="margin-left: 8px;">关联采购/运输合同</span>
<a-button type="primary" style="margin: 0 10px" @click="handleAdd" v-if="!isDisable">新增</a-button>
</div>
</template>
<div v-for="(item, idx) in dataList" class="tbStyle">
<DeleteOutlined style="margin-bottom: 10px;color:red" @click="handleDelete(idx)" v-if="!isDisable"/>
<a-row>
<a-col :span="8">
<a-form-item label="采购合同" name="kpName">
<a-input-search v-model:value="item.kpName" :disabled="isDisable" placeholder="请选择合同" readonly @search="onContract(idx)"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item name="suName">
<template #label>
<span><span style="color:red">*</span>供应商</span>
</template>
<a-input-search v-model:value="item.suName" :disabled="isDisable" placeholder="请选择供应商" readonly @search="onSearchSupplier(idx)"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item name="pointUpName">
<template #label>
<span><span style="color:red">*</span>上载点</span>
</template>
<a-input-search v-model:value="item.pointUpName" :disabled="isDisable" placeholder="请选择上载点" readonly @search="onSearchDownLoad(idx)"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item name="dateFrom">
<template #label>
<span><span style="color:red">*</span>开始日期</span>
</template>
<a-date-picker :inputReadOnly="true" v-model:value="item.dateFrom" style="width: 100%" @focus="dateFocus(idx)" :disabled-date="disabledDateStart" :disabled="isDisable" placeholder="请选择日期" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item name="dateTo">
<template #label>
<span><span style="color:red">*</span>结束日期</span>
</template>
<a-date-picker :inputReadOnly="true" v-model:value="item.dateTo" style="width: 100%" @focus="dateFocus(idx)" :disabled-date="disabledDateEnd" :disabled="isDisable" placeholder="请选择日期" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item name="transSign">
<template #label>
<span><span style="color:red">*</span>自主托运</span>
</template>
<a-select v-model:value="item.transSign" :disabled="isDisable" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.transSignList" :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 name="sort">
<template #label>
<span><span style="color:red">*</span>顺序</span>
</template>
<input-number v-model:value="item.sort" :disabled="isDisable" :digits="0" :min="1" style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
<div style="width: 100%">
<a style="padding: 0 10px;">运输合同(自主托运)</a>
<a-button type="primary" style="margin-bottom: 10px" @click="addRow(idx)" v-if="!isDisable">新增行</a-button>
<a-table style="width: 100%" :columns="columns" :data-source="item.lngContractSalesPngPointTransList" :pagination="false">
<template #headerCell="{ column }">
<template v-if="column.dataIndex == 'dateFrom'">
<span><span style="color: red">*</span>开始日期</span>
</template>
<template v-if="column.dataIndex == 'dateTo'">
<span><span style="color: red">*</span>结束日期</span>
</template>
<template v-if="column.dataIndex == 'ktpName'">
<span><span style="color: red">*</span>管输合同</span>
</template>
</template>
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'dateFrom'">
<a-date-picker :inputReadOnly="true" v-model:value="record.dateFrom" format="YYYY-MM-DD" :value-format="'YYYY-MM-DD'" @focus="dateFocusTb(idx, index)" :disabled-date="disabledDateStartTb" :disabled="disabled" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'dateTo'">
<a-date-picker :inputReadOnly="true" v-model:value="record.dateTo" format="YYYY-MM-DD" :value-format="'YYYY-MM-DD'" @focus="dateFocusTb(idx, index)" :disabled-date="disabledDateEndTb" :disabled="disabled" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'ktpName'">
</template>
<template v-if="column.dataIndex === 'operation'">
<a v-if="!isDisable" @click="deleteRow(idx,index)">删除</a>
</template>
</template>
</a-table>
</div>
</div>
</Card>
</a-form>
</div>
<supplierListModal @register="registerSupplier" @success="handleSuccessSupplier" selectType="radio" />
<downloadPointModal @register="registerDownLoad" @success="handleSuccessDownLoad"/>
<contractSalesPngPurPointModal @register="registerPur" @success="handleSuccessPur" 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 { SendOutlined, SaveOutlined, CloseOutlined, DeleteOutlined} 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 { addLngContractSalesPngPoint,updateLngContractSalesPngPoint, getLngContractSalesPngPoint, getContractScPageList} from '/@/api/contract/contractSalesPngPur';
import dayjs from 'dayjs';
import { getAppEnvConfig } from '/@/utils/env';
import { message } from 'ant-design-vue';
import supplierListModal from '/@/components/common/supplierListModal.vue';
import downloadPointModal from '/@/components/common/downloadPointModal.vue';
import contractSalesPngPurPointModal from '/@/components/common/contractSalesPngPurPointModal.vue';
import { useUserStore } from '/@/store/modules/user';
import { getLngOpsPurInt} from '/@/api/ship/OpsPurInt';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
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 dataList = ref([])
const curIdx = ref(null)
const curIndex = ref(null)
const spinning = ref(false);
const { notification } = useMessage();
const { t } = useI18n()
const formState = reactive({
approCode: 'WTJ'
});
const [registerSupplier, { openModal:openModalSupplier}] = useModal();
const [registerDownLoad, { openModal:openModalDownLoad}] = useModal();
const [registerPur, { openModal:openModalPur}] = useModal();
const rules= reactive({
});
const columns= ref([
{ title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 50},
{ title: t('托运商'), dataIndex: 'suName', width: 150},
{ title: t('管输上载点'), dataIndex: 'pointUpTransName', width: 150},
{ title: t('管输下载点'), dataIndex: 'pointDelyTransName', width: 150},
{ title: t('开始日期'), dataIndex: 'dateFrom', width: 150},
{ title: t('结束日期'), dataIndex: 'dateTo', width: 150},
{ title: t('管输合同'), dataIndex: 'ktpName', width: 150},
{ title: t('操作'), dataIndex: 'operation', width: 80, fixed: 'right',align: 'center'},
]);
const layout = {
labelCol: { span: 8 },
wrapperCol: { span: 16 },
}
const dataFile = ref([]);
let optionSelect= reactive({
transSignList: [],
});
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)
}
});
async function getInfo(id) {
spinning.value = true
try {
let data = await getContractScPageList(id)
spinning.value = false
// Object.assign(formState, {...data?.list[0]})
} catch (error) {
spinning.value = false
}
}
const dateFocus = (idx) => {
curIdx.value = idx
}
const disabledDateStart = (startValue) => {
const endValue = dataList.value[curIdx.value]?.dateTo;
if (!startValue || !endValue) {
return false
}
return dayjs(startValue).format('YYYY-MM-DD').valueOf() > dayjs(endValue).format('YYYY-MM-DD').valueOf();
}
const disabledDateEnd = (endValue) => {
const startValue = dataList.value[curIdx.value]?.dateFrom;
if (!endValue || !startValue) {
return false
}
return dayjs(endValue).format('YYYY-MM-DD').valueOf() < dayjs(startValue).format('YYYY-MM-DD').valueOf();
}
const dateFocusTb = (idx, index)=> {
curIdx.value = idx
curIndex.value = index
}
const disabledDateStartTb = (startValue) => {
const endValue = dataList.value[curIdx.value]?.lngContractSalesPngPointTransList[curIndex.value]?.dateTo;
if (!startValue || !endValue) {
return false
}
return dayjs(startValue).format('YYYY-MM-DD').valueOf() > dayjs(endValue).format('YYYY-MM-DD').valueOf();
}
const disabledDateEndTb = (endValue) => {
const startValue = dataList.value[curIdx.value]?.lngContractSalesPngPointTransList[curIndex.value]?.dateFrom;
if (!endValue || !startValue) {
return false
}
return dayjs(endValue).format('YYYY-MM-DD').valueOf() < dayjs(startValue).format('YYYY-MM-DD').valueOf();
}
const handleAdd = ()=> {
dataList.value.push({
lngContractSalesPngPointTransList: []
})
}
const handleDelete= (index) => {
dataList.value.splice(index, 1)
}
const addRow = (idx) => {
dataList.value[idx].lngContractSalesPngPointTransList.push({dateFrom: null, dateTo: null})
}
const deleteRow = (idx, index) => {
dataList.value[idx].lngContractSalesPngPointTransList.splice(index, 1)
}
async function getOption() {
optionSelect.transSignList = await getDictionary('LNG_YN')
}
const onContract = (idx) => {
curIdx.value = idx
openModalPur(true,{isUpdate: false})
}
const onSearchDownLoad = (idx)=> {
curIdx.value = idx
openModalDownLoad(true,{isUpdate: false})
}
const onSearchSupplier = (idx) => {
curIdx.value = idx
openModalSupplier(true,{isUpdate: false})
}
const handleSuccessDownLoad = (val) => {
dataList.value[curIdx.value].pointUpCode = val[0].code
dataList.value[curIdx.value].pointUpName = val[0].fullName
}
const handleSuccessSupplier = (val) => {
dataList.value[curIdx.value].suCode = val[0].suCode
dataList.value[curIdx.value].suName = val[0].suName
}
const handleSuccessPur = (val) => {
dataList.value[curIdx.value].kpId = val[0].kpId
dataList.value[curIdx.value].kpName = val[0].kpName
dataList.value[curIdx.value].suCode = val[0].suCode
dataList.value[curIdx.value].suName = val[0].suName
dataList.value[curIdx.value].pointUpCode = val[0].pointUpCode
dataList.value[curIdx.value].pointUpName = val[0].pointUpName
dataList.value[curIdx.value].dateFrom = val[0].dateFrom ? dayjs(val[0].dateFrom) : null
dataList.value[curIdx.value].dateTo = val[0].dateTo ? dayjs(val[0].dateTo) : null
dataList.value[curIdx.value].transSign = val[0].transSign
}
function close() {
tabStore.closeTab(currentRoute.value, router);
}
async function getFormValue() {
return formState
}
async function handleSubmit(type) {
try {
await formRef.value.validateFields();
let obj = {
...formState,
}
spinning.value = true;
let request = !formState.id ? addLngContractSalesPngPoint :updateLngContractSalesPngPoint
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;
}
.tbStyle {
border: 1px dashed #d9d9d9;
padding: 10px;
margin-bottom: 10px;
}
</style>

View File

@ -0,0 +1,225 @@
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: '099a7c94e61348e190cf953f39d03075',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '客户',
fieldId: 'createUserId',
isSubTable: false,
showChildren: true,
type: 'input',
key: '26e6b9a891894f36b32d12c6980d861d',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '销售合同号',
fieldId: 'kId',
isSubTable: false,
showChildren: true,
type: 'input',
key: '97b10c6ff8e34c8ebfd909837578cb70',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '销售合同名称',
fieldId: 'createDate',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'c3b0c9629a6b42949f4714dd9ebf0927',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '下载点',
fieldId: 'pointDelyCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '4ab1b6f5ae5c4eac95df041261fbc641',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '销售合同有效期开始',
fieldId: 'modifyDate',
isSubTable: false,
showChildren: true,
type: 'input',
key: '09f7ea6f69cb4e9291bed72bd0b25e20',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '销售合同有效期结束',
fieldId: 'note',
isSubTable: false,
showChildren: true,
type: 'input',
key: '5b457a72ec2d42369c8af2974d2bdd91',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '供应商',
fieldId: 'ruleUserId',
isSubTable: false,
showChildren: true,
type: 'input',
key: '17f189a0b07b463ba37f7aacb08c2e35',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '上载点',
fieldId: 'deptId',
isSubTable: false,
showChildren: true,
type: 'input',
key: '2363e0c349db47e7b4071d02af617086',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '采购合同',
fieldId: 'transSign',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'e4b8e7cb7c064a24be5666f39297492c',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '托运商',
fieldId: 'pointTransCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '6d8a64879c3f4ab78301709772e42fae',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
showChildren: false,
tableName: 'lngContractSalesPngPointPurList',
fieldName: '表格组件',
fieldId: 'lngContractSalesPngPointPurList',
type: 'form',
key: '34e71585c82c4b7c8e4b950f924116ef',
children: [
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
isSaveTable: false,
showChildren: false,
tableName: 'lngContractSalesPngPointPurList',
fieldName: '供应商',
fieldId: 'suCode',
key: '35b4306b3bd640668fec95ba9a82fdc7',
children: [],
},
],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
showChildren: false,
tableName: 'lngContractSalesPngPointTransList',
fieldName: '表格组件',
fieldId: 'lngContractSalesPngPointTransList',
type: 'form',
key: '85871c5877a047749ec8f25bde5ab379',
children: [
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
isSaveTable: false,
showChildren: false,
tableName: 'lngContractSalesPngPointTransList',
fieldName: '托运商',
fieldId: 'suCode',
key: 'e5a91a5a0299403cbff6e9e242bdd931',
children: [],
},
],
},
];

View File

@ -0,0 +1,293 @@
<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>
<ContractSalesPngPurModal @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/contractSalesPngPur/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted,
} from 'vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngContractSalesPngPointPage, deleteLngContractSalesPngPoint} from '/@/api/contract/ContractSalesPngPur';
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 { getLngContractSalesPngPoint } from '/@/api/contract/ContractSalesPngPur';
import { useModal } from '/@/components/Modal';
import ContractSalesPngPurModal from './components/ContractSalesPngPurModal.vue';
import {formConfig, searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
import dayjs from 'dayjs';
const defaultDate = ref([dayjs().subtract(1, 'month').format('YYYY-MM-DD'),dayjs().add(1, 'month').format('YYYY-MM-DD')]);
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
const { notification } = useMessage();
const { t } = useI18n();
defineEmits(['register']);
const { filterColumnAuth, filterButtonAuth } = usePermission();
const { mergeColumns,mergeSearchFormSchema,mergeButtons } = useFormConfig();
const filterColumns = cloneDeep(filterColumnAuth(columns));
const customConfigColums =ref(filterColumns);
const customSearchFormSchema =ref(searchFormSchema);
const tableRef = ref();
//所有按钮
const buttons = ref([{"name":"编辑","code":"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}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {edit : handleEdit,refresh : handleRefresh,view : handleView,datalog : handleDatalog,}
const { currentRoute } = useRouter();
const router = useRouter();
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const [registerModal, { openModal }] = useModal();
const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, }] = useTable({
title: '' || (formName + '列表'),
api: getLngContractSalesPngPointPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: [
{
field: 'dateFrom',
label: '销售合同有效期',
component: 'RangePicker',
// defaultValue: defaultDate.value,
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'ksName',
label: '销售合同号/名称',
component: 'Input',
},
{
field: 'cuName',
label: '客户',
component: 'Input',
},
],
fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true,
},
immediate: 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) {
router.push({
path: '/contract/ContractSalesPngPur/createForm',
query: {
formPath: 'contract/ContractSalesPngPur',
formName: '查看'+formName,
formId:currentRoute.value.meta.formId,
id: record.ksppId,
type: 'view'
}
});
}
function buttonClick(code) {
btnEvent[code]();
}
function handleDatalog (record: Recordable) {
modalVisible.value = true
logId.value = record.id
}
function handleEdit(record: Recordable) {
router.push({
path: '/contract/ContractSalesPngPur/createForm',
query: {
formPath: 'contract/ContractSalesPngPur',
formName: '编辑'+formName,
formId:currentRoute.value.meta.formId,
id: record.ksppId,
type: 'edit'
}
});
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
onMounted(() => {
reload({ searchInfo: { startDate: defaultDate.value[0], endDate: defaultDate.value[1] }});
if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh);
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
mergeCustomListRenderConfig();
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
bus.off(FLOW_PROCESSED, handleRefresh);
bus.off(CREATE_FLOW, handleRefresh);
} else {
bus.off(FORM_LIST_MODIFIED, handleRefresh);
}
});
function getActions(record: Recordable):ActionItem[] {
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
if (!record.workflowData?.processId) {
return {
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
if (button.code === 'view') {
return {
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
return {};
}
}
});
return actionsList;
}
async function mergeCustomListRenderConfig(){
if (formConfig.useCustomConfig) {
let formId=currentRoute.value.meta.formId;
//1.合并展示字段配置
let cols= await mergeColumns(customConfigColums.value,formId);
customConfigColums.value=cols;
//2.合并搜索字段配置
let sFormSchema= await mergeSearchFormSchema(customSearchFormSchema.value,formId);
customSearchFormSchema.value=sFormSchema;
//3.合并按钮配置
let btns= await mergeButtons(buttons.value,formId);
buttons.value=btns;
}
};
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
:deep( .ant-col-8:nth-child(1)) {
width: 350px !important;
max-width: 350px !important;;
}
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
width: 110px !important;
}
:deep(.ant-col-8:nth-child(1) .ant-form-item-label label) {
width: 110px !important;
max-width: 110px !important;
}
:deep(.ant-col-8:nth-child(2) .ant-form-item-label) {
width: 120px !important;
}
:deep(.ant-col-8:nth-child(2) .ant-form-item-label label) {
width: 120px !important;
max-width: 120px !important;
}
:deep( .ant-col-8:nth-child(2)) {
width: 300px !important;
max-width: 300px !important;;
}
</style>