chengxiangling
2025-05-16 c9120650b03c477c27ce5c9c492a416be21df1b0
src/views/mainPlan/gasPlanning/index.vue
@@ -9,7 +9,11 @@
    >
      <el-row type="flex" justify="left">
        <el-col :span="8">
          <el-form-item :style="{ width: '100%' }" :label="$t('plan.query.selectMonth')" prop="description">
          <el-form-item
            :style="{ width: '100%' }"
            :label="$t('plan.query.selectMonth')"
            prop="description"
          >
            <el-date-picker
              clearable
              v-model="queryParams.date"
@@ -20,477 +24,275 @@
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="16" style="text-align: right">
          <el-form-item class="column-with-margin">
            <el-button type="primary" icon="Search" @click="handleQuery"
              >{{$t("common.common.query")}}</el-button
        <el-col :span="8">
          <el-form-item
            :label="$t('basic.table.applicableFactories')"
            style="width: 100%"
            prop="plant"
          >
            <el-select
              clearable
              v-model="queryParams.applicableFactory"
              :placeholder="$t('basic.table.applicableFactories')"
            >
            <el-button icon="Refresh" @click="resetQuery">{{$t("common.common.reset")}}</el-button>
              <el-option
                v-for="item in aps_factory"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8" style="text-align: right">
          <el-form-item class="column-with-margin">
            <el-button type="primary" icon="Search" @click="handleQuery">{{
              $t("common.common.query")
            }}</el-button>
            <el-button icon="Refresh" @click="resetQuery">{{
              $t("common.common.reset")
            }}</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div class="box_container">
      <el-row>
        <el-col :span="!clickedTableRef?22:20">
          <div class="title_text">{{$t('plan.title.pipePlanCapacity')}}</div>
        </el-col>
        <el-col :span="1" v-if="!clickedTableRef">
          <el-button
            class="title_btn"
            type="default"
            @click="editRowEvent" >{{$t("common.common.edit")}}</el-button>
        </el-col>
        <el-col :span="1.8" v-if="clickedTableRef">
          <el-button
            class="title_btn"
            type="primary"
            @click="saveRowEvent"
            v-hasPermi="['aps:gasPipelineCapacityPlan:add']"
          >
            {{$t("common.common.save")}}
          </el-button>
        </el-col>
        <el-col :span="1" v-if="clickedTableRef">
          <el-button
            class="title_btn ml20"
            type="default"
            @click="handleCancleStaus">{{$t("common.common.cancel")}}</el-button>
        </el-col>
      </el-row>
      <div class="tabel_container">
        <!-- <HxlhTable
    <!-- <div class="box_container"> -->
    <el-row v-if="!clickedTableRefGas">
      <el-col :span="24" style="text-align: right; margin-bottom: 10px">
        <el-button class="title_btn" type="default" @click="editRowEventGas">{{
          $t("common.common.edit")
        }}</el-button>
      </el-col>
    </el-row>
    <el-row v-if="clickedTableRefGas">
      <el-col :span="24" style="text-align: right; margin-bottom: 10px">
        <el-button
          class="title_btn"
          type="primary"
          @click="saveRowEvent1"
          v-hasPermi="['aps:gasPipelineCapacityPlan:add']"
        >
          {{ $t("common.common.save") }}
        </el-button>
        <el-button
          class="title_btn ml20"
          type="default"
          @click="handleCancleStausGas"
          >{{ $t("common.common.cancel") }}</el-button
        >
      </el-col>
    </el-row>
    <!-- <div class="tabel_container"> -->
    <!-- <HxlhTable
          style="width: 100%"
          :columns="columns"
          :data="routePlanList"
          :data="gasPlanList"
          :loading="loading"
          :height="height"
          :editConfig="editConfig"
        >
          <template #edit_role="{ row }">
            <vxe-select
        </HxlhTable> -->
    <vxe-table
      border
      ref="tableRef1"
      show-overflow
      size="small"
      :loading="loading2"
      :height="height"
      :column-config="{ resizable: true, useKey: true }"
      :data="gasPlanList"
    >
      <vxe-column
        :width="locale === 'zh' ? '150px' : '200px'"
        field="processName"
        :title="$t('plan.table.satndardProcessName')"
        fixed="left"
      >
      </vxe-column>
      <vxe-column
        field="orgCode"
        :width="locale === 'zh' ? '150px' : '200px'"
        :title="$t('plan.table.applicableFactories')"
        fixed="left"
      >
        <template #default="{ row }">
          {{ formatTypeLabelPlant([row.orgCode]) }}
        </template>
      </vxe-column>
      <vxe-column
        :width="locale === 'zh' ? '150px' : '200px'"
        field="dayProduceType"
        :title="$t('plan.table.dayProduceType')"
      >
        <!-- <template #edit="{ row }">
              <el-select
                clearable
                v-model="row.dayProduceType"
                style="width: 140px"
              >
                <el-option
                  v-for="type in dayProduceTypeOptions"
                  :key="type.value"
                  :label="type.label"
                  :value="type.value"
                >
                </el-option>
              </el-select>
            </template> -->
        <template #default="{ row }">
          <div v-if="!clickedTableRefGas">
            <span>{{ formatTypeLabel([row.dayProduceType]) }}</span>
          </div>
          <div v-else>
            <el-select
              clearable
              v-model="row.dayProduceType"
              :options="dayProduceTypeOptions"
              filterable
            ></vxe-select>
          </template>
        </HxlhTable> -->
        <vxe-table
          border
          ref="tableRef"
          show-overflow
          :loading="loading"
          :height="height"
          :column-config="{ resizable: true, useKey: true }"
          :data="routePlanList"
          size="small"
        >
          <vxe-column field="processName" :width="locale === 'zh' ? '150px' : '200px'" :title="$t('plan.table.satndardProcessName')" fixed="left">
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '150px' : '200px'"
            field="dayProduceType"
            :title="$t('plan.table.dayProduceType')"
          >
            <!-- <template #edit="{ row }">
              <el-select
                clearable
                v-model="row.dayProduceType"
                style="width: 140px"
              style="width: 140px"
              @change="handlechangeDayproduceType($event, row)"
            >
              <el-option
                v-for="type in dayProduceTypeOptions"
                :key="type.value"
                :label="type.label"
                :value="type.value"
              >
                <el-option
                  v-for="type in dayProduceTypeOptions"
                  :key="type.value"
                  :label="type.label"
                  :value="type.value"
                >
                </el-option>
              </el-select>
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRef">
                <span>{{ formatTypeLabel([row.dayProduceType]) }}</span>
              </div>
              <div v-else>
                <el-select
                  clearable
                  v-model="row.dayProduceType"
                  style="width: 140px"
                  @change="handlechangeDayproduceType($event,row)"
                >
                  <el-option
                    v-for="type in dayProduceTypeOptions"
                    :key="type.value"
                    :label="type.label"
                    :value="type.value"
                  >
                  </el-option>
                </el-select>
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="dayProduceNum"
           :title="$t('plan.table.dayProduceNum')"
          >
            <!-- <template #edit="{ row }">
              </el-option>
            </el-select>
          </div>
        </template>
      </vxe-column>
      <vxe-column
        :width="locale === 'zh' ? '180px' : '200px'"
        field="dayProduceNum"
        :title="$t('plan.table.dayProduceNum')"
      >
        <!-- <template #edit="{ row }">
              <el-input-number v-model="row.dayProduceNum" size="mini" />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRef">
                <span>{{ row.dayProduceNum }}</span>
              </div>
              <div v-else>
                <el-input-number @change="cellClickEvent($event,row)" v-model="row.dayProduceNum" size="mini" />
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '150px' : '200px'"
            field="dayProduceUnit"
            :title="$t('plan.table.dayProduceUnit')"
          >
            <!-- <template #edit="{ row }">
        <template #default="{ row }">
          <div v-if="!clickedTableRefGas">
            <span>{{ row.dayProduceNum }}</span>
          </div>
          <div v-else>
            <el-input-number
              @change="cellClickEvent($event, row)"
              v-model="row.dayProduceNum"
              size="mini"
            />
          </div>
        </template>
      </vxe-column>
      <vxe-column
        :width="locale === 'zh' ? '150px' : '200px'"
        field="dayProduceUnit"
        :title="$t('plan.table.dayProduceUnit')"
      >
        <!-- <template #edit="{ row }">
              <el-input v-model="row.dayProduceUnit" />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRef">
                <span>{{ row.dayProduceUnit }}</span>
              </div>
              <div v-else>
                <el-input v-model="row.dayProduceUnit" />
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="personnelNumber"
            :title="$t('plan.table.personnelNumber')"
          >
            <!-- <template #edit="{ row }">
        <template #default="{ row }">
          <div v-if="!clickedTableRefGas">
            <span>{{ row.dayProduceUnit }}</span>
          </div>
          <div v-else>
            <el-input v-model="row.dayProduceUnit" />
          </div>
        </template>
      </vxe-column>
      <vxe-column
        :width="locale === 'zh' ? '180px' : '200px'"
        field="personnelNumber"
        :title="$t('plan.table.personnelNumber')"
      >
        <!-- <template #edit="{ row }">
              <el-input-number v-model="row.personnelNumber" />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRef">
                <span>{{ row.personnelNumber }}</span>
              </div>
              <div v-else>
                <el-input-number @change="cellClickEvent($event,row)" v-model="row.personnelNumber" />
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="dayProduceAllNum"
            :title="$t('plan.table.dayProduceAllNum')"
          >
            <!-- <template #edit="{ row }">
        <template #default="{ row }">
          <div v-if="!clickedTableRefGas">
            <span>{{ row.personnelNumber }}</span>
          </div>
          <div v-else>
            <el-input-number
              @change="cellClickEvent($event, row)"
              v-model="row.personnelNumber"
            />
          </div>
        </template>
      </vxe-column>
      <vxe-column
        :width="locale === 'zh' ? '180px' : '200px'"
        field="dayProduceAllNum"
        :title="$t('plan.table.dayProduceAllNum')"
      >
        <!-- <template #edit="{ row }">
              <el-input-number v-model="row.dayProduceAllNum" disabled />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRef">
                <span>{{ row.dayProduceAllNum }}</span>
              </div>
              <div v-else>
                <el-input-number v-model="row.dayProduceAllNum" disabled />
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="days"
           :title="$t('plan.table.days')"
          >
            <!-- <template #edit="{ row }">
        <template #default="{ row }">
          <div v-if="!clickedTableRefGas">
            <span>{{ row.dayProduceAllNum }}</span>
          </div>
          <div v-else>
            <el-input-number v-model="row.dayProduceAllNum" disabled />
          </div>
        </template>
      </vxe-column>
      <vxe-column
        :width="locale === 'zh' ? '180px' : '200px'"
        field="days"
        :title="$t('plan.table.days')"
      >
        <!-- <template #edit="{ row }">
              <el-input-number v-model="row.days" />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRef">
                <span>{{ row.days }}</span>
              </div>
              <div v-else>
                <el-input-number @change="cellClickEvent($event,row)" v-model="row.days" />
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="monthProduceAllNum"
            :title="$t('plan.table.monthProduceAllNum')"
          >
            <!-- <template #edit="{ row }">
        <template #default="{ row }">
          <div v-if="!clickedTableRefGas">
            <span>{{ row.days }}</span>
          </div>
          <div v-else>
            <el-input-number
              @change="cellClickEvent($event, row)"
              v-model="row.days"
            />
          </div>
        </template>
      </vxe-column>
      <vxe-column
        :width="locale === 'zh' ? '180px' : '200px'"
        field="monthProduceAllNum"
        :title="$t('plan.table.monthProduceAllNum')"
      >
        <!-- <template #edit="{ row }">
              <el-input-number v-model="row.monthProduceAllNum" disabled />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRef">
                <span>{{ row.monthProduceAllNum }}</span>
              </div>
              <div v-else>
                <el-input-number v-model="row.monthProduceAllNum" disabled/>
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '150px' : '200px'"
            field="remark"
            :title="$t('plan.table.remark')"
          >
          <!-- :edit-render="{ autoFocus: 'input' }" -->
            <!-- <template #edit="{ row }">
        <template #default="{ row }">
          <div v-if="!clickedTableRefGas">
            <span>{{ row.monthProduceAllNum }}</span>
          </div>
          <div v-else>
            <el-input-number v-model="row.monthProduceAllNum" disabled />
          </div>
        </template>
      </vxe-column>
      <vxe-column
        :width="locale === 'zh' ? '150px' : '200px'"
        field="remark"
        :title="$t('plan.table.remark')"
      >
        <!-- <template #edit="{ row }">
              <el-input
                type="text"
                v-model="row.remark"
              />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRef">
                <span>{{ row.remark }}</span>
              </div>
              <div v-else>
                <el-input
                  type="text"
                  v-model="row.remark"
                />
              </div>
            </template>
          </vxe-column>
          <!-- <vxe-column title="操作" width="200" fixed="right">
            <template #default="{ row }">
              <template v-if="hasEditStatus(row)">
                <el-button
                  @click="saveRowEvent(row)"
                  v-hasPermi="['aps:gasPipelineCapacityPlan:add']"
                  >保存</el-button
                >
                <el-button @click="cancelRowEvent()">取消</el-button>
              </template>
              <template v-else>
                <el-button @click="editRowEvent(row)">编辑</el-button>
              </template>
            </template>
          </vxe-column> -->
        </vxe-table>
      </div>
    </div>
    <div class="box_container">
      <el-row>
        <el-col :span="!clickedTableRefGas?22:20">
          <div class="title_text">{{$t("plan.title.gasPlanCapacity")}}</div>
        </el-col>
        <el-col :span="1" v-if="!clickedTableRefGas">
          <el-button
            class="title_btn"
            type="default"
            @click="editRowEventGas" >{{$t("common.common.edit")}}</el-button>
        </el-col>
        <el-col :span="1.8" v-if="clickedTableRefGas">
          <el-button
            class="title_btn"
            type="primary"
            @click="saveRowEvent1"
            v-hasPermi="['aps:gasPipelineCapacityPlan:add']"
          >
            {{$t("common.common.save")}}
          </el-button>
        </el-col>
        <el-col :span="1" v-if="clickedTableRefGas">
          <el-button
            class="title_btn ml20"
            type="default"
            @click="handleCancleStausGas">{{$t("common.common.cancel")}}</el-button>
        </el-col>
      </el-row>
      <div class="tabel_container">
        <!-- <HxlhTable
          style="width: 100%"
          :columns="columns"
          :data="gasPlanList"
          :loading="loading"
          :height="height"
        >
        </HxlhTable> -->
        <vxe-table
          border
          ref="tableRef1"
          show-overflow
          size="small"
          :loading="loading2"
          :height="height"
          :column-config="{ resizable: true, useKey: true }"
          :data="gasPlanList"
        >
          <vxe-column :width="locale === 'zh' ? '150px' : '200px'" field="processName" :title="$t('plan.table.satndardProcessName')" fixed="left">
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '150px' : '200px'"
            field="dayProduceType"
            :title="$t('plan.table.dayProduceType')"
          >
            <!-- <template #edit="{ row }">
              <el-select
                clearable
                v-model="row.dayProduceType"
                style="width: 140px"
              >
                <el-option
                  v-for="type in dayProduceTypeOptions"
                  :key="type.value"
                  :label="type.label"
                  :value="type.value"
                >
                </el-option>
              </el-select>
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRefGas">
                <span>{{ formatTypeLabel([row.dayProduceType]) }}</span>
              </div>
              <div v-else>
                <el-select
                  clearable
                  v-model="row.dayProduceType"
                  style="width: 140px"
                  @change="handlechangeDayproduceType($event,row)"
                >
                  <el-option
                    v-for="type in dayProduceTypeOptions"
                    :key="type.value"
                    :label="type.label"
                    :value="type.value"
                  >
                  </el-option>
                </el-select>
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="dayProduceNum"
           :title="$t('plan.table.dayProduceNum')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.dayProduceNum" size="mini" />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRefGas">
                <span>{{ row.dayProduceNum }}</span>
              </div>
              <div v-else>
                <el-input-number @change="cellClickEvent($event,row)" v-model="row.dayProduceNum" size="mini" />
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '150px' : '200px'"
            field="dayProduceUnit"
            :title="$t('plan.table.dayProduceUnit')"
          >
            <!-- <template #edit="{ row }">
              <el-input v-model="row.dayProduceUnit" />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRefGas">
                <span>{{ row.dayProduceUnit }}</span>
              </div>
              <div v-else>
                <el-input v-model="row.dayProduceUnit" />
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="personnelNumber"
            :title="$t('plan.table.personnelNumber')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.personnelNumber" />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRefGas">
                <span>{{ row.personnelNumber }}</span>
              </div>
              <div v-else>
                <el-input-number @change="cellClickEvent($event,row)" v-model="row.personnelNumber" />
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="dayProduceAllNum"
            :title="$t('plan.table.dayProduceAllNum')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.dayProduceAllNum" disabled />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRefGas">
                <span>{{ row.dayProduceAllNum }}</span>
              </div>
              <div v-else>
                <el-input-number v-model="row.dayProduceAllNum" disabled />
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="days"
            :title="$t('plan.table.days')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.days" />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRefGas">
                <span>{{ row.days }}</span>
              </div>
              <div v-else>
                <el-input-number @change="cellClickEvent($event,row)" v-model="row.days" />
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="monthProduceAllNum"
            :title="$t('plan.table.monthProduceAllNum')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.monthProduceAllNum" disabled />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRefGas">
                <span>{{ row.monthProduceAllNum }}</span>
              </div>
              <div v-else>
                <el-input-number v-model="row.monthProduceAllNum" disabled/>
              </div>
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '150px' : '200px'"
            field="remark"
            :title="$t('plan.table.remark')"
          >
            <!-- <template #edit="{ row }">
              <el-input
                type="text"
                v-model="row.remark"
              />
            </template> -->
            <template #default="{ row }">
              <div v-if="!clickedTableRefGas">
                <span>{{ row.remark }}</span>
              </div>
              <div v-else>
                <el-input
                  type="text"
                  v-model="row.remark"
                />
              </div>
            </template>
          </vxe-column>
          <!-- <vxe-column title="操作" width="200" fixed="right">
        <template #default="{ row }">
          <div v-if="!clickedTableRefGas">
            <span>{{ row.remark }}</span>
          </div>
          <div v-else>
            <el-input type="text" v-model="row.remark" />
          </div>
        </template>
      </vxe-column>
      <!-- <vxe-column title="操作" width="200" fixed="right">
            <template #default="{ row }">
              <template v-if="hasEditStatus1(row)">
                <el-button
