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组件 -->
|
2023-08-24 19:24:00 +08:00
|
|
|
|
<ma-crud :options="crudOptions" :columns="crudColumns" ref="crudRef">
|
2023-08-23 20:45:44 +08:00
|
|
|
|
<template #ident="{ record }">
|
|
|
|
|
|
{{ showType(record) }}
|
|
|
|
|
|
</template>
|
2024-05-24 19:27:16 +08:00
|
|
|
|
<template #tableAfterButtons>
|
2024-05-31 18:29:29 +08:00
|
|
|
|
<a-button status="success" type="outline" @click="handleAddFileInputDemand" v-if="isXQ === 'XQ'">
|
2024-05-24 19:27:16 +08:00
|
|
|
|
<template #icon>
|
|
|
|
|
|
<icon-plus />
|
|
|
|
|
|
</template>
|
2024-05-31 18:29:29 +08:00
|
|
|
|
上传需求规格说明快捷录入
|
2024-05-24 19:27:16 +08:00
|
|
|
|
</a-button>
|
|
|
|
|
|
</template>
|
2023-08-23 20:45:44 +08:00
|
|
|
|
</ma-crud>
|
2023-06-19 19:51:12 +08:00
|
|
|
|
</div>
|
2024-05-24 19:27:16 +08:00
|
|
|
|
<file-input-modal ref="fileInputRef"></file-input-modal>
|
2023-06-19 19:51:12 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2023-08-23 20:45:44 +08:00
|
|
|
|
<script setup lang="jsx">
|
|
|
|
|
|
import { ref, computed } from "vue"
|
2023-06-19 19:51:12 +08:00
|
|
|
|
import { useRoute, useRouter } from "vue-router"
|
|
|
|
|
|
import designDemandApi from "@/api/project/designDemand"
|
2024-05-31 18:29:29 +08:00
|
|
|
|
import dutApi from "@/api/project/dut"
|
2023-08-23 20:45:44 +08:00
|
|
|
|
import commonApi from "@/api/common"
|
2023-08-15 17:15:52 +08:00
|
|
|
|
import { useTreeDataStore } from "@/store"
|
2024-05-24 19:27:16 +08:00
|
|
|
|
import FileInputModal from "./components/FileInputModal/index.vue"
|
2023-08-15 17:15:52 +08:00
|
|
|
|
const treeDataStore = useTreeDataStore()
|
2023-06-19 19:51:12 +08:00
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
const router = useRouter()
|
2023-08-24 19:24:00 +08:00
|
|
|
|
const crudRef = ref()
|
2023-06-19 19:51:12 +08:00
|
|
|
|
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)
|
2024-05-11 18:11:56 +08:00
|
|
|
|
// 5月8日修改设计需求标识就按SJ-FT-设计需求标识来
|
2023-08-23 20:45:44 +08:00
|
|
|
|
const demandTypeDict = ref([])
|
|
|
|
|
|
!(function () {
|
|
|
|
|
|
commonApi.getDict("demandType").then((res) => {
|
|
|
|
|
|
demandTypeDict.value = res
|
|
|
|
|
|
})
|
|
|
|
|
|
})()
|
|
|
|
|
|
|
2024-05-31 18:29:29 +08:00
|
|
|
|
// 5月31日更新,获取当前dut的类型,以判断是否显示“需求录入”的按钮
|
|
|
|
|
|
const isXQ = ref("")
|
|
|
|
|
|
async function isXQdemand() {
|
|
|
|
|
|
const res = await dutApi.getDutType({ key: route.query.key, project_id: projectId.value })
|
|
|
|
|
|
isXQ.value = res.data.dut_type
|
|
|
|
|
|
}
|
|
|
|
|
|
isXQdemand()
|
|
|
|
|
|
|
2023-08-23 20:45:44 +08:00
|
|
|
|
const showType = (record) => {
|
|
|
|
|
|
let len = demandTypeDict.value.data.length
|
|
|
|
|
|
for (let i = 0; i < len; i++) {
|
|
|
|
|
|
if (demandTypeDict.value.data[i].key === record.demandType) {
|
|
|
|
|
|
let item = demandTypeDict.value.data[i]
|
2024-05-11 18:11:56 +08:00
|
|
|
|
return "SJ-" + item.show_title + "-" + record.ident
|
2023-08-23 20:45:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-06-19 19:51:12 +08:00
|
|
|
|
// crud组件
|
|
|
|
|
|
const crudOptions = ref({
|
|
|
|
|
|
api: designDemandApi.getDesignDemandList,
|
2024-04-19 18:53:52 +08:00
|
|
|
|
add: { show: true, api: designDemandApi.save, text: "新增设计需求" },
|
2024-05-11 18:11:56 +08:00
|
|
|
|
edit: { show: true, api: designDemandApi.editDesignDemand, text: "编辑设计需求" },
|
2023-08-15 17:15:52 +08:00
|
|
|
|
delete: { show: true, api: designDemandApi.delete },
|
|
|
|
|
|
// 处理添加后函数
|
2023-08-24 19:24:00 +08:00
|
|
|
|
beforeOpenAdd: function () {
|
2024-03-05 16:28:47 +08:00
|
|
|
|
let key_split = route.query.key.split("-")
|
2023-08-25 13:28:24 +08:00
|
|
|
|
let round_key = key_split[0]
|
|
|
|
|
|
let dut_key = key_split[1]
|
2023-08-24 19:24:00 +08:00
|
|
|
|
let td = treeDataStore.treeData
|
|
|
|
|
|
crudRef.value.crudFormRef.actionTitle = `${route.query.ident} > ${td[round_key].title} > ${td[round_key].children[dut_key].title} > 设计需求-`
|
|
|
|
|
|
return true
|
|
|
|
|
|
},
|
|
|
|
|
|
beforeOpenEdit: function (record) {
|
2024-03-05 16:28:47 +08:00
|
|
|
|
let key_split = route.query.key.split("-")
|
2023-08-25 13:28:24 +08:00
|
|
|
|
let round_key = key_split[0]
|
|
|
|
|
|
let dut_key = key_split[1]
|
2023-08-24 19:24:00 +08:00
|
|
|
|
let td = treeDataStore.treeData
|
|
|
|
|
|
crudRef.value.crudFormRef.actionTitle = `${route.query.ident} > ${td[round_key].title} > ${td[round_key].children[dut_key].title} >设计需求[${record.name}]-`
|
|
|
|
|
|
return true
|
|
|
|
|
|
},
|
2023-08-15 17:15:52 +08:00
|
|
|
|
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
|
2024-05-11 18:11:56 +08:00
|
|
|
|
if (!record) {
|
|
|
|
|
|
record = { key: route.query.key + "-X" }
|
|
|
|
|
|
}
|
2023-08-15 17:15:52 +08:00
|
|
|
|
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
|
2024-05-11 18:11:56 +08:00
|
|
|
|
},
|
|
|
|
|
|
showTools: false
|
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",
|
2024-03-05 16:28:47 +08:00
|
|
|
|
commonRules: [{ required: true, message: "ID必填" }],
|
2023-06-19 19:51:12 +08:00
|
|
|
|
validateTrigger: "blur"
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-05-11 18:11:56 +08:00
|
|
|
|
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: "标识是必填" }],
|
2024-05-11 18:11:56 +08:00
|
|
|
|
validateTrigger: "blur",
|
|
|
|
|
|
placeholder: "请输入文档中设计需求的标识"
|
2023-06-19 19:51:12 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
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
|
|
|
|
{
|
2023-08-23 20:45:44 +08:00
|
|
|
|
title: "章节号",
|
|
|
|
|
|
align: "center",
|
|
|
|
|
|
width: 150,
|
|
|
|
|
|
dataIndex: "chapter",
|
|
|
|
|
|
search: true
|
2023-08-21 19:57:49 +08:00
|
|
|
|
},
|
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
|
|
|
|
|
|
}
|
|
|
|
|
|
])
|
2024-05-24 19:27:16 +08:00
|
|
|
|
// ~~~大功能打开ma-form-modal~~~
|
|
|
|
|
|
const fileInputRef = ref(null)
|
|
|
|
|
|
const handleAddFileInputDemand = () => {
|
2024-05-31 18:29:29 +08:00
|
|
|
|
fileInputRef.value.open()
|
2024-05-24 19:27:16 +08:00
|
|
|
|
}
|
2023-06-19 19:51:12 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped></style>
|