2026-03-03 17:48:45 +08:00
|
|
|
<template>
|
2026-03-04 16:31:44 +08:00
|
|
|
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex" class="ShipSchedule">
|
2026-03-03 17:48:45 +08:00
|
|
|
<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>
|
2026-03-04 16:31:44 +08:00
|
|
|
<template v-if="column.dataIndex === 'opsPurName'">
|
|
|
|
|
{{ record.opsPurId ? '已执行' : '未执行' }}
|
|
|
|
|
</template>
|
|
|
|
|
<template v-if="column.dataIndex === 'opsSalesName'">
|
|
|
|
|
{{ record.opsSalesId ? '已执行' : '未执行' }}
|
|
|
|
|
</template>
|
2026-03-03 17:48:45 +08:00
|
|
|
</template>
|
|
|
|
|
</BasicTable>
|
|
|
|
|
<ShipScheduleModal @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('/ship/shipSchedule/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 { getLngShipSchedulePage, deleteLngShipSchedule} from '/@/api/ship/ShipSchedule';
|
|
|
|
|
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 { getLngShipSchedule } from '/@/api/ship/ShipSchedule';
|
|
|
|
|
import { useModal } from '/@/components/Modal';
|
|
|
|
|
import ShipScheduleModal from './components/ShipScheduleModal.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';
|
2026-03-04 16:31:44 +08:00
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
import { getAllCom } from '/@/api/contract/ContractPurInt';
|
2026-03-03 17:48:45 +08:00
|
|
|
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":"send","icon":"ant-design:send-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":"opspur","icon":"ant-design:folder-view-outlined","isDefault":false},{"isUse":true,"name":"销售执行","code":"opssales","icon":"ant-design:fund-view-outlined","isDefault":false},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]);
|
|
|
|
|
//展示在列表内的按钮
|
|
|
|
|
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord', 'opspur', 'opssales']);
|
|
|
|
|
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));
|
|
|
|
|
});
|
|
|
|
|
|
2026-03-04 16:31:44 +08:00
|
|
|
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,datalog : handleDatalog,delete : handleDelete,send: handleSend, opssales: handleOpssales, opspur: handleOpspur}
|
2026-03-03 17:48:45 +08:00
|
|
|
|
|
|
|
|
const { currentRoute } = useRouter();
|
2026-03-04 16:31:44 +08:00
|
|
|
const selectedKeys = ref<string[]>([]);
|
2026-03-03 17:48:45 +08:00
|
|
|
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();
|
2026-03-04 16:31:44 +08:00
|
|
|
const formName=currentRoute.value.meta?.title;
|
|
|
|
|
const defaultDate = ref([dayjs().startOf('year').format('YYYY-MM-DD'), dayjs().add(1, 'year').endOf('year').format('YYYY-MM-DD')]);
|
|
|
|
|
const comIdList = ref([])
|
|
|
|
|
const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
|
2026-03-03 17:48:45 +08:00
|
|
|
title: '' || (formName + '列表'),
|
|
|
|
|
api: getLngShipSchedulePage,
|
|
|
|
|
rowKey: 'id',
|
|
|
|
|
columns: customConfigColums,
|
|
|
|
|
formConfig: {
|
|
|
|
|
rowProps: {
|
|
|
|
|
gutter: 16,
|
|
|
|
|
},
|
2026-03-04 16:31:44 +08:00
|
|
|
schemas: [
|
|
|
|
|
{
|
|
|
|
|
field: 'dateEta',
|
|
|
|
|
label: '卸港ETA',
|
|
|
|
|
component: 'RangePicker',
|
|
|
|
|
defaultValue: defaultDate.value,
|
|
|
|
|
componentProps: {
|
|
|
|
|
format: 'YYYY-MM-DD',
|
|
|
|
|
style: { width: '100%' },
|
|
|
|
|
getPopupContainer: () => document.body,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'ssNo',
|
|
|
|
|
label: '船期编号',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'staName',
|
|
|
|
|
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: comIdList,
|
|
|
|
|
placeholder: '请选择',
|
|
|
|
|
allowClear: true,
|
|
|
|
|
|
|
|
|
|
getPopupContainer: () => document.body,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
fieldMapToTime: [['dateEta', ['startDate', 'endDate'], 'YYYY-MM-DD']],
|
|
|
|
|
showResetButton: true,
|
|
|
|
|
submitButtonOptions: {
|
|
|
|
|
text: '搜索',
|
|
|
|
|
onClick: () => {
|
|
|
|
|
clearSelectedRowKeys()
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
resetButtonOptions: {
|
|
|
|
|
text: '重置',
|
|
|
|
|
onClick: () => {
|
|
|
|
|
clearSelectedRowKeys()
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-03-03 17:48:45 +08:00
|
|
|
},
|
2026-03-04 16:31:44 +08:00
|
|
|
immediate: false,
|
2026-03-03 17:48:45 +08:00
|
|
|
beforeFetch: (params) => {
|
2026-03-04 16:31:44 +08:00
|
|
|
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
|
2026-03-03 17:48:45 +08:00
|
|
|
},
|
|
|
|
|
afterFetch: (res) => {
|
|
|
|
|
tableRef.value.setToolBarWidth();
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
useSearchForm: true,
|
|
|
|
|
showTableSetting: true,
|
|
|
|
|
|
|
|
|
|
striped: false,
|
|
|
|
|
actionColumn: {
|
2026-03-04 16:31:44 +08:00
|
|
|
width: 200,
|
2026-03-03 17:48:45 +08:00
|
|
|
title: '操作',
|
|
|
|
|
dataIndex: 'action',
|
|
|
|
|
slots: { customRender: 'action' },
|
2026-03-04 16:31:44 +08:00
|
|
|
},
|
|
|
|
|
rowSelection: {
|
|
|
|
|
type: 'checkbox',
|
|
|
|
|
onChange: onSelectChange
|
2026-03-03 17:48:45 +08:00
|
|
|
},
|
|
|
|
|
tableSetting: {
|
|
|
|
|
size: false,
|
|
|
|
|
setting: false,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
});
|
2026-03-04 16:31:44 +08:00
|
|
|
function onSelectChange(rowKeys: string[]) {
|
|
|
|
|
selectedKeys.value = rowKeys;
|
|
|
|
|
}
|
2026-03-03 17:48:45 +08:00
|
|
|
function dbClickRow(record) {
|
2026-03-04 16:31:44 +08:00
|
|
|
router.push({
|
|
|
|
|
path: '/ship/ShipSchedule/createForm',
|
|
|
|
|
query: {
|
2026-03-03 17:48:45 +08:00
|
|
|
formPath: 'ship/ShipSchedule',
|
2026-03-04 16:31:44 +08:00
|
|
|
formName: '查看'+ formName,
|
|
|
|
|
formId:currentRoute.value.meta.formId,
|
|
|
|
|
id: record.id,
|
|
|
|
|
type: 'view'
|
|
|
|
|
}
|
|
|
|
|
});
|
2026-03-03 17:48:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function buttonClick(code) {
|
|
|
|
|
|
|
|
|
|
btnEvent[code]();
|
|
|
|
|
}
|
|
|
|
|
function handleDatalog (record: Recordable) {
|
|
|
|
|
modalVisible.value = true
|
|
|
|
|
logId.value = record.id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleAdd() {
|
|
|
|
|
if (schemaIdComputedRef.value) {
|
|
|
|
|
router.push({
|
|
|
|
|
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
router.push({
|
2026-03-04 16:31:44 +08:00
|
|
|
path: '/ship/ShipSchedule/createForm',
|
2026-03-03 17:48:45 +08:00
|
|
|
query: {
|
|
|
|
|
formPath: 'ship/ShipSchedule',
|
2026-03-04 16:31:44 +08:00
|
|
|
formName: '新建'+formName,
|
2026-03-03 17:48:45 +08:00
|
|
|
formId:currentRoute.value.meta.formId
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleEdit(record: Recordable) {
|
|
|
|
|
|
|
|
|
|
router.push({
|
2026-03-04 16:31:44 +08:00
|
|
|
path: '/ship/ShipSchedule/createForm',
|
2026-03-03 17:48:45 +08:00
|
|
|
query: {
|
|
|
|
|
formPath: 'ship/ShipSchedule',
|
2026-03-04 16:31:44 +08:00
|
|
|
formName: '编辑'+ formName,
|
|
|
|
|
formId:currentRoute.value.meta.formId,
|
|
|
|
|
id: record.id,
|
|
|
|
|
type: 'edit'
|
2026-03-03 17:48:45 +08:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2026-03-04 16:31:44 +08:00
|
|
|
function handleOpspur () {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function handleOpssales () {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function handleSend () {
|
|
|
|
|
// if (!selectedKeys.value.length) {
|
|
|
|
|
// notification.warning({
|
|
|
|
|
// message: '提示',
|
|
|
|
|
// description: t('请选择需要发送的数据'),
|
|
|
|
|
// });
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
}
|
2026-03-03 17:48:45 +08:00
|
|
|
function handleDelete(record: Recordable) {
|
|
|
|
|
deleteList([record.id]);
|
|
|
|
|
}
|
|
|
|
|
function deleteList(ids) {
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
title: '提示信息',
|
|
|
|
|
icon: createVNode(ExclamationCircleOutlined),
|
|
|
|
|
content: '是否确认删除?',
|
|
|
|
|
okText: '确认',
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
onOk() {
|
|
|
|
|
deleteLngShipSchedule(ids).then((_) => {
|
|
|
|
|
handleSuccess();
|
|
|
|
|
notification.success({
|
2026-03-04 16:31:44 +08:00
|
|
|
message: '提示',
|
2026-03-03 17:48:45 +08:00
|
|
|
description: t('删除成功!'),
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onCancel() {},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function handleRefresh() {
|
|
|
|
|
reload();
|
|
|
|
|
}
|
|
|
|
|
function handleSuccess() {
|
|
|
|
|
|
|
|
|
|
reload();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleView(record: Recordable) {
|
|
|
|
|
|
|
|
|
|
dbClickRow(record);
|
|
|
|
|
|
|
|
|
|
}
|
2026-03-04 16:31:44 +08:00
|
|
|
onMounted(async() => {
|
|
|
|
|
reload({ searchInfo: { startDate: defaultDate.value[0], endDate: defaultDate.value[1] }});
|
|
|
|
|
let res = await getAllCom() || []
|
|
|
|
|
comIdList.value = res.map(v=> {
|
|
|
|
|
return {
|
|
|
|
|
label: v.shortName,
|
|
|
|
|
value: v.id
|
|
|
|
|
}
|
|
|
|
|
})
|
2026-03-03 17:48:45 +08:00
|
|
|
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>
|
2026-03-04 16:31:44 +08:00
|
|
|
<style lang="less">
|
|
|
|
|
.ShipSchedule .cusSearchForm .advanceRow> div:nth-of-type(3){
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
2026-03-03 17:48:45 +08:00
|
|
|
<style lang="less" scoped>
|
|
|
|
|
:deep(.ant-table-selection-col) {
|
|
|
|
|
width: 50px;
|
|
|
|
|
}
|
|
|
|
|
.show{
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
.hide{
|
|
|
|
|
display: none !important;
|
|
|
|
|
}
|
2026-03-04 16:31:44 +08:00
|
|
|
: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;
|
|
|
|
|
}
|
2026-03-03 17:48:45 +08:00
|
|
|
</style>
|