src/views/system/work-order/threshold/index.vue
@@ -26,14 +26,14 @@
                v-hasPermi="['ycl:threshold:edit']"
                @click="showEdit('video')"
                v-if="!ifEditVideo"
                >修改
              >修改
              </el-button>
              <el-button
                size="mini"
                type="primary"
                @click="saveEdit('video')"
                v-if="ifEditVideo"
                >保存
              >保存
              </el-button>
            </div>
          </div>
@@ -45,6 +45,7 @@
              justify-content: space-between;
            "
          >
            <div>
              <div
                style="
@@ -64,13 +65,13 @@
                    :key="item.id"
                  >
                    <el-input
                      v-model="videoList[index].value"
                      v-model="videoList[index].valueAuto"
                      size="mini"
                      style="width: 100px"
                      :type="item.countType=='int'?'number':''"
                      v-if="ifEditVideo"
                    ></el-input>
                    <span v-else>{{ item.value }}</span>
                    <span v-else>{{ item.valueAuto }}</span>
                    <span class="unit" v-if="item.countType=='percent'">%</span>
                    <span class="unit" v-if="item.countType=='second'">秒</span>
                  </el-form-item>
@@ -87,13 +88,13 @@
                    :key="item.id"
                  >
                    <el-input
                      v-model="videoList[index].valueAuto"
                      v-model="videoList[index].value"
                      size="mini"
                      style="width: 100px"
                      :type="item.countType=='int'?'number':''"
                      v-if="ifEditVideo"
                    ></el-input>
                    <span v-else>{{ item.valueAuto }}</span>
                    <span v-else>{{ item.value }}</span>
                    <span class="unit" v-if="item.countType=='percent'">%</span>
                    <span class="unit" v-if="item.countType=='second'">秒</span>
                  </el-form-item>
@@ -115,14 +116,14 @@
                v-hasPermi="['ycl:threshold:edit']"
                @click="showEdit('face')"
                v-if="!ifEditFace"
                >修改
              >修改
              </el-button>
              <el-button
                size="mini"
                type="primary"
                @click="saveEdit('face')"
                v-if="ifEditFace"
                >保存
              >保存
              </el-button>
            </div>
          </div>
@@ -153,13 +154,13 @@
                    :key="item.id"
                  >
                    <el-input
                      v-model="faceList[index].value"
                      v-model="faceList[index].valueAuto"
                      size="mini"
                      style="width: 100px"
                      :type="item.countType=='int'?'number':''"
                      v-if="ifEditFace"
                    ></el-input>
                    <span v-else>{{ item.value }}</span>
                    <span v-else>{{ item.valueAuto }}</span>
                    <span class="unit" v-if="item.countType=='percent'">%</span>
                    <span class="unit" v-if="item.countType=='second'">秒</span>
                  </el-form-item>
@@ -176,22 +177,23 @@
                    :key="item.id"
                  >
                    <el-input
                      v-model="faceList[index].valueAuto"
                      v-model="faceList[index].value"
                      size="mini"
                      style="width: 100px"
                      :type="item.countType=='int'?'number':''"
                      v-if="ifEditFace"
                    ></el-input>
                    <span v-else>{{ item.valueAuto }}</span>
                    <span v-else>{{ item.value }}</span>
                    <span class="unit" v-if="item.countType=='percent'">%</span>
                    <span class="unit" v-if="item.countType=='second'">秒</span>
                    </el-form-item
                  </el-form-item
                  >
                </el-form>
              </div>
            </div>
          </div>
        </el-card></el-col
        </el-card>
      </el-col
      >
      <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="8">
        <el-card style="margin-bottom: 20px; height: 350px; margin-right: 20px;color: #656565;">
@@ -205,14 +207,14 @@
                v-hasPermi="['ycl:threshold:edit']"
                @click="showEdit('car')"
                v-if="!ifEditCar"
                >修改
              >修改
              </el-button>
              <el-button
                size="mini"
                type="primary"
                @click="saveEdit('car')"
                v-if="ifEditCar"
                >保存
              >保存
              </el-button>
            </div>
          </div>
