commit
Some checks failed
Build And Deploy v3-admin-vite / build-and-deploy (push) Has been cancelled

This commit is contained in:
吕杰刚 2025-11-25 21:00:46 +08:00
parent a86213eb9e
commit 58098e6542
3 changed files with 293 additions and 107 deletions

View File

@ -23,3 +23,43 @@ export function getSpecificDate(val: Date) {
(endD < 10 ? "0" + endD : endD); (endD < 10 ? "0" + endD : endD);
return enddate; return enddate;
} }
// 将时间转为年月日
export function formatDateToChinese(dateString: any) {
const date = new Date(dateString);
const year = date.getFullYear();
const month = date.getMonth() + 1; // 月份从0开始需要+1
const day = date.getDate();
return `${year}${month}${day}`;
}
// 中文转英文函数
export function formatChineseToEnglish(chineseDate: any) {
// 使用正则表达式提取年、月、日
const match = chineseDate.match(/(\d{4})年(\d{1,2})月(\d{1,2})日/);
console.log(match);
if (!match) {
throw new Error('日期格式不正确');
}
const year = parseInt(match[1]);
const month = parseInt(match[2]) - 1; // 月份从0开始需要-1
const day = parseInt(match[3]);
const date = new Date(year, month, day);
// 星期名称数组
const weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
// 月份名称数组
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const weekday = weekdays[date.getDay()];
const monthName = months[date.getMonth()];
// 格式化日期部分,确保日为两位数
const formattedDay = day < 10 ? '0' + day : day;
return `${weekday} ${monthName} ${formattedDay} ${year} 00:00:00 GMT+0800`;
}

View File

