Browse Source

数据权限增查

zhuliu 3 years ago
parent
commit
00a3898ef4
2 changed files with 14 additions and 34 deletions
  1. 1 1
      src/api/admin.js
  2. 13 33
      src/views/dataPermission/index.vue

+ 1 - 1
src/api/admin.js

@@ -291,7 +291,7 @@ export default {
    * 查询数据权限
   */
     getDataList(params) {
-      return axios.get('/permission/api/data/queryPageList', { params })
+      return axios.get('/permission/api/data/queryList', { params })
     },
   /**
     * 编辑数据权限

+ 13 - 33
src/views/dataPermission/index.vue

@@ -51,14 +51,9 @@
             </el-form-item> -->
            <el-form-item label="所属功能" prop="function">
             <el-input v-model="ruleForm.function" size="small" :readonly="true" placeholder="请输入所属功能"></el-input>
-           <!-- <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="数据权限名称" prop="function">
+            <el-input v-model="ruleForm.name" size="small" :readonly="true" placeholder="请输入数据权限名称"></el-input>
         </el-form-item>
         <el-form-item label="数据权限">
              <template>
@@ -115,7 +110,7 @@
                           filterable
                           allow-create
                           default-first-option
-                          placeholder="请选择文章标签">
+                          placeholder="请选择">
                              <el-option
                              :value="userinfo.tenantName"
                              >
@@ -180,26 +175,7 @@ export default {
         name: [{ required: true, message: '请输入部门名称', trigger: 'blur' },],
         parentId: [{ required: true, message: '请选择所属部门', trigger: 'change' },],
       },
-      list:[{
-        logicOpr:'and',
-        field:'姓名',
-        opr:'=',
-        value:'你好'},
-        {
-        logicOpr:'你好1',
-        field:'年龄',
-        opr:'=',
-        value:'4'},
-        {
-        logicOpr:'or',
-        field:'性别',
-        opr:'=',
-        value:'男'},
-        {
-        logicOpr:'not',
-        field:'爱好',
-        opr:'=',
-        value:'篮球'},],
+      list:[],
       
       dataList:
         {
@@ -238,7 +214,7 @@ export default {
   mounted() {
     this.getList()
     this.getFunctionList()
-    this.ListToTree()
+    // this.ListToTree()
   },
   computed: {
     dictionaries() {
@@ -278,7 +254,8 @@ export default {
         }
       }
       console.log(a)
-      this.TreeToList(a[a.length-1])
+      this.ruleForm.rule = JSON.stringify(a[a.length-1])
+      // this.TreeToList(a[a.length-1])
     },
     TreeToList(data){
        var root = data
@@ -332,7 +309,7 @@ export default {
       }
       s(i)
       console.log(a)
-      this.data= a
+      this.list= a
     },
     getNode(node){
       console.log(node)
@@ -347,11 +324,12 @@ export default {
       // console.log(row)
       this.title = '新增数据权限'
       this.visible = true
-      
+      this.ruleForm={}
     },
     handleEdit(row) {
       this.title = '编辑数据权限'
       this.visible = true
+      this.TreeToList(JSON.parse(row.rule))
       this.ruleForm = { ...row }
     },
     close() {
@@ -381,6 +359,7 @@ export default {
       this.$refs.ruleForm.validate((valid) => {
         if (valid) {
           this.btnLoading = true
+          this.ListToTree()
           if (this.ruleForm.id) {
             this.$api.editData(this.ruleForm).then(response => {
               this.$message.success('编辑成功')
@@ -392,6 +371,7 @@ export default {
             })
           } else {
             this.ruleForm.tenant=this.userinfo.tenantId
+            console.log(this.ruleForm)
             this.$api.addData(this.ruleForm).then(response => {
               this.$message.success('新增成功')
               this.btnLoading = false