lng计划业务逻辑处理
This commit is contained in:
@ -16,6 +16,16 @@ export const searchFormSchema: FormSchema[] = [
|
||||
getPopupContainer: () => document.body,
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'cuName',
|
||||
label: '客户名称/简称/编码',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'suName',
|
||||
label: '供应商名称/简称/编码',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'noTractor',
|
||||
label: '车头号',
|
||||
@ -26,6 +36,25 @@ export const searchFormSchema: FormSchema[] = [
|
||||
label: '挂车号',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'statusCode',
|
||||
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,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
@ -48,7 +77,7 @@ export const columns: BasicColumn[] = [
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'staCode',
|
||||
dataIndex: 'staName',
|
||||
title: '气源地',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
@ -75,7 +104,7 @@ export const columns: BasicColumn[] = [
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'qtyTonLoading',
|
||||
dataIndex: 'qtyMeaTonSales',
|
||||
title: '装车量(吨)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
@ -84,7 +113,7 @@ export const columns: BasicColumn[] = [
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'tenantId',
|
||||
dataIndex: 'qtyMeaGjSales',
|
||||
title: '装车量(吉焦)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
@ -93,7 +122,7 @@ export const columns: BasicColumn[] = [
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'modifyDate',
|
||||
dataIndex: 'qtyMeaM3Sales',
|
||||
title: '装车量(方)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
|
||||
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex" class="LngMeasurePurStyle">
|
||||
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
|
||||
|
||||
<template #toolbar>
|
||||
@ -15,13 +15,19 @@
|
||||
</template>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'lngFileUploadList'">
|
||||
<div v-for="(item, idx) in record.lngFileUploadList">
|
||||
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<TableAction :actions="getActions(record)" />
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<LngMeasurePurModal @register="registerModal" @success="handleSuccess" />
|
||||
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
|
||||
<LngMeasurePurModal @register="registerModal" @success="handleSuccess" />
|
||||
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
|
||||
<rejectReplyModal :visible="isOpen" @success="handleRejectReply" />
|
||||
</PageWrapper>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
@ -29,9 +35,7 @@
|
||||
const logId = ref('')
|
||||
const logPath = ref('/dayPlan/lngMeasurePur/datalog');
|
||||
import { DataLog } from '/@/components/pcitc';
|
||||
import { ref, computed, onMounted, onUnmounted,
|
||||
|
||||
} from 'vue';
|
||||
import { ref, computed, onMounted, onUnmounted, watch} from 'vue';
|
||||
|
||||
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||
import { getLngLngMeasurePage, deleteLngLngMeasure} from '/@/api/dayPlan/LngMeasurePur';
|
||||
@ -49,6 +53,10 @@
|
||||
import Icon from '/@/components/Icon/index';
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { parseDownloadUrl} from '/@/api/system/file';
|
||||
import { downloadByUrl } from '/@/utils/file/download';
|
||||
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
|
||||
import rejectReplyModal from '/@/components/common/rejectReplyModal.vue'
|
||||
|
||||
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||
|
||||
@ -61,25 +69,29 @@
|
||||
const filterColumns = cloneDeep(filterColumnAuth(columns));
|
||||
const customConfigColums =ref(filterColumns);
|
||||
const customSearchFormSchema =ref(searchFormSchema);
|
||||
|
||||
const isOpen = ref(false)
|
||||
const tableRef = ref();
|
||||
const tableData = ref([])
|
||||
const selectedKeys = ref<string[]>([]);
|
||||
//所有按钮
|
||||
const buttons = ref([{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true},{"isUse":true,"name":"确认","code":"submit","icon":"ant-design:check-outlined","isDefault":false},{"isUse":true,"name":"取消确认","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":false},{"isUse":true,"name":"驳回","code":"reject","icon":"ant-design:stop-outlined","isDefault":false}]);
|
||||
//展示在列表内的按钮
|
||||
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
|
||||
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','submit','cancel','reject']);
|
||||
const buttonConfigs = computed(()=>{
|
||||
return filterButtonAuth(buttons.value);
|
||||
})
|
||||
|
||||
const tableButtonConfig = computed(() => {
|
||||
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
|
||||
let arr =[{"name":"确认","code":"submit","icon":"ant-design:check-outlined","isDefault":true,"isUse":true},{"name":"取消确认","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":true,"isUse":true},{"name":"驳回","code":"reject","icon":"ant-design:stop-outlined","isDefault":true,"isUse":true},{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},]
|
||||
return arr
|
||||
// return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
|
||||
});
|
||||
|
||||
const actionButtonConfig = computed(() => {
|
||||
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
|
||||
});
|
||||
|
||||
const btnEvent = {refresh : handleRefresh,datalog : handleDatalog,}
|
||||
const btnEvent = {refresh : handleRefresh,datalog : handleDatalog,submit: handleSubmit, cancel: handleCancel, reject: handleReject}
|
||||
|
||||
const { currentRoute } = useRouter();
|
||||
const router = useRouter();
|
||||
@ -88,8 +100,8 @@
|
||||
const schemaIdComputedRef = ref();
|
||||
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const formName='LNG计量(业务)';
|
||||
const [registerTable, { reload, }] = useTable({
|
||||
const formName=currentRoute.value.meta?.title;
|
||||
const [registerTable, { reload, setTableData,clearSelectedRowKeys }] = useTable({
|
||||
title: '' || (formName + '列表'),
|
||||
api: getLngLngMeasurePage,
|
||||
rowKey: 'id',
|
||||
@ -99,13 +111,14 @@
|
||||
gutter: 16,
|
||||
},
|
||||
schemas: customSearchFormSchema,
|
||||
fieldMapToTime: [],
|
||||
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD']],
|
||||
showResetButton: false,
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
|
||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
|
||||
},
|
||||
afterFetch: (res) => {
|
||||
tableData.value = res || []
|
||||
tableRef.value.setToolBarWidth();
|
||||
|
||||
},
|
||||
@ -119,52 +132,117 @@
|
||||
dataIndex: 'action',
|
||||
slots: { customRender: 'action' },
|
||||
},
|
||||
rowSelection: {
|
||||
type: 'checkbox',
|
||||
onChange: onSelectChange
|
||||
},
|
||||
tableSetting: {
|
||||
size: false,
|
||||
setting: false,
|
||||
},
|
||||
|
||||
});
|
||||
watch(
|
||||
() => tableData.value,
|
||||
(val) => {
|
||||
if (val) {
|
||||
let arr = DataFormat.format(val, [
|
||||
FormatOption.createQty('qtyMeaTonSales'),
|
||||
FormatOption.createQty('qtyMeaGjSales'),
|
||||
FormatOption.createQty('qtyMeaM3Sales'),
|
||||
]);
|
||||
if (arr.length) {
|
||||
setTableData(arr)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
const handleDownload = (info) => {
|
||||
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
|
||||
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
|
||||
downloadByUrl({ url, fileName: fileName});
|
||||
};
|
||||
function onSelectChange(selectedRowKeys: [], selectedRows) {
|
||||
selectedKeys.value = selectedRowKeys;
|
||||
}
|
||||
|
||||
function dbClickRow(record) {
|
||||
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
|
||||
return;
|
||||
}
|
||||
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||
if (taskIds && taskIds.length) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||
query: {
|
||||
taskId: taskIds[0],
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
} else if (schemaId && !taskIds && processId) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||
query: {
|
||||
readonly: 1,
|
||||
taskId: '',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/LngMeasurePur/' + record.id + '/viewForm',
|
||||
query: {
|
||||
formPath: 'dayPlan/LngMeasurePur',
|
||||
formName: formName,
|
||||
formId:currentRoute.value.meta.formId
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function buttonClick(code) {
|
||||
|
||||
btnEvent[code]();
|
||||
btnEvent[code]('batch');
|
||||
}
|
||||
async function handleSubmit (val) {
|
||||
if (val=='batch') {
|
||||
if (!selectedKeys.value.length) {
|
||||
notification.warning({
|
||||
message: '提示',
|
||||
description: t('请选择需要确认的数据'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
selectedKeys.value= [val?.id]
|
||||
}
|
||||
await submitLngPngMeasurePur(selectedKeys.value)
|
||||
handleSuccess();
|
||||
notification.success({
|
||||
message: '提示',
|
||||
description: t('确认成功!'),
|
||||
});
|
||||
clearSelectedRowKeys()
|
||||
}
|
||||
async function handleCancel (val) {
|
||||
if (val=='batch') {
|
||||
if (!selectedKeys.value.length) {
|
||||
notification.warning({
|
||||
message: '提示',
|
||||
description: t('请选择需要取消的数据'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
selectedKeys.value= [val?.id]
|
||||
}
|
||||
await cancelLngPngMeasurePur(selectedKeys.value)
|
||||
handleSuccess();
|
||||
notification.success({
|
||||
message: '提示',
|
||||
description: t('取消成功!'),
|
||||
});
|
||||
clearSelectedRowKeys()
|
||||
}
|
||||
function handleReject (val) {
|
||||
if (val=='batch') {
|
||||
if (!selectedKeys.value.length) {
|
||||
notification.warning({
|
||||
message: '提示',
|
||||
description: t('请选择需要驳回的数据'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
selectedKeys.value= [val?.id]
|
||||
}
|
||||
isOpen.value = true
|
||||
}
|
||||
const handleRejectReply = async (val) => {
|
||||
let obj = {
|
||||
"ids": selectedKeys.value,
|
||||
"rejNote": val.reply,
|
||||
}
|
||||
await rejectLngPngMeasurePur(obj)
|
||||
isOpen.value = false
|
||||
handleSuccess();
|
||||
notification.success({
|
||||
message: '提示',
|
||||
description: t('已驳回!'),
|
||||
});
|
||||
}
|
||||
function handleDatalog (record: Recordable) {
|
||||
modalVisible.value = true
|
||||
@ -179,6 +257,17 @@
|
||||
}
|
||||
onMounted(() => {
|
||||
|
||||
const statusList = [
|
||||
{label: '计量中', value: 'JLZ'},
|
||||
{label: '结算中', value: 'JSZ'},
|
||||
{label: '已结算', value: 'YJS'},
|
||||
{label: '计量完成', value: 'JLWC'},
|
||||
]
|
||||
customSearchFormSchema.value.forEach(v => {
|
||||
if (v.field == 'statusCode') {
|
||||
v.componentProps.options = statusList
|
||||
}
|
||||
});
|
||||
if (schemaIdComputedRef.value) {
|
||||
bus.on(FLOW_PROCESSED, handleRefresh);
|
||||
bus.on(CREATE_FLOW, handleRefresh);
|
||||
@ -198,27 +287,52 @@
|
||||
}
|
||||
});
|
||||
function getActions(record: Recordable):ActionItem[] {
|
||||
|
||||
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
|
||||
if (!record.workflowData?.processId) {
|
||||
return {
|
||||
let submitBtn: ActionItem[] = [];
|
||||
let cancelBtn: ActionItem[] = [];
|
||||
let rejectBtn: ActionItem[] = [];
|
||||
let datalogBtn: ActionItem[] = [];
|
||||
let actionsList: ActionItem[] = []
|
||||
actionButtonConfig.value?.map((button) => {
|
||||
if (['submit'].includes(button.code)) {
|
||||
submitBtn.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
});
|
||||
}
|
||||
if (['cancel'].includes(button.code)) {
|
||||
cancelBtn.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
});
|
||||
}
|
||||
if (['reject'].includes(button.code)) {
|
||||
rejectBtn.push({
|
||||
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 {};
|
||||
}
|
||||
});
|
||||
}
|
||||
if (['datalog'].includes(button.code)) {
|
||||
datalogBtn.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
});
|
||||
}
|
||||
});
|
||||
if (record.statusCode=='JLZ') {
|
||||
actionsList = actionsList.concat(submitBtn);
|
||||
}
|
||||
if (record.statusCode=='JLWC') {
|
||||
actionsList = actionsList.concat(cancelBtn);
|
||||
}
|
||||
if (record.statusCode=='JLZ'&&record.cfmCuUserId) {
|
||||
actionsList = actionsList.concat(rejectBtn);
|
||||
}
|
||||
actionsList = actionsList.concat(datalogBtn);
|
||||
return actionsList;
|
||||
}
|
||||
async function mergeCustomListRenderConfig(){
|
||||
@ -236,6 +350,11 @@
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="less">
|
||||
.LngMeasurePurStyle .cusSearchForm .advanceRow> div:nth-of-type(3){
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-table-selection-col) {
|
||||
width: 50px;
|
||||
@ -246,4 +365,67 @@
|
||||
.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(2)) {
|
||||
width: 330px !important;
|
||||
max-width: 330px !important;
|
||||
}
|
||||
:deep(.ant-col-8:nth-child(2) .ant-form-item-label) {
|
||||
width: 150px !important;
|
||||
max-width: 150px !important;
|
||||
}
|
||||
:deep(.ant-col-8:nth-child(2) .ant-form-item-label label) {
|
||||
width: 150px !important;
|
||||
max-width: 150px !important;
|
||||
}
|
||||
:deep( .ant-col-8:nth-child(6)) {
|
||||
width: 330px !important;
|
||||
max-width: 330px !important;
|
||||
}
|
||||
:deep(.ant-col-8:nth-child(6) .ant-form-item-label) {
|
||||
width: 150px !important;
|
||||
max-width: 150px !important;
|
||||
}
|
||||
:deep(.ant-col-8:nth-child(6) .ant-form-item-label label) {
|
||||
width: 150px !important;
|
||||
max-width: 150px !important;
|
||||
}
|
||||
:deep( .ant-col-8:nth-child(3)) {
|
||||
width: 330px !important;
|
||||
max-width: 330px !important;
|
||||
}
|
||||
:deep(.ant-col-8:nth-child(3) .ant-form-item-label) {
|
||||
width: 150px !important;
|
||||
max-width: 150px !important;
|
||||
}
|
||||
:deep(.ant-col-8:nth-child(3) .ant-form-item-label label) {
|
||||
width: 150px !important;
|
||||
max-width: 150px !important;
|
||||
}
|
||||
:deep( .ant-col-8:nth-child(5)) {
|
||||
width: 330px !important;
|
||||
max-width: 330px !important;
|
||||
}
|
||||
:deep(.ant-col-8:nth-child(5) .ant-form-item-label) {
|
||||
width: 150px !important;
|
||||
max-width: 150px !important;
|
||||
}
|
||||
:deep(.ant-col-8:nth-child(5) .ant-form-item-label label) {
|
||||
width: 150px !important;
|
||||
max-width: 150px !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user