{"remainingRequest":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/badp-bcxin-web-5.x-vue/src/components/o_dept_tree_select.vue?vue&type=script&lang=js&","dependencies":[{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/src/components/o_dept_tree_select.vue","mtime":1725957645726},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/thread-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/babel-loader/lib/index.js","mtime":315532800000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/vue-loader/lib/index.js","mtime":1655715099000}],"contextDependencies":[],"result":["\nimport Constant from \"@/Constant.js\";\nimport API from \"@/api.js\";\nimport form_operation from \"@/components/form_operation_log\";\nimport controlHidden from \"@/assets/js/controlHidden.js\";\nexport default {\n name: \"o-dept-tree-select\",\n props: [\"id\"],\n components: {\n form_operation,\n },\n computed: {\n field: function () {\n let formData = this.$parent.findField(this.id);\n if (formData.displayType == 5 || formData.displayType == 3) {\n formData.printHiddenValue = formData.printHiddenValue\n ? formData.printHiddenValue.replace(/ /g, \"\")\n : \"\";\n }\n if (formData.value) {\n let arr = formData.value.split(\";\");\n let val = \"\";\n for (let j = 0; j < arr.length; j++) {\n for (let i = 0; i < formData.data.length; i++) {\n if (arr[j] == formData.data[i].id) {\n val += formData.data[i].name + \";\";\n }\n }\n }\n formData.val = val.replace(/^(\\s|;)+|(\\s|;)+$/g, \"\");\n } else {\n formData.val = \"\";\n }\n //return this.$parent.findField(this.id);\n return formData;\n },\n },\n watch: {\n \"field.value\": {\n deep: true,\n handler: function (newVal) {\n let field = this.field;\n if (!newVal) {\n field.data = [];\n }\n },\n },\n searchValue(newVal) {\n if (!newVal) {\n setTimeout(() => {\n let deptTree = this.searchDeptListValue;\n let rightList = this.activeRightDept;\n for (let i = 0; i < rightList.length; i++) {\n for (let j = 0; j < deptTree.length; j++) {\n if (rightList[i] == deptTree[j].key) {\n deptTree.splice(j, 1);\n j--;\n }\n }\n }\n\n let arr = [];\n deptTree.forEach((item) => {\n arr.push(item.key);\n });\n this.$refs.deptTree.setCheckedKeys(arr);\n this.selectTreeDeptRight = this.$refs.deptTree.getCheckedNodes();\n this.activeRightDept = [];\n this.$forceUpdate();\n }, 500);\n }\n },\n },\n mounted() {\n this.$nextTick(() => {\n let field = this.field;\n if (field.isHideType) {\n let id = this.id,\n formShowType = field.formShowType;\n controlHidden({ id, field, formShowType });\n }\n });\n },\n data: function () {\n return {\n checkedCities: [],\n isActive: false,\n errorMessage: \"\",\n activeName: \"first\",\n Constant,\n dialogVisible: false,\n defaultCheckedKeys: [],\n defaultExpandedKeys: [], //默认展开\n defaultProps: {\n label: \"label\",\n children: \"children\",\n isLeaf: \"leaf\",\n },\n selectedNumber: \"\",\n dialog: false,\n selectTreeDept: [],\n selectTreeDeptRight: [],\n activeRightDept: [],\n allDeptTree: [],\n searchValue: \"\",\n showLogsDialog: false,\n tableData: [],\n showLogsIcon: true,\n operationData: \"\",\n searchDeptList: [],\n searchDeptListValue: [],\n isSearchValue: false,\n };\n },\n methods: {\n searchChange(value) {\n this.selectTreeDept = value;\n this.selectedNumber = value.length;\n },\n hiddenLogsDialog() {\n this.showLogsIcon = false;\n this.showLogsDialog = false;\n },\n enter() {\n if (this.field.isModified) {\n this.showLogsIcon = true;\n }\n },\n getOperationLogs() {\n let obj = {};\n obj.fieldName = this.field.name;\n this.operationData = obj;\n this.showLogsDialog = true;\n },\n handleIconSearch(value) {\n this.$api.searchDepartments(this.$root.appid, encodeURIComponent(value), {\n onSucess: (res) => {\n let list = res.data.data.map((item) => {\n return {\n children: false,\n key: item.id,\n label: item.name,\n leaf: true,\n level: 0,\n row_count: \"\",\n };\n });\n this.searchDeptList = list;\n if (!value) {\n this.isSearchValue = false;\n } else {\n this.isSearchValue = true;\n }\n },\n });\n },\n handleSelectDeptClick(key) {\n if (this.activeRightDept.indexOf(key) > -1) {\n for (let i = 0; i < this.activeRightDept.length; i++) {\n if (this.activeRightDept[i] == key) {\n this.activeRightDept.splice(i, 1);\n break;\n }\n }\n } else {\n this.activeRightDept.push(key);\n }\n console.log(\"------------->\", this.activeRightDept);\n },\n selectType(val) {\n if (val == \"TORIGHT\") {\n this.selectTreeDeptRight = this.selectTreeDept;\n } else if (val == \"TOLEFT\") {\n if (!this.searchValue) {\n let deptTree = this.$refs.deptTree.getCheckedNodes();\n let rightList = this.activeRightDept;\n for (let i = 0; i < rightList.length; i++) {\n for (let j = 0; j < deptTree.length; j++) {\n if (rightList[i] == deptTree[j].key) {\n deptTree.splice(j, 1);\n j--;\n }\n }\n }\n let arr = [];\n deptTree.forEach((item) => {\n arr.push(item.key);\n });\n this.$refs.deptTree.setCheckedKeys(arr);\n this.selectTreeDeptRight = this.$refs.deptTree.getCheckedNodes();\n this.activeRightDept = [];\n this.$forceUpdate();\n } else {\n let deptTree = this.searchDeptListValue;\n let rightList = this.activeRightDept;\n for (let i = 0; i < rightList.length; i++) {\n for (let j = 0; j < deptTree.length; j++) {\n if (rightList[i] == deptTree[j].key) {\n deptTree.splice(j, 1);\n j--;\n }\n }\n }\n\n let arr = [];\n deptTree.forEach((item) => {\n arr.push(item.key);\n });\n this.$refs.deptTree.setCheckedKeys(arr);\n this.selectTreeDeptRight = this.$refs.deptTree.getCheckedNodes();\n this.activeRightDept = [];\n this.$forceUpdate();\n }\n } else if (val == \"ALLTOLEFT\") {\n this.selectTreeDeptRight = this.allDeptTree;\n let arr = [];\n this.selectTreeDeptRight.forEach((item) => {\n item.key = item.id;\n item.label = item.name;\n arr.push(item.id);\n });\n this.$refs.deptTree.setCheckedKeys(arr);\n } else if (val == \"ALLTORIGHT\") {\n this.selectTreeDeptRight = [];\n this.$refs.deptTree.setCheckedKeys([]);\n this.activeRightDept = [];\n }\n },\n handleClick() {},\n showDialg() {\n this.selectedNumber = this.field.data.length;\n this.dialogVisible = true;\n },\n\n handleCheckChange() {\n let res = this.$refs.deptTree.getCheckedNodes();\n this.selectTreeDept = this.$refs.deptTree.getCheckedNodes();\n this.selectedNumber = res.length;\n },\n\n onTabClose(dept) {\n let field = this.field;\n let deptId = dept.id ? dept.id : dept.key;\n let allValue = field.value.split(\";\");\n for (let i = 0; i < field.data.length; i++) {\n let fieldDeptId = field.data[i].id\n ? field.data[i].id\n : field.data[i].key;\n if (fieldDeptId == deptId) {\n allValue.splice(allValue.indexOf(deptId), 1);\n }\n }\n field.value = allValue.join(\";\");\n field.data.splice(field.data.indexOf(dept), 1);\n if (field.data && field.data.length > 0) {\n let arr = [];\n let deptName = \"\";\n for (let i = 0; i < field.data.length; i++) {\n deptName += field.data[i].name + \";\";\n let deptid = field.data[i].id ? field.data[i].id : field.data[i].key;\n arr.push(deptid);\n }\n field.val = deptName;\n this.defaultCheckedKeys = arr;\n this.selectTreeDeptRight = field.data;\n this.field = field;\n if (this.$refs.deptTree) {\n this.$refs.deptTree.setCheckedKeys(arr);\n }\n } else {\n this.defaultCheckedKeys = [];\n }\n if (this.field.refreshOnChanged) {\n this.onChange();\n }\n if (this.field.instantValidate) {\n this.evenCheck();\n }\n },\n\n evenCheck() {\n let value = true;\n let formData = this.$parent.checkData(value);\n this.$api.formValidation(this.$root.appid, formData, {\n onSucess: (response) => {\n if (response.data.errcode == 4001) {\n if (response.data.errors && response.data.errors.length > 0) {\n let arr = response.data.errors;\n for (let i = 0; i < arr.length; i++) {\n if (this.field.name == arr[i].field) {\n this.isActive = true;\n this.errorMessage = arr[i].errmsg;\n return;\n } else {\n this.isActive = false;\n this.errorMessage = \"\";\n }\n }\n }\n } else if (response.data.errcode == 0) {\n this.isActive = false;\n }\n },\n });\n },\n\n onOk() {\n let nodes = this.selectTreeDeptRight; //this.$refs.deptTree.getCheckedNodes();\n //this.selectedNumber = nodes.length;\n if (nodes && nodes.length <= this.field.limit) {\n let value = \"\";\n let key = \"\";\n this.field.data = [];\n let selectKeys = [];\n nodes.forEach((node) => {\n selectKeys.push(node.key);\n this.field.data.push({ key: node.key, name: node.name });\n value += node.label + \";\";\n key += node.key + \";\";\n });\n this.field.data = JSON.parse(JSON.stringify(nodes));\n this.field.value = key.replace(/^(\\s|;)+|(\\s|;)+$/g, \"\");\n this.field.val = value;\n this.defaultCheckedKeys = selectKeys;\n this.selectedNumber = this.field.data.length + nodes.length;\n if (this.field.instantValidate) {\n this.evenCheck();\n }\n } else {\n alert(\"您最多可选择\" + this.field.limit + \"个部门\");\n }\n this.dialogVisible = false;\n if (this.field.refreshOnChanged) {\n //判断是否需要刷新\n this.onChange();\n }\n },\n handleClose(done) {\n this.selectedNumber = this.field.data.length;\n done();\n },\n\n loadNode(node, resolve) {\n let that = this;\n let appid = this.$root.appid;\n if (node.level === 0) {\n API.getDepartmentsByParentId(appid, \"\", {\n onSucess: function (response) {\n if (response.data.data) {\n that.allDeptTree = that.allDeptTree.concat(response.data.data);\n }\n let nodes = [];\n that.defaultExpandedKeys.push(response.data.data[0].id);\n let allData = response.data.data;\n allData.forEach((doc) => {\n nodes.push({\n key: doc.id,\n level: 0,\n label: doc.name,\n children: doc.hasChilds,\n row_count: doc.userCount,\n leaf: doc.hasChilds ? false : true,\n });\n });\n // hasChilds: true\n // id: \"ZMMMGm5mnGCE4WvWFeI\"\n // name: \"test123\"\n // userCount: 21\n console.log(\"this.nodes--->\", nodes);\n resolve(nodes);\n },\n });\n } else {\n API.getDepartmentsByParentId(appid, node.key, {\n onSucess: function (response) {\n if (response.data.data) {\n that.allDeptTree = that.allDeptTree.concat(response.data.data);\n }\n let nodes = [];\n let allData = response.data.data;\n allData.forEach((doc) => {\n nodes.push({\n key: doc.id,\n level: 0,\n label: doc.name,\n children: doc.hasChilds,\n row_count: doc.userCount,\n leaf: doc.hasChilds ? false : true,\n });\n });\n resolve(nodes);\n },\n });\n }\n },\n\n onChange() {\n this.$parent.refresh(this.id);\n },\n },\n};\n",null]}