فهرست منبع

Merge branch 'zl' into dev

zhuliu 3 سال پیش
والد
کامیت
432f201312

+ 2 - 2
src/directives/permission.js

@@ -5,13 +5,13 @@ export default {
         let perVal = bindling.value;
         if(bindling.value){
             
-            let pers=['add','details'];
+            let pers=['/admin/apply','/admin/client','delete'];
             let hasPer = pers.some(item=>{
                 return item == perVal
             });
             if(!hasPer){
                 
-               if(perVal.indexOf('edit')>-1){
+               if(perVal.indexOf('modify')>-1){
 
                 el.children[0].children[0].disabled='true'
           

+ 8 - 0
src/router/index.js

@@ -105,6 +105,14 @@ const routes = [
         },
         component: () => import('@/views/group/index.vue')
       },
+      {
+        path: 'dataPermission',
+        meta: {
+          title: '数据权限管理',
+          active: 'dataPermission'
+        },
+        component: () => import('@/views/dataPermission/index.vue')
+      },
     ]
   },
  

+ 1 - 1
src/views/apply/index.vue

@@ -33,7 +33,7 @@
       <el-table-column prop="createUserName" label="创建人" align="center" show-overflow-tooltip></el-table-column>
       <el-table-column label="操作" align="center" width="150">
         <template slot-scope="scope">
-          <el-dropdown split-button type="primary" size="small" @click="handleEdit(scope.row)" v-permission="'edit'">
+          <el-dropdown split-button type="primary" size="small" @click="handleEdit(scope.row)" v-permission="'modify'">
            编辑
             <el-dropdown-menu slot="dropdown" class="text-align_center">
              

+ 8 - 16
src/views/client/index.vue

@@ -1,8 +1,8 @@
 <template>
   <div class="admin-client">
     <el-form :inline="true">
-      <el-form-item label="用户名">
-        <el-input v-model="queryParams.name" size="small" placeholder="请输入联系人"></el-input>
+      <el-form-item>
+        <el-input v-model="queryParams.name" size="small" placeholder="请输入"></el-input>
       </el-form-item>
       <el-form-item>
         <el-button type="" size="small" @click="getList">查询</el-button>
@@ -293,22 +293,14 @@ export default {
         this.loading = false
       })
     },
-    getFunction() {
-      this.$api.getFunctionList().then(response => {
-        // console.log(response.data)
-        this.authority = response.data
-        // this.tableData = response.data
-        // this.total=response.pageColumn.total
-        // this.loading = false
-      }).catch(error => {
-        this.loading = true
+    getSelect() {
+      this.$api.getDict().then(reponse => {
+        for (let i = 0; i < reponse.data.TENANT_TYPE.length; i++) {
+          this.select[i] = reponse.data.TENANT_TYPE[i]
+        }
+        // this.$set(this.select, reponse.data.TENANT_TYPE)
       })
     },
-    // getSelect() {
-    //   this.$api.getDict().then(response => {
-    //     this.select = response.data.TENANT_TYPE
-    //   })
-    // },
     handleCurrentChange(val) {
       this.queryParams.current = val;
       this.getList();

+ 168 - 0
src/views/dataPermission/components/TreeItem.vue

@@ -0,0 +1,168 @@
+<template>
+  <div class="card">
+    <ul>
+      <li v-for="(item,index) in treeData" :key="index">
+        <div class="item" :class="{'line-left':index!==0,'line-right':index!=treeData.length-1}">
+          <div class="item-name" :class="{'line-bottom':item.child&&item.child.length>0,'line-top':!treeFirst}">
+            <div v-if="!treeFirst" class="reduce" @click="delChild(index)">-</div>
+            <div>
+              {{item.name}}
+              <!-- <input type="text"><input type="text"><input type="text"> -->
+            </div>
+            <div class="plus" ><span @click="addChild(index)">+</span></div>
+          </div>
+        </div>
+        <tree-item v-if="item.child&&item.child.length>0" :tree-data="item.child" />
+      </li>
+    </ul>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'TreeItem',
+  props: {
+    treeData: {
+      type: Array,
+      default: () => []
+    },
+    treeFirst: { //判断是否第一个
+      type: Boolean,
+      default: false
+    }
+  },
+  data() {
+    return {
+    }
+  },
+  created() {
+
+  },
+  methods: {
+    // 添加子元素
+    addChild(index) {
+      if (this.treeData[index].child) {
+        this.treeData[index].child.push({ name: '1' })
+      } else {
+        this.$set(this.treeData[index], 'child', [{ 'name': '1' }])
+      }
+    },
+    // 删除子元素
+    delChild(index) {
+      this.treeData.splice(index, 1)
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+$line-length:20px; //线长
+$spacing:20px; //间距
+$extend:calc(#{$spacing} + 2px); //延长线
+
+// 线样式
+@mixin line{
+    content: "";
+    display: block;
+    width: 3px;
+    height: $line-length;
+    position: absolute;
+    left: 0;
+    right: 0;
+    margin: auto;
+    background: rgb(6, 183, 253);
+}
+// 加减号icon
+@mixin icon{
+  position: absolute;
+  border: solid 1px #666;
+  border-radius: 100%;
+  bottom:-5px;
+  width: 12px;
+  height: 12px;
+  line-height: 10px;
+  text-align: center;
+  color:#666;
+  z-index: 100;
+  cursor: pointer;
+  margin: 0;
+  padding: 0;
+  // opacity: 0;
+}
+
+.card{
+    ul{
+      list-style-type: none;
+        display: flex;
+        justify-content: center;
+        li{
+            .item{
+                display: flex;
+                justify-content: center;
+                align-items: center;
+                position: relative;
+                &-name{
+                    position: relative;
+                    display: flex;
+                    justify-content: center;
+                    align-items: center;
+                    width: 200px;
+                    height:50px;
+                    padding: 5px;
+                    margin: $spacing;
+                    background: coral;
+                    color: #fff;
+                    .plus{
+                      @include icon();
+                      &:hover{
+                        opacity: 100%;
+                      }
+                    }
+                    .reduce{
+                      @include icon();
+                      top:-5px;
+                      &:hover{
+                        opacity: 100%;
+                      }
+                    }
+                }
+            }
+        }
+
+    }
+    // 向下的线
+    .line-bottom{
+        &::after{
+            @include line();
+            bottom: -$line-length;
+        }
+    }
+    // 向上的线
+    .line-top{
+        &::before{
+            @include line();
+            top: -$line-length;
+        }
+    }
+    // 向左的线
+    .line-left{
+        &::after{
+            @include line();
+            width: calc(50% + #{$spacing});
+            height: 3px;
+            left: calc(-50% - #{$extend});
+            top: 0;
+        }
+    }
+    // 向右的线
+    .line-right{
+        &::before{
+            @include line();
+            width: calc(50% + #{$spacing});
+            height: 3px;
+            right: calc(-50% - #{$extend});
+            top: 0;
+        }
+    }
+}
+</style>

+ 273 - 0
src/views/dataPermission/index.vue

@@ -0,0 +1,273 @@
+<template>
+  <div class="admin-department">
+    <el-form :inline="true">
+      <el-form-item>
+        <el-input v-model="queryParams.name" size="small" placeholder="请输入"></el-input>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="" size="small" @click="getList">查询</el-button>
+        <el-button type="primary" size="small" @click="handleAdd(0)">新增</el-button>
+      </el-form-item>
+    </el-form>
+    <el-table
+        row-key="id"
+        v-loading="loading"
+        :data="tableData"
+        border
+        @expand-change="getNode"
+        header-row-class-name="custom-table-header"
+        :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
+    >
+      <el-table-column prop="name" label="数据权限名称" align="" show-overflow-tooltip></el-table-column>
+      <el-table-column prop="tenant" label="所属功能" align="center" show-overflow-tooltip></el-table-column>
+      <el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip></el-table-column>
+      <el-table-column label="操作" align="center" width="150">
+        <template slot-scope="scope">
+          <el-dropdown split-button type="primary" size="small" @click="handleEdit(scope.row)">
+            编辑
+            <el-dropdown-menu slot="dropdown" class="text-align_center">
+              <el-dropdown-item class="color-red" @click.native="handleDelete(scope.row)" divided>删除</el-dropdown-item>
+            </el-dropdown-menu>
+          </el-dropdown>
+        </template>
+      </el-table-column>
+    </el-table>
+       <div class="pagination">
+      <el-pagination :current-page.sync="queryParams.current" :page-size="queryParams.size" :total="total" @current-change="handleCurrentChange" layout="total, prev, pager, next, jumper" background></el-pagination>
+    </div>
+    <el-dialog :title="title" :visible.sync="visible" width="100%" :before-close="close">
+      <el-form v-if="visible" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="80px" label-position="left">
+           <!-- <el-form-item label="所属租户" prop="tenant">
+              <el-tooltip
+                  class="item"
+                  effect="dark"
+                  :disabled="!userinfo.tenantName"
+                  :content="userinfo.tenantName"
+                  placement="top-start"
+                >
+                <el-input v-model="userinfo.tenantName" placeholder="请输入所属租户" :readonly="true" ></el-input>
+                </el-tooltip>
+            </el-form-item> -->
+           <el-form-item label="所属功能" prop="function">
+           <el-cascader
+              v-model="ruleForm.function"
+              :options="functionList"
+              :props="{multiple:true, checkStrictly: false,value:'id',label:'name' }"
+              collapse-tags
+              placeholder="请选择所属功能"
+              clearable
+              style="width:100%"></el-cascader>
+        </el-form-item>
+        <el-form-item label="数据权限">
+             <template>
+                  <div style="border:1px solid #C0C0C0;border-radius:4px;overflow:auto">
+                    <div class="tree">
+                        <div class="tree-content" @mousedown.stop="move">
+                        <tree-item :tree-data="treeData" :tree-first="true" />
+                        </div>
+                    </div>
+                  </div>
+                </template>
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="ruleForm.remark" placeholder="请输入备注" type="textarea" maxlength="100" show-word-limit></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="close">取 消</el-button>
+        <el-button type="primary" @click="submit" :loading="btnLoading">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+import TreeItem from './components/TreeItem'
+export default {
+  components: {
+    Treeselect,
+    TreeItem
+  },
+  data() {
+    return {
+          treeData: [{
+        name: '1',
+        child: [
+          { name: '2',
+            child: [{ name: '1' }, { name: '2' }]
+          },
+          { name: '1',
+            child: [{ name: '1' }, { name: '2' }]
+          }
+        ]
+      }],
+      visible: false,
+      loading: false,
+      btnLoading: false,
+      total: 0,
+      tableData: [],
+      title: '',
+      show:false,
+      disabled:false,
+      lastName:'',
+      functionLis:[],
+      queryParams: {
+        size: 10,
+        current: 1,
+        name: ''
+      },
+      ruleForm: {},
+      roleList:[],
+      rules: {
+        name: [{ required: true, message: '请输入部门名称', trigger: 'blur' },],
+        parentId: [{ required: true, message: '请选择所属部门', trigger: 'change' },],
+      },
+    }
+  },
+  mounted() {
+    this.getList()
+    this.getFunctionList()
+  },
+  computed: {
+    userinfo() {
+      return this.$store.state.admin.userinfo
+    }
+  },
+  methods: {
+     move(e) {
+      const odiv = e.currentTarget // 获取元素
+      console.log(odiv)
+
+      // 算出鼠标相对元素的位置
+      const disX = e.clientX - odiv.offsetLeft
+      const disY = e.clientY - odiv.offsetTop
+      document.onmousemove = (e) => { // 鼠标按下并移动的事件
+        // 用鼠标的位置减去鼠标相对元素的位置,得到元素的位置
+        const left = e.clientX - disX
+        const top = e.clientY - disY
+
+        // 绑定元素位置到positionX和positionY上面
+        this.positionX = top
+        this.positionY = left
+
+        // 移动当前元素
+        odiv.style.left = left + 'px'
+        odiv.style.top = top + 'px'
+      }
+      document.onmouseup = () => {
+        document.onmousemove = null
+        document.onmouseup = null
+      }
+    },
+    getNode(node){
+      console.log(node)
+
+    },
+    normalizer(node) {
+      return {
+        id: node.id,
+        label: node.name,
+      }
+    },
+    handleAdd(updepartmentId,row) {
+      console.log(row)
+      this.title = '新增数据权限'
+      this.visible = true
+      
+    },
+    handleEdit(row) {
+      this.title = '编辑数据权限'
+      this.visible = true
+      this.ruleForm = { ...row }
+    },
+    close() {
+      this.visible = false
+    },
+     handleCurrentChange(val) {
+      this.queryParams.current = val;
+      this.getList();
+    },
+    getList() {
+      this.loading = true
+      this.$api.getDepartmentList(this.queryParams).then(response => {
+        
+        this.tableData = response.data
+        this.total=response.pageColumn.total
+        this.loading = false
+      }).catch(error => {
+        this.loading = false
+      })
+    },
+    getFunctionList() {
+      this.$api.getFunctionList().then(response => {
+        this.functionList = response.data
+      })
+    },
+    submit() {
+      this.$refs.ruleForm.validate((valid) => {
+        if (valid) {
+          this.btnLoading = true
+          if (this.ruleForm.id) {
+            this.$api.editDepartment(this.ruleForm).then(response => {
+              this.$message.success('编辑成功')
+              this.btnLoading = false
+              this.getList()
+              this.close()
+            }).catch(error => {
+              this.btnLoading = false
+            })
+          } else {
+            this.ruleForm.tenant=this.userinfo.tenantId
+            this.$api.addDepartment(this.ruleForm).then(response => {
+              this.$message.success('新增成功')
+              this.btnLoading = false
+              this.getList()
+              this.close()
+            }).catch(error => {
+              this.btnLoading = false
+            })
+          }
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    handleDelete(row) {
+      this.$confirm('确认删除本条数据吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.loading = true
+        this.$api.deleteDepartment({ id: row.id }).then(response => {
+          this.$message.success('删除成功')
+          this.loading = false
+          this.getList()
+        }).catch(error => {
+          this.loading = false
+        })
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.admin-department {
+
+}
+.tree{
+    background: #fff;
+    min-height: calc(100vh - 110px);
+    position: relative;
+    &-content{
+      background: #fff;
+      position: absolute;
+      top: 0;
+      left: 0;
+    }
+}
+</style>

+ 8 - 1
src/views/department/index.vue

@@ -20,7 +20,12 @@
     >
       <el-table-column prop="name" label="部门名称" align="" show-overflow-tooltip></el-table-column>
       <el-table-column prop="tenant" label="所属租户" align="center" show-overflow-tooltip></el-table-column>
-      <el-table-column prop="role" label="角色" align="center" show-overflow-tooltip></el-table-column>
+      <el-table-column label="角色" align="center" show-overflow-tooltip>
+         <template slot-scope="scope">
+          <span v-for="item in scope.row.roleList">{{item.name}}
+          </span>
+        </template>
+      </el-table-column>
       <el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip></el-table-column>
       <el-table-column label="操作" align="center" width="150">
         <template slot-scope="scope">
@@ -186,6 +191,7 @@ export default {
     },
     getList() {
       this.loading = true
+      this.queryParams.tenant=this.userinfo.tenantId
       this.$api.getDepartmentList(this.queryParams).then(response => {
         
         this.tableData = response.data
@@ -233,6 +239,7 @@ export default {
             })
           } else {
             this.ruleForm.tenant=this.userinfo.tenantId
+            console.log(this.ruleForm)
             this.$api.addDepartment(this.ruleForm).then(response => {
               this.$message.success('新增成功')
               this.btnLoading = false

+ 2 - 0
src/views/function/index.vue

@@ -177,6 +177,7 @@ export default {
         this.show=false
         this.disabled=false
          this.ruleForm = {
+         
         function: id
       }
       }else{
@@ -184,6 +185,7 @@ export default {
         this.disabled=true
         this.functionName=name
          this.ruleForm = {
+           sign:row.sign,
         function: id,
         apply:applyid,
         path:row.path

+ 12 - 7
src/views/group/index.vue

@@ -1,8 +1,8 @@
 <template>
   <div class="admin-group">
     <el-form :inline="true">
-      <el-form-item label="用户组名称">
-        <el-input v-model="queryParams.name" size="small" placeholder="请输入用户组名称"></el-input>
+      <el-form-item>
+        <el-input v-model="queryParams.name" size="small" placeholder="请输入"></el-input>
       </el-form-item>
       <el-form-item>
         <el-button type="" size="small" @click="getList">查询</el-button>
@@ -21,19 +21,23 @@
       <!-- <el-table-column prop="user_group_up" label="上级用户组" align="center" show-overflow-tooltip></el-table-column> -->
       <el-table-column label="组员" align="center" show-overflow-tooltip>
         <template slot-scope="scope">
-          <span v-for="item in scope.row.users">{{item.name}}
-            
+          <span v-for="item in scope.row.userList">{{item.name}},
+          </span>
+        </template>
+      </el-table-column>
+      <el-table-column label="角色" align="center" show-overflow-tooltip>
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.roleList">{{item.name}},
           </span>
         </template>
       </el-table-column>
-      <el-table-column prop="role" label="角色" align="center" show-overflow-tooltip></el-table-column>
       <el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip></el-table-column>
       <el-table-column label="操作" align="center" width="150">
         <template slot-scope="scope">
           <el-dropdown split-button type="primary" size="small" @click="handleEdit(scope.row)">
             编辑
             <el-dropdown-menu slot="dropdown" class="text-align_center">
-              <el-dropdown-item @click.native="handleAdd(scope.row.id)">新增</el-dropdown-item>
+              <!-- <el-dropdown-item @click.native="handleAdd(scope.row.id)">新增</el-dropdown-item> -->
               <el-dropdown-item class="color-red" @click.native="handleDelete(scope.row)" divided>删除</el-dropdown-item>
             </el-dropdown-menu>
           </el-dropdown>
@@ -172,6 +176,7 @@ export default {
         if (valid) {
           this.btnLoading = true
           if (this.ruleForm.id) {
+            console.log(this.ruleForm)
             this.$api.editGroup(this.ruleForm).then(response => {
               this.$message.success('编辑成功')
               this.btnLoading = false
@@ -203,7 +208,7 @@ export default {
         type: 'warning'
       }).then(() => {
         this.loading = true
-        this.$api.deleteDepartment({ id: row.id }).then(response => {
+        this.$api.deleteGroup({ id: row.id }).then(response => {
           this.$message.success('删除成功')
           this.loading = false
           this.getList()

+ 6 - 2
src/views/layout/index.vue

@@ -23,7 +23,7 @@
                   <i class="el-icon-coordinate"></i>
                   <span slot="title">其他系统管理员管理</span>
             </el-menu-item> -->
-            <el-menu-item index="client">
+            <el-menu-item index="client" v-permission="'/admin/client'">
               <i class="el-icon-film"></i>
               <span slot="title">租户管理</span>
             </el-menu-item>
@@ -51,7 +51,7 @@
                </template>
              </el-menu-item>
             </el-submenu> -->
-            <el-menu-item index="apply">
+            <el-menu-item index="apply" v-permission="'/admin/apply'">
               <i class="el-icon-setting"></i>
               <span slot="title">应用功能管理</span>
             </el-menu-item>
@@ -76,6 +76,10 @@
               <i class="el-icon-eleme"></i>
               <span slot="title">角色管理</span>
             </el-menu-item>
+             <el-menu-item index="dataPermission">
+              <i class="el-icon-eleme"></i>
+              <span slot="title">数据权限管理</span>
+            </el-menu-item>
 
           </el-menu>
         </el-aside>

+ 6 - 0
src/views/position/index.vue

@@ -12,6 +12,12 @@
     <el-table :data="tableData" style="width: 100%">
       <!-- <el-table-column prop="department" label="所属部门" align="center" show-overflow-tooltip></el-table-column> -->
        <el-table-column prop="position" label="职位名称" align="center" show-overflow-tooltip></el-table-column>
+       <el-table-column label="角色" align="center" show-overflow-tooltip>
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.roleList">{{item.name}}
+          </span>
+        </template>
+       </el-table-column>
        <el-table-column  label="是否唯一" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
         <span style="margin-left: 10px" v-if="scope.row.ismore==0">否</span>

+ 16 - 6
src/views/role/index.vue

@@ -1,8 +1,8 @@
 <template>
   <div class="admin-role">
     <el-form :inline="true">
-      <el-form-item label="角色名称">
-        <el-input v-model="queryParams.name" size="small" placeholder="请输入角色名称"></el-input>
+      <el-form-item>
+        <el-input v-model="queryParams.name" size="small" placeholder="请输入"></el-input>
       </el-form-item>
       <el-form-item>
         <el-button type="" size="small" @click="getList">查询</el-button>
@@ -18,15 +18,25 @@
         :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
     >
       <el-table-column prop="name" label="角色名称" align="" show-overflow-tooltip></el-table-column>
-      <el-table-column prop="gongneng" label="功能权限" align="center" show-overflow-tooltip></el-table-column>
-      <el-table-column prop="shuju" label="数据权限" align="center" show-overflow-tooltip></el-table-column>
+      <el-table-column label="功能权限" align="center" show-overflow-tooltip>
+        <template slot-scope="scope">
+          <span v-for="item in scope.row.functionList">{{item.name}}
+          </span>
+        </template>
+      </el-table-column>
+      <el-table-column label="数据权限" align="center" show-overflow-tooltip>
+         <template slot-scope="scope">
+          <span v-for="item in scope.row.dataList">{{item.name}}
+          </span>
+        </template>
+      </el-table-column>
       <el-table-column prop="remark" label="备注" align="center" show-overflow-tooltip></el-table-column>
       <el-table-column label="操作" align="center" width="150">
         <template slot-scope="scope">
           <el-dropdown split-button type="primary" size="small" @click="handleEdit(scope.row)">
             编辑
             <el-dropdown-menu slot="dropdown" class="text-align_center">
-              <el-dropdown-item @click.native="handleAdd(scope.row.id)">新增</el-dropdown-item>
+              <!-- <el-dropdown-item @click.native="handleAdd(scope.row.id)">新增</el-dropdown-item> -->
               <el-dropdown-item class="color-red" @click.native="handleDelete(scope.row)" divided>删除</el-dropdown-item>
             </el-dropdown-menu>
           </el-dropdown>
@@ -101,7 +111,7 @@ export default {
         name: ''
       },
       ruleForm: {
-        function:[]
+        function:[[1,6,29]]
       },
       rules: {
         name: [{ required: true, message: '请输入部门名称', trigger: 'blur' },],

+ 293 - 0
src/views/user/index.vue

@@ -599,6 +599,7 @@
 </template>
 
 <script>
+<<<<<<< HEAD
 	import Treeselect from "@riophae/vue-treeselect";
 	import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 	export default {
@@ -933,6 +934,298 @@
 			},
 		},
 	};
+=======
+import Treeselect from '@riophae/vue-treeselect'
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+export default {
+  components: {
+    Treeselect
+  },
+  data() {
+    return {
+      showvisible: false,
+      visible: false,
+      loading: false,
+      btnLoading: false,
+      total: 0,
+      tableData: [],
+      title: '',
+        roleList: [{
+          value: '选项1',
+          label: '黄金糕'
+        }, {
+          value: '选项2',
+          label: '双皮奶'
+        }, {
+          value: '选项3',
+          label: '蚵仔煎'
+        }, {
+          value: '选项4',
+          label: '龙须面'
+        }, {
+          value: '选项5',
+          label: '北京烤鸭'
+        }],
+      queryParams: {
+        size: 10,
+        current: 1,
+        // username: '',
+        name: ''
+      },
+      labelVal:'',
+    departmentList: [],
+     positionList:[],
+     groupList:[],
+     roleList:[],
+      genderObj: {
+        0: '女',
+        1: '男'
+      },
+   positionAndDepartment:{},
+      // departmentList: [],
+      ruleForm: {
+      },
+      rules: {
+        name: [{ required: true, message: '请输入姓名', trigger: 'blur' },],
+        username: [{ required: true, message: '请输入账号', trigger: 'blur' },],
+        password: [{ required: true, message: '请输入密码', trigger: 'blur' },],
+        mobile:[{required:true,message: "请输入手机号码", trigger: "blur"},
+                {pattern:/(^((\+86)|(86))?(1[3-9])\d{9}$)|(^(0\d{2,3})-?(\d{7,8})$)/,
+                message: '输入的手机号码格式不正确,请重新输入',trigger:'blur'}],
+    		email:[{required:true,message: "请输入手机号码", trigger: "blur"},
+      		{pattern:/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9_\.\-])+\.)+([a-zA-Z0-9]{2,4})+$/,
+       		 message:'请输入正确的邮箱格式',trigger:'blur'}],
+        sex: [{ required: true, message: '请选择性别', trigger: 'change' },],
+        // position: [{ required: true, message: '请选择职位', trigger: 'change' },],
+        // department: [{ required: true, message: '请选择部门', trigger: 'change' },],
+        state: [{ required: true, message: '请选择', trigger: 'change' },],
+      },
+    }
+  },
+  watch: {
+    "positionAndDepartment.department"() {
+        if (this.$refs.deptIdCascader) {
+            this.$refs.deptIdCascader.dropDownVisible = false
+        }
+    },
+    "ruleForm.email"(val){
+        if(val.indexOf('@qq.com')!=-1){
+        var index = val.indexOf('@qq.com')
+        var str = val.substring(0,index)
+        this.ruleForm.qqNumber=str
+       
+      }else if(val.indexOf('@qq.com')==-1){
+      
+      }
+    },
+  
+},
+computed: {
+    userinfo() {
+      return this.$store.state.admin.userinfo
+    }
+  },
+  mounted() {
+    this.getList()
+    this.getDepartment()
+    this.getPositionList()
+    this.getGroupList()
+    this.getRoleList()
+  },
+  methods: {
+    	change(e) {
+      this.$forceUpdate();
+    },
+    // getqqNumber(val){
+    //   if(val.indexOf('@qq.com')){
+    //     var index = val.indexOf('@qq.com')
+    //     var str = val.substring(0,index)
+    //     this.ruleForm.qqNumber=str
+    //     console.log(this.ruleForm.qqNumber,str)
+    //   }else{
+    //     this.ruleForm.qqNumber=''
+    //   }
+    // },
+     handleClose(index) {
+        this.ruleForm.positions.splice(index, 1);
+        console.log(this.ruleForm.positions)
+      },
+     handleChange(val) {
+      // console.log(val)
+      let res = this.getVal(val, this.departmentList, []);
+      console.log(res, res.join("/"));
+      this.labelVal = res.join("/");
+    },
+    getVal(data, options, arr) {
+      options.forEach((e) => {
+        data.forEach((i) => {
+          if (i == e.id) {
+            arr.push(e.name||e.position);
+            return;
+          } else {
+            if (e.children) {
+              this.getVal([i], e.children, arr);
+            } else {
+              return;
+            }
+          }
+        });
+      });
+      return arr;
+
+    },
+     normalizer(node) {
+    
+        if (node.children && !node.children.length) {
+        delete node.children;
+      }
+      return {
+        id: node.id,
+        label: node.name,
+        children: node.children
+      };
+    },
+    handleAdd() {
+      this.title = '新增人员'
+      this.visible = true
+      this.ruleForm = {
+        gender: 0,
+        state: 1,
+        positions:[],
+   
+      }
+    },
+    handleEdit(row) {
+      this.title = '编辑人员'
+      this.visible = true
+      this.ruleForm = { ...row }
+    },
+    handleDetails(row) {
+      console.log(row)
+      this.title = '人员详情'
+      this.showvisible = true
+      this.ruleForm.apply = row
+    },
+    close() {
+      this.visible = false
+      this.showvisible = false
+    },
+    getDepartment() {
+      this.$api.getDepartmentList().then(response => {
+        this.departmentList = response.data
+      })
+    },
+    getPositionList(){
+      this.$api.getPositionList().then(response => {
+        this.positionList = response.data
+      })
+    },
+     getGroupList(){
+      this.$api.getGroupList().then(response => {
+        this.groupList = response.data
+      })
+    },
+     getRoleList(){
+      this.$api.getRoleList().then(response => {
+        this.roleList = response.data
+      })
+    },
+     showInputLabel() {
+      console.log(this.positionAndDepartment) 
+      let departmentName=this.getVal([this.positionAndDepartment.department[this.positionAndDepartment.department.length-1]],this.departmentList,[])
+       let positionName=this.getVal([this.positionAndDepartment.position],this.positionList,[])
+        this.ruleForm.positions.push({
+        position:this.positionAndDepartment.position,
+        positionName:positionName[0],
+        department:this.positionAndDepartment.department[this.positionAndDepartment.department.length-1],
+        departmentName:departmentName[departmentName.length-1]
+      })
+      console.log(this.ruleForm.positions)
+        console.log(this.ruleForm)
+        this.positionAndDepartment={}
+         this.labelVal=""
+    },
+    getList() {
+      this.loading = true
+       this.queryParams.tenant=this.userinfo.tenantId
+      this.$api.getPersonnelList(this.queryParams).then(response => {
+        this.tableData = response.data
+        this.total = response.pageColumn.total
+        this.loading = false
+      }).catch(error => {
+        this.loading = false
+      })
+    },
+    handleCurrentChange(val) {
+      this.queryParams.current = val;
+      this.getList();
+    },
+    submit() {
+      this.$refs.ruleForm.validate((valid) => {
+        if (valid) {
+          console.log(this.ruleForm)
+          this.btnLoading = true
+          if (this.ruleForm.id) {
+            this.$api.editPersonnel(this.ruleForm).then(response => {
+              this.$message.success('编辑成功')
+              this.btnLoading = false
+              this.getList()
+              this.close()
+            }).catch(error => {
+              this.btnLoading = false
+            })
+          } else {
+            this.ruleForm.tenant=this.userinfo.tenantId
+            this.$api.addPersonnel(this.ruleForm).then(response => {
+              this.$message.success('新增成功')
+              this.btnLoading = false
+              this.getList()
+              this.close()
+            }).catch(error => {
+              this.btnLoading = false
+            })
+          }
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    handleReset(row) {
+      this.$confirm('确认将用户密码重置吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.loading = true
+        this.$api.resetCommonUserPassword({ id: row.id }).then(response => {
+          this.$message.success('重置成功')
+          this.loading = false
+          this.getList()
+        }).catch(error => {
+          this.loading = false
+        })
+      })
+    },
+    handleDelete(row) {
+      this.$confirm('确认删除本条数据吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.loading = true
+        this.$api.deletePersonnel({ id: row.id }).then(response => {
+          this.$message.success('删除成功')
+          this.loading = false
+          this.getList()
+        }).catch(error => {
+          this.loading = false
+        })
+      })
+    }
+  }
+}
+>>>>>>> zl
 </script>
 
 <style lang="scss" scoped>