|
|
|
|
|
|
|
|
<a-row :gutter="[10]"> |
|
|
<a-row :gutter="[10]"> |
|
|
<a-col span="24"> |
|
|
<a-col span="24"> |
|
|
<a-form-item> |
|
|
<a-form-item> |
|
|
<a-input addon-before="文章" v-model:value="commomParams.search.keyword" |
|
|
|
|
|
placeholder="请输入文章" @keyup.enter="getData"/> |
|
|
|
|
|
|
|
|
<a-input addon-before="文章" v-model:value="commomParams.search.keyword" placeholder="请输入文章" |
|
|
|
|
|
@keyup.enter="getData" /> |
|
|
|
|
|
</a-form-item> |
|
|
|
|
|
<a-form-item> |
|
|
|
|
|
<search-select placeholder="请选择上级栏目" :list="section_list" :select_value="commomParams.search.section_id" |
|
|
|
|
|
@searchData="sectionSearch" @getSelectValue="getSectionValue" |
|
|
|
|
|
:select_disabled="false"></search-select> |
|
|
</a-form-item> |
|
|
</a-form-item> |
|
|
</a-col> |
|
|
</a-col> |
|
|
</a-row> |
|
|
</a-row> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
import { ref, onMounted, watch, computed } from 'vue'; |
|
|
import { ref, onMounted, watch, computed } from 'vue'; |
|
|
|
|
|
import { addArticle, updateArticle, listSection } from '@/apis/models'; |
|
|
import { useCommon } from '@/hooks/useCommon'; |
|
|
import { useCommon } from '@/hooks/useCommon'; |
|
|
let { store, commomParams, openSearchModel, hideSearch } = useCommon(); |
|
|
let { store, commomParams, openSearchModel, hideSearch } = useCommon(); |
|
|
let props = defineProps(['search_params']); |
|
|
let props = defineProps(['search_params']); |
|
|
const emit = defineEmits(); |
|
|
const emit = defineEmits(); |
|
|
|
|
|
|
|
|
openSearchModel = computed(() => { |
|
|
openSearchModel = computed(() => { |
|
|
|
|
|
sectionSearch() |
|
|
return store.state.openSearchModel; |
|
|
return store.state.openSearchModel; |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
interface listType { |
|
|
|
|
|
section_id : Number | 0, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
commomParams.value.search = commomParams.value.search as listType; |
|
|
|
|
|
commomParams.value.search.section_id = null; |
|
|
|
|
|
|
|
|
// watch(() => props.search_params, (newVal) => { |
|
|
// watch(() => props.search_params, (newVal) => { |
|
|
// emit('searchData', commomParams.value.search) |
|
|
// emit('searchData', commomParams.value.search) |
|
|
// }) |
|
|
// }) |
|
|
|
|
|
|
|
|
clearSearch() |
|
|
clearSearch() |
|
|
hideSearch() |
|
|
hideSearch() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 选择栏目/频道 |
|
|
|
|
|
let section_list = ref<Object[]>([]) |
|
|
|
|
|
const sectionSearch = (val : Object) => { |
|
|
|
|
|
listSection(val).then((res : object) => { |
|
|
|
|
|
const data = res.data.sections.map((item : object) => ({ |
|
|
|
|
|
label: item.name, |
|
|
|
|
|
value: item.id, |
|
|
|
|
|
})); |
|
|
|
|
|
section_list.value = data; |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
const getSectionValue = (val : Object) => { |
|
|
|
|
|
commomParams.value.search.section_id = val.key; |
|
|
|
|
|
getData() |
|
|
|
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style> |
|
|
<style> |