From 42935de0c2ec1a626cef63bce7c79da0e0708d32 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期五, 28 二月 2025 14:43:30 +0800 Subject: [PATCH] 人员-培训记录搬迁 --- src/assets/styles/ruoyi.scss | 2 src/views/CNAS/personnel/personnelInfo/index.vue | 10 +- src/api/cnas/personal/personTrainingRecord.js | 27 +++++ src/main.js | 4 src/views/CNAS/personnel/personnelInfo/tabs/personnel-list.vue | 2 src/views/CNAS/personnel/personnelInfo/tabs/training-record.vue | 245 +++++++++++++++++++++--------------------------- src/views/CNAS/personnel/personnelInfo/tabs/job-responsibilities.vue | 1 package.json | 1 src/views/CNAS/personnel/personnelInfo/tabs/reward-punishment-record.vue | 1 src/components/Pagination/index.vue | 3 10 files changed, 149 insertions(+), 147 deletions(-) diff --git a/package.json b/package.json index 2b89237..4379600 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "jsencrypt": "3.0.0-rc.1", "jspdf": "^3.0.0", "mammoth": "^1.9.0", + "moment": "^2.30.1", "nprogress": "0.2.0", "pako": "^2.1.0", "print-js": "^1.6.0", diff --git a/src/api/cnas/personal/personTrainingRecord.js b/src/api/cnas/personal/personTrainingRecord.js new file mode 100644 index 0000000..6b75b4d --- /dev/null +++ b/src/api/cnas/personal/personTrainingRecord.js @@ -0,0 +1,27 @@ +import request from "@/utils/request"; + +// 瀵煎嚭鍩硅璁板綍 +export function exportTrainingRecord(query) { + return request({ + url: "/personTrainingRecord/exportTrainingRecord", + method: "get", + params: query, + responseType: 'blob' + }); +} +// 鏌ヨ浜哄憳 鍩硅璁板綍 +export function trainingSelectTrainingRecord(query) { + return request({ + url: "/personTrainingRecord/trainingSelectTrainingRecord", + method: "get", + params: query, + }); +} +// 鏌ヨ浜哄憳鏄庣粏 鍩硅璁板綍 +export function queryPersonnelDetails(query) { + return request({ + url: "/personTrainingRecord/queryPersonnelDetails", + method: "get", + params: query, + }); +} diff --git a/src/assets/styles/ruoyi.scss b/src/assets/styles/ruoyi.scss index 7e44513..8dfe1d0 100644 --- a/src/assets/styles/ruoyi.scss +++ b/src/assets/styles/ruoyi.scss @@ -121,7 +121,7 @@ height: 32px; margin-bottom: 10px; margin-top: 15px; - padding: 10px 20px !important; + padding: 0 20px !important; } /* tree border */ diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue index 56f5a6b..9be5ddb 100644 --- a/src/components/Pagination/index.vue +++ b/src/components/Pagination/index.vue @@ -106,7 +106,8 @@ <style scoped> .pagination-container { background: #fff; - padding: 32px 16px; + padding: 28px 16px; + margin-top: 10px; } .pagination-container.hidden { display: none; diff --git a/src/main.js b/src/main.js index 5809760..beaf8ef 100644 --- a/src/main.js +++ b/src/main.js @@ -49,6 +49,8 @@ import DictData from "@/components/DictData"; import { checkPermi } from "@/utils/permission"; // 鏉冮檺鍒ゆ柇鍑芥暟 import { getToken } from "@/utils/auth"; +// 鏃堕棿杞崲 +import Moment from 'moment' // 鍏ㄥ眬鏂规硶鎸傝浇 Vue.prototype.getDicts = getDicts; @@ -80,6 +82,8 @@ }); } }) +Vue.use(Moment) +Vue.prototype.$moment = Moment // 鍏ㄥ眬缁勪欢鎸傝浇 Vue.component("DictTag", DictTag); diff --git a/src/views/CNAS/personnel/personnelInfo/index.vue b/src/views/CNAS/personnel/personnelInfo/index.vue index f931306..5cbb11a 100644 --- a/src/views/CNAS/personnel/personnelInfo/index.vue +++ b/src/views/CNAS/personnel/personnelInfo/index.vue @@ -70,11 +70,11 @@ <rewardPunishmentRecord v-if="activeName === '濂栨儵璁板綍'" :departId="departId" :isDepartment="isDepartment"></rewardPunishmentRecord> </el-tab-pane> -<!-- <el-tab-pane label="鍩硅璁板綍" name="鍩硅璁板綍">--> -<!-- <training-record v-if="activeName === '鍩硅璁板綍'" ref="trainingRecord"--> -<!-- :departId="departId"--> -<!-- :isDepartment="isDepartment"></training-record>--> -<!-- </el-tab-pane>--> + <el-tab-pane label="鍩硅璁板綍" name="鍩硅璁板綍"> + <training-record v-if="activeName === '鍩硅璁板綍'" ref="trainingRecord" + :departId="departId" + :isDepartment="isDepartment"></training-record> + </el-tab-pane> <!-- <el-tab-pane label="浠昏亴鎺堟潈璁板綍" name="浠昏亴鎺堟潈璁板綍">--> <!-- <Mandate v-if="activeName === '浠昏亴鎺堟潈璁板綍'" ref="manDateRef" :departId="departId" :isDepartment="isDepartment"></Mandate>--> <!-- </el-tab-pane>--> diff --git a/src/views/CNAS/personnel/personnelInfo/tabs/job-responsibilities.vue b/src/views/CNAS/personnel/personnelInfo/tabs/job-responsibilities.vue index 227b749..1ae74e8 100644 --- a/src/views/CNAS/personnel/personnelInfo/tabs/job-responsibilities.vue +++ b/src/views/CNAS/personnel/personnelInfo/tabs/job-responsibilities.vue @@ -43,6 +43,7 @@ <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]" :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" background + style="margin-top: 10px" @size-change="handleSizeChange" @current-change="handleCurrentChange"> </el-pagination> diff --git a/src/views/CNAS/personnel/personnelInfo/tabs/personnel-list.vue b/src/views/CNAS/personnel/personnelInfo/tabs/personnel-list.vue index edf7b44..92e0233 100644 --- a/src/views/CNAS/personnel/personnelInfo/tabs/personnel-list.vue +++ b/src/views/CNAS/personnel/personnelInfo/tabs/personnel-list.vue @@ -48,7 +48,7 @@ :total="page.total" background layout="->,total, sizes, prev, pager, next, jumper" - style="margin-top: 16px" + style="margin-top: 10px" @size-change="handleSizeChange" @current-change="handleCurrentChange" > diff --git a/src/views/CNAS/personnel/personnelInfo/tabs/reward-punishment-record.vue b/src/views/CNAS/personnel/personnelInfo/tabs/reward-punishment-record.vue index bf5c9e4..40b2f82 100644 --- a/src/views/CNAS/personnel/personnelInfo/tabs/reward-punishment-record.vue +++ b/src/views/CNAS/personnel/personnelInfo/tabs/reward-punishment-record.vue @@ -68,6 +68,7 @@ :page-sizes="[10, 20, 30, 50, 100]" :total="search.total" layout="->,total, sizes, prev, pager, next, jumper" background + style="margin-top: 10px" @size-change="handleSizeChange" @current-change="handleCurrentChange"> </el-pagination> diff --git a/src/views/CNAS/personnel/personnelInfo/tabs/training-record.vue b/src/views/CNAS/personnel/personnelInfo/tabs/training-record.vue index 6ac536f..a2642b7 100644 --- a/src/views/CNAS/personnel/personnelInfo/tabs/training-record.vue +++ b/src/views/CNAS/personnel/personnelInfo/tabs/training-record.vue @@ -2,82 +2,54 @@ <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>--> -<!-- <ZTTable--> -<!-- :column="trainingColumn"--> -<!-- :currentChange="currentChange"--> -<!-- :height="'calc(100vh - 18em)'"--> -<!-- :highlightCurrentRow="true"--> -<!-- :table-data="trainingTableData"--> -<!-- :table-loading="trainingLoading"--> -<!-- style="padding: 0 15px;">--> -<!-- </ZTTable>--> -<!-- <div class="pagination">--> -<!-- <div></div>--> -<!-- <el-pagination--> -<!-- :page-size="trainingPagination.size"--> -<!-- :page-sizes="[10, 20, 30, 40]"--> -<!-- :total="trainingPagination.total"--> -<!-- layout="total, sizes, prev, pager, next, jumper"--> -<!-- @current-change="handleYearCurrentTraining"--> -<!-- @size-change="handleYearSizeChangeTraining">--> -<!-- </el-pagination>--> -<!-- </div>--> -<!-- </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>--> -<!-- <ZTTable--> -<!-- :column="trainingPersonColumn"--> -<!-- :height="'calc(100vh - 18em)'"--> -<!-- :table-data="trainingPersonTableData"--> -<!-- :table-loading="trainingPersonLoading"--> -<!-- style="padding: 0 15px;">--> -<!-- </ZTTable>--> -<!-- <div class="pagination">--> -<!-- <div></div>--> -<!-- <el-pagination--> -<!-- :page-size="trainingPersonPagination.size"--> -<!-- :page-sizes="[10, 20, 30, 40]"--> -<!-- :total="trainingPersonPagination.total"--> -<!-- layout="total, sizes, prev, pager, next, jumper"--> -<!-- @current-change="handleYearCurrentPagination"--> -<!-- @size-change="handleYearSizeChangePagination">--> -<!-- </el-pagination>--> -<!-- </div>--> -<!-- </template>--> -<!-- </TableCard>--> + <div v-if="isDepartment" style="width: 49%"> + <div class="title"> + <span style="font-weight: bold">骞村害璁″垝</span> + </div> + <div style="display: flex;justify-content: space-between;"> + <el-form :model="trainingPagination" ref="trainingPagination" size="small" :inline="true"> + <el-form-item label="濮撳悕"> + <el-input v-model="trainingPagination.userName" class="search" clearable placeholder="璇疯緭鍏�" size="small"></el-input> + </el-form-item> + <el-form-item> + <el-button size="small" type="primary" @click="getPersonnelTraining(departId)">鏌ヨ</el-button> + </el-form-item> + </el-form> + </div> + <lims-table :tableData="trainingTableData" :column="trainingColumn" + ref="trainingTableData" + :currentChange="currentChange" :highlightCurrentRow="true" + @pagination="pagination" :height="'calc(100vh - 22em)'" + :page="trainingPagination" :tableLoading="trainingLoading"></lims-table> + </div> + <div :style="`width: ${isDepartment ? '49%' : '100%'};`"> + <div class="title"> + <span style="font-weight: bold">骞村害璁″垝鏄庣粏</span> + </div> + <div style="display: flex;justify-content: space-between;"> + <el-form :model="searchForm" ref="searchForm" size="small" :inline="true"> + <el-form-item label="骞翠唤"> + <el-date-picker + v-model="searchForm.trainingDate" + clearable + format="yyyy" + placeholder="閫夋嫨骞�" + size="small" + type="year" + value-format="yyyy"> + </el-date-picker> + </el-form-item> + <el-form-item> + <el-button size="small" type="primary" @click="queryPersonnelDetailsPage(currentChangeRow.userId)">鏌ヨ</el-button> + </el-form-item> + </el-form> + <div> + <el-button size="small" type="primary" @click="openDownloadDia(currentChangeRow)">瀵煎嚭</el-button> + </div> + </div> + <lims-table :tableData="trainingPersonTableData" :column="trainingPersonColumn" + :height="'calc(100vh - 22em)'" @pagination="pagination1" + :page="trainingPersonPagination" :tableLoading="trainingPersonLoading"></lims-table> </div> </div> </div> @@ -85,8 +57,15 @@ <script> +import limsTable from "@/components/Table/lims-table.vue"; +import { + exportTrainingRecord, + queryPersonnelDetails, + trainingSelectTrainingRecord +} from "@/api/cnas/personal/personTrainingRecord"; + export default { - components: {}, + components: {limsTable}, props: { departId: { type: Number, @@ -215,48 +194,31 @@ if (!date) { date = this.$moment().format('YYYY') } - console.log('date----', date); - this.$axios.get( this.$api.personnel.exportTrainingRecord+ '?userId=' + row.userId + '&trainingDate=' + date,{responseType: "blob"}).then(res => { + exportTrainingRecord({userId: row.userId, trainingDate: date}).then(res => { this.outLoading = false const blob = new Blob([res],{ type: 'application/msword' }); - //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 - let reader = new FileReader(); - reader.readAsText(blob, 'utf-8'); - reader.onload = () => { - try { - let result = JSON.parse(reader.result); - if (result.message) { - this.$message.error(result.message); - } else { - const url = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - link.download = '鍩硅璁板綍瀵煎嚭' + '.docx'; - link.click(); - this.$message.success('瀵煎嚭鎴愬姛') - } - } catch (err) { - console.log(err); - const url = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - link.download = '鍩硅璁板綍瀵煎嚭' + '.docx'; - link.click(); - this.$message.success('瀵煎嚭鎴愬姛') - } - } + this.$download.saveAs(blob, '鍩硅璁板綍瀵煎嚭.docx'); }) }, // 鑾峰彇瀹為獙瀹�-鍩硅璁″垝鍒楄〃淇℃伅 getPersonnelTraining(departId) { - // const name = this.isDepartment ? 'departmentId' : 'userId'; - this.$axios.get(`${this.$api.personnel.trainingSelectTrainingRecord}?departmentId=${departId}&size=${this.trainingPagination.size}¤t=${this.trainingPagination.current}&userName=${this.trainingPagination.userName}`).then(res => { + const params = { + departmentId: departId, + size: this.trainingPagination.size, + current: this.trainingPagination.current, + userName: this.trainingPagination.userName, + } + this.trainingLoading = true + trainingSelectTrainingRecord(params).then(res => { + this.trainingLoading = false this.trainingTableData = res.data.records; this.trainingPagination.total = res.data.total; if (this.trainingTableData.length > 0) { - this.currentChange(this.trainingTableData[0]); + this.$refs.trainingTableData.setCurrentRow(this.trainingTableData[0]) } - }); + }).catch(err => { + this.trainingLoading = false + }) }, // 鑾峰彇涓汉-鍩硅璁″垝鍒楄〃淇℃伅 currentChange(row) { @@ -270,29 +232,31 @@ if (this.searchForm.trainingDate === null) { this.searchForm.trainingDate = '' } - this.$axios.get(`${this.$api.personnel.queryPersonnelDetails}?userId=${userId}&size=${this.trainingPersonPagination.size}¤t=${this.trainingPersonPagination.current}&trainingDate=${this.searchForm.trainingDate}`).then(res => { + const params = { + userId: userId, + size: this.trainingPersonPagination.size, + current: this.trainingPersonPagination.current, + trainingDate: this.searchForm.trainingDate, + } + this.trainingPersonLoading = true + queryPersonnelDetails(params).then(res => { + this.trainingPersonLoading = false this.trainingPersonTableData = res.data.records; this.trainingPersonPagination.total = res.data.total; - }); + }).catch(err => { + this.trainingPersonLoading = false + }) }, // 鍒嗛〉 - handleYearCurrentTraining(page) { - this.trainingPagination.curent = page; - this.getPersonnelTraining(this.departId); - }, - handleYearSizeChangeTraining(size) { - this.trainingPagination.size = size; + pagination(page) { + this.trainingPagination.size = page.limit; this.getPersonnelTraining(this.departId); }, // 鍒嗛〉 - handleYearCurrentPagination(page) { - this.trainingPersonPagination.curent = page; + pagination1(page) { + this.trainingPersonPagination.size = page.limit; this.queryPersonnelDetailsPage(this.currentChangeRow.userId); }, - handleYearSizeChangePagination(size) { - this.trainingPersonPagination.size = size; - this.queryPersonnelDetailsPage(this.currentChangeRow.userId); - } }, watch: { departId: { @@ -308,29 +272,32 @@ }; </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; +} +.title { + position: relative; + font-size: 16px; + color: #333; + font-weight: 400; + padding-left: 10px; + margin-bottom: 10px; +} + +.title::before { + position: absolute; + left: 0; + top: 4px; + content: ''; + width: 4px; + height: 16px; + background-color: #3A7BFA; + border-radius: 2px; } </style> -- Gitblit v1.9.3