唐耀东
2022-02-22 778354d2ae8cde6b13a70c7a962806e2d735a654
src/views/device/peripheralUnit/index.vue
@@ -121,7 +121,7 @@
      </el-table-column>
      <el-table-column label="外设代码" width="80" align="center" prop="code"/>
      <el-table-column label="外设名称" align="center" prop="name" show-overflow-tooltip/>
      <el-table-column label="规格型号" align="center" prop="model"/>
      <el-table-column label="规格型号" align="center" prop="model" min-width="120"/>
      <el-table-column label="生产厂商" align="center" prop="manufacturer_dictText"/>
      <el-table-column label="厂商代码" width="100" align="center" prop="vendorCode_dictText"/>
      <el-table-column label="波特率" width="100" align="center" prop="baudRate">
@@ -179,7 +179,7 @@
    />
    <!-- 添加或修改外设单元对话框 -->
    <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="500px" append-to-body>
    <Dialog :title="title" :visible.sync="open" width="50%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="外设代码" prop="code">
          <el-input v-model="form.code" placeholder="请输入外设代码" :disabled="disabled"/>
@@ -227,23 +227,23 @@
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
        <el-button :loading="buttonLoading" type="primary" @click="submitForm" :disabled="disabled">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    </Dialog>
    <!-- 附件窗体 -->
    <el-dialog :title="title" :close-on-click-modal="false" :visible.sync="uploadFlag" width="500px" append-to-body>
    <Dialog :title="title" :visible.sync="uploadFlag" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="附件">
          <fileUpload v-model="form.filePath" limit="1"/>
          <fileUpload v-model="form.filePath" :limit="1"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    </Dialog>
  </div>
</template>
@@ -358,12 +358,12 @@
  },
  created() {
    this.getList();
    this.getManufacturerList();
  },
  methods: {
    getManufacturerList() {
      listManufacturer().then(res => {
        this.manufacturerList = res.data
        this.manufacturerList = res.data;
      })
    },
    /** 查询外设单元列表 */
@@ -373,6 +373,7 @@
        this.peripheralUnitList = response.rows;
        this.total = response.total;
        this.loading = false;
        this.getManufacturerList();
      });
    },
    // 取消按钮
@@ -440,7 +441,7 @@
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "修改外设单元";
        this.title = "查看外设单元";
      });
    },
    /** 修改按钮操作 */
@@ -448,11 +449,12 @@
      this.loading = true;
      this.disabled = false
      this.reset();
      this.getManufacturerList();
      //this.getManufacturerList();
      const id = row.id || this.ids
      getPeripheralUnit(id).then(response => {
        this.loading = false;
        this.form = response.data;
        this.form.manufacturer = parseInt(this.form.manufacturer);
        this.open = true;
        this.title = "修改外设单元";
      });
@@ -461,6 +463,12 @@
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          // if(this.uploadFlag){
          //   if(!this.form.filePath){
          //     this.$modal.msgWarning("请选择上传附件");
          //     return;
          //   }
          // }
          this.buttonLoading = true;
          if (this.form.id != null) {
            updatePeripheralUnit(this.form).then(response => {