Browse Source

研发工时记录表

dev01 4 weeks ago
parent
commit
7104e7eced

BIN
1.5.zip


+ 21 - 0
src/api/rd/journal.js

@@ -0,0 +1,21 @@
+import request from '@/utils/request'
+import { parseStrEmpty } from "@/utils/ruoyi";
+
+
+// 
+export function allProjectMonthData(query) {
+  return request({
+    url: '/api/project/allProjectMonthData',
+    method: 'get',
+    params: query
+  })
+}
+
+// 
+export function listJournal(query) {
+  return request({
+    url: '/api/project/getMonthClock',
+    method: 'get',
+    params: query
+  })
+}

src/api/system/record.js → src/api/rd/record.js


+ 287 - 0
src/views/rd/journal/index.vue

@@ -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>

+ 3 - 15
src/views/system/record/index.vue

@@ -172,7 +172,6 @@
               icon="el-icon-upload2"
               size="mini"
               @click="handleImport"
-              v-hasPermi="['system:record:import']"
               >导入</el-button
             >
           </el-col>
@@ -183,7 +182,6 @@
               icon="el-icon-download"
               size="mini"
               @click="handleExport"
-              v-hasPermi="['system:record:export']"
               >导出</el-button
             >
           </el-col>
@@ -195,7 +193,6 @@
               size="mini"
               :disabled="multiple"
               @click="handleDownload"
-              v-hasPermi="['system:record:export']"
               >下载附件</el-button
             >
           </el-col>
@@ -213,11 +210,7 @@
             />
           </el-col>
           <el-col :span="1.5">
-            <el-button
-              type="primary"
-              size="mini"
-              @click="handleImports"
-              v-hasPermi="['system:record:import']"
+            <el-button type="primary" size="mini" @click="handleImports"
               >导入考勤</el-button
             >
           </el-col>
@@ -225,12 +218,7 @@
             <el-button type="primary" size="mini" @click="mateHours">匹配工时</el-button>
           </el-col>
           <el-col :span="1.5">
-            <el-button
-              type="primary"
-              size="mini"
-              :disabled="multiple"
-              @click="chainUp"
-              v-hasPermi="[`system:record:chainup`]"
+            <el-button type="primary" size="mini" :disabled="multiple" @click="chainUp"
               >上链确权</el-button
             >
           </el-col>
@@ -677,7 +665,7 @@ import {
   UserClockDetails,
   updateUserClockDetails,
   saveProjectStaffRecordTianhe,
-} from "@/api/system/record";
+} from "@/api/rd/record";
 import { deptTreeSelect } from "@/api/system/user";
 import { getToken } from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";

+ 9 - 2
src/views/system/menu/index.vue

@@ -79,18 +79,25 @@
           <svg-icon :icon-class="scope.row.icon" />
         </template>
       </el-table-column>
-      <el-table-column prop="orderNum" label="排序" width="60"></el-table-column>
+      <el-table-column
+        prop="orderNum"
+        label="排序"
+        align="center"
+        width="60"
+      ></el-table-column>
       <el-table-column
         prop="perms"
         label="权限标识"
+        align="center"
         :show-overflow-tooltip="true"
       ></el-table-column>
       <el-table-column
         prop="component"
         label="组件路径"
+        align="center"
         :show-overflow-tooltip="true"
       ></el-table-column>
-      <el-table-column prop="status" label="状态" width="80">
+      <el-table-column prop="status" label="状态" align="center" width="80">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status" />
         </template>

+ 4 - 2
src/views/system/role/index.vue

@@ -117,20 +117,22 @@
       @cell-dblclick="handleUpdate"
     >
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="角色编号" prop="roleId" width="120" />
+      <el-table-column label="角色编号" align="center" prop="roleId" width="120" />
       <el-table-column
         label="角色名称"
+        align="center"
         prop="roleName"
         :show-overflow-tooltip="true"
         width="150"
       />
       <el-table-column
         label="权限字符"
+        align="center"
         prop="roleKey"
         :show-overflow-tooltip="true"
         width="150"
       />
-      <el-table-column label="显示顺序" prop="roleSort" width="100" />
+      <el-table-column label="显示顺序" align="center" prop="roleSort" width="100" />
       <el-table-column label="状态" align="center" width="100">
         <template slot-scope="scope">
           <el-switch