优化检测脚本页面
This commit is contained in:
@@ -1,94 +1,35 @@
|
||||
import { ref } from "vue"
|
||||
|
||||
<template>
|
||||
<el-dialog title="检测项目信息" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1400">
|
||||
<div class="table-container">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#003078',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
height="600px"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="60" />
|
||||
<el-table-column prop="pname" label="参考设定值类型" />
|
||||
<el-table-column prop="name" label="参考设定值子类型" />
|
||||
<el-table-column prop="phase" label="相别" />
|
||||
<el-table-column prop="value" label="参考设定值" />
|
||||
<el-table-column label="操作">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link :icon="EditPen">编辑</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<!-- <ProTable
|
||||
ref="proTable"
|
||||
:columns="columns"
|
||||
:request-api="getTableList"
|
||||
:pagination="false"
|
||||
:toolButton="false"
|
||||
:style="{ height: '530px', maxHeight: '530px', overflow: 'hidden' }"
|
||||
>
|
||||
|
||||
<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>
|
||||
<div class="table-container">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:header-cell-style="{
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#003078',
|
||||
color: '#fff'
|
||||
}"
|
||||
stripe
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
height="600px"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="60" />
|
||||
<el-table-column prop="pname" label="参考设定值类型" />
|
||||
<el-table-column prop="name" label="参考设定值子类型" />
|
||||
<el-table-column prop="dataType" label="值类型" :formatter="formatter" />
|
||||
<el-table-column prop="phase" label="相别" />
|
||||
<el-table-column prop="value" label="参考设定值" />
|
||||
<el-table-column prop="value" label="参与误差比较">
|
||||
<template #default="{ row }">
|
||||
{{ row.errorFlag == 0 ? '否' : '是' }}
|
||||
</template>
|
||||
|
||||
<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>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link :icon="EditPen">编辑</el-button>
|
||||
</template>
|
||||
</ProTable> -->
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<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">
|
||||
@@ -111,8 +52,6 @@ import { ref } from "vue"
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { TestScript } from '@/api/device/interface/testScript'
|
||||
import type { ColumnProps } from '@/components/ProTable/interface'
|
||||
import { CirclePlus, EditPen, Delete, Share } from '@element-plus/icons-vue'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
|
||||
@@ -144,13 +83,25 @@ const form = ref({
|
||||
standardName: 0,
|
||||
standardTime: 0
|
||||
})
|
||||
const formatter = (row: any, column: any) => {
|
||||
if (column.property == 'dataType') {
|
||||
return row.dataType == 'real'
|
||||
? '实时'
|
||||
: row.dataType == 'cp95'
|
||||
? 'CP95值'
|
||||
: row.dataType == 'avg'
|
||||
? '平均值'
|
||||
: row.dataType == 'min'
|
||||
? '最小值'
|
||||
: row.dataType == 'max'
|
||||
? '最大值'
|
||||
: row.dataType
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = async (row: any) => {
|
||||
dialogVisible.value = true
|
||||
// checkDataList({ scriptId: props.formContent.id, scriptType: props.activeName }).then((res: any) => {
|
||||
|
||||
// })
|
||||
const open = async (row: any) => {
|
||||
let treeData: any = []
|
||||
await getDictTreeByCode({
|
||||
name: '',
|
||||
@@ -162,16 +113,21 @@ const open = async (row: any) => {
|
||||
}).then((res: any) => {
|
||||
treeData = res.data[0].children
|
||||
})
|
||||
let checkDataList: any = []
|
||||
await row.forEach((item: any) => {
|
||||
item.children.forEach((k: any) => {
|
||||
if (k.enable != 0 || k.errorFlag != 0) {
|
||||
checkDataList.push({
|
||||
pid: k.pid,
|
||||
valueType: k.id,
|
||||
dataType: k.dataType,
|
||||
enable: k.enable,
|
||||
errorFlag: k.errorFlag
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
let checkDataList = [
|
||||
{
|
||||
pid: '004e06c7145e8454493dd69ad485c2a9',
|
||||
valueType: '2da2a32c0cd19fb6368b9f4c249c2b3c',
|
||||
dataType: 'real',
|
||||
enable: 1,
|
||||
errorFlag: 1
|
||||
}
|
||||
]
|
||||
await scriptDtlsCheckDataList({
|
||||
...props.form,
|
||||
scriptId: props.formContent?.id,
|
||||
@@ -189,14 +145,18 @@ const open = async (row: any) => {
|
||||
const save = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
const getTableData = () => {
|
||||
return tableData.value
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
onMounted(() => {})
|
||||
|
||||
// 对外映射
|
||||
defineExpose({ open })
|
||||
defineExpose({ open, getTableData })
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
Reference in New Issue
Block a user