选煤厂安全管理系统前端代码
houzhongjian
2024-11-25 37b2044f04a09e89f82f8484279b5f06b7194481
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
<template>
  <ComponentContainerProperty v-model="formData.style">
    <el-form label-width="40px" :model="formData">
      <el-form-item label="文章" prop="id">
        <el-select
          v-model="formData.id"
          placeholder="请选择文章"
          class="w-full"
          filterable
          remote
          :remote-method="queryArticleList"
          :loading="loading"
        >
          <el-option
            v-for="article in articles"
            :key="article.id"
            :label="article.title"
            :value="article.id"
          />
        </el-select>
      </el-form-item>
    </el-form>
  </ComponentContainerProperty>
</template>
 
<script setup lang="ts">
import { PromotionArticleProperty } from './config'
import { usePropertyForm } from '@/components/DiyEditor/util'
import * as ArticleApi from '@/api/mall/promotion/article/index'
 
// 营销文章属性面板
defineOptions({ name: 'PromotionArticleProperty' })
 
const props = defineProps<{ modelValue: PromotionArticleProperty }>()
const emit = defineEmits(['update:modelValue'])
const { formData } = usePropertyForm(props.modelValue, emit)
// 文章列表
const articles = ref<ArticleApi.ArticleVO>([])
 
// 加载中
const loading = ref(false)
// 查询文章列表
const queryArticleList = async (title?: string) => {
  loading.value = true
  const { list } = await ArticleApi.getArticlePage({ title, pageSize: 10 })
  articles.value = list
  loading.value = false
}
 
// 初始化
onMounted(() => {
  queryArticleList()
})
</script>
 
<style scoped lang="scss"></style>