CD配唱片
2025-04-28 79769f8e0350bd5473005af41cc01974edd06d8b
提交管路,气柜负载统计不同颜色字段
已修改3个文件
314 ■■■■■ 文件已修改
src/views/mainPlan/gasPlanning/index.vue 242 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mainPlan/gasProduceStatics/index.vue 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mainPlan/pipeProduceStatics/index.vue 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mainPlan/gasPlanning/index.vue
@@ -31,7 +31,22 @@
      </el-row>
    </el-form>
    <div class="box_container">
      <div class="title_text">管路规划产能</div>
      <el-row>
        <el-col :span="22">
          <div class="title_text">管路规划产能</div>
        </el-col>
        <el-col :span="2">
          <el-button
            class="title_btn"
            type="primary"
            @click="saveRowEvent"
            v-hasPermi="['aps:gasPipelineCapacityPlan:add']"
          >
            保存
          </el-button>
        </el-col>
      </el-row>
      <div class="tabel_container">
        <!-- <HxlhTable
          style="width: 100%"
@@ -55,7 +70,7 @@
          show-overflow
          :loading="loading"
          :height="height"
          :edit-config="{ trigger: 'manual', mode: 'row', showStatus: true }"
          :edit-config="{ trigger: 'click', mode: 'row', showStatus: true }"
          :data="routePlanList"
          size="small"
          @cell-click="cellClickEvent"
@@ -149,27 +164,40 @@
              <el-input type="textarea" v-model="row.remark" />
            </template>
          </vxe-column>
          <vxe-column title="操作" width="200" fixed="right">
            <!-- <template #default="{ row }">
                <vxe-button @click="handleSave(row)" :loading="row.loading"
                  >保存</vxe-button
                > -->
          <!-- <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="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>
            <!-- </template> -->
          </vxe-column>
          </vxe-column> -->
        </vxe-table>
      </div>
    </div>
    <div class="box_container">
      <div class="title_text">气柜规划产能</div>
      <el-row>
        <el-col :span="22">
          <div class="title_text">气柜规划产能</div>
        </el-col>
        <el-col :span="2">
          <el-button
            class="title_btn"
            type="primary"
            @click="saveRowEvent1"
            v-hasPermi="['aps:gasPipelineCapacityPlan:add']"
          >
            保存
          </el-button>
        </el-col>
      </el-row>
      <div class="tabel_container">
        <!-- <HxlhTable
          style="width: 100%"
@@ -279,22 +307,21 @@
              <el-input type="textarea" v-model="row.remark" />
            </template>
          </vxe-column>
          <vxe-column title="操作" width="200" fixed="right">
            <!-- <template #default="{ row }">
                <el-button @click="handleSave(row)" :loading="row.loading"
                  >保存</el-button
                > -->
          <!-- <vxe-column title="操作" width="200" fixed="right">
            <template #default="{ row }">
              <template v-if="hasEditStatus1(row)">
                <el-button @click="saveRowEvent1(row)" v-hasPermi="['aps:gasPipelineCapacityPlan:add']">保存</el-button>
                <el-button
                  @click="saveRowEvent1(row)"
                  v-hasPermi="['aps:gasPipelineCapacityPlan:add']"
                  >保存</el-button
                >
                <el-button @click="cancelRowEvent1()">取消</el-button>
              </template>
              <template v-else>
                <el-button @click="editRowEvent1(row)">编辑</el-button>
              </template>
            </template>
            <!-- </template> -->
          </vxe-column>
          </vxe-column> -->
        </vxe-table>
        <!-- <div class="btn_center">
          <el-button type="primary" @click="handleSave2">保存</el-button>
