From 14d29f928b24d203e76f1dcefc1a51182657cd45 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 10 三月 2025 16:29:09 +0800
Subject: [PATCH] Merge branch 'dev' of http://114.132.189.42:9002/r/center-lims-before-ruoyi into dev

---
 src/views/CNAS/personnel/personnelInfo/Department/components/TrainingRecord/index.vue |  285 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 285 insertions(+), 0 deletions(-)

diff --git a/src/views/CNAS/personnel/personnelInfo/Department/components/TrainingRecord/index.vue b/src/views/CNAS/personnel/personnelInfo/Department/components/TrainingRecord/index.vue
new file mode 100644
index 0000000..4f228e4
--- /dev/null
+++ b/src/views/CNAS/personnel/personnelInfo/Department/components/TrainingRecord/index.vue
@@ -0,0 +1,285 @@
+<!-- 鍩硅璁板綍 -->
+<template>
+  <div>
+    <div class="flex_table">
+      <div v-if="isDepartment" style="width: 50%">
+        <TableCard :showTitle="false">
+          <template v-slot:form>
+            <div class="items_center">
+              <span>濮撳悕</span>
+              <el-input v-model="trainingPagination.userName" class="search" clearable placeholder="璇疯緭鍏�"
+                size="small"></el-input>
+              <el-button size="small" type="primary" @click="getPersonnelTraining(departId)">鏌ヨ</el-button>
+            </div>
+            <div>
+              <!--              <el-button :loading="outLoading" size="small" type="primary" @click="exportExcel">瀵煎嚭</el-button>-->
+            </div>
+          </template>
+          <template v-slot:table>
+            <limsTable :column="trainingColumn" :currentChange="currentChange" :height="'calc(100vh - 18em)'"
+              :highlightCurrentRow="true" :table-data="trainingTableData" :table-loading="trainingLoading"
+              style="padding: 0 15px;" :page="trainingPagination" @pagination="trainingPaginationMethod">
+            </limsTable>
+          </template>
+        </TableCard>
+      </div>
+      <div :style="`width: ${isDepartment ? '50%' : '100%'};`">
+        <TableCard :showTitle="false">
+          <template v-slot:form>
+            <div class="items_center">
+              <span>骞翠唤</span>
+              <el-date-picker v-model="searchForm.trainingDate" clearable format="yyyy" placeholder="閫夋嫨骞�" size="small"
+                style="margin: 0 10px" type="year" value-format="yyyy">
+              </el-date-picker>
+              <el-button size="small" type="primary"
+                @click="queryPersonnelDetailsPage(currentChangeRow.userId)">鏌ヨ</el-button>
+              <el-button size="small" type="primary" @click="openDownloadDia(currentChangeRow)">瀵煎嚭</el-button>
+            </div>
+          </template>
+          <template v-slot:table>
+            <limsTable :column="trainingPersonColumn" :height="'calc(100vh - 18em)'"
+              :table-data="trainingPersonTableData" :table-loading="trainingPersonLoading" style="padding: 0 15px;"
+              :page="trainingPersonPagination" @pagination="trainingPersonPaginationMethod">
+            </limsTable>
+          </template>
+        </TableCard>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import limsTable from "@/components/Table/lims-table.vue";
+import TableCard from "@/components/TableCard/index.vue";
+import {
+  exportTrainingRecord,
+  trainingSelectTrainingRecord,
+  queryPersonnelDetails,
+} from '@/api/cnas/personnel/personnelInfo.js'
+export default {
+  components: { TableCard, limsTable },
+  props: {
+    departId: {
+      type: Number,
+      default: () => {
+        return null;
+      }
+    },
+    isDepartment: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data() {
+    return {
+      outLoading: false,
+      trainingForm: {},
+      trainingColumn: [
+        {
+          label: '鍛樺伐缂栧彿',
+          prop: 'account',
+          width: '100'
+        }, {
+          label: '濮撳悕',
+          prop: 'name'
+        }, {
+          label: '鎵�鍦ㄩ儴闂�',
+          prop: 'departLimsName',
+          width: '150'
+        }, {
+          label: '鑱岀О',
+          prop: 'professionalTitle'
+        }, {
+          label: '鏈�楂樺鍘�',
+          prop: 'officialAcademicRedentials',
+          width: '100'
+        }, {
+          label: '鍏ュ崟浣嶆椂闂�',
+          prop: 'unitTime',
+          width: '150'
+        },
+        // {
+        //   fixed: 'right',
+        //   dataType: 'action',
+        //   width: 80,
+        //   label: '鎿嶄綔',
+        //   operation: [
+        //     {
+        //       name: '瀵煎嚭',
+        //       type: 'text',
+        //       clickFun: (row) => {
+        //         this.openDownloadDia(row)
+        //       }
+        //     }
+        //   ]
+        // }
+      ],
+      trainingTableData: [],
+      trainingLoading: false,
+      trainingPagination: {
+        size: 20,
+        total: 0,
+        current: 1,
+        userName: null
+      },
+      searchForm: {
+        trainingDate: ''
+      },
+      trainingPersonColumn: [
+        {
+          label: '鍩硅鏃ユ湡',
+          prop: 'trainingDate'
+        }, {
+          label: '鍩硅鍐呭',
+          prop: 'trainingContent'
+        }, {
+          label: '鍩硅璇炬椂',
+          prop: 'educationBackground'
+        }, {
+          label: '璇炬椂',
+          prop: 'classHour'
+        }, {
+          label: '鍩硅缁撴灉',
+          prop: 'examinationResults',
+        }, {
+          label: '澶囨敞',
+          prop: 'remarks'
+        }
+      ],
+      trainingPersonTableData: [],
+      trainingPersonLoading: false,
+      trainingPersonPagination: {
+        size: 20,
+        current: 1,
+        total: 0
+      },
+      currentChangeRow: '',
+    };
+  },
+  mounted() {
+    this.getPersonnelTraining(this.departId);
+  },
+  methods: {
+    // exportExcel() {
+    //   this.outLoading = true;
+    //   const name = this.isDepartment ? 'departmentId' : 'userId';
+    //   this.$axios.get(this.$api.personnel.personTrackRecordExport + `&${name}=` + this.departId, { responseType: 'blob' }).then(res => {
+    //     this.outLoading = false;
+    //     this.$message.success('瀵煎嚭鎴愬姛');
+    //     const blob = new Blob([res], { type: 'application/octet-stream' });
+    //     const url = URL.createObjectURL(blob);
+    //     const link = document.createElement('a');
+    //     link.href = url;
+    //     link.download = '鍩硅璁板綍.xlsx';
+    //     link.click();
+    //   }).catch(err => {
+    //     this.outLoading = false;
+    //   })
+    // },
+    // 鏌ヨ
+    refreshTable() {
+      this.getPersonnelTraining(this.departId);
+    },
+    // 鍩硅璁板綍瀵煎嚭
+    openDownloadDia(row) {
+      let date = this.searchForm.trainingDate
+      if (!date) {
+        date = this.$moment().format('YYYY')
+      }
+      console.log('date----', date);
+      exportTrainingRecord({
+        userId: row.userId,
+        trainingDate: date
+      }).then(res => {
+        this.outLoading = false
+        const blob = new Blob([res], { type: 'application/msword' });
+        this.$download.saveAs(blob, '鍩硅璁板綍瀵煎嚭' + '.docx')
+      })
+    },
+    // 鑾峰彇瀹為獙瀹�-鍩硅璁″垝鍒楄〃淇℃伅
+    getPersonnelTraining(departId) {
+      // const name = this.isDepartment ? 'departmentId' : 'userId';
+      trainingSelectTrainingRecord({
+        departmentId: departId,
+        ...this.trainingPagination
+      }).then(res => {
+        this.trainingTableData = res.data.records;
+        this.trainingPagination.total = res.data.total;
+        if (this.trainingTableData.length > 0) {
+          this.currentChange(this.trainingTableData[0]);
+        }
+      });
+    },
+    // 鑾峰彇涓汉-鍩硅璁″垝鍒楄〃淇℃伅
+    currentChange(row) {
+      this.currentChangeRow = row
+      if (row === null) {
+        row = this.trainingTableData[0]
+      }
+      this.queryPersonnelDetailsPage(row.userId)
+    },
+    queryPersonnelDetailsPage(userId) {
+      if (this.searchForm.trainingDate === null) {
+        this.searchForm.trainingDate = ''
+      }
+      queryPersonnelDetails({
+        userId,
+        ...this.trainingPersonPagination
+      }).then(res => {
+        this.trainingPersonTableData = res.data.records;
+        this.trainingPersonPagination.total = res.data.total;
+      });
+    },
+    // 鍒嗛〉
+    trainingPaginationMethod({ page, limit }) {
+      this.trainingPagination.current = page;
+      this.trainingPagination.size = limit;
+      this.getPersonnelTraining(this.departId);
+    },
+    // 鍒嗛〉
+    trainingPersonPaginationMethod({ page, limit }) {
+      this.trainingPersonPagination.current = page;
+      this.trainingPersonPagination.size = limit;
+      this.queryPersonnelDetailsPage(this.currentChangeRow.userId);
+    },
+  },
+  watch: {
+    departId: {
+      handler(newId, oldId) {
+        if (this.isDepartment) {
+          this.getPersonnelTraining(newId);
+        } else {
+          this.queryPersonnelDetailsPage(newId)
+        }
+      }
+    }
+  }
+};
+</script>
+<style scoped>
+>>>.el-form-item {
+  margin-bottom: 13px;
+}
+
+.flex_table {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+}
+
+.pagination {
+  display: flex;
+  justify-content: space-between;
+  margin-top: 10px;
+}
+
+.items_center {
+  display: flex;
+  align-items: center;
+}
+
+.search {
+  width: 150px;
+  padding: 0 6px;
+}
+</style>

--
Gitblit v1.9.3