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

diff --git a/src/views/CNAS/personnel/personnelInfo/Department/components/Plan/index.vue b/src/views/CNAS/personnel/personnelInfo/Department/components/Plan/index.vue
new file mode 100644
index 0000000..6ef1c26
--- /dev/null
+++ b/src/views/CNAS/personnel/personnelInfo/Department/components/Plan/index.vue
@@ -0,0 +1,484 @@
+<template>
+    <div class="flex_column">
+        <div>
+            <TableCard title="骞村害璁″垝琛�">
+                <template v-slot:form>
+                    <div class="items_center">
+                        <span>缂栧埗浜�</span>
+                        <el-input v-model="yearForm.organizationPerson" class="search" placeholder="璇疯緭鍏�"
+                            size="small"></el-input>
+                        <el-button size="small" type="primary" @click="getYearPlanList">鏌ヨ</el-button>
+                        <el-button size="small" @click="clearYear">娓呯┖</el-button>
+                    </div>
+                    <!-- <UploadExcel v-if="isShowButton" @upload="getYearPlanList"></UploadExcel> -->
+                    <el-upload ref="upload" v-if="isShowButton" :action="action" :data="uploadData"
+                        :headers="uploadHeader" :before-upload="beforeUpload" :on-success="onSuccess">
+                        <el-button size="small" type="primary">瀵煎叆</el-button>
+                    </el-upload>
+
+
+
+
+                </template>
+                <template v-slot:table>
+                    <limsTable ref="yearTable" :column="yearColumnData" :height="'calc(100vh - 38em)'"
+                        :highlightCurrentRow="true" :rowClick="rowClick" :table-data="yearTableData"
+                        :table-loading="yearLoading" style="margin-top: 0.5em;
+                        padding: 0 15px;" :page="yearPage" @pagination="yearPagination">
+                    </limsTable>
+                </template>
+            </TableCard>
+        </div>
+        <div style="width: 100%; height: 0.5em; background-color: #f5f7fb;"></div>
+        <div>
+            <TableCard title="骞村害璁″垝鏄庣粏琛�">
+                <template v-slot:form>
+                    <div class="items_center">
+                        <span>鐩戠潱鏃ユ湡</span>
+                        <el-date-picker v-model="yearDetailForm.date" class="date_box" format="yyyy-MM-dd"
+                            placeholder="閫夋嫨鏃ユ湡" size="small" type="date" value-format="yyyy-MM-dd">
+                        </el-date-picker>
+                        <span>鐩戠潱椤圭洰</span>
+                        <el-input v-model="yearDetailForm.project" class="search" placeholder="璇疯緭鍏�"
+                            size="small"></el-input>
+                        <el-button size="small" type="primary" @click="getYearDetailPlanList">鏌ヨ</el-button>
+                        <el-button size="small" @click="clearDetail">娓呯┖</el-button>
+                    </div>
+                    <div>
+                        <el-button v-if="isOperation" size="small" type="primary"
+                            @click="showDialog('add')">鏂板</el-button>
+                    </div>
+                </template>
+                <template v-slot:table>
+                    <limsTable :column="yearDetailColumnData" :height="'calc(100vh - 38em)'"
+                        :table-data="yearDetailTableData" :table-loading="yearDetailLoading"
+                        style="margin-top: 18px; padding: 0 15px;" :page="yearDeatilPage"
+                        @pagination="yearDeatilPagination">
+                    </limsTable>
+                </template>
+            </TableCard>
+        </div>
+        <PlanAdd ref="planModal" :planId="planId" @submit="handleForm"></PlanAdd>
+    </div>
+</template>
+<script>
+import TableCard from '@/components/TableCard/index.vue';
+import PlanAdd from "./Add.vue"
+import limsTable from "@/components/Table/lims-table.vue";
+import UploadExcel from "./UploadExcel.vue"
+import {
+    yearPlanList,
+    yearPlanDetailList,
+    yearPlanDel,
+    yearPlanDetailDel,
+    yearPlanDetailApproval,
+    exportSuperVisePlan
+} from '@/api/cnas/personnel/personnelInfo.js'
+
+export default {
+    props: {
+        departId: {
+            type: Number,
+            default: null
+        }
+    },
+
+
+    components: {
+        TableCard,
+        PlanAdd,
+        limsTable,
+        UploadExcel
+    },
+    data() {
+        return {
+            uploadData: {},
+            isShowButton: false,
+            planId: undefined,
+            yearForm: {
+                organizationPerson: undefined,
+            },
+            yearTableData: [],  // 骞磋〃
+            yearPage: {
+                curent: 1,
+                pageSize: 20,
+                total: 0
+            },
+            yearColumnData: [
+                {
+                    label: '鏂囦欢鍚嶇О',
+                    prop: 'fileName',
+                    minWidth: '150px'
+                }, {
+                    label: '缂栧埗浜�',
+                    prop: 'organizationPersonName',
+                    minWidth: '100'
+                }, {
+                    label: '缂栧埗鏃ユ湡',
+                    prop: 'organizationDate',
+                    minWidth: '160'
+                }, {
+                    label: '鎵瑰噯浜�',
+                    prop: 'approvalName',
+                    minWidth: '100'
+                }, {
+                    label: '鎵瑰噯鏃ユ湡',
+                    prop: 'approvalDate',
+                    minWidth: '160'
+                }, {
+                    label: '瀹℃牳浜�',
+                    prop: 'examine'
+                }, {
+                    dataType: 'tag',
+                    label: '鎵瑰噯鐘舵��',
+                    prop: 'approvalStatus',
+                    minWidth: '130',
+                    formatData: (params) => {
+                        if (params == 1) {
+                            return '鎵瑰噯'
+                        } else {
+                            return '涓嶆壒鍑�'
+                        }
+                    },
+                    formatType: (params) => {
+                        if (params == 1) {
+                            return 'success'
+                        } else {
+                            return 'danger'
+                        }
+                    }
+                }, {
+                    label: '鍒涘缓鏃ユ湡',
+                    prop: 'createTime',
+                    minWidth: '160'
+                }, {
+                    label: '鍒涘缓浜�',
+                    prop: 'createName',
+                    minWidth: '100'
+                }, {
+                    dataType: 'action',
+                    minWidth: '160',
+                    label: '鎿嶄綔',
+                    fixed: 'right',
+                    operation: [
+                        {
+                            name: '瀵煎嚭',
+                            type: 'text',
+                            clickFun: (row) => {
+                                this.downLoadPost(row)
+                            }
+                        },
+                        {
+                            name: '鎵瑰噯',
+                            type: 'text',
+                            disabled: (row) => {
+                                if (row.approvalStatus == 1 || (row.departId == 18 && ![12, 11, 16].includes(row.currentId)) || (row.departId == 19 && ![35, 41, 16].includes(row.currentId))) {
+                                    return true
+                                } else {
+                                    return false
+                                }
+                            },
+                            clickFun: (row) => {
+                                this.approvalYearPlan(row)
+                            }
+                        },
+                        {
+                            name: '鍒犻櫎',
+                            type: 'text',
+                            color: '#f56c6c',
+                            clickFun: (row) => {
+                                this.delYearPlan(row.id)
+                            }
+                        }
+                    ]
+                }],
+            yearLoading: false,
+            yearDetailForm: {
+                date: undefined,
+                project: undefined
+            },
+            yearDetailTableData: [],    // 骞存槑缁嗚〃
+            yearDeatilPage: {
+                curent: 1,
+                pageSize: 20,
+                total: 0
+            },
+            yearDetailColumnData: [
+                {
+                    label: '鐩戠潱鏃ユ湡',
+                    prop: 'superviseDate'
+                }, {
+                    label: '鐩戠潱鐩殑',
+                    prop: 'superviseDes'
+                }, {
+                    label: '琚洃鐫d汉鍛�',
+                    prop: 'supervisePerson'
+                }, {
+                    label: '澶囨敞',
+                    prop: 'remarks'
+                }, {
+                    label: '鍩硅鏃ユ湡',
+                    prop: 'trainDate'
+                }, {
+                    label: '鍒涘缓',
+                    prop: 'createBy'
+                }, {
+                    dataType: 'action',
+                    width: '180',
+                    label: '鎿嶄綔',
+                    operation: [
+                        {
+                            name: '缂栬緫',
+                            type: 'text',
+                            clickFun: (row) => {
+                                this.$refs.planModal.showDialog(row, true)
+                            }
+                        },
+                        {
+                            name: '鍒犻櫎',
+                            type: 'text',
+                            color: '#f56c6c',
+                            clickFun: (row) => {
+                                this.delYearPlanDetail(row.id)
+                            }
+                        }
+                    ]
+                }
+            ],
+            yearDetailLoading: false,
+            isOperation: false,
+        }
+    },
+    mounted() {
+        this.getYearPlanList()
+        // this.getPower()
+        // this.getYearDetailPlanList()
+
+    },
+    computed: {
+        action() {
+            return this.javaApi + '/superVisePlan/yearPlanDetailImport'
+        },
+    },
+    watch: {
+        departId(newValue, oldValue) {
+            this.getYearPlanList();
+        }
+    },
+    methods: {
+        // 涓婁紶鍓嶇殑閽╁瓙
+        beforeUpload(file) {
+            let list = file.name.split(".")
+            let fileName = list[list.length - 1]
+            this.$set(this.uploadData, "suffix", fileName)
+        },
+        // 鎴愬姛涔嬪悗鐨勯挬瀛�
+        onSuccess(response, file, fileList) {
+            this.getYearPlanList();
+            this.$message.success("瀵煎叆鎴愬姛")
+            this.$refs.upload.clearFiles()
+        },
+        getPower() {
+            let power = JSON.parse(sessionStorage.getItem('power'))
+            let up = false
+            for (var i = 0; i < power.length; i++) {
+                if (power[i].menuMethod == 'yearPlanDetailImport') {
+                    up = true
+                }
+            }
+            if (!up) {
+                this.isShowButton = false
+            } else {
+                this.isShowButton = true
+            }
+        },
+        /**
+         * @desc 鏌ヨ骞村害璁″垝鍒楄〃
+         */
+        async getYearPlanList() {
+            this.yearLoading = true
+            const { code, data } = await yearPlanList({
+                current: this.yearPage.curent,
+                size: this.yearPage.pageSize,
+                organizationPerson: this.yearForm.organizationPerson,
+                departId: this.departId
+            })
+            if (code == 200) {
+                this.yearTableData = data.records
+                this.yearPage.total = data.total
+                if (this.yearTableData.length > 0) {
+                    this.rowClick(this.yearTableData[0])
+                } else {
+                    this.yearDetailTableData = []
+                }
+            }
+            console.log('涓昏〃鏁版嵁', this.yearTableData);
+            this.yearLoading = false
+        },
+        // 骞磋鍒掑垎椤�
+        yearPagination({ page, limit }) {
+            this.yearPage.current = page;
+            this.yearPage.size = limit;
+            this.getYearPlanList();
+        },
+        // 骞村害璁″垝琛ㄦ牸锛岀偣鍑昏鏁版嵁鍚庡埛鏂拌鎯�
+        rowClick(row) {
+            const now = new Date();
+            const currentYear = now.getFullYear();
+            if (row.createTime.slice(0, 4) == currentYear) {
+                this.isOperation = true;
+            } else {
+                this.isOperation = false;
+            }
+            this.planId = row.id
+            this.getYearDetailPlanList()
+        },
+        // 鏂板|缂栬緫瀹屾垚鍚庡仛浠�涔�
+        handleForm() {
+            this.getYearDetailPlanList()
+        },
+        // 娓呴櫎骞�
+        clearYear() {
+            this.$refs.yearTable.setCurrent()
+            this.yearForm.organizationPerson = undefined
+            this.getYearPlanList()
+        },
+        // 娓呴櫎鏄庣粏
+        clearDetail() {
+            this.yearDetailForm.date = undefined
+            this.yearDetailForm.project = undefined
+            this.getYearDetailPlanList()
+        },
+
+        /**
+         * @desc 鏌ヨ骞村害璁″垝鏄庣粏
+         */
+        async getYearDetailPlanList() {
+            this.yearDetailLoading = true
+            const { code, data } = await yearPlanDetailList({
+                planId: this.planId,
+                current: this.yearDeatilPage.curent,
+                size: this.yearDeatilPage.pageSize,
+                date: this.yearDetailForm.date,
+                project: this.yearDetailForm.project
+            })
+            if (code == 200) {
+                this.yearDetailTableData = data.records
+                this.yearDeatilPage.total = data.total
+            }
+            this.yearDetailLoading = false
+        },
+        showDialog(operationType, row, type = false) {
+            if (operationType === 'add') {
+                if (!this.planId) {
+                    this.$message.warning('璇烽�夋嫨涓�鏉¤鍒掕繘琛屾柊澧�')
+                    return
+                }
+            }
+            this.$refs.planModal.showDialog({ planId: this.planId, ...row }, type)
+        },
+
+
+
+        // 骞存槑缁嗚鍒掑垎椤�
+        yearDeatilPagination({ page, limit }) {
+            this.yearDeatilPage.current = page;
+            this.yearDeatilPage.size = limit;
+            this.getYearDetailPlanList();
+        },
+        // 鍒犻櫎骞磋鍒�
+        delYearPlan(id) {
+            this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', {
+                confirmButtonText: '纭畾',
+                cancelButtonText: '鍙栨秷',
+                type: 'warning'
+            }).then(async () => {
+                const { code } = await yearPlanDel({ id })
+                if (code == 200) {
+                    this.$message.success('鍒犻櫎鎴愬姛')
+                    this.getYearPlanList()
+                    this.getYearDetailPlanList()
+                } else {
+                    this.$message.error('鍒犻櫎澶辫触')
+                }
+            })
+        },
+        // 鍒犻櫎骞磋鍒掓槑缁�
+        delYearPlanDetail(id) {
+            this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', {
+                confirmButtonText: '纭畾',
+                cancelButtonText: '鍙栨秷',
+                type: 'warning'
+            }).then(async () => {
+                const { code } = await yearPlanDetailDel({ id })
+                if (code == 200) {
+                    this.$message.success('鍒犻櫎鎴愬姛')
+                    this.getYearDetailPlanList()
+                } else {
+                    this.$message.error('鍒犻櫎澶辫触')
+                }
+            })
+        },
+        // 鎵瑰噯骞村害璁″垝
+        approvalYearPlan(row) {
+            this.$confirm('纭鎵瑰噯璇ュ勾搴﹁鍒�?', '鎻愮ず', {
+                confirmButtonText: '鎵瑰噯',
+                cancelButtonText: '涓嶆壒鍑�',
+                type: 'info'
+            }).then(() => {
+                this.approvalYearPlanFun(1, row.id)
+            }).catch(action => {
+                this.approvalYearPlanFun(0, row.id)
+            })
+        },
+        // 骞村害璁″垝琛�-涓嬭浇
+        downLoadPost(row) {
+            exportSuperVisePlan({ id: row.id }).then(res => {
+                this.outLoading = false
+                const blob = new Blob([res], { type: 'application/msword' });
+                this.$download.saveAs(blob, row.fileName + '.docx')
+            })
+        },
+        async approvalYearPlanFun(approvalStatus, rowId) {
+            const { code } = await yearPlanDetailApproval({
+                id: rowId,
+                approvalStatus: approvalStatus
+            })
+            if (code == 200) {
+                this.$message.success('鎿嶄綔鎴愬姛锛�')
+                this.getYearPlanList()
+            } else {
+                this.$message.error('鎿嶄綔鎴愬姛锛�')
+            }
+        }
+    }
+}
+</script>
+<style scoped>
+.flex_column {
+    display: flex;
+    height: 80vh;
+    flex-direction: column;
+    overflow: auto;
+    justify-content: space-between;
+}
+
+.pagination {
+    display: flex;
+    justify-content: space-between
+}
+
+.items_center {
+    display: flex;
+    align-items: center;
+}
+
+.date_box {
+    margin: 0 5px;
+}
+
+.search {
+    width: 150px;
+    padding: 0 16px;
+}
+</style>

--
Gitblit v1.9.3