| | |
| | | <avue-crud :option="option" v-model:search="queryParams" :table-loading="pageF.loading" :data="tableData" |
| | | :page="page" :permission="permissionList" :before-open="beforeOpen" v-model="form" ref="crudRef" |
| | | @row-update="rowUpdate" @row-save="rowSave" @refresh-change="refreshChange" @row-del="rowDel" |
| | | @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" |
| | | @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" |
| | | @current-change="currentChange" @size-change="sizeChange" @on-load="onLoad"> |
| | | |
| | | <template #menu-left> |
| | |
| | | projectName: { |
| | | fixed: 'left', |
| | | label: '项目名称', search: true, |
| | | minWidth: 150, |
| | | |
| | | }, |
| | | dispatchNo: { |
| | | label: '调度单号', |
| | | minWidth: 150, |
| | | search: true, |
| | | rules: [ |
| | | { |
| | |
| | | customerName: { |
| | | label: '客户名称', |
| | | search: true, |
| | | minWidth: 220, |
| | | showOverflowTooltip: true, |
| | | type: 'select', // 设置为下拉框类型 |
| | | dicData: [], // 使用 selectCustomName 作为数据源 |
| | | disabled: false // 根据需要设置是否禁用 |
| | | }, |
| | | licensePlateNumber: { |
| | | label: '车牌', search: true, hide: true, |
| | | label: '车牌', search: true, |
| | | minWidth: 120, |
| | | |
| | | }, |
| | | vehicleType: { |
| | | label: '车型', search: true, hide: true, |
| | | label: '车型', search: true, |
| | | }, |
| | | // createdTime: { |
| | | // label: '下单时间', |
| | | // display: false, |
| | | // search: true, |
| | | // type: 'date', |
| | | // format: 'YYYY-MM-DD', |
| | | // searchSpan: 5, minWidth: 120, |
| | | // valueFormat: 'YYYY-MM-DD', |
| | | // }, |
| | | createdTimeArray: { |
| | | label: '下单时间', |
| | | search: true, |
| | | searchRange: true, |
| | | type: 'daterange', |
| | | startPlaceholder: '开始日期', |
| | | endPlaceholder: '结束日期', |
| | | valueFormat: 'YYYY-MM-DD', |
| | | hide: true |
| | | }, |
| | | createdTime: { |
| | | label: '下单时间', |
| | | display: false, |
| | | search: true, |
| | | type: 'date', |
| | | format: 'YYYY-MM-DD', |
| | | searchSpan: 5, minWidth: 100, |
| | | valueFormat: 'YYYY-MM-DD', |
| | | minWidth: 180, |
| | | }, |
| | | operationMode: { |
| | | label: '运营模式', |
| | |
| | | |
| | | carrierName: { |
| | | label: '承运商', |
| | | minWidth: 220, |
| | | showOverflowTooltip: true, |
| | | }, |
| | | departureLocation: { |
| | | label: '出发地', |
| | | minWidth: 220, |
| | | showOverflowTooltip: true, |
| | | }, |
| | | arrivalLocation: { |
| | | label: '目的地', |
| | | minWidth: 220, |
| | | showOverflowTooltip: true, |
| | | |
| | | }, |
| | | isCreate: { |
| | | label: '是否已入账', dataType: 'string', search: true, |
| | | type: 'select', |
| | | dicUrl: '/system/dict/data/type/sys_whether_type', |
| | | }, |
| | | |
| | | // vehicleId: { |
| | | // label: '运输工具ID',hide: true, |
| | | // }, |
| | | |
| | | |
| | | // mainDriver: { |
| | | // label: '主驾驶员',hide: true, |
| | | // }, |
| | | // assistantDriver: { |
| | | // label: '副驾驶员',hide: true, |
| | | // }, |
| | | // pointNum: { |
| | | // label: '提送货点数',hide: true, |
| | | // }, |
| | | // businessContact: { |
| | | // label: '业务联系人',hide: true, |
| | | // }, |
| | | // estimatedTotalIncome: { |
| | | // label: '预估总收入', |
| | | // }, |
| | | // estimatedTotalCost: { |
| | | // label: '预估总成本', |
| | | // }, |
| | | // estimatedProfit: { |
| | | // label: '预估利润', |
| | | // }, |
| | | mainDriver: { |
| | | label: '主驾驶员', |
| | | minWidth: 120, |
| | | |
| | | }, |
| | | assistantDriver: { |
| | | label: '副驾驶员', |
| | | minWidth: 120, |
| | | |
| | | }, |
| | | pointNum: { |
| | | label: '提送货点数', |
| | | minWidth: 100, |
| | | |
| | | }, |
| | | businessContact: { |
| | | label: '业务联系人', |
| | | minWidth: 120, |
| | | }, |
| | | estimatedTotalIncome: { |
| | | label: '预估总收入', |
| | | minWidth: 120, |
| | | |
| | | }, |
| | | estimatedTotalCost: { |
| | | label: '预估总成本', |
| | | minWidth: 120, |
| | | |
| | | }, |
| | | estimatedProfit: { |
| | | label: '预估利润', |
| | | minWidth: 120, |
| | | |
| | | }, |
| | | |
| | | confirmedTotalIncome: { |
| | | label: '确认总收入', |
| | | minWidth: 120, |
| | | |
| | | }, |
| | | confirmedTotalCost: { |
| | | label: '确认总成本', |
| | | minWidth: 120, |
| | | |
| | | }, |
| | | isCreate: { |
| | | label: '是否已入账', dataType: 'string', |
| | | type: 'select', |
| | | fixed: 'right', |
| | | minWidth: 120, |
| | | search: true, |
| | | dicUrl: '/system/dict/data/type/sys_whether_type', |
| | | }, |
| | | billName: { |
| | | label: '关联账单名称', |
| | | fixed: 'right', |
| | | minWidth: 120, |
| | | search: true, |
| | | }, |
| | | isIncomeMatched: { |
| | | label: '是否匹配收入', |
| | | type: 'select', |
| | | dataType: 'string', |
| | | minWidth: 120, |
| | | |
| | | dicUrl: '/system/dict/data/type/sys_matching_status', |
| | | }, |
| | | isCostMatched: { |
| | | label: '是否匹配成本', |
| | | type: 'select', |
| | | dataType: 'string', |
| | | minWidth: 120, |
| | | dicUrl: '/system/dict/data/type/sys_matching_status', |
| | | }, |
| | | |
| | | |
| | | relatedBillStatus: { |
| | | minWidth: 120, |
| | | label: '关联账单状态', |
| | | dataType: 'string', |
| | | type: 'select', |
| | | dicUrl: '/system/dict/data/type/sys_related_status', |
| | | // formatter: (row, value) => { |
| | | // // 自定义格式化逻辑(如果需要) |
| | | // return value; |
| | | // } |
| | | }, |
| | | // electronicLock: { |
| | | // label: '电子锁', |
| | | // }, |
| | |
| | | crudRef.value.rowEdit(selectionList.value[0]); |
| | | }, |
| | | handleSelectionChangeFunc: (selection: any) => { |
| | | if (selection.every((item: any) => item.isCreate == '0')) { |
| | | generateDisabled.value = false; |
| | | } else { |
| | | generateDisabled.value = true; |
| | | if (selection.length > 0) { |
| | | proxy.$message.warning('请选择未入账的记录'); |
| | | if (selection.length > 0) { |
| | | // 检查是否所有记录都是未入账状态(isCreate == '0') |
| | | const allNotCreated = selection.every((item: any) => item.isCreate == '0'); |
| | | // 检查是否所有记录的客户名称都相同 |
| | | const sameCustomer = selection.every((item: any) => item.customerName === selection[0].customerName); |
| | | |
| | | if (allNotCreated && sameCustomer) { |
| | | generateDisabled.value = false; |
| | | } else { |
| | | generateDisabled.value = true; |
| | | if (!allNotCreated) { |
| | | proxy.$message.warning('请选择未入账的记录'); |
| | | } else if (!sameCustomer) { |
| | | proxy.$message.warning('请选择相同客户名称的记录'); |
| | | } |
| | | } |
| | | } else { |
| | | generateDisabled.value = false; |
| | | } |
| | | selectionList.value = selection; |
| | | selectionList.value = selection; |
| | | } |
| | | }, |
| | | getBeginListFunc: (params = {}) => { |
| | | // 1. 日期转换 |
| | | let newParams = <any>{ ...params }; |
| | | console.log(newParams, '2'); |
| | | if (newParams) { |
| | | // 1. 定义日期字段映射 (数组名 : 接口需要的前缀) |
| | | // 这样写的好处是:如果你有多个日期,直接在这里添加一行即可 |
| | | const dateMap = { |
| | | createdTimeArray: 'createdTime', |
| | | }; |
| | | |
| | | // 2. 遍历处理日期 |
| | | Object.keys(dateMap).forEach(arrayKey => { |
| | | const prefix = dateMap[arrayKey]; |
| | | const range = newParams[arrayKey]; |
| | | |
| | | if (Array.isArray(range) && range.length > 0) { |
| | | // 赋值 Begin 和 End |
| | | newParams[`${prefix}Begin`] = range[0]; |
| | | newParams[`${prefix}End`] = range[1]; |
| | | } |
| | | |
| | | // 【核心改动】:无论是否有值,处理完后都把原始的 Array 字段删掉 |
| | | // 这样请求里就不会出现 confirmTimeRangeArray: [...] |
| | | delete newParams[arrayKey]; |
| | | }); |
| | | |
| | | // 3. 通用清洗:删除所有空字符串、null 或 undefined 的其他字段 |
| | | Object.keys(newParams).forEach(key => { |
| | | const val = newParams[key]; |
| | | if (val === '' || val === null || val === undefined) { |
| | | delete newParams[key]; |
| | | } |
| | | }); |
| | | |
| | | } else { |
| | | newParams = {}; |
| | | } |
| | | |
| | | return newParams; |
| | | |
| | | }, |
| | | |
| | | }) |
| | | const dialog = reactive({ |
| | | visible: false, |
| | |
| | | const dispatchNo = ref(''); |
| | | const handleClick = (tab: TabsPaneContext, event: Event) => { |
| | | if (tab.props.name == 'first') { |
| | | getListVable(dispatchNo.value, 0); |
| | | } else if (tab.props.name == 'second') { |
| | | getListVable(dispatchNo.value, 1); |
| | | } else if (tab.props.name == 'second') { |
| | | getListVable(dispatchNo.value, 0); |
| | | } |
| | | } |
| | | |
| | | const handleFy = (row: any) => { |
| | | dispatchNo.value = row.dispatchNo; |
| | | dialog.title = '费用明细'; |
| | | if (activeName.value == 'first') { |
| | | listEstimatedReceivable({ dispatchNo: row.dispatchNo, feeType: 0 }).then((res) => { |
| | | listEstimatedReceivable({ dispatchNo: row.dispatchNo, feeType: 1, isConfirmed: 1 }).then((res) => { |
| | | if (res.code === 200) { |
| | | dialog.detail = true; |
| | | tableDataList.value = res.rows || []; |
| | |
| | | }) |
| | | } else if (activeName.value == 'second') { |
| | | // 这里可以添加查询收入相关的逻辑 |
| | | listEstimatedReceivable({ dispatchNo: row.dispatchNo, feeType: 1 }).then((res) => { |
| | | listEstimatedReceivable({ dispatchNo: row.dispatchNo, feeType: 0, isConfirmed: 1 }).then((res) => { |
| | | if (res.code === 200) { |
| | | dialog.detail = true; |
| | | tableDataList.value = res.rows || []; |
| | |
| | | } |
| | | } |
| | | const getListVable = (dispatchNo, feeType) => { |
| | | listEstimatedReceivable({ dispatchNo: dispatchNo, feeType: feeType }).then((res) => { |
| | | listEstimatedReceivable({ dispatchNo: dispatchNo, feeType: feeType, isConfirmed: 1 }).then((res) => { |
| | | if (res.code === 200) { |
| | | tableDataList.value = res.rows || []; |
| | | } |
| | |
| | | return sums; |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | :deep(.avue-crud__table) { |
| | | overflow-y: auto; |
| | | } |
| | | |
| | | :deep(.el-scrollbar__bar.is-horizontal) { |
| | | pointer-events: auto; |
| | | } |
| | | </style> |