This commit is contained in:
parent
050378defc
commit
43e2289ada
|
|
@ -185,7 +185,7 @@
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
addWsMaInfoData, delGadget,
|
addWsMaInfoData, delGadget,
|
||||||
getDeviceType, getGadgetInfo, getGadgetList
|
getDeviceType, getGadgetInfo, getGadgetList, updateGadgetInfo
|
||||||
} from '@/api/ma/device'
|
} from '@/api/ma/device'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -227,6 +227,7 @@ export default {
|
||||||
open: false,
|
open: false,
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {
|
form: {
|
||||||
|
id:null,
|
||||||
deviceTypeId: null,
|
deviceTypeId: null,
|
||||||
deviceModelId: null,
|
deviceModelId: null,
|
||||||
deviceCode: '',
|
deviceCode: '',
|
||||||
|
|
@ -383,8 +384,8 @@ export default {
|
||||||
this.reset();
|
this.reset();
|
||||||
try {
|
try {
|
||||||
const response = await getGadgetInfo(row.id);
|
const response = await getGadgetInfo(row.id);
|
||||||
this.form = { ...response.data };
|
this.form = { ...response.data,deviceCode: response.data.maCode};
|
||||||
this.form.deviceCode = response.data.maCode;
|
// this.form.deviceCode = response.data.maCode;
|
||||||
|
|
||||||
// 先设置设备类型ID
|
// 先设置设备类型ID
|
||||||
this.form.deviceTypeId =response.data.deviceTypeId;
|
this.form.deviceTypeId =response.data.deviceTypeId;
|
||||||
|
|
@ -433,27 +434,6 @@ export default {
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
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("修改成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
const data = { ...this.form };
|
const data = { ...this.form };
|
||||||
// 获取设备类型名称
|
// 获取设备类型名称
|
||||||
const deviceType = this.deviceTypeOptions.find(item => item.typeId === data.deviceTypeId);
|
const deviceType = this.deviceTypeOptions.find(item => item.typeId === data.deviceTypeId);
|
||||||
|
|
@ -467,6 +447,7 @@ export default {
|
||||||
data.maModel = deviceModel.typeName; // 添加设备型号名称
|
data.maModel = deviceModel.typeName; // 添加设备型号名称
|
||||||
}
|
}
|
||||||
const params = {
|
const params = {
|
||||||
|
id: this.form.id,
|
||||||
maName: data.maName,
|
maName: data.maName,
|
||||||
maModel:data.maModel,
|
maModel:data.maModel,
|
||||||
modelId:this.form.deviceModelId,
|
modelId:this.form.deviceModelId,
|
||||||
|
|
@ -478,6 +459,14 @@ export default {
|
||||||
phone: this.form.phone,
|
phone: this.form.phone,
|
||||||
result:this.form.result,
|
result:this.form.result,
|
||||||
}
|
}
|
||||||
|
if (this.form.id) {
|
||||||
|
// 这里替换为您的实际API调用
|
||||||
|
updateGadgetInfo(params).then(response => {
|
||||||
|
this.$message.success("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
// 这里替换为您的实际API调用
|
// 这里替换为您的实际API调用
|
||||||
addWsMaInfoData(params).then(response => {
|
addWsMaInfoData(params).then(response => {
|
||||||
this.$message.success("新增成功");
|
this.$message.success("新增成功");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue