与后端接口进行首次联调
This commit is contained in:
@@ -3,9 +3,11 @@
|
||||
<ProTable
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:data='testScriptData'
|
||||
:request-api="getTableList"
|
||||
:init-param="initParam"
|
||||
:data-callback="dataCallback"
|
||||
>
|
||||
<!-- :requestApi="getRoleList" -->
|
||||
<!-- :data='testScriptData' 如果要显示静态数据,就切换该配置 -->
|
||||
<!-- 表格 header 按钮 -->
|
||||
<template #tableHeader='scope'>
|
||||
<el-button type='primary' :icon='CirclePlus' >新增</el-button>
|
||||
@@ -45,12 +47,12 @@ import { useDictStore } from '@/stores/modules/dict'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
|
||||
const testScriptData = testScriptDataList
|
||||
// const testScriptData = testScriptDataList
|
||||
// ProTable 实例
|
||||
const proTable = ref<ProTableInstance>()
|
||||
|
||||
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
||||
const initParam = reactive({ type: 1 })
|
||||
const initParam = reactive({ pattern: 1 })//表示当前用户选择的是模拟式测试,后期要读取pinia中的数据 TODO...
|
||||
|
||||
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
|
||||
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
|
||||
@@ -58,6 +60,8 @@ const dataCallback = (data: any) => {
|
||||
return {
|
||||
list: data.list,
|
||||
total: data.total,
|
||||
pageNum: data.pageNum,
|
||||
pageSize: data.pageSize,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,24 +79,38 @@ const getTableList = (params: any) => {
|
||||
const { BUTTONS } = useAuthButtons()
|
||||
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<TestScript.ResTestScriptList>[]>([
|
||||
const columns = reactive<ColumnProps<TestScript.TestScriptBO>[]>([
|
||||
{ type: 'selection', fixed: 'left', width: 70 },
|
||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||
{
|
||||
prop: 'testScriptName',
|
||||
prop: 'name',
|
||||
label: '名称',
|
||||
search: { el: 'input' },
|
||||
minWidth: 350,
|
||||
},
|
||||
{
|
||||
prop: 'testScriptValueType',
|
||||
prop: 'standardName',
|
||||
label: '参照标准名称',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
prop: 'standardTime',
|
||||
label: '标准推行时间',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
prop: 'valueType',
|
||||
label: '值类型',
|
||||
enum: dictStore.getDictData('testScriptValueType'),
|
||||
fieldNames: { label: 'label', value: 'id' },
|
||||
search: { el: 'select' },
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
prop: 'testScriptType',
|
||||
prop: 'type',
|
||||
label: '模板类型',
|
||||
enum: dictStore.getDictData('testScriptType'),
|
||||
fieldNames: { label: 'label', value: 'id' },
|
||||
search: { el: 'select' },
|
||||
minWidth: 150,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user