|
|
@@ -5,9 +5,7 @@
|
|
|
v-on="onEvent"
|
|
|
v-model="form"
|
|
|
:page.sync="page"
|
|
|
- :before-open="handleBeforeOpen"
|
|
|
:header-cell-style="headerCellStyle"
|
|
|
- :span-method="spanMethod"
|
|
|
>
|
|
|
<template slot="menuLeft">
|
|
|
<el-button
|
|
|
@@ -25,7 +23,35 @@
|
|
|
<year-month-select v-model="params.yearAndMonth" :showAllYear="false"></year-month-select>
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
+
|
|
|
+ <template slot="gslb" slot-scope="{ row }">
|
|
|
+ <div v-if="row.dailyHoursList.length" class="custom-cell">
|
|
|
+ <div class="custom-cell-line">研发工时</div>
|
|
|
+ <div class="custom-cell-line">非研发工时</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-for="col of allMonthCols" :slot="col" slot-scope="{ row }">
|
|
|
+ <div v-if="row.dailyHoursList.length" class="custom-cell" :key="col">
|
|
|
+ <div class="custom-cell-line">{{ row.dailyHoursList[0] ? row.dailyHoursList[0][col] : '' }}</div>
|
|
|
+ <div class="custom-cell-line">{{ row.dailyHoursList[1] ? row.dailyHoursList[1][col] : '' }}</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template slot="hoursTotal" slot-scope="{ row }">
|
|
|
+ <div v-if="row.dailyHoursList.length" class="custom-cell">
|
|
|
+ <div class="custom-cell-line">{{ row.workHoursTotal }}</div>
|
|
|
+ <div class="custom-cell-line">{{ row.unworkHoursTotal }}</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template slot="hoursRate" slot-scope="{ row }">
|
|
|
+ <div v-if="row.dailyHoursList.length" class="custom-cell">
|
|
|
+ <div class="custom-cell-line">{{ row.workHoursRate }}</div>
|
|
|
+ <div class="custom-cell-line">{{ row.unworkHoursRate }}</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
</avue-crud>
|
|
|
|
|
|
<WideTablePrinter
|
|
|
@@ -62,6 +88,8 @@ export default window.$crudCommon({
|
|
|
|
|
|
wideTableColumns: [],
|
|
|
printTitle: "",
|
|
|
+
|
|
|
+ allMonthCols: [],
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -79,33 +107,12 @@ export default window.$crudCommon({
|
|
|
this.option.column = deepClone(this.defaultColumns);
|
|
|
},
|
|
|
methods: {
|
|
|
- loadData() {},
|
|
|
- spanMethod({ row, column, rowIndex, columnIndex }) {
|
|
|
- let fields = ["xm", "number", "idCard", "personnelType"];
|
|
|
- let cellValue = row[column.property];
|
|
|
- if (cellValue && fields.includes(column.property)) {
|
|
|
- let prevRow = this.data[rowIndex - 1];
|
|
|
- let nextRow = this.data[rowIndex + 1];
|
|
|
- if (prevRow && prevRow[column.property] === cellValue) {
|
|
|
- return { rowspan: 0, colspan: 0 };
|
|
|
- } else {
|
|
|
- let countRowspan = 1;
|
|
|
- while (nextRow && nextRow[column.property] === cellValue) {
|
|
|
- nextRow = this.data[++countRowspan + rowIndex];
|
|
|
- }
|
|
|
- if (countRowspan > 1) {
|
|
|
- row.hbFlag = true;
|
|
|
- return { rowspan: countRowspan, colspan: 1 };
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
refreshTableCol(yearAndMonth) {
|
|
|
let yearMonth = moment(yearAndMonth).format("YYYY-MM").split("-");
|
|
|
const monthDays = getMonthDatesWithMarkers(Number(yearMonth[0]), Number(yearMonth[1]));
|
|
|
|
|
|
let newColumns = deepClone(this.defaultColumns);
|
|
|
-
|
|
|
+ this.allMonthCols = [];
|
|
|
monthDays.forEach((item) => {
|
|
|
let col = {
|
|
|
prop: moment(item.dateString).format('yyyyMMDD'),
|
|
|
@@ -124,16 +131,17 @@ export default window.$crudCommon({
|
|
|
col.labelClassName = 'red';
|
|
|
}
|
|
|
newColumns.push(col);
|
|
|
+ this.allMonthCols.push(moment(item.dateString).format('yyyyMMDD'));
|
|
|
});
|
|
|
newColumns.push({
|
|
|
- prop: "hj",
|
|
|
+ prop: "hoursTotal",
|
|
|
label: "合计",
|
|
|
- width: 60,
|
|
|
+ width: 50,
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true,
|
|
|
display: false,
|
|
|
}, {
|
|
|
- prop: "gsfpl",
|
|
|
+ prop: "hoursRate",
|
|
|
label: "工时分配率",
|
|
|
width: 60,
|
|
|
align: 'center',
|
|
|
@@ -141,10 +149,10 @@ export default window.$crudCommon({
|
|
|
display: false,
|
|
|
});
|
|
|
|
|
|
- this.option.column = newColumns;
|
|
|
+ this.option.column = [...newColumns];
|
|
|
},
|
|
|
handleExport() {
|
|
|
- exportBlob(`/api/kd-scientific/attendance/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
|
|
|
+ exportBlob(`/api/kd-scientific/xm/technician/hours/myyfgsfpb/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
|
|
|
downloadXls(res.data, `${this.params.yearAndMonth}研发工时分配表.xlsx`);
|
|
|
});
|
|
|
},
|
|
|
@@ -170,21 +178,37 @@ export default window.$crudCommon({
|
|
|
// 模块路径
|
|
|
name: 'yfCostManage/yfCostStatistics/yfWorkHoursAllocationList',
|
|
|
res: ({ data }) => {
|
|
|
- let newList = [];
|
|
|
- data.records.forEach((item) => {
|
|
|
- let objData = {
|
|
|
- ...item,
|
|
|
- id: item.unicode,
|
|
|
- monthlyHours: (item.monthlyHours || 0).toFixed(1),
|
|
|
- monthlyDays: (item.monthlyDays || 0).toFixed(1)
|
|
|
- };
|
|
|
- item.dailyAttendances.forEach(hourItem => {
|
|
|
- objData[hourItem.workDate] = (hourItem.workHours || 0).toFixed(1);
|
|
|
- });
|
|
|
- newList.push(objData);
|
|
|
+ data.records = data.records.map(item => {
|
|
|
+ if (item.dailyHoursList && item.dailyHoursList.length) {
|
|
|
+ let newDailyHoursList = [
|
|
|
+ {gslb: '研发工时', hoursTotal: item.workHoursTotal, hoursRate: (item.workHoursRate * 100).toFixed(2)},
|
|
|
+ {gslb: '非研发工时', hourTotal: item.unworkHoursTotal, hoursRate: (item.unworkHoursRate * 100).toFixed(2)}
|
|
|
+ ];
|
|
|
+ item.dailyHoursList.forEach(hourItem => {
|
|
|
+ newDailyHoursList[0][hourItem.workDate] = hourItem.workHours;
|
|
|
+ newDailyHoursList[1][hourItem.workDate] = hourItem.unworkHours;
|
|
|
+ });
|
|
|
+
|
|
|
+ item.dailyHoursList = newDailyHoursList;
|
|
|
+ item.workHoursRate = (item.workHoursRate * 100).toFixed(2);
|
|
|
+ item.unworkHoursRate = (item.unworkHoursRate * 100).toFixed(2);
|
|
|
+ }
|
|
|
+ return item;
|
|
|
});
|
|
|
- data.records = newList;
|
|
|
return data;
|
|
|
},
|
|
|
});
|
|
|
</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.custom-cell {
|
|
|
+ margin: 0 -10px;
|
|
|
+ &-line {
|
|
|
+ border-bottom: 1px solid #EBEEF5;
|
|
|
+ line-height: 24px;
|
|
|
+ &:last-child {
|
|
|
+ border-bottom: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|