222
This commit is contained in:
87
cdTMP/src/views/testmanage/projFragment/index.vue
Normal file
87
cdTMP/src/views/testmanage/projFragment/index.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<div class="proj-fragment-container">
|
||||
<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" v-loading="isDataLoading">
|
||||
<a-page-header @back="handleBackClick" :style="{ background: 'var(--color-bg-2)' }" :title="loadingData.ident">
|
||||
<template #subtitle>
|
||||
<a-space>
|
||||
<span>{{ loadingData.name }}</span>
|
||||
</a-space>
|
||||
<span class="text-base ml-3 text-red-950">所属文档片段</span>
|
||||
</template>
|
||||
</a-page-header>
|
||||
<hr/>
|
||||
<ma-crud class="mt-3" :options="crudOptions" :columns="crudColumns" ref="crudRef"> </ma-crud>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue"
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
import { FragApi } from "@/api/system/fragment"
|
||||
import { ProductFileEnum } from "@/utils/enums/productTypes"
|
||||
import { IDictData } from "@/utils/types/CommonType"
|
||||
import useFetchData from "@/hooks/fetchData"
|
||||
import projectApi from "@/api/testmanage/project"
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const crudRef = ref(null)
|
||||
// 产品文档类型写死7种
|
||||
const productFileType: IDictData<ProductFileEnum>[] = Object.keys(ProductFileEnum).map((it) => ({
|
||||
label: ProductFileEnum[it],
|
||||
value: it as ProductFileEnum
|
||||
}))
|
||||
// 返回项目管理
|
||||
const handleBackClick = () => {
|
||||
router.go(-1)
|
||||
}
|
||||
// hook-获取单个项目信息
|
||||
const fetchData = async () => {
|
||||
return projectApi.getProjectById(route.params.projectId)
|
||||
}
|
||||
const { loadingData, isDataLoading } = useFetchData({}, fetchData)
|
||||
|
||||
// ma-crud配置
|
||||
const crudOptions = ref<object>({
|
||||
api: FragApi.getFragList,
|
||||
showTools: false
|
||||
})
|
||||
const crudColumns = ref<any[]>([
|
||||
{
|
||||
title: "ID",
|
||||
align: "center",
|
||||
width: 50,
|
||||
hide: true,
|
||||
dataIndex: "id",
|
||||
commonRules: [{ required: true, message: "ID必填" }],
|
||||
validateTrigger: "blur"
|
||||
},
|
||||
{
|
||||
title: "片段名称",
|
||||
align: "center",
|
||||
width: 120,
|
||||
dataIndex: "name",
|
||||
search: true,
|
||||
commonRules: [{ required: true, message: "片段名称必填" }],
|
||||
validateTrigger: "blur"
|
||||
},
|
||||
{
|
||||
title: "所属文档",
|
||||
align: "center",
|
||||
width: 100,
|
||||
dataIndex: "belong_doc",
|
||||
formType: "select",
|
||||
search: true,
|
||||
commonRules: [{ required: true, message: "所属文档必选" }],
|
||||
dict: { data: productFileType }
|
||||
}
|
||||
])
|
||||
|
||||
defineOptions({
|
||||
name: "projFragment"
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -93,6 +93,7 @@
|
||||
工作区
|
||||
</a-button>
|
||||
<a-link @click="previewRef.open(record)"><icon-eye />预览</a-link>
|
||||
<a-link @click="handleFragmentClick(record)"><icon-file />片段</a-link>
|
||||
<a-link @click="handleBoardClick(record)"><icon-dashboard />项目看板</a-link>
|
||||
</template>
|
||||
</ma-crud>
|
||||
@@ -338,6 +339,15 @@ const handleBoardClick = (record) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
// 2.跳转到项目所属文档片段
|
||||
const handleFragmentClick = (record) => {
|
||||
router.push({
|
||||
name: "projFragment",
|
||||
params: {
|
||||
projectId: record.id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// CRUD-OPTIONS
|
||||
const crudRef = ref()
|
||||
@@ -482,6 +492,7 @@ const crudOptions = ref({
|
||||
const crudColumns = ref([
|
||||
{
|
||||
title: "项目标识",
|
||||
align: "center",
|
||||
width: 90,
|
||||
sortable: { sortDirections: ["ascend"] },
|
||||
dataIndex: "ident",
|
||||
@@ -492,6 +503,7 @@ const crudColumns = ref([
|
||||
{
|
||||
title: "项目名称",
|
||||
width: 110,
|
||||
align: "center",
|
||||
dataIndex: "name",
|
||||
search: true,
|
||||
commonRules: [{ required: true, message: "名称是必填" }]
|
||||
@@ -503,11 +515,13 @@ const crudColumns = ref([
|
||||
{
|
||||
title: "开始日期",
|
||||
dataIndex: "beginTime",
|
||||
align: "center",
|
||||
commonRules: [{ required: true, message: "开始时间必填" }],
|
||||
formType: "date"
|
||||
},
|
||||
{
|
||||
title: "结束时间",
|
||||
align: "center",
|
||||
dataIndex: "endTime",
|
||||
formType: "date",
|
||||
extra: "注意:结束时间需要晚于最后一轮结束时间",
|
||||
@@ -537,6 +551,7 @@ const crudColumns = ref([
|
||||
},
|
||||
{
|
||||
title: "责任人",
|
||||
align: "center",
|
||||
width: 70,
|
||||
dataIndex: "duty_person",
|
||||
search: true,
|
||||
@@ -651,6 +666,7 @@ const crudColumns = ref([
|
||||
{
|
||||
title: "报告类型",
|
||||
dataIndex: "report_type",
|
||||
align: "center",
|
||||
addDefaultValue: "9",
|
||||
search: true,
|
||||
commonRules: [{ required: true, message: "报告类型必填" }],
|
||||
@@ -785,6 +801,7 @@ const crudColumns = ref([
|
||||
},
|
||||
{
|
||||
title: "状态",
|
||||
align: "center",
|
||||
dataIndex: "step",
|
||||
search: true,
|
||||
formType: "radio",
|
||||
|
||||
Reference in New Issue
Block a user