From 7b090e55877ddb2316ec43ef7ce845b536fb95eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Sun, 15 Jan 2023 15:25:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/routes_xm.js | 4 +- src/store/getters.js | 2 +- src/store/index.js | 7 +- src/store/modules/iterationInfo.js | 29 ++ src/store/modules/productInfo.js | 17 - src/store/modules/projectInfo.js | 8 +- src/store/modules/xmProduct.js | 29 ++ .../xmIteration/XmIterationForLinkComplex.vue | 16 +- src/views/xm/core/xmMenu/XmMenuBox.vue | 11 +- .../xmProduct/XmProductForLinkComplex.vue | 4 +- src/views/xm/core/xmProject/XmProjectMng.vue | 9 +- src/views/xm/core/xmProject/index.vue | 438 ++---------------- src/views/xm/core/xmProject/top-nav.vue | 34 +- src/views/xm/core/xmTask/XmPlan.vue | 8 +- 14 files changed, 144 insertions(+), 472 deletions(-) create mode 100644 src/store/modules/iterationInfo.js delete mode 100644 src/store/modules/productInfo.js create mode 100644 src/store/modules/xmProduct.js diff --git a/src/router/routes_xm.js b/src/router/routes_xm.js index 89588077..e44a4339 100644 --- a/src/router/routes_xm.js +++ b/src/router/routes_xm.js @@ -40,9 +40,9 @@ export default { // leaf: true,//只有一个节点 children: [ { - path: 'overviewComplex', + path: 'overview', component: _import('xm/core/xmProject/XmProjectOverviewComplex'), - name: 'projectOverviewComplex', + name: 'projectOverview', iconCls: 'fa el-icon-menu', meta: { title: '项目-首页', diff --git a/src/store/getters.js b/src/store/getters.js index 236ea338..f440e84b 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -22,6 +22,6 @@ const getters = { isLoadOk:state=>state.user.isLoadOk, noticeMsg:state=>state.noticeMsg.noticeMsg, projectInfo:state=>state.projectInfo.projectInfo, - productInfo:state=>state.productInfo.productInfo, + xmProduct:state=>state.xmProduct.xmProduct, } export default getters diff --git a/src/store/index.js b/src/store/index.js index 1f025d7f..40bec4bc 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -7,7 +7,9 @@ import tagsView from './modules/tagsView' import user from './modules/user' import noticeMsg from './modules/noticeMsg' import projectInfo from './modules/projectInfo' -import productInfo from './modules/productInfo' +import xmProduct from './modules/xmProduct' +import iterationInfo from './modules/iterationInfo' + import getters from './getters' Vue.use(Vuex) @@ -21,7 +23,8 @@ const store = new Vuex.Store({ user, noticeMsg, projectInfo, - productInfo + xmProduct, + iterationInfo, }, getters }) diff --git a/src/store/modules/iterationInfo.js b/src/store/modules/iterationInfo.js new file mode 100644 index 00000000..f55328ea --- /dev/null +++ b/src/store/modules/iterationInfo.js @@ -0,0 +1,29 @@ + +var key='xm-iteration-info'; +const iterationInfo = { + state: { + iterationInfo: null, + }, + mutations: { + SET_ITERATION_INFO: (state, iterationInfo) => { + state.iterationInfo=iterationInfo + if(iterationInfo && iterationInfo!='null' && iterationInfo!='undefined' ){ + sessionStorage.setItem(key,JSON.stringify(iterationInfo)) + }else{ + sessionStorage.removeItem(key) + } + + } + }, + actions: { + setIterationInfo({ commit }, iterationInfo) { + commit('SET_ITERATION_INFO', iterationInfo) + } + } +} +var iterationStr=sessionStorage.getItem(key) +if(iterationStr && iterationStr!='null' && iterationStr!='undefined' ){ + iterationInfo.state.iterationInfo=JSON.parse(iterationStr) +} + +export default iterationInfo diff --git a/src/store/modules/productInfo.js b/src/store/modules/productInfo.js deleted file mode 100644 index 3958162c..00000000 --- a/src/store/modules/productInfo.js +++ /dev/null @@ -1,17 +0,0 @@ -const productInfo = { - state: { - productInfo: {} - }, - mutations: { - SET_PRODUCT: (state, productInfo) => { - state.productInfo=productInfo - } - }, - actions: { - setProduct({ commit }, productInfo) { - commit('SET_PRODUCT', productInfo) - } - } -} - -export default productInfo diff --git a/src/store/modules/projectInfo.js b/src/store/modules/projectInfo.js index be28edd5..c3d0ee94 100644 --- a/src/store/modules/projectInfo.js +++ b/src/store/modules/projectInfo.js @@ -2,10 +2,10 @@ var key='xm-project-info'; const projectInfo = { state: { - projectInfo: {} + projectInfo: null, }, mutations: { - SET_PROJECT: (state, projectInfo) => { + SET_PROJECT_INFO: (state, projectInfo) => { state.projectInfo=projectInfo if(projectInfo && projectInfo!='null' && projectInfo!='undefined' ){ sessionStorage.setItem(key,JSON.stringify(projectInfo)) @@ -16,8 +16,8 @@ const projectInfo = { } }, actions: { - setProject({ commit }, projectInfo) { - commit('SET_PROJECT', projectInfo) + setProjectInfo({ commit }, projectInfo) { + commit('SET_PROJECT_INFO', projectInfo) } } } diff --git a/src/store/modules/xmProduct.js b/src/store/modules/xmProduct.js new file mode 100644 index 00000000..1e5a0a23 --- /dev/null +++ b/src/store/modules/xmProduct.js @@ -0,0 +1,29 @@ + +var key='xm-product'; +const xmProduct = { + state: { + xmProduct: null, + }, + mutations: { + SET_XM_PRODUCT: (state, xmProduct) => { + state.xmProduct=xmProduct + if(xmProduct && xmProduct!='null' && xmProduct!='undefined' ){ + sessionStorage.setItem(key,JSON.stringify(xmProduct)) + }else{ + sessionStorage.removeItem(key) + } + + } + }, + actions: { + setXmProduct({ commit }, xmProduct) { + commit('SET_XM_PRODUCT', xmProduct) + } + } +} +var xmProductStr=sessionStorage.getItem(key) +if(xmProductStr && xmProductStr!='null' && xmProductStr!='undefined' ){ + xmProduct.state.xmProduct=JSON.parse(xmProductStr) +} + +export default xmProduct diff --git a/src/views/xm/core/xmIteration/XmIterationForLinkComplex.vue b/src/views/xm/core/xmIteration/XmIterationForLinkComplex.vue index 19048524..2c28bb58 100644 --- a/src/views/xm/core/xmIteration/XmIterationForLinkComplex.vue +++ b/src/views/xm/core/xmIteration/XmIterationForLinkComplex.vue @@ -4,7 +4,7 @@ - + @@ -280,7 +280,7 @@ - + @@ -301,16 +301,16 @@ - + - + - + @@ -325,7 +325,7 @@ - + @@ -356,7 +356,7 @@ export default { computed: { ...mapGetters([ - 'userInfo','roles' + 'userInfo','roles','projectInfo','xmProduct' ]), calcIterationStatusStep() { @@ -374,7 +374,7 @@ } }, }, - props:['visible','selProject','xmProduct'], + props:['visible'], watch:{ visible:function(visible){ if(visible==true){ diff --git a/src/views/xm/core/xmMenu/XmMenuBox.vue b/src/views/xm/core/xmMenu/XmMenuBox.vue index 5900f5f7..d7054470 100644 --- a/src/views/xm/core/xmMenu/XmMenuBox.vue +++ b/src/views/xm/core/xmMenu/XmMenuBox.vue @@ -4,13 +4,13 @@ - + - + @@ -28,11 +28,10 @@ components: { XmEpicFeatures,XmMenuMng,XmProductSelect - }, - props:['xmProduct','selProject','xmIteration'], + }, computed: { ...mapGetters([ - 'userInfo','roles' + 'userInfo','roles','projectInfo','xmProduct','xmIteration' ]), diff --git a/src/views/xm/core/xmProduct/XmProductForLinkComplex.vue b/src/views/xm/core/xmProduct/XmProductForLinkComplex.vue index 3c16999d..0cb8f0a9 100644 --- a/src/views/xm/core/xmProduct/XmProductForLinkComplex.vue +++ b/src/views/xm/core/xmProduct/XmProductForLinkComplex.vue @@ -316,7 +316,7 @@ import XmProductAdd from "./XmProductEdit"; //新增界面 export default { computed: { - ...mapGetters(["userInfo", "roles","projectInfo"]), + ...mapGetters(["userInfo", "roles","projectInfo","xmIteration"]), calcProductPstatusStep() { if (this.dicts["xmProductPstatus"] && this.xmProduct) { @@ -333,7 +333,7 @@ export default { } }, }, - props: ["visible", "xmIteration"], + props: ["visible"], watch: { visible: function (visible) { if (visible == true) { diff --git a/src/views/xm/core/xmProject/XmProjectMng.vue b/src/views/xm/core/xmProject/XmProjectMng.vue index ba969a2d..572c6c41 100644 --- a/src/views/xm/core/xmProject/XmProjectMng.vue +++ b/src/views/xm/core/xmProject/XmProjectMng.vue @@ -664,12 +664,9 @@ //进入info界面 intoInfo(row) { this.selectProject = row; - store.dispatch("setProject",row).then(res=>{ - this.$router.push({ name:'projectOverviewComplex', query: {id:row.id} }) - }) - - localStorage.setItem("xm-project-info-route",JSON.stringify(row)) - //this.showInfo = true; + store.dispatch("setProjectInfo",row).then(res=>{ + this.$router.push({ name:'projectOverview', query: {projectId:row.id} }) + }) }, //筛选项目 diff --git a/src/views/xm/core/xmProject/index.vue b/src/views/xm/core/xmProject/index.vue index be253742..83f5a40e 100644 --- a/src/views/xm/core/xmProject/index.vue +++ b/src/views/xm/core/xmProject/index.vue @@ -10,424 +10,56 @@ import util from "@/common/js/util"; //全局公共库 //import Sticky from '@/components/Sticky' // 粘性header组件 //import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询 import { mapGetters } from "vuex"; -import topNav from './top-nav.vue' - -import { initDicts,getDefOptions,editXmProjectSomeFields } from "@/api/xm/core/xmProject"; +import topNav from './top-nav.vue' +import store from '@/store' +import { listXmProject } from '@/api/xm/core/xmProject'; export default { computed: { - ...mapGetters(["userInfo", "roles"]), - - calcProjectStatusStep() { - if (this.dicts["projectStatus"] && this.selProject) { - var index = this.dicts["projectStatus"].findIndex((i) => { - if (i.id == this.selProject.status) { - return true; - } else { - return false; - } - }); - return index + 1; - } else { - return 0; - } - }, + ...mapGetters(["userInfo", "roles","projectInfo"]), }, watch: {}, data() { - return { - platformViewVisible: false, - tabPosition: "left", - infotype: "项目概览", - load: { list: false, edit: false }, - groupUserVisible: false, - exportArr: ["任务", "计划", "需求监控"], - dicts: getDefOptions(), - maxTableHeight:300, - /**end 自定义属性请在上面加 请加备注**/ + return { }; }, //end data methods: { - afterEditSubmit: function (project) { - this.selProject = Object.assign(this.selProject, project); - this.$emit("submit", project); - }, - toArchive: function () { - this.$router.push({ - path: "/mdp/arc/mate/archive/ArchiveMng", - }); - }, - toIm: function () { - this.groupUserVisible = true; - }, - toHelpMe: function () { - this.$router.push({ - path: "/mdp/im/messages/crmChat", - query: { - categoryId: "css", - sendContent: "咨询", - }, - }); - }, - onUserSelected: function (users) { - if (this.groupUserVisible == true) { - var query = {}; - if (users) { - if (users.length == 1) { - var user = users[0]; - query.toUserid = user.userid; - query.toUsername = user.username; - query.msgType = "prichat"; - } else if (users.length >= 2) { - query.users = JSON.stringify( - users.map((i) => { - return { userid: i.userid, username: i.username }; - }) - ); - query.categoryId = "common"; - query.msgType = "group"; - } - } - this.$router.push({ - path: "/mdp/im/messages/messageChat", - query: query, - }); - } - }, - setInfotype(infotype) { - if (infotype == "返回") { - this.goBack(); - } else { - this.infotype = infotype; - localStorage.setItem("project-infotype", infotype); - } - }, - handleExport() { - this.downloadLoading = true; - let list = []; - let header = []; - let keyList = []; - let pageNum = 1; - let infotypeKey = ""; - if (this.infotype === "任务") { - header = [ - "序号", - "任务名称", - "需求", - "预算(万)", - "工作量(人时)", - "执行人", - "进度", - "任务开始时间", - "任务结束时间", - "任务技能需求", - ]; - keyList = [ - "sortLevel", - "name", - "menuName", - "budgetCost", - "budgetWorkload", - "exeUsernames", - "rate", - "startTime", - "endTime", - "taskSkillNames", - ]; - list = this.$refs.xmTaskMng.tasksTreeData; - pageNum = this.$refs.xmTaskMng.pageInfo.pageNum; - } else if (this.infotype === "计划") { - header = [ - "序号", - "计划名称", - "开始时间", - "结束时间", - "进度(%)", - "状态", - "计划人数", - "实际人数", - "计划工期", - "实际工期", - "计划工作量(人时)", - "实际工作量(人时)", - "计划非人力成本(元)", - "实际非人力成本(元)", - "计划内购人力成本(元)", - "实际内购人力成本(元)", - "计划外购人力成本(元)", - "实际外购人力成本(元)", - "计划成本合计(元)", - "实际成本合计(元)", - "审批状态", - "备注", - ]; - keyList = [ - "seqNo", - "name", - "beginDate", - "endDate", - "actRate", - "phaseStatus", - "budgetOuserCnt", - "actStaffNu", - "budgetHours", - "actHours", - "budgetWorkload", - "actWorkload", - "budgetNouserAt", - "actNouserAt", - "budgetIuserAt", - "actIuserAt", - "budgetOuserAt", - "actOuserAt", - "budgetCostAt", - "actCostAt", - "bizFlowState", - "remark", - ]; - list = this.$refs.xmPhaseMng.projectPhaseTreeData; - pageNum = this.$refs.xmPhaseMng.pageInfo.pageNum; - } else if (this.infotype === "需求监控") { - header = [ - "序号", - "需求名称", - "计划状态", - "负责人", - "上线时间", - "计划开始时间", - "实际开始时间", - "计划结束时间", - "实际结束时间", - "计划工作量(人时)", - "实际工作量(人时)", - "计划成本(元)", - "实际成本(元)", - "总体完成比例%", - "需求完成比例%", - "设计完成比例%", - "开发完成比例%", - "sit完成比例%", - "uat完成比例%", - "上线状态", - ]; - keyList = [ - "seqNo", - "menuName", - "planStatus", - "chargeUsername", - "onlineTime", - "planStartTime", - "actStartTime", - "planEndTime", - "actEndTime", - "planWorkload", - "actWorkload", - "planCostAmount", - "actCostAmount", - "finishRate", - "demandRate", - "designRate", - "devRate", - "sitRate", - "uatRate", - "onlineStatus", - ]; - list = this.$refs.xmMenuWithPlan.xmMenusTreeData; - pageNum = this.$refs.xmMenuWithPlan.pageInfo.pageNum; - } - const filename = `${this.selProject.name}_${this.infotype}_第${pageNum}页`; - const data = this.formatJson(keyList, list); - - import("@/vendor/Export2Excel").then((excel) => { - excel.export_json_to_excel({ - header, - data, - filename, - // autoWidth: this.autoWidth, - bookType: "xlsx", - }); - this.downloadLoading = false; - }); - }, - formatJson(filterVal, jsonData, dataList = []) { - if (this.infotype == "任务") { - jsonData.forEach((v) => { - const row = filterVal.map((j) => { - let key = ""; - return v[j]; - }); - dataList.push(row); - if (v.children && v.children.length) { - dataList = this.formatJson(filterVal, v.children, dataList); - } - }); - return dataList; - } else if (this.infotype == "计划") { - const bizFlowStateDict = { - 0: "未发审", - 1: "审核中", - 2: "已通过", - 3: "未通过", - 4: "已取消", - }; - jsonData.forEach((v) => { - const row = filterVal.map((j) => { - let key = ""; - if (j == "phaseStatus") { - return this.$refs.xmPhaseMng.formateOption( - "xmPhaseStatus", - v.phaseStatus - ); - } else if (j == "bizFlowState") { - return `${bizFlowStateDict[parseInt(v[j]) || 0]}`; - } else { - return v[j]; - } - }); - dataList.push(row); - if (v.children && v.children.length) { - dataList = this.formatJson(filterVal, v.children, dataList); - } - }); - return dataList; - } else if (this.infotype == "需求监控") { - jsonData.forEach((v) => { - const row = filterVal.map((j) => { - let key = ""; - if (j == "planStatus") { - key = "xmMenuPlanStatus"; - } else if (j == "onlineStatus") { - return parseInt(v[j]) ? "已上线" : "未上线"; - } else { - return v[j]; - } - const dicts = this.$refs.xmMenuWithPlan.dicts; - if ( - dicts[key] == undefined || - dicts[key] == null || - dicts[key].length == 0 - ) { - return v[j]; - } - var rowData = dicts[key].filter((i) => i.id == v[j]); - if (rowData.length > 0) { - return rowData[0].name; - } else { - return v[j]; - } - }); - dataList.push(row); - if (v.children && v.children.length) { - dataList = this.formatJson(filterVal, v.children, dataList); - } - }); - return dataList; - } - }, - getDateString(dateStr) { - if (dateStr == null || dateStr == "" || dateStr == undefined) { - return ""; - } else { - return dateStr.substr(0, 10); - } - }, - - editXmProjectSomeFields(row,fieldName,$event){ - var that=this; - var func=(params)=>{ - editXmProjectSomeFields(params).then(res=>{ - var tips = res.data.tips; - if(tips.isOk){ - this.$emit('edit-fields',params) - Object.assign(row,params) - this.selProjectBak=Object.assign({},row) - }else{ - Object.assign(this.selProject,this.selProjectBak) - this.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'}) - } - }) - } - var params={ids:[row.id]}; - - params[fieldName]=$event - - - if(fieldName=='description'){ - this.$refs.selProject.validateField('description',err=>{ - if(err){ - this.$notify({position:'bottom-left',showClose:true,message: err,type: 'error'}) - return; - }else{ - func(params) - } - }) - }else if(fieldName=='name'){ - this.$refs.selProject.validateField('name',err=>{ - if(err){ - this.$notify({position:'bottom-left',showClose:true,message: err,type: 'error'}) - return; - }else{ - func(params) - } - }) - }else{ - func(params) - } - }, - goBack() { - localStorage.setItem("project-infotype", "项目概览"); - this.$router.back(-1); - }, - goHome(){ - localStorage.setItem("project-infotype", "项目概览"); - this.$router.push({path:'/'}) - }, - - onEditFields(row){ - Object.assign(this.selProject,row) - this.$emit("edit-fields",row); - }, - showCurrFlow(){ - this.$refs['项目概览'].showPanelName='currFlow' - }, - showHisFlow(){ - this.$refs['项目概览'].showPanelName='hisFlow' - }, - showDetail(){ - this.$refs['项目概览'].showPanelName='detail' - }, - showProjectGaiSuan(){ - this.$refs['项目概览'].showPanelName='detail' - this.$nextTick(()=>{ - this.$refs['项目概览'].$refs['detail'].$refs['projectEdit'].currTabPane='4' - }) - }, - showProjectShouYi(){ - this.$refs['项目概览'].showPanelName='detail' - this.$nextTick(()=>{ - this.$refs['项目概览'].$refs['detail'].$refs['projectEdit'].currTabPane='5' - }) - - }, - showMenusPage(){ - this.infotype='需求' - }, - linkProduct(){ - this.$refs['项目概览'].showPanelName='productProjectLink' - }, - createProduct(){ - this.infotype='产品' - this.$nextTick(()=>{ - this.$refs['xmProductComplex'].addProductVisible=true - }) - } + }, //end methods components: { topNav //在下面添加其它组件 }, - mounted() { + mounted() { + if(!this.$route.query.projectId){ + this.$message.error("地址不合规") + this.$route.back(-1) + } + if(!this.projectInfo||this.projectInfo.id!=this.$route.query.projectId){ + listXmProject({id:this.$route.query.projectId}).then(res=>{ + var tips = res.data.tips; + if(tips.isOk ){ + if( res.data.data.length==1){ + store.dispatch('setProjectInfo',res.data.data[0]) + }else{ + this.$message.error("项目不存在,请确保项目编号正确") + this.$router.push({ + path:'/xm/core/xmProject/XmProjectMng' + }) + } + + }else{ + this.$message.error(tips.msg) + this.$router.push({ + path:'/xm/core/xmProject/XmProjectMng' + }) + } + }) + } }, + beforeDestroy(){ + store.dispatch('setProjectInfo',null) + } }; diff --git a/src/views/xm/core/xmProject/top-nav.vue b/src/views/xm/core/xmProject/top-nav.vue index 9649a62b..7c71ab8a 100644 --- a/src/views/xm/core/xmProject/top-nav.vue +++ b/src/views/xm/core/xmProject/top-nav.vue @@ -12,7 +12,7 @@ :router="true" > - + - + 产品 - + 需求 - + 迭代 - + 计划 - + 任务 - + 缺陷 - + 团队 - + 合同管理 - + 预算 - + 费用 - + 效能 - + 文档 - + 环境清单 - + 日志 - + 每日工时 - + 每月工时 diff --git a/src/views/xm/core/xmTask/XmPlan.vue b/src/views/xm/core/xmTask/XmPlan.vue index da549fc9..bab783e9 100644 --- a/src/views/xm/core/xmTask/XmPlan.vue +++ b/src/views/xm/core/xmTask/XmPlan.vue @@ -2,10 +2,10 @@
- + - +
@@ -23,10 +23,10 @@ components: { XmPhase,XmTaskMng }, - props:['xmProduct','selProject'], + props:[], computed: { ...mapGetters([ - 'userInfo','roles' + 'userInfo','roles','xmProduct','projectInfo' ]),