luohairen
2024-11-26 17ce03611f5a845a7a867f96965a587fb63ae71a
查看计划项页面
3个文件已修改
1个文件已添加
196 ■■■■■ 已修改文件
src/api/projectPlan/index.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/projectPlan/planInfoCheck.vue 152 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/projectPlan/planRecord.vue 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/projectPlan/index.js
@@ -44,9 +44,9 @@
}
// 删除项目计划记录
export function delRecord(id) {
export function deletePlanRecord(id) {
  return request({
    url: '/plan/record/' + id,
    url: '/api/project-plan-record/' + id,
    method: 'delete'
  })
}
src/router/index.js
@@ -196,12 +196,19 @@
        name: 'PlanRecord',
        meta: { title: '项目计划记录' }
      },
      /** 项目计划项 */
      /** 编辑项目计划项 */
      {
        path: '/projectPlan/planInfo',
        component: () => import('@/views/projectPlan/planInfo'),
        name: 'PlanInfo',
        meta: { title: '项目计划项' }
        meta: { title: '编辑项目计划项' }
      },
      /** 查看项目计划项 */
      {
        path: '/projectPlan/planInfoCheck',
        component: () => import('@/views/projectPlan/planInfoCheck'),
        name: 'PlanInfoCheck',
        meta: { title: '查看项目计划项' }
      }
    ]
  },
src/views/projectPlan/planInfoCheck.vue
New file
@@ -0,0 +1,152 @@
<template>
  <div class="app-container">
    <el-container>
      <el-header v-show="planRecordData && planRecordData.projectName" class="header-title">项目名称:{{ planRecordData.projectName }} {{ planRecordData.planTimeFlag === 0 ? '(月度计划)' : planRecordData.planTimeFlag === 1 ? '(季度计划)' : '(年度计划)' }}</el-header>
      <h4 v-show="planRecordData && planRecordData.projectCode" style="text-align: center">项目代码:{{ planRecordData.projectCode }}</h4>
      <el-main>
        <el-card shadow="hover">
          <el-row :gutter="20">
            <el-col :span="24" class="mb-4">
              <el-table :data="tableData" border stripe style="width: 100%; margin-bottom: 20px">
                <el-table-column prop="index" label="序号" width="50" align="center">
                  <template #default="scope">
                    {{ scope.$index + 1 }}
                  </template>
                </el-table-column>
                <el-table-column prop="taskName" label="事项名称" width="500" align="center">
                  <template #default="scope">
                    <el-input type="textarea" v-model="scope.row.title" placeholder="请输入" rows="3" />
                  </template>
                </el-table-column>
                <el-table-column prop="startTime" label="计划开始时间" width="160" align="center">
                  <template #default="scope">
                    <el-date-picker v-model="scope.row.startTime" type="date" placeholder="选择日期" size="small" style="width: 130px" />
                  </template>
                </el-table-column>
                <el-table-column prop="endTime" label="计划完成时间" width="160" align="center">
                  <template #default="scope">
                    <el-date-picker v-model="scope.row.endTime" type="date" placeholder="选择日期" size="small" style="width: 130px" />
                  </template>
                </el-table-column>
                <el-table-column :label="planRecordData.planTimeFlag === 0 ? '月度' : planRecordData.planTimeFlag === 1 ? '季度' : '年度' " width="100" align="center">
                  <template #default="scope">
                    <span>{{ planRecordData.planTime }}{{ planRecordData.planTimeFlag === 0 ? '月度' : planRecordData.planTimeFlag === 1 ? '季度' : '年度' }}</span>
                  </template>
                </el-table-column>
                <el-table-column fixed="right" label="操作" align="center">
                  <template #default="scope">
                    <el-button size="small" @click="handleDelay(scope.$index)">延期</el-button>
                    <el-button size="small" type="danger" @click="handleReset(scope.$index)">重置</el-button>
                    <el-button size="small" type="danger" @click="handleDelete(scope.$index)">删除</el-button>
                  </template>
                </el-table-column>
              </el-table>
              <div style="display: flex; align-items: center;">
                <h1 style="margin: 0;">
                  截止本计划进度完成投资(万元):
                </h1>
                <el-input
                  placeholder="请输入投资金额"
                  style="flex: 1"
                  v-model="actualInvest"
                  clearable
                  :type="number"
                  @input="handleInput">
                </el-input>
              </div>
            </el-col>
          </el-row>
        </el-card>
      </el-main>
    </el-container>
  </div>
