提交修改问题
This commit is contained in:
@@ -239,7 +239,7 @@ const handleSoDutCancel = () => {
|
|||||||
// so_dut弹窗ref对象
|
// so_dut弹窗ref对象
|
||||||
const soDutFormRef = ref()
|
const soDutFormRef = ref()
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
treeDataStore.initTreeData(projectId.value)
|
await treeDataStore.initTreeData(projectId.value)
|
||||||
// 检查是否存在第一轮的源代码dut
|
// 检查是否存在第一轮的源代码dut
|
||||||
/// 主动后端请求
|
/// 主动后端请求
|
||||||
const res = await dutApi.getSoExists({ id: projectId.value })
|
const res = await dutApi.getSoExists({ id: projectId.value })
|
||||||
@@ -613,32 +613,22 @@ const soDutColumn = ref([
|
|||||||
{
|
{
|
||||||
title: "空行",
|
title: "空行",
|
||||||
dataIndex: "black_line",
|
dataIndex: "black_line",
|
||||||
formType: "input-number"
|
formType: "input"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "纯注释?",
|
title: "纯注释",
|
||||||
dataIndex: "pure_code_line",
|
dataIndex: "comment_line",
|
||||||
formType: "input-number"
|
formType: "input"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "混合行?",
|
title: "混合行",
|
||||||
dataIndex: "mix_line",
|
dataIndex: "mix_line",
|
||||||
formType: "input-number"
|
formType: "input"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "总注释",
|
title: "纯代码",
|
||||||
dataIndex: "total_comment_line",
|
dataIndex: "code_line",
|
||||||
formType: "input-number"
|
formType: "input"
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "总代码",
|
|
||||||
dataIndex: "total_code_line",
|
|
||||||
formType: "input-number"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "总行数",
|
|
||||||
dataIndex: "total_line",
|
|
||||||
formType: "input-number"
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -13,11 +13,28 @@ const useTreeDataStore = defineStore("treeDataStore", {
|
|||||||
actions: {
|
actions: {
|
||||||
// 不能使用箭头函数,无法绑定this
|
// 不能使用箭头函数,无法绑定this
|
||||||
async initTreeData(projectId) {
|
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")) {
|
if (localStorage.getItem("tree_local_data")) {
|
||||||
this.treeData = JSON.parse(localStorage.getItem("tree_local_data"))
|
this.treeData = JSON.parse(localStorage.getItem("tree_local_data"))
|
||||||
this.originTreeData = JSON.parse(localStorage.getItem("tree_local_data"))
|
this.originTreeData = JSON.parse(localStorage.getItem("tree_local_data"))
|
||||||
}
|
}
|
||||||
|
/// 如果没有tree_local_data则请求后台数据
|
||||||
if (this.treeData.length === 0) {
|
if (this.treeData.length === 0) {
|
||||||
const roundData = await projectApi.getRoundInfo(projectId)
|
const roundData = await projectApi.getRoundInfo(projectId)
|
||||||
this.treeData = roundData.data
|
this.treeData = roundData.data
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const related_reload = () => {
|
|||||||
|
|
||||||
const crudOptions = ref({
|
const crudOptions = ref({
|
||||||
api: problemApi.getProblemList,
|
api: problemApi.getProblemList,
|
||||||
add: { show: true, api: problemApi.save },
|
add: { show: true, api: problemApi.save, text: "新增问题单" },
|
||||||
edit: { show: true, api: problemApi.update },
|
edit: { show: true, api: problemApi.update },
|
||||||
delete: { show: true, api: problemApi.delete },
|
delete: { show: true, api: problemApi.delete },
|
||||||
operationColumnAlign: "center", // 操作列居中
|
operationColumnAlign: "center", // 操作列居中
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ const showType = (record) => {
|
|||||||
// crud组件
|
// crud组件
|
||||||
const crudOptions = ref({
|
const crudOptions = ref({
|
||||||
api: testDemandApi.getTestDemandList,
|
api: testDemandApi.getTestDemandList,
|
||||||
add: { show: true, api: testDemandApi.save },
|
add: { show: true, api: testDemandApi.save, text: "新增测试项" },
|
||||||
edit: { show: true, api: testDemandApi.update },
|
edit: { show: true, api: testDemandApi.update },
|
||||||
delete: { show: true, api: testDemandApi.delete },
|
delete: { show: true, api: testDemandApi.delete },
|
||||||
beforeOpenAdd: function () {
|
beforeOpenAdd: function () {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ const showType = (record) => {
|
|||||||
// crud组件
|
// crud组件
|
||||||
const crudOptions = ref({
|
const crudOptions = ref({
|
||||||
api: designDemandApi.getDesignDemandList,
|
api: designDemandApi.getDesignDemandList,
|
||||||
add: { show: true, api: designDemandApi.save },
|
add: { show: true, api: designDemandApi.save, text: "新增设计需求" },
|
||||||
edit: { show: true, api: designDemandApi.editDesignDemand },
|
edit: { show: true, api: designDemandApi.editDesignDemand },
|
||||||
delete: { show: true, api: designDemandApi.delete },
|
delete: { show: true, api: designDemandApi.delete },
|
||||||
// 处理添加后函数
|
// 处理添加后函数
|
||||||
|
|||||||
@@ -2,41 +2,7 @@
|
|||||||
<div class="ma-content-block lg:flex justify-between p-4">
|
<div class="ma-content-block lg:flex justify-between p-4">
|
||||||
<div class="lg:w-full w-full lg:ml-4 mt-5 lg:mt-0">
|
<div class="lg:w-full w-full lg:ml-4 mt-5 lg:mt-0">
|
||||||
<!-- CRUD组件 -->
|
<!-- CRUD组件 -->
|
||||||
<ma-crud :options="crudOptions" :columns="crudColumns" ref="crudRef">
|
<ma-crud :options="crudOptions" :columns="crudColumns" ref="crudRef"></ma-crud>
|
||||||
<template #total_code_line="{ record }">
|
|
||||||
<template v-if="record.total_code_line">
|
|
||||||
<a-statistic
|
|
||||||
:animation-duration="1000"
|
|
||||||
:value="parseInt(record.total_code_line)"
|
|
||||||
animation
|
|
||||||
:value-style="{ color: '#0fbf60' }"
|
|
||||||
></a-statistic>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
<template #total_line="{ record }">
|
|
||||||
<template v-if="record.total_line">
|
|
||||||
<a-statistic
|
|
||||||
:animation-duration="1000"
|
|
||||||
:value="parseInt(record.total_line)"
|
|
||||||
animation
|
|
||||||
:value-style="{ color: 'orange' }"
|
|
||||||
></a-statistic>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
<template #comment_line="{ record }">
|
|
||||||
<template v-if="record.comment_line">
|
|
||||||
<a-statistic
|
|
||||||
:animation-duration="1000"
|
|
||||||
:precision="2"
|
|
||||||
:value="parseFloat(record.comment_line)"
|
|
||||||
animation
|
|
||||||
:value-style="{ color: 'lightblue' }"
|
|
||||||
>
|
|
||||||
<template #suffix> % </template>
|
|
||||||
</a-statistic>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</ma-crud>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -143,23 +109,23 @@ const crudColumns = ref([
|
|||||||
if (value === "SO") {
|
if (value === "SO") {
|
||||||
return {
|
return {
|
||||||
black_line: { display: true },
|
black_line: { display: true },
|
||||||
pure_code_line: { display: true },
|
code_line: { display: true },
|
||||||
mix_line: { display: true },
|
mix_line: { display: true },
|
||||||
total_comment_line: { display: true },
|
comment_line: { display: true },
|
||||||
total_code_line: { display: true },
|
total_code_line: { display: true },
|
||||||
total_line: { display: true },
|
total_line: { display: true },
|
||||||
comment_line: { display: true }
|
comment_percent: { display: true }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 其他数据清除
|
// 其他数据清除
|
||||||
return {
|
return {
|
||||||
black_line: { display: false },
|
black_line: { display: false },
|
||||||
pure_code_line: { display: false },
|
code_line: { display: false },
|
||||||
mix_line: { display: false },
|
mix_line: { display: false },
|
||||||
total_comment_line: { display: false },
|
comment_line: { display: false },
|
||||||
total_code_line: { display: false },
|
total_code_line: { display: false },
|
||||||
total_line: { display: false },
|
total_line: { display: false },
|
||||||
comment_line: { display: false }
|
comment_percent: { display: false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -213,72 +179,78 @@ const crudColumns = ref([
|
|||||||
formType: "input-number"
|
formType: "input-number"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "纯注释?",
|
title: "纯代码行",
|
||||||
hide: true,
|
hide: true,
|
||||||
align: "center",
|
align: "center",
|
||||||
dataIndex: "pure_code_line",
|
dataIndex: "code_line",
|
||||||
formType: "input-number"
|
formType: "input-number"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "混合行?",
|
title: "纯注释行",
|
||||||
|
hide: true,
|
||||||
|
align: "center",
|
||||||
|
dataIndex: "comment_line",
|
||||||
|
formType: "input-number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "混合行",
|
||||||
hide: true,
|
hide: true,
|
||||||
align: "center",
|
align: "center",
|
||||||
dataIndex: "mix_line",
|
dataIndex: "mix_line",
|
||||||
formType: "input-number"
|
formType: "input-number"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: "总注释",
|
|
||||||
hide: true,
|
|
||||||
align: "center",
|
|
||||||
dataIndex: "total_comment_line",
|
|
||||||
formType: "input-number"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "总代码",
|
|
||||||
hide: true,
|
|
||||||
align: "center",
|
|
||||||
dataIndex: "total_code_line",
|
|
||||||
formType: "input-number"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "总行数",
|
|
||||||
hide: true,
|
|
||||||
align: "center",
|
|
||||||
dataIndex: "total_line",
|
|
||||||
formType: "input-number"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: "注释率 %",
|
title: "注释率 %",
|
||||||
align: "center",
|
align: "center",
|
||||||
dataIndex: "comment_line",
|
dataIndex: "comment_percent",
|
||||||
hide: true,
|
hide: true,
|
||||||
addDisabled: true,
|
addDisabled: true,
|
||||||
editDisabled: true,
|
editDisabled: true,
|
||||||
customRender: ({ record }) => {
|
customRender: ({ record }) => {
|
||||||
if (record.total_comment_line && record.total_code_line) {
|
const sum_line =
|
||||||
if (isNaN(parseFloat(record.total_comment_line)) || isNaN(parseFloat(record.total_code_line))) {
|
parseFloat(record.comment_line) +
|
||||||
|
parseFloat(record.mix_line) +
|
||||||
|
parseFloat(record.black_line) +
|
||||||
|
parseFloat(record.code_line)
|
||||||
|
if (record.comment_line && record.mix_line && record.black_line && record.code_line) {
|
||||||
|
if (
|
||||||
|
isNaN(parseFloat(record.comment_line)) ||
|
||||||
|
isNaN(parseFloat(record.mix_line)) ||
|
||||||
|
isNaN(parseFloat(record.black_line)) ||
|
||||||
|
isNaN(parseFloat(record.code_line))
|
||||||
|
) {
|
||||||
return "数值错误"
|
return "数值错误"
|
||||||
}
|
}
|
||||||
if (parseFloat(record.total_comment_line) <= 0 || parseFloat(record.total_code_line) <= 0) {
|
if (
|
||||||
|
parseFloat(record.comment_line) <= 0 ||
|
||||||
|
parseFloat(record.mix_line) <= 0 ||
|
||||||
|
parseFloat(record.black_line) <= 0 ||
|
||||||
|
parseFloat(record.code_line) <= 0
|
||||||
|
) {
|
||||||
return "不能为负数"
|
return "不能为负数"
|
||||||
}
|
}
|
||||||
if (parseFloat(record.total_comment_line) >= parseFloat(record.total_code_line)) {
|
|
||||||
return "注释大于总行"
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<a-statistic
|
<a-statistic
|
||||||
animation-duration={parseInt(1000)}
|
animation-duration={parseInt(1000)}
|
||||||
precision={2}
|
precision={2}
|
||||||
animation
|
animation
|
||||||
value-style={{ color: "lightblue" }}
|
value-style={{ color: "lightblue" }}
|
||||||
value={parseFloat(record.total_comment_line / record.total_code_line)}
|
value={(parseFloat(record.comment_line) + parseFloat(record.mix_line)) / sum_line}
|
||||||
></a-statistic>
|
></a-statistic>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 注意这个是个创新点
|
// 注意这个是个创新点
|
||||||
control(value, data) {
|
control(value, data) {
|
||||||
data.comment_line = (data.total_comment_line / data.total_code_line).toFixed(2).toString()
|
data.comment_percent = (
|
||||||
|
(parseFloat(data.comment_line) + parseFloat(data.mix_line)) /
|
||||||
|
(parseFloat(data.comment_line) +
|
||||||
|
parseFloat(data.mix_line) +
|
||||||
|
parseFloat(data.black_line) +
|
||||||
|
parseFloat(data.code_line))
|
||||||
|
)
|
||||||
|
.toFixed(2)
|
||||||
|
.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const showType = (record) => {
|
|||||||
// crud设置
|
// crud设置
|
||||||
const crudOptions = ref({
|
const crudOptions = ref({
|
||||||
api: caseApi.getCaseList,
|
api: caseApi.getCaseList,
|
||||||
add: { show: true, api: caseApi.save },
|
add: { show: true, api: caseApi.save, text: "新增用例" },
|
||||||
edit: { show: true, api: caseApi.update },
|
edit: { show: true, api: caseApi.update },
|
||||||
delete: { show: true, api: caseApi.delete },
|
delete: { show: true, api: caseApi.delete },
|
||||||
// 处理新增删除后树状图显示
|
// 处理新增删除后树状图显示
|
||||||
@@ -237,13 +237,15 @@ const crudColumns = ref([
|
|||||||
title: "是否通过",
|
title: "是否通过",
|
||||||
dataIndex: "passed",
|
dataIndex: "passed",
|
||||||
formType: "radio",
|
formType: "radio",
|
||||||
dict: { name: "passType", props: { label: "title", value: "key" } }
|
dict: { name: "passType", props: { label: "title", value: "key" } },
|
||||||
|
commonRules: [{ required: true, message: "是否通过必填" }]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "执行状态",
|
title: "执行状态",
|
||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
formType: "radio",
|
formType: "radio",
|
||||||
dict: { name: "execType", props: { label: "title", value: "key" } }
|
dict: { name: "execType", props: { label: "title", value: "key" } },
|
||||||
|
commonRules: [{ required: true, message: "执行状态必填" }]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user