hhz_restructure/src/views/inspection/all-task/tools/search.js

59 lines
1.2 KiB
JavaScript

import { reactive, ref } from 'vue'
import { TASK_STATUS } from '@/utils/dictionary.js'
import { allRivers } from '@/api/inspection/alltask.js'
import { dataToSelect } from '@/utils/handleData.js'
const riverOptions = ref([])
export const search = reactive([
{
label: '任务编码',
key: 'code',
props: {
placeholder: '请输入任务编码'
}
},
{
label: '任务名称',
key: 'name',
props: {
placeholder: '请输入任务名称'
}
},
{
label: '巡检河道',
type: 'select',
key: 'streamId',
props: {
placeholder: '请选择巡检河道',
options: riverOptions
}
},
{
label: '任务状态',
type: 'select',
key: 'status',
props: {
placeholder: '请选择任务状态',
options: TASK_STATUS
}
},
{
label: '巡检时间',
type: 'date',
key: 'inspectionTime',
props: {
placeholder: '请选择巡检时间',
type: 'date',
valueFormat: 'yyyy-MM-dd',
format: 'yyyy-MM-dd'
}
}
])
export const getRiverOptions = async function() {
const res = await allRivers()
riverOptions.value = dataToSelect(res.data, { label: 'name', value: 'id' })
}