108 lines
2.3 KiB
JavaScript
108 lines
2.3 KiB
JavaScript
|
|
import { h, ref, reactive } from 'vue'
|
|||
|
|
import TableAction from '@/components/DataTable/tools/Action.vue'
|
|||
|
|
|
|||
|
|
/* 注册table */
|
|||
|
|
const tableRef = ref()
|
|||
|
|
const searchParams = ref()
|
|||
|
|
|
|||
|
|
function handleSearch(params) {
|
|||
|
|
searchParams.value = { ...params }
|
|||
|
|
tableRef.value.reFetch({ searchParams })
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @description: 获取数据及操作
|
|||
|
|
* @param {*} row 单行数据
|
|||
|
|
* @param {*} type 操作类型 create:创建,preview:预览,edit:编辑
|
|||
|
|
* @return {*}
|
|||
|
|
*/
|
|||
|
|
function getRowData(row, type) {
|
|||
|
|
data.rowData = row || {}
|
|||
|
|
data.drawerType = type
|
|||
|
|
data.drawerShow = true
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const data = reactive({
|
|||
|
|
tableRef,
|
|||
|
|
searchParams,
|
|||
|
|
rowData: {},
|
|||
|
|
drawerType: 'create',
|
|||
|
|
drawerShow: false,
|
|||
|
|
handleSearch,
|
|||
|
|
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
title: '任务编码',
|
|||
|
|
key: 'inspectionCode',
|
|||
|
|
align: 'center',
|
|||
|
|
width: 200
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: '任务名称',
|
|||
|
|
key: 'inspectionName',
|
|||
|
|
align: 'center',
|
|||
|
|
ellipsis: {
|
|||
|
|
tooltip: true
|
|||
|
|
},
|
|||
|
|
width: 400
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: '巡检河道',
|
|||
|
|
key: 'streamName',
|
|||
|
|
align: 'center',
|
|||
|
|
width: 200
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: '巡检时间',
|
|||
|
|
key: 'inspectionTime',
|
|||
|
|
align: 'center',
|
|||
|
|
width: 200
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: '操作',
|
|||
|
|
align: 'center',
|
|||
|
|
width: 150,
|
|||
|
|
fixed: 'right',
|
|||
|
|
render(row) {
|
|||
|
|
return h(TableAction, {
|
|||
|
|
actions: [
|
|||
|
|
// {
|
|||
|
|
// label: '查看',
|
|||
|
|
// type: 'button',
|
|||
|
|
// props: {
|
|||
|
|
// type: 'primary',
|
|||
|
|
// text: true,
|
|||
|
|
// onClick: getRowData.bind(null, row, 'preview')
|
|||
|
|
// },
|
|||
|
|
// auth: 'basic_list'
|
|||
|
|
// },
|
|||
|
|
{
|
|||
|
|
label: '巡河报告',
|
|||
|
|
type: 'button',
|
|||
|
|
props: {
|
|||
|
|
type: 'primary',
|
|||
|
|
text: true,
|
|||
|
|
onClick: getRowData.bind(null, row, 'river')
|
|||
|
|
},
|
|||
|
|
auth: 'basic_list'
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
label: '处理结果',
|
|||
|
|
type: 'button',
|
|||
|
|
props: {
|
|||
|
|
type: 'primary',
|
|||
|
|
text: true,
|
|||
|
|
onClick: getRowData.bind(null, row, 'result')
|
|||
|
|
},
|
|||
|
|
auth: 'basic_list'
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
align: 'center'
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
export default data
|