@@ -314,8 +341,8 @@
    date: "",
  },
});
const tableRef = ref()
const tableRef1 = ref()
const tableRef = ref();
const tableRef1 = ref();
const { queryParams } = toRefs(data);
const gasPlanList = ref([]);
const routePlanList = ref([]);
@@ -407,20 +434,27 @@
//     type: "html",
//   },
// ]);
const hasEditStatus = (row) => {
  const $table = tableRef.value
  if ($table) {
    return $table.isEditByRow(row)
  }
}
const editRowEvent = (row) => {
  const $table = tableRef.value
  if ($table) {
    $table.setEditRow(row)
  }
}
// const hasEditStatus = (row) => {
//   const $table = tableRef.value;
//   if ($table) {
//     return $table.isEditByRow(row);
//   }
// };
// const editRowEvent = (row) => {
//   const $table = tableRef.value;
//   if ($table) {
//     $table.setEditRow(row);
//   }
// };
const saveRowEvent = (row) => {
  const $table = tableRef.value
  if (!queryParams.value.date) {
    ElMessage({
      message: "请选择年月",
      type: "error",
    });
    return;
  }
  const $table = tableRef.value;
  if ($table) {
    $table.clearEdit().then(() => {
      // loading.value = true
@@ -428,30 +462,37 @@
      //   loading.value = false
      //   VxeUI.modal.message({ content: `保存成功!name=${row.name}`, status: 'success' })
      // }, 300)
      handleSave(row)
    })
      handleSave("管路");
    });
  }
}
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 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) => {
  const $table = tableRef1.value
  if (!queryParams.value.date) {
    ElMessage({
      message: "请选择年月",
      type: "error",
    });
    return;
  }
  const $table = tableRef1.value;
  if ($table) {
    $table.clearEdit().then(() => {
      // loading.value = true
@@ -459,16 +500,16 @@
      //   loading.value = false
      //   VxeUI.modal.message({ content: `保存成功!name=${row.name}`, status: 'success' })
      // }, 300)
      handleSave2(row)
    })
      handleSave("气柜");
    });
  }
}
const cancelRowEvent1 = () => {
  const $table = tableRef1.value
  if ($table) {
    $table.clearEdit()
  }
}
};
// const cancelRowEvent1 = () => {
//   const $table = tableRef1.value;
//   if ($table) {
//     $table.clearEdit();
//   }
// };
async function getRouteList(year, month) {
  const res = await listGasPlan({
    major: "管路",
@@ -480,9 +521,11 @@
  routePlanList.value = routePlanList.value.map((item, index) => {
    return {
      ...item,
      dayProduceType: item.dayProduceType == null ? "" : item.dayProduceType,
      dayProduceType:
        item.dayProduceType == null ? "单人日产出" : item.dayProduceType,
      dayProduceNum: item.dayProduceNum == null ? "0" : item.dayProduceNum,
      dayProduceUnit: item.dayProduceUnit == null ? "个" : item.dayProduceUnit,
      dayProduceUnit:
        item.dayProduceUnit == null ? "小时" : item.dayProduceUnit,
      personnelNumber:
        item.personnelNumber == null ? "1" : item.personnelNumber,
      dayProduceAllNum:
@@ -504,14 +547,15 @@
    year,
    month,
  });
  console.log(res.rows, "getList");
  gasPlanList.value = res.rows;
  gasPlanList.value = gasPlanList.value.map((item, index) => {
    return {
      ...item,
      dayProduceType: item.dayProduceType == null ? "" : item.dayProduceType,
      dayProduceType:
        item.dayProduceType == null ? "单人日产出" : item.dayProduceType,
      dayProduceNum: item.dayProduceNum == null ? "0" : item.dayProduceNum,
      dayProduceUnit: item.dayProduceUnit == null ? "个" : item.dayProduceUnit,
      dayProduceUnit:
        item.dayProduceUnit == null ? "小时" : item.dayProduceUnit,
      personnelNumber:
        item.personnelNumber == null ? "1" : item.personnelNumber,
      dayProduceAllNum:
@@ -533,56 +577,51 @@
  row.monthProduceAllNum = row.dayProduceAllNum * row.days;
}
function handleQuery() {
  if(!queryParams.value.date){
  if (!queryParams.value.date) {
    ElMessage({
      message: "请选择年月",
      type: "error",
    });
    return;
  }
  console.log(queryParams.value.date, "scsciciisc");
  const year = queryParams.value.date.split("-")[0];
  const month = parseInt(queryParams.value.date.split("-")[1]);
  getRouteList(year, month);
  getGasList(year, month);
}
function resetQuery() {
  queryParams.value.date = ""
  queryParams.value.date = "";
}
async function handleSave(row) {
async function handleSave(major) {
  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,
    },
  ]);
  if (major === "管路") {
    routePlanList.value = routePlanList.value.map((item) => {
      return {
        ...item,
        major: "管路",
        year,
        month,
      };
    });
    await getGasPlanSave([...routePlanList.value]);
  } else {
    gasPlanList.value = gasPlanList.value.map((item) => {
      return {
        ...item,
        major: "气柜",
        year,
        month,
      };
    });
    await getGasPlanSave([...gasPlanList.value]);
  }
  ElMessage({
    message: "数据保存成功",
    type: "success",
  });
  handleQuery();
  console.log(res, "akiwjciwj");
}
async function handleSave2(row) {
  const year = queryParams.value.date.split("-")[0];
@@ -635,6 +674,9 @@
    padding-top: 20px;
    margin-left: 20px;
  }
  .title_btn {
    margin-top: 20px;
  }
  .tabel_container {
    width: 98%;
    margin: 20px auto;
src/views/mainPlan/gasProduceStatics/index.vue
@@ -263,21 +263,18 @@
            tableKey++;
            item[`designTimes${tableKey}`] = listItem.designTimes;
            item[`requireTimes${tableKey}`] = listItem.requireTimes;
            item[`capacityLoad${tableKey}`] =
              listItem.capacityLoad > 100
                ? `<font color="red">${listItem.capacityLoad}%</font>`
                : listItem.capacityLoad + "%";
            item[`capacityLoad${tableKey}`] = formatCapacityLoad(listItem.designTimes,listItem.requireTimes,listItem.capacityLoad)
            data.push(listItem.designTimes);
            data.push(listItem.requireTimes);
            data.push(listItem.capacityLoad + "%");
            if (listItem.capacityLoad > 100) {
              flag = true;
            }
            // if (listItem.capacityLoad > 100) {
            //   flag = true;
            // }
          });
          item[`resourceName`] = flag
            ? `<div class='el-badge'><sup class="el-badge__content is-fixed is-dot"></sup>${key}</div>`
            : key;
          // item[`resourceName`] = flag
          //   ? `<div class='el-badge'><sup class="el-badge__content is-fixed is-dot"></sup>${key}</div>`
          //   : key;
        }
        exportData.value.push(data);
        dataList.push(item);
@@ -296,6 +293,23 @@
    }
  });
}
function formatCapacityLoad(designTimes,requireTimes,capacityLoad){
  /**
   * // 0-100 绿色,101-120黄色,大于120红色
    listItem.capacityLoad <= 100
      ? `<font color="red">${listItem.capacityLoad}%</font>`
      : listItem.capacityLoad + "%";
   */
  if(capacityLoad>0&&capacityLoad<=100){
    return `<font color="#85cf60">${capacityLoad}%</font>`
  }else if(designTimes>0&&capacityLoad>101&&capacityLoad<=120){
    return `<font color="#ecb869">${capacityLoad}%</font>`
  }else if(designTimes>0&&capacityLoad>120){
    return `<font color="#f89c9c">${capacityLoad}%</font>`
  }else if(designTimes==0&&requireTimes>0){
    return `<font color="#f56c6c">error</font>`
  }
}
/** 导出按钮操作 */
function handleExport() {
  if (
src/views/mainPlan/pipeProduceStatics/index.vue
@@ -274,21 +274,22 @@
            tableKey++;
            item[`designTimes${tableKey}`] = listItem.designTimes;
            item[`requireTimes${tableKey}`] = listItem.requireTimes;
            item[`capacityLoad${tableKey}`] =
              listItem.capacityLoad > 100
                ? `<font color="red">${listItem.capacityLoad}%</font>`
                : listItem.capacityLoad + "%";
            item[`capacityLoad${tableKey}`] = formatCapacityLoad(listItem.designTimes,listItem.requireTimes,listItem.capacityLoad)
            // 0-100 绿色,101-120黄色,大于120红色
              // listItem.capacityLoad <= 100
              //   ? `<font color="red">${listItem.capacityLoad}%</font>`
              //   : listItem.capacityLoad + "%";
            data.push(listItem.designTimes);
            data.push(listItem.requireTimes);
            data.push(listItem.capacityLoad + "%");
            if (listItem.capacityLoad > 100) {
              flag = true;
            }
            // if (listItem.capacityLoad > 100) {
            //   flag = true;
            // }
          });
          item[`resourceName`] = flag
            ? `<div class='el-badge'><sup class="el-badge__content is-fixed is-dot"></sup>${key}</div>`
            : key;
          // item[`resourceName`] = flag
          //   ? `<div class='el-badge'><sup class="el-badge__content is-fixed is-dot"></sup>${key}</div>`
          //   : key;
        }
        exportData.value.push(data);
        dataList.push(item);
@@ -307,6 +308,23 @@
    }
  });
}
function formatCapacityLoad(designTimes,requireTimes,capacityLoad){
  /**
   * // 0-100 绿色,101-120黄色,大于120红色
    listItem.capacityLoad <= 100
      ? `<font color="red">${listItem.capacityLoad}%</font>`
      : listItem.capacityLoad + "%";
   */
  if(capacityLoad>0&&capacityLoad<=100){
    return `<font color="#85cf60">${capacityLoad}%</font>`
  }else if(designTimes>0&&capacityLoad>101&&capacityLoad<=120){
    return `<font color="#ecb869">${capacityLoad}%</font>`
  }else if(designTimes>0&&capacityLoad>120){
    return `<font color="#f89c9c">${capacityLoad}%</font>`
  }else if(designTimes==0&&requireTimes>0){
    return `<font color="#f56c6c">error</font>`
  }
}
/** 导出按钮操作 */
function handleExport() {
  if (