hhz_restructure/src/views/reports/river-report/tools/table.js

108 lines
2.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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