소스 검색

主体环境修改

ljr-395181403 1 년 전
부모
커밋
42c93104e0

+ 18 - 5
src/components/search-bar/index.vue

@@ -22,12 +22,18 @@
                 <template v-else-if="item.component == 'SelectOrgTree'">
                     <select-org-tree
                         ref="orgTree"
-                        :api-name="item.apiName || 'getOrgTree'"
+                        v-model="item.value"
+                        :api-name="item.apiName || 'getTree'"
                         :nodeKey="item.nodeKey || 'id'"
-                        :type="item.type || 'APP'"
-                        :defaultSelectRoot="item.defaultSelectRoot"
-                        @orgTreeValue="getOrgTreeValue"
-                        @orgRootValue="getOrgRootValue"
+                        :name="item.name"
+                        :type="item.type"
+                        :filterable="item.filterable == false ? false : true"
+                        :defaultCurrentUserOrg="item.defaultCurrentUserOrg"
+                        :defaultSearch="item.defaultSearch == false ? false : true"
+                        :needDeleted="item.needDeleted === true ? true : false"
+                        :searchParams="item.searchParams ? item.searchParams : {}"
+                        v-bind="item.attr"
+                        @search="search"
                     ></select-org-tree>
                 </template>
                 <!-- 应用系统下拉列表 -->
@@ -134,6 +140,13 @@ export default {
             const name = key == "id" ? "orgId" : "orgCode"
             this.form.find(item => item.name == name).value = val
         },
