CD配唱片
2025-05-06 a07f90d6106971923e8f761f253a9b4d30a60752
src/views/mainPlan/gasPlanning/index.vue
@@ -5,17 +5,18 @@
      :model="queryParams"
      ref="queryRef"
      :inline="true"
      label-width="68px"
      label-width="100px"
      label-position="left"
    >
      <el-row type="flex" justify="left">
        <el-col :span="6">
          <el-form-item label="选择月份" prop="description">
          <el-form-item :label="$t('plan.query.selectMonth')" prop="description">
            <el-date-picker
              clearable
              v-model="queryParams.date"
              type="month"
              value-format="YYYY-MM"
              placeholder="选择月份"
              :placeholder="$t('plan.query.selectMonth')"
            >
            </el-date-picker>
          </el-form-item>
@@ -23,9 +24,9 @@
        <el-col :span="18" style="text-align: right">
          <el-form-item class="column-with-margin">
            <el-button type="primary" icon="Search" @click="handleQuery"
              >查询</el-button
              >{{$t("common.common.query")}}</el-button
            >
            <el-button icon="Refresh" @click="resetQuery">重置</el-button>
            <el-button icon="Refresh" @click="resetQuery">{{$t("common.common.reset")}}</el-button>
          </el-form-item>
        </el-col>
      </el-row>
@@ -33,13 +34,13 @@
    <div class="box_container">
      <el-row>
        <el-col :span="!clickedTableRef?22:20">
          <div class="title_text">管路规划产能</div>
          <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" >编辑</el-button>
            @click="editRowEvent" >{{$t("common.common.edit")}}</el-button>
        </el-col>
        <el-col :span="1.8" v-if="clickedTableRef">
          <el-button
@@ -48,14 +49,14 @@
            @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">取消</el-button>
            @click="handleCancleStaus">{{$t("common.common.cancel")}}</el-button>
        </el-col>
      </el-row>
@@ -82,16 +83,16 @@
          show-overflow
          :loading="loading"
          :height="height"
          :edit-config="{ trigger: 'click', mode: 'row', showStatus: true }"
          :column-config="{ resizable: true, useKey: true }"
          :data="routePlanList"
          size="small"
        >
          <vxe-column field="processName" title="标准工序名称" min-width="150" fixed="left">
          <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="日产出类型"
            min-width="160"
            :title="$t('plan.table.dayProduceType')"
          >
            <!-- <template #edit="{ row }">
              <el-select
@@ -131,9 +132,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="dayProduceNum"
            title="日产出数量"
            min-width="200"
           :title="$t('plan.table.dayProduceNum')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.dayProduceNum" size="mini" />
@@ -148,9 +149,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '150px' : '200px'"
            field="dayProduceUnit"
            title="日产出单位"
            min-width="200"
            :title="$t('plan.table.dayProduceUnit')"
          >
            <!-- <template #edit="{ row }">
              <el-input v-model="row.dayProduceUnit" />
@@ -165,9 +166,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="personnelNumber"
            title="人员数量"
            min-width="200"
            :title="$t('plan.table.personnelNumber')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.personnelNumber" />
@@ -182,9 +183,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="dayProduceAllNum"
            title="日产出总数量"
            min-width="200"
            :title="$t('plan.table.dayProduceAllNum')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.dayProduceAllNum" disabled />
@@ -199,9 +200,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="days"
            title="天数"
            min-width="200"
           :title="$t('plan.table.days')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.days" />
@@ -216,9 +217,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="monthProduceAllNum"
            title="月产出数量"
            min-width="200"
            :title="$t('plan.table.monthProduceAllNum')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.monthProduceAllNum" disabled />
@@ -233,9 +234,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '150px' : '200px'"
            field="remark"
            title="备注"
            min-width="200"
            :title="$t('plan.table.remark')"
          >
          <!-- :edit-render="{ autoFocus: 'input' }" -->
            <!-- <template #edit="{ row }">
@@ -277,13 +278,13 @@
    <div class="box_container">
      <el-row>
        <el-col :span="!clickedTableRefGas?22:20">
          <div class="title_text">气柜规划产能</div>
          <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" >编辑</el-button>
            @click="editRowEventGas" >{{$t("common.common.edit")}}</el-button>
        </el-col>
        <el-col :span="1.8" v-if="clickedTableRefGas">
          <el-button
