This commit is contained in:
parent
050378defc
commit
43e2289ada
|
|
@ -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("新增成功");
|
||||
|
|
|
|||
Loading…
Reference in New Issue