| | |
| | | </ContentView> |
| | | <PageFooter> |
| | | <div class="expect-position-page-footer"> |
| | | <div class="expect-position-select-wrapper" v-if="positionList.length > 0"> |
| | | <div class="expect-position-select-item" v-for="(item, index) in positionList" :key="index"> |
| | | <div class="expect-position-select-item-text">{{ item }}</div> |
| | | <div class="expect-position-select-wrapper" v-if="checkdList.length > 0"> |
| | | <div class="expect-position-select-item" v-for="(item, index) in checkdList" :key="index"> |
| | | <div class="expect-position-select-item-text">{{ item.name }}</div> |
| | | <div class="expect-position-select-item-icon-wrapper"> |
| | | <Close :size="8" class="expect-position-select-item-icon" /> |
| | | <Close |
| | | :size="8" |
| | | class="expect-position-select-item-icon" |
| | | @click="handleDelete(item.id)" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <PageFooterBtn type="primary">保存</PageFooterBtn> |
| | | <PageFooterBtn type="primary" @click="handleConfirm">保存</PageFooterBtn> |
| | | </div> |
| | | </PageFooter> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { PositionSelectView } from '@12333/components'; |
| | | import { SearchType } from '@12333/constants'; |
| | | import { useSearchSettingType } from '@12333/hooks'; |
| | | import { Close } from '@nutui/icons-vue-taro'; |
| | | import Taro from '@tarojs/taro'; |
| | | import { size } from 'lodash'; |
| | | import { useEvent, useEventChannel } from 'senin-mini/hooks'; |
| | | |
| | | defineOptions({ |
| | | name: 'InnerPage', |
| | | }); |
| | | |
| | | const eventChannel = useEventChannel(); |
| | | |
| | | useEvent('updatePosition', function (data: { content: string[] }) { |
| | | if (data.content.length) { |
| | | positionList.value = [...data.content]; |
| | | } |
| | | }); |
| | | |
| | | const positionList = ref([]); |
| | | |
| | | const { searchSettingTypeList: position } = useSearchSettingType({ |
| | | searchType: SearchType.Position, |
| | | }); |
| | | |
| | | const checkdList = computed(() => { |
| | | if (!positionList.value.length) return []; |
| | | return position.value.filter((x) => positionList.value.includes(x.id)); |
| | | }); |
| | | |
| | | function handleDelete(id: string) { |
| | | positionList.value = positionList.value.filter((x) => x !== id); |
| | | } |
| | | |
| | | function handleConfirm() { |
| | | eventChannel.emit('addPosition', { |
| | | content: positionList.value, |
| | | }); |
| | | Taro.navigateBack({ delta: 1 }); |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |