联调检测脚本
This commit is contained in:
@@ -1,9 +1,32 @@
|
||||
import { ref } from "vue"
|
||||
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" v-model="dialogVisible" @close="close" v-bind="dialogBig" width="1400">
|
||||
<div class="table-box">
|
||||
<ProTable
|
||||
<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"
|
||||
@@ -11,8 +34,7 @@ import { ref } from "vue"
|
||||
:toolButton="false"
|
||||
:style="{ height: '530px', maxHeight: '530px', overflow: 'hidden' }"
|
||||
>
|
||||
<!-- :data='testScriptData' 如果要显示静态数据,就切换该配置 -->
|
||||
<!-- 表格 header 按钮 -->
|
||||
|
||||
<template #tableHeader="scope">
|
||||
<el-button v-auth.testScript="'add'" type="primary" :icon="CirclePlus" @click="add">新增</el-button>
|
||||
<el-button
|
||||
@@ -26,7 +48,7 @@ import { ref } from "vue"
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
<!-- 表格操作 -->
|
||||
|
||||
<template #operation="scope">
|
||||
<el-button
|
||||
v-auth.testScript="'upgrade'"
|
||||
@@ -58,12 +80,11 @@ import { ref } from "vue"
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</ProTable>
|
||||
</div>
|
||||
</ProTable> -->
|
||||
|
||||
<template #footer>
|
||||
<div>
|
||||
<el-button @click="close()">取 消</el-button>
|
||||
<el-button @click="close">取 消</el-button>
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -87,8 +108,6 @@ import { ref } from "vue"
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<SetValuePopup ref="setValuePopup" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -96,32 +115,30 @@ 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'
|
||||
import { dialogBig } from '@/utils/elementBind'
|
||||
import { checkDataList, scriptDtlsCheckDataList } from '@/api/device/testScript/index'
|
||||
const showForm = ref(false)
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const props = defineProps({
|
||||
activeName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
|
||||
formContent: {
|
||||
type: [Object, Array],
|
||||
required: true
|
||||
},
|
||||
form: {
|
||||
type: [Object, Array],
|
||||
required: true
|
||||
}
|
||||
})
|
||||
const tableData: any = ref([])
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<TestScript.ResTestScript>[]>([
|
||||
{ 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 }
|
||||
])
|
||||
|
||||
const form = ref({
|
||||
name: 220,
|
||||
standardName: 0,
|
||||
@@ -129,9 +146,45 @@ const form = ref({
|
||||
})
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = (sign: string, row: any) => {
|
||||
const open = async (row: any) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = sign === 'add' ? '新增检测项目信息' : '编辑检测项目信息'
|
||||
// checkDataList({ scriptId: props.formContent.id, scriptType: props.activeName }).then((res: any) => {
|
||||
|
||||
// })
|
||||
let treeData: any = []
|
||||
await getDictTreeByCode({
|
||||
name: '',
|
||||
id: '',
|
||||
pid: '',
|
||||
pids: '',
|
||||
code: 'Script_Error',
|
||||
sort: 0
|
||||
}).then((res: any) => {
|
||||
treeData = res.data[0].children
|
||||
})
|
||||
|
||||
let checkDataList = [
|
||||
{
|
||||
pid: '004e06c7145e8454493dd69ad485c2a9',
|
||||
valueType: '2da2a32c0cd19fb6368b9f4c249c2b3c',
|
||||
dataType: 'real',
|
||||
enable: 1,
|
||||
errorFlag: 1
|
||||
}
|
||||
]
|
||||
await scriptDtlsCheckDataList({
|
||||
...props.form,
|
||||
scriptId: props.formContent?.id,
|
||||
scriptType: props.activeName,
|
||||
checkDataList: checkDataList
|
||||
}).then((res: any) => {
|
||||
res.data.forEach((item: any) => {
|
||||
let pList = treeData.filter((i: any) => i.id == item.pid)[0]
|
||||
item.pname = pList.name
|
||||
item.name = pList.children.filter((i: any) => i.id == item.valueType)[0].name
|
||||
})
|
||||
tableData.value = res.data
|
||||
})
|
||||
}
|
||||
const save = () => {
|
||||
dialogVisible.value = false
|
||||
@@ -141,16 +194,7 @@ const save = () => {
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
// 新增
|
||||
const add = () => {
|
||||
showForm.value = true
|
||||
}
|
||||
//编辑
|
||||
const edit = (row: any) => {}
|
||||
// 复制
|
||||
const copy = (row: any) => {}
|
||||
//批量删除
|
||||
const batchDelete = (row: any) => {}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user