|  |  | 
 |  |  |             <div class="main-panel"> | 
 |  |  |                 <div style="display: flex;justify-content: space-between;"> | 
 |  |  |                     <div class="section-title">应收应付统计</div> | 
 |  |  |                     <el-radio-group v-model="radio1" size="large" @change="statisticsReceivable"> | 
 |  |  |                         <el-radio-button label="按周" :value="1" /> | 
 |  |  |                         <el-radio-button label="按月" :value="2" /> | 
 |  |  |                         <el-radio-button label="按季度" :value="3" /> | 
 |  |  |                     </el-radio-group> | 
 |  |  | <!--                    <el-radio-group v-model="radio1" size="large" @change="statisticsReceivable">--> | 
 |  |  | <!--                        <el-radio-button label="按周" :value="1" />--> | 
 |  |  | <!--                        <el-radio-button label="按月" :value="2" />--> | 
 |  |  | <!--                        <el-radio-button label="按季度" :value="3" />--> | 
 |  |  | <!--                    </el-radio-group>--> | 
 |  |  |                 </div> | 
 |  |  |                 <Echarts ref="chart" | 
 |  |  |                                  :color="barColors2" | 
 
 |  |  | 
 |  |  |             </el-form-item> | 
 |  |  |           </el-col> | 
 |  |  |         </el-row> | 
 |  |  |         <el-row :gutter="30"> | 
 |  |  |           <el-col :span="12"> | 
 |  |  |             <el-form-item label="试用期(月):" prop="probationPeriod"> | 
 |  |  |               <el-input-number v-model="form.probationPeriod" :precision="0" :step="1" min="0" style="width: 100%"/> | 
 |  |  |             </el-form-item> | 
 |  |  |           </el-col> | 
 |  |  |           <!-- <el-col :span="12"> | 
 |  |  |             <el-form-item label="入职日期:" prop="entryDate"> | 
 |  |  |               <el-date-picker | 
 |  |  |                   v-model="form.entryDate" | 
 |  |  |                   type="date" | 
 |  |  |                   placeholder="请选择日期" | 
 |  |  |                   value-format="YYYY-MM-DD" | 
 |  |  |                   format="YYYY-MM-DD" | 
 |  |  |                   clearable | 
 |  |  |                   style="width: 100%" | 
 |  |  |               /> | 
 |  |  |             </el-form-item> | 
 |  |  |           </el-col> --> | 
 |  |  |         </el-row> | 
 |  |  |       </el-form> | 
 |  |  |       <template #footer> | 
 |  |  |         <div class="dialog-footer"> | 
 |  |  | 
 |  |  | </template> | 
 |  |  |  | 
 |  |  | <script setup> | 
 |  |  | import {ref} from "vue"; | 
 |  |  | import {ref, reactive, toRefs} from "vue"; | 
 |  |  | import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js"; | 
 |  |  | const { proxy } = getCurrentInstance() | 
 |  |  | const emit = defineEmits(['close']) | 
 |  |  | 
 |  |  |     contractStartTime: "", | 
 |  |  |     contractEndTime: "", | 
 |  |  |     staffState: "", | 
 |  |  |     probationPeriod: 3, // 默认试用期3个月 | 
 |  |  |   }, | 
 |  |  |   rules: { | 
 |  |  |     staffNo: [{ required: true, message: "请输入", trigger: "blur" },], | 
 
 |  |  | 
 |  |  |     width:150 | 
 |  |  |   }, | 
 |  |  |   { | 
 |  |  |     label: "合同年限", | 
 |  |  |     label: "试用期(月)", | 
 |  |  |     prop: "probationPeriod", | 
 |  |  |     width: 120, | 
 |  |  |   }, | 
 |  |  |   // { | 
 |  |  |   //   label: "转正日期", | 
 |  |  |   //   prop: "probationEndDate", | 
 |  |  |   //   width: 120, | 
 |  |  |   //   formatData: (row) => { | 
 |  |  |   //     // 修改为使用合同开始日期计算转正日期 | 
 |  |  |   //     if (row.contractStartTime && row.probationPeriod) { | 
 |  |  |   //       // 计算转正日期(合同开始日期加上试用期月数) | 
 |  |  |   //       return dayjs(row.contractStartTime).add(row.probationPeriod, 'month').format('YYYY-MM-DD'); | 
 |  |  |   //     } | 
 |  |  |   //     return ''; | 
 |  |  |   //   }, | 
 |  |  |   //   formatType: (row) => { | 
 |  |  |   //     // 修改为使用合同开始日期检查是否临近转正(7天内) | 
 |  |  |   //     if (row.contractStartTime && row.probationPeriod) { | 
 |  |  |   //       const probationEndDate = dayjs(row.contractStartTime).add(row.probationPeriod, 'month'); | 
 |  |  |   //       const daysUntilProbationEnd = probationEndDate.diff(dayjs(), 'day'); | 
 |  |  |          | 
 |  |  |   //       if (daysUntilProbationEnd >= 0 && daysUntilProbationEnd <= 7) { | 
 |  |  |   //         return 'warning'; // 使用警告样式标记临近转正的员工 | 
 |  |  |   //       } | 
 |  |  |   //     } | 
 |  |  |   //     return ''; | 
 |  |  |   //   } | 
 |  |  |   // }, | 
 |  |  |   { | 
 |  |  |     label: "合同年限(年)", | 
 |  |  |     prop: "contractTerm", | 
 |  |  |     width: 120, | 
 |  |  |   }, | 
 |  |  |   { | 
 |  |  |     label: "合同开始日期", | 
 |  |  | 
 |  |  |     tableLoading.value = false; | 
 |  |  |     tableData.value = res.data.records | 
 |  |  |     page.total = res.data.total; | 
 |  |  |  | 
 |  |  |     // 检查是否有临近转正的员工并提醒 | 
 |  |  |     checkProbationEnding(tableData.value); | 
 |  |  |   }).catch(err => { | 
 |  |  |     tableLoading.value = false; | 
 |  |  |   }) | 
 |  |  | }; | 
 |  |  | // 检查临近转正的员工并提醒 | 
 |  |  | const checkProbationEnding = (data) => { | 
 |  |  |   const probationEndingSoon = []; | 
 |  |  |    | 
 |  |  |   data.forEach(item => { | 
 |  |  |     // 修改为使用合同开始日期检查 | 
 |  |  |     if (item.contractStartTime && item.probationPeriod) { | 
 |  |  |       const probationEndDate = dayjs(item.contractStartTime).add(item.probationPeriod, 'month'); | 
 |  |  |       const daysUntilProbationEnd = probationEndDate.diff(dayjs(), 'day'); | 
 |  |  |        | 
 |  |  |       if (daysUntilProbationEnd >= 0 && daysUntilProbationEnd <= 7) { | 
 |  |  |         probationEndingSoon.push({ | 
 |  |  |           staffName: item.staffName, | 
 |  |  |           probationEndDate: probationEndDate.format('YYYY-MM-DD'), | 
 |  |  |           daysLeft: daysUntilProbationEnd | 
 |  |  |         }); | 
 |  |  |       } | 
 |  |  |     } | 
 |  |  |   }); | 
 |  |  |    | 
 |  |  |   if (probationEndingSoon.length > 0) { | 
 |  |  |     let message = '以下员工将在7天内转正:\n'; | 
 |  |  |     probationEndingSoon.forEach(item => { | 
 |  |  |       message += `${item.staffName}(${item.probationEndDate},还有${item.daysLeft}天)\n`; | 
 |  |  |     }); | 
 |  |  |      | 
 |  |  |     // 显示提醒消息 | 
 |  |  |     proxy.$modal.msgInfo(message); | 
 |  |  |   } | 
 |  |  | }; | 
 |  |  | // 表格选择数据 | 
 |  |  | const handleSelectionChange = (selection) => { | 
 |  |  |   selectedRows.value = selection; | 
 
 |  |  | 
 |  |  |     "contractAmount", | 
 |  |  |     "taxInclusiveTotalPrice", | 
 |  |  |     "taxExclusiveTotalPrice", | 
 |  |  |         'invoiceTotal', | 
 |  |  |         'noInvoiceAmountTotal', | 
 |  |  |         'receiptPaymentAmountTotal', | 
 |  |  |         'noReceiptAmount', | 
 |  |  |   ]); | 
 |  |  | }; | 
 |  |  | // 子表合计方法 |