| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <template>
- <view class="task-location">
- <wd-cell
- title-width="200rpx"
- :placeholder="'请选择' + taskFieldConfig.taskFiledValue"
- :title="taskFieldConfig.taskFiledValue"
- :required="taskFieldConfig.isMustfill === '1'"
- :value="cellValue"
- :is-link="!props.disabled"
- @click="taskLocationClick"
- />
- </view>
- </template>
- <script setup lang="ts">
- import { computed } from 'vue'
- import type { TaskFieldConfigItem } from '@/services/modules/task/taskFrom/type'
- interface Props {
- taskFieldConfig: TaskFieldConfigItem
- disabled?: boolean
- }
- type FieldValue = string
- const props = withDefaults(defineProps<Props>(), {
- disabled: false,
- })
- const value = defineModel<FieldValue>('value', { default: '' })
- const label = defineModel<FieldValue>('label', { default: '' })
- const cellValue = computed(() => label.value || value.value || '')
- const taskLocationClick = () => {
- if (props.disabled) return
- uni.navigateTo({
- url: `/pages-common/location-select/index?type=${props.taskFieldConfig.taskFiledType}`,
- events: {
- locationSelect: (location: string) => {
- label.value = location
- value.value = location
- },
- },
- })
- }
- </script>
|