样式调整

This commit is contained in:
sjl
2024-12-18 15:49:29 +08:00
parent 53ead0e62f
commit 4cfca89895
9 changed files with 280 additions and 156 deletions

View File

@@ -78,7 +78,7 @@ const init = () => {
data: props.chartsData, data: props.chartsData,
formatter: function (name: any) { formatter: function (name: any) {
const item = props.chartsData.filter(item=>item.name==name) const item = props.chartsData.filter(item=>item.name==name)
console.log(item) //console.log(item)
if(item) if(item)
return item[0].value; return item[0].value;
}, },

View File

@@ -1,7 +1,6 @@
<template> <template>
<div> <el-dialog v-model='dialogVisible' title="系数校准" width="1200px" height="1000px">
<div class="test-dialog"> <div class="test-dialog" >
<div class="dialog-content"> <div class="dialog-content">
<div class="right-title"> <div class="right-title">
@@ -46,18 +45,24 @@
</div> </div>
</div> </div>
</div> <template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="handleSubmit">开始系数校准</el-button>
</div>
</template>
</el-dialog>
</template> </template>
<script lang="tsx" setup name="channelsTest"> <script lang="tsx" setup name="channelsTest">
import { SuccessFilled, Failed } from '@element-plus/icons-vue' import { SuccessFilled, Failed } from '@element-plus/icons-vue'
import { ref, toRef, watch } from 'vue'
const activeIndex = ref(0) const activeIndex = ref(0)
const activeTotalNum = ref(4) const activeTotalNum = ref(4)
const qualified = ref(0) const qualified = ref(0)
const outputDsc = ref('电压误差为±0.1Un% 电流误差为±0.5%') const outputDsc = ref('电压误差为±0.1Un% 电流误差为±0.5%')
const total = ref(0) const total = ref(0)
const dialogVisible = ref(false)
const activities = [ const activities = [
{ {
content: '开始检测', content: '开始检测',
@@ -305,41 +310,58 @@ const tableData4 = ref([
]) ])
const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish'); const currentStepStatus = ref<'error' | 'finish' | 'wait' | 'success' | 'process'>('finish');
const props = defineProps({
testStatus: {
type: String,
default: 'wait'
}
})
const testStatus = toRef(props, 'testStatus');
const ts = ref('');
//监听goods_sn的变化
watch(testStatus, function (newValue, oldValue) {
ts.value = props.testStatus;
if (ts.value === 'start') {
ts.value = 'process'
let timer = setInterval(() => { // 打开弹窗,可能是新增,也可能是编辑
if (activeIndex.value < activeTotalNum.value) { const open = () => {
activeIndex.value++ dialogVisible.value = true;
if(activeIndex.value > 1) activeIndex.value = 1
qualified.value = activeIndex.value -1;//演示效果,实际运行时使用后端传来的真实数据即可
else
qualified.value = activeIndex.value;
}
else if (activeIndex.value === activeTotalNum.value) {
clearInterval(timer)
ts.value = 'success'
}
else {
clearInterval(timer)
ts.value = 'success'
}
total.value = activeTotalNum.value
}, 1000);
} }
})
// const props = defineProps({
// testStatus: {
// type: String,
// default: 'wait'
// }
// })
// const testStatus = toRef(props, 'testStatus');
// const ts = ref('');
// //监听goods_sn的变化
// watch(testStatus, function (newValue, oldValue) {
// ts.value = props.testStatus;
// if (ts.value === 'start') {
// ts.value = 'process'
// let timer = setInterval(() => {
// if (activeIndex.value < activeTotalNum.value) {
// activeIndex.value++
// if(activeIndex.value > 1)
// qualified.value = activeIndex.value -1;//演示效果,实际运行时使用后端传来的真实数据即可
// else
// qualified.value = activeIndex.value;
// }
// else if (activeIndex.value === activeTotalNum.value) {
// clearInterval(timer)
// ts.value = 'success'
// }
// else {
// clearInterval(timer)
// ts.value = 'success'
// }
// total.value = activeTotalNum.value
// }, 1000);
// }
// })
// const emit = defineEmits(['update:testStatus']);
// //监听sn
// watch(ts, function (newValue, oldValue) {
// //修改父组件
// emit('update:testStatus', ts.value)
// })
watch(activeIndex, function (newValue, oldValue) { watch(activeIndex, function (newValue, oldValue) {
@@ -350,13 +372,32 @@ if(activeIndex.value === 1)
}) })
const emit = defineEmits(['update:testStatus']); const handleSubmit = () => {
//监听sn let timer = setInterval(() => {
watch(ts, function (newValue, oldValue) { if (activeIndex.value < activeTotalNum.value) {
//修改父组件 activeIndex.value++
emit('update:testStatus', ts.value) if(activeIndex.value > 1)
}) qualified.value = activeIndex.value -1;//演示效果,实际运行时使用后端传来的真实数据即可
else
qualified.value = activeIndex.value;
}
else if (activeIndex.value === activeTotalNum.value) {
clearInterval(timer)
}
else {
clearInterval(timer)
}
total.value = activeTotalNum.value
}, 1000);
};
// 对外映射
defineExpose({ open })
</script> </script>
<style scoped> <style scoped>
.right-title { .right-title {

View File

@@ -1,13 +1,34 @@
<template> <template>
<div class="table-container table-main"> <div class="table-container table-main">
<el-table :data="tableData" :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" style="width: 100%" > <el-table :data="tableData"
:header-cell-style="{ textAlign: 'center' } "
<el-table-column prop="id" label="序号" width="70" /> :cell-style="{ textAlign: 'center' }"
<el-table-column prop="updateTime" label="上送时刻" width="180"/> style="width: 100%"
max-height="400px">
<el-table-column type="expand">
<template #default="props">
<div style="display: flex">
<p >大电压A相57.74V,</p>
<p >大电压B相57.74V,</p>
<p >大电压C相57.74V,</p>
<p >大电流A相1A,</p>
<p >大电流B相1A,</p>
<p >大电流C相1A</p>
</div>
<div style="display: flex">
<p >小电压A相57.74V,</p>
<p >小电压B相57.74V,</p>
<p >小电压C相57.74V,</p>
<p >小电流A相1A,</p>
<p >小电流B相1A,</p>
<p >小电流C相1A</p>
</div>
</template>
</el-table-column>
<el-table-column prop="MonitorIdx" label="监测点序号"/>
<!-- <el-table-column prop="updateTime" label="上送时刻" width="180"/> -->
<!-- <el-table-column prop="deviceName" label="设备名称" /> --> <!-- <el-table-column prop="deviceName" label="设备名称" /> -->
<el-table-column prop="MonitorIdx" label="监测点序号" />
<el-table-column label="电压通道" > <el-table-column label="电压通道" >
<el-table-column prop="Ua" label="L1"> <el-table-column prop="Ua" label="L1">
@@ -39,9 +60,6 @@
</el-table> </el-table>
</div> </div>
</template> </template>
<script lang="ts" setup name="ErrorSystemDialog"> <script lang="ts" setup name="ErrorSystemDialog">

View File

@@ -101,6 +101,8 @@
<!-- <el-button type="primary" :icon="CirclePlus" @click="addDevice('设备新增')" v-if="form.activeTabs === 0" <!-- <el-button type="primary" :icon="CirclePlus" @click="addDevice('设备新增')" v-if="form.activeTabs === 0"
>设备新增</el-button> --> >设备新增</el-button> -->
<el-button type="primary" :icon="Odometer" @click="handleTest('系数校准')" v-if="form.activeTabs === 0"
>系数校准</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
@@ -120,7 +122,7 @@
link link
:icon="Download" :icon="Download"
@click="openDrawer('报告下载', scope.row)" @click="openDrawer('报告下载', scope.row)"
v-if="form.activeTabs === 3 && form.activeChildTabs === 0" v-if="form.activeTabs === 3 && form.activeChildTabs === 0 && scope.row.reportState === 1"
>报告下载</el-button >报告下载</el-button
> >
@@ -206,12 +208,13 @@
</ProTable> </ProTable>
<!-- 检测过程对话框 --> <!-- 检测过程对话框 -->
<testPopup <!-- <testPopup
:visible="dialogFormVisible" :visible="dialogFormVisible"
:formData="dialogForm" :formData="dialogForm"
:dialogTitle="dialogTitle" :dialogTitle="dialogTitle"
@update:visible="dialogFormVisible = $event" @update:visible="dialogFormVisible = $event"
/> /> -->
<TestPopup ref="testPopup"></TestPopup>
<reportPopup <reportPopup
:visible="reportDialogVisible" :visible="reportDialogVisible"
@@ -232,6 +235,9 @@
:visible="matchDialogVisible" :visible="matchDialogVisible"
@update:visible="matchDialogVisible = $event" @update:visible="matchDialogVisible = $event"
></matchPopup> ></matchPopup>
<!--系数校准-->>
<ChannelsTest ref="channelsTest"></ChannelsTest>
</div> </div>
</template> </template>
@@ -243,17 +249,19 @@ import { ElMessage, ElMessageBox, ElLoading, Action} from "element-plus";
import ProTable from "@/components/ProTable/index.vue"; import ProTable from "@/components/ProTable/index.vue";
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface' import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
import { import {
Search,View,Delete,Download,EditPen,Clock,ChatLineRound,ChatLineSquare,ChatDotSquare,Postcard,Notebook,Switch,PieChart,CirclePlus Search,View,Delete,Download,EditPen,Clock,ChatLineRound,ChatLineSquare,ChatDotSquare,Postcard,Notebook,Switch,PieChart,CirclePlus,Odometer
} from "@element-plus/icons-vue"; } from "@element-plus/icons-vue";
import { getPlanList } from "@/api/plan/planList"; import { getPlanList } from "@/api/plan/planList";
import deviceDataList from '@/api/device/device/deviceData' import deviceDataList from '@/api/device/device/deviceData'
import testPopup from "./testPopup.vue"; import TestPopup from "./testPopup.vue";
import reportPopup from "./reportPopup.vue"; import reportPopup from "./reportPopup.vue";
import dataCheckPopup from "./dataCheckPopup.vue"; import dataCheckPopup from "./dataCheckPopup.vue";
import dataCheckChangeErrSysPopup from "./dataCheckChangeErrSysPopup.vue"; import dataCheckChangeErrSysPopup from "./dataCheckChangeErrSysPopup.vue";
import { getBoundPqDevList } from '@/api/plan/plan.ts' import { getBoundPqDevList } from '@/api/plan/plan.ts'
import { onMounted, reactive, ref, watch } from "vue"; import { onMounted, reactive, ref, watch } from "vue";
import { useDictStore } from '@/stores/modules/dict' import { useDictStore } from '@/stores/modules/dict'
import ChannelsTest from './channelsTest.vue'
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
const dictStore = useDictStore() const dictStore = useDictStore()
let devNum = 0;//当前选取的被检设备数量 let devNum = 0;//当前选取的被检设备数量
@@ -264,7 +272,6 @@ const router = useRouter();
const value1 = ref(""); const value1 = ref("");
const value2 = ref(""); const value2 = ref("");
const tableHeight = ref(0); const tableHeight = ref(0);
const dialogFormVisible = ref(false)
const reportDialogVisible = ref(false) const reportDialogVisible = ref(false)
const dataCheckDialogVisible = ref(false) const dataCheckDialogVisible = ref(false)
const dataCheckChangeErrSysDialogVisible = ref(false) const dataCheckChangeErrSysDialogVisible = ref(false)
@@ -280,6 +287,7 @@ const dialogForm = ref<any>({
enable:1, enable:1,
state:1, state:1,
}); });
const modeStore = useModeStore();
const shouldShowOption = (item) => { const shouldShowOption = (item) => {
//return !item.disabled; //return !item.disabled;
return item; return item;
@@ -292,12 +300,18 @@ const documentStateShow = ref(false);
const checkStateShow = ref(true); const checkStateShow = ref(true);
const operationMinWidth = ref(200); const operationMinWidth = ref(200);
const selectionShow = ref(true); const selectionShow = ref(true);
const channelsTest = ref()
const testPopup = ref()
const props = defineProps({ const props = defineProps({
id: { id: {
type: String, type: String,
required: true, required: true,
}, },
isTimeCheck: {
type: Boolean,
required: true,
},
}) })
//下拉框数据 //下拉框数据
@@ -383,7 +397,6 @@ const proTable = ref<ProTableInstance>();
const boundPqDevList=ref<Device.ReqPqDevParams[]>([])//根据检测计划id查询出所有已绑定的设备 const boundPqDevList=ref<Device.ReqPqDevParams[]>([])//根据检测计划id查询出所有已绑定的设备
const getTableList = async (params: any) => { const getTableList = async (params: any) => {
console.log('activeTabs',form.activeTabs)
if(props.id){ if(props.id){
const checkStateList = ref<any>() const checkStateList = ref<any>()
if(form.value.checkStatus != null){ if(form.value.checkStatus != null){
@@ -508,6 +521,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
]) ])
// 跳转详情页 // 跳转详情页
const toDetail = () => { const toDetail = () => {
router.push( router.push(
@@ -536,8 +550,8 @@ const handleSelectionChange = (selection: any[]) => {
devChannelsNum += selection[i].dev_Chns; devChannelsNum += selection[i].dev_Chns;
} }
devTestedNum = selection.filter((item) => item.check_State === '检测完成').length; devTestedNum = selection.filter((item) => item.checkState === 2).length;
const result = selection.filter((item) => item.check_Result != "不符合") const result = selection.filter((item) => item.checkResult != 0)
if(result.length > 0) if(result.length > 0)
{ {
testType= "test"; testType= "test";
@@ -584,7 +598,6 @@ const changeActiveTabs = (val: number,val2: number,tabledata:any[]) => {
//根据当前功能,初始化表头下拉框中的默认值和禁用值 //根据当前功能,初始化表头下拉框中的默认值和禁用值
function tableHeaderInit(val: number) { function tableHeaderInit(val: number) {
console.log("tableHeader",val)
refreshStatusList() refreshStatusList()
switch (val) { switch (val) {
case 0://设备检测 case 0://设备检测
@@ -715,7 +728,7 @@ const addDevice = (val:string) => {
path: "/machine/device", path: "/machine/device",
}); });
}; };
const handleTest = (val:string) => { const handleTest = async (val:string) => {
if(devNum == 0) if(devNum == 0)
{ {
@@ -773,23 +786,29 @@ const handleTest = (val:string) => {
.then(() => { .then(() => {
ElMessage.success('不合格项复检'); ElMessage.success('不合格项复检');
dialogTitle.value = val; dialogTitle.value = val;
dialogFormVisible.value = true; // 打开对话框 testPopup.value?.open(dialogTitle.value,props.isTimeCheck)// 打开对话框
}) })
.catch((action: Action) => { .catch((action: Action) => {
ElMessage.success('全部复检'); ElMessage.success('全部复检');
dialogTitle.value = val; dialogTitle.value = val;
dialogFormVisible.value = true; // 打开对话框 testPopup.value?.open(dialogTitle.value,props.isTimeCheck) // 打开对话框
}) })
} }
else else
{ {
ElMessage.success(val); ElMessage.success(val);
dialogTitle.value = val; dialogTitle.value = val;
dialogFormVisible.value = true; // 打开对话框 testPopup.value?.open(dialogTitle.value,props.isTimeCheck)
} }
return return
} }
if(val==='系数校准')
{
channelsTest.value?.open()
return
}
if(devTestedNum == 0) if(devTestedNum == 0)
{ {
@@ -822,6 +841,9 @@ const handleTest = (val:string) => {
ElMessage.success("归档成功"); ElMessage.success("归档成功");
}, 2000) }, 2000)
} }
}; };
@@ -829,7 +851,6 @@ const handleTest = (val:string) => {
const openDrawer = (title: string, row: any) => { const openDrawer = (title: string, row: any) => {
if (title === '查看') if (title === '查看')
{ {
console.log(title);
const link = document.createElement('a'); const link = document.createElement('a');
const fileUrl = 'G:/南网数研院非结构化数据生成程序MMS_JSON修改记录.docx'; // 文件路径 const fileUrl = 'G:/南网数研院非结构化数据生成程序MMS_JSON修改记录.docx'; // 文件路径
link.href = fileUrl; link.href = fileUrl;

View File

@@ -1,5 +1,5 @@
<template> <template>
<el-dialog :title="dialogTitle" :model-value="visible" :before-close="beforeClose" @close="handleCancel" width="1200px" height="1000px" draggable> <el-dialog :title="dialogTitle" :model-value="dialogVisible" :before-close="beforeClose" @close="handleCancel" width="1200px" height="1000px" draggable>
<div class="steps-container"> <div class="steps-container">
<!-- simple --> <!-- simple -->
@@ -8,16 +8,16 @@
<!-- style="height:100px" --> <!-- style="height:100px" -->
<!-- <el-step title="预检测" :icon="getIcon(0)" /> --> <!-- <el-step title="预检测" :icon="getIcon(0)" /> -->
<el-step title="预检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :Edit" /> <el-step title="预检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :Edit" />
<el-step title="守时检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :UploadFilled"/> <el-step title="守时检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :UploadFilled" v-if="isTimeCheck"/>
<el-step title="系数校准" :icon="stepsActiveIndex > 2 ? SuccessFilled :Odometer" /> <!-- <el-step title="系数校准" :icon="stepsActiveIndex > 2 ? SuccessFilled :Odometer" /> -->
<el-step title="正式检测" :icon="stepsActiveIndex > 3 ? SuccessFilled :Coin" /> <el-step title="正式检测" :icon="stepsActiveIndex > 3 ? SuccessFilled :Coin" />
<el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key" /> <el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key" />
</el-steps> </el-steps>
</div> </div>
<preTest v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus"></preTest> <preTest v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus"></preTest>
<timeTest v-if="stepsActiveIndex === 1" v-model:testStatus="timeTestStatus"></timeTest> <timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest>
<channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> <!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
<test v-if="stepsActiveIndex >= 3" v-model:testStatus="TestStatus"></test> <test v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus"></test>
<template #footer> <template #footer>
<div> <div>
@@ -36,7 +36,7 @@
<script lang="tsx" setup name="testPopup"> <script lang="tsx" setup name="testPopup">
import { h } from 'vue'; import { h } from 'vue';
import{ElMessage, ElSelectV2, FormInstance,FormItemRule}from'element-plus' import{ElMessage, ElMessageBox, ElSelectV2, FormInstance,FormItemRule}from'element-plus'
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue'; import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
import { dialogBig,dialogMiddle} from '@/utils/elementBind' import { dialogBig,dialogMiddle} from '@/utils/elementBind'
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件 //import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
@@ -53,28 +53,29 @@
// <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"> // <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6">
// </svg> // </svg>
// `; // `;
const props = defineProps<{ // const props = defineProps<{
visible: boolean; // visible: boolean;
dialogTitle: string; // dialogTitle: string;
formData: { // formData: {
id: string;//误差体系表Id // id: string;//误差体系表Id
name: string;//误差体系名称 // name: string;//误差体系名称
standard_Name:string;//参照标准名称 // standard_Name:string;//参照标准名称
standard_Time:string;//标准推行时间 // standard_Time:string;//标准推行时间
dev_Level:string;//使用设备等级 // dev_Level:string;//使用设备等级
enable:number;//状态0-不启用 1-启用 // enable:number;//状态0-不启用 1-启用
state:number;//0-删除 1-正常 // state:number;//0-删除 1-正常
}; // };
}>(); // }>();
const emit = defineEmits<{ // const emit = defineEmits<{
(e: 'update:visible', value: boolean): void; // (e: 'update:visible', value: boolean): void;
(e: 'submit', data: any): void; // (e: 'submit', data: any): void;
}>(); // }>();
const skipDisabled = ref(false); const skipDisabled = ref(false);
const nextStepText = ref('下一步'); const nextStepText = ref('下一步');
const dialogVisible = ref(false)
//定义与预检测配置数组 //定义与预检测配置数组
const detectionOptions = ref([ const detectionOptions = ref([
{ {
@@ -117,13 +118,22 @@ const detectionOptions = ref([
// }, // },
]); ]);
const stepsTotalNum = ref(5);//步骤总数 const stepsTotalNum = ref(4);//步骤总数
const stepsActiveIndex = ref(0); //当前正在执行的步骤索引 const stepsActiveIndex = ref(0); //当前正在执行的步骤索引
const ActiveStatue = ref('waiting');//当前步骤状态 const ActiveStatue = ref('waiting');//当前步骤状态
const preTestStatus = ref('waiting');//预检测执行状态 const preTestStatus = ref('waiting');//预检测执行状态
const timeTestStatus = ref('waiting');//守时校验执行状态 const timeTestStatus = ref('waiting');//守时校验执行状态
const channelsTestStatus = ref('waiting');//通道系数校准执行状态 const channelsTestStatus = ref('waiting');//通道系数校准执行状态
const TestStatus = ref('waiting');//正式检测执行状态 const TestStatus = ref('waiting');//正式检测执行状态
const dialogTitle = ref('');
const isTimeCheck = ref(false)
// 打开弹窗,可能是新增,也可能是编辑
const open = (title: string,time:boolean) => {
dialogTitle.value = title;
dialogVisible.value = true;
isTimeCheck.value = time
}
watch(preTestStatus,function(newValue,oldValue){ watch(preTestStatus,function(newValue,oldValue){
console.log(newValue,oldValue); console.log(newValue,oldValue);
@@ -148,9 +158,10 @@ const detectionOptions = ref([
watch(ActiveStatue,function(newValue,oldValue){ watch(ActiveStatue,function(newValue,oldValue){
if(newValue === 'success' || newValue === 'error') if(newValue === 'success' || newValue === 'error'){
skipDisabled.value = false skipDisabled.value = false
}
if(newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 2) if(newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 2)
{ {
stepsActiveIndex.value++; stepsActiveIndex.value++;
@@ -175,13 +186,17 @@ const getIcon = (index: number) => {
if(stepsActiveIndex.value < stepsTotalNum.value ) if(stepsActiveIndex.value < stepsTotalNum.value )
{ {
stepsActiveIndex.value++ stepsActiveIndex.value++
if(!isTimeCheck.value){//不具备守时检测,预检测后直接跳正式检测
stepsActiveIndex.value++
}
ActiveStatue.value = 'waiting' ActiveStatue.value = 'waiting'
} }
else if(stepsActiveIndex.value === stepsTotalNum.value) else if(stepsActiveIndex.value === stepsTotalNum.value)
{ {
emit('update:visible', false); // 关闭对话框 //emit('update:visible', false); // 关闭对话框
clearData() clearData()
dialogVisible.value = false;
} }
}; };
@@ -208,14 +223,15 @@ const getIcon = (index: number) => {
) )
.then(() => { .then(() => {
clearData() clearData()
emit('update:visible', false); // 关闭对话框 //emit('update:visible', false); // 关闭对话框
dialogVisible.value = false;
}) })
} }
else else
{ {
clearData() clearData()
emit('update:visible', false); // 关闭对话框 //emit('update:visible', false); // 关闭对话框
dialogVisible.value = false;
} }
// ElMessageBox.confirm('Are you sure to close this dialog?') // ElMessageBox.confirm('Are you sure to close this dialog?')
// .then(() => { // .then(() => {
@@ -228,6 +244,7 @@ const getIcon = (index: number) => {
const handleCancel = () => { const handleCancel = () => {
// clearData() // clearData()
// emit('update:visible', false); // 关闭对话框 // emit('update:visible', false); // 关闭对话框
}; };
const handleSubmit = () => { const handleSubmit = () => {
@@ -239,10 +256,10 @@ const getIcon = (index: number) => {
case 1: case 1:
timeTestStatus.value = 'start' timeTestStatus.value = 'start'
break; break;
// case 2:
// channelsTestStatus.value = 'start'
// break;
case 2: case 2:
channelsTestStatus.value = 'start'
break;
case 3:
TestStatus.value = 'start' TestStatus.value = 'start'
break; break;
default: default:
@@ -252,38 +269,16 @@ const getIcon = (index: number) => {
}; };
// 当 props.visible 改变时,更新 formData // // 当 props.visible 改变时,更新 formData
watch(() => props.visible, (newVal) => { // watch(() => props.visible, (newVal) => {
if (!newVal) { // if (!newVal) {
// 这里可以重置表单数据,如果需要的话 // // 这里可以重置表单数据,如果需要的话
} // }
}); // });
//选中
// 处理选择变化
const handleSelectionChange = (selection: any[]) => {
multipleSelection.value = selection.map(row => row.id); // 更新选中的行
};
const openAddDialog = () => {
tableData.value.push({
id: tableData.value.length + 1,
type: '',
startSelect: '',
startRange: '',
endSelect: '',
endRange: '',
unit:'',
maxErrorValue:'',
errorType:''
});
};
// 对外映射
defineExpose({ open })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -1,5 +1,26 @@
<template> <template>
<div> <div>
<el-tabs type="border-card">
<el-tab-pane label="守时误差">
<div class="right-title" >
<span v-if="activeIndex <= 1"> </span>
<span v-if="activeIndex > 1" style=" font-size: 18px;font-weight: 600;">
标准时间: <span style="color: #003078">{{ gpsTime }}</span>
</span>
<div class="error-dsc">
<div class="green-div"></div>
<span style=" color: #606266; font-size: 16px;font-weight: 600;">
守时误差1000ms
</span>
<div class="red-div"></div>
<span style=" color: #F56C6c; font-size: 16px;font-weight: 600;">
守时误差>1000ms
</span>
</div>
</div>
</el-tab-pane>
</el-tabs>
<div class="test-dialog"> <div class="test-dialog">
<div class="dialog-left"> <div class="dialog-left">
<el-steps direction="vertical" :active="stepsIndex" :process-status="currentStepStatus" <el-steps direction="vertical" :active="stepsIndex" :process-status="currentStepStatus"
@@ -29,7 +50,7 @@
<div class="right-title"> <div class="right-title">
<!-- <div>设备上送时刻表</div> --> <!-- <div>设备上送时刻表</div> -->
<span v-if="activeIndex <= 1"> </span> <!-- <span v-if="activeIndex <= 1"> </span>
<span v-if="activeIndex > 1" style=" font-size: 18px;font-weight: 600;"> <span v-if="activeIndex > 1" style=" font-size: 18px;font-weight: 600;">
标准时间: <span style="color: #003078">{{ gpsTime }}</span> 标准时间: <span style="color: #003078">{{ gpsTime }}</span>
</span> </span>
@@ -43,7 +64,7 @@
<span style=" color: #F56C6c; font-size: 16px;font-weight: 600;"> <span style=" color: #F56C6c; font-size: 16px;font-weight: 600;">
守时误差>1000ms 守时误差>1000ms
</span> </span>
</div> </div> -->
<!-- <span style=" font-size: 18px;font-weight: 600;"> <!-- <span style=" font-size: 18px;font-weight: 600;">
设备已合格 <span style="color: #67C23A">{{ qualified }}</span> / <span style="color: green">4</span> 设备已合格 <span style="color: #67C23A">{{ qualified }}</span> / <span style="color: green">4</span>
</span> --> </span> -->
@@ -57,7 +78,7 @@
:cell-style="{ textAlign: 'center' }" style="width: 100%; height:435px" border> :cell-style="{ textAlign: 'center' }" style="width: 100%; height:435px" border>
</ProTable> --> </ProTable> -->
<el-table v-if="activeIndex > 0" :data="deviceOperatorData" stripe :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" style="width: 100%" border> <el-table v-if="activeIndex > 0" :data="deviceOperatorData" stripe :header-cell-style="{ textAlign: 'center' } " :cell-style="{ textAlign: 'center' }" style="margin-top: -30px;width: 100%" border>
<el-table-column prop="deviceName" label="设备名称" /> <el-table-column prop="deviceName" label="设备名称" />
<el-table-column prop="updataTime" label="上送时刻" /> <el-table-column prop="updataTime" label="上送时刻" />
<el-table-column prop="ErrorValue" label="守时误差(ms)"> <el-table-column prop="ErrorValue" label="守时误差(ms)">
@@ -311,14 +332,15 @@ watch(ts, function (newValue, oldValue) {
</script> </script>
<style scoped> <style scoped>
.test-dialog { .test-dialog {
height: 350px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
/* 横向排列 */ /* 横向排列 */
/* margin-top: 20px; */ margin-top: 20px;
/* min-height: 300px; */
height: 472px;
/* .dialog-left{ /* .dialog-left{
margin-right: 20px; margin-right: 20px;
} */ } */

View File

@@ -92,7 +92,7 @@
<el-tab-pane :label="tabLabel1" :style="{ height: tabPaneHeight }"> <el-tab-pane :label="tabLabel1" :style="{ height: tabPaneHeight }">
<!-- 列表数据 --> <!-- 列表数据 -->
<div class="container_table" :style="{ height: tableHeight }"> <div class="container_table" :style="{ height: tableHeight }">
<Table ref="tableRef1" :id='currentId'></Table> <Table ref="tableRef1" :id='currentId' :isTimeCheck = 'isTimeCheck'></Table>
</div> </div>
</el-tab-pane> </el-tab-pane>
@@ -123,6 +123,7 @@ import type { CollapseModelValue } from "element-plus/es/components/collapse/src
import { type Device } from "@/api/device/interface/device"; import { type Device } from "@/api/device/interface/device";
import { getBoundPqDevList } from '@/api/plan/plan.ts' import { getBoundPqDevList } from '@/api/plan/plan.ts'
import { CENTERED_ALIGNMENT } from "element-plus/es/components/virtual-list/src/defaults"; import { CENTERED_ALIGNMENT } from "element-plus/es/components/virtual-list/src/defaults";
import { ResultData } from "@/api/interface";
const dictStore = useDictStore() const dictStore = useDictStore()
const modeStore = useModeStore(); const modeStore = useModeStore();
@@ -151,9 +152,9 @@ const tabsHeight = ref('calc(100vh - 538px)'); // 初始高度
const tabPaneHeight = ref('calc(100% - 5px)'); // 初始高度 const tabPaneHeight = ref('calc(100% - 5px)'); // 初始高度
const tableHeight = ref('calc(100% - 5px)'); // 初始高度 const tableHeight = ref('calc(100% - 5px)'); // 初始高度
const handleChange = (val: string[]) => { const handleChange = (val: string[]) => {
} }
const isTimeCheck = ref<boolean>(false);
const planList = ref<ResultData<Plan.ReqPlan[]>>();
const handleCollapseChange = (val: CollapseModelValue) => { const handleCollapseChange = (val: CollapseModelValue) => {
// 计算新的高度 // 计算新的高度
@@ -264,6 +265,23 @@ const pieRef1 = ref(),
const chartsData1: any = ref([]), const chartsData1: any = ref([]),
chartsData2: any = ref([]), chartsData2: any = ref([]),
chartsData3: any = ref([]); chartsData3: any = ref([]);
const findPlanById = (plans: Plan.ReqPlan[], id: string): Plan.ReqPlan | undefined => {
for (const plan of plans) {
if (plan.id === id) {
return plan;
}
console.log('plan.children', plan.children);
if (plan.children) {
const foundPlan = findPlanById(plan.children, id);
if (foundPlan) {
return foundPlan;
}
}
}
return undefined;
};
const getPieData = async (id: string) => { const getPieData = async (id: string) => {
currentId.value = id; // 设置当前ID currentId.value = id; // 设置当前ID
//handleCheckFunction(0)//切换左侧树默认css功能是设备检测 //handleCheckFunction(0)//切换左侧树默认css功能是设备检测
@@ -274,6 +292,13 @@ const getPieData = async (id: string) => {
const reportStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 }; const reportStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 };
if (id) { if (id) {
const boundPqDevList = ref<Device.ResPqDev[]>([])//根据检测计划id查询出所有已绑定的设备 const boundPqDevList = ref<Device.ResPqDev[]>([])//根据检测计划id查询出所有已绑定的设备
const plan = findPlanById(planList.value?.data || [], id);
if (plan) {
isTimeCheck.value = plan.timeCheck ===1; // 将 1 转换为 true0 转换为 false
} else {
// 处理未找到计划的情况
isTimeCheck.value = false; // 或者其他默认值
}
const pqDevList_Result2 = await getBoundPqDevList({'planId': id, 'checkStateList': [0, 1, 2, 3]}); const pqDevList_Result2 = await getBoundPqDevList({'planId': id, 'checkStateList': [0, 1, 2, 3]});
boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[]; boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[];
// 遍历 boundPqDevList 并更新计数对象 // 遍历 boundPqDevList 并更新计数对象
@@ -411,14 +436,17 @@ onBeforeMount(async () => {
code: 0, code: 0,
state: 0 state: 0
}; };
const planList = await getPlanListByPattern(reqPlan); planList.value = (await getPlanListByPattern(reqPlan)) as ResultData<Plan.ReqPlan[]>;
if (planList.data[0].children[0]) {
currentId.value = planList.data[0].children[0].id; console.log('qqq',planList.value)
if (planList.value.data[0].children[0]) {
currentId.value = planList.value.data[0].children[0].id;
} }
if (chartsInfoRef.value) { if (chartsInfoRef.value) {
resizeObserver.observe(chartsInfoRef.value); resizeObserver.observe(chartsInfoRef.value);
} }
getTree(planList.data); getTree(planList.value.data);
getPieData(currentId.value); getPieData(currentId.value);
}); });

View File

@@ -38,7 +38,7 @@ const handleSourceClick = (index: number) => {
if (props.sourceIds && props.sourceIds[index]) { if (props.sourceIds && props.sourceIds[index]) {
emit('source-clicked', props.sourceIds[index]); emit('source-clicked', props.sourceIds[index]);
} else { } else {
console.log('sourceIds is undefined or the index is out of bounds'); //console.log('sourceIds is undefined or the index is out of bounds');
} }
}; };

View File

@@ -240,7 +240,7 @@ const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
// pattern: device.pattern, // pattern: device.pattern,
// })); // }));
console.log('保持',formContent.devIds)
if (formContent.id) { if (formContent.id) {
if( mode.value === '比对式'){ if( mode.value === '比对式'){
await updatePlan(formContent) await updatePlan(formContent)
@@ -248,9 +248,7 @@ const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
await updatePlan({...formContent,'sourceIds':[formContent.sourceIds],'datasourceIds':[formContent.datasourceIds]}); await updatePlan({...formContent,'sourceIds':[formContent.sourceIds],'datasourceIds':[formContent.datasourceIds]});
} }
ElMessage.success({ message: `${dialogTitle.value}成功!` }) ElMessage.success({ message: `${dialogTitle.value}成功!` })
console.log('保存完成后还有绑定',boundPqDevList)
console.log('保存完成后还有表单',formContent.devIds)
console.log('保存完成后还有未绑定',unboundPqDevList)
} else { } else {
// 新增需要把设备模式转成字典ID // 新增需要把设备模式转成字典ID
const patternItem = dictStore.getDictData('Pattern').find(item => item.name === formContent.pattern); const patternItem = dictStore.getDictData('Pattern').find(item => item.name === formContent.pattern);
@@ -317,7 +315,7 @@ const open = async (sign: string,
getPqScriptList(data), getPqScriptList(data),
getPqErrSysList(), getPqErrSysList(),
getBoundPqDevList({ 'planId': data.id }), getBoundPqDevList({ 'planId': data.id }),
getUnboundPqDevList(data,) getUnboundPqDevList(data)
]); ]);
pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[]; pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[];
@@ -325,6 +323,7 @@ const open = async (sign: string,
pqErrSysList.value = PqErrSys_Result.data as unknown as ErrorSystem.ErrorSystemList[]; pqErrSysList.value = PqErrSys_Result.data as unknown as ErrorSystem.ErrorSystemList[];
const boundData = Array.isArray(boundPqDevList_Result.data) ? boundPqDevList_Result.data : []; const boundData = Array.isArray(boundPqDevList_Result.data) ? boundPqDevList_Result.data : [];
const unboundData = Array.isArray(unboundPqDevList_Result.data) ? unboundPqDevList_Result.data : []; const unboundData = Array.isArray(unboundPqDevList_Result.data) ? unboundPqDevList_Result.data : [];
pqDevList.value = [...boundData,...unboundData] as Device.ResPqDev[]; pqDevList.value = [...boundData,...unboundData] as Device.ResPqDev[];
formContent.devIds = boundData.map(i => i.id );// 已绑定设备id集合 formContent.devIds = boundData.map(i => i.id );// 已绑定设备id集合