{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-fvue\\src\\components\\eipControl\\selector\\EipUserSelector.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\src\\components\\eipControl\\selector\\EipUserSelector.vue","mtime":1667327529356},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\r\nimport utils from \"@/hotent-ui-util.js\";\r\nimport sub_pio_mixin from \"@/sub-permission-mixin.js\";\r\nexport default {\r\n  name: \"eip-user-selector\",\r\n  props: {\r\n    validate: [String, Object],\r\n    value: String,\r\n    name: String,\r\n    placeholder: String,\r\n    permission: String,\r\n    single: Boolean,\r\n    config: Object,\r\n    appendToBody: {\r\n      type: Boolean,\r\n      default: false\r\n    },\r\n    selectCurrent:Boolean\r\n  },\r\n  mixins: [sub_pio_mixin],//混入方式引入表单组件中公共属性，处理子表、孙表行内联动（切面修改permission）\r\n  data() {\r\n    return {\r\n      data: [],\r\n      demensions: [],\r\n      defaultDemension: \"\",\r\n      orgs: [],\r\n      tableColumns: [\r\n        { prop: \"fullname\", label: \"名称\", width: \"120\" },\r\n        { prop: \"account\", label: \"账号\", width: \"120\" },\r\n        { prop: \"mobile\", label:\"手机\", width:\"120\" },\r\n        { prop: \"email\", label: \"邮件\" }\r\n      ],\r\n      pagination: {\r\n        page: 1,\r\n        pageSize: 50,\r\n        total: 0,\r\n        showTotal: true\r\n      }\r\n    };\r\n  },\r\n  computed:{\r\n    inputName: function() {\r\n      let labeldesc = \"\";\r\n      if(this.$slots && this.$slots.labeldesc && this.$slots.labeldesc[0].children && this.$slots.labeldesc[0].children[0].text){\r\n        labeldesc = this.$slots.labeldesc[0].children[0].text;\r\n        return this.name ? this.name : utils.getName()+ \"-\" +labeldesc;\r\n      }else{\r\n        return this.name ? this.name : utils.getName();\r\n      }\r\n    }\r\n  },\r\n  mounted() {\r\n    // 没有值而且需要显示当前用户\r\n    if (!this.value && this.selectCurrent) {\r\n       let user  = null;\r\n      if (this.$store.state.user.currentUserDetail == null) {\r\n\r\n        this.$store\r\n          .dispatch(\"user/loadCurrentUserDetail\")\r\n          .then(currentUserDetail => {\r\n            user = currentUserDetail.user;\r\n          }).then(()=>{\r\n            this.initCurrentValue(user);\r\n          });\r\n      } else {\r\n        user = this.$store.state.user.currentUserDetail.user;\r\n        this.initCurrentValue(user);\r\n      }\r\n    }\r\n  },\r\n  methods: {\r\n    initCurrentValue(user){\r\n      this.$emit(\"input\", user.fullname);\r\n      // 同时更新绑定的字段\r\n      if (this.config) {\r\n        // 配置了id的绑定关系，则回填到指定属性上\r\n        if (this.config.hasOwnProperty(\"id\")) {\r\n          utils.setValueByConfigKey(this, this.config, \"id\", user.id);\r\n        }\r\n        // 配置了fullname的绑定关系，则回填到指定的属性上\r\n        if (this.config.hasOwnProperty(\"fullname\")) {\r\n          utils.setValueByConfigKey(\r\n            this,\r\n            this.config,\r\n            \"fullname\",\r\n            user.fullname\r\n          );\r\n        }\r\n        // 配置了account的绑定关系，则回填到指定的属性上\r\n        if (this.config.hasOwnProperty(\"account\")) {\r\n          utils.setValueByConfigKey(\r\n            this,\r\n            this.config,\r\n            \"account\",\r\n            user.account\r\n          );\r\n        }\r\n         if (this.config.hasOwnProperty(\"mobile\")) {\r\n          utils.setValueByConfigKey(\r\n            this,\r\n            this.config,\r\n            \"mobile\",\r\n            user.mobile\r\n          );\r\n        }\r\n         if (this.config.hasOwnProperty(\"email\")) {\r\n          utils.setValueByConfigKey(\r\n            this,\r\n            this.config,\r\n            \"email\",\r\n            user.email\r\n          );\r\n          console.log(this.config)\r\n        }\r\n      }\r\n    },\r\n    handleLoad(param, cb) {\r\n      let queryFilter = param;\r\n\r\n      if (param.path) {\r\n        queryFilter.pageBean = {\r\n          page: 1,\r\n          pageSize: 50,\r\n          total: 0,\r\n          showTotal: true\r\n        };\r\n        let query = {\r\n          property: \"path_\",\r\n          value: param.path,\r\n          group: \"main\",\r\n          operation: \"RIGHT_LIKE\",\r\n          relation: \"AND\"\r\n        };\r\n        if (!queryFilter.querys) {\r\n          queryFilter.querys = [];\r\n        }\r\n        queryFilter.querys.push(query);\r\n      }\r\n      let _this = this;\r\n      this.$http\r\n        .post(\"${uc}/api/user/v1/users/queryByType\", queryFilter)\r\n        .then(rep => {\r\n          let data = rep.data;\r\n          console.log(data)\r\n          _this.data = data.rows;\r\n          _this.pagination.page = data.page;\r\n          _this.pagination.pageSize = data.pageSize;\r\n          _this.pagination.total = data.total;\r\n        })\r\n        .finally(() => {\r\n          cb();\r\n        });\r\n    },\r\n    valueChange(value) {\r\n      this.$emit(\"input\", value);\r\n    },\r\n    loadOrgTree(node, resolve) {\r\n      if (node && node.data && node.data.isParent) {\r\n        if (node.data.children) {\r\n          resolve(node.data.children);\r\n        } else {\r\n          this.$http\r\n            .post(\"${uc}/api/org/v1/orgs/getByParentAndDem\", {\r\n              demId: node.data.demId,\r\n              parentId: node.data.id\r\n            })\r\n            .then(rep => {\r\n              resolve(rep.data);\r\n            })\r\n            .catch(function(error) {});\r\n        }\r\n      } else {\r\n        resolve([]);\r\n      }\r\n    },\r\n    changeDemension(currentDemensionId) {\r\n      // 维度改变 重新获取组织\r\n      let _this = this;\r\n      this.$http\r\n        .post(\"${uc}/api/org/v1/orgs/getByParentAndDem\", {\r\n          demId: currentDemensionId\r\n        })\r\n        .then(rep => {\r\n          _this.orgs = utils.tile2nest(rep.data);\r\n        })\r\n        .catch(function(error) {});\r\n    },\r\n    loadOrgUser(org) {\r\n      // 根据组织获取用户\r\n      this.handleLoad({ path: org.path }, () => {});\r\n    },\r\n    loadDemensions() {\r\n      if (this.demensions.length == 0) {\r\n        let _this = this;\r\n        this.$http\r\n          .get(\"${uc}/api/demension/v1/dems/getAll\")\r\n          .then(rep => {\r\n            let data = rep.data;\r\n            _this.demensions = data;\r\n            data.forEach(element => {\r\n              if(element.isDefault==1){\r\n                _this.defaultDemension = element.id;\r\n              }\r\n            });\r\n            if(!_this.defaultDemension){\r\n              _this.defaultDemension = data[0].id;\r\n            }\r\n          })\r\n          .catch(function(error) {});\r\n      }\r\n    }\r\n  }\r\n};\r\n",null]}