@ -116,7 +116,7 @@ export default {
<div class="daiban-top"><i class="iconfont wodeyiban"></i></div> <div class="daiban-top"><i class="iconfont wodeyiban"></i></div>
<div <div
class="daiban-center" class="daiban-center"
style="font-size: 24px; font-weight: 700; margin: 20px" style="font-size: 24px; font-weight: 700; margin: 10px"
> >
12 12
</div> </div>
@ -126,7 +126,7 @@ export default {
<div class="yiban-top"><i class="iconfont daibanrenwu"></i></div> <div class="yiban-top"><i class="iconfont daibanrenwu"></i></div>
<div <div
class="yiban-center" class="yiban-center"
style="font-size: 24px; font-weight: 700; margin: 20px" style="font-size: 24px; font-weight: 700; margin: 10px"
> >
0 0
</div> </div>
@ -136,7 +136,7 @@ export default {
<div class="jinji-top"><i class="iconfont jinjianniu"></i></div> <div class="jinji-top"><i class="iconfont jinjianniu"></i></div>
<div <div
class="jinji-center" class="jinji-center"
style="font-size: 24px; font-weight: 700; margin: 20px" style="font-size: 24px; font-weight: 700; margin: 10px"
> >
0 0
</div> </div>
@ -146,7 +146,7 @@ export default {
<div class="taskAll-top"><i class="iconfont suoyou"></i></div> <div class="taskAll-top"><i class="iconfont suoyou"></i></div>
<div <div
class="taskAll-center" class="taskAll-center"
style="font-size: 24px; font-weight: 700; margin: 20px" style="font-size: 24px; font-weight: 700; margin: 10px"
> >
0 0
</div> </div>
@ -176,7 +176,7 @@ export default {
height: 100%; height: 100%;
.function-bar { .function-bar {
display: flex; display: flex;
height: 30%; height: 20%;
margin: 10px; margin: 10px;
i { i {
font-size: 36px; font-size: 36px;
@ -201,14 +201,29 @@ export default {
} }
.one-box { .one-box {
margin-left: 0; margin-left: 0;
background: linear-gradient(
135deg,
#c7e9fb,
#a6defa,
#80d4f9,
#5bc9f8,
#35bef7
);
}
.two-box {
background: linear-gradient(135deg, #f6d365, #fda085);
}
.three-box {
background: linear-gradient(135deg, #f69165, #f14115);
} }
.four-box { .four-box {
margin-right: 0; margin-right: 0;
background: linear-gradient(135deg, #65e0f6, #0abbec);
} }
} }
.echarts-bar { .echarts-bar {
display: flex; display: flex;
height: 65%; height: 70%;
// /* */ // /* */
.card { .card {
width: 50%; width: 50%;

View File

@ -1,63 +1,154 @@
<script> <script >
import {} from "@@/apis/tables/drainageWorkshop/pumpOperationLog.ts"; import {
import { getSpecificDate } from "@@/utils/datetime"; formatDateToChinese,
formatChineseToEnglish,
} from "@/common/utils/datetime.ts";
export default { export default {
data() { data() {
return { return {
date: "", date: "",
tableList: [ tableList: [
{ {
projectName: "运矿量", date: "2025年11月21日",
unit: "节", id: "69",
month: { plan: "15167", actual: "15624", percentage: "103.01" }, shift: "早班",
cumulativeForMonth: { mineralcapacity: "100",
plan: "", },
actual: "", {
percentage: "", date: "2025年11月21日",
}, id: "69",
notes: "每次交班必须至少留1列重矿在葵站待命", shift: "中班",
mineralcapacity: "200",
},
{
date: "2025年11月21日",
id: "69",
shift: "晚班",
mineralcapacity: "500",
},
{
date: "2025年11月22日",
id: "70",
shift: "早班",
mineralcapacity: "350",
},
{
date: "2025年11月22日",
id: "70",
shift: "中班",
mineralcapacity: "260",
},
{
date: "2025年11月22日",
id: "70",
shift: "晚班",
mineralcapacity: "400",
},
{
date: "2025年11月25日",
id: "01",
shift: "早班",
mineralcapacity: "200",
},
{
date: "2025年11月25日",
id: "01",
shift: "中班",
mineralcapacity: "150",
},
{
date: "2025年11月25日",
id: "01",
shift: "晚班",
mineralcapacity: "300",
},
{
date: "2025年11月25日",
id: "03",
shift: "早班",
mineralcapacity: "100",
},
{
date: "2025年11月25日",
id: "03",
shift: "中班",
mineralcapacity: "200",
},
{
date: "2025年11月25日",
id: "03",
shift: "晚班",
mineralcapacity: "500",
}, },
{ projectName: "其中:东倒", unit: "节", month: { plan: "" } },
{ projectName: "西倒", unit: "节" },
{ projectName: "", unit: "单位" },
{ projectName: "装车质量", unit: "t/列" },
{ projectName: "电机车周转量", unit: "吨公里" },
{ projectName: "电机车综合效率", unit: "吨台班" },
{ projectName: "电机车出车率(台班)", unit: "吨" },
{ projectName: "电机作业率(分时)", unit: "吨" },
{ projectName: "电机车完好率(台班)", unit: "吨" },
{ projectName: "", unit: "单位" },
{ projectName: "列车周转时间", unit: "分" },
{ projectName: "大选厂卸车数" },
], ],
dialogFormVisible: false,
title: "",
form: {
date: "",
shift: "",
id: "",
mineralcapacity: "",
},
formLabelWidth: 140,
index: 0,
}; };
}, },
created() { created() {},
// methods
this.getList();
},
methods: { methods: {
// //
async getList() { addDayReportDialog() {
// const res = await findAllMiningglossApi(); this.dialogFormVisible = true;
// console.log(res); this.title = "添加日报";
}, },
// //
async getMouthLoss() { addDayReportSub() {
let data = getSpecificDate(this.date); this.form.date = formatDateToChinese(this.form.date);
const res = await findTotalMiningByMonthApi(data); if ((this.tilte = "编辑日报")) {
console.log(res); this.tableList[this.index] = this.form;
}, } else {
// this.tableList.push(this.form);
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) {
if (rowIndex === 12) {
return {
rowspan: 1,
colspan: 1,
};
}
} }
this.dialogFormVisible = false;
},
//excel
excelImport() {},
//
dayreportExport() {},
handleSelectionChange(val) {
console.log(val);
},
//
handleEdit(index, row) {
this.index = index;
this.title = "编辑日报";
this.dialogFormVisible = true;
this.form.date = formatChineseToEnglish(row.date);
this.form.id = row.id;
this.form.mineralcapacity = row.mineralcapacity;
this.form.shift = row.shift;
},
//
handleDelete(index, row) {
console.log(index, row);
ElMessageBox.confirm("此操作将永久删除此记录,是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.tableList.splice(index, 1);
//
ElMessage({
type: "success",
message: "删除成功!",
});
})
.catch(() => {
ElMessage({
type: "info",
message: "已取消删除",
});
});
}, },
}, },
}; };
@ -66,73 +157,77 @@ export default {
<template> <template>
<div class="app-container"> <div class="app-container">
<div style="margin-bottom: 20px"> <div style="margin-bottom: 20px">
<el-date-picker v-model="date" type="month" placeholder="选择年月"> <el-date-picker
</el-date-picker> v-model="date"
type="date"
placeholder="请选择时间"
format="YYYY/MM/DD"
/>
<el-button <el-button
type="primary" type="primary"
size="mini" size="mini"
style="margin-left: 20px" style="margin-left: 20px"
@click="getMouthLoss" @click="getMouthLoss"
>查询</el-button icon="Search"
> </el-button
>
<el-button
type="primary"
size="mini"
style="margin-left: 20px"
@click="addDayReportDialog"
icon="CirclePlus"
>添加日报</el-button
>
<el-button
type="success"
size="mini"
style="margin-left: 20px"
@click="excelImport"
icon="Upload"
>excel导入</el-button
>
<el-button
type="warning"
size="mini"
style="margin-left: 20px"
@click="dayreportExport"
icon="Document"
>日报导出</el-button
> >
</div> </div>
<el-table <el-table
:data="tableList" :data="tableList"
border border
style="width: 100%" style="width: 100%"
:span-method="objectSpanMethod" :header-cell-style="{ 'text-align': 'center' }"
:header-align="center" :cell-style="{ 'text-align': 'center' }"
@selection-change="handleSelectionChange"
> >
<el-table-column <el-table-column type="selection" width="55" :selectable="selectable" />
align="center" <el-table-column prop="date" label="时间" />
prop="projectName" <el-table-column prop="id" label="铲号" />
fixed <el-table-column prop="shift" label="班次" />
label="项目" <el-table-column prop="mineralcapacity" label="装矿量" />
></el-table-column> <el-table-column fixed="right" label="操作" min-width="120">
<el-table-column <template #default="scope">
align="center" <el-button
prop="unit" type="primary"
label="单位" size="small"
></el-table-column> @click="handleEdit(scope.$index, scope.row)"
<el-table-column align="center" prop="amount" label="月份"> icon="Edit"
<el-table-column >编辑</el-button
align="center" >
prop="month.plan" <el-button
label="计划" type="danger"
></el-table-column> size="small"
<el-table-column @click="handleDelete(scope.$index, scope.row)"
align="center" icon="Delete"
prop="month.actual" >
label="实际" 删除
></el-table-column> </el-button>
<el-table-column </template>
align="center"
prop="month.percentage"
label="%"
></el-table-column>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="amount" label="一月份累计">
<el-table-column
align="center"
prop="cumulativeForMonth.plan"
label="计划"
></el-table-column>
<el-table-column
align="center"
prop="cumulativeForMonth.actual"
label="实际"
></el-table-column>
<el-table-column
align="center"
prop="cumulativeForMonth.percentage"
label="%"
></el-table-column>
</el-table-column>
<el-table-column
align="center"
prop="notes"
label="备注"
></el-table-column>
<!-- 空数据时的显示 --> <!-- 空数据时的显示 -->
<template #empty> <template #empty>
<div style="display: grid; place-items: center center"> <div style="display: grid; place-items: center center">
@ -140,5 +235,41 @@ export default {
</div> </div>
</template> </template>
</el-table> </el-table>
<el-dialog v-model="dialogFormVisible" :title="title" width="800">
<el-form :model="form">
<el-form-item label="时间" :label-width="formLabelWidth">
<el-date-picker
v-model="form.date"
type="date"
placeholder="请选择时间"
format="YYYY/MM/DD"
/>
</el-form-item>
<el-form-item label="铲号" :label-width="formLabelWidth">
<el-select v-model="form.id" placeholder="请选择铲号">
<el-option label="01" value="01" />
<el-option label="10" value="10" />
<el-option label="69" value="69" />
<el-option label="70" value="70" />
</el-select>
</el-form-item>
<el-form-item label="班次" :label-width="formLabelWidth">
<el-select v-model="form.shift" placeholder="请选择班次">
<el-option label="早班" value="早班" />
<el-option label="中班" value="中班" />
<el-option label="晚班" value="晚班" />
</el-select>
</el-form-item>
<el-form-item label="装矿量" :label-width="formLabelWidth">
<el-input v-model="form.mineralcapacity" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="addDayReportSub"> </el-button>
</div>
</template>
</el-dialog>
</div> </div>
</template> </template>