xiangpei
2024-03-12 c757946e75dacaffb07d7415edc0176f8cd0c0a2
src/views/system/point/index.vue
@@ -87,7 +87,7 @@
          <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="运维单位" align="center" prop="unitId" />
      <el-table-column label="运维单位" align="center" prop="unitName" />
      <el-table-column label="运维状态" align="center" prop="status" />
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -118,12 +118,12 @@
    <!-- 添加运维点位对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
      <el-form ref="form" :model="tempForm" :rules="rules" label-width="120px">
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="点位名称" prop="pointName">
          <el-input v-model="tempForm.pointName" placeholder="请输入点位名称" />
          <el-input v-model="form.pointName" placeholder="请输入点位名称" />
        </el-form-item>
        <el-form-item label="运维单位" prop="unitId">
          <el-select :disabled="title === '修改运维点位'" v-model="tempForm.unitId"  placeholder="运维单位">
          <el-select :disabled="title === '修改运维点位'" v-model="form.unitId"  placeholder="运维单位">
            <el-option
              v-for="item in unitList"
              :key="item.id"
@@ -136,7 +136,7 @@
          <el-date-picker
            :disabled="title === '修改运维点位'"
            @change="dateChange"
            v-model="tempForm.timezone"
            v-model="form.timezone"
            type="daterange"
            align="right"
            unlink-panels
@@ -279,7 +279,7 @@
    // 继续添加点位
    nextAdd() {
      let item = {}
      this.formList.push(item);
      // this.formList.push(item);
      this.tempFormList.push(item);
    },
    getUnitSelect() {
@@ -318,7 +318,8 @@
        remark: null,
        createTime: null,
        updateTime: null,
        deleted: null
        deleted: null,
        pointDetail: ""
      };
      this.resetForm("form");
    },
@@ -335,7 +336,7 @@
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
@@ -351,39 +352,31 @@
      getPoint(id).then(response => {
        this.form = response.data;
        this.form.timezone = [this.form.startTime, this.form.endTime]
        if (this.form.pointDetail) {
          this.tempFormList = JSON.parse(this.form.pointDetail)
        }
        this.open = true;
        this.title = "修改运维点位";
      });
    },
    /** 提交按钮 */
    submitForm() {
      if (this.formList.length > 0) {
        // 批量增加
        if (this.formList.every(item => !item.hasOwnProperty("id"))) {
          addPointBatch(this.formList).then(response => {
            this.$modal.msgSuccess("新增成功");
            this.open = false;
            // 重置
            this.tempForm = {};
            this.tempFormList = [];
            this.formList = [];
            this.getList();
          });
        }
      }else {
        if (this.form.id != null) {
          updatePoint(this.form).then(response => {
            this.$modal.msgSuccess("修改成功");
            this.editOpen = false;
            this.getList();
          });
        } else {
          addPoint(this.form).then(response => {
            this.$modal.msgSuccess("新增成功");
            this.open = false;
            this.getList();
          });
        }
      if (this.tempFormList) {
        this.form.pointDetail = JSON.stringify(this.tempFormList)
      }
      if (this.form.id != null) {
        updatePoint(this.form).then(response => {
          this.$modal.msgSuccess("修改成功");
          this.open = false;
          this.getList();
        });
      } else {
        addPoint(this.form).then(response => {
          this.$modal.msgSuccess("新增成功");
          this.open = false;
          this.reset()
          this.getList();
        });
      }
    },
    /** 删除按钮操作 */
@@ -394,7 +387,8 @@
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
      }).catch(() => {
      });
    },
    /** 导出按钮操作 */
    handleExport() {