@@ -243,13 +245,13 @@
                    :key="item.id"
                  >
                    <el-input
                      v-model="carList[index].value"
                      v-model="carList[index].valueAuto"
                      size="mini"
                      style="width: 100px"
                      :type="item.countType=='int'?'number':''"
                      v-if="ifEditCar"
                    ></el-input>
                    <span v-else>{{ item.value }}</span>
                    <span v-else>{{ item.valueAuto }}</span>
                    <span class="unit" v-if="item.countType=='percent'">%</span>
                    <span class="unit" v-if="item.countType=='second'">秒</span>
                  </el-form-item>
@@ -266,13 +268,13 @@
                    :key="item.id"
                  >
                    <el-input
                      v-model="carList[index].valueAuto"
                      v-model="carList[index].value"
                      size="mini"
                      style="width: 100px"
                      :type="item.countType=='int'?'number':''"
                      v-if="ifEditCar"
                    ></el-input>
                    <span v-else>{{ item.valueAuto }}</span>
                    <span v-else>{{ item.value }}</span>
                    <span class="unit" v-if="item.countType=='percent'">%</span>
                    <span class="unit" v-if="item.countType=='second'">秒</span>
                  </el-form-item>
@@ -280,7 +282,8 @@
              </div>
            </div>
          </div>
        </el-card></el-col
        </el-card>
      </el-col
      >
    </el-row>
@@ -305,7 +308,8 @@
      <el-button size="small" type="success" @click="whiteOpen" plain>新增</el-button>
      <el-button size="small" type="danger" @click="bathDelete" plain>删除</el-button>
      <el-button type="primary" plain icon="el-icon-top" v-loading="download" size="mini" @click="handleExport"
      >导出白名单</el-button>
      >导出白名单
      </el-button>
      <el-popover style="margin-left: 10px" placement="bottom" trigger="hover" content="导入白名单">
        <div class="bottom_">
          <el-upload
@@ -323,11 +327,33 @@
        </div>
        <div>
          <el-button class="bottom_" type="primary" size="small" v-loading="upload" @click="handleImport"
                   >导入</el-button>
          >导入
          </el-button>
        </div>
        <el-button type="primary" size="small" plain icon="el-icon-bottom" slot="reference" >导入白名单</el-button>
        <el-button type="primary" size="small" plain icon="el-icon-bottom" slot="reference">导入白名单</el-button>
      </el-popover>
      <el-popover style="margin-left: 10px" placement="bottom" content="添加故障类型">
        <div class="bottom_">
          <el-form ref = "addErrorForm" :model="addErrorForm" v-loading="addErrorLoading" rules="addErrorFormRules" :inline="true" >
            <el-form-item label="故障类型" prop="errorTypeList">
              <el-select v-model="addErrorForm.errorTypeList" multiple>
                <el-option v-for="dict in dict.type.error_type"
                           :value="dict.value"
                           :key="dict.value"
                           :label="dict.label"/>
              </el-select>
            </el-form-item>
          </el-form>
        </div>
        <div>
          <el-button class="bottom_" type="primary" size="small" @click="addError" plain>确认</el-button>
        </div>
        <el-button style="margin-left: 10px" size="small" type="primary" slot="reference" plain>添加故障类型</el-button>
      </el-popover>
    </el-row>
    <el-row class="content-warp">
      <el-col :span="24">
        <el-table v-loading="loading" :data="workOrderWhiteList" @selection-change="handleSelectionChange">
@@ -339,7 +365,8 @@
          <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button size="mini" type="text" icon="el-icon-edit" @click="handleWhiteUpdate(scope.row)"
                         >修改</el-button>
              >修改
              </el-button>
            </template>
          </el-table-column>
        </el-table>
@@ -347,6 +374,7 @@
        <pagination
          v-show="total>0"
          :total="total"
          :auto-scroll="false"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getWhiteList"
@@ -354,7 +382,7 @@
      </el-col>
    </el-row>
<!--    新增白名单-->
    <!--    新增白名单-->
    <el-dialog
      :title="title"
      :visible.sync="whiteShow"
@@ -362,14 +390,15 @@
      :close-on-click-modal="false"
      :before-close="whiteClose">
      <div>
        <el-form :model="whiteForm" label-position="top" :rules="whiteFormRules" ref="whiteForm" size="small" class="add-form">
          <el-form-item label="点位" prop="serialNumber" >
        <el-form :model="whiteForm" label-position="top" :rules="whiteFormRules" ref="whiteForm" size="small"
                 class="add-form">
          <el-form-item label="点位" prop="serialNumber">
            <el-select
              v-model="whiteForm.pointName"
              filterable
              remote
              reserve-keyword
              :disabled = "whiteForm.id"
              :disabled="whiteForm.id"
              placeholder="国标码/点位名称搜索"
              :remote-method="remoteGetPoints"
              @change="setPointId"
