|  | @@ -22,7 +22,7 @@
 | 
	
		
			
				|  |  |              <el-col :span="12">
 | 
	
		
			
				|  |  |                <el-form-item prop="iotCode" label="所属主机">
 | 
	
		
			
				|  |  |                  <el-select
 | 
	
		
			
				|  |  | -                  prop="checkRole"
 | 
	
		
			
				|  |  | +                  prop="iotCode"
 | 
	
		
			
				|  |  |                    label="检查人员"
 | 
	
		
			
				|  |  |                    v-model="formData.iotCode"
 | 
	
		
			
				|  |  |                    placeholder="请选择所属主机"
 | 
	
	
		
			
				|  | @@ -131,7 +131,7 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  |  import {mapMutations, mapState} from "vuex";
 | 
	
		
			
				|  |  | -import {getProductDisplayName} from "@/api/iot/deviceInfo";
 | 
	
		
			
				|  |  | +import {addDvrHostDevice, editDvrHostDevice, getProductDisplayName, updateDvrHostDevice} from "@/api/iot/deviceInfo";
 | 
	
		
			
				|  |  |  import KSelect from "@/components/common/userselect.vue";
 | 
	
		
			
				|  |  |  import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
 | 
	
		
			
				|  |  |  import {addConfig, updateConfig} from "@/api/system/config";
 | 
	
	
		
			
				|  | @@ -185,6 +185,8 @@ export default {
 | 
	
		
			
				|  |  |      reset(other = {}) {
 | 
	
		
			
				|  |  |        return {
 | 
	
		
			
				|  |  |          id: null,
 | 
	
		
			
				|  |  | +        orgId: null,
 | 
	
		
			
				|  |  | +        iotCode: null,
 | 
	
		
			
				|  |  |          deviceName: null,
 | 
	
		
			
				|  |  |          deviceProduct: null,
 | 
	
		
			
				|  |  |          serverIp: "",
 | 
	
	
		
			
				|  | @@ -202,21 +204,15 @@ export default {
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    async show(id, orgId, name,other = {}) {
 | 
	
		
			
				|  |  | -      if (id) {
 | 
	
		
			
				|  |  | -        this.title = '编辑' + name;
 | 
	
		
			
				|  |  | -        this.formData = await this.refresh(id);
 | 
	
		
			
				|  |  | -      } else {
 | 
	
		
			
				|  |  | -        this.formData.orgId = orgId;
 | 
	
		
			
				|  |  | -        console.log("this.formData.orgId",this.formData.orgId)
 | 
	
		
			
				|  |  | -        this.title = '新增' + name;
 | 
	
		
			
				|  |  | -        this.initData();
 | 
	
		
			
				|  |  | -        this.formData = this.reset(other);
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -      this.isShow = true;
 | 
	
		
			
				|  |  | +    async show(orgId, name, other = {}) {
 | 
	
		
			
				|  |  | +      this.formData = this.reset(other);
 | 
	
		
			
				|  |  | +      this.formData.orgId = orgId;
 | 
	
		
			
				|  |  | +      this.title = '新增' + name;
 | 
	
		
			
				|  |  | +      this.initData();
 | 
	
		
			
				|  |  |        this.$nextTick(() => {
 | 
	
		
			
				|  |  |          this.$refs.form.clearValidate(); // 确保在 DOM 更新之后清除表单验证状态
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  | +      this.isShow = true;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // 事件
 | 
	
	
		
			
				|  | @@ -230,19 +226,14 @@ export default {
 | 
	
		
			
				|  |  |      async onSubmit() {
 | 
	
		
			
				|  |  |        this.$refs["form"].validate((valid) => {
 | 
	
		
			
				|  |  |          if (valid) {
 | 
	
		
			
				|  |  | -          if (this.formData.id != undefined) {
 | 
	
		
			
				|  |  | -            updateConfig(this.form).then(response => {
 | 
	
		
			
				|  |  | -              this.$modal.msgSuccess("修改成功");
 | 
	
		
			
				|  |  | -              this.open = false;
 | 
	
		
			
				|  |  | -              this.getList();
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | -          } else {
 | 
	
		
			
				|  |  | -            addConfig(this.form).then(response => {
 | 
	
		
			
				|  |  | +          editDvrHostDevice(this.formData).then(r => {
 | 
	
		
			
				|  |  | +            if (!this.formData.id) {
 | 
	
		
			
				|  |  |                this.$modal.msgSuccess("新增成功");
 | 
	
		
			
				|  |  | -              this.open = false;
 | 
	
		
			
				|  |  | -              this.getList();
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | -          }
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +              this.$modal.msgSuccess("修改成功");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            this.onHide();
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |      },
 |