前端大功能实现
This commit is contained in:
@@ -6,6 +6,14 @@
|
||||
<template #create_datetime="{ record }">
|
||||
{{ record.create_datetime.replace("T", " ") }}
|
||||
</template>
|
||||
<template #tableBeforeButtons>
|
||||
<a-button type="primary" status="warning" @click="handleDeleteLogButton"
|
||||
><template #icon> <icon-delete /> </template>删除7天前数据</a-button
|
||||
>
|
||||
<a-button type="primary" status="danger" @click="handleDeleteAllLogButton"
|
||||
><template #icon> <icon-delete /> </template>删除全部日志</a-button
|
||||
>
|
||||
</template>
|
||||
</ma-crud>
|
||||
</div>
|
||||
</div>
|
||||
@@ -14,6 +22,7 @@
|
||||
<script setup>
|
||||
import { ref, reactive } from "vue"
|
||||
import operationApi from "@/api/monitor/operationLog"
|
||||
import { Message } from "@arco-design/web-vue"
|
||||
|
||||
const crudRef = ref()
|
||||
const crudOptions = reactive({
|
||||
@@ -31,6 +40,16 @@ const crudColumns = reactive([
|
||||
{ title: "操作内容", dataIndex: "operate_des", align: "center" },
|
||||
{ title: "时间", dataIndex: "create_datetime", align: "center", search: true, formType: "range" }
|
||||
])
|
||||
// 删除日志按钮事件处理函数
|
||||
const handleDeleteLogButton = async () => {
|
||||
const res = await operationApi.deleteOperationLogs() // 参数:{day:4}保留4天内的日志
|
||||
Message.success(res.message)
|
||||
}
|
||||
const handleDeleteAllLogButton = async () => {
|
||||
const res = await operationApi.deleteOperationLogs({ day: 0 }) // 0表示删除全部日志
|
||||
crudRef.value.refresh()
|
||||
Message.success(res.message)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
|
||||
@@ -196,7 +196,7 @@ const columns = ref([
|
||||
validateTrigger: "blur"
|
||||
},
|
||||
{
|
||||
title: "标识",
|
||||
title: "问题标识",
|
||||
align: "center",
|
||||
sortable: { sortDirections: ["ascend"] },
|
||||
width: 140,
|
||||
|
||||
@@ -98,6 +98,7 @@ const crudOptions = ref({
|
||||
case: caseNumber
|
||||
},
|
||||
showIndex: false,
|
||||
showTools: false,
|
||||
rowSelection: { showCheckedAll: true },
|
||||
searchColNumber: 3,
|
||||
tablePagination: false,
|
||||
@@ -201,7 +202,7 @@ const crudColumns = ref([
|
||||
validateTrigger: "blur"
|
||||
},
|
||||
{
|
||||
title: "标识",
|
||||
title: "问题标识",
|
||||
align: "center",
|
||||
sortable: { sortDirections: ["ascend"] },
|
||||
width: 140,
|
||||
|
||||
@@ -141,9 +141,8 @@ const showType = (record) => {
|
||||
let len = testTypeDict.value.data.length
|
||||
for (let i = 0; i < len; i++) {
|
||||
if (testTypeDict.value.data[i].key === record.testType) {
|
||||
let key_string = parseInt(record.key.substring(record.key.lastIndexOf("-") + 1)) + 1
|
||||
let item = testTypeDict.value.data[i]
|
||||
return "XQ-" + record.ident + "-" + item.show_title + "-" + key_string.toString().padStart(3, "0")
|
||||
return "XQ-" + item.show_title + "-" + record.ident
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,6 +152,7 @@ const crudOptions = ref({
|
||||
add: { show: true, api: testDemandApi.save, text: "新增测试项" },
|
||||
edit: { show: true, api: testDemandApi.update, text: "修改测试项" },
|
||||
delete: { show: true, api: testDemandApi.delete },
|
||||
showTools: false,
|
||||
beforeOpenAdd: function () {
|
||||
let key_split = route.query.key.split("-")
|
||||
let round_key = key_split[0]
|
||||
@@ -181,6 +181,9 @@ const crudOptions = ref({
|
||||
},
|
||||
afterDelete: (res, record) => {
|
||||
let id = projectId.value
|
||||
if (!record) {
|
||||
record = { key: route.query.key + "-X" }
|
||||
}
|
||||
treeDataStore.updateTestDemandTreeData(record, id)
|
||||
},
|
||||
parameters: {
|
||||
@@ -206,15 +209,15 @@ const crudColumns = ref([
|
||||
dataIndex: "id"
|
||||
},
|
||||
{
|
||||
title: "标识",
|
||||
title: "测项标识",
|
||||
width: 150,
|
||||
dataIndex: "ident",
|
||||
sortable: { sortDirections: ["ascend"] },
|
||||
align: "center",
|
||||
search: true,
|
||||
addDisabled: true,
|
||||
editDisabled: true,
|
||||
validateTrigger: "blur"
|
||||
validateTrigger: "blur",
|
||||
placeholder: "请填写测试项的标识,注意标识不能重复",
|
||||
commonRules: [{ required: true, message: "测试项标识必填" }]
|
||||
},
|
||||
{
|
||||
title: "名称",
|
||||
@@ -261,36 +264,7 @@ const crudColumns = ref([
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "充分条件",
|
||||
hide: true,
|
||||
addDefaultValue: "覆盖需求相关功能",
|
||||
dataIndex: "adequacy",
|
||||
formType: "textarea",
|
||||
maxLength: 256,
|
||||
commonRules: [{ required: true, message: "充分性描述必填" }]
|
||||
},
|
||||
{
|
||||
title: "终止条件",
|
||||
hide: true,
|
||||
dataIndex: "termination",
|
||||
formType: "textarea",
|
||||
showWordLimit: true,
|
||||
maxLength: 1024,
|
||||
addDefaultValue:
|
||||
"1.测试正常终止:测试项分解的所有用例执行完毕,达到充分性要求,相关记录完整;\n2.测试异常终止:由于某些特殊原因导致该测试项分解的测试用例不能完全执行,无法执行的原因已记录",
|
||||
commonRules: [{ required: true, message: "前提条件必填" }]
|
||||
},
|
||||
{
|
||||
title: "前提条件",
|
||||
hide: true,
|
||||
addDefaultValue: "软件正常运行,外部接口通信正常",
|
||||
dataIndex: "premise",
|
||||
formType: "textarea",
|
||||
maxLength: 256,
|
||||
commonRules: [{ required: true, message: "前提条件必填" }]
|
||||
},
|
||||
{
|
||||
title: "测试方法",
|
||||
title: "测试手段",
|
||||
align: "center",
|
||||
dataIndex: "testMethod",
|
||||
formType: "select",
|
||||
@@ -298,24 +272,70 @@ const crudColumns = ref([
|
||||
dict: { name: "testMethod", props: { label: "title", value: "key" }, translation: true }
|
||||
},
|
||||
{
|
||||
title: "测试内容",
|
||||
title: "充分性要求",
|
||||
hide: true,
|
||||
addDefaultValue: "覆盖需求相关功能",
|
||||
dataIndex: "adequacy",
|
||||
formType: "textarea",
|
||||
maxLength: 256,
|
||||
commonRules: [{ required: true, message: "充分性描述必填" }],
|
||||
addDefaultValue:
|
||||
"测试用例覆盖XX子项名称1、XX子项名称2、XX子项名称3子项要求的全部内容。\n所有用例执行完毕,对于未执行的用例说明未执行原因。"
|
||||
},
|
||||
{
|
||||
title: "测试子项",
|
||||
hide: true,
|
||||
dataIndex: "testContent",
|
||||
commonRules: [{ required: true, message: "测试内容必填" }],
|
||||
commonRules: [{ required: true, message: "测试方法是必填的" }],
|
||||
formType: "children-form",
|
||||
type: "table",
|
||||
formList: [
|
||||
{
|
||||
title: "测试分解",
|
||||
dataIndex: "testXuQiu"
|
||||
title: "子项名称",
|
||||
dataIndex: "subName",
|
||||
placeholder: "对应测试项描述标题,和测试方法的标题",
|
||||
rules: [{ required: true, message: "测试子项名称必填" }],
|
||||
onChange: (ev) => {
|
||||
// 取出子项的对象数组
|
||||
const subItemFormData = crudRef.value.getFormData().testContent
|
||||
// 取出充分性条件字段字符串
|
||||
const mapRes = subItemFormData.map((subItem) => subItem.subName)
|
||||
crudRef.value.getFormData().adequacy = `测试用例覆盖${mapRes}子项要求的全部内容。\n所有用例执行完毕,对于未执行的用例说明未执行原因。`
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "预期",
|
||||
dataIndex: "testYuQi"
|
||||
title: "子项描述",
|
||||
dataIndex: "subDesc",
|
||||
placeholder: "对应大纲测试项表格的测试项描述",
|
||||
rules: [{ required: true, message: "测试子项描述必填" }]
|
||||
},
|
||||
{
|
||||
title: "条件",
|
||||
dataIndex: "condition",
|
||||
placeholder: "在什么环境和前置条件下"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "operation",
|
||||
placeholder: "通过xxx操作"
|
||||
},
|
||||
{
|
||||
title: "观察",
|
||||
dataIndex: "observe",
|
||||
placeholder: "查看xxx内容"
|
||||
},
|
||||
{
|
||||
title: "期望",
|
||||
dataIndex: "expect",
|
||||
placeholder: "xxx结果正确"
|
||||
}
|
||||
]
|
||||
}
|
||||
])
|
||||
// 暴露给route-view的刷新表格函数
|
||||
const refreshCrudTable = () => {
|
||||
crudRef.value.refresh()
|
||||
}
|
||||
defineExpose({ refreshCrudTable })
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -24,7 +24,7 @@ const crudRef = ref()
|
||||
const roundNumber = route.query.key.split("-")[0]
|
||||
const dutNumber = route.query.key.split("-")[1]
|
||||
const projectId = ref(route.query.id)
|
||||
// 显示标识是FT-{标识}-001,大体思路是:根据类型生成FT,拼接标识和key的最后一位
|
||||
// 5月8日修改设计需求标识就按SJ-FT-设计需求标识来
|
||||
const demandTypeDict = ref([])
|
||||
!(function () {
|
||||
commonApi.getDict("demandType").then((res) => {
|
||||
@@ -36,9 +36,8 @@ 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 key_string = parseInt(record.key.substring(record.key.lastIndexOf("-") + 1)) + 1
|
||||
let item = demandTypeDict.value.data[i]
|
||||
return "SJ-" + record.ident + "-" + item.show_title + "-" + key_string.toString().padStart(3, "0")
|
||||
return "SJ-" + item.show_title + "-" + record.ident
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,7 +45,7 @@ const showType = (record) => {
|
||||
const crudOptions = ref({
|
||||
api: designDemandApi.getDesignDemandList,
|
||||
add: { show: true, api: designDemandApi.save, text: "新增设计需求" },
|
||||
edit: { show: true, api: designDemandApi.editDesignDemand,text:'编辑设计需求' },
|
||||
edit: { show: true, api: designDemandApi.editDesignDemand, text: "编辑设计需求" },
|
||||
delete: { show: true, api: designDemandApi.delete },
|
||||
// 处理添加后函数
|
||||
beforeOpenAdd: function () {
|
||||
@@ -75,6 +74,9 @@ const crudOptions = ref({
|
||||
},
|
||||
afterDelete: (res, record) => {
|
||||
let id = projectId.value
|
||||
if (!record) {
|
||||
record = { key: route.query.key + "-X" }
|
||||
}
|
||||
treeDataStore.updateDesignDemandTreeData(record, id)
|
||||
},
|
||||
parameters: {
|
||||
@@ -90,7 +92,8 @@ const crudOptions = ref({
|
||||
operationColumnAlign: "center",
|
||||
formOption: {
|
||||
width: 1200
|
||||
}
|
||||
},
|
||||
showTools: false
|
||||
})
|
||||
const crudColumns = ref([
|
||||
{
|
||||
@@ -102,14 +105,15 @@ const crudColumns = ref([
|
||||
validateTrigger: "blur"
|
||||
},
|
||||
{
|
||||
title: "标识",
|
||||
title: "设需标识",
|
||||
align: "center",
|
||||
sortable: { sortDirections: ["ascend"] },
|
||||
width: 120,
|
||||
dataIndex: "ident",
|
||||
search: true,
|
||||
commonRules: [{ required: true, message: "标识是必填" }],
|
||||
validateTrigger: "blur"
|
||||
validateTrigger: "blur",
|
||||
placeholder: "请输入文档中设计需求的标识"
|
||||
},
|
||||
{
|
||||
title: "需求名称",
|
||||
|
||||
@@ -50,6 +50,9 @@ const crudOptions = ref({
|
||||
},
|
||||
afterDelete: (res, record) => {
|
||||
let id = projectId.value
|
||||
if (!record) {
|
||||
record = { key: route.query.key + "-X" }
|
||||
}
|
||||
treeDataStore.updateDutTreeData(record, id)
|
||||
},
|
||||
edit: { show: true, api: dutApi.update, text: "编辑被测件" },
|
||||
@@ -81,7 +84,7 @@ const crudColumns = ref([
|
||||
validateTrigger: "blur"
|
||||
},
|
||||
{
|
||||
title: "标识",
|
||||
title: "测件标识",
|
||||
width: 150,
|
||||
sortable: { sortDirections: ["ascend"] },
|
||||
align: "center",
|
||||
|
||||
@@ -25,19 +25,10 @@ const designDemandNumber = route.query.key.split("-")[2]
|
||||
const testDemandNumber = route.query.key.split("-")[3]
|
||||
const crudRef = ref()
|
||||
const projectId = ref(route.query.id)
|
||||
// 标识显示字段
|
||||
// 标识显示字段-用例比较特殊让后端返回了“FT”字样,因为FT是在测试项里面标识的
|
||||
const showType = (record) => {
|
||||
let key_string = parseInt(record.key.substring(record.key.lastIndexOf("-") + 1)) + 1
|
||||
let k_string_array = record.key.split("-")
|
||||
let demand_key = parseInt(k_string_array.slice(-2)[0]) + 1
|
||||
return (
|
||||
"YL-" +
|
||||
record.ident +
|
||||
"-" +
|
||||
demand_key.toString().padStart(3, "0") +
|
||||
"-" +
|
||||
key_string.toString().padStart(3, "0")
|
||||
)
|
||||
return "YL-" + record.testType + "-" + record.ident + "-" + key_string.toString().padStart(3, "0")
|
||||
}
|
||||
// crud设置
|
||||
const crudOptions = ref({
|
||||
@@ -83,6 +74,9 @@ const crudOptions = ref({
|
||||
},
|
||||
afterDelete: (res, record) => {
|
||||
let id = projectId.value
|
||||
if (!record) {
|
||||
record = { key: route.query.key + "-X" }
|
||||
}
|
||||
treeDataStore.updateCaseTreeData(record, id)
|
||||
},
|
||||
parameters: {
|
||||
@@ -93,6 +87,7 @@ const crudOptions = ref({
|
||||
testDemand: testDemandNumber
|
||||
},
|
||||
showIndex: false,
|
||||
showTools: false,
|
||||
rowSelection: { showCheckedAll: true },
|
||||
searchColNumber: 3,
|
||||
tablePagination: false,
|
||||
@@ -134,7 +129,7 @@ const crudColumns = ref([
|
||||
fixed: "left"
|
||||
},
|
||||
{
|
||||
title: "标识",
|
||||
title: "用例标识",
|
||||
dataIndex: "ident",
|
||||
sortable: { sortDirections: ["ascend"] },
|
||||
width: 140,
|
||||
@@ -220,7 +215,8 @@ const crudColumns = ref([
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "operation",
|
||||
formType: "editor"
|
||||
formType: "editor",
|
||||
height: 180
|
||||
},
|
||||
{
|
||||
title: "预期",
|
||||
@@ -230,8 +226,8 @@ const crudColumns = ref([
|
||||
{
|
||||
title: "结果",
|
||||
dataIndex: "result",
|
||||
|
||||
formType: "editor"
|
||||
formType: "editor",
|
||||
height: 180
|
||||
},
|
||||
{
|
||||
title: "是否通过",
|
||||
@@ -250,6 +246,11 @@ const crudColumns = ref([
|
||||
]
|
||||
}
|
||||
])
|
||||
// 暴露刷新表格方法给外部
|
||||
const refreshCrudTable = () => {
|
||||
crudRef.value.refresh()
|
||||
}
|
||||
defineExpose({ refreshCrudTable })
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
|
||||
@@ -248,6 +248,7 @@ const crudOptions = ref({
|
||||
operationColumn: true,
|
||||
operationWidth: 500,
|
||||
showIndex: false,
|
||||
showTools: false,
|
||||
// 处理弹窗的title
|
||||
beforeOpenAdd: function () {
|
||||
crudRef.value.crudFormRef.actionTitle = "项目"
|
||||
@@ -377,8 +378,8 @@ const crudOptions = ref({
|
||||
// CRUD-CLOMNS
|
||||
const crudColumns = ref([
|
||||
{
|
||||
title: "标识",
|
||||
width: 70,
|
||||
title: "项目标识",
|
||||
width: 90,
|
||||
sortable: { sortDirections: ["ascend"] },
|
||||
dataIndex: "ident",
|
||||
search: true,
|
||||
|
||||
Reference in New Issue
Block a user