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/Mandate/index.vue |  228 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 228 insertions(+), 0 deletions(-)

diff --git a/src/views/CNAS/personnel/personnelInfo/Department/components/Mandate/index.vue b/src/views/CNAS/personnel/personnelInfo/Department/components/Mandate/index.vue
new file mode 100644
index 0000000..d6fa9a2
--- /dev/null
+++ b/src/views/CNAS/personnel/personnelInfo/Department/components/Mandate/index.vue
@@ -0,0 +1,228 @@
+<template>
+    <div class="flex_column">
+        <TableCard :showForm="isDepartment" title="浠昏亴鎺堟潈璁板綍">
+            <template v-slot:form>
+                <div v-if="isDepartment" class="w100 items_center justify_between">
+                    <div></div>
+                    <div>
+                        <el-button size="small" type="primary" @click="openDialog">鏂板</el-button>
+                    </div>
+                </div>
+            </template>
+            <template v-slot:table>
+                <limsTable :column="columnData" :height="'calc(100vh - 21em)'" :table-data="tableData"
+                    :table-loading="loading" style="margin-top: 18px; padding: 0 15px;" :page="page"
+                    @pagination="pagination"></limsTable>
+            </template>
+        </TableCard>
+        <Add ref="mandateModal" @refresh="getTableData"></Add>
+    </div>
+</template>
+<script>
+import TableCard from "@/components/TableCard/index.vue";
+import limsTable from "@/components/Table/lims-table.vue";
+import Add from "./Add.vue"
+import {
+    PersonPostAuthorizationRecordPage,
+    deletePersonPostAuthorizationRecord,
+    exportPersonPostAuthorizationRecord
+} from '@/api/cnas/personnel/personnelInfo.js'
+import { nextTick } from "vue";
+
+export default {
+    components: {
+        TableCard,
+        limsTable,
+        Add
+    },
+    props: {
+        departId: {
+            type: Number,
+            default: () => {
+                return null;
+            }
+        },
+        isDepartment: {
+            type: Boolean,
+            default: false
+        }
+    },
+    data() {
+        return {
+            // departId: 0,
+            columnData: [
+                {
+                    label: '搴忓彿',
+                    prop: 'id'
+                }, {
+                    label: '璇佷功缂栧彿',
+                    prop: 'certificateNumber'
+                }, {
+                    label: '琚换鑱屼汉鍛�',
+                    prop: 'userName'
+                }, {
+                    label: '浠昏亴宀椾綅',
+                    prop: 'post'
+                }, {
+                    label: '鐞嗚鑰冭瘯鎴愮哗',
+                    prop: 'num1'
+                }, {
+                    label: '鎿嶄綔鎶�鑳借�冭瘯鎴愮哗',
+                    prop: 'num2'
+                }, {
+                    label: '鎿嶄綔鏃堕棿',
+                    prop: 'updateTime'
+                }, {
+                    label: '澶囨敞',
+                    prop: 'remarks',
+                    width: 300
+                }, {
+                    label: '鎿嶄綔',
+                    dataType: 'action',
+                    width: 160,
+                    operation: [
+                        {
+                            name: '缂栬緫',
+                            type: 'text',
+                            clickFun: (row) => {
+                                this.openDialog(row, true)
+                            }
+                        }, {
+                            name: '涓嬭浇',
+                            type: 'text',
+                            clickFun: (row) => {
+                                this.handleDown(row)
+                            }
+                        }, {
+                            name: '鍒犻櫎',
+                            type: 'text',
+                            color: '#f56c6c',
+                            clickFun: (row) => {
+                                this.deleteNotify(row.id)
+                            }
+                        }
+                    ]
+                },
+            ],
+            tableData: [],
+            page: {
+                current: 1,
+                pageSize: 20,
+                total: 0
+            },
+            loading: false
+        }
+    },
+    mounted() {
+        this.getTableData()
+        console.log(this.departId)
+    },
+    methods: {
+        openDialog(row, type = false) {
+            this.$refs.mandateModal.openDialog(row, type)
+        },
+        /**
+         * @desc 鏌ヨ琛ㄦ牸鏁版嵁
+         */
+        async getTableData() {
+            this.loading = true
+            await nextTick()
+            const params = this.isDepartment ? {
+                departLimsId: this.departId,
+                current: this.page.current,
+                size: this.page.pageSize
+            } : {
+                userId: this.departId,
+                current: this.page.current,
+                size: this.page.pageSize
+            }
+            const { code, data } = await PersonPostAuthorizationRecordPage(params)
+            if (code == 200) {
+                this.page.total = data.total
+                this.tableData = data.records
+                this.loading = false
+            }
+        },
+        /**
+         * @desc 鍒嗛〉
+         */
+        pagination({ page, limit }) {
+            this.page.current = page;
+            this.page.size = limit;
+            this.getTableData();
+        },
+        /**
+         * @desc 鍒犻櫎浠昏亴璁板綍
+         */
+        deleteNotify(id) {
+            this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', {
+                confirmButtonText: '纭畾',
+                cancelButtonText: '鍙栨秷',
+                type: 'warning'
+            }).then(() => {
+                this.delMandate(id)
+            })
+        },
+        /**
+         * @desc api鍒犻櫎
+         */
+        async delMandate(id) {
+            const formData = new FormData()
+            formData.append('id', id)
+            const { code, data } = await deletePersonPostAuthorizationRecord(formData)
+            if (code == 200) {
+                this.$message({ message: '鍒犻櫎鎴愬姛', type: 'success' })
+                this.getTableData()
+            } else {
+                this.$message({ message: '鍒犻櫎澶辫触', type: 'error' })
+            }
+        },
+        /**
+         * @desc 鑾峰彇璁惧id
+         */
+        getDepart(id) {
+            this.departId = id
+            this.getTableData()
+        },
+        handleDown(row) {
+            exportPersonPostAuthorizationRecord({ id: row.id }).then(res => {
+                if (res.code == 201) {
+                    this.$message.error(res.message)
+                    return
+                }
+                const blob = new Blob([res], { type: 'application/octet-stream' });
+                this.$download.saveAs(blob, '浠昏亴鎺堟潈-' + row.certificateNumber + '-' + row.post + '.docx')
+            })
+        }
+    },
+    //   watch: {
+    //     departId: {
+    //       handler(newId, oldId) {
+    //         if (newId) {
+    //           this.getTableData();
+    //         }
+    //       }
+    //     }
+    //   }
+}
+</script>
+<style scoped>
+.flex_column {
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+}
+
+.w100 {
+    width: 100%;
+}
+
+.items_center {
+    display: flex;
+    align-items: center;
+}
+
+.justify_between {
+    justify-content: space-between
+}
+</style>

--
Gitblit v1.9.3