{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-fvue\\src\\components\\control\\HtUserSelector.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\src\\components\\control\\HtUserSelector.vue","mtime":1667327529137},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\babel.config.js","mtime":1667327525434},{"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\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"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":["import \"core-js/modules/es6.regexp.search\";\nimport _toConsumableArray from \"D:/jenkins/workspace/xq-web-fvue/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.regexp.split\";\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//\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//\nimport Vue from \"vue\";\nimport { mapState } from \"vuex\";\nimport utils from \"@/utils.js\";\nexport default {\n name: \"ht-user-selector\",\n props: [\"validate\", \"value\", \"name\", \"permission\", \"single\", \"selectorconfig\", \"tooltipplacement\"],\n data: function data() {\n return {\n tableData: \"\",\n orgId: \"\",\n userDialogVisible: false,\n defaultProps: {\n children: \"children\",\n label: \"name\"\n },\n selectUserProps: {\n label: \"fullname\"\n },\n selectUsers: null,\n currentDimension: null,\n inputSuffixHeight: 30,\n config: null,\n updating: false,\n currentUser: null,\n singleSelectId: null\n };\n },\n computed: mapState({\n pagination: function pagination(state) {\n return state.user.pagination;\n },\n total: function total(state) {\n return state.user.total;\n },\n dimensions: function dimensions(state) {\n return state.user.dimensions;\n },\n // 左侧组织树的数据\n orgs: function orgs(state) {\n return state.user.orgs;\n },\n // 中间用户表格的数据\n users: function users(state) {\n return state.user.users;\n },\n isSingle: function isSingle() {\n if (this.single === undefined || this.single === null) {\n if (this.selectorconfig) {\n return this.selectorconfig.isSingle;\n }\n\n return false;\n }\n\n if (this.single === \"\") {\n return true;\n }\n\n return !!this.single;\n },\n inputVal: function inputVal() {\n if (!this.value) {\n return null;\n } else if (this.bindSet) {\n if (!utils.getAndValidPath(this.bindSet, \"fullname\")) {\n throw \"ht-user-selector的bind属性中必须配置fullname属性.\";\n }\n\n if (this.value.constructor != String) {\n throw \"ht-user-selector中有bind属性时,fullname必须是字符串.\";\n }\n\n var subIndex = null;\n\n if (this.$el) {\n subIndex = utils.getSomeAttributeFromParentElement(this.$el, \"data-index\");\n }\n\n var nameAry = this.value.split(\",\");\n var idAry = null;\n var accountAry = null;\n var emailAry = [];\n var mobileAry = [];\n var idPath = utils.getAndValidPath(this.bindSet, \"id\");\n\n if (idPath) {\n var idVal = utils.getValueByPath(this.$parent, idPath, subIndex);\n\n if (!idVal || idVal.constructor != String) {\n throw \"ht-user-selector中有bind属性中id的值必须是非空的字符串.\";\n }\n\n idAry = idVal.split(\",\");\n }\n\n var accountPath = utils.getAndValidPath(this.bindSet, \"account\");\n\n if (accountPath) {\n var accountVal = utils.getValueByPath(this.$parent, accountPath, subIndex);\n\n if (!accountVal || accountVal.constructor != String) {\n throw \"ht-user-selector中有bind属性中account的值必须是非空的字符串.\";\n }\n\n accountAry = accountVal.split(\",\");\n }\n\n var emailPath = utils.getAndValidPath(this.bindSet, \"email\");\n\n if (emailPath) {\n var emailVal = utils.getValueByPath(this.$parent, emailPath, subIndex);\n\n if (emailVal && emailVal.constructor == String) {\n emailAry = emailVal.split(\",\");\n }\n }\n\n var mobilePath = utils.getAndValidPath(this.bindSet, \"mobile\");\n\n if (mobilePath) {\n var mobileVal = utils.getValueByPath(this.$parent, mobilePath, subIndex);\n\n if (mobileVal && mobileVal.constructor == String) {\n mobileAry = mobileVal.split(\",\");\n }\n }\n\n var result = [];\n nameAry.forEach(function (m, i) {\n var n = {\n fullname: m\n };\n\n if (idAry) {\n n[\"id\"] = idAry[i];\n }\n\n if (accountAry) {\n n[\"account\"] = accountAry[i];\n }\n\n if (emailAry) {\n n[\"email\"] = emailAry[i];\n }\n\n if (mobileAry) {\n n[\"mobile\"] = mobileAry[i];\n }\n\n result.push(n);\n });\n return result;\n } else if (this.value.constructor == Array) {\n return this.value;\n } else {\n return null;\n }\n },\n inputWriteable: function inputWriteable() {\n return utils.getWriteable(this.permission);\n },\n inputValidate: function inputValidate() {\n var validateObj = this.$store.state.index.validate;\n return utils.addRequiredOrNot(this.permission, this.validate, validateObj, this);\n },\n inputName: function inputName() {\n var labeldesc = \"\";\n\n if (this.$slots && this.$slots.labeldesc && this.$slots.labeldesc[0].children && this.$slots.labeldesc[0].children[0].text) {\n labeldesc = this.$slots.labeldesc[0].children[0].text;\n return this.name ? this.name : utils.getName() + \"-\" + labeldesc;\n } else {\n return this.name ? this.name : utils.getName();\n }\n },\n // 是否显示当前用户\n selectCurrent: function selectCurrent() {\n return this.selectorconfig ? this.selectorconfig.selectCurrent : false;\n },\n // 是否有回填设置\n bindSet: function bindSet() {\n return this.selectorconfig ? this.selectorconfig.bind : null;\n }\n }),\n mounted: function mounted() {\n var _this = this;\n\n // 没有值而且需要显示当前用户\n if (!this.inputVal && this.selectCurrent) {\n if (this.$store.state.user.currentUserDetail == null) {\n this.$store.dispatch(\"user/loadCurrentUserDetail\").then(function (currentUserDetail) {\n _this.currentUser = currentUserDetail.user;\n _this.selectUsers = [currentUserDetail.user];\n\n _this.syncInputValue();\n\n _this.calacInputSuffixHeight();\n });\n } else {\n this.currentUser = this.$store.state.user.currentUserDetail.user;\n this.selectUsers = [this.currentUser];\n this.syncInputValue();\n this.calacInputSuffixHeight();\n }\n }\n },\n created: function created() {\n this.$validator = this.$root.$validator;\n var pageBean = {\n pageBean: {\n page: \"1\",\n pageSize: \"10\",\n showTotal: \"true\"\n }\n }; //初次加载默认pageBean\n\n this.$store.dispatch(\"user/loadDimension\");\n this.$store.dispatch(\"user/loadUsersByOrgId\", pageBean);\n },\n watch: {\n userDialogVisible: function userDialogVisible(newVal) {\n if (newVal) {\n if (this.inputVal && this.inputVal.constructor == Array) {\n this.selectUsers = _toConsumableArray(this.inputVal);\n } else {\n this.selectUsers = [];\n }\n\n this.syncCheckedStatus();\n }\n }\n },\n methods: {\n loadOrgTree: function loadOrgTree(node, resolve) {\n if (node && node.data && node.data.isParent) {\n if (node.data.children) {\n resolve(node.data.children);\n } else {\n this.$store.dispatch(\"user/loadOrgsByParentId\", node.data.id).then(function (rep) {\n resolve(rep);\n });\n }\n } else {\n resolve([]);\n }\n },\n //点击组织查询用户\n handleNodeClick: function handleNodeClick(data, node, vuecomponent) {\n if (data.id) {\n this.orgId = data.id;\n }\n\n var pageBean = {\n pageBean: {\n page: \"1\",\n pageSize: \"10\",\n showTotal: \"true\"\n }\n };\n var querys = [{\n property: \"org_id_\",\n value: this.orgId,\n group: \"main\",\n operation: \"EQUAL\",\n relation: \"AND\"\n }];\n var queryFilter = {\n pageBean: pageBean,\n querys: querys\n };\n this.$store.dispatch(\"user/loadUsersByOrgId\", queryFilter);\n },\n handleSizeChange: function handleSizeChange(size) {\n //每页下拉显示数据\n this.$store.dispatch(\"user/setPaginationSize\", size);\n this.search();\n },\n handleCurrentChange: function handleCurrentChange(currentPage) {\n //点击第几页\n this.$store.dispatch(\"user/setPaginationPageNum\", currentPage);\n this.search();\n },\n //回车查询\n searchEnterFun: function searchEnterFun(e) {\n var keyCode = window.event ? e.keyCode : e.which;\n\n if (keyCode == 13) {\n this.search(\"find\");\n }\n },\n // 查询\n search: function search(str) {\n var _this2 = this;\n\n if (str == \"find\") {\n this.$store.dispatch(\"user/setPaginationPageNum\", 1);\n }\n\n var querys = []; //查询条件\n\n var queryFilter = {};\n var pageBean = {\n pageBean: this.pagination\n };\n\n if (this.tableData == \"\" && this.orgId == \"\") {\n this.$store.dispatch(\"user/loadUsersByOrgId\", pageBean).then(function () {\n _this2.syncCheckedStatus();\n });\n } else {\n if (this.orgId && this.tableData == \"\") {\n querys.push({\n property: \"org_id_\",\n value: this.orgId,\n group: \"main1\",\n operation: \"EQUAL\",\n relation: \"AND\"\n });\n } else if (this.orgId && this.tableData != \"\") {\n querys = [{\n property: \"org_id_\",\n value: this.orgId,\n group: \"main1\",\n operation: \"EQUAL\",\n relation: \"AND\"\n }, {\n property: \"fullname\",\n value: this.tableData,\n group: \"main\",\n operation: \"LIKE\",\n relation: \"OR\"\n }, {\n property: \"account\",\n value: this.tableData,\n group: \"main\",\n operation: \"LIKE\",\n relation: \"OR\"\n }, {\n property: \"email\",\n value: this.tableData,\n group: \"main\",\n operation: \"LIKE\",\n relation: \"OR\"\n }, {\n property: \"mobile\",\n value: this.tableData,\n group: \"main\",\n operation: \"LIKE\",\n relation: \"OR\"\n }];\n } else {\n querys = [{\n property: \"fullname\",\n value: this.tableData,\n group: \"main\",\n operation: \"LIKE\",\n relation: \"OR\"\n }, {\n property: \"account\",\n value: this.tableData,\n group: \"main\",\n operation: \"LIKE\",\n relation: \"OR\"\n }, {\n property: \"email\",\n value: this.tableData,\n group: \"main\",\n operation: \"LIKE\",\n relation: \"OR\"\n }, {\n property: \"mobile\",\n value: this.tableData,\n group: \"main\",\n operation: \"LIKE\",\n relation: \"OR\"\n }];\n }\n\n queryFilter = {\n pageBean: this.pagination,\n querys: querys\n };\n this.$store.dispatch(\"user/loadUsersByOrgId\", queryFilter).then(function () {\n _this2.syncCheckedStatus();\n });\n }\n },\n //重置\n reset: function reset() {\n this.tableData = \"\";\n this.orgId = \"\";\n\n if (this.$refs.tree) {\n this.$refs.tree.setCurrentKey(null);\n }\n\n this.search(\"find\");\n },\n showDialog: function showDialog() {\n this.reset();\n this.userDialogVisible = true;\n },\n //通过维度获取组织\n changeDimension: function changeDimension(val) {\n this.$store.dispatch(\"user/loadOrgsByDimension\", val);\n },\n radioChangeHandler: function radioChangeHandler(index) {\n this.selectUsers = [this.users[index]];\n },\n userSelectionChange: function userSelectionChange() {\n !this.updating && this.syncSelection2selectUsers();\n },\n userRowClick: function userRowClick(row, column, event) {\n var _this3 = this;\n\n // 单选\n if (this.isSingle) {\n this.selectUsers = [row];\n this.singleSelectId = row.id;\n } // 多选\n else {\n var arg = this.getUniqueArg();\n var _tag = true;\n this.$refs.userTable && this.$refs.userTable.selection && this.$refs.userTable.selection.forEach(function (m) {\n if (m === row) {\n // 对于已选中该行时,取消选中状态\n _this3.$refs.userTable.toggleRowSelection(row, false);\n\n _tag = false;\n }\n }); // 对于未选中该行时,切换为选中状态\n\n this.$refs.userTable && _tag && this.$refs.userTable.toggleRowSelection(row);\n this.syncSelection2selectUsers();\n }\n },\n // 获取当前用作唯一键的参数\n getUniqueArg: function getUniqueArg() {\n var arg = \"fullname\";\n\n if (utils.getAndValidPath(this.bindSet, \"id\")) {\n arg = \"id\";\n } else if (utils.getAndValidPath(this.bindSet, \"account\")) {\n arg = \"account\";\n }\n\n return arg;\n },\n dialogConfirm: function dialogConfirm() {\n this.userDialogVisible = false;\n this.syncInputValue();\n },\n // 同步userTable中已选行到已选数据中去\n syncSelection2selectUsers: function syncSelection2selectUsers() {\n var _this4 = this;\n\n var arg = this.getUniqueArg(); // 当前分页的orgTable行中已被选择的数据\n\n var curPageAry = this.selectUsers.filter(function (m) {\n return _this4.users.some(function (n) {\n return m[arg] === n[arg];\n });\n });\n curPageAry.forEach(function (item) {\n _this4.selectUsers.remove(item);\n });\n this.selectUsers = [].concat(_toConsumableArray(this.selectUsers), _toConsumableArray(this.$refs.userTable.selection));\n },\n // 同步已选数据在orgTable中的checkbox和radio的选中状态\n syncCheckedStatus: function syncCheckedStatus() {\n var arg = this.getUniqueArg();\n\n var _me = this;\n\n setTimeout(function () {\n _me.updating = true;\n _me.singleSelectId = null;\n _me.$refs.userTable && _me.$refs.userTable.clearSelection();\n _me.users && _me.users.forEach(function (m) {\n if (_me.selectUsers && _me.selectUsers.some(function (n) {\n return n[arg] === m[arg];\n })) {\n _me.singleSelectId = m.id;\n\n if (!_me.isSingle && _me.$refs.userTable) {\n _me.$refs.userTable.toggleRowSelection(m);\n }\n } else {\n if (!_me.isSingle && _me.$refs.userTable) {\n _me.$refs.userTable.toggleRowSelection(m, false);\n }\n }\n });\n _me.updating = false;\n }, 200);\n },\n // 同步选择结果到表单上(会自动修正表单上输入框的高度)\n syncInputValue: function syncInputValue(item) {\n if (item) {\n if (this.inputVal && this.inputVal.constructor == Array) {\n this.selectUsers = _toConsumableArray(this.inputVal);\n } // 在表单上点击X删除已选数据\n\n\n this.selectUsers.remove(item);\n }\n\n var subIndex = null;\n\n if (this.$el) {\n subIndex = utils.getSomeAttributeFromParentElement(this.$el, \"data-index\");\n }\n\n this.updating = true;\n\n if (this.bindSet) {\n if (!utils.getAndValidPath(this.bindSet, \"fullname\")) {\n throw \"ht-user-selector的bind属性中必须配置fullname属性.\";\n }\n\n var nameAry = [];\n var idAry = [];\n var accountAry = [];\n var mobileArr = [];\n var emailArr = [];\n this.selectUsers && this.selectUsers.forEach(function (m) {\n nameAry.push(m.fullname);\n idAry.push(m.id);\n accountAry.push(m.account);\n mobileArr.push(m.mobile);\n emailArr.push(m.email);\n });\n var idPath = utils.getAndValidPath(this.bindSet, \"id\");\n idPath && utils.setValueByPath(this.$parent, idPath, idAry.join(\",\"), subIndex);\n var accountPath = utils.getAndValidPath(this.bindSet, \"account\");\n accountPath && utils.setValueByPath(this.$parent, accountPath, accountAry.join(\",\"), subIndex);\n var mobilePath = utils.getAndValidPath(this.bindSet, \"mobile\");\n mobilePath && utils.setValueByPath(this.$parent, mobilePath, mobileArr.join(\",\"), subIndex);\n var emailPath = utils.getAndValidPath(this.bindSet, \"email\");\n emailPath && utils.setValueByPath(this.$parent, emailPath, emailArr.join(\",\"), subIndex);\n this.$emit(\"input\", nameAry.join(\",\"));\n } else {\n this.$emit(\"input\", this.selectUsers);\n }\n\n this.updating = false;\n this.calacInputSuffixHeight();\n },\n dialogCancel: function dialogCancel() {\n this.userDialogVisible = false;\n },\n clearAllSelectUsers: function clearAllSelectUsers() {\n this.selectUsers = [];\n this.syncCheckedStatus();\n this.singleSelectId = null;\n },\n // 调整已选列表中元素的顺序\n moveSelectUser: function moveSelectUser(direct) {\n var _this5 = this;\n\n var ary = this.$refs.selectTree.getCheckedNodes();\n\n if (direct == \"up\") {\n ary.forEach(function (m) {\n var index = _this5.selectUsers.indexOf(m, 1);\n\n if (index > 0) {\n var newAry = _toConsumableArray(_this5.selectUsers);\n\n newAry[index - 1] = _this5.selectUsers[index];\n newAry[index] = _this5.selectUsers[index - 1];\n _this5.selectUsers = newAry;\n }\n });\n } else if (direct == \"down\") {\n for (var i = ary.length - 1, m; m = ary[i--];) {\n var index = this.selectUsers.indexOf(m, 0);\n\n if (index > -1 && index < this.selectUsers.length - 1) {\n var newAry = _toConsumableArray(this.selectUsers);\n\n newAry[index + 1] = this.selectUsers[index];\n newAry[index] = this.selectUsers[index + 1];\n this.selectUsers = newAry;\n }\n }\n }\n\n setTimeout(function () {\n _this5.$refs.selectTree.setCheckedNodes(ary);\n });\n },\n // 在弹框中的已选数据中删除勾选的项\n removeSelectUsers: function removeSelectUsers() {\n var _this6 = this;\n\n var ary = this.$refs.selectTree.getCheckedNodes();\n ary.forEach(function (item) {\n _this6.selectUsers.remove(item);\n });\n this.syncCheckedStatus();\n },\n // 在表单的输入框中点击X删除一条已选数据\n removeSelectUser: function removeSelectUser(item) {\n this.syncInputValue(item);\n },\n calacInputSuffixHeight: function calacInputSuffixHeight() {\n var _this7 = this;\n\n setTimeout(function () {\n if (!_this7.$refs.tagSpans) return;\n\n if (_this7.$refs.tagSpans.offsetHeight) {\n _this7.inputSuffixHeight = _this7.$refs.tagSpans.offsetHeight + 5;\n } else {\n _this7.inputSuffixHeight = 30;\n } // 触发验证\n\n\n _this7.$validator.validate();\n }, 0);\n }\n }\n};",null]}