+        // 默认查询
+        search(defaultSearch) {
+            if (defaultSearch) {
+                this.handleSearch()
+            }
+            this.$emit("submitDefaultSearch", this.setCondition())
+        },
         getOrgRootValue(val, key) {
             this.getOrgTreeValue(val, key)
             this.$emit("submitDefaultSearch", this.setCondition())

+ 321 - 184
src/components/select-org-tree/index.vue

@@ -1,200 +1,337 @@
-<!--
-机构下拉树组件
-@Author: linqian
-@Date: 2021-08-02 13:49
--->
 <template>
-  <el-select
-    ref="selectOrgTree"
-    class="dg-select"
-    v-model="selectedNodeLabel"
-    v-bind="$attrs"
-    v-on="$listeners"
-    @filter-change="handleFilterOrg"
-    @clearSelect="handleClearSelect"
-    :placeholder="placeholder"
-    :filterable="filterable"
-    :loadData="treeData"
-    :loading="loading"
-    clearable
-    style="width: 300px"
-    @scroll-bottom="handleScrollBottom"
-  >
-    <dg-tree
-      ref="tree"
-      :key="key"
-      radioType="all"
-      :props="props"
-      v-bind="treeProps"
-      empty-text=""
-      :lazy="lazy"
-      :data="treeData"
-      :render-after-expand="false"
-      v-model="treeValue"
-      @node-click="handleNodeClick"
-    ></dg-tree>
-  </el-select>
+    <el-select
+        ref="selectOrgTree"
+        class="dg-select"
+        :style="{ width: width }"
+        v-model="selectedNodeLabel"
+        v-bind="$attrs"
+        v-on="$listeners"
+        :placeholder="placeholder"
+        :filterable="filterable"
+        :loadData="treeData"
+        :loading="loading"
+        :clearable="clearable"
+        :defaultValue="defaultValue"
+        style="width: 300px"
+        @filter-change="handleFilterOrg"
+        @clearSelect="handleClearSelect"
+        @scroll-bottom="handleScrollBottom"
+    >
+        <dg-tree
+            ref="tree"
+            :key="key"
+            :props="props"
+            v-bind="treeProps"
+            empty-text=""
+            :lazy="lazy"
+            :data="treeData"
+            :render-after-expand="false"
+            v-model="treeValue"
+            radioType="all"
+            @node-click="handleNodeClick"
+        ></dg-tree>
+    </el-select>
 </template>
 
 <script>
-import ElSelect from './select';
-import * as commonApi from '@/api/common';
-export default {
-  components: {
-    ElSelect
-  },
+import ElSelect from "./select"
+// import ElSelect from "./baseSelect";
 
-  props: {
-    nodeKey: {
-      type: String,
-      default: 'code'
-    },
-    apiName: {
-      type: String,
-      default: 'getOrgTree'
-    },
-    placeholder: {
-      type: String,
-      default: '请选择单位名称'
-    },
-    // 目前所知道的值有:APP, 0
-    type: {
-      type: String
-    },
-    // 是否支持查询
-    filterable: {
-      type: Boolean,
-      default: true
+import * as commonApi from "@/api/common"
+export default {
+    components: {
+        ElSelect
     },
-    // 是否默认选中根节点
-    defaultSelectRoot: {
-      type: Boolean,
-      default: false
-    }
-  },
-  data() {
-    return {
-      props: {
-        value: this.nodeKey,
-        label: 'name',
-        children: 'children',
-        isLeaf(data) {
-          return data.isParent !== true;
-        }
-      },
-      treeProps: {
-        nodeKey: this.nodeKey,
-        load: this.loadNode
-      },
-      searchForm: {
-        mtType: 'app',
-        name: '',
-        pageNum: 0,
-        pageSize: 50
-      },
-      treeValue: '',
-      data: [],
-      lazy: true,
-      treeData: [],
-      key: 0,
-      selectedNodeLabel: '',
-      loading: true
-    };
-  },
 
-  computed: {
-    hasSlots() {
-      return this.$slots && this.$slots.default && this.$slots.default.length > 0;
-    }
-  },
-  watch: {
-    treeValue(val) {
-      if (val) {
-        const { data } = this.$refs.tree.getNode(val);
-        this.$refs.selectOrgTree.blur();
-        this.selectedNodeLabel = data.name;
-        this.$refs.selectOrgTree.oldValue = data.name;
-      }
-    }
-  },
-  methods: {
-    handleNodeClick(data, node, tree) {
-      this.$emit('orgTreeValue', data[this.nodeKey], this.nodeKey);
-      this.$emit('orgTreeNode', data);
-    },
-    loadNode(node, resolve) {
-      this.getTree(node.level === 0 ? void 0 : node.data.id, resolve, node.level);
-    },
-    // 组织机构
-    getTree(id, resolve, level) {
-      const { params, apiName } = this;
-      commonApi[apiName]({ id, type: this.type })
-        .then((res) => {
-          // 默认选中根节点
-          if (this.defaultSelectRoot && level === 0) {
-            this.treeValue = res[0][this.nodeKey];
-            this.selectedNodeLabel = res[0].name;
-            this.$emit('orgRootValue', res[0][this.nodeKey], this.nodeKey);
-          }
-          return resolve(res || []);
-        })
-        .catch(() => resolve([]));
-    },
-    handleChange(val) {
-      this.$emit('submitTreeValue', val);
+    props: {
+        value: {
+            type: String,
+            default: ""
+        },
+        // 绑定值是否携带机构名称,如果为true,则value格式为${nodeKey}:orgName
+        valueNeedName: {
+            type: Boolean,
+            default: false
+        },
+        nodeKey: {
+            type: String,
+            default: "code"
+        },
+        apiName: {
+            type: String,
+            default: "getOrgTree"
+        },
+        placeholder: {
+            type: String,
+            default: "请选择单位名称"
+        },
+        type: {
+            type: String
+        },
+        // 是否支持查询
+        filterable: {
+            type: Boolean,
+            default: true
+        },
+        // 是否默认选中根节点
+        defaultSelectRoot: {
+            type: Boolean,
+            default: false
+        },
+        // 是否默认选中当前登录人机构
+        defaultCurrentUserOrg: {
+            type: Boolean,
+            default: true
+        },
+        // 是否默认拼成条件去查询数据
+        defaultSearch: {
+            type: Boolean,
+            default: true
+        },
+        name: String,
+        // USER, TEMP
+        mtType: {
+            type: String,
+            default: "USER"
+        },
+        clearable: {
+            type: Boolean,
+            default: true
+        },
+        // 查询时是否需要删除的数据
+        needDeleted: {
+            type: Boolean,
+            default: false
+        },
+        // 查询时是否需要过滤管理范围
+        needFilterMtAuth: {
+            type: Boolean,
+            default: true
+        },
+        defaultQueryOrg: Boolean,
+        width: {
+            type: String,
+            default: "300px"
+        },
+        searchParams: {
+            type: Object,
+            default: () => {}
+        }
     },
-    searchOrgTree() {},
-    handleFilterOrg(val) {
-      this.searchForm.name = $.trim(val);
-      this.searchForm.pageNum = 0;
-      if (this.searchForm.name) {
-        if (this.lazy === true) {
-          this.key++;
-          this.lazy = false;
+    data() {
+        return {
+            props: {
+                value: this.nodeKey,
+                label: "name",
+                children: "children",
+                isLeaf(data) {
+                    return data.isParent !== true
+                }
+            },
+            treeProps: {
+                nodeKey: this.nodeKey,
+                load: this.loadNode
+            },
+            searchForm: {
+                name: "",
+                mtType: "app",
+                pageNum: 0,
+                pageSize: 50
+            },
+            treeValue: "",
+            data: [],
+            lazy: true,
+            treeData: [],
+            key: 0,
+            selectedNodeLabel: "",
+            loading: true,
+            defaultRoot: false,
+            defaultValue: "",
+            defaultReset: false
         }
-        this.getSearchTree();
-      } else {
-        if (this.lazy === false) {
-          this.key++;
-          this.lazy = true;
+    },
+
+    computed: {
+        hasSlots() {
+            return this.$slots && this.$slots.default && this.$slots.default.length > 0
         }
-      }
     },
-    handleClearSelect() {
-      this.treeValue = '';
-      this.selectedNodeLabel = '';
-      this.$refs.tree.setCurrentKey(null);
-      this.$refs.tree.setRadioKeys([]);
-      this.$emit('orgTreeValue', '', this.nodeKey);
+    watch: {
+        treeValue(val) {
+            if (val) {
+                const { data } = this.$refs.tree.getNode(val)
+                this.$refs.selectOrgTree.blur()
+                this.selectedNodeLabel = data.name
+                this.$refs.selectOrgTree.oldValue = data.name
+                this.$emit("input", this.valueNeedName ? `${val}:${data.name}` : val)
+            }
+        },
+        value: {
+            immediate: true,
+            handler(val) {
+                if (!val) {
+                    this.handleClearSelect()
+                } else if (val && this.valueNeedName) {
+                    this.selectedNodeLabel = this.value.split(":")[1]
+                    this.defaultValue = this.selectedNodeLabel
+                }
+            }
+        }
     },
-    handleScrollBottom() {
-      if (!this.lazy && !this.isLast) {
-        this.searchForm.pageNum++;
-        this.getSearchTree();
-      }
+    methods: {
+        handleNodeClick(data, node, tree) {
+            this.$emit("orgTreeValue", data[this.nodeKey], this.name)
+            this.$emit("orgTreeNode", data)
+        },
+        loadNode(node, resolve) {
+            this.getTree(node.level === 0 ? void 0 : node.data.id, resolve, node.level)
+        },
+        // 组织机构
+        getTree(id, resolve, level) {
+            const { apiName } = this
+            let params = {
+                id
+            }
+            if (this.type) {
+                params["type"] = this.type
+            }
+            commonApi[apiName]({ ...params, ...this.searchParams })
+                .then(res => {
+                    // 默认选中根节点
+                    if ((this.defaultSelectRoot || this.defaultRoot) && level === 0) {
+                        this.treeValue = res[0][this.nodeKey]
+                        this.selectedNodeLabel = res[0].name
+                        this.$emit(
+                            "input",
+                            this.valueNeedName ? `${res[0][this.nodeKey]}:${res[0].name}` : res[0][this.nodeKey]
+                        )
+                        this.$emit("search", this.defaultSearch)
+                    }
+                    const resp = (res || []).map(item => {
+                        return {
+                            ...item,
+                            name: item.deleted == "0" || !item.deleted ? item.name : item.name + "(已删除)"
+                        }
+                    })
+                    return resolve(resp)
+                })
+                .catch(() => resolve([]))
+        },
+        handleChange(val) {
+            this.$emit("submitTreeValue", val)
+        },
+        searchOrgTree() {},
+        handleFilterOrg(val) {
+            this.searchForm.keyword = $.trim(val)
+            this.searchForm.pageNum = 0
+            if (this.defaultReset === true) {
+                this.key++
+                this.defaultReset = false
+            } else {
+                if (this.searchForm.keyword) {
+                    if (this.lazy === true) {
+                        this.key++
+                        this.lazy = false
+                    }
+                    this.getSearchTree()
+                } else {
+                    this.defaultReset = false
+                    if (this.lazy === false) {
+                        this.key++
+                        this.lazy = true
+                    }
+                }
+            }
+        },
+        handleClearSelect() {
+            if (this.clearable) {
+                this.treeValue = ""
+                this.selectedNodeLabel = ""
+                if (this.$refs.tree) {
+                    this.$refs.tree.setCurrentKey(null)
+                    this.$refs.tree.setRadioKeys([])
+                }
+                this.$emit("orgTreeValue", "", this.name)
+                this.$emit("orgTreeNode", {})
+                this.$emit("input", "")
+                this.$emit("change", "")
+            } else {
+                if (this.defaultCurrentUserOrg) {
+                    if (this.$refs.tree) {
+                        this.$refs.tree.setCurrentKey(null)
+                        this.$refs.tree.setRadioKeys([])
+                    }
+                    this.setDefaultCurrentUserOrg(false)
+                    this.defaultValue = ""
+                    this.defaultReset = true
+                    this.lazy = true
+                }
+            }
+        },
+        handleScrollBottom() {
+            if (!this.lazy && !this.isLast) {
+                this.searchForm.pageNum++
+                this.getSearchTree()
+            }
+        },
+        // 查询
+        getSearchTree() {
+            this.loading = true
+            let api = ""
+            if (this.apiName == "roleAuthMtTree") {
+                api = "roleAuthOrgSearch"
+            } else {
+                api = this.name == "govId" ? "govTreeMatch" : "treeMatch"
+            }
+
+            commonApi[api]({
+                ...this.searchForm,
+                needDeleted: this.needDeleted,
+                needFilterMtAuth: this.needFilterMtAuth,
+                ...this.searchParams
+            }).then(res => {
+                let { content, totalElements } = res.data
+                content = content || []
+                const _content = content.map(item => {
+                    return {
+                        ...item,
+                        isParent: true,
+                        name: item.fullName
+                    }
+                })
+                if (this.searchForm.pageNum == 0) {
+                    this.treeData = []
+                }
+                this.treeData = [...this.treeData, ..._content]
+                this.isLast = this.treeData.length == totalElements
+                this.loading = false
+            })
+        },
+        // 设置当前登录人管理单位,默认为主单位
+        setDefaultCurrentUserOrg(search) {
+            // 单位名称: 当前登录人所属机构在管理范围内,则默认所属机构,反之默认根机构第一个
+            const { deptId, securityOrgName, securityOrg, extendtions } = this.$store.state.user.info
+            if (extendtions && (extendtions.haveCurrentOrgMt || extendtions.isAppAdmin == "1")) {
+                const obj = {
+                    code: securityOrg,
+                    id: deptId,
+                    name: securityOrgName
+                }
+                this.selectedNodeLabel = securityOrgName
+                this.defaultValue = securityOrgName
+
+                this.$emit("input", this.valueNeedName ? `${obj[this.nodeKey]}:${securityOrgName}` : obj[this.nodeKey])
+                this.$emit("search", search)
+            } else {
+                this.defaultRoot = true
+            }
+        }
     },
-    // 查询
-    getSearchTree() {
-      this.loading = true;
-      commonApi.treeMatch(this.searchForm).then((res) => {
-        let { content, totalElements } = res.data;
-        const _content = content.map((item) => {
-          return {
-            ...item,
-            isParent: true,
-            name: item.fullName
-          };
-        });
-        if (this.searchForm.pageNum == 0) {
-          this.treeData = [];
+    created() {
+        if (this.defaultCurrentUserOrg) {
+            this.setDefaultCurrentUserOrg(this.defaultSearch)
         }
-        this.treeData = [...this.treeData, ..._content];
-        this.isLast = this.treeData.length == totalElements;
-        this.loading = false;
-      });
     }
-  }
-};
+}
 </script>
-<style lang="scss" scoped>
-</style>
+<style lang="scss" scoped></style>

+ 313 - 307
src/components/select-org-tree/select.vue

@@ -1,345 +1,351 @@
 <template>
-  <div
-    class="el-select"
-    :class="[selectSize ? 'el-select--' + selectSize : '']"
-    @click.stop="toggleMenu"
-    v-clickoutside="handleClose"
-  >
-    <!-- update author: tangdm descript: add overflow: 'hidden' -->
     <div
-      class="el-select__tags"
-      v-if="multiple"
-      ref="tags"
-      :style="{ 'max-width': inputWidth - 32 + 'px', width: '100%', overflow: 'hidden' }"
+        class="el-select"
+        :class="[selectSize ? 'el-select--' + selectSize : '']"
+        @click.stop="toggleMenu"
+        v-clickoutside="handleClose"
     >
-      <input
-        type="text"
-        class="el-select__input"
-        :class="[selectSize ? `is-${selectSize}` : '']"
-        :disabled="selectDisabled"
-        :autocomplete="autoComplete || autocomplete"
-        @focus="handleFocus"
-        @blur="softFocus = false"
-        @click.stop
-        @keyup="managePlaceholder"
-        @keydown="resetInputState"
-        @keydown.down.prevent="navigateOptions('next')"
-        @keydown.up.prevent="navigateOptions('prev')"
-        @keydown.enter.prevent="selectOption"
-        @keydown.esc.stop.prevent="visible = false"
-        @keydown.delete="deletePrevTag"
-        @compositionstart="handleComposition"
-        @compositionupdate="handleComposition"
-        @compositionend="handleComposition"
-        v-model="query"
-        @input="debouncedQueryChange"
-        v-if="filterable"
-        :style="{
-          'flex-grow': '1',
-          width: inputLength / (inputWidth - 32) + '%',
-          'max-width': inputWidth - 42 + 'px'
-        }"
-        ref="input"
-      />
-    </div>
-    <el-input
-      ref="reference"
-      v-model="selectedLabel"
-      type="text"
-      :placeholder="currentPlaceholder"
-      :name="name"
-      :id="id"
-      :autocomplete="autoComplete || autocomplete"
-      :size="selectSize"
-      :disabled="selectDisabled"
-      :readonly="readonly"
-      :validate-event="false"
-      :class="{ 'is-focus': visible }"
-      @focus="handleFocus"
-      @blur="handleBlur"
-      @keyup.native="debouncedOnInputChange"
-      @keydown.native.down.stop.prevent="navigateOptions('next')"
-      @keydown.native.up.stop.prevent="navigateOptions('prev')"
-      @keydown.native.enter.prevent="selectOption"
-      @keydown.native.esc.stop.prevent="visible = false"
-      @keydown.native.tab="visible = false"
-      @paste.native="debouncedOnInputChange"
-      @mouseenter.native="inputHovering = true"
-      @mouseleave.native="inputHovering = false"
-    >
-      <template slot="prefix" v-if="$slots.prefix">
-        <slot name="prefix"></slot>
-      </template>
-      <template slot="suffix">
-        <i v-show="!showClose" :class="['el-select__caret', 'el-input__icon', 'el-icon-' + iconClass]"></i>
-        <i v-if="showClose" class="el-select__caret el-input__icon el-icon-circle-close" @click="handleClearClick"></i>
-      </template>
-    </el-input>
-    <transition name="el-zoom-in-top" @before-enter="handleMenuEnter" @after-leave="doDestroy">
-      <el-select-menu ref="popper" :append-to-body="popperAppendToBody" v-show="visible && emptyText !== false">
-        <slot name="empty" v-if="$slots.empty"></slot>
-        <template v-if="!loading && loadData.length == 0 && query">
-          <slot name="empty" v-if="$slots.empty"></slot>
-          <p class="el-select-dropdown__empty" v-else>暂无数据</p>
-        </template>
-        <dg-scrollbar
-          ref="scrollbar"
-          wrap-class="el-select-dropdown__wrap"
-          view-class="el-select-dropdown__list dg-select-dropdown__list"
-          @scroll-bottom="handleScrollToBottom"
+        <!-- update author: tangdm descript: add overflow: 'hidden' -->
+        <div
+            class="el-select__tags"
+            v-if="multiple"
+            ref="tags"
+            :style="{ 'max-width': inputWidth - 32 + 'px', width: '100%', overflow: 'hidden' }"
+        >
+            <input
+                type="text"
+                class="el-select__input"
+                :class="[selectSize ? `is-${selectSize}` : '']"
+                :disabled="selectDisabled"
+                :autocomplete="autoComplete || autocomplete"
+                @focus="handleFocus"
+                @blur="softFocus = false"
+                @click.stop
+                @keyup="managePlaceholder"
+                @keydown="resetInputState"
+                @keydown.down.prevent="navigateOptions('next')"
+                @keydown.up.prevent="navigateOptions('prev')"
+                @keydown.enter.prevent="selectOption"
+                @keydown.esc.stop.prevent="visible = false"
+                @keydown.delete="deletePrevTag"
+                @compositionstart="handleComposition"
+                @compositionupdate="handleComposition"
+                @compositionend="handleComposition"
+                v-model="query"
+                @input="debouncedQueryChange"
+                v-if="filterable"
+                :style="{
+                    'flex-grow': '1',
+                    width: inputLength / (inputWidth - 32) + '%',
+                    'max-width': inputWidth - 42 + 'px'
+                }"
+                ref="input"
+            />
+        </div>
+        <el-input
+            ref="reference"
+            v-model="selectedLabel"
+            type="text"
+            :placeholder="currentPlaceholder"
+            :name="name"
+            :id="id"
+            :autocomplete="autoComplete || autocomplete"
+            :size="selectSize"
+            :disabled="selectDisabled"
+            :readonly="readonly"
+            :validate-event="false"
+            :class="{ 'is-focus': visible }"
+            @focus="handleFocus"
+            @blur="handleBlur"
+            @keyup.native="debouncedOnInputChange"
+            @keydown.native.down.stop.prevent="navigateOptions('next')"
+            @keydown.native.up.stop.prevent="navigateOptions('prev')"
+            @keydown.native.enter.prevent="selectOption"
+            @keydown.native.esc.stop.prevent="visible = false"
+            @keydown.native.tab="visible = false"
+            @paste.native="debouncedOnInputChange"
+            @mouseenter.native="inputHovering = true"
+            @mouseleave.native="inputHovering = false"
         >
-          <slot></slot>
-        </dg-scrollbar>
-      </el-select-menu>
-    </transition>
-  </div>
+            <template slot="prefix" v-if="$slots.prefix">
+                <slot name="prefix"></slot>
+            </template>
+            <template slot="suffix">
+                <i v-show="!showClose" :class="['el-select__caret', 'el-input__icon', 'el-icon-' + iconClass]"></i>
+                <i
+                    v-if="showClose"
+                    class="el-select__caret el-input__icon el-icon-circle-close"
+                    @click="handleClearClick"
+                ></i>
+            </template>
+        </el-input>
+        <transition name="el-zoom-in-top" @before-enter="handleMenuEnter" @after-leave="doDestroy">
+            <el-select-menu ref="popper" :append-to-body="popperAppendToBody" v-show="visible && emptyText !== false">
+                <slot name="empty" v-if="$slots.empty"></slot>
+                <template v-if="!loading && loadData.length == 0 && query">
+                    <slot name="empty" v-if="$slots.empty"></slot>
+                    <p class="el-select-dropdown__empty" v-else>暂无数据</p>
+                </template>
+                <dg-scrollbar
+                    ref="scrollbar"
+                    wrap-class="el-select-dropdown__wrap"
+                    view-class="el-select-dropdown__list dg-select-dropdown__list"
+                    @scroll-bottom="handleScrollToBottom"
+                >
+                    <slot></slot>
+                </dg-scrollbar>
+            </el-select-menu>
+        </transition>
+    </div>
 </template>
 
 <script type="text/babel">
-import { Select as ElSelect } from 'element-ui';
-import debounce from 'throttle-debounce/debounce';
-import { addResizeListener } from '@uiSrcPath/utils/resize-event.js';
-import { complex } from '@uiSrcPath/dg-utils/shear.js';
+import { Select as ElSelect } from "element-ui"
+import debounce from "throttle-debounce/debounce"
+import { addResizeListener } from "@uiSrcPath/utils/resize-event.js"
+import { complex } from "@uiSrcPath/dg-utils/shear.js"
 // import { valueEquals } from '@uiSrcPath/utils/util.js';
-import _ from 'lodash';
+import _ from "lodash"
 
-ElSelect.components.ElSelectMenu.watch['$parent.inputWidth'] = function () {
-  this.minWidth = Math.max(this.$parent.$el.getBoundingClientRect().width, this.$parent.$el.clientWidth) + 'px';
-};
+ElSelect.components.ElSelectMenu.watch["$parent.inputWidth"] = function() {
+    this.minWidth = Math.max(this.$parent.$el.getBoundingClientRect().width, this.$parent.$el.clientWidth) + "px"
+}
 
-const Select = complex(ElSelect, ['created', 'mounted']);
+const Select = complex(ElSelect, ["created", "mounted"])
 
 export default {
-  mixins: [Select],
-
-  props: {
-    // add author: tangdm
-    dragTags: Boolean,
-    defaultProp: Object,
-    loadData: Array
-  },
+    mixins: [Select],
 
-  data() {
-    return {
-      dragStatus: false,
-      tagItemLength: 0,
-      debounceTime: 300,
-      oldValue: ''
-    };
-  },
-
-  computed: {
-    scrollbarCls() {
-      const { allowCreate, query, filteredOptionsCount, scrollbarClass } = this;
-      return [!allowCreate && query && filteredOptionsCount === 0 ? 'is-empty' : '', scrollbarClass || ''].join(' ');
-    },
-    // 覆盖element ui - select中方法
-    debounce() {
-      return this.debounceTime;
-    },
-    // oldValue() {
-    //   return this.selectedLabel;
-    // }
-  },
-  watch: {
-    selectDisabled() {
-      // create author:lutz describe:!multiple不渲染
-      if (!this.multiple) {
-        return;
-      }
-      this.$nextTick(() => {
-        this.resetInputHeight();
-      });
+    props: {
+        // add author: tangdm
+        dragTags: Boolean,
+        defaultProp: Object,
+        loadData: Array
     },
 
-    // add author: tangdm
-    selected() {
-      this.$nextTick(() => {
-        // 检测判断标签值是否存在
-        if (this.$refs.tagContent) {
-          this.$refs.tagContent.style.transform = 'translateX(0px)';
+    data() {
+        return {
+            dragStatus: false,
+            tagItemLength: 0,
+            debounceTime: 300,
+            oldValue: ""
         }
+    },
 
-        // 计算标签数量值的长度
-        let count = 0;
-        let tagItem = this.$refs.tagItem;
-        if (tagItem) {
-          tagItem.forEach((item) => {
-            count += item.$el.offsetWidth + 8;
-          });
+    computed: {
+        scrollbarCls() {
+            const { allowCreate, query, filteredOptionsCount, scrollbarClass } = this
+            return [!allowCreate && query && filteredOptionsCount === 0 ? "is-empty" : "", scrollbarClass || ""].join(
+                " "
+            )
+        },
+        // 覆盖element ui - select中方法
+        debounce() {
+            return this.debounceTime
         }
-        this.tagItemLength = count;
-      });
-    }
-  },
-
-  methods: {
-    valueEquals(a, b) {
-      // see: https://stackoverflow.com/questions/3115982/how-to-check-if-two-arrays-are-equal-with-javascript
-      if (a === b) return true;
-      if (!(a instanceof Array)) return false;
-      if (!(b instanceof Array)) return false;
-      if (a.length !== b.length) return false;
-      for (let i = 0; i !== a.length; ++i) {
-        if (a[i] !== b[i]) return false;
-      }
-      return true;
+        // oldValue() {
+        //   return this.selectedLabel;
+        // }
     },
-    resetInputHeight() {
-      if (this.collapseTags && !this.filterable) return;
-      this.$nextTick(() => {
-        if (!this.$refs.reference) return;
-        let inputChildNodes = this.$refs.reference.$el.childNodes;
-        let input = [].filter.call(inputChildNodes, (item) => item.tagName === 'INPUT')[0];
-        const tags = this.$refs.tags;
-        const sizeInMap = this.initialInputHeight || 40;
+    watch: {
+        selectDisabled() {
+            // create author:lutz describe:!multiple不渲染
+            if (!this.multiple) {
+                return
+            }
+            this.$nextTick(() => {
+                this.resetInputHeight()
+            })
+        },
 
-        // update author: tangdm descript: 不同分辨率兼容高度问题
-        // [code] input.style.height = this.selected.length === 0
-        //        ? sizeInMap + 'px'
-        //        : Math.max(
-        //        tags ? (tags.clientHeight + (tags.clientHeight > sizeInMap ? 6 : 0)) : 0,
-        //        sizeInMap
-        // ) + 'px';
+        // add author: tangdm
+        selected() {
+            this.$nextTick(() => {
+                // 检测判断标签值是否存在
+                if (this.$refs.tagContent) {
+                    this.$refs.tagContent.style.transform = "translateX(0px)"
+                }
 
-        input.style.height =
-          this.selected.length === 0 ? sizeInMap + 'px' : Math.max(tags ? tags.clientHeight : 0, sizeInMap) + 'px';
-        if (this.visible && this.emptyText !== false) {
-          this.broadcast('ElSelectDropdown', 'updatePopper');
+                // 计算标签数量值的长度
+                let count = 0
+                let tagItem = this.$refs.tagItem
+                if (tagItem) {
+                    tagItem.forEach(item => {
+                        count += item.$el.offsetWidth + 8
+                    })
+                }
+                this.tagItemLength = count
+            })
         }
-      });
     },
 
-    toggleMenu() {
-      // update author: tangdm descript: 拖拽状态判断
-      if (this.dragStatus) {
-        this.dragStatus = false;
-        return false;
-      }
+    methods: {
+        valueEquals(a, b) {
+            // see: https://stackoverflow.com/questions/3115982/how-to-check-if-two-arrays-are-equal-with-javascript
+            if (a === b) return true
+            if (!(a instanceof Array)) return false
+            if (!(b instanceof Array)) return false
+            if (a.length !== b.length) return false
+            for (let i = 0; i !== a.length; ++i) {
+                if (a[i] !== b[i]) return false
+            }
+            return true
+        },
+        resetInputHeight() {
+            if (this.collapseTags && !this.filterable) return
+            this.$nextTick(() => {
+                if (!this.$refs.reference) return
+                let inputChildNodes = this.$refs.reference.$el.childNodes
+                let input = [].filter.call(inputChildNodes, item => item.tagName === "INPUT")[0]
+                const tags = this.$refs.tags
+                const sizeInMap = this.initialInputHeight || 40
 
-      if (!this.selectDisabled) {
-        if (this.menuVisibleOnFocus) {
-          this.menuVisibleOnFocus = false;
-        } else {
-          this.visible = !this.visible;
-        }
-        if (this.visible) {
-          (this.$refs.input || this.$refs.reference).focus();
-        }
-      }
-    },
+                // update author: tangdm descript: 不同分辨率兼容高度问题
+                // [code] input.style.height = this.selected.length === 0
+                //        ? sizeInMap + 'px'
+                //        : Math.max(
+                //        tags ? (tags.clientHeight + (tags.clientHeight > sizeInMap ? 6 : 0)) : 0,
+                //        sizeInMap
+                // ) + 'px';
 
-    resetInputWidth() {
-      // update author: tangdm [code] this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
-      // descript: element count item's width for error in layers.
-      this.inputWidth = Math.max(
-        this.$refs.reference.$el.getBoundingClientRect().width,
-        this.$refs.reference.$el.clientWidth
-      );
-    },
+                input.style.height =
+                    this.selected.length === 0
+                        ? sizeInMap + "px"
+                        : Math.max(tags ? tags.clientHeight : 0, sizeInMap) + "px"
+                if (this.visible && this.emptyText !== false) {
+                    this.broadcast("ElSelectDropdown", "updatePopper")
+                }
+            })
+        },
 
-    //  下拉触发
-    handleScrollToBottom() {
-      this.$emit('scroll-bottom');
-    },
-    handleQueryChange(val) {
-      if (this.oldValue === val || this.isOnComposition) return;
-      this.oldValue = val;
-      this.$nextTick(() => {
-        if (this.visible) this.broadcast('ElSelectDropdown', 'updatePopper');
-      });
-      this.hoverIndex = -1;
-      if (this.multiple && this.filterable) {
-        this.$nextTick(() => {
-          const length = this.$refs.input.value.length * 15 + 20;
-          this.inputLength = this.collapseTags ? Math.min(50, length) : length;
-          this.managePlaceholder();
-          this.resetInputHeight();
-        });
-      }
-      if (this.remote && typeof this.remoteMethod === 'function') {
-        this.hoverIndex = -1;
-        this.remoteMethod(val);
-      } else if (typeof this.filterMethod === 'function') {
-        this.filterMethod(val);
-        this.broadcast('ElOptionGroup', 'queryChange');
-      } else {
-        this.filteredOptionsCount = this.optionsCount;
-        this.broadcast('ElOption', 'queryChange', val);
-        this.broadcast('ElOptionGroup', 'queryChange');
-      }
-      if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
-        this.checkDefaultFirstOption();
-      }
-      this.$emit('filter-change', val);
-    },
-    handleClearClick(event) {
-      this.$emit('clearSelect');
-      this.deleteSelected(event);
+        toggleMenu() {
+            // update author: tangdm descript: 拖拽状态判断
+            if (this.dragStatus) {
+                this.dragStatus = false
+                return false
+            }
+
+            if (!this.selectDisabled) {
+                if (this.menuVisibleOnFocus) {
+                    this.menuVisibleOnFocus = false
+                } else {
+                    this.visible = !this.visible
+                }
+                if (this.visible) {
+                    ;(this.$refs.input || this.$refs.reference).focus()
+                }
+            }
+        },
+
+        resetInputWidth() {
+            // update author: tangdm [code] this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
+            // descript: element count item's width for error in layers.
+            this.inputWidth = Math.max(
+                this.$refs.reference.$el.getBoundingClientRect().width,
+                this.$refs.reference.$el.clientWidth
+            )
+        },
+
+        //  下拉触发
+        handleScrollToBottom() {
+            this.$emit("scroll-bottom")
+        },
+        handleQueryChange(val) {
+            if (this.oldValue === val || this.isOnComposition) return
+            this.oldValue = val
+            this.$nextTick(() => {
+                if (this.visible) this.broadcast("ElSelectDropdown", "updatePopper")
+            })
+            this.hoverIndex = -1
+            if (this.multiple && this.filterable) {
+                this.$nextTick(() => {
+                    const length = this.$refs.input.value.length * 15 + 20
+                    this.inputLength = this.collapseTags ? Math.min(50, length) : length
+                    this.managePlaceholder()
+                    this.resetInputHeight()
+                })
+            }
+            if (this.remote && typeof this.remoteMethod === "function") {
+                this.hoverIndex = -1
+                this.remoteMethod(val)
+            } else if (typeof this.filterMethod === "function") {
+                this.filterMethod(val)
+                this.broadcast("ElOptionGroup", "queryChange")
+            } else {
+                this.filteredOptionsCount = this.optionsCount
+                this.broadcast("ElOption", "queryChange", val)
+                this.broadcast("ElOptionGroup", "queryChange")
+            }
+            if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
+                this.checkDefaultFirstOption()
+            }
+            this.$emit("filter-change", val)
+        },
+        handleClearClick(event) {
+            this.$emit("clearSelect")
+            this.deleteSelected(event)
+        },
+        // 解决因树组件展开收起后引发的样式定位问题
+        updatePopper() {
+            setTimeout(() => {
+                this.broadcast("ElSelectDropdown", "updatePopper")
+            }, 300)
+        }
     },
-    // 解决因树组件展开收起后引发的样式定位问题
-    updatePopper() {
-      setTimeout(() => {
-        this.broadcast('ElSelectDropdown', 'updatePopper');
-      }, 300);
-    }
-  },
 
-  created() {
-    this.cachedPlaceHolder = this.currentPlaceholder = this.placeholder;
-    if (this.multiple && !Array.isArray(this.value)) {
-      this.$emit('input', []);
-    }
-    if (!this.multiple && Array.isArray(this.value)) {
-      this.$emit('input', '');
-    }
+    created() {
+        this.cachedPlaceHolder = this.currentPlaceholder = this.placeholder
+        if (this.multiple && !Array.isArray(this.value)) {
+            this.$emit("input", [])
+        }
+        if (!this.multiple && Array.isArray(this.value)) {
+            this.$emit("input", "")
+        }
 
-    this.debouncedOnInputChange = debounce(this.debounce, () => {
-      this.onInputChange();
-    });
+        this.debouncedOnInputChange = debounce(this.debounce, () => {
+            this.onInputChange()
+        })
 
-    this.debouncedQueryChange = debounce(this.debounce, (e) => {
-      this.handleQueryChange(e.target.value);
-    });
+        this.debouncedQueryChange = debounce(this.debounce, e => {
+            this.handleQueryChange(e.target.value)
+        })
 
-    this.$on('handleOptionClick', this.handleOptionSelect);
-    this.$on('setSelected', this.setSelected);
-  },
+        this.$on("handleOptionClick", this.handleOptionSelect)
+        this.$on("setSelected", this.setSelected)
+    },
 
-  mounted() {
-    if (this.multiple && Array.isArray(this.value) && this.value.length > 0) {
-      this.currentPlaceholder = '';
-    }
-    addResizeListener(this.$el, this.handleResize);
+    mounted() {
+        if (this.multiple && Array.isArray(this.value) && this.value.length > 0) {
+            this.currentPlaceholder = ""
+        }
+        addResizeListener(this.$el, this.handleResize)
 
-    const reference = this.$refs.reference;
-    if (reference && reference.$el) {
-      const sizeMap = {
-        medium: 36,
-        small: 32,
-        mini: 28
-      };
-      const input = reference.$el.querySelector('input');
+        const reference = this.$refs.reference
+        if (reference && reference.$el) {
+            const sizeMap = {
+                medium: 36,
+                small: 32,
+                mini: 28
+            }
+            const input = reference.$el.querySelector("input")
 
-      // add author: tangdm descript: 增加分辨率识别
-      const clientBodyWidth = document.body.clientWidth;
-      const autoFixedHeight = clientBodyWidth < 1366 ? 24 : clientBodyWidth < 1681 ? 28 : 32;
+            // add author: tangdm descript: 增加分辨率识别
+            const clientBodyWidth = document.body.clientWidth
+            const autoFixedHeight = clientBodyWidth < 1366 ? 24 : clientBodyWidth < 1681 ? 28 : 32
 
-      // update author: tangdm [code] this.initialInputHeight = input.getBoundingClientRect().height || sizeMap[this.selectSize];
-      this.initialInputHeight = sizeMap[this.selectSize] || autoFixedHeight;
-    }
-    if (this.remote && this.multiple) {
-      this.resetInputHeight();
+            // update author: tangdm [code] this.initialInputHeight = input.getBoundingClientRect().height || sizeMap[this.selectSize];
+            this.initialInputHeight = sizeMap[this.selectSize] || autoFixedHeight
+        }
+        if (this.remote && this.multiple) {
+            this.resetInputHeight()
+        }
+        this.$nextTick(() => {
+            if (reference && reference.$el) {
+                // update author: tangdm [code] this.inputWidth = reference.$el.getBoundingClientRect().width;
+                this.inputWidth = Math.max(reference.$el.getBoundingClientRect().width, reference.$el.clientWidth)
+            }
+        })
+        this.setSelected()
     }
-    this.$nextTick(() => {
-      if (reference && reference.$el) {
-        // update author: tangdm [code] this.inputWidth = reference.$el.getBoundingClientRect().width;
-        this.inputWidth = Math.max(reference.$el.getBoundingClientRect().width, reference.$el.clientWidth);
-      }
-    });
-    this.setSelected();
-  }
-};
+}
 </script>
-
-

+ 1 - 1
src/pages/auth-subject-manage/environment-element/add-user-form.vue

@@ -38,7 +38,7 @@ export default {
                     op: "=",
                     value: "",
                     nodeKey: "id",
-                    type: "USER",
+                    type: "APP",
                     component: "SelectOrgTree",
                     placeholder: "请选择单位名称",
                     filterable: true

+ 1 - 1
src/router/modules/auth-subject-manage.js

@@ -39,7 +39,7 @@ const componentsRouter = {
             path: "environment-element",
             component: () => import("@/pages/auth-subject-manage/environment-element"),
             name: "environment-element",
-            meta: { title: "主体环境要素管理", noCache: true }
+            meta: { title: "主体环境要素管理", noCache: true, permission: ["QXGL_SQGL_ZTGL_ZTHJYSGL"] }
         },
         {
             path: "statistics",