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/trackRecord/index.vue | 298 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 298 insertions(+), 0 deletions(-)
diff --git a/src/views/CNAS/personnel/personnelInfo/Department/components/trackRecord/index.vue b/src/views/CNAS/personnel/personnelInfo/Department/components/trackRecord/index.vue
new file mode 100644
index 0000000..7efd792
--- /dev/null
+++ b/src/views/CNAS/personnel/personnelInfo/Department/components/trackRecord/index.vue
@@ -0,0 +1,298 @@
+<!-- 宸ヤ綔灞ュ巻 -->
+<template>
+ <div>
+ <div style="text-align: right; margin-bottom: 15px;">
+ <el-button v-if="clickNodeVal.userId" size="small" type="primary" @click="dialogVisible = true">娣诲姞宸ヤ綔灞ュ巻</el-button>
+ <el-button :loading="outLoading" size="small" type="primary" @click="exportExcel">瀵煎嚭excel</el-button>
+ </div>
+ <div class="table">
+ <el-table :data="tableData" height="70vh" style="width: 100%">
+ <el-table-column label="搴忓彿" type="index" width="120">
+ <template v-slot="scope">
+ <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="璧峰鏃ユ湡" min-width="180" prop="startTime">
+ </el-table-column>
+ <el-table-column label="缁撴潫鏃ユ湡" min-width="180" prop="endTime">
+ </el-table-column>
+ <el-table-column label="宸ヤ綔鍗曚綅" min-width="120" prop="placeWork">
+ </el-table-column>
+ <el-table-column label="宸ヤ綔閮ㄩ棬" min-width="120" prop="department">
+ </el-table-column>
+ <el-table-column label="鑱屽姟" min-width="120" prop="post">
+ </el-table-column>
+ <el-table-column label="澶囨敞" min-width="180" prop="remarks">
+ </el-table-column>
+ <el-table-column label="鍒涘缓浜�" min-width="180" prop="createUser">
+ </el-table-column>
+ <el-table-column label="鍒涘缓鏃堕棿" min-width="180" prop="createTime">
+ </el-table-column>
+ <el-table-column fixed="right" label="鎿嶄綔" width="150">
+ <template v-slot="scope">
+ <el-button size="small" type="text" @click="downloadFile(scope.row.fileName)">瀵煎嚭</el-button>
+ <el-button size="small" type="text" @click="checkFun(scope.row)">鏌ョ湅</el-button>
+ <el-button size="small" style="color: red;" type="text" @click="deleteFun(scope.row.id)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <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" @size-change="handleSizeChange"
+ @current-change="handleCurrentChange">
+ </el-pagination>
+ </div>
+ <el-dialog :visible.sync="dialogVisible" title="鎻愮ず" width="45%">
+ <div style="height: 30vh;">
+ <el-form ref="ruleForm" :model="ruleForm" :rules="rules" class="demo-ruleForm" label-width="100px">
+ <el-row>
+ <el-col :span="12">
+ <el-form-item label="璧峰鏃ユ湡" prop="startTime">
+ <el-date-picker v-model="ruleForm.startTime" format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" required
+ size="small" style="width: 99%;" type="date" value-format="yyyy-MM-dd HH:mm:ss">
+ </el-date-picker>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="缁撴潫鏃ユ湡">
+ <el-date-picker v-model="ruleForm.endTime" format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" size="small"
+ style="width: 99%;" type="date" value-format="yyyy-MM-dd HH:mm:ss">
+ </el-date-picker>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="12">
+ <el-form-item label="宸ヤ綔鍗曚綅" prop="placeWork">
+ <el-input v-model="ruleForm.placeWork" clearable required size="small"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="宸ヤ綔閮ㄩ棬" prop="department">
+ <el-input v-model="ruleForm.department" clearable required size="small"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="12">
+ <el-form-item label="鏈�楂樿亴鍔�" prop="post">
+ <el-input v-model="ruleForm.post" clearable required size="small"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="闄勪欢璧勬枡">
+ <el-row>
+ <el-col :span="17"><el-input v-model="ruleForm.fileName" disabled size="small"></el-input></el-col>
+ <el-col :span="7">
+ <el-upload ref="upload" :action="action" :on-change="handleChangePic" :on-success="onSuccess"
+ :show-file-list="false" style="float: left; margin: 0 20px;" :headers="uploadHeader">
+ <el-button slot="trigger" class="uploadFile" size="mini" type="primary">娴忚</el-button>
+ </el-upload>
+ </el-col>
+ </el-row>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="澶囨敞">
+ <el-input v-model="ruleForm.remarks" clearable size="small"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ </div>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="saveOrUpdate">{{ isUpdate ? '鏇� 鏂�' : '淇� 瀛�' }}</el-button>
+ </span>
+ </el-dialog>
+ </div>
+</template>
+
+<script>
+import {
+ personTrackRecordExport,
+ personTrackRecordUpdate,
+ personTrackRecordSave,
+ personTrackRecordDelete,
+ personTrackRecordSelect,
+} from '@/api/cnas/personnel/personnelInfo.js'
+export default {
+ props: {
+ clickNodeVal: {
+ type: Object,
+ default: () => {
+ return {};
+ }
+ }
+ },
+ data() {
+ return {
+ tableData: [],
+ search: {
+ size: 20,
+ current: 1,
+ total: 0
+ },
+ dialogVisible: false,
+ ruleForm: {
+ fileName: '',
+ sysFileName: ''
+ },
+ rules: {
+ startTime: [
+ { required: true, message: '璇疯緭鍏ヨ捣濮嬫棩鏈�', trigger: 'blur' },
+ { required: true, message: '璇疯緭鍏ヨ捣濮嬫棩鏈�', trigger: 'change' }
+ ],
+ placeWork: [
+ { required: true, message: '璇疯緭鍏ュ伐浣滃崟浣�', trigger: 'blur' }
+ ],
+ department: [
+ { required: true, message: '璇疯緭鍏ュ伐浣滈儴闂�', trigger: 'blur' }
+ ],
+ post: [
+ { required: true, message: '璇疯緭鍏ユ渶楂樿亴鍔�', trigger: 'blur' }
+ ]
+ },
+ isUpdate: false,
+ outLoading: false
+ };
+ },
+ created() {
+ this.init();
+ },
+ computed: {
+ action() {
+ return this.javaApi + '/personBasicInfo/saveCNASFile'
+ }
+ },
+ methods: {
+ downloadFile(fileName) {
+ this.$download.saveAs(fileName, fileName)
+ },
+ handleChangePic(file, fileList) {
+ if (fileList.length > 1) {
+ fileList.splice(0, 1);
+ }
+ },
+ onSuccess(response, file, fileList) {
+ if (response.code === 200) {
+ this.$set(this.ruleForm, 'fileName', response.data)
+ } else {
+ this.$message.warning(response.message)
+ }
+ },
+ exportExcel() {
+ this.outLoading = true
+ let userId = this.clickNodeVal.userId ? this.clickNodeVal.userId : null
+ let departmentId = this.clickNodeVal.id ? this.clickNodeVal.id : null
+ personTrackRecordExport({
+ userId,
+ departmentId
+ }).then(res => {
+ this.outLoading = false
+ const blob = new Blob([res], { type: 'application/octet-stream' });
+ this.$download.saveAs(blob, '宸ヤ綔灞ュ巻.xlsx')
+ })
+ },
+ saveOrUpdate() {
+ this.$refs['ruleForm'].validate((valid) => {
+ if (valid) {
+ if (this.isUpdate) {
+ personTrackRecordUpdate(this.ruleForm).then(res => {
+ if (res.code = 200) {
+ this.dialogVisible = false
+ this.$message.success('鏇存柊鎴愬姛锛�')
+ this.init()
+ }
+ })
+ } else {
+ this.ruleForm.userId = this.clickNodeVal.userId
+ personTrackRecordSave(this.ruleForm).then(res => {
+ if (res.code = 200) {
+ this.dialogVisible = false
+ this.$message.success('鏂板鎴愬姛锛�')
+ this.init()
+ }
+ })
+ }
+ } else {
+ return false;
+ }
+ });
+ },
+ deleteFun(id) {
+ this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ personTrackRecordDelete({ id }).then(res => {
+ this.$message.success('鍒犻櫎鎴愬姛锛�')
+ this.init()
+ })
+ }).catch(() => {
+ this.$message({
+ type: 'info',
+ message: '宸插彇娑堝垹闄�'
+ });
+ });
+ },
+ handleSizeChange(val) {
+ this.search.size = val
+ this.init()
+ },
+ handleCurrentChange(val) {
+ this.search.current = val
+ this.init()
+ },
+ // 鍒濆鍖栬皟鐢�
+ init() {
+ if (this.clickNodeVal.userId) {
+ this.getPersonnelTraining(this.clickNodeVal.userId ? this.clickNodeVal.userId : null, null);
+ } else {
+ this.getPersonnelTraining(null, this.clickNodeVal.id ? this.clickNodeVal.id : null);
+ }
+ },
+ getPersonnelTraining(userId, departmentId) {
+ personTrackRecordSelect({
+ userId,
+ departmentId,
+ ...this.search
+ }).then(res => {
+ this.tableData = res.data.records
+ this.search.total = res.data.total
+ })
+ },
+ checkFun(row) {
+ this.ruleForm = { ...row }
+ this.dialogVisible = true
+ this.isUpdate = true
+ }
+ },
+ watch: {
+ // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊
+ clickNodeVal(newVal) {
+ if (newVal.userId) {
+ // 鐢ㄦ埛id
+ this.getPersonnelTraining(newVal.userId, null);
+ } else {
+ // 閮ㄩ棬id
+ this.getPersonnelTraining(null, newVal.id);
+ }
+ },
+ dialogVisible(newVal) {
+ if (!newVal) {
+ this.isUpdate = false
+ this.$refs.ruleForm.resetFields();
+ this.ruleForm = {}
+ }
+ }
+ }
+};
+</script>
+<style scoped>
+>>>.el-form-item {
+ margin-bottom: 13px;
+}
+</style>
--
Gitblit v1.9.3