src/api/projectPlan/index.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/router/index.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/projectPlan/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/projectPlan/planInfo.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/projectPlan/planRecord.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/api/projectPlan/index.js
File was renamed from src/api/project/plan/index.js @@ -9,7 +9,7 @@ }) } // 查询月度计划列表 // 查询计划记录列表 export function getPlanRecordList(id) { return request({ url: '/api/project-plan-record/' + id, @@ -50,3 +50,29 @@ method: 'delete' }) } // 项目计划项列表 export function getPlanInfoData(id) { return request({ url: '/api/project-plan-info/' + id, method: 'get' }) } // 新增计划项 export function addPlanInfo(data) { return request({ url: '/api/project-plan-info/addPlanInfo', method: 'post', data: data }) } // 保存计划项 export function savePlanInfo(data) { return request({ url: '/api/project-plan-info/savePlanInfo', method: 'post', data: data }) } src/router/index.js
@@ -184,17 +184,24 @@ component: Layout, children: [ { path: '/plan/index', component: () => import('@/views/project/plan/index'), path: '/projectPlan/index', component: () => import('@/views/projectPlan/index'), name: 'Index', meta: { title: '项目计划' } }, /** 项目计划记录 */ { path: '/plan/planRecord', component: () => import('@/views/project/plan/planRecord'), path: '/projectPlan/planRecord', component: () => import('@/views/projectPlan/planRecord'), name: 'PlanRecord', meta: { title: '项目计划记录' } }, /** 项目计划项 */ { path: '/projectPlan/planInfo', component: () => import('@/views/projectPlan/planInfo'), name: 'PlanInfo', meta: { title: '项目计划项' } } ] }, src/views/projectPlan/index.vue
File was renamed from src/views/project/plan/index.vue @@ -79,38 +79,6 @@ @click="handleReset" >重置</el-button> </el-col> <!-- <el-col :span="1.5">--> <!-- <el-button--> <!-- type="success"--> <!-- plain--> <!-- icon="el-icon-edit"--> <!-- size="mini"--> <!-- :disabled="single"--> <!-- @click="handleUpdate"--> <!-- v-hasPermi="['plan:record:edit']"--> <!-- >修改</el-button>--> <!-- </el-col>--> <!-- <el-col :span="1.5">--> <!-- <el-button--> <!-- type="danger"--> <!-- plain--> <!-- icon="el-icon-delete"--> <!-- size="mini"--> <!-- :disabled="multiple"--> <!-- @click="handleDelete"--> <!-- v-hasPermi="['plan:record:remove']"--> <!-- >删除</el-button>--> <!-- </el-col>--> <!-- <el-col :span="1.5">--> <!-- <el-button--> <!-- type="warning"--> <!-- plain--> <!-- icon="el-icon-download"--> <!-- size="mini"--> <!-- @click="handleExport"--> <!-- v-hasPermi="['plan:record:export']"--> <!-- >导出</el-button>--> <!-- </el-col>--> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> @@ -217,39 +185,11 @@ :limit.sync="queryParams.pageSize" @pagination="getList" /> <!-- <!– 添加或修改项目计划记录对话框 –>--> <!-- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>--> <!-- <el-form ref="form" :model="form" :rules="rules" label-width="80px">--> <!-- <el-form-item label="项目信息id" prop="projectInfoId">--> <!-- <el-input v-model="form.projectInfoId" placeholder="请输入项目信息id" />--> <!-- </el-form-item>--> <!-- <el-form-item label="项目计划id" prop="planId">--> <!-- <el-input v-model="form.planId" placeholder="请输入项目计划id" />--> <!-- </el-form-item>--> <!-- <el-form-item label="工程id" prop="engineeringInfoId">--> <!-- <el-input v-model="form.engineeringInfoId" placeholder="请输入工程id" />--> <!-- </el-form-item>--> <!-- <el-form-item label="计划期" prop="planTime">--> <!-- <el-input v-model="form.planTime" placeholder="请输入计划期" />--> <!-- </el-form-item>--> <!-- <el-form-item label="月度/季度/年度 0/1/2" prop="planTimeFlag">--> <!-- <el-input v-model="form.planTimeFlag" placeholder="请输入月度/季度/年度 0/1/2" />--> <!-- </el-form-item>--> <!-- <el-form-item label="投资" prop="actualInvest">--> <!-- <el-input v-model="form.actualInvest" placeholder="请输入投资" />--> <!-- </el-form-item>--> <!-- </el-form>--> <!-- <div slot="footer" class="dialog-footer">--> <!-- <el-button type="primary" @click="submitForm">确 定</el-button>--> <!-- <el-button @click="cancel">取 消</el-button>--> <!-- </div>--> <!-- </el-dialog>--> </div> </template> <script> import { getList, getRecord, delRecord, addRecord, updateRecord } from "@/api/project/plan/index"; import { getList, getRecord, delRecord, addRecord, updateRecord } from "@/api/projectPlan/index"; export default { name: "index", @@ -389,7 +329,7 @@ /** 查看项目计划记录 */ handlePlanRecord(row) { this.$router.push({ path: '/plan/planRecord', path: '/projectPlan/planRecord', query: { data: JSON.stringify(row) } src/views/projectPlan/planInfo.vue
New file @@ -0,0 +1,192 @@ <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-button type="primary" size="small" @click="handleAdd" style="float: right; margin-bottom: 10px">新增</el-button> <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="handleSave(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> <div style="display: flex; justify-content: center; align-items: center; margin-top: 20px"> <el-button type="primary" size="small" @click="handleSubmit">上报</el-button> <el-button type="primary" size="small" @click="handleResetAll">重置</el-button> </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: "planInfo", 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; } }); }, // 新增一行空白数据 handleAdd() { this.tableData.push({ title: '', startTime: '', endTime: '' }); }, // 删除一行数据 handleDelete(index) { this.tableData.splice(index, 1); }, // 上报数据 handleSubmit() { // 遍历tableData,获得值不为空字符串的行 const validList = this.tableData.filter(item => item.title !== '' && item.startTime !== '' && item.endTime !== ''); this.addData = { projectPlanRecordId: this.planRecordData.id, actualInvest: this.actualInvest, addList: validList } addPlanInfo(this.addData).then(response => { this.handlePlanRecord(this.planInfoData) }) }, // 重置当前行数据 handleReset(index) { this.tableData[index].title = ''; this.tableData[index].startTime = ''; this.tableData[index].endTime = ''; }, // 重置所有数据 handleResetAll() { this.tableData = this.tableData.map(item => { item.title = ''; item.startTime = ''; item.endTime = ''; return item; }); this.actualInvest = ''; }, // 保存当前行数据 handleSave(index) { this.tableData[index].projectPlanRecordId = this.planRecordData.id; savePlanInfo(this.tableData[index]).then(response => { this.search(); this.$message.success('保存成功'); }); }, /** 返回项目计划记录 */ 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
File was renamed from src/views/project/plan/planRecord.vue @@ -11,20 +11,20 @@ <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="项目代码"></el-table-column> <el-table-column label="计划期"> <el-table-column prop="id" label="序号" align="center"></el-table-column> <el-table-column prop="projectName" label="项目名称" align="center"></el-table-column> <el-table-column prop="projectCode" label="项目代码" align="center"></el-table-column> <el-table-column label="计划期" align="center"> <template slot-scope="scope"> <span> {{ scope.row.planTime }}{{ scope.row.planTimeFlag === 0 ? '月度' : scope.row.planTimeFlag === 1 ? '季度' : '年度' }} </span> </template> </el-table-column> <el-table-column prop="createTime" label="创建时间"></el-table-column> <el-table-column fixed="right" label="操作"> <el-table-column prop="createTime" label="创建时间" align="center"></el-table-column> <el-table-column fixed="right" label="操作" align="center"> <template slot-scope="scope"> <el-button type="primary" size="small" :disabled="scope.row.reportStatus === 0">编辑上报</el-button> <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> </template> </el-table-column> @@ -35,20 +35,20 @@ <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="项目代码"></el-table-column> <el-table-column label="计划期"> <el-table-column prop="id" label="序号" align="center"></el-table-column> <el-table-column prop="projectName" label="项目名称" align="center"></el-table-column> <el-table-column prop="projectCode" label="项目代码" align="center"></el-table-column> <el-table-column label="计划期" align="center"> <template slot-scope="scope"> <span> {{ scope.row.planTime }}{{ scope.row.planTimeFlag === 0 ? '月度' : scope.row.planTimeFlag === 1 ? '季度' : '年度' }} </span> </template> </el-table-column> <el-table-column prop="createTime" label="创建时间"></el-table-column> <el-table-column fixed="right" label="操作"> <el-table-column prop="createTime" label="创建时间" align="center"></el-table-column> <el-table-column fixed="right" label="操作" align="center"> <template slot-scope="scope"> <el-button type="primary" size="small" :disabled="scope.row.reportStatus === 0">编辑上报</el-button> <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> </template> </el-table-column> @@ -59,20 +59,20 @@ <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="项目代码"></el-table-column> <el-table-column label="计划期"> <el-table-column prop="id" label="序号" align="center"></el-table-column> <el-table-column prop="projectName" label="项目名称" align="center"></el-table-column> <el-table-column prop="projectCode" label="项目代码" align="center"></el-table-column> <el-table-column label="计划期" align="center"> <template slot-scope="scope"> <span> {{ scope.row.planTime }}{{ scope.row.planTimeFlag === 0 ? '月度' : scope.row.planTimeFlag === 1 ? '季度' : '年度' }} </span> </template> </el-table-column> <el-table-column prop="createTime" label="创建时间"></el-table-column> <el-table-column fixed="right" label="操作"> <el-table-column prop="createTime" label="创建时间" align="center"></el-table-column> <el-table-column fixed="right" label="操作" align="center"> <template slot-scope="scope"> <el-button type="primary" size="small" :disabled="scope.row.reportStatus === 0">编辑上报</el-button> <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> </template> </el-table-column> @@ -86,13 +86,12 @@ </template> <script> import {addRecord, getPlanRecordList} from "@/api/project/plan/index"; import {addRecord, getPlanRecordList} from "@/api/projectPlan/index"; export default { // name: "planRecord", name: "planRecord", data() { return { loading: true, // 接收传递过来的项目计划数据 planInfoData: {}, // 月度计划数据 @@ -101,8 +100,6 @@ seasonRecords: [], // 年度计划数据 yearRecords: [], // 新增计划 } }, methods: { @@ -115,21 +112,17 @@ // 从查询参数中获取数据 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; // 获取季度计划数据 this.seasonRecords = res.data.seasonRecords; // 获取年度计划数据 this.yearRecords = res.data.yearRecords; console.log(this.monthRecords); this.loading = false; }) }, // 新增月度计划记录 @@ -186,6 +179,16 @@ this.search(); }); }, /** 查看项目计划项 */ handlePlanInfo(row) { this.$router.push({ path: '/projectPlan/planInfo', query: { data: JSON.stringify(row), planInfoData: this.planInfoData } }) } }, created() {