|
|
|
|
@ -17,24 +17,10 @@
|
|
|
|
|
<el-option v-for="dict in project_category" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="起止日期">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="dateRange[0]"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="YYYY-MM-DD"
|
|
|
|
|
placeholder="开始日期(周一)"
|
|
|
|
|
:disabled-date="disabledDateStart"
|
|
|
|
|
style="width: 150px"
|
|
|
|
|
/>
|
|
|
|
|
<el-form-item label="月份范围">
|
|
|
|
|
<el-date-picker v-model="monthRange[0]" type="month" value-format="YYYYMM" placeholder="起始月份" style="width: 150px" />
|
|
|
|
|
<span class="el-range-separator" style="margin: 0 5px">-</span>
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="dateRange[1]"
|
|
|
|
|
type="date"
|
|
|
|
|
value-format="YYYY-MM-DD"
|
|
|
|
|
placeholder="结束日期(周日)"
|
|
|
|
|
:disabled-date="disabledDateEnd"
|
|
|
|
|
style="width: 150px"
|
|
|
|
|
/>
|
|
|
|
|
<el-date-picker v-model="monthRange[1]" type="month" value-format="YYYYMM" placeholder="结束月份" style="width: 150px" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
|
|
@ -82,6 +68,7 @@ import {
|
|
|
|
|
} from '@/api/oa/erp/timesheetReport';
|
|
|
|
|
import { getErpProjectInfoList } from '@/api/oa/erp/projectInfo';
|
|
|
|
|
import { allListDept, listDept } from '@/api/system/dept';
|
|
|
|
|
import { FormInstance } from 'element-plus';
|
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
const { project_category } = toRefs<any>(proxy?.useDict('project_category'));
|
|
|
|
|
@ -92,11 +79,12 @@ const showSearch = ref(true);
|
|
|
|
|
const ids = ref<Array<string | number>>([]);
|
|
|
|
|
const single = ref(true);
|
|
|
|
|
const multiple = ref(true);
|
|
|
|
|
const dateRange = ref<[string, string]>(['', '']);
|
|
|
|
|
const monthRange = ref<[string, string]>(['', '']);
|
|
|
|
|
|
|
|
|
|
const projectOptions = ref<any[]>([]);
|
|
|
|
|
const deptOptions = ref<any[]>([]);
|
|
|
|
|
const projectLoading = ref(false);
|
|
|
|
|
const queryRef = ref<FormInstance>();
|
|
|
|
|
|
|
|
|
|
const queryParams = ref<ProjectManHourReportQuery>({
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
@ -108,19 +96,22 @@ const queryParams = ref<ProjectManHourReportQuery>({
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const totalHoursLabel = computed(() => {
|
|
|
|
|
if (dateRange.value && dateRange.value[0] && dateRange.value[1]) {
|
|
|
|
|
return `当月工时 (${dateRange.value[0]} 至 ${dateRange.value[1]})`;
|
|
|
|
|
if (monthRange.value && monthRange.value[0] && monthRange.value[1]) {
|
|
|
|
|
const start = monthRange.value[0];
|
|
|
|
|
const end = monthRange.value[1];
|
|
|
|
|
const fmt = (m: string) => m.substring(0, 4) + '年' + m.substring(4) + '月';
|
|
|
|
|
return `工时 (${fmt(start)} 至 ${fmt(end)})`;
|
|
|
|
|
}
|
|
|
|
|
return '当月工时';
|
|
|
|
|
return '工时';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/** 查询列表 */
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true;
|
|
|
|
|
const params = { ...queryParams.value };
|
|
|
|
|
if (dateRange.value) {
|
|
|
|
|
params.startTime = dateRange.value[0];
|
|
|
|
|
params.endTime = dateRange.value[1];
|
|
|
|
|
if (monthRange.value && monthRange.value[0] && monthRange.value[1]) {
|
|
|
|
|
params.startTime = monthRange.value[0];
|
|
|
|
|
params.endTime = monthRange.value[1];
|
|
|
|
|
}
|
|
|
|
|
const res = await listProjectManHourReport(params);
|
|
|
|
|
reportList.value = res.data;
|
|
|
|
|
@ -146,17 +137,17 @@ const handleSelectionChange = (selection: ProjectManHourReportVO[]) => {
|
|
|
|
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
const resetQuery = () => {
|
|
|
|
|
dateRange.value = ['', ''];
|
|
|
|
|
(proxy as any)?.resetForm('queryRef');
|
|
|
|
|
monthRange.value = ['', ''];
|
|
|
|
|
queryRef.value?.resetFields();
|
|
|
|
|
handleQuery();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
const handleExport = () => {
|
|
|
|
|
const params = { ...queryParams.value };
|
|
|
|
|
if (dateRange.value) {
|
|
|
|
|
params.startTime = dateRange.value[0];
|
|
|
|
|
params.endTime = dateRange.value[1];
|
|
|
|
|
if (monthRange.value && monthRange.value[0] && monthRange.value[1]) {
|
|
|
|
|
params.startTime = monthRange.value[0];
|
|
|
|
|
params.endTime = monthRange.value[1];
|
|
|
|
|
}
|
|
|
|
|
proxy?.download('/oa/erp/timesheetReport/exportProjectManHour', params, `项目工时统计报表_${new Date().getTime()}.xlsx`);
|
|
|
|
|
};
|
|
|
|
|
@ -213,16 +204,6 @@ const getDeptList = async () => {
|
|
|
|
|
deptOptions.value = res.data || res.rows || [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 禁用非周一的日期 */
|
|
|
|
|
const disabledDateStart = (date: Date) => {
|
|
|
|
|
// getDay() 返回 0=周日, 1=周一
|
|
|
|
|
return date.getDay() !== 1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const disabledDateEnd = (date: Date) => {
|
|
|
|
|
return date.getDay() !== 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const spanArr = ref<number[]>([]);
|
|
|
|
|
const pos = ref(0);
|
|
|
|
|
|
|
|
|
|
|