春风项目四线(合箱线、总装线)
wujian
2024-10-23 2c65c31aceb16c1d06c692266e3fb555ecafdfb5
jcdm-ui/src/views/main/da/paramCollection/index.vue
@@ -18,6 +18,19 @@
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="日期范围" prop="dateConditions">
        <el-date-picker
          v-model="queryParams.dateConditions"
          type="daterange"
          align="right"
          unlink-panels
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          value-format="yyyy-MM-dd"
          @change="handleDateChange">
        </el-date-picker>
      </el-form-item>
      <el-form-item style="float: right">
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -77,10 +90,10 @@
      <el-table-column label="发动机编码" align="center" width="160" prop="sfcCode" ></el-table-column>
<!--      <el-table-column label="产品编号" align="center" prop="productCode"></el-table-column>-->
<!--      <el-table-column label="产线编号" align="center" prop="productionLine"></el-table-column>-->
      <el-table-column label="工位编号" align="center" prop="locationCode"></el-table-column>
<!--      <el-table-column label="设备编号" align="center" prop="equipmentNo"></el-table-column>-->
      <el-table-column label="参数编码" align="center" prop="paramCode"></el-table-column>
      <el-table-column label="参数名称" align="center" prop="paramName" width="150" ></el-table-column>
      <el-table-column label="参数值" align="center" prop="paramValue"></el-table-column>
      <el-table-column label="工位编号" align="center" prop="locationCode"></el-table-column>
      <el-table-column label="参数上限" align="center" prop="paramUpper"></el-table-column>
      <el-table-column label="参数下限" align="center" prop="paramLower"></el-table-column>
      <el-table-column label="采集时间" align="center" prop="collectionTime" width="160">
@@ -89,7 +102,7 @@
        </template>
      </el-table-column>
      <el-table-column label="状态" align="center" prop="state"></el-table-column>
      <el-table-column label="参数名称" align="center" prop="paramName" width="150" ></el-table-column>
      <el-table-column label="参数编码" align="center" prop="paramCode"></el-table-column>
      <el-table-column label="单位" align="center" prop="unit"></el-table-column>
      <el-table-column label="类型" align="center" prop="type"></el-table-column>
      <el-table-column fixed="right" width="200" label="操作" align="center" class-name="small-padding fixed-width" >
@@ -188,11 +201,13 @@
<script>
import { listParamCollection, getParamCollection, delParamCollection, addParamCollection, updateParamCollection } from "@/api/main/da/paramCollection/paramCollection";
import {queryDaParamCollectionListForSearch} from "../../../../api/main/da/paramCollection/paramCollection";
export default {
  name: "ParamCollection",
  data() {
    return {
      maxDate: '',
      // 遮罩层
      loading: true,
      // 选中数组
@@ -213,6 +228,7 @@
      open: false,
      // 查询参数
      queryParams: {
        dateConditions: [],
        pageNum: 1,
        pageSize: 10,
        workOrderNo: null,
@@ -258,14 +274,39 @@
    // this.getList();
  },
  methods: {
    handleDateChange(value) {
      if (value && value.length === 2) {
        const startDate = value[0];
        const endDate = value[1];
        const dayCount = this.daysBetween(startDate, endDate);
        if (dayCount + 1 > 7) {
          this.$message.error('请选择连续的7天!');
          this.queryParams.dateConditions = []; // 重置日期范围
        }
      }
    },
    daysBetween(startDate, endDate) {
      const oneDay = 24 * 60 * 60 * 1000; // 每天的毫秒数
      const startTime = new Date(startDate).getTime();
      const endTime = new Date(endDate).getTime();
      return Math.round(Math.abs((startTime - endTime) / oneDay));
    },
    /** 查询设备产品过程参数采集列表 */
    getList() {
      this.loading = true;
      listParamCollection(this.queryParams).then(response => {
        this.paramCollectionList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
      if ((this.queryParams.sfcCode == null || this.queryParams.sfcCode === '') && this.queryParams.dateConditions.length === 0){
        this.$message({
          message: '请输入发动机号码或者选择查询日期',
          type: 'info'
        });
      } else {
        queryDaParamCollectionListForSearch(this.queryParams).then(response => {
          this.paramCollectionList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      }
    },
    // 取消按钮
    cancel() {