riku
2025-10-11 925b485e661682a2fcfc8b8a47a8148d16ec818e
src/views/fysp/data-product/components/ProdDownload.vue
@@ -15,8 +15,14 @@
      </el-form-item>
      <el-form-item label="产品形式">
        <el-radio-group v-model="downloadType">
          <el-radio value="1"> Excel表单 </el-radio>
          <el-radio value="2" :disabled="true"> Word文档 </el-radio>
          <el-radio
            v-for="item in _downloadTypeOptions"
            :key="item.value"
            :value="item.value"
            :disabled="item.disabled"
          >
            {{ item.label }}
          </el-radio>
        </el-radio-group>
      </el-form-item>
    </el-form>
@@ -48,11 +54,33 @@
  loading: {
    type: Boolean,
    default: false
  },
  downloadTypeOptions: {
    type: Array,
    default: () => [
      {
        value: '1',
        label: 'Excel表单'
      },
      {
        value: '2',
        label: 'Word文档'
      }
    ]
  },
  // 下载类型是否有效
  downloadTypeValid: {
    type: Array,
    default: () => ['1']
  },
  defaultDownloadType: {
    type: String,
    default: '1'
  }
});
const emit = defineEmits(['submit']);
const downloadType = ref('1');
const downloadType = ref(props.defaultDownloadType);
const opts = computed(() => {
  if (props.queryOpt instanceof Array && props.queryOpt.length > 0) {
    return props.queryOpt[0];
@@ -61,6 +89,13 @@
  }
});
const _downloadTypeOptions = computed(() => {
  return props.downloadTypeOptions.map((item) => ({
    ...item,
    disabled: !props.downloadTypeValid.includes(item.value)
  }));
});
const submit = () => {
  emit('submit', {
    downloadType: downloadType.value