样式调整

This commit is contained in:
GYYM
2024-12-04 21:36:12 +08:00
parent aa86c5e662
commit a415ffa12a
9 changed files with 239 additions and 142 deletions

View File

@@ -8,7 +8,7 @@
:init-param="initParam"
:data-callback="dataCallback"
@drag-sort="sortTable"
:default-sort="{ prop: 'check_State', order: 'ascending' }"
:stripe="true"
:pagination = "false"
:key="tableKey"
@@ -18,17 +18,18 @@
<!-- 表格 header 按钮 -->
<template #tableHeader="scope">
<el-form :model="form" :inline="true">
<el-form-item label="关键字搜索">
<el-input v-model="form.search" placeholder="输入设备名称类型搜索"></el-input>
<el-form-item label="关键字">
<el-input v-model="form.search" placeholder="输入设备名称类型"></el-input>
</el-form-item>
<el-form-item label="检测状态" v-if="form.activeTabs != 3 && form.activeTabs != 5">
<el-select v-model="form.checkStatus" clearable>
<el-option
v-for="(item, index) in checkStatusList"
v-for="(item, index) in checkResultList"
:label="item.label"
:value="item.value"
:disabled="item.disabled"
:key="index"
v-show="shouldShowOption(item)"
></el-option>
</el-select>
</el-form-item>
@@ -40,6 +41,7 @@
:value="item.value"
:disabled="item.disabled"
:key="index"
v-show="shouldShowOption(item)"
></el-option>
</el-select>
</el-form-item>
@@ -51,6 +53,7 @@
:value="item.value"
:disabled="item.disabled"
:key="index"
v-show="shouldShowOption(item)"
></el-option>
</el-select>
</el-form-item>
@@ -72,20 +75,22 @@
<el-button :icon="Delete" @click="handleRefresh"
>重置</el-button
>
<!-- :disabled='!scope.isSelected' -->
<el-button
type="primary"
:icon="Clock"
@click="handleTest('手动检测')"
v-if="form.activeTabs === 0"
:disabled='!scope.isSelected'
>手动检测</el-button
>
<!-- :disabled='!scope.isSelected' -->
<el-button
type="primary"
:icon="ChatLineRound"
@click="handleTest('自动检测')"
v-if="form.activeTabs === 0"
:disabled='!scope.isSelected'
>自动检测</el-button
>
<el-button type="primary" :icon="ChatLineSquare" @click="handleTest('不合格项复检')" v-if="form.activeTabs === 2"
@@ -95,15 +100,18 @@
>全部复检</el-button
>
<!-- :disabled='!scope.isSelected' -->
<el-button type="primary" :icon="Download" @click="handleTest('批量下载')" v-if="form.activeTabs === 3"
>报告下载</el-button
>
<!-- :disabled='!scope.isSelected' -->
<el-button type="primary" :icon="Postcard" @click="handleTest('批量生成')" v-if="form.activeTabs === 3"
>报告生成</el-button
>
<el-button type="primary" :icon="Download" :disabled='!scope.isSelected' @click="handleTest('批量下载')" v-if="form.activeTabs === 3"
>批量下载</el-button
>
<el-button type="primary" :icon="Postcard" :disabled='!scope.isSelected' @click="handleTest('批量生成')" v-if="form.activeTabs === 3"
>批量生成</el-button
>
<el-button type="primary" :icon="Notebook" :disabled="!scope.isSelected || scope.selectedList.filter((item) => item.check_State === '检测完成').length === 0" @click="handleTest('批量归档')" v-if="form.activeTabs === 0"
>批量归档</el-button
<!-- :disabled="!scope.isSelected || scope.selectedList.filter((item) => item.check_State === '检测完成').length === 0" -->
<el-button type="primary" :icon="Notebook" @click="handleTest('批量归档')" v-if="form.activeTabs === 0"
>归档</el-button
>
<el-button type="primary" :icon="CirclePlus" @click="addDevice('设备新增')" v-if="form.activeTabs === 0"
>设备新增</el-button
@@ -154,7 +162,7 @@
>数据查看</el-button
> -->
<el-button
type="primary"
:type="scope.row.check_State === '检测完成' ? 'primary' : 'info'"
link
:icon="Notebook"
@click="openDrawer('归档', scope.row)"
@@ -237,6 +245,9 @@ import dataCheckChangeErrSysPopup from "./dataCheckChangeErrSysPopup.vue";
import { reactive, ref } from "vue";
let devNum = 0;//当前选取的被检设备数量
let devChannelsNum = 0;//当前选择的被检设备通道总数
let devTestedNum = 0;//当前选择的已完成检测的被检设备数量
const tableKey = ref(0);
const router = useRouter();
const value1 = ref("");
@@ -257,13 +268,20 @@ const dialogForm = ref<any>({
enable:1,
state:1,
});
const shouldShowOption = (item) => {
console.log(item,12345)
return !item.disabled;
};
//console.log(window.innerHeight, "+++++++++");
tableHeight.value = window.innerHeight - 600;
//const deviceData = deviceDataList.plan_devicedata
const deviceData = ref([]);
deviceData.value = deviceDataList.plan_devicedata.filter((item) => item.document_State === "未归档")
const operationShow = ref(false);
const documentStateShow = ref(false);
const checkStateShow = ref(true);
const operationMinWidth = ref(200);
const selectionShow = ref(true);
//下拉框数据
//检测状态数据
@@ -315,71 +333,17 @@ let checkResultList = reactive([
disabled: false,
},
{
label: "不合格",
label: "不合格",
value: 1,
disabled: false,
},
{
label: "全部合格",
label: "合格",
value: 2,
disabled: false,
},
]);
//绑定状态数组
// const deviceBindStatusList = [
// {
// label: "未绑定",
// value: 0,
// disabled: true,
// },
// {
// label: "已绑定",
// value: 1,
// disabled: true,
// },
// ];
// //设备类型数组
// const deviceTypeList = [
// {
// label: "PQS882A",
// value: 0,
// },
// {
// label: "PQS882B4",
// value: 1,
// },
// {
// label: "PQS882B5",
// value: 2,
// },
// {
// label: "PQS882B6",
// value: 3,
// },
// {
// label: "PQS882B7",
// value: 4,
// },
// {
// label: "PQS882B8",
// value: 5,
// },
// ];
// //制造厂商数组
// const manufacturerList = [
// {
// label: "南京灿能电力",
// value: 0,
// },
// {
// label: "南瑞继保",
// value: 1,
// },
// {
// label: "中电",
// value: 2,
// },
// ];
//查询条件
const form: any = ref({
activeTabs: 0, //功能选择
@@ -427,13 +391,13 @@ const getTableList = (params: any) => {
};
// 表格配置项
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
{ type: 'selection', fixed: 'left', width: 70 },
const columns = reactive([
{ type: 'selection', fixed: 'left', width: 70, isShow:selectionShow },
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
{
prop: 'name',
label: '设备名称',
minWidth: 120,
minWidth: 220,
},
{
prop: 'dev_Type',
@@ -448,21 +412,42 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
},
{
prop: 'reCheck_Num',
label: '检次数',
label: '检次数',
minWidth: 100,
sortable:true,
// <template #header>
// <span>检测次数</span>
// <el-tooltip content = "最大检测次数为3次超过会强制归档" placement="top" style="align-items: bottom;">
// <el-icon><InfoFilled /></el-icon>
// </el-tooltip>
// </template>
},
{
prop: 'check_State',
label: '检测状态',
minWidth: 100,
sortable:true,
isShow:checkStateShow,
},
{
prop: 'check_Result',
label: '检测结果',
minWidth: 100,
sortable:true,
render: (scope) => {
if(scope.row.check_Result === '不合格')
{
return (
<el-tag type='danger'>{ scope.row.check_Result }</el-tag>
)
}
else
{
return (
<span>{ scope.row.check_Result }</span>
)
}
},
},
{
prop: 'report_State',
@@ -475,6 +460,7 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
label: '归档状态',
minWidth: 100,
sortable:true,
isShow: documentStateShow,
},
{ prop: 'operation', label: '操作', fixed: 'right', minWidth: 200 ,isShow: operationShow},
])
@@ -641,9 +627,16 @@ const resetSearchForm = () => {
};
};
let testType = "test";//检测还是复检
const handleSelectionChange = (selection: any[]) => {
const result = selection.filter((item) => item.check_Result != "有不合格项")
devNum = selection.length;
for (let i = 0; i < selection.length; i++) {
devChannelsNum += selection[i].dev_Chns;
}
devTestedNum = selection.filter((item) => item.check_State === '检测完成').length;
const result = selection.filter((item) => item.check_Result != "不合格")
if(result.length > 0)
{
testType= "test";
@@ -652,7 +645,6 @@ const handleSelectionChange = (selection: any[]) => {
{
testType= "reTest";
}
console.log(selection);
}
//查询
@@ -757,6 +749,9 @@ function tableHeaderInit(val: number) {
columns[columns.length - 1].minWidth = 100;
tableKey.value ++;
operationShow.value = true;
documentStateShow.value = false;
checkStateShow.value = true;
selectionShow.value = true;
break;
case 2://设备复检
// form.value.checkStatus = 2;//检测状态默认为检测完成
@@ -780,6 +775,9 @@ function tableHeaderInit(val: number) {
columns[columns.length - 1].minWidth = 180;
tableKey.value += 1;
operationShow.value = true;
documentStateShow.value = true;
checkStateShow.value = false;
selectionShow.value = true;
break;
case 4://设备归档
// form.value.checkStatus = 2;//检测状态默认为检测完成
@@ -793,13 +791,20 @@ function tableHeaderInit(val: number) {
columns[columns.length - 1].minWidth = 100;
tableKey.value ++;
operationShow.value = true;
documentStateShow.value = true;
checkStateShow.value = false;
selectionShow.value = true;
break;
case 5://数据查询
disablecheckResultList("未检测")
disableCheckReportStatus("未检测")
columns[columns.length - 1].minWidth = 250;
tableKey.value += 1;
operationShow.value = true;
documentStateShow.value = true;
checkStateShow.value = false;
selectionShow.value = false;
columns[0].isShow = false;
tableKey.value += 1;
break;
}
console.log("test",columns);
@@ -808,6 +813,12 @@ console.log("test",columns);
tableHeaderInit(0)
function refreshStatusList(){
// devNum = 0;
// devChannelsNum = 0;
// devTestedNum = 0;
devNum = 0;
devChannelsNum = 0;
devTestedNum = 0;
checkStatusList.map((item: any, index: any) => {
if (item.disabled) {
item.disabled = false;
@@ -856,12 +867,49 @@ const addDevice = (val:string) => {
path: "/machine/device",
});
};
const handleTest = (val:string) => {
if(devNum == 0)
{
ElMessageBox.confirm(
'请先选择被检设备',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
return
}
if(val==='手动检测'||val==='自动检测'||val==='不合格项复检'||val==='全部复检' )
{
if(devNum > 6)
{
ElMessageBox.confirm(
'每次检测最多只能选择6台设备请重新选择',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
return
}
if(devChannelsNum > 20)
{
ElMessageBox.confirm(
'每次检测最多只能检测20个设备通道请重新选择',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
return
}
if(testType === "reTest")
{
ElMessageBox.confirm(
@@ -895,16 +943,30 @@ const handleTest = (val:string) => {
dialogTitle.value = val;
dialogFormVisible.value = true; // 打开对话框
}
return
}
if(devTestedNum == 0)
{
ElMessageBox.confirm(
'请先选择检测完成状态的被检设备',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
return
}
if(val==='批量生成')
{
reportDialogVisible.value = true;
reportDialogVisible.value = true;
return
}
if(val==='批量归档')
if(val==='归档')
{
const loading = ElLoading.service({
lock: true,