This commit is contained in:
hayu 2025-08-29 17:44:57 +08:00
parent 050378defc
commit 43e2289ada
1 changed files with 29 additions and 40 deletions

View File

@ -185,7 +185,7 @@
<script>
import {
addWsMaInfoData, delGadget,
getDeviceType, getGadgetInfo, getGadgetList
getDeviceType, getGadgetInfo, getGadgetList, updateGadgetInfo
} from '@/api/ma/device'
export default {
@ -227,6 +227,7 @@ export default {
open: false,
//
form: {
id:null,
deviceTypeId: null,
deviceModelId: null,
deviceCode: '',
@ -383,8 +384,8 @@ export default {
this.reset();
try {
const response = await getGadgetInfo(row.id);
this.form = { ...response.data };
this.form.deviceCode = response.data.maCode;
this.form = { ...response.data,deviceCode: response.data.maCode};
// this.form.deviceCode = response.data.maCode;
// ID
this.form.deviceTypeId =response.data.deviceTypeId;
@ -433,20 +434,32 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
const data = { ...this.form };
//
const deviceType = this.deviceTypeOptions.find(item => item.typeId === data.deviceTypeId);
if (deviceType) {
data.maName = deviceType.typeName; //
}
//
const deviceModel = this.deviceModelOptions.find(item => item.typeId === data.deviceModelId);
if (deviceModel) {
data.maModel = deviceModel.typeName; //
}
const params = {
id: this.form.id,
maName: data.maName,
maModel:data.maModel,
modelId:this.form.deviceModelId,
maCode:this.form.deviceCode,
thisCheckTime:this.form.thisCheckTime,
nextCheckTime:this.form.nextCheckTime,
repairMan: this.form.repairMan,
checkMan: this.form.checkMan,
phone: this.form.phone,
result:this.form.result,
}
if (this.form.id) {
const params = {
id: this.form.id,
maName: data.maName,
maModel:data.maModel,
modelId:this.form.deviceModelId,
maCode:this.form.deviceCode,
thisCheckTime:this.form.thisCheckTime,
nextCheckTime:this.form.nextCheckTime,
repairMan: this.form.repairMan,
checkMan: this.form.checkMan,
phone: this.form.phone,
result:this.form.result,
}
// API
updateGadgetInfo(params).then(response => {
this.$message.success("修改成功");
@ -454,30 +467,6 @@ export default {
this.getList();
});
} else {
const data = { ...this.form };
//
const deviceType = this.deviceTypeOptions.find(item => item.typeId === data.deviceTypeId);
if (deviceType) {
data.maName = deviceType.typeName; //
}
//
const deviceModel = this.deviceModelOptions.find(item => item.typeId === data.deviceModelId);
if (deviceModel) {
data.maModel = deviceModel.typeName; //
}
const params = {
maName: data.maName,
maModel:data.maModel,
modelId:this.form.deviceModelId,
maCode:this.form.deviceCode,
thisCheckTime:this.form.thisCheckTime,
nextCheckTime:this.form.nextCheckTime,
repairMan: this.form.repairMan,
checkMan: this.form.checkMan,
phone: this.form.phone,
result:this.form.result,
}
// API
addWsMaInfoData(params).then(response => {
this.$message.success("新增成功");