Files
cdTestPlant3/cdTMP/src/views/project/testDemand/index.vue

44 lines
1.4 KiB
Vue
Raw Normal View History

2023-06-15 20:13:46 +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组件 -->
2024-08-13 18:35:48 +08:00
<ma-crud :options="crudOptions" :columns="crudColumns" ref="crudRef" @beforeCancel="handleBeforeCancel">
2023-08-23 20:45:44 +08:00
<template #ident="{ record }">
{{ showType(record) }}
</template>
</ma-crud>
2023-06-15 20:13:46 +08:00
</div>
2024-07-22 18:57:12 +08:00
<problem-form ref="problemFormRef" :title="title"></problem-form>
2023-06-15 20:13:46 +08:00
</div>
</template>
2024-06-04 18:56:45 +08:00
<script setup lang="jsx">
2024-12-30 09:50:38 +08:00
import { ref } from "vue"
2024-07-22 18:57:12 +08:00
import ProblemForm from "@/views/project/case/components/ProblemForm.vue"
2024-12-30 09:50:38 +08:00
import useCrudOpMore from "./hooks/useCrudOpMore"
import useColumn from "./hooks/useColumn"
2024-07-22 18:57:12 +08:00
const problemFormRef = ref(null)
const title = ref("问题单表单")
2023-08-24 19:24:00 +08:00
const crudRef = ref()
2024-12-30 09:50:38 +08:00
// 标识重新定义
2023-08-23 20:45:44 +08:00
const showType = (record) => {
let key_string = parseInt(record.key.substring(record.key.lastIndexOf("-") + 1)) + 1
2024-05-11 18:11:56 +08:00
return "YL-" + record.testType + "-" + record.ident + "-" + key_string.toString().padStart(3, "0")
2023-08-23 20:45:44 +08:00
}
2024-06-04 18:56:45 +08:00
2024-12-30 09:50:38 +08:00
const { handleBeforeCancel, crudOptions } = useCrudOpMore(crudRef)
const crudColumns = useColumn(crudRef, problemFormRef)
2024-05-11 18:11:56 +08:00
// 暴露刷新表格方法给外部
const refreshCrudTable = () => {
crudRef.value.refresh()
}
defineExpose({ refreshCrudTable })
2024-07-22 18:57:12 +08:00
defineOptions({
name: "testDemand"
})
2023-06-15 20:13:46 +08:00
</script>
<style lang="less" scoped></style>