gaoluyang
2026-06-24 712aa51536236d43e87273e4ce45ac5691dffad8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<script setup lang="ts">
import type { PromotionArticleProperty } from './config';
 
import type { MallArticleApi } from '#/api/mall/promotion/article';
 
import { onMounted, ref } from 'vue';
 
import { useVModel } from '@vueuse/core';
import { Form, FormItem, Select } from 'ant-design-vue';
 
import { getArticlePage } from '#/api/mall/promotion/article';
 
import ComponentContainerProperty from '../../component-container-property.vue';
 
/** 营销文章属性面板 */
defineOptions({ name: 'PromotionArticleProperty' });
 
const props = defineProps<{ modelValue: PromotionArticleProperty }>();
 
const emit = defineEmits(['update:modelValue']);
const formData = useVModel(props, 'modelValue', emit);
 
const articles = ref<MallArticleApi.Article[]>([]); // 文章列表
const loading = ref(false); // 加载中
 
/** 查询文章列表 */
const queryArticleList = async (title?: string) => {
  loading.value = true;
  const { list } = await getArticlePage({
    title,
    pageNo: 1,
    pageSize: 10,
  });
  articles.value = list;
  loading.value = false;
};
 
/** 初始化 */
onMounted(() => {
  queryArticleList();
});
</script>
 
<template>
  <ComponentContainerProperty v-model="formData.style">
    <Form
      :label-col="{ span: 6 }"
      :wrapper-col="{ span: 18 }"
      :model="formData"
    >
      <FormItem label="文章" name="id">
        <Select
          v-model:value="formData.id"
          placeholder="请选择文章"
          class="w-full"
          :show-search="true"
          :loading="loading"
          :options="
            articles.map((item: any) => ({ label: item.title, value: item.id }))
          "
          @search="queryArticleList"
        />
      </FormItem>
    </Form>
  </ComponentContainerProperty>
</template>