xiangpei
2024-03-08 596940048ca4a9b3a18cd1a1c85e698db504035e
src/views/system/point/index.vue
@@ -1,6 +1,6 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="点位名称" prop="pointName">
        <el-input
          v-model="queryParams.pointName"
@@ -39,7 +39,6 @@
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['x:point:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
@@ -50,7 +49,6 @@
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['x:point:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
@@ -61,7 +59,6 @@
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['x:point:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
@@ -100,14 +97,12 @@
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['x:point:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['x:point:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
@@ -121,7 +116,7 @@
      @pagination="getList"
    />
    <!-- 添加或修改运维点位对话框 -->
    <!-- 添加运维点位对话框 -->
    <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-item label="点位名称" prop="pointName">
@@ -155,7 +150,7 @@
            <el-button @click="nextAdd" type="primary" plain>继续添加</el-button>
          </div>
        </el-form-item>
          <div class="point-row" v-for="(point,index) in tempFormList">
        <div class="point-row" v-for="(point,index) in tempFormList">
            <div class="row-item">
              <el-input :disabled="editingIndex!==index" v-model="point.pointName" placeholder="点位名称"></el-input>
            </div>
@@ -193,6 +188,42 @@
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 修改运维点位对话框 -->
    <el-dialog :title="title" :visible.sync="editOpen" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="点位名称" prop="pointName">
          <el-input v-model="form.pointName" placeholder="请输入点位名称" />
        </el-form-item>
        <el-form-item label="运维单位" prop="unitId">
          <el-select v-model="form.unitId"  placeholder="运维单位">
            <el-option
              v-for="item in unitList"
              :key="item.id"
              :label="item.value"
              :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="点位时区" prop="timezone">
          <el-date-picker
            @change="dateChange"
            v-model="form.timezone"
            type="daterange"
            align="right"
            unlink-panels
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          >
          </el-date-picker>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="updateCancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
@@ -224,6 +255,8 @@
      title: "",
      // 是否显示弹出层
      open: false,
      // 修改弹窗
      editOpen: false,
      // 运维单位
      unitList: [],
      // 运维时区
@@ -313,6 +346,10 @@
      this.open = false;
      this.reset();
    },
    updateCancel() {
      this.editOpen = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
@@ -357,7 +394,8 @@
      const id = row.id || this.ids
      getPoint(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.form.timezone = [this.form.startTime, this.form.endTime]
        this.editOpen = true;
        this.title = "修改运维点位";
      });
    },
@@ -369,6 +407,10 @@
          addPointBatch(this.formList).then(response => {
            this.$modal.msgSuccess("新增成功");
            this.open = false;
            // 重置
            this.tempForm = {};
            this.tempFormList = [];
            this.formList = [];
            this.getList();
          });
        }
@@ -376,7 +418,7 @@
        if (this.form.id != null) {
          updatePoint(this.form).then(response => {
            this.$modal.msgSuccess("修改成功");
            this.open = false;
            this.editOpen = false;
            this.getList();
          });
        } else {