diff --git a/src/common/utils/datetime.ts b/src/common/utils/datetime.ts index 3a0f8f5..563b95f 100644 --- a/src/common/utils/datetime.ts +++ b/src/common/utils/datetime.ts @@ -11,7 +11,7 @@ export function formatDateTime( return day.isValid() ? day.format(template) : INVALID_DATE; } -export function getDate(val: Date) { +export function getSpecificDate(val: Date) { let endY = val.getFullYear(); let endM = val.getMonth() + 1; let endD = val.getDate(); diff --git a/src/pages/demo/diceke/ExcavationQuantityReport.vue b/src/pages/demo/diceke/ExcavationQuantityReport.vue index bbdcd8b..4b37a9b 100644 --- a/src/pages/demo/diceke/ExcavationQuantityReport.vue +++ b/src/pages/demo/diceke/ExcavationQuantityReport.vue @@ -2,8 +2,8 @@ import { findTotalMiningByMonthApi, updateTotalMiningApi, -} from "@@/apis/tables/diceke/excavationQuantityReport.ts"; -import { getDate } from "@@/utils/datetime"; +} from "@@/apis/tables/diceke/ExcavationQuantityReport.ts"; +import { getSpecificDate } from "@@/utils/datetime"; export default { data() { return { @@ -23,7 +23,7 @@ export default { }, //按月查询 async getMouthLoss() { - let data = getDate(this.date); + let data = getSpecificDate(this.date); const res = await findTotalMiningByMonthApi(data); console.log(res); }, diff --git a/src/pages/demo/diceke/LossDepletionReport.vue b/src/pages/demo/diceke/LossDepletionReport.vue index c590af1..651f905 100644 --- a/src/pages/demo/diceke/LossDepletionReport.vue +++ b/src/pages/demo/diceke/LossDepletionReport.vue @@ -7,12 +7,14 @@ import { updatedicekeMininglossApi, savedicekeMininglossApi, } from "@@/apis/tables/diceke/LossDepletionReport.ts"; -import { getDate } from "@@/utils/datetime"; +import { getSpecificDate } from "@@/utils/datetime"; export default { data() { return { date: "", tableList: [], + dialogVisible: false, + lossReportForm: {}, }; }, created() { @@ -23,13 +25,12 @@ export default { //获取列表 async getList() { const res = await findAllMiningglossApi(); - console.log(res); + this.tableList = res.data.dicekeMininglossVoList; }, //按月查询 async getMouthLoss() { - let data = getDate(this.date); + let data = getSpecificDate(this.date); const res = await findLossByMonthApi(data); - console.log(res); }, removeDataById(id) { ElMessageBox.confirm("此操作将永久删除降水量记录,是否继续?", "提示", { @@ -38,7 +39,7 @@ export default { type: "warning", }) .then(() => { - deletePrecipitation(id).then(() => { + deletedicekeMininglossApi(id).then(() => { // 删除成功 ElMessage({ type: "success", @@ -55,58 +56,12 @@ export default { }); }); }, - handleAdd() { - this.isEdit = false; // 设置为新增操作 - this.precipitationform = { plateRange: "" }; // 初始化为空数据 - this.updateprecipitationform = true; // 显示弹窗 - }, + //修改 handleEdit(id) { - this.isEdit = true; - findPrecipitationById(id) - .then((Response) => { - this.precipitationform = Response.data.precipitationById; - console.log(this.precipitationform); - this.updateprecipitationform = true; - }) - .catch(() => { - ElMessage.error("查询失败,请稍后重试"); - }); - }, - formatMonth(dateTime) { - if (!dateTime) return "-"; - return dateTime.slice(0, 7); // 直接截取 "yyyy-MM" - // 或用 dayjs(需安装): - // return dayjs(dateTime).format('YYYY-MM'); - }, - updatePrecipitation() { - if (this.isEdit) { - updatePrecipitationApi(this.precipitationform) - .then(() => { - ElMessage({ - type: "success", - message: "修改成功!", - }); - this.updateprecipitationform = false; - this.getList(); - }) - .catch(() => { - ElMessage.error("修改失败,请稍后重试"); - }); - } else { - addPrecipitationApi(this.precipitationform) - .then(() => { - ElMessage({ - type: "success", - message: "新增成功!", - }); - this.updateprecipitationform = false; - this.getList(); - }) - .catch(() => { - ElMessage.error("新增失败,请稍后重试"); - }); - } + this.dialogVisible = true; }, + //修改提交 + lossReportSub() {}, }, }; @@ -133,30 +88,34 @@ export default { :cell-style="rowStyle" > - - - - - - + + + + + + - - - + + + - - + + diff --git a/src/router/index.ts b/src/router/index.ts index 1aa077e..f33ca8b 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -207,7 +207,7 @@ export const constantRoutes: RouteRecordRaw[] = [ }, { path: "excavationQuantityReport", - component: () => import("@/pages/demo/diceke/excavationQuantityReport.vue"), + component: () => import("@/pages/demo/diceke/ExcavationQuantityReport.vue"), name: "", meta: { title: "采剥量报表",