{"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\\flow\\flowTree.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\src\\components\\flow\\flowTree.vue","mtime":1667327529403},{"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\r\nimport {mapState, mapActions} from 'vuex'\r\nimport process from '@/api/process'\r\n\r\nexport default {\r\n name: 'flowTree',\r\n props: {\r\n loadCount: Function,\r\n isAsideShow:{\r\n type:Boolean,\r\n default:false\r\n }\r\n },\r\n components: {},\r\n data() {\r\n return {\r\n isExpand:false,\r\n filterText: '',\r\n expandOnClickNode: false,\r\n defaultProps: {\r\n children: 'children',\r\n label: 'name'\r\n },\r\n treeData: []\r\n }\r\n },\r\n computed: {\r\n ...mapState('storeProcess',['pagination']),\r\n },\r\n watch: {\r\n filterText(val) {\r\n this.$refs.tree.filter(val)\r\n },\r\n },\r\n methods: {\r\n //流程分类默认展开收起事件\r\n handleValChange(val){\r\n this.$emit('switch-change',val)\r\n },\r\n treeClick(n, i, e) {\r\n this.$emit('currentTree', n)\r\n },\r\n //过滤函数\r\n filterNode(value, data) {\r\n if (!value) return true\r\n return data.name.indexOf(value) !== -1\r\n },\r\n cancelCheck() {\r\n this.$refs.tree.setCurrentKey(null)\r\n },\r\n getCountMap(array) {\r\n let map = {}\r\n array.forEach(item => {\r\n if (item.typeId === null) {\r\n map[''] = item.count\r\n } else {\r\n map[item.typeId] = item.count\r\n }\r\n })\r\n return map\r\n },\r\n fillCountIntoTree(tree, map) {\r\n tree.count = map[tree.id] ? map[tree.id] : 0\r\n tree.name += ' '\r\n if (tree.children == null) {\r\n return tree.count\r\n }\r\n for (let i = 0; i < tree.children.length; i++) {\r\n let child = tree.children[i]\r\n let count = this.fillCountIntoTree(child, map)\r\n tree.count += count\r\n if (count === 0) {\r\n tree.children.remove(child)\r\n i--\r\n }\r\n }\r\n return tree.count\r\n },\r\n getTotal(data) {\r\n let total = 0\r\n data.forEach(item => {\r\n total += item.count\r\n })\r\n return total\r\n }\r\n },\r\n created() {\r\n this.isExpand = this.isAsideShow \r\n process.getFlowTree(response => {\r\n this.treeData = response.data\r\n this.loadCount(this.pagination).then(data => {\r\n let map = this.getCountMap(data)\r\n this.fillCountIntoTree(this.treeData[0], map)\r\n this.treeData[0].count = this.getTotal(data)\r\n })\r\n /*process.getCountByUserId(this.pagination).then(data=>{\r\n let map = this.getCountMap(data);\r\n this.fillCountIntoTree(this.treeData[0],map);\r\n this.treeData[0].count += map[\"\"];\r\n });*/\r\n })\r\n \r\n }\r\n}\r\n",null]}