1
lkk
2025-05-07 208d124f1512f45c90ac41849bd50dffda2d4f4a
src/views/system/comp/index.vue
@@ -1236,8 +1236,8 @@
        >
          <el-form-item label="单位类型" prop="isZybUnit">
            <el-radio-group v-model="form.isZybUnit">
              <el-radio :label="false">普通单位</el-radio>
              <el-radio :label="true">职业病单位</el-radio>
              <el-radio :label="0">普通单位</el-radio>
              <el-radio :label="1">职业病单位</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item
@@ -1476,7 +1476,7 @@
      id: "",
      // 表单参数
      form: {
        isZybUnit: false,
        isZybUnit: 0,
      },
      lastXianPrice: 0,
      forms: {
@@ -1555,6 +1555,7 @@
      return this.sfzs === "Y";
    },
  },
  created() {
    this.getList();
  },
@@ -1718,6 +1719,7 @@
        validTime: null,
        wbm: null,
        deleted: null,
        isZybUnit: 0
      };
      this.resetForm("form");
    },
@@ -1777,6 +1779,7 @@
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.form.isZybUnit = 0;
      this.open = true;
      this.title = "添加体检单位信息维护";
    },
@@ -1785,7 +1788,10 @@
      this.reset();
      const drugManufacturerId = row.drugManufacturerId || this.ids;
      getComp(drugManufacturerId).then((response) => {
        this.form = response.data;
        // 不要直接赋值整个 response.data,而是逐个属性赋值
        Object.assign(this.form, response.data);
        this.form.isZybUnit = response.data.isZybUnit === true ? 1 : 0;
        console.log('修改时的 isZybUnit 值:', this.form.isZybUnit);
        this.open = true;
        this.title = "修改体检单位信息维护";
      });
@@ -1823,7 +1829,6 @@
              new Big(0)
            ).toNumber();
          });
          // ----------------------------------------------------------
        })
        .catch(() => {
          this.youhui = oldValue;
@@ -2423,19 +2428,19 @@
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          const submitData = {
            ...this.form,
            isZybUnit: Boolean(this.form.isZybUnit)  // 转换为布尔值
          };
          if (this.form.drugManufacturerId != null) {
            updateComp(this.form).then((response) => {
            updateComp(submitData).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            if (
              this.form.cnName &&
              this.form.contactPerson &&
              this.form.contactPhone
            ) {
              addComp(this.form).then((response) => {
            if (this.form.cnName && this.form.contactPerson && this.form.contactPhone) {
              addComp(submitData).then((response) => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.getList();