@@ -411,29 +440,30 @@
  getThreshold,
  updateThreshold,
  importData,
} from "@/api/platform/threshold";
import {
  editCar,
  editFace,
  getCar,
  getFace,
  getVideo,
} from "../../../../api/platform/threshold";
import {
  getWhiteList,
  getWhite,
  addWhiteList,
  bathDelete,
  updateWhite
} from "@/api/platform/work-order";
import { pointSelectData } from "@/api/platform/point";
  updateWhite,
  whiteExport
} from "@/api/platform/threshold";
import {pointSelectData} from "@/api/platform/point";
import {addError} from "../../../../api/platform/threshold";
export default {
  dicts: ["image_qualify", "video_qualify", "error_type"],
  name: "Threshold",
  data() {
    return {
      download: false,
      addErrorLoading: false,
      scrollPosition: 0, // 用于保存滚动位置
      // 下拉加载
      selectLoading: false,
      ifEditVideo: false,
@@ -477,6 +507,13 @@
      videoForm: {},
      carForm: {},
      faceForm: {},
      addErrorForm: {},
      // 新增框校验
      addErrorFormRules: {
        errorTypeList: [
          {required: true, message: "请选择故障类型", trigger: "blur"}
        ],
      },
      // 表单校验
      faceRules: {
        monitorType: [
@@ -556,7 +593,7 @@
          {required: true, message: "设备不能为空", trigger: "blur"},
        ],
        errorTypeList: [
          { required: true, message: "请选择故障类型", trigger: "blur" }
          {required: true, message: "请选择故障类型", trigger: "blur"}
        ],
      },
      // 导入文件路径
@@ -592,9 +629,9 @@
    },
    handleExport() {
      this.download = true
      exportData(this.queryParams).then(res => {
      whiteExport().then(res => {
        // 将二进制数据转换为 Blob 对象
        let blob = new Blob([res], { type: 'application/octet-stream' });
        let blob = new Blob([res], {type: 'application/octet-stream'});
        // 创建下载链接
        let downloadLink = document.createElement('a');
@@ -703,6 +740,7 @@
      });
    },
    getWhiteList() {
      // 保存当前滚动位置
      this.loading = true;
      getWhiteList(this.queryParams).then((response) => {
        this.workOrderWhiteList = response.data;
@@ -963,6 +1001,19 @@
      this.whiteShow = false;
      this.whiteReset();
    },
    // 新增故障类型
    addError() {
      this.$refs["addErrorForm"].validate((valid) => {
        if (valid) {
          this.addErrorLoading = true
          addError(this.addErrorForm).then((response) => {
            this.$modal.msgSuccess("添加成功");
            this.getWhiteList();
          });
          this.addErrorLoading = false
        }
      });
    },
    // 白名单框提交
    whiteSubmit() {
      this.$refs["whiteForm"].validate((valid) => {
@@ -1031,6 +1082,8 @@
        this.upload = false
        this.fileList = []
        this.getWhiteList()
      }).catch(() => {
        this.upload = false
      })
    }
  }
@@ -1044,17 +1097,21 @@
::v-deep .el-input-half-width {
  width: calc(50% - 6px); /* 减去一些间隔 */
}
::v-deep .table-row {
  display: flex;
  flex-direction: row;
}
::v-deep .table-row-item {
  width: 120px;
  text-align: center;
}
.fixedWidth {
  width: 200px;
}
.threshold {
  display: flex;
  flex-direction: row;
@@ -1064,19 +1121,27 @@
  font-weight: bold;
  font-size: large;
}
::v-deep .el-form-item {
  margin-bottom: 0px; /* 根据需求调整这个值 */
}
::v-deep .el-form-item__label {
  color: #8d8d8d;
}
.unit {
  margin-left: 5px;
  display: inline-block;
}
.content-warp {
  margin-top: 10px;
}
.bottom_ {
  width: 100%;
  margin-bottom: 8px;
}
</style>