微调
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class='table-box'>
|
||||
<div class='table-box' >
|
||||
<ProTable
|
||||
ref='proTable'
|
||||
ref='proTable'
|
||||
:columns='columns'
|
||||
:pagination="false"
|
||||
:toolButton="false"
|
||||
@@ -11,18 +11,18 @@
|
||||
>
|
||||
<!-- 表格 header 按钮 -->
|
||||
<template #tableHeader='scope'>
|
||||
<el-button v-auth.testSource="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增
|
||||
<el-button :disabled="isDisable" v-auth.testSource="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增
|
||||
</el-button>
|
||||
<el-button v-auth.testSource="'delete'" type='danger' :icon='Delete'
|
||||
plain :disabled='!scope.isSelected' @click='batchDelete(scope.selectedListIds)'>
|
||||
plain :disabled='isDisable || !scope.isSelected' @click='batchDelete(scope.selectedListIds)'>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
<!-- 表格操作 -->
|
||||
<template #operation='scope'>
|
||||
<el-button type="primary" link :icon='CopyDocument' @click="copyRow(scope.row)">复制</el-button>
|
||||
<el-button type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
||||
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row.id)'>删除</el-button>
|
||||
<!-- <el-button type="primary" link :icon='CopyDocument' @click="copyRow(scope.row)">复制</el-button> -->
|
||||
<el-button :disabled="isDisable" type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
||||
<el-button :disabled="isDisable" type='primary' link :icon='Delete' @click='handleDelete(scope.row.id)'>删除</el-button>
|
||||
</template>
|
||||
</ProTable>
|
||||
|
||||
@@ -40,15 +40,23 @@ import ParameterPopup from '@/views/machine/testSource/components/parameterPopup
|
||||
import {reactive, ref, watch} from 'vue'
|
||||
import {generateUUID} from "@/styles";
|
||||
import {defineEmits} from "vue/dist/vue";
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const parameterPopup = ref()
|
||||
const dictStore = useDictStore()
|
||||
// ProTable 实例
|
||||
const proTable = ref<ProTableInstance>()
|
||||
const tableData = ref<any[]>([])
|
||||
const props = defineProps<{
|
||||
parameterStr: string;
|
||||
}>();
|
||||
const props = defineProps({
|
||||
parameterStr: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
isDisable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['change-parameter'])
|
||||
|
||||
@@ -105,7 +113,14 @@ const getTreeData = (data: TestSource.ParameterType[]): TestSource.ParameterType
|
||||
}
|
||||
|
||||
const columns = reactive<ColumnProps<any>[]>([
|
||||
{type: 'selection', fixed: 'left', width: 70},
|
||||
{type: 'selection', fixed: 'left', width: 70,
|
||||
selectable(row, index) {
|
||||
if (props.isDisable) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
||||
{
|
||||
prop: 'sourceParamType',
|
||||
@@ -179,6 +194,8 @@ const copyRow = (row) => {
|
||||
|
||||
const getParameter = (data: TestSource.ParameterType) => {
|
||||
let index = originalParameterArr.findIndex(item => item.id === data.id)
|
||||
|
||||
|
||||
if (index === -1) {
|
||||
data.id = generateUUID()
|
||||
// 新增
|
||||
@@ -193,7 +210,7 @@ const getParameter = (data: TestSource.ParameterType) => {
|
||||
|
||||
//清空数据
|
||||
const clearData = () => {
|
||||
console.log('clearData')
|
||||
//console.log('clearData')
|
||||
originalParameterArr = []
|
||||
tableData.value = []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user