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组件 -->
|
2025-05-28 18:44:58 +08:00
|
|
|
|
<ma-crud
|
|
|
|
|
|
id="basic-table-design-normal"
|
|
|
|
|
|
:options="crudOptions"
|
|
|
|
|
|
:columns="crudColumns"
|
|
|
|
|
|
ref="crudRef"
|
|
|
|
|
|
:parent-key="route.query.key"
|
|
|
|
|
|
>
|
2023-08-23 20:45:44 +08:00
|
|
|
|
<template #ident="{ record }">
|
|
|
|
|
|
{{ showType(record) }}
|
|
|
|
|
|
</template>
|
2024-05-24 19:27:16 +08:00
|
|
|
|
<template #tableAfterButtons>
|
2025-05-28 18:44:58 +08:00
|
|
|
|
<a-space>
|
|
|
|
|
|
<a-button
|
|
|
|
|
|
status="success"
|
|
|
|
|
|
type="outline"
|
|
|
|
|
|
@click="handleAddFileInputDemand"
|
|
|
|
|
|
v-if="isXQ === 'XQ'"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #icon>
|
|
|
|
|
|
<icon-plus />
|
|
|
|
|
|
</template>
|
|
|
|
|
|
上传需求规格说明快捷录入
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
<a-divider direction="vertical" type="double" />
|
|
|
|
|
|
<a-button type="outline" @click="handleReplaceClick">批量替换</a-button>
|
|
|
|
|
|
</a-space>
|
2024-05-24 19:27:16 +08:00
|
|
|
|
</template>
|
2024-07-22 18:57:12 +08:00
|
|
|
|
<!-- 字段的前缀后缀的插槽 -->
|
|
|
|
|
|
<!-- 版本字段的插槽 -->
|
|
|
|
|
|
<template #inputPrepend-ident> SJ-XX- </template>
|
2023-08-23 20:45:44 +08:00
|
|
|
|
</ma-crud>
|
2023-06-19 19:51:12 +08:00
|
|
|
|
</div>
|
2025-04-30 17:44:22 +08:00
|
|
|
|
<file-input-modal ref="fileInputRef" @enterFinish="crudRef.refresh()"></file-input-modal>
|
2025-05-28 18:44:58 +08:00
|
|
|
|
<!-- 批量替换组件 -->
|
|
|
|
|
|
<ReplaceModel
|
|
|
|
|
|
ref="replaceModal"
|
|
|
|
|
|
:api="designApi.replace"
|
|
|
|
|
|
:columns="[
|
|
|
|
|
|
{ dataIndex: 'ident', title: '标识' },
|
|
|
|
|
|
{ dataIndex: 'name', title: '名称' },
|
|
|
|
|
|
{ dataIndex: 'chapter', title: '章节号' },
|
|
|
|
|
|
{ dataIndex: 'description', title: '需求描述' }
|
|
|
|
|
|
]"
|
|
|
|
|
|
key="modal-design-normal"
|
|
|
|
|
|
popup-key="design-normal"
|
|
|
|
|
|
@replaceSuccess="replaceSuccessHandle"
|
|
|
|
|
|
/>
|
2023-06-19 19:51:12 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
2025-05-10 19:21:50 +08:00
|
|
|
|
<script setup>
|
2024-09-06 10:48:22 +08:00
|
|
|
|
import { ref } from "vue"
|
2024-12-30 09:50:38 +08:00
|
|
|
|
import useCrudOptions from "@/views/project/dut/hooks/useCrudOptions"
|
|
|
|
|
|
import useColumns from "./hooks/useColumns"
|
2025-05-28 18:44:58 +08:00
|
|
|
|
import { Message } from "@arco-design/web-vue"
|
2024-09-06 10:48:22 +08:00
|
|
|
|
import { useRoute } from "vue-router"
|
2024-05-31 18:29:29 +08:00
|
|
|
|
import dutApi from "@/api/project/dut"
|
2025-05-28 18:44:58 +08:00
|
|
|
|
import designApi from "@/api/project/designDemand"
|
2023-08-23 20:45:44 +08:00
|
|
|
|
import commonApi from "@/api/common"
|
2024-05-24 19:27:16 +08:00
|
|
|
|
import FileInputModal from "./components/FileInputModal/index.vue"
|
2025-05-28 18:44:58 +08:00
|
|
|
|
import ReplaceModel from "@/views/project/opeSets/components/DesignTable/ReplaceModal.vue"
|
|
|
|
|
|
|
2023-06-19 19:51:12 +08:00
|
|
|
|
const route = useRoute()
|
2023-08-24 19:24:00 +08:00
|
|
|
|
const crudRef = ref()
|
2023-08-15 17:15:52 +08:00
|
|
|
|
const projectId = ref(route.query.id)
|
2025-05-28 18:44:58 +08:00
|
|
|
|
|
|
|
|
|
|
// 5月28日新增功能:替换
|
|
|
|
|
|
const replaceModal = ref()
|
|
|
|
|
|
|
|
|
|
|
|
const handleReplaceClick = () => {
|
|
|
|
|
|
replaceModal.value?.open(crudRef.value.getSelecteds) // 把获取选中行的函数给传递给替换组件
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const replaceSuccessHandle = async (count) => {
|
|
|
|
|
|
Message.success(`批量更新成功,尝试更新行数:${count}`)
|
|
|
|
|
|
// 批量更新后刷新表格
|
|
|
|
|
|
crudRef.value.refresh()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-11 18:11:56 +08:00
|
|
|
|
// 5月8日修改设计需求标识就按SJ-FT-设计需求标识来
|
2023-08-23 20:45:44 +08:00
|
|
|
|
const demandTypeDict = ref([])
|
2024-12-30 09:50:38 +08:00
|
|
|
|
;(function () {
|
2023-08-23 20:45:44 +08:00
|
|
|
|
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组件
|
2024-12-30 09:50:38 +08:00
|
|
|
|
const crudOptions = useCrudOptions(crudRef)
|
|
|
|
|
|
const crudColumns = useColumns(crudRef)
|
2025-05-28 18:44:58 +08:00
|
|
|
|
|
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
|
|
|
|
}
|
2024-07-22 18:57:12 +08:00
|
|
|
|
|
2024-12-26 17:53:50 +08:00
|
|
|
|
const refreshCrudTable = () => {
|
|
|
|
|
|
crudRef.value.refresh()
|
|
|
|
|
|
}
|
|
|
|
|
|
defineExpose({ refreshCrudTable })
|
|
|
|
|
|
|
2024-07-22 18:57:12 +08:00
|
|
|
|
defineOptions({
|
|
|
|
|
|
name: "dut"
|
|
|
|
|
|
})
|
2023-06-19 19:51:12 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
2025-05-28 18:44:58 +08:00
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
|
/* 下面让modal的蒙层不交互,让用户可以复制table的文字 */
|
|
|
|
|
|
div:deep(.arco-modal-container) {
|
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
:deep(.arco-modal.arco-modal-draggable) {
|
|
|
|
|
|
pointer-events: auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|