zhuliu 3 lat temu
rodzic
commit
2da78af4c8
2 zmienionych plików z 39 dodań i 63 usunięć
  1. 12 0
      src/api/admin.js
  2. 27 63
      src/views/dataPermission/index.vue

+ 12 - 0
src/api/admin.js

@@ -313,6 +313,18 @@ export default {
       })
   },
 
+    /**
+     * 
+   * 根据功能查字典
+  */
+     getDictList(params) {
+      return axios({
+        url:'/permission/api/data/getDataSources',
+        method:'post',
+        params: params
+      })
+    },
+
   /**
      * 
    * 查询数据权限

+ 27 - 63
src/views/dataPermission/index.vue

@@ -69,7 +69,7 @@
                     <el-col :span="7">
                       <el-select v-model="item.field">
                         <el-option
-                        v-for="item in dictionaries.dataDict"
+                        v-for="item in dictList"
                         :key="item.dataSourceField"
                         :label="item.dataSourceName"
                         :value="item.dataSourceField">
@@ -92,14 +92,20 @@
                           allow-create
                           default-first-option
                           placeholder="请选择">
-                             <el-option
+                             <!-- <el-option
                              :value="userinfo.tenantName"
                              >
                                <el-tooltip class="item" effect="dark" :content="userinfo.tenantName" placement="top">
                                  <span style="float: left;width:100px;white-space:nowrap;overflow:hidden;text-overflow: ellipsis;">{{userinfo.tenantName}}</span>
                                 </el-tooltip> 
                                 <span style="float: right; color: #8492a6; font-size: 13px;margin-left:30px">租户</span>
-                              </el-option>
+                              </el-option> -->
+                              <el-option
+                              v-for="item in dict2List"
+                              :key="item.dataSourceField"
+                              :label="item.dataSourceName"
+                              :value="item.dataSourceField">
+                      </el-option>
                         </el-select>
                       </el-col>
                       <el-col :span="3">
@@ -118,36 +124,6 @@
         <el-button type="primary" @click="submit" :loading="btnLoading">确 定</el-button>
       </div>
     </el-dialog>
-     <!-- <el-table
-    ref="multipleTable"
-    :data="option"
-    tooltip-effect="dark"
-    style="width: 100%"
-    @selection-change="handleSelectionChange">
-    <el-table-column
-      type="selection"
-      width="55">
-    </el-table-column>
-    <el-table-column
-      label="日期"
-      width="120">
-      <template slot-scope="scope">{{ scope.row.date }}</template>
-    </el-table-column>
-    <el-table-column
-      prop="name"
-      label="姓名"
-      width="120">
-    </el-table-column>
-    <el-table-column
-      prop="address"
-      label="地址"
-      show-overflow-tooltip>
-    </el-table-column>
-  </el-table>
-  <div style="margin-top: 20px">
-    <el-button @click="toggleSelection([option[1], option[2]])">切换第二、第三行的选中状态</el-button>
-    <el-button @click="toggleSelection()">取消选择</el-button>
-  </div> -->
   </div>
 </template>
 
@@ -168,36 +144,8 @@ export default {
   data() {
     name: 'DataPermission'
     return {
-       option: [{
-          date: '2016-05-03',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1518 弄'
-        }, {
-          date: '2016-05-02',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1518 弄'
-        }, {
-          date: '2016-05-04',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1518 弄'
-        }, {
-          date: '2016-05-01',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1518 弄'
-        }, {
-          date: '2016-05-08',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1518 弄'
-        }, {
-          date: '2016-05-06',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1518 弄'
-        }, {
-          date: '2016-05-07',
-          name: '王小虎',
-          address: '上海市普陀区金沙江路 1518 弄'
-        }],
-      options:[{label:'你好',value:1},{label:'你好1',value:2},{label:'你好2',value:3}],   
+      dictList:[],
+      dict2List:[],
       visible: false,
       loading: false,
       btnLoading: false,
@@ -232,6 +180,7 @@ export default {
  
   mounted() {
     this.getList()
+    this.getDictList()
     this.getFunctionList()
     // console.log(this.fun)
     // this.func=this.fun
@@ -244,6 +193,7 @@ export default {
       return this.$store.state.admin.dictionaries
     },
     userinfo() {
+      console.log(this.$store.state.admin.userinfo)
       return this.$store.state.admin.userinfo
     }
   },
@@ -252,6 +202,8 @@ export default {
       // console.log(val)
         // this.$refs.dataTable.clearSelection()
       this.func = val
+      this.getDictList()
+      
       this.getList()
       
     },
@@ -263,6 +215,17 @@ export default {
     // }
   },
   methods: {
+    getDictList(){
+      console.log(this.func)
+      this.$api.getDictList({tableName:this.func.fun.id}).then(response => {
+        // console.log(response)
+        this.dictList = response.data
+      })
+      this.$api.getDictList({tableName:'local'}).then(response => {
+        // console.log(response)
+        this.dict2List = response.data
+      })
+    },
       // toggleSelection(rows) {
       //   console.log(rows)
       //   if (rows) {
@@ -321,6 +284,7 @@ export default {
         //   value: "1"
         // }
         a[0]=this.list[0]
+        a[0].nodeType="sql"
         //  a.nodeType='logic'
       }else{
         a[0]=this.list[0]