|
@@ -0,0 +1,287 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="app-container">
|
|
|
|
+ <el-row :gutter="20" v-show="headList.length > 0">
|
|
|
|
+ <el-col
|
|
|
|
+ :span="2"
|
|
|
|
+ :xs="24"
|
|
|
|
+ style="padding-left: 0; padding-right: 0; overflow-x: auto"
|
|
|
|
+ v-show="showSearch"
|
|
|
|
+ >
|
|
|
|
+ <div
|
|
|
|
+ class="head-container"
|
|
|
|
+ :style="deptOptions.length > 0 ? 'display: flex;' : ''"
|
|
|
|
+ >
|
|
|
|
+ <el-tree
|
|
|
|
+ :data="deptOptions"
|
|
|
|
+ :props="defaultProps"
|
|
|
|
+ ref="tree"
|
|
|
|
+ highlight-current
|
|
|
|
+ expand-on-click-node
|
|
|
|
+ accordion
|
|
|
|
+ @node-click="handleNodeClick"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </el-col>
|
|
|
|
+ <!--用户数据-->
|
|
|
|
+ <el-col :span="22" :xs="24">
|
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
+ <el-button
|
|
|
|
+ type="warning"
|
|
|
|
+ plain
|
|
|
|
+ icon="el-icon-download"
|
|
|
|
+ size="mini"
|
|
|
|
+ @click="handleExport"
|
|
|
|
+ v-hasPermi="['system:record:export']"
|
|
|
|
+ >导出</el-button
|
|
|
|
+ >
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row class="title">{{ this.headData.tableName }}</el-row>
|
|
|
|
+ <el-row class="head">
|
|
|
|
+ <el-col :span="8">单位:{{ this.headData.companyName }}</el-col>
|
|
|
|
+ <el-col :span="8" style="text-align: center"
|
|
|
|
+ >所属事业部:{{ this.headData.departmentName }}</el-col
|
|
|
|
+ >
|
|
|
|
+ <el-col :span="8" style="text-align: right"
|
|
|
|
+ >课题名称:{{ this.headData.projectName }}</el-col
|
|
|
|
+ >
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-table v-loading="loading" :data="userList" border>
|
|
|
|
+ <el-table-column
|
|
|
|
+ label="姓名"
|
|
|
|
+ align="center"
|
|
|
|
+ key="name"
|
|
|
|
+ prop="name"
|
|
|
|
+ show-overflow-tooltip
|
|
|
|
+ >
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="星期" align="center">
|
|
|
|
+ <el-table-column
|
|
|
|
+ label="类型"
|
|
|
|
+ align="center"
|
|
|
|
+ width="80"
|
|
|
|
+ key="type"
|
|
|
|
+ prop="type"
|
|
|
|
+ show-overflow-tooltip
|
|
|
|
+ />
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ v-for="(item, index) in headList"
|
|
|
|
+ :label="item.week"
|
|
|
|
+ width="40"
|
|
|
|
+ align="center"
|
|
|
|
+ >
|
|
|
|
+ <el-table-column
|
|
|
|
+ :label="item.date.toString()"
|
|
|
|
+ align="center"
|
|
|
|
+ width="40"
|
|
|
|
+ key="dateList"
|
|
|
|
+ prop="dateList"
|
|
|
|
+ >
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ {{ scope.row.dateList[index] == 0 ? "" : scope.row.dateList[index] }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="正常出勤" align="center">
|
|
|
|
+ <el-table-column
|
|
|
|
+ label="工时"
|
|
|
|
+ width="73"
|
|
|
|
+ align="center"
|
|
|
|
+ key="duration"
|
|
|
|
+ prop="duration"
|
|
|
|
+ />
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ label="分摊率"
|
|
|
|
+ align="center"
|
|
|
|
+ width="60"
|
|
|
|
+ key="proportion"
|
|
|
|
+ prop="proportion"
|
|
|
|
+ >
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ {{ (scope.row.proportion * 100).toFixed(0) + "%" }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-col
|
|
|
|
+ :gutter="20"
|
|
|
|
+ style="text-align: center; font-size: 24px"
|
|
|
|
+ v-show="headList.length == 0"
|
|
|
|
+ >
|
|
|
|
+ 暂无数据
|
|
|
|
+ </el-col>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { allProjectMonthData, listJournal } from "@/api/rd/journal";
|
|
|
|
+import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+ name: "Journal",
|
|
|
|
+ components: { Treeselect },
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ loading: true,
|
|
|
|
+ // 显示搜索条件
|
|
|
|
+ showSearch: true,
|
|
|
|
+ // 用户表格数据
|
|
|
|
+ userList: null,
|
|
|
|
+ // 部门树选项
|
|
|
|
+ deptOptions: [],
|
|
|
|
+ // 默认密码
|
|
|
|
+ initPassword: undefined,
|
|
|
|
+ defaultProps: {
|
|
|
|
+ children: "children",
|
|
|
|
+ label: "label",
|
|
|
|
+ },
|
|
|
|
+ // 查询参数
|
|
|
|
+ queryParams: {
|
|
|
|
+ id: undefined,
|
|
|
|
+ yearMonth: undefined,
|
|
|
|
+ },
|
|
|
|
+ headList: [],
|
|
|
|
+ headData: {},
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ watch: {},
|
|
|
|
+ created() {
|
|
|
|
+ this.getDeptTree();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ /** 查询列表 */
|
|
|
|
+ getList() {
|
|
|
|
+ this.loading = true;
|
|
|
|
+ listJournal(this.queryParams).then((response) => {
|
|
|
|
+ this.headData = {
|
|
|
|
+ tableName: response.data.tableName,
|
|
|
|
+ projectName: response.data.projectName,
|
|
|
|
+ companyName: response.data.companyName,
|
|
|
|
+ departmentName: response.data.departmentName,
|
|
|
|
+ };
|
|
|
|
+ this.headList = response.data?.list?.[0].data;
|
|
|
|
+ let list = response.data.list || [];
|
|
|
|
+ let dataS = [];
|
|
|
|
+ for (var i = 0; i < list.length; i++) {
|
|
|
|
+ let dateList1 = [];
|
|
|
|
+ let dateList2 = [];
|
|
|
|
+ for (var j = 0; j < list[i].data.length; j++) {
|
|
|
|
+ dateList1.push(list[i].data[j].projectDuration);
|
|
|
|
+ dateList2.push(list[i].data[j].notDuration);
|
|
|
|
+ }
|
|
|
|
+ let a = {
|
|
|
|
+ name: list[i].name,
|
|
|
|
+ type: "研发工时",
|
|
|
|
+ duration: list[i].projectDuration,
|
|
|
|
+ proportion: list[i].projectProportion,
|
|
|
|
+ dateList: dateList1,
|
|
|
|
+ };
|
|
|
|
+ dataS.push(a);
|
|
|
|
+ let b = {
|
|
|
|
+ name: list[i].name,
|
|
|
|
+ type: "非研发工时",
|
|
|
|
+ duration: list[i].notDuration,
|
|
|
|
+ proportion: list[i].notProportion,
|
|
|
|
+ dateList: dateList2,
|
|
|
|
+ };
|
|
|
|
+ dataS.push(b);
|
|
|
|
+ }
|
|
|
|
+ this.userList = dataS;
|
|
|
|
+ this.loading = false;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ /** 查询下拉树结构 */
|
|
|
|
+ getDeptTree() {
|
|
|
|
+ allProjectMonthData().then((response) => {
|
|
|
|
+ if (response.data.length > 0) {
|
|
|
|
+ const newList = response.data.map((item) => {
|
|
|
|
+ if (item.projectList.length > 0) {
|
|
|
|
+ item.projectList = item.projectList.map((itx) => {
|
|
|
|
+ if (itx.months.length > 0) {
|
|
|
|
+ itx.months = itx.months.map((it) => ({
|
|
|
|
+ id: itx.id,
|
|
|
|
+ label: it,
|
|
|
|
+ children: [],
|
|
|
|
+ }));
|
|
|
|
+ }
|
|
|
|
+ return { id: itx.id, label: itx.name, children: itx.months };
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ return { label: item.companyName, children: item.projectList };
|
|
|
|
+ });
|
|
|
|
+ this.deptOptions = newList;
|
|
|
|
+ this.queryParams = {
|
|
|
|
+ id: newList[0].children[0].id,
|
|
|
|
+ yearMonth: newList[0].children[0].children[0].label,
|
|
|
|
+ };
|
|
|
|
+ this.getList();
|
|
|
|
+ } else {
|
|
|
|
+ this.deptOptions = [];
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 节点单击事件
|
|
|
|
+ handleNodeClick(data) {
|
|
|
|
+ if (!!data.id && data.children.length == 0) {
|
|
|
|
+ this.queryParams.id = data.id;
|
|
|
|
+ this.queryParams.yearMonth = data.label;
|
|
|
|
+ } else {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // if (!!data.id) {
|
|
|
|
+ // this.queryParams.id = data.id;
|
|
|
|
+ // if (data.children.length == 0) {
|
|
|
|
+ // // 点击日期
|
|
|
|
+ // this.queryParams.yearMonth = data.label;
|
|
|
|
+ // } else {
|
|
|
|
+ // // 点击项目
|
|
|
|
+ // this.queryParams.yearMonth = data.children[0].label;
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // // 点击公司
|
|
|
|
+ // this.queryParams.id = data.children[0].id;
|
|
|
|
+ // this.queryParams.yearMonth = data.children[0].children[0].label;
|
|
|
|
+ // }
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+ /** 导出按钮操作 */
|
|
|
|
+ handleExport() {
|
|
|
|
+ this.download(
|
|
|
|
+ "api/project/getMonthClockExport",
|
|
|
|
+ {
|
|
|
|
+ ...this.queryParams,
|
|
|
|
+ },
|
|
|
|
+ `project_record_${new Date().getTime()}.xlsx`
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="scss">
|
|
|
|
+.mb8 {
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-direction: row-reverse;
|
|
|
|
+}
|
|
|
|
+.title {
|
|
|
|
+ text-align: center;
|
|
|
|
+ font-size: 30px;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ margin-bottom: 30px;
|
|
|
|
+}
|
|
|
|
+.head {
|
|
|
|
+ font-size: 18px;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ margin-bottom: 10px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.el-table .cell {
|
|
|
|
+ padding-left: 0;
|
|
|
|
+ padding-right: 0;
|
|
|
|
+}
|
|
|
|
+</style>
|