</template>
<script>
import { getPlanInfoData, addPlanInfo, savePlanInfo } from "@/api/projectPlan/index";
export default {
  name: "planInfoCheck",
  data() {
    return {
      loading: true,
      // 接收传递过来的项目计划数据
      planRecordData: {},
      planInfoData: {},
      tableData: [
        {
          title: '',
          startTime: '',
          endTime: ''
        },
      ],
      // 投资金额
      actualInvest: '',
      // 新增参数
      addData: {
        projectPlanRecordId: '',
        actualInvest: '',
        addList:[]
      }
    }
  },
  methods: {
    // 页面加载
    search() {
      this.getPlanInfoData(this.planRecordData.id);
    },
    // 获取传递过来的项目计划详情
    getPlanRecordData() {
      // 从查询参数中获取数据
      if (this.$route.query.data) {
        this.planRecordData = JSON.parse(this.$route.query.data)
      }
      this.planInfoData = this.$route.query.planInfoData
      this.search();
    },
    // 获取项目计划项
    getPlanInfoData(id) {
      getPlanInfoData(id).then(response => {
        this.actualInvest = response.data.actualInvest;
        if (response.data.list.length === 0){
          this.tableData = [{ title: '', startTime: '', endTime: '' }];
        }else {
          this.tableData = response.data.list;
        }
      });
    },
    // 删除一行数据
    handleDelete(index) {
      this.tableData.splice(index, 1);
    },
    // 重置当前行数据
    handleReset(index) {
      this.tableData[index].title = '';
      this.tableData[index].startTime = '';
      this.tableData[index].endTime = '';
    },
    /** 返回项目计划记录页面 */
    handlePlanRecord(planInfoData) {
      this.$router.push({
        path: '/projectPlan/planRecord',
        query: {
          data: JSON.stringify(planInfoData)
        }
      })
    }
  },
  created() {
    this.getPlanRecordData();
  },
};
</script>
<style scoped>
.header-title {
  font-size: 24px; /* 根据需要调整字体大小 */
  text-align: center; /* 居中对齐 */
  line-height: 64px; /* 如果需要与 header 高度对齐 */
}
</style>
src/views/projectPlan/planRecord.vue
@@ -25,7 +25,8 @@
                <el-table-column fixed="right" label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button type="primary" size="small" :disabled="scope.row.reportStatus === 0" @click="handlePlanInfo(scope.row)">编辑上报</el-button>
                    <el-button type="danger" size="small">删除</el-button>
                    <el-button type="danger" size="small" v-show="scope.row.reportStatus === 1" @click="handleDeletePlanRecord(scope.row.id)">删除</el-button>
                    <el-button type="danger" size="small" v-show="scope.row.reportStatus === 0" @click="handleCheckPlanInfo(scope.row)">查看</el-button>
                  </template>
                </el-table-column>
              </el-table>
@@ -49,7 +50,8 @@
                <el-table-column fixed="right" label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button type="primary" size="small" :disabled="scope.row.reportStatus === 0" @click="handlePlanInfo(scope.row)">编辑上报</el-button>
                    <el-button type="danger" size="small">删除</el-button>
                    <el-button type="danger" size="small" v-show="scope.row.reportStatus === 1" @click="handleDeletePlanRecord(scope.row.id)">删除</el-button>
                    <el-button type="danger" size="small" v-show="scope.row.reportStatus === 0" @click="handleCheckPlanInfo(scope.row)">查看</el-button>
                  </template>
                </el-table-column>
              </el-table>
@@ -73,7 +75,8 @@
                <el-table-column fixed="right" label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button type="primary" size="small" :disabled="scope.row.reportStatus === 0" @click="handlePlanInfo(scope.row)">编辑上报</el-button>
                    <el-button type="danger" size="small">删除</el-button>
                    <el-button type="danger" size="small" v-show="scope.row.reportStatus === 1" @click="handleDeletePlanRecord(scope.row.id)">删除</el-button>
                    <el-button type="danger" size="small" v-show="scope.row.reportStatus === 0" @click="handleCheckPlanInfo(scope.row)">查看</el-button>
                  </template>
                </el-table-column>
              </el-table>
@@ -86,7 +89,7 @@
</template>
<script>
import {addRecord, getPlanRecordList} from "@/api/projectPlan/index";
import {addRecord, getPlanRecordList, deletePlanRecord} from "@/api/projectPlan/index";
export default {
  name: "planRecord",
@@ -179,7 +182,7 @@
        this.search();
      });
    },
    /** 查看项目计划项 */
    /** 修改项目计划项 */
    handlePlanInfo(row) {
      this.$router.push({
        path: '/projectPlan/planInfo',
@@ -188,8 +191,22 @@
          planInfoData: this.planInfoData
        }
      })
    },
    // 删除项目计划记录
    handleDeletePlanRecord(id) {
      deletePlanRecord(id).then(res => {
        this.search();
      });
    },
    // 查看项目计划项
    handleCheckPlanInfo(row) {
      this.$router.push({
        path: '/projectPlan/planInfoCheck',
        query: {
          data: JSON.stringify(row),
        }
      })
    }
  },
  created() {
    this.getPlanInfoData();