Explorar o código

Merge branch '王立生' of sckj/mz-cloud into master

sckj %!s(int64=2) %!d(string=hai) anos
pai
achega
167529eb8d

+ 136 - 0
ruoyi-web/src/components/OrgTreeSelEmbed/index.vue

@@ -0,0 +1,136 @@
+<template>
+  <el-scrollbar wrapClass="scroll-wrap">
+    <el-tree
+      node-key="code"
+      :props="defaultProps"
+      :default-expanded-keys="expands"
+      :expand-on-click-node="false"
+      lazy
+      :load="loadNode"
+      ref="tree"
+      :check-strictly="true"
+      highlight-current
+      @check="checkGroupNode"
+      @node-click="handleNodeClick"
+    />
+  </el-scrollbar>
+</template>
+
+<script>
+import {defineComponent} from "vue";
+import {gettreedata} from "@/api/home";
+import {mapState} from 'vuex'
+export default defineComponent({
+    props:{
+     //是否只显示吉林的数据 true显示吉林省的数据, false显示全国的数据
+      isJl:{
+        type:Boolean,
+        default:true,
+      },
+      isLoad:{
+        type:Boolean,
+        default:true,
+      },
+
+    },
+    data(){
+      return{
+        defaultProps: {
+          childre: 'children',
+          label: 'label',
+          isLeaf: 'leaf',
+        },
+        expands:[],
+        treenode:[],
+        resolve:{},
+
+      }
+    },
+    computed: {
+      ...mapState(['user']),
+    },
+    methods:{
+      updatetree()
+      {
+        if (this.treenode) {
+          this.treenode.childNodes = [] // 清空子节点
+          this.loadNode(this.treenode, this.resolve) // 再次执行 load 的方法
+        }
+      },
+      treeClear(){
+        console.log('重置了');
+        this.$refs.tree.setCheckedKeys([]);
+      },
+      check (data, checked, indeterminate) {
+        this.$refs.tree.setCheckedKeys([data.id])
+      },
+      handleNodeClick(data) {
+        this.$emit('handleNodeClick',data)
+      },
+      checkGroupNode(a, b){
+        if (b.checkedKeys.length > 0) {
+          this.$refs.tree.setCheckedKeys([a.id]);
+          this.$emit('handleNodeClick',a)
+        }else {
+          this.$emit('handleNodeClick',{code:null})
+        }
+      },
+      async getdata(level, cs2, cs3, resolve) {
+
+        var para = {};
+        para.dictType = "xzqh";
+        para.outType = '0';
+        para.para1 = level;
+        para.para2 = cs2;
+        para.para3 = cs3;
+        let data = await gettreedata(para);
+        var treedata = [];
+        if (data.code == 200) {
+          for (let i = 0; i < data.data[0].recordCount; i++) {
+            treedata[i] = {};
+            for (let j = 0; j < data.data[0].columnLabelList.length; j++) {
+              treedata[i][data.data[0].columnLabelList[j].toLowerCase()] = data.data[0].rowList[i][j];
+            }
+          }
+          ;
+          treedata.forEach((item) => {
+            item.isleaf == '0' ? (item.leaf = false) : (item.leaf = true)
+          })
+          resolve(treedata);
+
+        }
+      },
+      async loadNode(node, resolve) {
+
+        if (node.level === 0) {
+          this.treenode=node;
+          this.resolve=resolve;
+          // if (this.isLoad==false) return ;
+          return this.getdata(node.level, 'sj', '', resolve);
+        } else if (node.level >= 1) {
+          //  if (this.isLoad==false) return ;
+          return this.getdata(node.level, node.data.nextlevel, node.data.id, resolve);
+        }
+      },
+      // handleNodeClick(data) {
+      //   this.$emit('handleNodeClick',data)
+      // },
+    },
+    watch: {
+      isLoad(newVal) {
+        this.updatetree();
+      },
+    }
+    ,
+
+  }
+)
+
+</script>
+
+<style lang="scss" scoped>
+  ::v-deep .scroll-wrap{
+    height: 62vh;
+    padding-right: 10px;
+  }
+</style>

+ 2 - 0
ruoyi-web/src/main.js

@@ -21,6 +21,7 @@ import ImageUpload from "@/components/ImageUpload"
 import ImagePreview from "@/components/ImagePreview"
 import Org_tree from '@/components/Org_tree'
 import OrgTreeSel from "@/components/OrgTreeSel"
+import OrgTreeSelEmbed from "@/components/OrgTreeSelEmbed"
 import * as ElIcon from '@element-plus/icons-vue'
 
 const app = createApp(App)
@@ -38,6 +39,7 @@ app.component('FileUpload', FileUpload)
 app.component('ImageUpload', ImageUpload)
 app.component('ImagePreview', ImagePreview)
 app.component('OrgTreeSel', OrgTreeSel)
+app.component('OrgTreeSelEmbed', OrgTreeSelEmbed)
 app.component('Pagination', Pagination)
 app.use(Org_tree)
 app.use(store)

+ 0 - 5
ruoyi-web/src/views/yldt/index.vue

@@ -301,11 +301,6 @@ function exitFullscreen(element) {
 
     function handleQuery() {
       getList();
-      proxy.$selywdata({},(para) => {
-        if (para) {
-           alert(para.wls);
-        }
-      });
     }
     function _renderClusterMarker  (context) {
       var factor = Math.pow(context.count / count.value, 1 / 18);