@@ -292,14 +293,14 @@
            @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">取消</el-button>
            @click="handleCancleStausGas">{{$t("common.common.cancel")}}</el-button>
        </el-col>
      </el-row>
      <div class="tabel_container">
@@ -318,15 +319,15 @@
          size="small"
          :loading="loading2"
          :height="height"
          :edit-config="{ mode: 'row', trigger: 'click', showStatus: true }"
          :column-config="{ resizable: true, useKey: true }"
          :data="gasPlanList"
        >
          <vxe-column field="processName" title="标准工序名称" min-width="150" fixed="left">
          <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="日产出类型"
            min-width="160"
            :title="$t('plan.table.dayProduceType')"
          >
            <!-- <template #edit="{ row }">
              <el-select
@@ -366,9 +367,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="dayProduceNum"
            title="日产出数量"
            min-width="200"
           :title="$t('plan.table.dayProduceNum')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.dayProduceNum" size="mini" />
@@ -383,9 +384,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '150px' : '200px'"
            field="dayProduceUnit"
            title="日产出单位"
            min-width="200"
            :title="$t('plan.table.dayProduceUnit')"
          >
            <!-- <template #edit="{ row }">
              <el-input v-model="row.dayProduceUnit" />
@@ -400,9 +401,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="personnelNumber"
            title="人员数量"
            min-width="200"
            :title="$t('plan.table.personnelNumber')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.personnelNumber" />
@@ -417,9 +418,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="dayProduceAllNum"
            title="日产出总数量"
            min-width="200"
            :title="$t('plan.table.dayProduceAllNum')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.dayProduceAllNum" disabled />
@@ -434,9 +435,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="days"
            title="天数"
            min-width="200"
            :title="$t('plan.table.days')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.days" />
@@ -451,9 +452,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '180px' : '200px'"
            field="monthProduceAllNum"
            title="月产出数量"
            min-width="200"
            :title="$t('plan.table.monthProduceAllNum')"
          >
            <!-- <template #edit="{ row }">
              <el-input-number v-model="row.monthProduceAllNum" disabled />
@@ -468,9 +469,9 @@
            </template>
          </vxe-column>
          <vxe-column
            :width="locale === 'zh' ? '150px' : '200px'"
            field="remark"
            title="备注"
            min-width="200"
            :title="$t('plan.table.remark')"
          >
            <!-- <template #edit="{ row }">
              <el-input
@@ -517,6 +518,8 @@
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 { t, locale } = useI18n();
const loading = ref(false);
const loading2 = ref(false);
const clickedQuery = ref(false);
@@ -644,7 +647,7 @@
  const $table = tableRef.value;
  if ($table) {
    $table.clearEdit().then(() => {
      // loading.value = true
      loading.value = true
      // setTimeout(() => {
      //   loading.value = false
      //   VxeUI.modal.message({ content: `保存成功!name=${row.name}`, status: 'success' })
@@ -722,12 +725,12 @@
//   }
// };
async function getRouteList(year, month) {
  loading.value = true;
  const res = await listGasPlan({
    major: "管路",
    year,
    month,
  });
  console.log(res.rows, "getList");
  routePlanList.value = res.rows;
  routePlanList.value = routePlanList.value.map((item, index) => {
    return {
@@ -753,6 +756,7 @@
  loading.value = false;
}
async function getGasList(year, month) {
  loading2.value = true;
  const res = await listGasPlan({
    major: "气柜",
    year,
@@ -793,7 +797,6 @@
//   row.monthProduceAllNum = row.dayProduceAllNum * row.days;
// }
function cellClickEvent(e, row) {
  console.log(row,"cellClickEvent")
  if(row.dayProduceType==="1"){
    row.dayProduceAllNum = row.dayProduceNum * row.personnelNumber;
  }else{
@@ -863,47 +866,45 @@
    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");
}
onMounted(() => {
  // getRouteList();
  // getGasList();
});
// 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>
.box_container {