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> <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("新增成功");