chengxiangling
2025-05-16 e875ccb607bc37c9515217277aafb3d4204c6d14
src/views/mainPlan/gasProduceStatics/index.vue
@@ -10,12 +10,11 @@
    >
      <el-row :gutter="20">
        <el-col :span="8">
          <el-form-item :label="$t('plan.query.statistical')" >
          <el-form-item :label="$t('plan.query.statistical')" :style="{ width: '100%' }">
            <el-select
              v-model="queryParams.searchType"
              placeholder="Select"
              @change="handleChangeSelectType"
              :style="{ width: '270px' }"
            >
              <el-option
                v-for="item in options"
@@ -27,10 +26,16 @@
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item :label="!dayCom?$t('plan.query.selectDateRange'):$t('plan.query.selectDateMonth')">
          <el-form-item
            :style="{ width: '100%' }"
            :label="
              !dayCom
                ? $t('plan.query.selectDateRange')
                : $t('plan.query.selectDateMonth')
            "
          >
            <div v-if="!dayCom">
              <el-date-picker
                :style="{ width: '240px' }"
                v-model="queryParams.monthRange"
                type="monthrange"
                :range-separator="$t('plan.placeholder.to')"
@@ -40,7 +45,6 @@
            </div>
            <div v-else>
              <el-date-picker
                :style="{ width: '200px' }"
                v-model="queryParams.monthDays"
                type="month"
                :placeholder="$t('plan.placeholder.selectMonth')"
@@ -48,13 +52,13 @@
            </div>
          </el-form-item>
        </el-col>
        <el-col :span="8" v-if="!dayCom">
        <el-col :span="8" v-if="dayCom">
          <el-form-item
            :label="$t('basic.table.applicableFactories')"
            prop="plant"
            :style="{ width: '100%' }"
          >
            <el-select
              :style="{ width: '300px' }"
              clearable
              v-model="queryParams.applicableFactory"
              :placeholder="$t('basic.table.applicableFactories')"
@@ -68,7 +72,7 @@
            </el-select>
          </el-form-item>
        </el-col>
        <!-- <el-col :span="8" style="text-align:right;">
        <!-- <el-col :span="6" style="text-align:right;">
          <el-form-item class="column-with-margin">
            <el-button type="primary" icon="Search" @click="handleQuery">{{
              $t("common.common.query")
@@ -103,7 +107,11 @@
          >{{ $t("common.common.update") }}</el-button
        >
      </el-col>
      <right-toolbar @queryTable="handleQuery"></right-toolbar>
      <right-toolbar
        v-model:showSearch="showSearch"
        @queryTable="handleQuery"
        @resetTable="resetQuery"
      ></right-toolbar>
    </el-row>
    <vxe-grid ref="gridRef" v-bind="gridOptions" :loading="loading"></vxe-grid>
  </div>
@@ -223,9 +231,7 @@
  if (list) {
    return list
      .map((type) => {
        const item = aps_factory.value.find(
          (item) => item.value === type
        );
        const item = aps_factory.value.find((item) => item.value === type);
        return item ? item.label : type;
      })
      .join("");
@@ -249,39 +255,51 @@
      : dateStr(queryParams.value.monthDays),
    searchType: searchTypeValue.value,
    major: "gas",
    plant: !dayCom.value?"": queryParams.value.applicableFactory
  }).then((response) => {
    const colList = [];
    let headersOne = [];
    let headersTwo = [];
    if (response.code == "200") {
      if (!response.data.planTitle) {
        loading.value = false;
        return;
      }
      // headersOne.push("");//t("plan.table.dateYearMonth")
      // headersOne.push("");
      // headersTwo.push(t("plan.table.processName"));
      // headersTwo.push(t("plan.table.applicableFactories"));
      colList.push({
        field: "dateCol",
        title: t("plan.table.dateYearMonth"),
        fixed: "left",
        children: [
          {
            field: `resourceName`,
            title: t("plan.table.processName"),
            width: 250,
            type: "html",
          },
          {
            field: `resourceGroupName`,
            title: t("plan.table.applicableFactories"),
            width: 250,
            type: "html",
          },
        ],
        width: 160,
      });
      if (!dayCom.value) {
        colList.push({
          field: "dateCol",
          title: t("plan.table.dateYearMonth"),
          fixed: "left",
          children: [
            {
              field: `resourceName`,
              title: t("plan.table.processName"),
              width: 250,
              type: "html",
            },
            {
              field: `resourceGroupName`,
              title: t("plan.table.applicableFactories"),
              width: 250,
              type: "html",
            },
          ],
          width: 160,
        });
      }else{
        colList.push({
          field: "dateCol",
          title: t("plan.table.dateYearMonth"),
          fixed: "left",
          children: [
            {
              field: `resourceName`,
              title: t("plan.table.processName"),
              width: 250,
              type: "html",
            }
          ],
          width: 160,
        });
      }
      response.data.planTitle.forEach((item) => {
        // headersOne.push(item);
        // headersOne.push("");
@@ -328,7 +346,6 @@
        // let lastCol = startCol + 2;
        // merges.push({ s: { r: 0, c: startCol }, e: { r: 0, c: lastCol } });
        // startCol = lastCol + 1;
        let data = [];
        const item = {
          id: `${rowKey}`,
        };
@@ -357,8 +374,13 @@
          // item[`resourceName`] = flag
          //   ? `<div class='el-badge'><sup class="el-badge__content is-fixed is-dot"></sup>${key}</div>`
          //   : key;
          item[`resourceName`] = key.split("_")[0];
          item[`resourceGroupName`] = formatTypeLabelPlant([key.split("_")[1]]);
          if (!dayCom.value) {
            const lastIndex = key.lastIndexOf('_');
            item[`resourceName`] = key.slice(0, lastIndex);
            item[`resourceGroupName`] = formatTypeLabelPlant([key.slice(lastIndex + 1)]);
          }else{
            item[`resourceName`] = key
          }
        }
        // exportData.value.push(data);
        dataList.push(item);