|  | @@ -7,7 +7,13 @@
 | 
											
												
													
														|  |              <div class="categoryName2">{{ item.nameCn }}</div>
 |  |              <div class="categoryName2">{{ item.nameCn }}</div>
 | 
											
												
													
														|  |              <div class="rightContent">
 |  |              <div class="rightContent">
 | 
											
												
													
														|  |                <div v-if="!item.children?.length"></div>
 |  |                <div v-if="!item.children?.length"></div>
 | 
											
												
													
														|  | -              <div v-else class="jobItem" v-for="val in item.children" :key="val.id">{{ val.nameCn }}</div>
 |  | 
 | 
											
												
													
														|  | 
 |  | +              <div
 | 
											
												
													
														|  | 
 |  | +                v-else
 | 
											
												
													
														|  | 
 |  | +                class="jobItem"
 | 
											
												
													
														|  | 
 |  | +                :class="{'act': item.act}"
 | 
											
												
													
														|  | 
 |  | +                v-for="val in item.children" :key="val.id"
 | 
											
												
													
														|  | 
 |  | +                @click="handleClick(val)"
 | 
											
												
													
														|  | 
 |  | +              >{{ val.nameCn }}</div>
 | 
											
												
													
														|  |              </div>
 |  |              </div>
 | 
											
												
													
														|  |            </div>
 |  |            </div>
 | 
											
												
													
														|  |          </div>
 |  |          </div>
 | 
											
										
											
												
													
														|  | @@ -17,14 +23,42 @@
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  <script setup>
 |  |  <script setup>
 | 
											
												
													
														|  |  import { getDict } from '@/hooks/web/useDictionaries'
 |  |  import { getDict } from '@/hooks/web/useDictionaries'
 | 
											
												
													
														|  | -import { ref } from 'vue';
 |  | 
 | 
											
												
													
														|  | 
 |  | +import { reactive, ref } from 'vue';
 | 
											
												
													
														|  |  defineOptions({ name:'common-components-industryTypeCard'})
 |  |  defineOptions({ name:'common-components-industryTypeCard'})
 | 
											
												
													
														|  | 
 |  | +const emits = defineEmits('inputChange')
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  let items = ref()
 |  |  let items = ref()
 | 
											
												
													
														|  |  getDict('industryTreeData', null, 'industryTreeData').then(({ data }) => {
 |  |  getDict('industryTreeData', null, 'industryTreeData').then(({ data }) => {
 | 
											
												
													
														|  |    data = data?.length && data || []
 |  |    data = data?.length && data || []
 | 
											
												
													
														|  |    items.value = data
 |  |    items.value = data
 | 
											
												
													
														|  | 
 |  | +  console.log('industryTreeData', data)
 | 
											
												
													
														|  |  })
 |  |  })
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +// 设置选中ids
 | 
											
												
													
														|  | 
 |  | +const idChecked = reactive([])
 | 
											
												
													
														|  | 
 |  | +const handleClick = (val) => {
 | 
											
												
													
														|  | 
 |  | +  val.act = !val.act
 | 
											
												
													
														|  | 
 |  | +  console.log('val', val)
 | 
											
												
													
														|  | 
 |  | +  const findIndex = idChecked?.length ? idChecked.findIndex(j => j === val.id) : -1
 | 
											
												
													
														|  | 
 |  | +  if (findIndex === -1) {  
 | 
											
												
													
														|  | 
 |  | +    idChecked.push(val.id) // 添加  
 | 
											
												
													
														|  | 
 |  | +  } else {  
 | 
											
												
													
														|  | 
 |  | +    idChecked.splice(findIndex, 1) // 删除  
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +  console.log('idChecked', idChecked)
 | 
											
												
													
														|  | 
 |  | +  if (idChecked?.length) emits('inputChange', idChecked)
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +// 选中样式判断
 | 
											
												
													
														|  | 
 |  | +const calcAct = (id) => {
 | 
											
												
													
														|  | 
 |  | +  if (!id) return false
 | 
											
												
													
														|  | 
 |  | +  if (Array.isArray(idChecked)) {
 | 
											
												
													
														|  | 
 |  | +    const index = idChecked.findIndex(itemToCheck => itemToCheck=== id)
 | 
											
												
													
														|  | 
 |  | +    const bool = index !== -1
 | 
											
												
													
														|  | 
 |  | +    return bool ? true : false; // 如果找到返回索引,否则返回 false
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +  else return false
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  |  </script>
 |  |  </script>
 | 
											
												
													
														|  |  <style lang="scss" scoped>
 |  |  <style lang="scss" scoped>
 | 
											
												
													
														|  |  .card { border-radius: 12px; }
 |  |  .card { border-radius: 12px; }
 | 
											
										
											
												
													
														|  | @@ -37,6 +71,7 @@ getDict('industryTreeData', null, 'industryTreeData').then(({ data }) => {
 | 
											
												
													
														|  |    // .categoryName { font-size: 16px; line-height: 28px; margin-top: 6px; color: var(--v-primary-base)}
 |  |    // .categoryName { font-size: 16px; line-height: 28px; margin-top: 6px; color: var(--v-primary-base)}
 | 
											
												
													
														|  |    .categoryName2 { font-size: 14px; color: #000; width: 150px; margin-right: 4px;}
 |  |    .categoryName2 { font-size: 14px; color: #000; width: 150px; margin-right: 4px;}
 | 
											
												
													
														|  |    .jobItem { font-size: 14px; color: #333333; }
 |  |    .jobItem { font-size: 14px; color: #333333; }
 | 
											
												
													
														|  | 
 |  | +  .act { color: var(--v-primary-base); }
 | 
											
												
													
														|  |    .rowItem {
 |  |    .rowItem {
 | 
											
												
													
														|  |      padding: 8px 0;
 |  |      padding: 8px 0;
 | 
											
												
													
														|  |    }
 |  |    }
 |