<script> | <script> | ||||
import table from './tools/table.js' | import table from './tools/table.js' | ||||
import search from './tools/search.js' | |||||
import { search, getAirOptions } from './tools/search.js' | |||||
import HeadSearch from '@/components/Search/index.vue' | import HeadSearch from '@/components/Search/index.vue' | ||||
import DataTable from '@/components/DataTable/index.vue' | import DataTable from '@/components/DataTable/index.vue' | ||||
import ReportDrawer from './components/ReportDrawer.vue' | import ReportDrawer from './components/ReportDrawer.vue' | ||||
name: 'TaskAll', | name: 'TaskAll', | ||||
components: { HeadSearch, DataTable, ReportDrawer }, | components: { HeadSearch, DataTable, ReportDrawer }, | ||||
setup() { | setup() { | ||||
getAirOptions() | |||||
const data = reactive({ | const data = reactive({ | ||||
search, | search, | ||||
...toRefs(table) | ...toRefs(table) |
import { reactive } from 'vue' | |||||
import { reactive, ref } from 'vue' | |||||
import { TASK_TYPE } from '@/utils/dictionary.js' | import { TASK_TYPE } from '@/utils/dictionary.js' | ||||
import { airportList } from '@/api/dashboard/index.js' | |||||
import { dataToSelect } from '@/utils/handleData.js' | |||||
const data = reactive([ | |||||
const airOptions = ref([]) | |||||
export const search = reactive([ | |||||
{ | { | ||||
label: '任务编号', | label: '任务编号', | ||||
key: 'code', | |||||
key: 'reportNo', | |||||
props: { | props: { | ||||
placeholder: '请输入任务编号' | placeholder: '请输入任务编号' | ||||
} | } | ||||
type: 'select', | type: 'select', | ||||
props: { | props: { | ||||
placeholder: '请选择巡检机场', | placeholder: '请选择巡检机场', | ||||
options: [], | |||||
onUpdateValue: () => { | |||||
const index = data.findIndex((item) => item.key === 'route') | |||||
data[index].value = '' | |||||
} | |||||
options: airOptions | |||||
} | } | ||||
}, | }, | ||||
{ | { | ||||
} | } | ||||
]) | ]) | ||||
export default data | |||||
export const getAirOptions = async function() { | |||||
const res = await airportList() | |||||
airOptions.value = dataToSelect(res.data, { label: 'name', value: 'id' }) | |||||
} |