This commit is contained in:
caozehui
2025-03-24 19:56:11 +08:00
parent d7df999cf2
commit 312490ce59
2 changed files with 116 additions and 118 deletions

View File

@@ -13,12 +13,12 @@
>
<el-table-column label="被测量">
<el-table-column prop="col1" width="150"/>
<el-table-column prop="col2" width="120" />
<el-table-column prop="col2" width="120"/>
</el-table-column>
<el-table-column prop="deviceLevel" label="检测装置级别" width="120"/>
<el-table-column prop="measurementType" label="测量类型" />
<el-table-column prop="condition" label="测量条件" />
<el-table-column prop="maxErrorValue" label="最大误差" />
<el-table-column prop="measurementType" label="测量类型"/>
<el-table-column prop="condition" label="测量条件"/>
<el-table-column prop="maxErrorValue" label="最大误差"/>
</el-table>
</div>
<div>
@@ -30,34 +30,33 @@
</el-dialog>
</template>
<script lang="ts" setup name="IndicatorTypeDialog">
import { defineProps, defineEmits, reactive,watch,ref,computed, type CSSProperties } from 'vue';
import { dialogBig} from '@/utils/elementBind'
import type { ColumnProps } from '@/components/ProTable/interface'
import type { ErrorSystem } from '@/api/device/interface/error'
import errorDataList from '@/api/device/error/errorData'
import type { TableColumnCtx } from 'element-plus'
import { useDictStore } from '@/stores/modules/dict'
<script lang="ts" setup name="IndicatorTypeDialog">
import {computed, type CSSProperties, defineProps, ref} from 'vue';
import {dialogBig} from '@/utils/elementBind'
import type {ErrorSystem} from '@/api/device/interface/error'
import errorDataList from '@/api/device/error/errorData'
import type {TableColumnCtx} from 'element-plus'
import {useDictStore} from '@/stores/modules/dict'
const dictStore = useDictStore()
const errorData = ref<ErrorSystem.Error_detail[]>([]);
const dialogTitle = ref()
const devLevelName = ref<string>('') // 假设 devLevelName 是一个 ref
function useMetaInfo() {
const dictStore = useDictStore()
const errorData = ref<ErrorSystem.Error_detail[]>([]);
const dialogTitle = ref()
const devLevelName = ref<string>('') // 假设 devLevelName 是一个 ref
function useMetaInfo() {
const dialogVisible = ref(false)
const formContent = ref<ErrorSystem.ErrorSystemList>({
id: '',
name: '',
standardName:'',
standardTime:'',
devLevel:'',
enable:1,
state:1,
standardName: '',
standardTime: '',
devLevel: '',
enable: 1,
state: 1,
})
return { dialogVisible, formContent }
}
return {dialogVisible, formContent}
}
const { dialogVisible, formContent } = useMetaInfo()
const {dialogVisible, formContent} = useMetaInfo()
interface SpanMethodProps {
row: ErrorSystem.ErrorSystemDetail
@@ -66,14 +65,14 @@ interface SpanMethodProps {
columnIndex: number
}
const rowClass = ({ row, column, rowIndex, columnIndex }: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => {
const rowClass = ({row, column, rowIndex, columnIndex}: { row: any; column: any; rowIndex: number; columnIndex: number }): CSSProperties => {
let res: CSSProperties = {
textAlign: 'center' as CSSProperties['textAlign'],
backgroundColor: 'var(--el-color-primary)',
color: '#fff'
}
if (rowIndex === 1) {
res = { ...res, display: 'none' }
res = {...res, display: 'none'}
}
return res
}
@@ -88,7 +87,7 @@ const spanAMethod = ({
column,
rowIndex,
columnIndex,
}: SpanMethodProps) => {
}: SpanMethodProps) => {
if (columnIndex === 0) {
if (rowIndex <= 1 || rowIndex === 7 || rowIndex == 20) {//0电压偏差1频率偏差7闪变20功率简单的跨两列
return {
@@ -170,7 +169,7 @@ const spanSMethod = ({
column,
rowIndex,
columnIndex,
}: SpanMethodProps) => {
}: SpanMethodProps) => {
if (columnIndex === 0) {
if (rowIndex <= 1 || rowIndex === 8 || rowIndex == 17) {//0电压偏差1频率偏差7闪变20功率简单的跨两列
return {
@@ -205,7 +204,7 @@ const spanSMethod = ({
colspan: 2,
}
}
if (rowIndex === 18 ) {//电流跨两行两列
if (rowIndex === 18) {//电流跨两行两列
return {
rowspan: 2,
colspan: 2,
@@ -245,18 +244,18 @@ const spanSMethod = ({
}
}
}
if(columnIndex === 3){
if (columnIndex === 3) {
if (rowIndex === 2 || rowIndex === 6 || rowIndex === 9 ||
rowIndex === 11 || rowIndex === 13 ||rowIndex === 15 ||
rowIndex === 18 || rowIndex === 21){
rowIndex === 11 || rowIndex === 13 || rowIndex === 15 ||
rowIndex === 18 || rowIndex === 21) {
return {
rowspan: 2,
colspan: 1,
}
}
if (rowIndex === 3 || rowIndex === 7 || rowIndex === 10 ||
rowIndex === 12 || rowIndex === 14 ||rowIndex === 16 ||
rowIndex === 19 || rowIndex === 22){
rowIndex === 12 || rowIndex === 14 || rowIndex === 16 ||
rowIndex === 19 || rowIndex === 22) {
return {
rowspan: 0,
colspan: 0,
@@ -270,31 +269,31 @@ const close = () => {
dialogVisible.value = false
}
// 打开弹窗,可能是新增,也可能是编辑
// 打开弹窗,可能是新增,也可能是编辑
const open = async (sign: string, data: ErrorSystem.ErrorSystemList) => {
dialogTitle.value = sign + ' 误差体系'
dialogVisible.value = true
if (data.id) {
formContent.value = data as ErrorSystem.ErrorSystemList;
devLevelName.value = dictStore.getDictData('Dev_Level').find(item => item.id === data.devLevel)?.name || '';
devLevelName.value = dictStore.getDictData('Dev_Level').find(item => item.id === data.devLevel)?.name || '';;
if(devLevelName.value === 'A级'){
if (devLevelName.value === 'A级' || data.devLevel === 'A级') {
errorData.value = errorDataList.errorADetail as unknown as ErrorSystem.Error_detail[];
}else{
} else {
errorData.value = errorDataList.errorSDetail as unknown as ErrorSystem.Error_detail[];
}
}
}
// 对外映射
defineExpose({ open })
// 对外映射
defineExpose({open})
const props = defineProps<{
refreshTable: (() => Promise<void>) | undefined;
}>()
</script>
<style>
</script>
<style>
.table-container {
display: flex;
flex-direction: column;
@@ -316,4 +315,4 @@ const props = defineProps<{
}
</style>
</style>

View File

@@ -219,9 +219,7 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
width: 360,
render: scope => {
return (
<el-link type='primary' link onClick={() => showTestScript(scope.row.scriptId)}>
{scope.row.scriptName}
</el-link>
<span>{scope.row.scriptName}</span>
)
},
},
@@ -231,7 +229,7 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
width: 200,
render: scope => {
return (
<el-link type='primary' link onClick={() => showData(scope.row.errorSysName || '')}>
<el-link type='primary' link onClick={() => showData(scope.row)}>
{scope.row.errorSysName}
</el-link>
)
@@ -282,8 +280,9 @@ function isVisible(row: Plan.ReqPlan) {
}
function showData(row: string) {
errorStandardPopup.value?.open(row, row)
function showData(row: any) {
let split = row.errorSysName.split('-')
errorStandardPopup.value?.open(row.errorSysName, {id:row.errorSysId,devLevel:split[split.length-1]})
}
async function showTestSource(row:string) {