|  |  |  | 
|---|
|  |  |  | <div class="tree"> | 
|---|
|  |  |  | <div v-for="(item, index) of list" :key="index" @click.stop="clickIten(item)"> | 
|---|
|  |  |  | <div class="tree_item"> | 
|---|
|  |  |  | <i class="el-icon-caret-bottom" :class="{ 'activeColor': item.fsStatus === 1 }" v-show="item.fsStatus === 1 && item.childList.length > 0"></i> | 
|---|
|  |  |  | <i class="el-icon-caret-bottom" :class="{ 'activeColor': item.actived === 1 }" v-show="item.fsStatus === 1 && item.childList.length > 0"></i> | 
|---|
|  |  |  | <i class="el-icon-caret-right color" v-show="item.childList.length > 0 && (item.fsStatus === 0 || !item.fsStatus)"></i> | 
|---|
|  |  |  | <div class="tree_item_label long-title-style" :title="item.name" :class="{ 'activeColor': item.fsDate === 1 && item.childList.length === 0 }">{{ item.name }}</div> | 
|---|
|  |  |  | <!--                <i class="el-icon-caret-bottom" :class="{ 'activeColor': item[defaultProps.status] }" v-show="item[defaultProps.status] && item[defaultProps.children]"></i>--> | 
|---|
|  |  |  | <!--                <i class="el-icon-caret-right color" v-show="item[defaultProps.children] && !item[defaultProps.status]"></i>--> | 
|---|
|  |  |  | <!--                <div class="tree_item_label long-title-style" :title="item[defaultProps.name]" :class="{ 'activeColor': item[defaultProps.status] && !item[defaultProps.children] }">{{ item[defaultProps.name] }}</div>--> | 
|---|
|  |  |  | <div class="tree_item_label long-title-style" :title="item.name" :class="{ 'activeColor':  item.actived === 1 }">{{ item.name }}</div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="tree_childern" v-show="item.fsStatus === 1"> | 
|---|
|  |  |  | <tree | 
|---|
|  |  |  | :list="item.childList" | 
|---|
|  |  |  | :alllist="alllist" | 
|---|
|  |  |  | :defaultProps="defaultProps" | 
|---|
|  |  |  | @callback="callback" | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | 
|---|
|  |  |  | name: 'tree', | 
|---|
|  |  |  | props: { | 
|---|
|  |  |  | list: { | 
|---|
|  |  |  | type: Array, | 
|---|
|  |  |  | required: false, | 
|---|
|  |  |  | default: () => [] | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | alllist: { | 
|---|
|  |  |  | type: Array, | 
|---|
|  |  |  | required: false, | 
|---|
|  |  |  | default: () => [] | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | listForList(){ | 
|---|
|  |  |  | // console.log('===============================',this.alllist) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 点击当前项 | 
|---|
|  |  |  | clickIten (item) { | 
|---|
|  |  |  | // item[this.defaultProps.status] = !item[this.defaultProps.status] | 
|---|
|  |  |  | // this.list.forEach(subItem => { | 
|---|
|  |  |  | //   if ((subItem[this.defaultProps.id] !== item[this.defaultProps.id] && subItem[this.defaultProps.status]) || (this.list.length === 1 && subItem[this.defaultProps.status] === false)) { | 
|---|
|  |  |  | //     subItem[this.defaultProps.status] = false | 
|---|
|  |  |  | //     if (subItem[this.defaultProps.children]) { | 
|---|
|  |  |  | //       this.recursion(subItem[this.defaultProps.children]) | 
|---|
|  |  |  | //     } | 
|---|
|  |  |  | //   } | 
|---|
|  |  |  | // }) | 
|---|
|  |  |  | // if (this.tempItem['id'] === item[this.defaultProps.id]) { | 
|---|
|  |  |  | //   this.tempItem = { | 
|---|
|  |  |  | //     id: null, | 
|---|
|  |  |  | //     name: null, | 
|---|
|  |  |  | //     erpId: null | 
|---|
|  |  |  | //   } | 
|---|
|  |  |  | // } else { | 
|---|
|  |  |  | //   this.tempItem.id = item[this.defaultProps.id] | 
|---|
|  |  |  | //   this.tempItem.name = item[this.defaultProps.name] | 
|---|
|  |  |  | //   this.tempItem.erpId = item['erpId'] | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // item.fsDate === 0 || !item.fsDate ? item.fsDate = 1 : item.fsDate = 0 | 
|---|
|  |  |  | // this.listForList() | 
|---|
|  |  |  | const fsDate = item.fsDate === 0 || !item.fsDate ? 1 : 0 | 
|---|
|  |  |  | this.list.forEach(i => { | 
|---|
|  |  |  | this.alllist.forEach(i => { | 
|---|
|  |  |  | i.fsDate = 0 | 
|---|
|  |  |  | i.actived = 0 | 
|---|
|  |  |  | this.recursion1(i.childList) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | item.fsDate = fsDate | 
|---|
|  |  |  | item.actived = 1 | 
|---|
|  |  |  | if (item.childList.length > 0) { | 
|---|
|  |  |  | item.fsStatus === 0 || !item.fsStatus ? item.fsStatus = 1 : item.fsStatus = 0 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.$emit('callback', item, item) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 递归方法 | 
|---|
|  |  |  | recursion (children) { | 
|---|
|  |  |  | recursion1 (children) { | 
|---|
|  |  |  | if (!children || children.length === 0){ | 
|---|
|  |  |  | return | 
|---|
|  |  |  | } | 
|---|
|  |  |  | children.forEach(item => { | 
|---|
|  |  |  | item.fsDate = 0 | 
|---|
|  |  |  | if (item.childList.length > 0) { | 
|---|
|  |  |  | this.recursion(item.childList) | 
|---|
|  |  |  | item.actived = 0 | 
|---|
|  |  |  | if (item.childList && item.childList.length > 0) { | 
|---|
|  |  |  | this.recursion1(item.childList) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // item[this.defaultProps.status] = false | 
|---|
|  |  |  | // if (item[this.defaultProps.children]) { | 
|---|