This commit is contained in:
sjl
2025-10-09 15:51:45 +08:00
parent 92b3e25989
commit b0d92de738
8 changed files with 195 additions and 207 deletions

View File

@@ -34,6 +34,7 @@ export namespace StandardDevice {
createTime?: string | null; //创建时间
updateBy?: string | null; //更新用户
updateTime?: string | null; //更新时间
disabled?: boolean;
}

View File

@@ -115,8 +115,8 @@ const handleImportResponse = (res: any) => {
if (!parameter.value.progressBar) {
if (res.code === 'A0000') {
ElMessage.success('导入成功')
emit('result', true)
dialogVisible.value = false
emit('result', res.data)
} else {
ElMessage.error(res.message)
fileDisabled.value = false
@@ -195,8 +195,8 @@ const initSSE = () => {
progressData.value.status = 'success'
eventSource.value!.close()
ElMessage.success('导入成功')
dialogVisible.value = false
emit('result', true)
dialogVisible.value = false
}
}

View File

@@ -226,21 +226,20 @@ watch(webMsgSend, function (newValue, oldValue) {
}
switch (newValue.requestId) {
case 'yjc_sbtxjy':
switch (newValue.operateCode) {
case 'INIT_GATHER$02':
if (newValue.code == 10200) {
step1InitLog.value.push({
type: 'info',
log: newValue.data,
})
} else if (newValue.code == 10201) {
}
if (newValue.code == 10201) {
step1.value = 'process'
step1InitLog.value = [{
type: 'wait',
log: '正在进行设备通讯校验.....',
}];
} else if (newValue.code == 10551) {
}
if (newValue.code == 10551) {
step1InitLog.value.push({
type: 'error',
log: newValue.data + '设备触发报告异常!',
@@ -248,7 +247,8 @@ watch(webMsgSend, function (newValue, oldValue) {
step1.value = 'error'
ts.value = 'error'
step5.value = 'error'
} else if (newValue.code == 10552) {
}
if (newValue.code == 10552) {
step1InitLog.value = [{
type: 'error',
log: '存在已经初始化步骤,执行自动关闭,请重新发起检测!',
@@ -256,40 +256,18 @@ watch(webMsgSend, function (newValue, oldValue) {
step1.value = 'error'
ts.value = 'error'
step5.value = 'error'
} else if (newValue.code == 25001) {
activeIndex.value = 1
step1.value = 'success'
step2.value = 'process'
}
break;
case 'INIT_GATHER$03':
if (newValue.code == 10200) {
step1InitLog.value.push({
type: 'info',
log: newValue.data,
})
}else if (newValue.code == 25001) {
step1InitLog.value.push({
type: 'info',
log: newValue.data,
})
activeIndex.value = 1
step1.value = 'success'
step2.value = 'process'
}
break;
case 'DATA_REQUEST$03':
if (newValue.code == 25001) {
step1InitLog.value.push({
type: 'info',
log: newValue.data,
})
activeIndex.value = 1
step1.value = 'success'
step2.value = 'process'
}
break;
}
break;
case 'record_wave_step1':
switch (newValue.operateCode) {
case 'DATA_REQUEST$03':
if (newValue.code == 25002) { //某一路录波校验失败
step1InitLog.value.push({
type: 'error',
@@ -300,66 +278,67 @@ watch(webMsgSend, function (newValue, oldValue) {
ts.value = 'error'
step5.value = 'error'
}
}
break;
case 'yjc_mxyzxjy':
switch (newValue.operateCode){
case 'DATA_REQUEST$02':
if (newValue.code == 10200) { //单个监测点成功
step2InitLog.value.push({
type: 'info',
log: newValue.data + '模型一致性检验成功!',
})
}else if (newValue.code == 10201) {
}
if (newValue.code == 10201) {
step2.value = 'process'
step2InitLog.value = [{
type: 'wait',
log: '正在进行模型一致性校验.....',
}];
} else if (newValue.code == 25002) { //单个监测点失败
}
if (newValue.code == 25002) { //单个监测点失败
step2InitLog.value.push({
type: 'error',
log: newValue.data + '模型一致性检验失败!',
})
}else if (newValue.code == 25001) { //最终成功
}
if (newValue.code == 25001) { //最终成功
step2.value = 'success'
step3.value = 'process'
activeIndex.value = 2
}else if (newValue.code == 25003) { //最终失败
}
if (newValue.code == 25003) { //最终失败
step2.value = 'error'
ts.value = 'error'
step5.value = 'error'
}
break;
}
break;
case 'yjc_align':
switch (newValue.operateCode){
case 'DATA_REQUEST$02':
if (newValue.code == 10200) { //单个监测点成功
step3InitLog.value.push({
type: 'info',
log: newValue.data +'实时数据对齐检验成功!',
log: newValue.data + '数据对齐检验成功!',
})
}else if (newValue.code == 10201) {
}
if (newValue.code == 10201) {
step3.value = 'process'
step3InitLog.value = [{
type: 'wait',
log: '正在进行实时数据对齐检验.....',
log: '正在进行数据对齐检验.....',
}];
}else if (newValue.code == 25002) { //单个监测点失败
}
if (newValue.code == 25002) { //单个监测点失败
step3InitLog.value.push({
type: 'error',
log: newValue.data + '实时数据对齐检验失败!',
log: newValue.data + '数据对齐检验失败!',
})
}else if (newValue.code == 25001 && newValue.data) { //最终成功
}
if (newValue.code == 25001 && newValue.data) { //最终成功
isShowDialog.value = true
step3.value = 'success'
step4.value = 'process'
activeIndex.value = 3
testDataStructure.value = newValue.data
}else if (newValue.code == 25003) { //最终失败
}
if (newValue.code == 25003) { //最终失败
isShowDialog.value = true
step3.value = 'error'
@@ -368,28 +347,27 @@ watch(webMsgSend, function (newValue, oldValue) {
testDataStructure.value = newValue.data
}
break;
}
break;
case 'YJC_xujy':
switch (newValue.operateCode) {
case 'DATA_REQUEST$02':
if (newValue.code == 10200) {
step4InitLog.value.push({
type: 'info',
log: newValue.data,
})
}else if (newValue.code == 10201) {
}
if (newValue.code == 10201) {
step4.value = 'process'
step4InitLog.value = [{
type: 'wait',
log: '正在进行相序性检.....',
}];
} else if(newValue.code == 25002){
}
if (newValue.code == 25002) {
step4InitLog.value.push({
type: 'error',
log: newValue.data,
})
} else if (newValue.code == 25003) {
}
if (newValue.code == 25003) {
step4InitLog.value.push({
type: 'error',
log: newValue.data,
@@ -397,14 +375,13 @@ watch(webMsgSend, function (newValue, oldValue) {
step4.value = 'error'
ts.value = 'error'
step5.value = 'error'
} else if (newValue.code == 25001) {
}
if (newValue.code == 25001) {
step4.value = 'success'
step5.value = 'success'
ts.value = 'success'
activeIndex.value = 4
}
break
}
break;
case 'quit':
break;

View File

@@ -53,7 +53,6 @@
content="子计划信息"
>
<List
v-auth.plan="'add_subplan'"
@click.stop="childDetail(node.data)"
style="
width: 16px;

View File

@@ -37,13 +37,7 @@
<el-button v-if="!isTabPlanFather" icon="CirclePlus" type="primary" @click="addTab('add')">
新增子计划
</el-button>
<el-button
v-if="isTabPlanFather && planFormContent?.testState === 0"
v-auth.plan="'add_subplan'"
icon="Edit"
type="primary"
@click="addTab('edit')"
>
<el-button v-if="isTabPlanFather" icon="Edit" type="primary" @click="addTab('edit')">
编辑子计划
</el-button>
<el-button
@@ -375,11 +369,11 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
fixed: 'right',
render: (scope: { row: { checkState: number } }) => {
return scope.row.checkState === 0 ? (
<el-tag type="warning" effect="dark">
<el-tag type="primary" effect="dark">
未检
</el-tag>
) : scope.row.checkState === 1 ? (
<el-tag type="danger" effect="dark">
<el-tag type="warning" effect="dark">
检测中
</el-tag>
) : (
@@ -422,7 +416,7 @@ const renderTabs = () => {
})
}
// 子计划 tabs
if (planFormContent.value?.children?.length > 0) {
if (planFormContent.value && planFormContent.value.children && planFormContent.value.children?.length > 0) {
planFormContent.value.children.forEach((child, index) => {
tabs.push({
title: child.name,
@@ -451,7 +445,8 @@ const unbindDevice = (row: any) => {
await subPlanBindDev({ planId: row.planId, devIds: [row.id], bindFlag: 0 }) //解绑 0 绑定 1
// 👇 更新数据(例如清空 state 字段)
row.state = '/'
proTable.value?.getTableList()
await proTable.value?.getTableList()
await props.refreshTable!()
// 可选:刷新表格或提交接口
ElMessage.success('解绑成功')
})
@@ -478,6 +473,7 @@ const addTab = (type: string) => {
//收到子组件回复后新增子计划tab
const addNewChildTab = async () => {
await props.refreshTable!() //刷新检测计划列表
proTable.value?.getTableList() // 刷新当前设备列表
renderTabs()
}
@@ -505,6 +501,7 @@ const distribute = (childPlan: Plan.ResPlan, scope: any) => {
.then(async () => {
await subPlanBindDev({ planId: childPlan.id, devIds: scope.selectedListIds, bindFlag: 1 }) //解绑 0 绑定 1
proTable.value?.getTableList()
await props.refreshTable!()
ElMessage.success('分配成功')
})
.catch(() => {
@@ -802,9 +799,10 @@ const importAndMergePlanCheckDataClick = () => {
}
planCheckDataImportZip.value?.acceptParams(params)
}
const importResult = async (success: boolean | undefined) => {
const importResult = async (success: boolean) => {
if (success) {
await props.refreshTable!()
proTable.value?.getTableList()
}
}

View File

@@ -367,6 +367,7 @@ const initTree = (data: Device[]) => {
filter.value.groupBy
)
defaultCheckedKeys.value = data.filter(item => item.checked).map(item => item.id)
modelValue.value = defaultCheckedKeys.value
// 统计数据
statistics.value.checked = defaultCheckedKeys.value.length
statistics.value.total = data.length
@@ -412,13 +413,13 @@ const convertToTree = (data: Device[], groupBy?: string | undefined) => {
const groupNode: Tree = {
id: `${groupBy}_${groupName}`,
label: groupName,
disabled: props.disabled,
children: (items as any[]).map((item: any) => ({
...item,
label: item.name,
children: [],
disabled: item.disabled ? item.disabled : props.disabled,
...item
}))
disabled: item.disabled ? item.disabled : props.disabled
})),
disabled: props.disabled
}
treeData.push(groupNode)
})

View File

@@ -13,6 +13,7 @@
<el-col :span="9">
<el-form-item :label-width="110" label="名称" prop="name">
<el-input
:disabled="formContent.testState != 0"
v-model="formContent.name"
autocomplete="off"
maxlength="32"
@@ -35,7 +36,7 @@
<el-option
v-for="option in pqStandardDevArray"
:key="option.value"
:disabled="subPlanBindStandardDev.includes(option.label)"
:disabled="subPlanBindStandardDev.includes(option.label) || option.disabled"
:label="option.label"
:value="option.value"
/>
@@ -83,7 +84,7 @@
<el-form-item :label-width="110" label="数据源" prop="datasourceIds">
<el-select
v-model="formContent.datasourceIds"
:disabled="allDisabled"
:disabled="allDisabled || formContent.testState != 0"
:max-collapse-tags="1"
collapse-tags-tooltip
:multiple="selectByMode"
@@ -209,7 +210,7 @@
<el-form-item v-if="selectByMode" :label-width="110" label="项目成员" prop="memberIds">
<el-select
v-model="formContent.memberIds"
:disabled="allDisabled"
:disabled="allDisabled || formContent.testState != 0"
:multiple="planType == 0"
autocomplete="off"
clearable
@@ -459,11 +460,12 @@ const generateData = () => {
i.manufacturer = manufacturer.name
}
}
i.checked = boundPqDevIds.includes(i.id)
if (i.assign) {
i.disabled = i.checkState != 0 || i.assign == 1 || allDisabled.value
} else {
i.disabled = allDisabled.value
i.checked = boundPqDevIds.length > 0 ? boundPqDevIds.includes(i.id) : false
if (i.checkState && i.checkState != 0) {
i.disabled = true
}
if (allDisabled.value) {
i.disabled = true
}
})
// 排序逻辑
@@ -668,12 +670,12 @@ const save = () => {
if (planType.value == 1) {
formContent.fatherPlanId = formContent.id
formContent.id = ''
formContent.memberIds = [formContent.memberIds?.toString()]
formContent.memberIds = formContent.memberIds ? [formContent.memberIds?.toString()] : []
await addPlan(formContent)
emit('update:tab')
// 编辑子计划
} else if (planType.value == 2) {
formContent.memberIds = [formContent.memberIds?.toString()]
formContent.memberIds = formContent.memberIds ? [formContent.memberIds?.toString()] : []
await updatePlan(formContent)
emit('update:tab')
console.log('更新子计划', formContent)
@@ -947,6 +949,13 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
...user,
disabled: childrenMembers.includes(user.id) || formContent.leader === user.id
}))
const subPlanIds = data.children.map((item: any) => item.id)
const subBoundDev_Result = await getBoundPqDevList({ planIdList: subPlanIds })
const subBoundDevData = Array.isArray(subBoundDev_Result.data) ? subBoundDev_Result.data : []
const subBoundDevIds = subBoundDevData.map((item: any) => item.id)
boundPqDevList.value.forEach((item: any) => {
item.disabled = subBoundDevIds.includes(item.id)
})
}
} else if (planType.value === 1) {
unboundPqDevList.value = boundData.filter((i: any) => !i.boundPlanName) as Device.ResPqDev[]
@@ -1117,14 +1126,16 @@ function pqToArray() {
if (planType.value === 0) {
pqStandardDevArray.value = sourceArray5.map(item => ({
label: item.name,
value: item.id
value: item.id,
disabled: item.disabled || false
}))
} else if (planType.value === 1) {
pqStandardDevArray.value = sourceArray5
.filter(item => formContent.standardDevIds.includes(item.id))
.map(item => ({
label: item.name,
value: item.id
value: item.id,
disabled: item.disabled || false
}))
formContent.standardDevIds = []
formContent.standardDevMap = new Map<string, number>()
@@ -1134,7 +1145,8 @@ function pqToArray() {
const boundStandardDevAllList = Array.isArray(result.data) ? result.data : []
pqStandardDevArray.value = boundStandardDevAllList.map(item => ({
label: item.name,
value: item.id
value: item.id,
disabled: item.disabled || false
}))
})
}

View File

@@ -41,7 +41,7 @@
<el-button
type="primary"
v-auth.plan="'analysis'"
:icon="List"
icon="DataLine"
:disabled="!scope.isSelected"
@click="statisticalAnalysisMore(scope.selectedListIds, scope.selectedList)"
>
@@ -103,7 +103,7 @@
type="primary"
v-auth.plan="'analysis'"
link
:icon="List"
icon="DataLine"
v-if="scope.row.testState == '2'"
@click="statisticalAnalysis(scope.row)"
>
@@ -149,7 +149,7 @@
<script setup lang="tsx" name="useProTable">
import ProTable from '@/components/ProTable/index.vue'
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
import { CirclePlus, Delete, Download, List, Upload } from '@element-plus/icons-vue'
import { CirclePlus, Delete, Download, Upload } from '@element-plus/icons-vue'
import {
deletePlan,
downloadTemplate,
@@ -342,11 +342,11 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
fieldNames: { label: 'label', value: 'id' },
render: scope => {
return scope.row.testState === 0 ? (
<el-tag type="warning" effect="dark">
<el-tag type="primary" effect="dark">
未检
</el-tag>
) : scope.row.testState === 1 ? (
<el-tag type="danger" effect="dark">
<el-tag type="warning" effect="dark">
检测中
</el-tag>
) : (
@@ -365,7 +365,7 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
<el-progress
text-inside={true}
stroke-width={20}
percentage={(scope.row.progress ?? 0) * 100}
percentage={Number(((scope.row.progress ?? 0) * 100).toFixed(2))}
status="success"
/>
)