commit
Some checks failed
Build And Deploy v3-admin-vite / build-and-deploy (push) Has been cancelled
Some checks failed
Build And Deploy v3-admin-vite / build-and-deploy (push) Has been cancelled
This commit is contained in:
parent
a86213eb9e
commit
58098e6542
@ -23,3 +23,43 @@ export function getSpecificDate(val: Date) {
|
||||
(endD < 10 ? "0" + endD : endD);
|
||||
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`;
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ export default {
|
||||
<div class="daiban-top"><i class="iconfont wodeyiban"></i></div>
|
||||
<div
|
||||
class="daiban-center"
|
||||
style="font-size: 24px; font-weight: 700; margin: 20px"
|
||||
style="font-size: 24px; font-weight: 700; margin: 10px"
|
||||
>
|
||||
12
|
||||
</div>
|
||||
@ -126,7 +126,7 @@ export default {
|
||||
<div class="yiban-top"><i class="iconfont daibanrenwu"></i></div>
|
||||
<div
|
||||
class="yiban-center"
|
||||
style="font-size: 24px; font-weight: 700; margin: 20px"
|
||||
style="font-size: 24px; font-weight: 700; margin: 10px"
|
||||
>
|
||||
0
|
||||
</div>
|
||||
@ -136,7 +136,7 @@ export default {
|
||||
<div class="jinji-top"><i class="iconfont jinjianniu"></i></div>
|
||||
<div
|
||||
class="jinji-center"
|
||||
style="font-size: 24px; font-weight: 700; margin: 20px"
|
||||
style="font-size: 24px; font-weight: 700; margin: 10px"
|
||||
>
|
||||
0
|
||||
</div>
|
||||
@ -146,7 +146,7 @@ export default {
|
||||
<div class="taskAll-top"><i class="iconfont suoyou"></i></div>
|
||||
<div
|
||||
class="taskAll-center"
|
||||
style="font-size: 24px; font-weight: 700; margin: 20px"
|
||||
style="font-size: 24px; font-weight: 700; margin: 10px"
|
||||
>
|
||||
0
|
||||
</div>
|
||||
@ -176,7 +176,7 @@ export default {
|
||||
height: 100%;
|
||||
.function-bar {
|
||||
display: flex;
|
||||
height: 30%;
|
||||
height: 20%;
|
||||
margin: 10px;
|
||||
i {
|
||||
font-size: 36px;
|
||||
@ -201,14 +201,29 @@ export default {
|
||||
}
|
||||
.one-box {
|
||||
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 {
|
||||
margin-right: 0;
|
||||
background: linear-gradient(135deg, #65e0f6, #0abbec);
|
||||
}
|
||||
}
|
||||
.echarts-bar {
|
||||
display: flex;
|
||||
height: 65%;
|
||||
height: 70%;
|
||||
// /* 卡片样式 */
|
||||
.card {
|
||||
width: 50%;
|
||||
|
||||
@ -1,63 +1,154 @@
|
||||
<script>
|
||||
import {} from "@@/apis/tables/drainageWorkshop/pumpOperationLog.ts";
|
||||
import { getSpecificDate } from "@@/utils/datetime";
|
||||
<script >
|
||||
import {
|
||||
formatDateToChinese,
|
||||
formatChineseToEnglish,
|
||||
} from "@/common/utils/datetime.ts";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
date: "",
|
||||
tableList: [
|
||||
{
|
||||
projectName: "运矿量",
|
||||
unit: "节",
|
||||
month: { plan: "15167", actual: "15624", percentage: "103.01" },
|
||||
cumulativeForMonth: {
|
||||
plan: "",
|
||||
actual: "",
|
||||
percentage: "",
|
||||
},
|
||||
notes: "每次交班必须至少留1列重矿,在葵站待命",
|
||||
date: "2025年11月21日",
|
||||
id: "69",
|
||||
shift: "早班",
|
||||
mineralcapacity: "100",
|
||||
},
|
||||
{
|
||||
date: "2025年11月21日",
|
||||
id: "69",
|
||||
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() {
|
||||
// 页面渲染之前执行,一般调用methods定义的方法
|
||||
this.getList();
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
//获取列表
|
||||
async getList() {
|
||||
// const res = await findAllMiningglossApi();
|
||||
// console.log(res);
|
||||
//添加日报
|
||||
addDayReportDialog() {
|
||||
this.dialogFormVisible = true;
|
||||
this.title = "添加日报";
|
||||
},
|
||||
//按月查询
|
||||
async getMouthLoss() {
|
||||
let data = getSpecificDate(this.date);
|
||||
const res = await findTotalMiningByMonthApi(data);
|
||||
console.log(res);
|
||||
},
|
||||
// 合并
|
||||
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
||||
if (columnIndex === 0) {
|
||||
if (rowIndex === 12) {
|
||||
return {
|
||||
rowspan: 1,
|
||||
colspan: 1,
|
||||
};
|
||||
}
|
||||
//提交日报
|
||||
addDayReportSub() {
|
||||
this.form.date = formatDateToChinese(this.form.date);
|
||||
if ((this.tilte = "编辑日报")) {
|
||||
this.tableList[this.index] = this.form;
|
||||
} else {
|
||||
this.tableList.push(this.form);
|
||||
}
|
||||
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>
|
||||
<div class="app-container">
|
||||
<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
|
||||
type="primary"
|
||||
size="mini"
|
||||
style="margin-left: 20px"
|
||||
@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>
|
||||
<el-table
|
||||
:data="tableList"
|
||||
border
|
||||
style="width: 100%"
|
||||
:span-method="objectSpanMethod"
|
||||
:header-align="center"
|
||||
:header-cell-style="{ 'text-align': 'center' }"
|
||||
:cell-style="{ 'text-align': 'center' }"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="projectName"
|
||||
fixed
|
||||
label="项目"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="unit"
|
||||
label="单位"
|
||||
></el-table-column>
|
||||
<el-table-column align="center" prop="amount" label="月份">
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="month.plan"
|
||||
label="计划"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="month.actual"
|
||||
label="实际"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="month.percentage"
|
||||
label="%"
|
||||
></el-table-column>
|
||||
<el-table-column type="selection" width="55" :selectable="selectable" />
|
||||
<el-table-column prop="date" label="时间" />
|
||||
<el-table-column prop="id" label="铲号" />
|
||||
<el-table-column prop="shift" label="班次" />
|
||||
<el-table-column prop="mineralcapacity" label="装矿量" />
|
||||
<el-table-column fixed="right" label="操作" min-width="120">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleEdit(scope.$index, scope.row)"
|
||||
icon="Edit"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="handleDelete(scope.$index, scope.row)"
|
||||
icon="Delete"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</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>
|
||||
<div style="display: grid; place-items: center center">
|
||||
@ -140,5 +235,41 @@ export default {
|
||||
</div>
|
||||
</template>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user