2023-06-19 19:51:12 +08:00
|
|
|
<template>
|
|
|
|
|
<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">
|
|
|
|
|
<!-- CRUD组件 -->
|
|
|
|
|
<ma-crud :options="crudOptions" :columns="crudColumns"></ma-crud>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { ref } from "vue"
|
|
|
|
|
import { useRoute, useRouter } from "vue-router"
|
|
|
|
|
import designDemandApi from "@/api/project/designDemand"
|
2023-08-15 17:15:52 +08:00
|
|
|
import { useTreeDataStore } from "@/store"
|
|
|
|
|
const treeDataStore = useTreeDataStore()
|
2023-06-19 19:51:12 +08:00
|
|
|
const route = useRoute()
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
const roundNumber = route.query.key.split("-")[0]
|
|
|
|
|
const dutNumber = route.query.key.split("-")[1]
|
2023-08-15 17:15:52 +08:00
|
|
|
const projectId = ref(route.query.id)
|
2023-06-19 19:51:12 +08:00
|
|
|
// crud组件
|
|
|
|
|
const crudOptions = ref({
|
|
|
|
|
api: designDemandApi.getDesignDemandList,
|
2023-08-15 17:15:52 +08:00
|
|
|
add: { show: true, api: designDemandApi.save },
|
2023-08-02 13:38:09 +08:00
|
|
|
edit: { show: true, api: designDemandApi.editDesignDemand },
|
2023-08-15 17:15:52 +08:00
|
|
|
delete: { show: true, api: designDemandApi.delete },
|
|
|
|
|
// 处理添加后函数
|
|
|
|
|
afterAdd: (res) => {
|
|
|
|
|
let id = projectId.value
|
|
|
|
|
treeDataStore.updateDesignDemandTreeData(res.data, id)
|
|
|
|
|
},
|
|
|
|
|
afterEdit: (res) => {
|
|
|
|
|
let id = projectId.value
|
|
|
|
|
treeDataStore.updateDesignDemandTreeData(res.data, id)
|
|
|
|
|
},
|
|
|
|
|
afterDelete: (res, record) => {
|
|
|
|
|
let id = projectId.value
|
|
|
|
|
treeDataStore.updateDesignDemandTreeData(record, id)
|
|
|
|
|
},
|
2023-06-19 19:51:12 +08:00
|
|
|
parameters: {
|
|
|
|
|
projectId: route.query.id,
|
|
|
|
|
round: roundNumber,
|
|
|
|
|
dut: dutNumber
|
|
|
|
|
},
|
|
|
|
|
showIndex: false,
|
|
|
|
|
rowSelection: { showCheckedAll: true },
|
2023-08-21 19:57:49 +08:00
|
|
|
searchColNumber: 4,
|
2023-07-25 20:03:06 +08:00
|
|
|
tablePagination: false,
|
2023-06-19 19:51:12 +08:00
|
|
|
operationColumn: true,
|
2023-08-02 13:38:09 +08:00
|
|
|
operationColumnAlign: "center",
|
2023-06-19 19:51:12 +08:00
|
|
|
formOption: {
|
2023-08-02 13:38:09 +08:00
|
|
|
width: 1200
|
2023-06-19 19:51:12 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const crudColumns = ref([
|
|
|
|
|
{
|
|
|
|
|
title: "ID",
|
2023-08-02 13:38:09 +08:00
|
|
|
align: "center",
|
2023-06-19 19:51:12 +08:00
|
|
|
width: 50,
|
|
|
|
|
dataIndex: "id",
|
|
|
|
|
commonRules: [{ required: true, message: "标识是必填" }],
|
|
|
|
|
validateTrigger: "blur"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "标识",
|
2023-08-02 13:38:09 +08:00
|
|
|
align: "center",
|
2023-08-21 19:57:49 +08:00
|
|
|
sortable: { sortDirections: ["ascend"] },
|
2023-06-19 19:51:12 +08:00
|
|
|
width: 120,
|
|
|
|
|
dataIndex: "ident",
|
|
|
|
|
search: true,
|
|
|
|
|
commonRules: [{ required: true, message: "标识是必填" }],
|
|
|
|
|
validateTrigger: "blur"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "需求名称",
|
2023-08-02 13:38:09 +08:00
|
|
|
align: "center",
|
2023-06-19 19:51:12 +08:00
|
|
|
width: 150,
|
|
|
|
|
dataIndex: "name",
|
|
|
|
|
search: true,
|
|
|
|
|
commonRules: [{ required: true, message: "需求名称是必填" }],
|
|
|
|
|
validateTrigger: "blur"
|
|
|
|
|
},
|
2023-08-21 19:57:49 +08:00
|
|
|
{
|
|
|
|
|
title:'章节号',
|
|
|
|
|
align:'center',
|
|
|
|
|
width:150,
|
|
|
|
|
dataIndex:'chapter',
|
|
|
|
|
search:true,
|
|
|
|
|
},
|
2023-06-19 19:51:12 +08:00
|
|
|
{
|
|
|
|
|
title: "需求类型",
|
|
|
|
|
width: 150,
|
2023-08-02 13:38:09 +08:00
|
|
|
align: "center",
|
2023-06-19 19:51:12 +08:00
|
|
|
dataIndex: "demandType",
|
2023-08-02 13:38:09 +08:00
|
|
|
addDefaultValue: "1",
|
2023-06-19 19:51:12 +08:00
|
|
|
formType: "radio",
|
|
|
|
|
search: true,
|
|
|
|
|
dict: { name: "demandType", props: { label: "title", value: "key" }, translation: true },
|
|
|
|
|
commonRules: [{ required: true, message: "需求类型是必填" }],
|
|
|
|
|
validateTrigger: "blur"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "需求描述",
|
|
|
|
|
dataIndex: "description",
|
2023-08-02 13:38:09 +08:00
|
|
|
hide: true,
|
2023-06-19 19:51:12 +08:00
|
|
|
width: 300,
|
|
|
|
|
formType: "editor",
|
|
|
|
|
height: 300
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped></style>
|