@@ -505,27 +307,28 @@
              </template>
            </template>
          </vxe-column> -->
        </vxe-table>
        <!-- <div class="btn_center">
    </vxe-table>
    <!-- <div class="btn_center">
          <el-button type="primary" @click="handleSave2">保存</el-button>
        </div> -->
      </div>
    </div>
    <!-- </div> -->
    <!-- </div> -->
  </div>
</template>
<script setup name="GasPlanning">
// import { ElMessage } from "element-plus";
import { listGasPlan, getGasPlanSave } from "@/api/mainPlan/gasPlanning";
const height = ref(document.documentElement.clientHeight - 400 + "px;");
import { useI18n } from "vue-i18n"; //要在js中使用国际化
const height = ref(document.documentElement.clientHeight - 230 + "px;");
const { t, locale } = useI18n();
const loading = ref(false);
const { proxy } = getCurrentInstance();
const { aps_factory } = proxy.useDict("aps_factory");
const loading2 = ref(false);
const clickedQuery = ref(false);
const clickedQuery2 = ref(false);
const data = reactive({
  queryParams: {
    date: "",
    applicableFactory: "",
  },
});
const tableRef = ref();
@@ -552,150 +355,31 @@
  }
  return "";
};
// 表格配置
// const columns = ref([
//   // {
//   //   title: "规划年份",
//   //   field: "year",
//   //   width: 150,
//   // },
//   // {
//   //   title: "规划月份",
//   //   field: "month",
//   // },
//   // {
//   //   title: "专业",
//   //   field: "major",
//   //   width: 100,
//   // },
//   {
//     title: "标准工序名称",
//     field: "processName",
//     width: 100,
//   },
//   {
//     title: "日产出类型",
//     field: "dayProduceType",
//     width: 140,
//     editRender: {},
//     slots: { edit: "edit_role", default: "default_role" },
//   },
//   {
//     title: "日产出数量",
//     field: "dayProduceNum",
//     width: 140,
//     // editRender: { autoFocus: "input" },
//     // slots: { edit: "edit_name", default: "default_name" },
//   },
//   {
//     title: "日产出数量单位",
//     field: "dayProduceUnit",
//     width: 140,
//   },
//   {
//     title: "人员数量",
//     field: "personnelNumber",
//     width: 140,
//     type: "html",
//   },
//   {
//     title: "日产出总数量",
//     field: "dayProduceAllNum",
//     width: 140,
//     type: "html",
//   },
//   {
//     title: "天数",
//     field: "days",
//     width: 120,
//     // format: 'YYYY-MM-DD'
//   },
//   {
//     title: "月产出总数量",
//     field: "monthProduceAllNum",
//     width: 140,
//     type: "html",
//   },
//   {
//     title: "备注",
//     field: "remark",
//     width: 140,
//     type: "html",
//   },
// ]);
// const hasEditStatus = (row) => {
//   const $table = tableRef.value;
//   if ($table) {
//     return $table.isEditByRow(row);
//   }
// };
const editRowEvent = () => {
  clickedTableRef.value = true;
const formatTypeLabelPlant = (list) => {
  if (list) {
    return list
      .map((type) => {
        const item = aps_factory.value.find(
          (item) => item.value === type
        );
        return item ? item.label : type;
      })
      .join("");
  }
  return "";
};
const editRowEventGas = () => {
  clickedTableRefGas.value = true;
};
const saveRowEvent = (row) => {
  if (!queryParams.value.date) {
    ElMessage({
      message: "请选择年月",
      type: "error",
    });
    return;
  }
  const $table = tableRef.value;
  if ($table) {
    $table.clearEdit().then(() => {
      loading.value = true
      // setTimeout(() => {
      //   loading.value = false
      //   VxeUI.modal.message({ content: `保存成功!name=${row.name}`, status: 'success' })
      // }, 300)
      handleSave("管路");
      clickedTableRef.value = false;
    });
  }
};
const handleCancelAllStatus = ()=>{
  handleCancleStaus();
  handleCancleStausGas();
}
const handleCancleStaus = () => {
  clickedTableRef.value = false;
  if(!clickedQuery.value){
    return
  }
  const year = queryParams.value.date.split("-")[0];
  const month = parseInt(queryParams.value.date.split("-")[1]);
  getRouteList(year, month);
};
const handleCancleStausGas = () => {
  clickedTableRefGas.value = false;
  if(!clickedQuery2.value){
    return
  if (!clickedQuery2.value) {
    return;
  }
  const year = queryParams.value.date.split("-")[0];
  const month = parseInt(queryParams.value.date.split("-")[1]);
  getGasList(year, month);
}
// const cancelRowEvent = () => {
//   const $table = tableRef.value;
//   if ($table) {
//     $table.clearEdit();
//   }
// };
// const hasEditStatus1 = (row) => {
//   const $table = tableRef1.value;
//   if ($table) {
//     return $table.isEditByRow(row);
//   }
// };
// const editRowEvent1 = (row) => {
//   const $table = tableRef1.value;
//   if ($table) {
//     $table.setEditRow(row);
//   }
// };
};
const saveRowEvent1 = (row) => {
  if (!queryParams.value.date) {
    ElMessage({
@@ -723,50 +407,19 @@
//     $table.clearEdit();
//   }
// };
async function getRouteList(year, month) {
  loading.value = true;
  const res = await listGasPlan({
    major: "管路",
    year,
    month,
  });
  routePlanList.value = res.rows;
  routePlanList.value = routePlanList.value.map((item, index) => {
    return {
      ...item,
      dayProduceType:
        item.dayProduceType == null ? "1" : item.dayProduceType,
      dayProduceNum: item.dayProduceNum == null ? "0" : item.dayProduceNum,
      dayProduceUnit:
        item.dayProduceUnit == null ? "小时" : item.dayProduceUnit,
      personnelNumber:
        item.personnelNumber == null ? "1" : item.personnelNumber,
      dayProduceAllNum:
        item.dayProduceAllNum == null
          ? "0"
          : item.dayProduceNum * item.personnelNumber,
      days: item.days == null ? "22" : item.days,
      monthProduceAllNum:
        item.monthProduceAllNum == null
          ? "0"
          : item.dayProduceAllNum * item.days,
    };
  });
  loading.value = false;
}
async function getGasList(year, month) {
  loading2.value = true;
  const res = await listGasPlan({
    major: "气柜",
    year,
    month,
    orgCode: queryParams.value.applicableFactory,
  });
  gasPlanList.value = res.rows;
  gasPlanList.value = gasPlanList.value.map((item, index) => {
    return {
      ...item,
      dayProduceType:
        item.dayProduceType == null ? "1" : item.dayProduceType,
      dayProduceType: item.dayProduceType == null ? "1" : item.dayProduceType,
      dayProduceNum: item.dayProduceNum == null ? "0" : item.dayProduceNum,
      dayProduceUnit:
        item.dayProduceUnit == null ? "小时" : item.dayProduceUnit,
@@ -790,27 +443,26 @@
//   if(row.dayProduceType==="1"){
//     row.dayProduceAllNum = row.dayProduceNum * row.personnelNumber;
//   }else{
//     row.dayProduceAllNum = row.dayProduceNum
//   }
//   row.monthProduceAllNum = row.dayProduceAllNum * row.days;
// }
function cellClickEvent(e, row) {
  if(row.dayProduceType==="1"){
  if (row.dayProduceType === "1") {
    row.dayProduceAllNum = row.dayProduceNum * row.personnelNumber;
  }else{
    row.dayProduceAllNum = row.dayProduceNum
  } else {
    row.dayProduceAllNum = row.dayProduceNum;
  }
  row.monthProduceAllNum = row.dayProduceAllNum * row.days;
}
function handlechangeDayproduceType(e,row){
function handlechangeDayproduceType(e, row) {
  row.dayProduceAllNum = "0";
  row.monthProduceAllNum = "0";
  if(e=="1"){
  if (e == "1") {
    row.dayProduceAllNum = row.dayProduceNum * row.personnelNumber;
  }else if(e=="2"){
    row.dayProduceAllNum = row.dayProduceNum
  } else if (e == "2") {
    row.dayProduceAllNum = row.dayProduceNum;
  }
  row.monthProduceAllNum = row.dayProduceAllNum * row.days;
}
@@ -824,14 +476,13 @@
  }
  const year = queryParams.value.date.split("-")[0];
  const month = parseInt(queryParams.value.date.split("-")[1]);
  getRouteList(year, month);
  // getRouteList(year, month);
  getGasList(year, month);
  clickedQuery.value = true;
  clickedQuery2.value = true
  clickedQuery2.value = true;
}
function resetQuery() {
  queryParams.value.date = "";
  clickedQuery.value = false;
  queryParams.value.applicableFactory = "";
  clickedQuery2.value = false;
  gasPlanList.value = [];
  routePlanList.value = [];
@@ -839,71 +490,27 @@
async function handleSave(major) {
  const year = queryParams.value.date.split("-")[0];
  const month = parseInt(queryParams.value.date.split("-")[1]);
  if (major === "管路") {
    routePlanList.value = routePlanList.value.map((item) => {
      return {
        ...item,
        major: "管路",
        year,
        month,
      };
    });
    await getGasPlanSave([...routePlanList.value]);
  } else {
  if (major === "气柜") {
    gasPlanList.value = gasPlanList.value.map((item) => {
      return {
        ...item,
        major: "气柜",
        year,
        month,
        orgCode: queryParams.value.applicableFactory,
      };
    });
    await getGasPlanSave([...gasPlanList.value]);
    const res = await getGasPlanSave([...gasPlanList.value]);
    if (res.code == 200) {
      ElMessage({
        message: "数据保存成功",
        type: "success",
      });
      loading2.value = false;
      handleQuery();
    }
  }
  ElMessage({
    message: "数据保存成功",
    type: "success",
  });
  loading.value = false;
  loading2.value = false;
  handleQuery();
}
// async function handleSave2(row) {
//   const year = queryParams.value.date.split("-")[0];
//   const month = parseInt(queryParams.value.date.split("-")[1]);
//   console.log(row, "baocun");
//   // gasPlanList.value = gasPlanList.value.map((item) => {
//   //   return {
//   //     ...item,
//   //     major: "气体",
//   //     year,
//   //     month,
//   //   };
//   // });
//   // routePlanList.value = routePlanList.value.map((item) => {
//   //   return {
//   //     ...item,
//   //     major: "管路",
//   //     year,
//   //     month,
//   //   };
//   // });
//   const res = await getGasPlanSave([
//     {
//       ...row,
//       major: "气柜",
//       year,
//       month,
//     },
//   ]);
//   ElMessage({
//     message: "数据保存成功",
//     type: "success",
//   });
//   handleQuery();
//   console.log(res, "akiwjciwj");
// }
</script>
<style lang="scss" scoped>
.column-with-margin {
@@ -921,8 +528,8 @@
  }
  .title_btn {
    margin-top: 20px;
    &.ml20{
      margin-left:20px;
    &.ml20 {
      margin-left: 20px;
    }
  }
  .tabel_container {