{"remainingRequest":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\artfess-module\\src\\components\\HtUserSelector.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\artfess-module\\src\\components\\HtUserSelector.vue","mtime":1675232038590},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\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//\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//\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//\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 \"@/utils.js\";\r\nimport HtFieldTail from \"@/components/HtFieldTail.vue\";\r\nimport Selector from \"@/components/common/Selector.vue\";\r\nimport { setTimeout } from \"timers\";\r\n\r\nexport default {\r\n name: \"ht-user-selector\",\r\n props: {\r\n demensions: {\r\n type: Array,\r\n default: () => {\r\n return [];\r\n }\r\n },\r\n orgs: {\r\n type: Array,\r\n default: () => {\r\n return [];\r\n }\r\n },\r\n loadOrgTree: {\r\n type: Function\r\n },\r\n roles: {\r\n type: Array,\r\n default: () => {\r\n return [];\r\n }\r\n },\r\n loadRoleTree: {\r\n type: Function\r\n },\r\n validate: [String, Object],\r\n value: String,\r\n name: String,\r\n placeholder: {\r\n type: String,\r\n default: \"请输入内容\"\r\n },\r\n permission: {\r\n type: String,\r\n default: \"w\",\r\n validator: function(value) {\r\n return [\"b\", \"w\", \"r\", \"n\"].indexOf(value) !== -1;\r\n }\r\n },\r\n single: {\r\n type: Boolean,\r\n default: false\r\n },\r\n roleTreeSupportFilter: {\r\n type: Boolean,\r\n default: false\r\n },\r\n config: Object,\r\n data: {\r\n type: Array,\r\n default: () => {\r\n return [];\r\n }\r\n },\r\n tableColumns: {\r\n type: Array,\r\n default: () => {\r\n return [];\r\n }\r\n },\r\n pagination: {\r\n type: Object,\r\n default: () => {\r\n return {\r\n page: 1,\r\n pageSize: 50,\r\n total: 0\r\n };\r\n }\r\n },\r\n selectLabel: {\r\n type: String,\r\n default: \"fullname\"\r\n },\r\n defaultDemension: {\r\n type: [String, Number],\r\n default: \"\"\r\n },\r\n quickSearchProps: {\r\n type: String,\r\n required: true\r\n },\r\n nodeKey: {\r\n type: String,\r\n default: \"id\"\r\n },\r\n defaultExpandedKeys: {\r\n type: Array,\r\n default() {\r\n return [];\r\n }\r\n },\r\n appendToBody: {\r\n type: Boolean,\r\n default: false\r\n }\r\n },\r\n components: {\r\n HtFieldTail,\r\n Selector\r\n },\r\n data() {\r\n return {\r\n el_aside_w: \"210px\",\r\n inputName: null,\r\n writeable: true,\r\n inputSuffixHeight: 30,\r\n selectors: [],\r\n dialogVisible: false,\r\n currentDemension: null,\r\n activeName: \"org\",\r\n primaryField: this.selectLabel\r\n };\r\n },\r\n computed: {\r\n inputWriteable: function() {\r\n return this.writeable\r\n ? utils.getWriteable(this.permission)\r\n : this.writeable;\r\n },\r\n inputValidate: function() {\r\n return utils.addRequiredOrNot(this.permission, this.validate, this);\r\n }\r\n },\r\n watch: {\r\n // 当所选择的数据发生变化时,同步到v-model中\r\n selectors: function(newVal) {\r\n let ary = [],\r\n idAry = [],\r\n fullnameAry = [],\r\n mobileAry = [],\r\n emailAry = [],\r\n postNameAry = [],\r\n orgNameAry = [],\r\n accountAry = [];\r\n if (newVal && newVal.constructor === Array && newVal.length > 0) {\r\n newVal.forEach(m => {\r\n ary.push(m.fullname);\r\n if (m.hasOwnProperty(\"id\")) {\r\n idAry.push(m.id);\r\n }\r\n if (m.hasOwnProperty(\"fullname\")) {\r\n fullnameAry.push(m.fullname);\r\n }\r\n if (m.hasOwnProperty(\"account\")) {\r\n accountAry.push(m.account);\r\n }\r\n if (m.hasOwnProperty(\"mobile\")) {\r\n mobileAry.push(m.mobile);\r\n }\r\n if (m.hasOwnProperty(\"email\")) {\r\n emailAry.push(m.email);\r\n }\r\n if (m.hasOwnProperty(\"postName\")) {\r\n postNameAry.push(m.postName);\r\n }\r\n if (m.hasOwnProperty(\"orgName\")) {\r\n orgNameAry.push(m.orgName);\r\n }\r\n });\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\", idAry.join(\",\"));\r\n this.primaryField = \"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 fullnameAry.join(\",\")\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 accountAry.join(\",\")\r\n );\r\n this.primaryField = this.primaryField == \"id\" ? \"id\" : \"account\";\r\n }\r\n // 配置了mobile的绑定关系,则回填到指定的属性上\r\n if (this.config.hasOwnProperty(\"mobile\")) {\r\n utils.setValueByConfigKey(\r\n this,\r\n this.config,\r\n \"mobile\",\r\n mobileAry.join(\",\")\r\n );\r\n }\r\n // 配置了email的绑定关系,则回填到指定的属性上\r\n if (this.config.hasOwnProperty(\"email\")) {\r\n utils.setValueByConfigKey(\r\n this,\r\n this.config,\r\n \"email\",\r\n emailAry.join(\",\")\r\n );\r\n }\r\n\r\n // 配置了post绑定关系,则回填到指定的属性上\r\n if (this.config.hasOwnProperty(\"postName\")) {\r\n utils.setValueByConfigKey(\r\n this,\r\n this.config,\r\n \"postName\",\r\n postNameAry.join(\",\")\r\n );\r\n }\r\n\r\n // 配置了org绑定关系,则回填到指定的属性上\r\n if (this.config.hasOwnProperty(\"orgName\")) {\r\n utils.setValueByConfigKey(\r\n this,\r\n this.config,\r\n \"orgName\",\r\n orgNameAry.join(\",\")\r\n );\r\n }\r\n }\r\n // 通过valueChange事件发布值变更消息\r\n setTimeout(() => {\r\n this.$emit(\"valueChange\", ary.join(\",\"));\r\n this.calacInputSuffixHeight();\r\n if (this.$refs.inputEl) {\r\n this.$refs.inputEl.focus();\r\n this.$refs.inputEl.blur();\r\n }\r\n }, 10);\r\n },\r\n value: function(newVal) {\r\n // 父级传递进来的value发生变更时,需要同步到当前所选数据中\r\n this.valueInit();\r\n },\r\n defaultDemension: function(newVal, oldVal) {\r\n if (newVal && newVal != oldVal) {\r\n this.currentDemension = newVal;\r\n this.changeDemension();\r\n }\r\n }\r\n },\r\n mounted() {\r\n // 组件第一次挂载时,同步value到当前所选数据中\r\n this.valueInit();\r\n },\r\n created() {\r\n this.inputName = this.name ? this.name : utils.getName();\r\n this.$validator = this.$root.$validator;\r\n if (this.$smallScreenDialog) {\r\n this.el_aside_w = \"180px\";\r\n }\r\n },\r\n methods: {\r\n // 同步value到当前所选数据中\r\n valueInit() {\r\n let tmpAry = [];\r\n if (this.value) {\r\n let idAry = [],\r\n accountAry = [],\r\n fullnameAry = [],\r\n mobileAry = [],\r\n postNameAry = [],\r\n orgNameAry = [],\r\n emailAry = [];\r\n if (this.config) {\r\n // 配置了id绑定关系,则获取id的值\r\n if (this.config.hasOwnProperty(\"id\")) {\r\n let idVal = utils.getValueByConfigKey(this, this.config, \"id\");\r\n if (idVal) {\r\n idAry = idVal.split(\",\").trim();\r\n }\r\n }\r\n // 配置了fullname绑定关系,则获取fullname的值\r\n if (this.config.hasOwnProperty(\"fullname\")) {\r\n let fullnameVal = utils.getValueByConfigKey(\r\n this,\r\n this.config,\r\n \"fullname\"\r\n );\r\n if (fullnameVal) {\r\n fullnameAry = fullnameVal.split(\",\").trim();\r\n }\r\n }\r\n\r\n // 配置了account绑定关系,则获取account的值\r\n if (this.config.hasOwnProperty(\"account\")) {\r\n let accountVal = utils.getValueByConfigKey(\r\n this,\r\n this.config,\r\n \"account\"\r\n );\r\n if (accountVal) {\r\n accountAry = accountVal.split(\",\").trim();\r\n }\r\n }\r\n\r\n // 配置了mobile绑定关系,则获取mobile的值\r\n if (this.config.hasOwnProperty(\"mobile\")) {\r\n let mobileVal = utils.getValueByConfigKey(\r\n this,\r\n this.config,\r\n \"mobile\"\r\n );\r\n if (mobileVal) {\r\n mobileAry = mobileVal.split(\",\").trim();\r\n }\r\n }\r\n\r\n // 配置了post绑定关系,则获取post的值\r\n if (this.config.hasOwnProperty(\"postName\")) {\r\n let postVal = utils.getValueByConfigKey(\r\n this,\r\n this.config,\r\n \"postName\"\r\n );\r\n if (postVal) {\r\n postNameAry = postVal.split(\",\").trim();\r\n }\r\n }\r\n\r\n // 配置了org绑定关系,则获取org的值\r\n if (this.config.hasOwnProperty(\"orgName\")) {\r\n let orgVal = utils.getValueByConfigKey(\r\n this,\r\n this.config,\r\n \"orgName\"\r\n );\r\n if (orgVal) {\r\n orgNameAry = orgVal.split(\",\").trim();\r\n }\r\n }\r\n\r\n // 配置了email绑定关系,则获取email的值\r\n if (this.config.hasOwnProperty(\"email\")) {\r\n let emailVal = utils.getValueByConfigKey(\r\n this,\r\n this.config,\r\n \"email\"\r\n );\r\n if (emailVal) {\r\n emailAry = emailVal.split(\",\").trim();\r\n }\r\n }\r\n }\r\n // 将fullname、id、code从逗号分割的字符串解析为json对象格式的数组\r\n let valAry = this.value.split(\",\").trim();\r\n valAry.forEach((m, index) => {\r\n let item = { fullname: m };\r\n if (idAry.length > index) {\r\n item[\"id\"] = idAry[index];\r\n }\r\n if (accountAry.length > index) {\r\n item[\"account\"] = accountAry[index];\r\n }\r\n if (fullnameAry.length > index) {\r\n item[\"fullname\"] = fullnameAry[index];\r\n }\r\n if (mobileAry.length > index) {\r\n item[\"mobile\"] = mobileAry[index];\r\n }\r\n if (emailAry.length > index) {\r\n item[\"email\"] = emailAry[index];\r\n }\r\n if (postNameAry.length > index) {\r\n item[\"postName\"] = postNameAry[index];\r\n }\r\n if (orgNameAry.length > index) {\r\n item[\"orgName\"] = orgNameAry[index];\r\n }\r\n tmpAry.push(item);\r\n });\r\n }\r\n // 对数组做深度对比,如果值不完全相等,则进行赋值操作\r\n if (!utils.arrayEquals(tmpAry, this.selectors)) {\r\n this.selectors = tmpAry;\r\n }\r\n },\r\n showDialog() {\r\n if (!this.inputWriteable) {\r\n return;\r\n }\r\n this.loadDemensions();\r\n this.dialogVisible = true;\r\n setTimeout(() => {\r\n this.$refs.selector.onShow();\r\n });\r\n },\r\n handleClose(done) {\r\n this.$refs.selector.onHide();\r\n done && done();\r\n },\r\n handleDialogSure() {\r\n this.dialogVisible = false;\r\n this.$refs.selector.onHide(true);\r\n },\r\n handleDialogCancel() {\r\n this.dialogVisible = false;\r\n this.$refs.selector.onHide();\r\n },\r\n handleRemove(item) {\r\n this.selectors.remove(item);\r\n },\r\n clear() {\r\n this.selectors = [];\r\n },\r\n // 更新当前输入框的高度来适配已选数据的高度\r\n calacInputSuffixHeight() {\r\n if (!this.$refs.tagSpans) return;\r\n if (this.$refs.tagSpans.offsetHeight) {\r\n this.inputSuffixHeight = this.$refs.tagSpans.offsetHeight + 5;\r\n } else {\r\n this.inputSuffixHeight = 30;\r\n }\r\n },\r\n load(param, cb) {\r\n this.$emit(\"load\", param, cb);\r\n },\r\n changeDemension() {\r\n this.$emit(\"changeDemension\", this.currentDemension);\r\n },\r\n handleNodeClick(data) {\r\n this.$emit(\"loadOrgUser\", data);\r\n },\r\n handleRoleNodeClick(data) {\r\n this.$emit(\"loadRoleUser\", data);\r\n },\r\n loadDemensions() {\r\n this.$emit(\"loadDemensions\");\r\n }\r\n }\r\n};\r\n",null]}