|
|
@@ -11,6 +11,15 @@
|
|
|
>
|
|
|
<template slot="menuLeft">
|
|
|
<el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ plain
|
|
|
+ @click="handleDelete"
|
|
|
+ >
|
|
|
+ 清除工时数据
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
type="warning"
|
|
|
size="small"
|
|
|
plain
|
|
|
@@ -26,17 +35,20 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
- <!-- 使用工时 -->
|
|
|
- <template slot="gsTotalSearch">
|
|
|
+
|
|
|
+ <template slot="monthlyHoursSearch">
|
|
|
<div style="display: flex; align-items: center;">
|
|
|
- <avue-input-number v-model="params.gsTotalStart" :min="0"></avue-input-number>
|
|
|
- <span style="width: 70px; text-align: center;">至</span>
|
|
|
- <avue-input-number v-model="params.gsTotalEnd" :min="0"></avue-input-number>
|
|
|
+ <span>使用工时/小时:</span>
|
|
|
+ <avue-input-number v-model="params.monthlyHoursStart" :min="0" style="width: 100px !important;"></avue-input-number>
|
|
|
+ <span style="width: 20px; text-align: center;">至</span>
|
|
|
+ <avue-input-number v-model="params.monthlyHoursEnd" :min="0" style="width: 100px !important;"></avue-input-number>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
</avue-crud>
|
|
|
|
|
|
+ <upload-excel-dialog ref="uploadExcelDialog" :uploadAfter="uploadAfter"/>
|
|
|
+
|
|
|
<WideTablePrinter
|
|
|
ref="printWideTable"
|
|
|
:columns="wideTableColumns"
|
|
|
@@ -51,6 +63,9 @@
|
|
|
<script>
|
|
|
import YearMonthSelect from "@/components/year-month-select";
|
|
|
import UploadExcelDialog from "@/components/upload-excel-dialog";
|
|
|
+import {exportBlob} from "@/api/common";
|
|
|
+import {getToken} from "@/util/auth";
|
|
|
+import {downloadXls} from "@/util/util";
|
|
|
import { deepClone, getMonthDatesWithMarkers } from "@/util/util";
|
|
|
import moment from "moment";
|
|
|
import ChineseHoliday from "@chnlib/chinese-holiday";
|
|
|
@@ -87,7 +102,6 @@ export default window.$crudCommon({
|
|
|
this.option.column = deepClone(this.defaultColumns);
|
|
|
},
|
|
|
methods: {
|
|
|
- loadData() {},
|
|
|
refreshTableCol(yearAndMonth) {
|
|
|
let yearMonth = moment(yearAndMonth).format("YYYY-MM").split("-");
|
|
|
const monthDays = getMonthDatesWithMarkers(Number(yearMonth[0]), Number(yearMonth[1]));
|
|
|
@@ -113,15 +127,80 @@ export default window.$crudCommon({
|
|
|
newColumns.push(col);
|
|
|
});
|
|
|
|
|
|
+ newColumns.push({
|
|
|
+ prop: "monthlyHours",
|
|
|
+ label: "研发出勤/小时",
|
|
|
+ type: 'number',
|
|
|
+ precision: 1,
|
|
|
+ min: 0,
|
|
|
+ width: 70,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ display: false,
|
|
|
+ search: true,
|
|
|
+ }, {
|
|
|
+ prop: "monthlyDays",
|
|
|
+ label: "研发出勤/天",
|
|
|
+ type: 'number',
|
|
|
+ precision: 1,
|
|
|
+ min: 0,
|
|
|
+ width: 70,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ display: false,
|
|
|
+ });
|
|
|
+
|
|
|
this.option.column = newColumns;
|
|
|
},
|
|
|
+ handleImport() {
|
|
|
+ let excelParams = { yearAndMonth: this.params.yearAndMonth };
|
|
|
+ this.$refs.uploadExcelDialog.open('/api/kd-scientific/xm/technician/hours/import', excelParams);
|
|
|
+ },
|
|
|
+ uploadAfter() {
|
|
|
+ this.page.currentPage = 1;
|
|
|
+ this.getList(this.page);
|
|
|
+ },
|
|
|
+ getFormData() {
|
|
|
+ const newFormData = { ...this.form, yearAndMonth: this.params.yearAndMonth };
|
|
|
+ let dailyAttendances = [];
|
|
|
+ Object.keys(this.form).forEach(key => {
|
|
|
+ if (key.indexOf(this.params.yearAndMonth) > -1) {
|
|
|
+ if (this.form[key]) {
|
|
|
+ dailyAttendances.push({
|
|
|
+ workDate: key,
|
|
|
+ workHours: this.form[key]
|
|
|
+ });
|
|
|
+ }
|
|
|
+ delete newFormData[key];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ newFormData.dailyAttendances = dailyAttendances;
|
|
|
+ return newFormData;
|
|
|
+ },
|
|
|
+ getDelParams(row) {
|
|
|
+ return [{ yearAndMonth: this.params.yearAndMonth, unicode: row.unicode }]
|
|
|
+ },
|
|
|
+ getBatchDelParams() {
|
|
|
+ let delArr = [];
|
|
|
+ this.data.forEach(item => {
|
|
|
+ if (this.ids.indexOf(item.id) > -1) {
|
|
|
+ delArr.push({ yearAndMonth: this.params.yearAndMonth, unicode: item.unicode });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return delArr;
|
|
|
+ },
|
|
|
+ handleExport() {
|
|
|
+ exportBlob(`/api/kd-scientific/xm/technician/hours/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
|
|
|
+ downloadXls(res.data, `${this.params.yearAndMonth}研发人员工时记录表.xlsx`);
|
|
|
+ });
|
|
|
+ },
|
|
|
/**
|
|
|
* 打印表格
|
|
|
* @param isLandscape 是否横向打印
|
|
|
*/
|
|
|
printTable(isLandscape) {
|
|
|
this.wideTableColumns = this.$refs.crud.columnOption;
|
|
|
- this.printTitle = `仪器设备工时记录表${this.params.yearAndMonth}`;
|
|
|
+ this.printTitle = `${this.params.yearAndMonth}研发人员工时记录表`;
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.printWideTable.printTable(isLandscape);
|
|
|
})
|
|
|
@@ -137,6 +216,20 @@ export default window.$crudCommon({
|
|
|
// 模块路径
|
|
|
name: 'yfCostManage/basicDataSetting/workHoursRecords',
|
|
|
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 = newList;
|
|
|
return data;
|
|
|
},
|
|
|
});
|