This commit is contained in:
2024-06-04 18:56:45 +08:00
parent 607dcde7b0
commit 3e784abe55
6 changed files with 124 additions and 130 deletions

View File

@@ -1,14 +1,6 @@
<template>
<div class="ma-content-block lg:flex justify-between p-4">
<div class="lg:w-2/12 w-full h-full p-2 shadow">
<ma-tree-slider
v-model="depts"
searchPlaceholder="用户类型"
:field-names="{ title: 'label', value: 'value' }"
@click="switchDept"
></ma-tree-slider>
</div>
<div class="lg:w-10/12 w-full lg:ml-4 mt-5 lg:mt-0">
<div class="lg:w-12/12 w-full lg:ml-4 mt-5 lg:mt-0">
<!-- CRUD组件 -->
<ma-crud :options="crudOptions" :columns="crudColumns" ref="crudRef">
<template #status="{ record }">
@@ -26,7 +18,6 @@
<script setup>
import { reactive, ref, onMounted } from "vue"
import MaTreeSlider from "@/components/ma-treeSlider/index.vue"
import userApi from "@/api/system/user"
import user from "@/api/system/user"
import { Message } from "@arco-design/web-vue"
@@ -35,115 +26,6 @@ const changeStatus = (e, id) => {
console.log("当前值:", e)
console.log("当前ID", id)
}
// 树状组件-注意在onMounted中加载数据不然不显示
const depts = ref([])
onMounted(() => {
depts.value = [
{
id: 15,
parent_id: 0,
value: 15,
label: "成都分部",
children: [
{
id: 16,
parent_id: 15,
value: 16,
label: "FPGA组"
},
{
id: 17,
parent_id: 15,
value: 17,
label: "CPU组"
}
]
},
{
id: 1,
parent_id: 0,
value: 1,
label: "上海本部",
children: [
{
id: 3,
parent_id: 1,
value: 3,
label: "FPGA组",
children: [
{
id: 6,
parent_id: 3,
value: 6,
label: "研发部门"
},
{
id: 7,
parent_id: 3,
value: 7,
label: "市场部门"
},
{
id: 8,
parent_id: 3,
value: 8,
label: "测试部门"
},
{
id: 9,
parent_id: 3,
value: 9,
label: "财务部门"
},
{
id: 10,
parent_id: 3,
value: 10,
label: "运维部门"
}
]
},
{
id: 2,
parent_id: 1,
value: 2,
label: "CPU组",
children: [
{
id: 11,
parent_id: 2,
value: 11,
label: "市场部门",
children: [
{
id: 13,
parent_id: 11,
value: 13,
label: "外勤"
},
{
id: 14,
parent_id: 11,
value: 14,
label: "行政"
}
]
},
{
id: 12,
parent_id: 2,
value: 12,
label: "财务部门"
}
]
}
]
}
]
})
const switchDept = (key) => {
console.log("选择", key)
}
// crud组件
const crudRef = ref()
const crudOptions = reactive({
@@ -160,9 +42,10 @@ const crudOptions = reactive({
// 是否显示操作列
operationColumn: true,
operationWidth: 200,
showTools: false,
// 设置列表数据API
api: userApi.getPageList,
// 设置新增接口-show为true则显示按钮
// 设置新增接口-show为true则显示按钮
add: {
show: true,
api: userApi.save

View File

@@ -11,14 +11,14 @@
</div>
</template>
<script setup>
<script setup lang="jsx">
import { ref } from "vue"
import { useRoute, useRouter } from "vue-router"
import caseApi from "@/api/project/case"
import dictApi from "@/api/system/dict"
import { useTreeDataStore } from "@/store"
const treeDataStore = useTreeDataStore()
const route = useRoute()
const router = useRouter()
const roundNumber = route.query.key.split("-")[0]
const dutNumber = route.query.key.split("-")[1]
const designDemandNumber = route.query.key.split("-")[2]
@@ -30,6 +30,7 @@ const showType = (record) => {
let key_string = parseInt(record.key.substring(record.key.lastIndexOf("-") + 1)) + 1
return "YL-" + record.testType + "-" + record.ident + "-" + key_string.toString().padStart(3, "0")
}
// crud设置
const crudOptions = ref({
api: caseApi.getCaseList,
@@ -138,7 +139,7 @@ const crudOptions = ref({
const crudColumns = ref([
{
title: "ID",
width: 50,
width: 60,
align: "center",
dataIndex: "id",
fixed: "left"
@@ -165,6 +166,83 @@ const crudColumns = ref([
commonRules: [{ required: true, message: "名称是必填" }],
validateTrigger: "blur"
},
{
title: "执行情况",
align: "center",
display: false,
addDisplay: false,
editDisplay: false,
customRender: ({ record }) => {
// 执行情况逻辑,查看所有步骤的执行情况 - 暂时硬编码
let completeCount = 0
let stepCount = record.testStep.length
record.testStep.forEach((item) => {
if (item.status === "1") {
completeCount++
}
})
if (completeCount === stepCount) {
return (
<a-tag bordered color="green">
已执行
</a-tag>
)
} else if (completeCount > 0 && completeCount < stepCount) {
return (
<a-tag bordered color="orange">
部分执行
</a-tag>
)
} else {
return (
<a-tag bordered color="red">
未执行
</a-tag>
)
}
}
},
{
title: "是否通过",
align: "center",
display: false,
addDisplay: false,
editDisplay: false,
customRender: ({ record }) => {
let passCount = 0
let failCount = 0
let stepCount = record.testStep.length
record.testStep.forEach((item) => {
if (item.passed === "1") {
passCount++
} else if (item.passed === "2") {
failCount++
}
})
if (failCount > 0) {
return (
<a-tag bordered color="red">
未通过
</a-tag>
)
} else {
if (passCount === stepCount) {
return (
<a-tag bordered color="green">
已通过
</a-tag>
)
} else {
return (
<a-tag bordered color="orange">
包含未执行
</a-tag>
)
}
}
}
},
{
title: "设计人员",
width: 80,
@@ -188,7 +266,7 @@ const crudColumns = ref([
dataIndex: "monitorPerson",
width: 80,
align: "center",
search: true,
hide: true,
formType: "select",
dict: { url: "system/user/list", translation: true, props: { label: "name", value: "name" } }
},
@@ -196,6 +274,7 @@ const crudColumns = ref([
title: "用例综述",
align: "center",
dataIndex: "summarize",
hide: true,
search: true,
addDefaultValue: ""
},
@@ -215,7 +294,7 @@ const crudColumns = ref([
title: "执行时间",
dataIndex: "exe_time",
hide: true,
formType: "date",
formType: "date"
},
{
title: "测试步骤",