From 2d0dd4f12d0f58c45e8c1de919b689bd97b88b08 Mon Sep 17 00:00:00 2001
From: luohairen <3399054449@qq.com>
Date: 星期一, 25 十一月 2024 20:40:28 +0800
Subject: [PATCH] 项目计划记录展示
---
src/views/project/plan/index.vue | 13 ++
src/api/project/plan/index.js | 10 ++
src/views/project/plan/planRecord.vue | 204 +++++++++++++++++++++++++++++++++++++++++++++++++++
src/router/index.js | 7 +
4 files changed, 231 insertions(+), 3 deletions(-)
diff --git a/src/api/project/plan/index.js b/src/api/project/plan/index.js
index fc3bb10..0bc549b 100644
--- a/src/api/project/plan/index.js
+++ b/src/api/project/plan/index.js
@@ -9,6 +9,14 @@
})
}
+// 鏌ヨ鏈堝害璁″垝鍒楄〃
+export function getPlanRecordList(id) {
+ return request({
+ url: '/api/project-plan-record/' + id,
+ method: 'post'
+ })
+}
+
// 鏌ヨ椤圭洰璁″垝璁板綍璇︾粏
export function getRecord(id) {
return request({
@@ -20,7 +28,7 @@
// 鏂板椤圭洰璁″垝璁板綍
export function addRecord(data) {
return request({
- url: '/plan/record',
+ url: '/api/project-plan-record',
method: 'post',
data: data
})
diff --git a/src/router/index.js b/src/router/index.js
index e0917a0..15e528b 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -110,6 +110,13 @@
component: () => import('@/views/project/plan/index'),
name: 'Index',
meta: { title: '椤圭洰璁″垝' }
+ },
+ /** 椤圭洰璁″垝璁板綍 */
+ {
+ path: '/plan/planRecord',
+ component: () => import('@/views/project/plan/planRecord'),
+ name: 'PlanRecord',
+ meta: { title: '椤圭洰璁″垝璁板綍' }
}
]
},
diff --git a/src/views/project/plan/index.vue b/src/views/project/plan/index.vue
index 4093878..838134b 100644
--- a/src/views/project/plan/index.vue
+++ b/src/views/project/plan/index.vue
@@ -192,7 +192,7 @@
size="mini"
type="text"
icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
+ @click="handlePlanRecord(scope.row)"
>鏌ョ湅</el-button>
<el-button
size="mini"
@@ -252,7 +252,7 @@
import { getList, getRecord, delRecord, addRecord, updateRecord } from "@/api/project/plan/index";
export default {
- name: "Record",
+ name: "index",
data() {
return {
// 閬僵灞�
@@ -385,6 +385,15 @@
this.download('plan/record/export', {
...this.queryParams
}, `record_${new Date().getTime()}.xlsx`)
+ },
+ /** 鏌ョ湅椤圭洰璁″垝璁板綍 */
+ handlePlanRecord(row) {
+ this.$router.push({
+ path: '/plan/planRecord',
+ query: {
+ data: JSON.stringify(row)
+ }
+ })
}
}
};
diff --git a/src/views/project/plan/planRecord.vue b/src/views/project/plan/planRecord.vue
new file mode 100644
index 0000000..63e6f5e
--- /dev/null
+++ b/src/views/project/plan/planRecord.vue
@@ -0,0 +1,204 @@
+<template>
+ <div class="app-container">
+ <el-container>
+ <el-header v-show="planInfoData && planInfoData.projectName" class="header-title">椤圭洰鍚嶇О锛歿{ planInfoData.projectName }}</el-header>
+ <h4 v-show="planInfoData && planInfoData.projectCode" style="text-align: center">椤圭洰浠g爜锛歿{ planInfoData.projectCode }}</h4>
+ <el-main>
+ <el-card shadow="hover">
+ <el-row :gutter="20">
+ <el-col :span="24" class="mb-4">
+ <span>鏈堝害璁″垝</span>
+ <el-button type="primary" size="small" style="float: right" @click="handleAddMonthPlan">鏂板</el-button>
+ <el-table :data="monthRecords" style="width: 100%">
+ <!-- 琛ㄥご -->
+ <el-table-column prop="id" label="搴忓彿"></el-table-column>
+ <el-table-column prop="projectName" label="椤圭洰鍚嶇О"></el-table-column>
+ <el-table-column prop="projectCode" label="椤圭洰浠g爜"></el-table-column>
+ <el-table-column label="璁″垝鏈�">
+ <template slot-scope="scope">
+ <span>
+ {{ scope.row.planTime }}{{ scope.row.planTimeFlag === 0 ? '鏈堝害' : scope.row.planTimeFlag === 1 ? '瀛e害' : '骞村害' }}
+ </span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="createTime" label="鍒涘缓鏃堕棿"></el-table-column>
+ <el-table-column fixed="right" label="鎿嶄綔">
+ <template slot-scope="scope">
+ <el-button type="primary" size="small" :disabled="scope.row.reportStatus === 0">缂栬緫涓婃姤</el-button>
+ <el-button type="danger" size="small">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-col>
+ <el-col :span="24" class="mb-4" style="margin-top: 20px">
+ <span>瀛e害璁″垝</span>
+ <el-button type="primary" size="small" style="float: right" @click="handleAddSeasonPlan">鏂板</el-button>
+ <el-table :data="seasonRecords" style="width: 100%">
+ <!-- 琛ㄥご -->
+ <el-table-column prop="id" label="搴忓彿"></el-table-column>
+ <el-table-column prop="projectName" label="椤圭洰鍚嶇О"></el-table-column>
+ <el-table-column prop="projectCode" label="椤圭洰浠g爜"></el-table-column>
+ <el-table-column label="璁″垝鏈�">
+ <template slot-scope="scope">
+ <span>
+ {{ scope.row.planTime }}{{ scope.row.planTimeFlag === 0 ? '鏈堝害' : scope.row.planTimeFlag === 1 ? '瀛e害' : '骞村害' }}
+ </span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="createTime" label="鍒涘缓鏃堕棿"></el-table-column>
+ <el-table-column fixed="right" label="鎿嶄綔">
+ <template slot-scope="scope">
+ <el-button type="primary" size="small" :disabled="scope.row.reportStatus === 0">缂栬緫涓婃姤</el-button>
+ <el-button type="danger" size="small">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-col>
+ <el-col :span="24" class="mb-4" style="margin-top: 20px">
+ <span>骞村害璁″垝</span>
+ <el-button type="primary" size="small" style="float: right" @click="handleAddYearPlan">鏂板</el-button>
+ <el-table :data="yearRecords" style="width: 100%">
+ <!-- 琛ㄥご -->
+ <el-table-column prop="id" label="搴忓彿"></el-table-column>
+ <el-table-column prop="projectName" label="椤圭洰鍚嶇О"></el-table-column>
+ <el-table-column prop="projectCode" label="椤圭洰浠g爜"></el-table-column>
+ <el-table-column label="璁″垝鏈�">
+ <template slot-scope="scope">
+ <span>
+ {{ scope.row.planTime }}{{ scope.row.planTimeFlag === 0 ? '鏈堝害' : scope.row.planTimeFlag === 1 ? '瀛e害' : '骞村害' }}
+ </span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="createTime" label="鍒涘缓鏃堕棿"></el-table-column>
+ <el-table-column fixed="right" label="鎿嶄綔">
+ <template slot-scope="scope">
+ <el-button type="primary" size="small" :disabled="scope.row.reportStatus === 0">缂栬緫涓婃姤</el-button>
+ <el-button type="danger" size="small">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-col>
+ </el-row>
+ </el-card>
+ </el-main>
+ </el-container>
+ </div>
+</template>
+
+<script>
+import {addRecord, getPlanRecordList} from "@/api/project/plan/index";
+
+export default {
+ // name: "planRecord",
+ data() {
+ return {
+ loading: true,
+ // 鎺ユ敹浼犻�掕繃鏉ョ殑椤圭洰璁″垝鏁版嵁
+ planInfoData: {},
+ // 鏈堝害璁″垝鏁版嵁
+ monthRecords: [],
+ // 瀛e害璁″垝鏁版嵁
+ seasonRecords: [],
+ // 骞村害璁″垝鏁版嵁
+ yearRecords: [],
+ // 鏂板璁″垝
+
+ }
+ },
+ methods: {
+ // 椤甸潰鍔犺浇
+ search() {
+ this.getPlanRecordData(this.planInfoData.id);
+ },
+ // 鑾峰彇浼犻�掕繃鏉ョ殑椤圭洰璁″垝璇︽儏
+ getPlanInfoData() {
+ // 浠庢煡璇㈠弬鏁颁腑鑾峰彇鏁版嵁
+ if (this.$route.query.data) {
+ this.planInfoData = JSON.parse(this.$route.query.data);
+ console.log(JSON.parse(this.$route.query.data))
+ this.getPlanRecordData(this.planInfoData.id);
+ }
+ },
+ // 鑾峰彇椤圭洰璁″垝璁板綍鏁版嵁
+ getPlanRecordData(id) {
+ this.loading = true;
+ getPlanRecordList(id).then(res => {
+ this.monthRecords = res.data.monthRecords;
+ // 鑾峰彇瀛e害璁″垝鏁版嵁
+ this.seasonRecords = res.data.seasonRecords;
+ // 鑾峰彇骞村害璁″垝鏁版嵁
+ this.yearRecords = res.data.yearRecords;
+ console.log(this.monthRecords);
+ this.loading = false;
+ })
+ },
+ // 鏂板鏈堝害璁″垝璁板綍
+ handleAddMonthPlan() {
+ let planRecordData = {
+ id: undefined,
+ projectInfoId: this.planInfoData.id,
+ planTimeFlag: 0
+ }
+ // 鍒ゆ柇鏈堝害璁″垝鏄惁涓虹┖
+ if (this.monthRecords.length === 0){
+ planRecordData.id = 0;
+ }else {
+ planRecordData.id = this.monthRecords[this.monthRecords.length - 1].id;
+ }
+ // 鏂板涓�琛岃褰�
+ addRecord(planRecordData).then(res => {
+ this.search();
+ });
+ },
+ // 鏂板瀛e害璁″垝璁板綍
+ handleAddSeasonPlan() {
+ let planRecordData = {
+ id: undefined,
+ projectInfoId: this.planInfoData.id,
+ planTimeFlag: 1
+ }
+ // 鍒ゆ柇瀛e害璁″垝鏄惁涓虹┖
+ if (this.seasonRecords.length === 0){
+ planRecordData.id = 0;
+ }else {
+ planRecordData.id = this.seasonRecords[this.seasonRecords.length - 1].id;
+ }
+ // 鏂板涓�琛岃褰�
+ addRecord(planRecordData).then(res => {
+ this.search();
+ });
+ },
+ // 鏂板骞村害璁″垝璁板綍
+ handleAddYearPlan() {
+ let planRecordData = {
+ id: undefined,
+ projectInfoId: this.planInfoData.id,
+ planTimeFlag: 2
+ }
+ // 鍒ゆ柇骞村害璁″垝鏄惁涓虹┖
+ if (this.yearRecords.length === 0){
+ planRecordData.id = 0;
+ }else {
+ planRecordData.id = this.yearRecords[this.yearRecords.length - 1].id;
+ }
+ // 鏂板涓�琛岃褰�
+ addRecord(planRecordData).then(res => {
+ this.search();
+ });
+ },
+
+ },
+ created() {
+ this.getPlanInfoData();
+ },
+};
+</script>
+
+<style scoped>
+.header-title {
+ font-size: 24px; /* 鏍规嵁闇�瑕佽皟鏁村瓧浣撳ぇ灏� */
+ text-align: center; /* 灞呬腑瀵归綈 */
+ line-height: 64px; /* 濡傛灉闇�瑕佷笌 header 楂樺害瀵归綈 */
+}
+</style>
+
--
Gitblit v1.8.0