This commit is contained in:
sjl
2025-01-09 13:56:56 +08:00
parent 80d1912fd5
commit 5be1d22115
7 changed files with 120 additions and 45 deletions

View File

@@ -101,7 +101,7 @@
<!-- <el-button type="primary" :icon="CirclePlus" @click="addDevice('设备新增')" v-if="form.activeTabs === 0"
>设备新增</el-button> -->
<el-button type="primary" :icon="Odometer" @click="handleTest('系数校准')" v-if="form.activeTabs === 0"
<el-button type="primary" v-auth.role="'channelsTest'" :icon="Odometer" @click="handleTest('系数校准')" v-if="form.activeTabs === 0"
>系数校准</el-button>
</el-form-item>
</el-form>
@@ -258,6 +258,8 @@ import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
import {useCheckStore} from '@/stores/modules/check'
import {CheckData} from '@/api/check/interface'
import socketClient from '@/utils/webSocketClient';
import auth from "@/directives/modules/auth";
import { useAuthStore } from "@/stores/modules/auth";
const dictStore = useDictStore()
const checkStore = useCheckStore()
@@ -304,6 +306,7 @@ const deviceData = ref<Device.ResPqDev[]>([]);
const operationShow = ref(false);
const documentStateShow = ref(false);
const checkStateShow = ref(true);
const factorCheckShow = ref(true);
const operationMinWidth = ref(200);
const selectionShow = ref(true);
const channelsTest = ref()
@@ -405,6 +408,14 @@ const searchForm = ref({
const proTable = ref<ProTableInstance>();
const getTableList = async (params: any) => {
//权限不包含通道系数,表格不展示列
const authStore = useAuthStore()
const currentPageRoles = authStore.authButtonListGet[authStore.routeName] ?? []
if (!currentPageRoles.includes('channelsTest')) {
factorCheckShow.value = false;
}
// 调用 ProTable 的 clearSelection 方法清空选择
if (proTable.value) {
proTable.value.clearSelection();
@@ -515,6 +526,28 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
return '';
}
},
{
prop: 'factorCheckResult',
label: '系数校准结果',
minWidth: 100,
sortable:true,
isShow:factorCheckShow,
render: scope => {
if (scope.row.factorCheckResult === 0)
{
return '不合格';
}
else if (scope.row.factorCheckResult === 1)
{
return '合格';
}
else if (scope.row.factorCheckResult === 2)
{
return '/';
}
return '';
}
},
{ prop: 'operation', label: '操作', fixed: 'right', minWidth: 200 ,isShow: operationShow},
])
@@ -627,6 +660,7 @@ function tableHeaderInit(val: number) {
documentStateShow.value = false;
checkStateShow.value = true;
selectionShow.value = true;
factorCheckShow.value = true;
break;
case 2://设备复检
// form.value.checkStatus = 2;//检测状态默认为检测完成
@@ -653,6 +687,7 @@ function tableHeaderInit(val: number) {
operationShow.value = true;
documentStateShow.value = true;
checkStateShow.value = false;
factorCheckShow.value = false;
selectionShow.value = true;
break;
case 4://设备归档
@@ -670,6 +705,7 @@ function tableHeaderInit(val: number) {
operationShow.value = true;
documentStateShow.value = false;
checkStateShow.value = false;
factorCheckShow.value = false;
selectionShow.value = true;
break;
case 5://数据查询
@@ -680,6 +716,7 @@ function tableHeaderInit(val: number) {
operationShow.value = true;
documentStateShow.value = true;
checkStateShow.value = false;
factorCheckShow.value = false;
selectionShow.value = false;
columns[0].isShow = false;
tableKey.value += 1;
@@ -851,6 +888,45 @@ const handleTest = async (val:string) => {
}
if(val === '系数校准') {
const checkStates = channelsSelection.value.map(item => item.checkState);
const allCheckStatesEqual = new Set(checkStates).size <= 1;
if (!allCheckStatesEqual) {
ElMessageBox.confirm(
'所勾选设备检测状态不一致,请重新选择',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
return
}
const factorFlagArray = ref<string[]>([]); // 初始化为空数组
for (let i = 0; i < channelsSelection.value.length; i++) {
const factorFlag = channelsSelection.value[i].factorFlag;
if (factorFlag !== undefined && factorFlag !== null && factorFlag === 0) {
factorFlagArray.value.push(channelsSelection.value[i].name.toString());
}
}
if(factorFlagArray.value.length > 0){
const factorFlags = factorFlagArray.value.join(', ');
ElMessageBox.confirm(
factorFlags + '设备不支持系数校准,请重新选择',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
return
}
//开始创建webSocket客户端
const data = reactive({
socketServe: socketClient.Instance,