Merge branch 'dev' of http://192.168.28.10:18088/SmartBench/CMVR-IOT-UI into dev
This commit is contained in:
commit
fe33c529fd
@ -334,7 +334,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" :loading="submitting" @click="submitForm">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -425,6 +425,10 @@ const data = reactive({
|
|||||||
trademark: null,
|
trademark: null,
|
||||||
modelSpec: null,
|
modelSpec: null,
|
||||||
quantity: null,
|
quantity: null,
|
||||||
|
entrustUnit: null,
|
||||||
|
productionUnit: null,
|
||||||
|
sampleDate: null,
|
||||||
|
productionDate: null,
|
||||||
},
|
},
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@ -522,8 +526,10 @@ function reset() {
|
|||||||
trademark: null,
|
trademark: null,
|
||||||
modelSpec: null,
|
modelSpec: null,
|
||||||
quantity: null,
|
quantity: null,
|
||||||
status: null,
|
entrustUnit: null,
|
||||||
remark: null,
|
productionUnit: null,
|
||||||
|
sampleDate: null,
|
||||||
|
productionDate: null,
|
||||||
createBy: null,
|
createBy: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
updateBy: null,
|
updateBy: null,
|
||||||
@ -560,32 +566,39 @@ function handleAdd() {
|
|||||||
|
|
||||||
|
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const submitForm = () => {
|
const submitting = ref(false);
|
||||||
if (!formRef.value) return;
|
const submitForm = async () => {
|
||||||
|
if (!formRef.value || submitting.value) return;
|
||||||
|
|
||||||
formRef.value.validate((valid) => {
|
const valid = await formRef.value.validate().catch(() => false);
|
||||||
if (!valid) {
|
if (!valid) return;
|
||||||
return
|
|
||||||
}
|
const testFuncIds = Array.isArray(form.value.testFuncIds)
|
||||||
form.value.testFuncIds = JSON.stringify(form.value.testFuncIds)
|
? form.value.testFuncIds
|
||||||
if (isAdd.value) {
|
: [];
|
||||||
addProject(form.value).then(res => {
|
const payload = {
|
||||||
if (res.code === 200) {
|
...form.value,
|
||||||
ElMessage.success("添加成功");
|
testFuncIds: JSON.stringify(testFuncIds),
|
||||||
getList();
|
};
|
||||||
}
|
|
||||||
})
|
submitting.value = true;
|
||||||
} else {
|
try {
|
||||||
updateProject(form.value).then(res => {
|
const res = isAdd.value
|
||||||
if (res.code === 200) {
|
? await addProject(payload)
|
||||||
ElMessage.success("修改成功");
|
: await updateProject(payload);
|
||||||
getList();
|
if (res.code !== 200) {
|
||||||
}
|
ElMessage.error(res.msg || (isAdd.value ? "添加失败" : "修改失败"));
|
||||||
})
|
return;
|
||||||
}
|
}
|
||||||
|
ElMessage.success(isAdd.value ? "添加成功" : "修改成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
reset();
|
reset();
|
||||||
});
|
getList();
|
||||||
|
} catch (err) {
|
||||||
|
console.error(isAdd.value ? "添加项目异常:" : "修改项目异常:", err);
|
||||||
|
} finally {
|
||||||
|
submitting.value = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUpdate = (row) => {
|
const handleUpdate = (row) => {
|
||||||
@ -593,7 +606,7 @@ const handleUpdate = (row) => {
|
|||||||
open.value = true;
|
open.value = true;
|
||||||
isAdd.value = false;
|
isAdd.value = false;
|
||||||
title.value = "修改测试项目";
|
title.value = "修改测试项目";
|
||||||
form.value = row;
|
form.value = { ...row };
|
||||||
let arr = []
|
let arr = []
|
||||||
try {
|
try {
|
||||||
arr = JSON.parse(form.value.testFuncIds);
|
arr = JSON.parse(form.value.testFuncIds);
|
||||||
@ -644,24 +657,32 @@ const vehicleConfigChange = (value) => {
|
|||||||
getFuncList(value)
|
getFuncList(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const getFuncList = (value) => {
|
const getFuncList = async (value) => {
|
||||||
getFunction({
|
if (!value) return;
|
||||||
pageNum: 1,
|
try {
|
||||||
pageSize: 10000,
|
const res = await getFunction({
|
||||||
vehicleConfigId: value
|
pageNum: 1,
|
||||||
}).then((res) => {
|
pageSize: 10000,
|
||||||
if (res.code === 200) {
|
vehicleConfigId: value
|
||||||
funcIdOptions.value = (res.rows || []).map(item => {
|
});
|
||||||
const label = ti_function_config.value.find(func => {
|
if (res.code !== 200) {
|
||||||
return func.value === item.funcKey
|
ElMessage.error(res.msg || "加载功能列表失败");
|
||||||
}).label
|
return;
|
||||||
return {
|
|
||||||
label: label,
|
|
||||||
value: item.id
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
const dictItems = ti_function_config.value || [];
|
||||||
|
funcIdOptions.value = (res.rows || []).map(item => {
|
||||||
|
const dictItem = dictItems.find(func => {
|
||||||
|
return String(func.value) === String(item.funcKey)
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
label: dictItem?.label || item.funcKey || `功能 ${item.id}`,
|
||||||
|
value: item.id
|
||||||
|
};
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
console.error("加载功能列表异常:", err);
|
||||||
|
ElMessage.error("网络异常,加载功能列表失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const executeOpen = ref(false);
|
const executeOpen = ref(false);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user