diff --git a/frontend/src/views/machine/standardDevice/components/standardDevicePopup.vue b/frontend/src/views/machine/standardDevice/components/standardDevicePopup.vue
index e8653bd..25e481a 100644
--- a/frontend/src/views/machine/standardDevice/components/standardDevicePopup.vue
+++ b/frontend/src/views/machine/standardDevice/components/standardDevicePopup.vue
@@ -31,8 +31,6 @@
参数信息
-
-
@@ -212,6 +209,8 @@ const pqChannelArray = ref([
formContent.devKey = null
}
+ // 可检通道转为字符串逗号分隔(保存前临时转换)
+ let originalInspectChannel = formContent.inspectChannel; // 保存原始值
//可检通道转为字符串逗号分隔
// 确保 inspectChannel 是数组再执行 join
if (Array.isArray(formContent.inspectChannel)) {
@@ -222,23 +221,33 @@ const pqChannelArray = ref([
.join(',');
}
+ try {
if (formContent.id) {
- await updatePqStandardDev(formContent);
- ElMessage.success({ message: `${dialogTitle.value}成功!` })
- } else {
+ await updatePqStandardDev(formContent);
+ ElMessage.success({ message: `${dialogTitle.value}成功!` })
+ } else {
+ // 新增需要把通讯协议转成字典ID
+ const protocolItem = dictStore.getDictData('Protocol').find(item => item.name === formContent.protocol);
+ if (protocolItem) {
+ formContent.protocol = protocolItem.id;
+ }
- // 新增需要把通讯协议转成字典ID
- const protocolItem = dictStore.getDictData('Protocol').find(item => item.name === formContent.protocol);
- if (protocolItem) {
- formContent.protocol = protocolItem.id;
- }
-
- await addPqStandardDev(formContent);
- ElMessage.success({ message: `${dialogTitle.value}成功!` })
+ await addPqStandardDev(formContent);
+ ElMessage.success({ message: `${dialogTitle.value}成功!` })
}
close()
// 刷新表格
await props.refreshTable!()
+ } catch (error) {
+ // 如果保存失败,恢复原始的 inspectChannel 值
+ formContent.inspectChannel = originalInspectChannel;
+ throw error;
+ }
+ } else {
+ // 验证失败也需要恢复原始 inspectChannel 格式(如果之前被转换过)
+ if (typeof formContent.inspectChannel === 'string' && formContent.inspectChannel.includes(',')) {
+ formContent.inspectChannel = formContent.inspectChannel.split(',').filter(Boolean);
+ }
}
})
@@ -270,6 +279,7 @@ const open = async (sign: string, data: StandardDevice.ResPqStandardDevice,devTy
const handleDevTypeChange = (value: string) => {
+ console.log('handleDevTypeChange', value)
// 在这里处理选中事件的逻辑
const dev = devTypeOptions.value.find(t =>t.id === value)
if (dev) {
@@ -282,8 +292,6 @@ const handleDevTypeChange = (value: string) => {
//if(titleType.value == 'add') // 默认全选所有通道
formContent.inspectChannel = pqChannelArray.value.map(channel => channel.value)
-
-
// 过滤掉超出新通道数范围的选项
if (Array.isArray(formContent.inspectChannel)) {
formContent.inspectChannel = formContent.inspectChannel.filter(
diff --git a/frontend/src/views/plan/planList/components/childrenPlan.vue b/frontend/src/views/plan/planList/components/childrenPlan.vue
index 02cc048..6133e23 100644
--- a/frontend/src/views/plan/planList/components/childrenPlan.vue
+++ b/frontend/src/views/plan/planList/components/childrenPlan.vue
@@ -188,7 +188,7 @@ const columns = reactive[]>([
fieldNames: {label: 'name', value: 'id'},
minWidth: 200,
},
- {
+ {
prop: 'cityName',
label: '地市',
minWidth: 150,
@@ -383,6 +383,11 @@ const open = async (textTitle: string,data: Plan.ReqPlan,pattern: string) => {
proTable.value?.getTableList()
isTabPlanFather.value = false//子计划页面按钮默认展示主计划的
patternId.value = pattern
+ columns.forEach(item => {//刚进去子计划页面隐藏主计划的操作列
+ if (item.prop === 'operation') {
+ item.isShow = false;
+ }
+ });
console.log('弹窗打开方法',planFormContent.value)
}
@@ -393,6 +398,9 @@ const handleTabClick = (tab:any) => {
if (item.prop === 'boundPlanName') {
item.isShow = false;
}
+ if (item.prop === 'operation') {
+ item.isShow = true;
+ }
});
isTabPlanFather.value = true
}else{
@@ -400,6 +408,9 @@ const handleTabClick = (tab:any) => {
if (item.prop === 'boundPlanName') {
item.isShow = true;
}
+ if (item.prop === 'operation') {
+ item.isShow = false;
+ }
});
isTabPlanFather.value = false
}
diff --git a/frontend/src/views/plan/planList/index.vue b/frontend/src/views/plan/planList/index.vue
index 858f661..85fab5f 100644
--- a/frontend/src/views/plan/planList/index.vue
+++ b/frontend/src/views/plan/planList/index.vue
@@ -487,17 +487,28 @@ const exportClick = () => {
// 打开 drawer(新增、编辑)
const openDialog = (titleType: string, row: Partial = {}) => {
- if(modeStore.currentMode == '比对式'){
- if(row.children?.length > 0){
- planPopup.value?.open(titleType, row,modeStore.currentMode,0)//0主计划 1子计划 2修改子计划
- }else{
- planPopup.value?.open(titleType, row,modeStore.currentMode,2)//0主计划 1子计划 2修改子计划
+ let planType = 0; // 0主计划 1子计划 2修改子计划
+
+ if (modeStore.currentMode === '比对式') {
+ if (titleType === 'add') {
+ // 新增只能是主计划
+ planType = 0;
+ } else {
+ // 编辑情况
+ if (row.children?.length > 0) {
+ // 有子计划 -> 主计划
+ planType = 0;
+ } else if (row.origin == null) {
+ // 没有来源 -> 主计划
+ planType = 0;
+ } else {
+ // 其他 -> 修改子计划
+ planType = 2;
}
- }else{
- planPopup.value?.open(titleType, row,modeStore.currentMode,0)//0主计划 1子计划 2修改子计划
+ }
}
-
-
+
+ planPopup.value?.open(titleType, row, modeStore.currentMode, planType);
}