diff --git a/cdTMP/src/layout/project-layout.vue b/cdTMP/src/layout/project-layout.vue index 1d37d2e..0b2aad4 100644 --- a/cdTMP/src/layout/project-layout.vue +++ b/cdTMP/src/layout/project-layout.vue @@ -239,7 +239,7 @@ const handleSoDutCancel = () => { // so_dut弹窗ref对象 const soDutFormRef = ref() onMounted(async () => { - treeDataStore.initTreeData(projectId.value) + await treeDataStore.initTreeData(projectId.value) // 检查是否存在第一轮的源代码dut /// 主动后端请求 const res = await dutApi.getSoExists({ id: projectId.value }) @@ -613,32 +613,22 @@ const soDutColumn = ref([ { title: "空行", dataIndex: "black_line", - formType: "input-number" + formType: "input" }, { - title: "纯注释?", - dataIndex: "pure_code_line", - formType: "input-number" + title: "纯注释", + dataIndex: "comment_line", + formType: "input" }, { - title: "混合行?", + title: "混合行", dataIndex: "mix_line", - formType: "input-number" + formType: "input" }, { - title: "总注释", - dataIndex: "total_comment_line", - formType: "input-number" - }, - { - title: "总代码", - dataIndex: "total_code_line", - formType: "input-number" - }, - { - title: "总行数", - dataIndex: "total_line", - formType: "input-number" + title: "纯代码", + dataIndex: "code_line", + formType: "input" } ]) diff --git a/cdTMP/src/store/project/treeData.js b/cdTMP/src/store/project/treeData.js index fff57b1..96876a7 100644 --- a/cdTMP/src/store/project/treeData.js +++ b/cdTMP/src/store/project/treeData.js @@ -13,11 +13,28 @@ const useTreeDataStore = defineStore("treeDataStore", { actions: { // 不能使用箭头函数,无法绑定this async initTreeData(projectId) { - // 获取localStorage的treeData数据 + // 先判断储存的pid是否存在 + const pid = localStorage.getItem("pid") + // 如果不存在,则请求后台树状数据 + if (!pid) { + const roundData = await projectApi.getRoundInfo(projectId) + this.treeData = roundData.data + this.originTreeData = roundData.data + } + // 如果存在,但是项目变为了其他 + if (pid && pid !== projectId) { + const roundData = await projectApi.getRoundInfo(projectId) + this.treeData = roundData.data + this.originTreeData = roundData.data + } + // 每次进入工作区存一个localStorage项目ID + localStorage.setItem("pid", projectId) + // 获取localStorage的treeData数据-F5刷新问题解决 if (localStorage.getItem("tree_local_data")) { this.treeData = JSON.parse(localStorage.getItem("tree_local_data")) this.originTreeData = JSON.parse(localStorage.getItem("tree_local_data")) } + /// 如果没有tree_local_data则请求后台数据 if (this.treeData.length === 0) { const roundData = await projectApi.getRoundInfo(projectId) this.treeData = roundData.data diff --git a/cdTMP/src/views/project/case/index.vue b/cdTMP/src/views/project/case/index.vue index 0a87349..5079c32 100644 --- a/cdTMP/src/views/project/case/index.vue +++ b/cdTMP/src/views/project/case/index.vue @@ -54,7 +54,7 @@ const related_reload = () => { const crudOptions = ref({ api: problemApi.getProblemList, - add: { show: true, api: problemApi.save }, + add: { show: true, api: problemApi.save, text: "新增问题单" }, edit: { show: true, api: problemApi.update }, delete: { show: true, api: problemApi.delete }, operationColumnAlign: "center", // 操作列居中 diff --git a/cdTMP/src/views/project/design-demand/index.vue b/cdTMP/src/views/project/design-demand/index.vue index d830596..514f426 100644 --- a/cdTMP/src/views/project/design-demand/index.vue +++ b/cdTMP/src/views/project/design-demand/index.vue @@ -150,7 +150,7 @@ const showType = (record) => { // crud组件 const crudOptions = ref({ api: testDemandApi.getTestDemandList, - add: { show: true, api: testDemandApi.save }, + add: { show: true, api: testDemandApi.save, text: "新增测试项" }, edit: { show: true, api: testDemandApi.update }, delete: { show: true, api: testDemandApi.delete }, beforeOpenAdd: function () { diff --git a/cdTMP/src/views/project/dut/index.vue b/cdTMP/src/views/project/dut/index.vue index 11b6b9c..27209ac 100644 --- a/cdTMP/src/views/project/dut/index.vue +++ b/cdTMP/src/views/project/dut/index.vue @@ -45,7 +45,7 @@ const showType = (record) => { // crud组件 const crudOptions = ref({ api: designDemandApi.getDesignDemandList, - add: { show: true, api: designDemandApi.save }, + add: { show: true, api: designDemandApi.save, text: "新增设计需求" }, edit: { show: true, api: designDemandApi.editDesignDemand }, delete: { show: true, api: designDemandApi.delete }, // 处理添加后函数 diff --git a/cdTMP/src/views/project/round/index.vue b/cdTMP/src/views/project/round/index.vue index 00fdfba..bde9742 100644 --- a/cdTMP/src/views/project/round/index.vue +++ b/cdTMP/src/views/project/round/index.vue @@ -2,41 +2,7 @@