From 65f86f41dedbbbb7030e2f37ce3e001bbca4923a Mon Sep 17 00:00:00 2001
From: chengxiangling <291105840@qq.com>
Date: 星期四, 15 五月 2025 13:03:25 +0800
Subject: [PATCH] 查询日历带适用工厂
---
src/views/mainPlan/pipeProduceStatics/index.vue | 244 ++++++++++++++++++++++++++++++------------------
1 files changed, 150 insertions(+), 94 deletions(-)
diff --git a/src/views/mainPlan/pipeProduceStatics/index.vue b/src/views/mainPlan/pipeProduceStatics/index.vue
index 03fd0d5..d99e07c 100644
--- a/src/views/mainPlan/pipeProduceStatics/index.vue
+++ b/src/views/mainPlan/pipeProduceStatics/index.vue
@@ -6,49 +6,55 @@
ref="queryRef"
:inline="true"
v-show="showSearch"
- label-width="68px"
+ label-position="left"
>
- <el-row type="flex" justify="left">
- <el-form-item label="缁熻鏂瑰紡">
- <el-select
- v-model="queryParams.searchType"
- style="width: 200px"
- placeholder="Select"
- @change="handleChangeSelectType"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="閫夋嫨鍖洪棿">
- <div v-if="!dayCom">
- <el-date-picker
- v-model="queryParams.monthRange"
- type="monthrange"
- range-separator="鑷�"
- start-placeholder="閫夋嫨寮�濮嬫湀浠�"
- end-placeholder="閫夋嫨缁撴潫鏈堜唤"
- />
- </div>
- <div v-else>
- <el-date-picker
- v-model="queryParams.monthDays"
- type="month"
- placeholder="閫夋嫨鏈堜唤"
- />
- </div>
- </el-form-item>
-
- <el-form-item class="column-with-margin">
- <el-button type="primary" icon="Search" @click="handleQuery"
- >鏌ヨ</el-button
- >
- <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button>
- </el-form-item>
+ <el-row :gutter="20">
+ <el-col :span="8">
+ <el-form-item :label="$t('plan.query.statistical')" :style="{ width: '100%' }">
+ <el-select
+ v-model="queryParams.searchType"
+ placeholder="Select"
+ @change="handleChangeSelectType"
+ >
+ <el-option
+ v-for="item in options"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="8">
+ <el-form-item :label="$t('plan.query.selectDateRange')" :style="{ width: '100%' }">
+ <div v-if="!dayCom">
+ <el-date-picker
+ v-model="queryParams.monthRange"
+ type="monthrange"
+ :range-separator="$t('plan.placeholder.to')"
+ :start-placeholder="$t('plan.placeholder.startMonth')"
+ :end-placeholder="$t('plan.placeholder.endMonth')"
+ />
+ </div>
+ <div v-else>
+ <el-date-picker
+ v-model="queryParams.monthDays"
+ type="month"
+ :placeholder="$t('plan.placeholder.selectMonth')"
+ />
+ </div>
+ </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>
<el-row :gutter="10" class="mb8">
@@ -58,43 +64,42 @@
plain
icon="Download"
@click="handleExport"
- v-hasPermi="['apsPartRouteStat:export']"
- >瀵煎嚭</el-button
+ v-hasPermi="['aps:apsGasPipingRouteStat:exportExcel']"
+ >{{ $t("common.common.export") }}</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
- type="info"
+ type="success"
plain
icon="Refresh"
@click="handleRefresh"
- v-hasPermi="['apsPartRouteStat:edit']"
- >鏇存柊</el-button
+ v-hasPermi="['aps:apsGasPipingRouteStat:computeCapacity']"
+ :disabled="loading"
+ >{{ $t("common.common.update") }}</el-button
>
</el-col>
<right-toolbar @queryTable="handleQuery" :search="false"></right-toolbar>
</el-row>
<!-- <div class="box_container"> -->
- <!-- <div class="title_text">绠¤矾瑙勫垝浜ц兘璐熻浇缁熻</div> -->
- <!-- <div class="tabel_container"> -->
- <vxe-grid
- ref="gridRef"
- v-bind="gridOptions"
- :loading="loading"
- ></vxe-grid>
- <!-- </div> -->
+ <!-- <div class="title_text">绠¤矾瑙勫垝浜ц兘璐熻浇缁熻</div> -->
+ <!-- <div class="tabel_container"> -->
+ <vxe-grid ref="gridRef" v-bind="gridOptions" :loading="loading"></vxe-grid>
+ <!-- </div> -->
<!-- </div> -->
</div>
</template>
-<script setup name="gasProduceStatics">
+<script setup name="PipeProduceStatics">
import {
listUpdateGasProduceStatics,
listGasProduceStatics,
} from "@/api/mainPlan/gasProduceStatics.js";
import { ref } from "vue";
import * as XLSX from "xlsx";
-import { ElMessage } from "element-plus";
+// import { ElMessage } from "element-plus";
+import { useI18n } from "vue-i18n"; //瑕佸湪js涓娇鐢ㄥ浗闄呭寲
+const { t, locale } = useI18n();
const { proxy } = getCurrentInstance();
const loading = ref(false);
@@ -107,20 +112,11 @@
queryParams: {
monthRange: "",
monthDays: "",
- searchType: "鎸夋湀缁熻",
+ searchType: t("plan.options.monthlyStatic"),
},
});
let searchTypeValue = ref("month");
-const options = [
- {
- value: "month",
- label: "鎸夋湀缁熻",
- },
- {
- value: "day",
- label: "鎸夋棩缁熻",
- },
-];
+let options = ref([]);
const { queryParams } = toRefs(data);
const gridOptions = reactive({
border: true,
@@ -148,6 +144,31 @@
let tableColumn = [];
let tableData = [];
let merges = [];
+watch(
+ locale,
+ (newLocale) => {
+ options.value = [
+ {
+ value: "month",
+ label: t("plan.options.monthlyStatic"),
+ },
+ {
+ value: "day",
+ label: t("plan.options.dailyStatic"),
+ },
+ ];
+ queryParams.value.searchType = t("plan.options.monthlyStatic");
+ if (
+ (!queryParams.value.monthRange && dayCom.value == false) ||
+ (!queryParams.value.monthDays && dayCom.value == true)
+ ) {
+ return;
+ }
+ // queryParams.value.pageNum = 1;
+ getPipeList();
+ },
+ { immediate: true, deep: true }
+);
function handleChangeSelectType(e) {
searchTypeValue.value = e;
if (e === "day") {
@@ -198,7 +219,6 @@
searchType: searchTypeValue.value,
major: "piping",
}).then((response) => {
- console.log(response.data.planTable, "responseresponseresponse");
const colList = [];
let headersOne = [];
let headersTwo = [];
@@ -207,16 +227,16 @@
loading.value = false;
return;
}
- headersOne.push("鏃ユ湡");
- headersTwo.push("宸ュ簭鍚嶇О");
+ headersOne.push(t("plan.table.dateYearMonth"));
+ headersTwo.push(t("plan.table.processName"));
colList.push({
field: "dateCol",
- title: "鏃ユ湡",
+ title: t("plan.table.dateYearMonth"),
fixed: "left",
children: [
{
field: `resourceName`,
- title: "宸ュ簭鍚嶇О",
+ title: t("plan.table.processName"),
width: 250,
type: "html",
},
@@ -227,19 +247,27 @@
headersOne.push(item);
headersOne.push("");
headersOne.push("");
- headersTwo.push("璁捐浜ц兘");
- headersTwo.push("闇�姹備骇鑳�");
- headersTwo.push("浜ц兘璐熻浇");
+ headersTwo.push(t("plan.table.designWorkingHours"));
+ headersTwo.push(t("plan.table.requiredWorkingHours"));
+ headersTwo.push(t("plan.table.capacityLoad"));
colKey++;
colList.push({
field: `dateColTime${colKey}`,
title: item,
children: [
- { field: `designTimes${colKey}`, title: "璁捐浜ц兘", width: 80 },
- { field: `requireTimes${colKey}`, title: "闇�姹備骇鑳�", width: 80 },
+ {
+ field: `designTimes${colKey}`,
+ title: t("plan.table.designWorkingHours"),
+ width: 80,
+ },
+ {
+ field: `requireTimes${colKey}`,
+ title: t("plan.table.requiredWorkingHours"),
+ width: 80,
+ },
{
field: `capacityLoad${colKey}`,
- title: "浜ц兘璐熻浇",
+ title: t("plan.table.capacityLoad"),
width: 80,
type: "html",
},
@@ -274,21 +302,27 @@
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;
+ item[`resourceName`] = key;
}
exportData.value.push(data);
dataList.push(item);
@@ -307,6 +341,25 @@
}
});
}
+function formatCapacityLoad(designTimes, requireTimes, capacityLoad) {
+ /**
+ * // 0-100 缁胯壊锛�101-120榛勮壊锛屽ぇ浜�120绾㈣壊
+ listItem.capacityLoad <= 100
+ ? `<font color="red">${listItem.capacityLoad}%</font>`
+ : listItem.capacityLoad + "%";
+ */
+ if (designTimes > 0 && 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>`;
+ } else {
+ return `${capacityLoad}%`;
+ }
+}
/** 瀵煎嚭鎸夐挳鎿嶄綔 */
function handleExport() {
if (
@@ -314,7 +367,7 @@
(!queryParams.value.monthDays && dayCom.value == true)
) {
ElMessage({
- message: "璇烽�夋嫨骞存湀",
+ message: t("plan.message.errorMonthEmpty"),
type: "error",
});
return;
@@ -341,7 +394,7 @@
(!queryParams.value.monthDays && dayCom.value == true)
) {
ElMessage({
- message: "璇烽�夋嫨骞存湀",
+ message: t("plan.message.errorMonthEmpty"),
type: "error",
});
return;
@@ -355,7 +408,7 @@
queryParams.value.monthRange = "";
queryParams.value.monthDays = "";
dayCom.value = false;
- (queryParams.value.searchType = "鎸夋湀缁熻"),
+ (queryParams.value.searchType = t("plan.options.monthlyStatic")),
(searchTypeValue.value = "month");
tableData = [];
const $grid = gridRef.value;
@@ -372,7 +425,7 @@
(!queryParams.value.monthDays && dayCom.value == true)
) {
ElMessage({
- message: "璇烽�夋嫨骞存湀",
+ message: t("plan.message.errorMonthEmpty"),
type: "error",
});
return;
@@ -382,7 +435,7 @@
major: "piping",
}).then((response) => {
ElMessage({
- message: "鏁版嵁鏇存柊鎴愬姛",
+ message: t("plan.message.update"),
type: "success",
});
loading.value = false;
@@ -393,6 +446,9 @@
// getList();
</script>
<style lang="scss" scoped>
+.column-with-margin {
+ margin-right: 0px;
+}
.box_container {
width: 100%;
margin: 20px auto;
--
Gitblit v1.9.3