2024-12-30 14:43:13 +08:00
|
|
|
|
import { ref } from "vue"
|
|
|
|
|
|
|
2024-12-26 09:28:19 +08:00
|
|
|
|
<template>
|
2025-02-17 08:39:18 +08:00
|
|
|
|
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1400">
|
|
|
|
|
|
<div class="table-box">
|
2024-12-30 14:43:13 +08:00
|
|
|
|
<ProTable
|
2025-02-17 08:39:18 +08:00
|
|
|
|
ref="proTable"
|
|
|
|
|
|
:columns="columns"
|
2024-12-30 14:43:13 +08:00
|
|
|
|
:request-api="getTableList"
|
|
|
|
|
|
:pagination="false"
|
2025-02-17 08:39:18 +08:00
|
|
|
|
:toolButton="false"
|
|
|
|
|
|
:style="{ height: '530px', maxHeight: '530px', overflow: 'hidden' }"
|
2024-12-30 14:43:13 +08:00
|
|
|
|
>
|
|
|
|
|
|
<!-- :data='testScriptData' 如果要显示静态数据,就切换该配置 -->
|
|
|
|
|
|
<!-- 表格 header 按钮 -->
|
2025-02-17 08:39:18 +08:00
|
|
|
|
<template #tableHeader="scope">
|
|
|
|
|
|
<el-button v-auth.testScript="'add'" type="primary" :icon="CirclePlus" @click="add">新增</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
v-auth.testScript="'delete'"
|
|
|
|
|
|
type="danger"
|
|
|
|
|
|
:icon="Delete"
|
|
|
|
|
|
plain
|
|
|
|
|
|
:disabled="!scope.isSelected"
|
|
|
|
|
|
@click="batchDelete(scope.selectedListIds)"
|
|
|
|
|
|
>
|
|
|
|
|
|
删除
|
|
|
|
|
|
</el-button>
|
2024-12-30 14:43:13 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 表格操作 -->
|
2025-02-17 08:39:18 +08:00
|
|
|
|
<template #operation="scope">
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
v-auth.testScript="'upgrade'"
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
v-if="scope.row.type !== 1"
|
|
|
|
|
|
link
|
|
|
|
|
|
:icon="Share"
|
|
|
|
|
|
@click="copy(scope.row)"
|
|
|
|
|
|
>
|
|
|
|
|
|
复制
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
v-auth.testScript="'edit'"
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
link
|
|
|
|
|
|
:icon="EditPen"
|
|
|
|
|
|
:model-value="false"
|
|
|
|
|
|
@click="edit(scope.row)"
|
|
|
|
|
|
>
|
|
|
|
|
|
编辑
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
v-auth.testScript="'delete'"
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
link
|
|
|
|
|
|
:icon="Delete"
|
|
|
|
|
|
@click="batchDelete(scope.row)"
|
|
|
|
|
|
>
|
|
|
|
|
|
删除
|
|
|
|
|
|
</el-button>
|
2024-12-30 14:43:13 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</ProTable>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-02-17 08:39:18 +08:00
|
|
|
|
<template #footer>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-button @click="close()">取 消</el-button>
|
|
|
|
|
|
<el-button type="primary" @click="save">保存</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
<el-dialog :title="dialogTitle" v-model="showForm" @close="close" width="500">
|
|
|
|
|
|
<el-form ref="form" :model="form" label-width="auto">
|
|
|
|
|
|
<el-form-item label="参考设定值类型" prop="name">
|
|
|
|
|
|
<el-input v-model="form.name" />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="参考设定值子类型" prop="standardName">
|
|
|
|
|
|
<el-input v-model="form.standardName" />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="参考设定值" prop="standardTime">
|
|
|
|
|
|
<el-input v-model="form.standardTime" />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-button @click="close()">取 消</el-button>
|
|
|
|
|
|
<el-button type="primary" @click="save">保 存</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2024-12-30 14:43:13 +08:00
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
2025-02-17 08:39:18 +08:00
|
|
|
|
<SetValuePopup ref="setValuePopup" />
|
|
|
|
|
|
</template>
|
2024-12-26 09:28:19 +08:00
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2024-12-30 14:43:13 +08:00
|
|
|
|
import type { TestScript } from '@/api/device/interface/testScript'
|
|
|
|
|
|
import type { ColumnProps } from '@/components/ProTable/interface'
|
2025-02-17 08:39:18 +08:00
|
|
|
|
import { CirclePlus, EditPen, Delete, Share } from '@element-plus/icons-vue'
|
|
|
|
|
|
import { reactive, ref } from 'vue'
|
2024-12-30 14:43:13 +08:00
|
|
|
|
import { dialogBig } from '@/utils/elementBind'
|
2025-02-17 08:39:18 +08:00
|
|
|
|
const showForm = ref(false)
|
2024-12-30 14:43:13 +08:00
|
|
|
|
const dialogVisible = ref(false)
|
|
|
|
|
|
const dialogTitle = ref('')
|
|
|
|
|
|
|
|
|
|
|
|
// 表格配置项
|
|
|
|
|
|
const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
2025-02-17 08:39:18 +08:00
|
|
|
|
{ type: 'selection', fixed: 'left', width: 70 },
|
|
|
|
|
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
|
|
|
|
|
{
|
|
|
|
|
|
prop: 'name',
|
|
|
|
|
|
label: '参考设定值类型',
|
|
|
|
|
|
minWidth: 350
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
prop: 'standardName',
|
|
|
|
|
|
label: '参考设定值子类型',
|
|
|
|
|
|
minWidth: 150
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
prop: 'standardTime',
|
|
|
|
|
|
label: '参考设定值',
|
|
|
|
|
|
minWidth: 150
|
|
|
|
|
|
},
|
|
|
|
|
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 }
|
2024-12-30 14:43:13 +08:00
|
|
|
|
])
|
2025-02-17 08:39:18 +08:00
|
|
|
|
const form = ref({
|
|
|
|
|
|
name: 220,
|
|
|
|
|
|
standardName: 0,
|
|
|
|
|
|
standardTime: 0
|
|
|
|
|
|
})
|
2024-12-30 14:43:13 +08:00
|
|
|
|
|
|
|
|
|
|
// 打开弹窗,可能是新增,也可能是编辑
|
2025-02-17 08:39:18 +08:00
|
|
|
|
const open = (sign: string, row: any) => {
|
2024-12-30 14:43:13 +08:00
|
|
|
|
dialogVisible.value = true
|
2025-02-17 08:39:18 +08:00
|
|
|
|
dialogTitle.value = sign === 'add' ? '新增检测项目信息' : '编辑检测项目信息'
|
|
|
|
|
|
}
|
|
|
|
|
|
const save = () => {
|
|
|
|
|
|
dialogVisible.value = false
|
2024-12-30 14:43:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 关闭弹窗
|
|
|
|
|
|
const close = () => {
|
|
|
|
|
|
dialogVisible.value = false
|
|
|
|
|
|
}
|
2025-02-17 08:39:18 +08:00
|
|
|
|
// 新增
|
|
|
|
|
|
const add = () => {
|
|
|
|
|
|
showForm.value = true
|
|
|
|
|
|
}
|
|
|
|
|
|
//编辑
|
|
|
|
|
|
const edit = (row: any) => {}
|
|
|
|
|
|
// 复制
|
|
|
|
|
|
const copy = (row: any) => {}
|
|
|
|
|
|
//批量删除
|
|
|
|
|
|
const batchDelete = (row: any) => {}
|
2024-12-30 14:43:13 +08:00
|
|
|
|
// 对外映射
|
|
|
|
|
|
defineExpose({ open })
|
2024-12-26 09:28:19 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
2025-02-17 08:39:18 +08:00
|
|
|
|
<style scoped></style>
|