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,20 +434,32 @@ export default {
 | 
				
			||||||
    submitForm() {
 | 
					    submitForm() {
 | 
				
			||||||
      this.$refs["form"].validate(valid => {
 | 
					      this.$refs["form"].validate(valid => {
 | 
				
			||||||
        if (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) {
 | 
					          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调用
 | 
					            // 这里替换为您的实际API调用
 | 
				
			||||||
            updateGadgetInfo(params).then(response => {
 | 
					            updateGadgetInfo(params).then(response => {
 | 
				
			||||||
              this.$message.success("修改成功");
 | 
					              this.$message.success("修改成功");
 | 
				
			||||||
| 
						 | 
					@ -454,30 +467,6 @@ export default {
 | 
				
			||||||
              this.getList();
 | 
					              this.getList();
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
          } else {
 | 
					          } 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调用
 | 
					            // 这里替换为您的实际API调用
 | 
				
			||||||
            addWsMaInfoData(params).then(response => {
 | 
					            addWsMaInfoData(params).then(response => {
 | 
				
			||||||
              this.$message.success("新增成功");
 | 
					              this.$message.success("新增成功");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue