检测计划列表编辑
This commit is contained in:
@@ -31,8 +31,6 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-divider >参数信息</el-divider>
|
||||
|
||||
|
||||
<el-form-item label='通讯协议' prop='protocol'>
|
||||
<el-select v-model="formContent.protocol" clearable placeholder="请选择通讯协议">
|
||||
<el-option
|
||||
@@ -40,7 +38,6 @@
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user