| | |
| | | ref="queryRef" |
| | | :inline="true" |
| | | v-show="showSearch" |
| | | label-width="68px" |
| | | :label-width="locale === 'zh' ? '68px' : '134px'" |
| | | > |
| | | <el-row type="flex" justify="left"> |
| | | <el-form-item label="统计方式"> |
| | | <el-form-item :label="$t('plan.query.statistical')"> |
| | | <el-select |
| | | v-model="queryParams.searchType" |
| | | style="width: 200px" |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="选择区间"> |
| | | <el-form-item :label="$t('plan.query.selectDateRange')"> |
| | | <div v-if="!dayCom"> |
| | | <el-date-picker |
| | | v-model="queryParams.monthRange" |
| | | type="monthrange" |
| | | range-separator="至" |
| | | start-placeholder="选择开始月份" |
| | | end-placeholder="选择结束月份" |
| | | :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="选择月份" |
| | | :placeholder="$t('plan.placeholder.selectMonth')" |
| | | /> |
| | | </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-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-row> |
| | | </el-form> |
| | |
| | | @click="handleExport" |
| | | v-hasPermi="['aps:apsGasPipingRouteStat:exportExcel']" |
| | | :disabled="loading" |
| | | >导出</el-button |
| | | >{{ $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="['aps:apsGasPipingRouteStat:computeCapacity']" |
| | | :disabled="loading" |
| | | >更新</el-button |
| | | >{{ $t("common.common.update") }}</el-button |
| | | > |
| | | </el-col> |
| | | <right-toolbar @queryTable="handleQuery" :search="false"></right-toolbar> |
| | |
| | | import { ref } from "vue"; |
| | | import * as XLSX from "xlsx"; |
| | | import { ElMessage } from "element-plus"; |
| | | import { useI18n } from "vue-i18n"; //要在js中使用国际化 |
| | | const { t, locale } = useI18n(); |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const loading = ref(false); |
| | |
| | | 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, |
| | |
| | | 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; |
| | | } |
| | | getGasList(); |
| | | },{ immediate: true, deep: true }); |
| | | function handleChangeSelectType(e) { |
| | | searchTypeValue.value = e; |
| | | if (e === "day") { |
| | |
| | | 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", |
| | | }, |
| | |
| | | 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", |
| | | }, |
| | |
| | | tableKey++; |
| | | item[`designTimes${tableKey}`] = listItem.designTimes; |
| | | item[`requireTimes${tableKey}`] = listItem.requireTimes; |
| | | item[`capacityLoad${tableKey}`] = formatCapacityLoad(listItem.designTimes,listItem.requireTimes,listItem.capacityLoad) |
| | | item[`capacityLoad${tableKey}`] = formatCapacityLoad( |
| | | listItem.designTimes, |
| | | listItem.requireTimes, |
| | | listItem.capacityLoad |
| | | ); |
| | | data.push(listItem.designTimes); |
| | | data.push(listItem.requireTimes); |
| | | data.push(listItem.capacityLoad + "%"); |
| | |
| | | } |
| | | }); |
| | | } |
| | | function formatCapacityLoad(designTimes,requireTimes,capacityLoad){ |
| | | 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}%` |
| | | 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}%`; |
| | | } |
| | | } |
| | | /** 导出按钮操作 */ |
| | |
| | | (!queryParams.value.monthDays && dayCom.value == true) |
| | | ) { |
| | | ElMessage({ |
| | | message: "请选择年月", |
| | | message: t("plan.message.errorMonthEmpty"), |
| | | type: "error", |
| | | }); |
| | | return; |
| | |
| | | (!queryParams.value.monthDays && dayCom.value == true) |
| | | ) { |
| | | ElMessage({ |
| | | message: "请选择年月", |
| | | message: t("plan.message.errorMonthEmpty"), |
| | | type: "error", |
| | | }); |
| | | return; |
| | |
| | | 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; |
| | |
| | | (!queryParams.value.monthDays && dayCom.value == true) |
| | | ) { |
| | | ElMessage({ |
| | | message: "请选择年月", |
| | | message: t("plan.message.errorMonthEmpty"), |
| | | type: "error", |
| | | }); |
| | | return; |
| | |
| | | major: "gas", |
| | | }).then((response) => { |
| | | ElMessage({ |
| | | message: "数据更新成功", |
| | | message: t("plan.message.update"), |
| | | type: "success", |
| | | }); |
| | | loading.value = false; |