vue更新3.5,以及mime打更新

This commit is contained in:
2024-09-06 10:48:22 +08:00
parent 9984041eec
commit 3914762c85
117 changed files with 4348 additions and 8000 deletions

View File

@@ -100,7 +100,7 @@ const crudColumns = reactive([
align: "center",
dataIndex: "name",
search: true,
width: 80,
width: 180,
commonRules: [
{ required: true, message: "名称必填" },
{ maxLength: 50, message: "名称不能超过50个字符" }
@@ -120,6 +120,7 @@ const crudColumns = reactive([
{
title: "电话",
align: "center",
width: 150,
dataIndex: "phone",
search: true,
commonRules: [{ match: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码" }]

View File

@@ -35,6 +35,7 @@ const crudColumns = ref([
{
title: "缩略语",
align: "center",
width: 200,
dataIndex: "title",
search: true,
commonRules: [{ required: true, message: "缩略语必填" }]
@@ -44,7 +45,6 @@ const crudColumns = ref([
align: "center",
dataIndex: "des",
search: true,
width: 500,
ellipsis: true,
commonRules: [{ required: true, message: "全称和描述必填" }]
}

View File

@@ -9,7 +9,6 @@
<script setup>
import { ref } from "vue"
import { Message } from "@arco-design/web-vue"
import contactApi from "@/api/system/contact"
const crudRef = ref()
@@ -27,7 +26,7 @@ const crudOptions = ref({
tablePagination: false,
rowSelection: { showCheckedAll: true },
showTools: false,
afterDelete(response) {
afterDelete() {
crudRef.value.tableRef.selectAll(false)
}
})
@@ -39,13 +38,13 @@ const crudColumns = ref([
align: "center",
dataIndex: "name",
search: true,
width: 150,
commonRules: [{ required: true, message: "名称必填" }]
},
{
title: "简称",
align: "center",
dataIndex: "refer_name",
width: 200,
search: true,
commonRules: [{ required: true, message: "简称必填" }]
},
@@ -62,7 +61,6 @@ const crudColumns = ref([
align: "center",
dataIndex: "addr",
search: true,
width: 150,
commonRules: [{ required: true, message: "公司地址必填" }]
}
])

View File

@@ -192,29 +192,34 @@ const crudOptions = ref({
formType: "divider"
},
{
dataIndex: "operation"
formType: "grid",
cols: [{ span: 24, formList: [{ dataIndex: "operation" }] }]
},
{
dataIndex: "result"
},
{
title: "开发方回填",
formType: "divider"
},
{
dataIndex: "analysis"
},
{
dataIndex: "effect_scope"
},
{
dataIndex: "solve"
formType: "grid",
cols: [{ span: 24, formList: [{ dataIndex: "result" }] }]
},
{
formType: "divider"
},
{
dataIndex: "verify_result"
formType: "grid",
cols: [{ span: 24, formList: [{ dataIndex: "analysis" }] }]
},
{
formType: "grid",
cols: [{ span: 24, formList: [{ dataIndex: "effect_scope" }] }]
},
{
formType: "grid",
cols: [{ span: 24, formList: [{ dataIndex: "solve" }] }]
},
{
formType: "divider"
},
{
formType: "grid",
cols: [{ span: 24, formList: [{ dataIndex: "verify_result" }] }]
},
{
formType: "divider",

View File

@@ -63,8 +63,6 @@ const crudOptions = ref({
edit: { show: true, api: problemApi.update },
delete: { show: true, api: problemApi.delete },
operationColumnAlign: "center", // 操作列居中
// 列表选项卡配置
tabs: {},
beforeOpenAdd: function () {
// 0.判断当前用例的是否为未通过/未执行
if (!caseIsNotPassedOrNotExe()) {
@@ -119,9 +117,11 @@ const crudOptions = ref({
crudRef.value.tableRef.selectAll(false)
},
// 请求后置处理-用于新增/删除更新树状的用例关联问题单状态
afterRequest(datas) {
afterRequest(tableData) {
const caseQuery = { key: route.query.key }
treeDataStore.updateCaseTreeData(caseQuery, route.query.id)
// 新版本mime必须返回
return tableData
},
showIndex: false,
showTools: false,
@@ -162,29 +162,34 @@ const crudOptions = ref({
formType: "divider"
},
{
dataIndex: "operation"
formType: "grid",
cols: [{ span: 24, formList: [{ dataIndex: "operation" }] }]
},
{
dataIndex: "result"
},
{
formType: "divider",
title: "开发方回填"
},
{
dataIndex: "analysis"
},
{
dataIndex: "effect_scope"
},
{
dataIndex: "solve"
formType: "grid",
cols: [{ span: 24, formList: [{ dataIndex: "result" }] }]
},
{
formType: "divider"
},
{
dataIndex: "verify_result"
formType: "grid",
cols: [{ span: 24, formList: [{ dataIndex: "analysis" }] }]
},
{
formType: "grid",
cols: [{ span: 24, formList: [{ dataIndex: "effect_scope" }] }]
},
{
formType: "grid",
cols: [{ span: 24, formList: [{ dataIndex: "solve" }] }]
},
{
formType: "divider"
},
{
formType: "grid",
cols: [{ span: 24, formList: [{ dataIndex: "verify_result" }] }]
},
{
formType: "divider",

View File

@@ -105,6 +105,7 @@ export default function useCrudRef() {
rowSelection: { showCheckedAll: true },
searchColNumber: 3,
tablePagination: false,
operationColumnWidth:200,
operationColumn: true,
operationColumnAlign: "center",
formOption: {
@@ -184,7 +185,7 @@ export default function useCrudRef() {
maxLength: 200,
commonRules: [{ required: true, message: "测试类型必选" }],
dict: { name: "testType", translation: true, props: { label: "title", value: "key" } },
extra: "请保证测试类型选择正确",
extra: "支持拼音搜索例如gn可以搜索出功能测试",
// 这是arco的属性所以在ma-crud和ma-form可以直接使用arco属性和事件事件+onXXX
filterOption: function (inputValue, selectedOption) {
if (inputValue) {

View File

@@ -24,8 +24,8 @@
</template>
<script setup lang="jsx">
import { ref, computed } from "vue"
import { useRoute, useRouter } from "vue-router"
import { ref } from "vue"
import { useRoute } from "vue-router"
import designDemandApi from "@/api/project/designDemand"
import dutApi from "@/api/project/dut"
import commonApi from "@/api/common"
@@ -33,7 +33,6 @@ import { useTreeDataStore } from "@/store"
import FileInputModal from "./components/FileInputModal/index.vue"
const treeDataStore = useTreeDataStore()
const route = useRoute()
const router = useRouter()
const crudRef = ref()
const roundNumber = route.query.key.split("-")[0]
const dutNumber = route.query.key.split("-")[1]
@@ -103,7 +102,6 @@ const crudOptions = ref({
// 删除后情况行选择器
crudRef.value.tableRef.selectAll(false)
},
parameters: {
projectId: route.query.id,
round: roundNumber,
@@ -113,6 +111,7 @@ const crudOptions = ref({
rowSelection: { showCheckedAll: true },
searchColNumber: 4,
tablePagination: false,
operationColumnWidth: 250,
operationColumn: true,
operationColumnAlign: "center",
formOption: {
@@ -134,7 +133,7 @@ const crudColumns = ref([
title: "设需标识",
align: "center",
sortable: { sortDirections: ["ascend"] },
width: 120,
width: 180,
dataIndex: "ident",
search: true,
validateTrigger: "blur",
@@ -145,7 +144,7 @@ const crudColumns = ref([
{
title: "设需名称",
align: "center",
width: 150,
width: 200,
dataIndex: "name",
search: true,
commonRules: [{ required: true, message: "设计需求名称是必填" }],
@@ -171,7 +170,7 @@ const crudColumns = ref([
commonRules: [{ required: true, message: "需求类型是必填" }],
validateTrigger: "blur",
// 主要为了添加“接口”的4个字段
control: (value) => {
onControl: (value) => {
if (value === "3") {
return {
source: { display: true },

View File

@@ -32,6 +32,8 @@ let beiceType = [
const crudOptions = ref({
api: dutApi.getDutList,
add: { show: true, api: dutApi.save, text: "新增被测件" },
edit: { show: true, api: dutApi.update, text: "编辑被测件" },
delete: { show: true, api: dutApi.delete },
// 处理添加后函数
beforeOpenAdd: function () {
let round_str = parseInt(route.query.key) + 1
@@ -60,8 +62,8 @@ const crudOptions = ref({
// 清空行选择器
crudRef.value.tableRef.selectAll(false)
},
edit: { show: true, api: dutApi.update, text: "编辑被测件" },
delete: { show: true, api: dutApi.delete },
// 新增、编辑、删除均携带下面
parameters: {
projectId: route.query.id,
round: roundNumber
@@ -72,6 +74,7 @@ const crudOptions = ref({
rowSelection: { showCheckedAll: true },
searchColNumber: 3,
tablePagination: false,
operationColumnWidth: 200, // 操作列宽度
operationColumn: true,
operationColumnAlign: "center",
formOption: {
@@ -81,6 +84,14 @@ const crudOptions = ref({
}
})
// 1.计算注释率函数 -> 用于字段交互
const calcPercent = () => {
const formData = crudRef.value.getFormData()
const total_line = +formData.black_line + +formData.code_line + +formData.comment_line + +formData.mix_line
const comment_total = +formData.comment_line + +formData.mix_line
formData.comment_percent = `${(comment_total / total_line).toFixed(2).toString()}%`
}
const crudColumns = ref([
{
title: "ID",
@@ -116,7 +127,7 @@ const crudColumns = ref([
translation: true,
tagColors: { XQ: "blue", SO: "green", SJ: "orangered", XY: "pinkpurple", YZ: "red" }
},
control: (value) => {
onControl: (value) => {
if (value === "SO") {
return {
black_line: { display: true },
@@ -194,7 +205,10 @@ const crudColumns = ref([
dataIndex: "black_line",
formType: "input-number",
commonRules: [{ required: true, message: "空行数必填" }],
min: 0
min: 0,
onControl: () => {
calcPercent()
}
},
{
title: "纯代码行",
@@ -203,7 +217,10 @@ const crudColumns = ref([
dataIndex: "code_line",
formType: "input-number",
commonRules: [{ required: true, message: "纯代码行数必填" }],
min: 0
min: 0,
onControl: () => {
calcPercent()
}
},
{
title: "纯注释行",
@@ -212,7 +229,10 @@ const crudColumns = ref([
dataIndex: "comment_line",
formType: "input-number",
commonRules: [{ required: true, message: "纯注释行数必填" }],
min: 0
min: 0,
onControl: () => {
calcPercent()
}
},
{
title: "混合行",
@@ -222,61 +242,19 @@ const crudColumns = ref([
formType: "input-number",
help: "混合行是指:代码中一行即包含代码也包含注释",
commonRules: [{ required: true, message: "混合行数必填" }],
min: 0
min: 0,
onControl: () => {
calcPercent()
}
},
{
title: "注释率 %",
align: "center",
dataIndex: "comment_percent",
placeholder: "计算注释率",
hide: true,
addDisabled: true,
editDisabled: true,
customRender: ({ record }) => {
const sum_line =
parseFloat(record.comment_line) +
parseFloat(record.mix_line) +
parseFloat(record.black_line) +
parseFloat(record.code_line)
if (record.comment_line && record.mix_line && record.black_line && record.code_line) {
if (
isNaN(parseFloat(record.comment_line)) ||
isNaN(parseFloat(record.mix_line)) ||
isNaN(parseFloat(record.black_line)) ||
isNaN(parseFloat(record.code_line))
) {
return "数值错误"
}
if (
parseFloat(record.comment_line) <= 0 ||
parseFloat(record.mix_line) <= 0 ||
parseFloat(record.black_line) <= 0 ||
parseFloat(record.code_line) <= 0
) {
return "不能为负数"
}
return (
<a-statistic
animation-duration={parseInt(1000)}
precision={2}
animation
value-style={{ color: "lightblue" }}
value={(parseFloat(record.comment_line) + parseFloat(record.mix_line)) / sum_line}
></a-statistic>
)
}
},
// 字段交互控制
control(value, data) {
data.comment_percent = (
(parseFloat(data.comment_line) + parseFloat(data.mix_line)) /
(parseFloat(data.comment_line) +
parseFloat(data.mix_line) +
parseFloat(data.black_line) +
parseFloat(data.code_line))
)
.toFixed(2)
.toString()
}
editDisabled: true
}
])

View File

@@ -128,6 +128,7 @@ const crudOptions = ref({
rowSelection: { showCheckedAll: true },
searchColNumber: 3,
tablePagination: false,
operationColumnWidth: 180,
operationColumn: true,
formOption: {
width: 1200,
@@ -185,7 +186,7 @@ const crudColumns = ref([
title: "用例标识",
dataIndex: "ident",
sortable: { sortDirections: ["ascend"] },
width: 140,
width: 180,
align: "center",
addDisabled: true,
addDefaultValue: "用例标识自动生成结构为YL_IO_XXXX_001",
@@ -197,7 +198,6 @@ const crudColumns = ref([
{
title: "名称",
dataIndex: "name",
width: 120,
align: "center",
search: true,
commonRules: [{ required: true, message: "名称是必填" }],
@@ -261,7 +261,7 @@ const crudColumns = ref([
{
title: "执行人员",
dataIndex: "testPerson",
width: 80,
width: 120,
align: "center",
search: true,
formType: "select",
@@ -356,7 +356,7 @@ const crudColumns = ref([
{
title: "关联问题",
dataIndex: "problem",
width: 120,
width: 150,
addDisplay: false,
editDisplay: false,
align: "center",

View File

@@ -9,7 +9,7 @@ const useCrudInit = function () {
rowSelection: { showCheckedAll: true },
api: projectApi.getPageList,
add: { show: true, api: projectApi.save, text: "新增项目" },
edit: { show: true, api: projectApi.update, text: "编辑项目" },
edit: { show: true, api: projectApi.update, text: "编辑项目" }, // auth未空数组则所有都可以
delete: { show: true, api: projectApi.delete },
searchColNumber: 3,
tablePagination: false,