From 952a20f1c005d80e9bf881287c40e6f4e4266a0b Mon Sep 17 00:00:00 2001
From: lxp <1928192722@qq.com>
Date: 星期三, 12 三月 2025 15:34:52 +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/index.vue | 298 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 298 insertions(+), 0 deletions(-)
diff --git a/src/views/CNAS/personnel/personnelInfo/index.vue b/src/views/CNAS/personnel/personnelInfo/index.vue
new file mode 100644
index 0000000..9feb358
--- /dev/null
+++ b/src/views/CNAS/personnel/personnelInfo/index.vue
@@ -0,0 +1,298 @@
+<template>
+ <div class="main">
+
+ <div class="main_left">
+ <el-row>
+ <el-col :span="20">
+ <el-input v-model="search" class="div_left_input" clearable placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�" size="small"
+ suffix-icon="el-icon-search" @blur="searchFilter" @clear="searchFilter"
+ @keyup.enter.native="searchFilter"></el-input>
+ </el-col>
+ <el-col :span="4" style="text-align: center;line-height: 30px; margin-top: 14px">
+ <el-button circle icon="el-icon-plus" size="mini" type="primary" @click="handleAdd"></el-button>
+ </el-col>
+ </el-row>
+ <el-tree ref="tree" :data="list" :default-expanded-keys="[1]" :expand-on-click-node="false"
+ :filter-node-method="filterNode" :props="{ children: 'children', label: 'name' }" highlight-current
+ node-key="id" style="height:calc(100% - 80px);overflow-y: scroll;scrollbar-width: none;"
+ @node-click="handleNodeClick">
+ <div slot-scope="{ node, data }" class="custom-tree-node">
+ <el-row style="width: 100%;">
+ <el-col :span="22" style="text-align: left;">
+ <span><i
+ :class="`node_i ${data.children != undefined && data.children.length > 0 ? 'el-icon-folder-opened' : 'el-icon-tickets'}`"></i>
+ {{ data.name }}</span>
+ </el-col>
+ <el-col v-if="node.level > 1 && data.id !== null" :span="2" style="text-align: right;">
+ <el-button size="mini" type="text" @click.stop="remove(node, data)">
+ <i class="el-icon-delete"></i>
+ </el-button>
+ </el-col>
+ </el-row>
+ </div>
+ </el-tree>
+ </div>
+ <div style="width: 10px;"></div>
+ <div class="main_right">
+ <!-- 閮ㄩ棬 -->
+ <Department ref="departRef" :clickNodeVal="clickNodeVal" :currentCompaniesList="currentCompaniesList"
+ :departId="departId" :isDepartment="isDepartment" :isShowAll="isShowAll" />
+ </div>
+ <el-dialog :visible.sync="addDia" title="鏋舵瀯鏂板" width="400px">
+ <div class="body">
+ <el-row style="line-height: 50px;">
+ <el-col :span="6" style="text-align: right;">
+ <span class="required-span">* </span>鏋舵瀯鍚嶇О锛�
+ </el-col>
+ <el-col :offset="1" :span="16">
+ <el-input v-model="addOb.name" clearable placeholder="璇疯緭鍏ユ灦鏋勫悕绉�" size="small"
+ @keyup.enter.native="addStandardTree"></el-input>
+ </el-col>
+ </el-row>
+ </div>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="addDia = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="addStandardTree">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
+ </div>
+</template>
+
+<script>
+import Department from './Department/index.vue';
+import {
+ delDepartmentLims,
+ addDepartmentLims,
+ selectCNSAPersonTree,
+} from '@/api/cnas/personnel/personnelInfo.js'
+
+export default {
+ components: {
+ Department
+ },
+ data() {
+ return {
+ isShowAll: true, // 鏄惁灞曠ず鏍囩鏍�
+ departId: 0,
+ list: [],
+ addDia: false,
+ addOb: {
+ name: '',
+ fatherId: ''
+ },
+ search: '',
+ clickNodeVal: {},
+ addUserForm: {
+ name: ''
+ },
+ currentCompaniesList: [],
+ entity: {
+ name: '',
+ departLimsId: '',
+ orderBy: {
+ field: 'id',
+ order: 'asc'
+ }
+ },
+ overallRecord: '浜哄憳鍒楄〃',
+ isDepartment: false,
+ };
+ },
+ mounted() {
+ this.geList();
+ },
+ methods: {
+ remove(node, data) {
+ this.$confirm("鏄惁鍒犻櫎璇ュ眰绾�", "鎻愮ず", {
+ type: "error"
+ }).then(() => {
+ this.treeLoad = true
+ delDepartmentLims({
+ id: data.id
+ }).then(res => {
+ if (res.code == 201) return
+ this.$message.success('宸插垹闄�')
+ this.geList();
+ })
+ }).catch(e => { })
+ },
+ addStandardTree() {
+ if (this.addOb.name == null || this.addOb.factory == '') {
+ this.$message.error('鏋勬灦鍚嶇О鏄繀濉」')
+ return
+ }
+ addDepartmentLims(this.addOb).then(res => {
+ if (res.code === 201) {
+ return
+ }
+ this.$message.success('娣诲姞鎴愬姛')
+ this.addDia = false
+ this.geList();
+ this.addOb.name = ''
+ this.addOb.fatherId = ''
+ })
+ },
+ handleAdd() {
+ if (this.addOb.fatherId) {
+ this.addDia = true;
+ } else {
+ this.$message.error('璇烽�夋嫨涓�涓灦鏋勫眰绾�')
+ }
+ },
+ // 浜哄憳鍒楄〃缂栬緫
+ updatePerson(row) {
+ const node = this.findNodeById(this.list, row.name);
+ if (node) {
+ this.handleNodeClick(node);
+ } else {
+ this.$message.warning('鏈壘鍒拌浜哄憳');
+ }
+ },
+ // 鏂板缓浜哄憳鍚庡埛鏂版爲
+ refreshTree() {
+ this.geList()
+ },
+ findNodeById(treeData, name) {
+ for (let i = 0; i < treeData.length; i++) {
+ if (treeData[i].name === name) {
+ return treeData[i]; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+ }
+ if (treeData[i].children && treeData[i].children.length > 0) {
+ const foundNode = this.findNodeById(treeData[i].children, name);
+ if (foundNode) {
+ return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+ }
+ }
+ }
+ return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
+ },
+ searchFilter() {
+ this.$refs.tree.filter(this.search);
+ },
+ // 鑾峰彇鏍�
+ geList() {
+ selectCNSAPersonTree().then(res => {
+ this.list = res.data;
+ if (this.list.length > 0) {
+ this.isDepartment = true;
+ this.departId = this.list[0].id
+ }
+ });
+ },
+ filterNode(value, data) {
+ if (!value) return true;
+ return data.name.indexOf(value) !== -1;
+ },
+ handleNodeClick(val, node, el) {
+ //鏍戠殑鍊�
+ this.clickNodeVal = val;
+ // 瀛樺偍鐖剁骇鑺傜偣绾ф暟
+ if (node) {
+ this.getNodeParent(node);
+ this.clickNodeVal.level = node.level;
+ this.clickNodeVal.parent = node.parent.data;
+ }
+ this.entity.departLimsId = val.id;
+ this.addOb.fatherId = val.id;
+ // 鏄惁鏄剧ず璁惧璇︽儏
+ this.isShowAll = val.id !== null;
+ if (val.id) { // 濡傛灉鏄疄楠屽
+ this.departId = val.id;
+ this.isDepartment = true;
+ }
+ if (val.userId) { // 鏄汉鍛�
+ this.departId = val.userId;
+ this.isDepartment = false
+ }
+ },
+ getNodeParent(val) {
+ if (val.parent != null) {
+ this.currentCompaniesList[val.level - 1] = val.data.id;
+ this.selectTree += ' - ' + val.label;
+ this.getNodeParent(val.parent);
+ }
+ }
+ }
+};
+</script>
+
+<style scoped>
+.custom-tree-node {
+ width: 80%;
+ line-height: 32px;
+}
+
+.custom-tree-node .el-icon-delete {
+ color: #3A7BFA;
+ opacity: 0;
+ font-size: 15px;
+}
+
+.custom-tree-node:hover .el-icon-delete {
+ opacity: 1;
+}
+
+.node_i {
+ color: orange;
+ font-size: 18px;
+}
+
+.main {
+ display: flex;
+ padding-top: 10px;
+ box-sizing: border-box;
+}
+
+.main_left {
+ background: #ffffff;
+ text-align: center;
+ height: calc(100vh - 6.5em);
+ width: 240px;
+ border-radius: 15px;
+}
+
+.main_right {
+ width: calc(100% - 240px);
+ border-radius: 15px;
+}
+
+.div_left_input {
+ margin: 15px 0;
+ width: 90%;
+}
+
+>>>.el-tabs--border-card>.el-tabs__header .el-tabs__item {
+ border: 0 none;
+}
+
+>>>.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-active {
+ color: black;
+}
+
+>>>.el-tabs--border-card>.el-tabs__header {
+ border-bottom: none;
+}
+
+.search {
+ background-color: #fff;
+ height: 100%;
+ display: flex;
+ justify-content: flex-end;
+}
+
+.search_thing {
+ width: 350px;
+ display: flex;
+ align-items: center;
+}
+
+.search_label {
+ width: 110px;
+ font-size: 14px;
+ text-align: right;
+}
+
+.search_input {
+ width: calc(100% - 110px);
+}
+</style>
--
Gitblit v1.9.3