Commit ea330f04 by chenwq1

fix:修复bug

1 parent d14bf3e5
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"core-js": "^3.6.5", "core-js": "^3.6.5",
"dayjs": "^1.10.7", "dayjs": "^1.10.7",
"echarts": "^5.2.2", "echarts": "^5.2.2",
"glsk-oss-jssdk": "^1.0.7", "glsk-oss-jssdk": "^1.0.6",
"image-conversion": "^2.1.1", "image-conversion": "^2.1.1",
"ionicons": "^8.0.9", "ionicons": "^8.0.9",
"lib": "file:../lib", "lib": "file:../lib",
......
...@@ -45,8 +45,8 @@ importers: ...@@ -45,8 +45,8 @@ importers:
specifier: ^5.2.2 specifier: ^5.2.2
version: 5.6.0 version: 5.6.0
glsk-oss-jssdk: glsk-oss-jssdk:
specifier: ^1.0.7 specifier: ^1.0.6
version: 1.0.7 version: 1.0.6
image-conversion: image-conversion:
specifier: ^2.1.1 specifier: ^2.1.1
version: 2.1.1 version: 2.1.1
...@@ -1826,8 +1826,8 @@ packages: ...@@ -1826,8 +1826,8 @@ packages:
resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==}
engines: {node: '>=10'} engines: {node: '>=10'}
glsk-oss-jssdk@1.0.7: glsk-oss-jssdk@1.0.6:
resolution: {integrity: sha512-e5uQWWD+f8UJ/zE7F1qJi09YvSMhX3iAbglJuwOOstMv0aVulX8gA3tdn8zPruS0fxzqrcpE9BNhwnETuHbSpw==} resolution: {integrity: sha512-uifUcPNbb6Roas0Dlx6LRldHPwU1yQqJbQRldUaNB+e6stFvn9XrsewCueNDUty3cZw4NCg3yao2WVCUm3T2Og==}
good-listener@1.2.2: good-listener@1.2.2:
resolution: {integrity: sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==} resolution: {integrity: sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==}
...@@ -5014,7 +5014,7 @@ snapshots: ...@@ -5014,7 +5014,7 @@ snapshots:
merge2: 1.4.1 merge2: 1.4.1
slash: 3.0.0 slash: 3.0.0
glsk-oss-jssdk@1.0.7: glsk-oss-jssdk@1.0.6:
dependencies: dependencies:
ali-oss: 6.23.0 ali-oss: 6.23.0
axios: 1.15.0 axios: 1.15.0
......
...@@ -52,8 +52,22 @@ ...@@ -52,8 +52,22 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { DetectionController } from "@/api/DetectionController"; import { DetectionController } from "@/api/DetectionController";
import { CopyOutlined } from "@ant-design/icons-vue";
import { message } from "ant-design-vue";
import { h, type VNode } from "vue";
@Component({ components: {} }) function formatLogValue(value: unknown): string {
if (value == null || value === "") {
return "-";
}
return String(value);
}
function hasCopyableValue(value: unknown): boolean {
return value != null && String(value).trim() !== "";
}
@Component({ components: { CopyOutlined } })
export default class OperationLog extends Vue { export default class OperationLog extends Vue {
workOrderId: any = ""; workOrderId: any = "";
logList: any[] = []; logList: any[] = [];
...@@ -63,7 +77,22 @@ export default class OperationLog extends Vue { ...@@ -63,7 +77,22 @@ export default class OperationLog extends Vue {
loading = false; loading = false;
hasMore = true; hasMore = true;
detailColumns: any[] = [ detailColumns: any[] = [];
created() {
this.detailColumns = this.buildDetailColumns();
}
buildDetailColumns() {
const renderCell = (text: unknown) => this.renderValueCell(text);
const valueColumn = (title: string, dataIndex: string, key: string) => ({
title,
dataIndex,
key,
width: 280,
customRender: ({ text }: { text: unknown }) => renderCell(text),
});
return [
{ {
title: "变更项", title: "变更项",
dataIndex: "fieldLabel", dataIndex: "fieldLabel",
...@@ -71,21 +100,34 @@ export default class OperationLog extends Vue { ...@@ -71,21 +100,34 @@ export default class OperationLog extends Vue {
width: 200, width: 200,
ellipsis: true, ellipsis: true,
}, },
valueColumn("变更前的值", "beforeValue", "beforeValue"),
valueColumn("变更后的值", "afterValue", "afterValue"),
];
}
renderValueCell = (value: unknown): VNode => {
const display = formatLogValue(value);
const children: VNode[] = [
h("span", { class: "op-log-value-text", title: display }, display),
];
if (hasCopyableValue(value)) {
children.push(
h(
"a",
{ {
title: "变更前的值", class: "op-log-copy-btn",
dataIndex: "beforeValue", onClick: (e: Event) => {
key: "beforeValue", e.stopPropagation();
width: 280, e.preventDefault();
ellipsis: true, void this.copyLogValue(value);
}, },
{
title: "变更后的值",
dataIndex: "afterValue",
key: "afterValue",
width: 280,
ellipsis: true,
}, },
]; [h(CopyOutlined), " 复制"],
),
);
}
return h("div", { class: "op-log-value-cell" }, children);
};
isChangeLog(item: any) { isChangeLog(item: any) {
const type = Number(item?.operationType); const type = Number(item?.operationType);
...@@ -142,6 +184,19 @@ export default class OperationLog extends Vue { ...@@ -142,6 +184,19 @@ export default class OperationLog extends Vue {
if (!str) return ""; if (!str) return "";
return String(str).charAt(0); return String(str).charAt(0);
} }
async copyLogValue(value: unknown) {
const text = formatLogValue(value);
if (text === "-") {
return;
}
try {
await navigator.clipboard.writeText(text);
message.success("复制成功");
} catch {
message.error("复制失败");
}
}
} }
</script> </script>
...@@ -260,4 +315,43 @@ export default class OperationLog extends Vue { ...@@ -260,4 +315,43 @@ export default class OperationLog extends Vue {
.p-l-8 { .p-l-8 {
padding-left: 8px; padding-left: 8px;
} }
</style>
<style lang="less">
.op-log-detail-popover .op-log-detail-table .ant-table-cell {
vertical-align: middle;
}
.op-log-detail-popover .op-log-value-cell {
display: flex;
align-items: center;
gap: 16px;
width: 100%;
padding-right: 4px;
}
.op-log-detail-popover .op-log-value-text {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding-right: 4px;
}
.op-log-detail-popover .op-log-copy-btn {
flex-shrink: 0;
margin-left: 4px;
padding-left: 12px;
font-size: 12px;
color: #1956fe;
white-space: nowrap;
cursor: pointer;
border-left: 1px solid #e8eaed;
}
.op-log-detail-popover .op-log-copy-btn:hover {
color: #0d3fd4;
}
</style> </style>
...@@ -362,13 +362,13 @@ export default class TestingScore extends Vue { ...@@ -362,13 +362,13 @@ export default class TestingScore extends Vue {
postData = { postData = {
taskId: 0, taskId: 0,
exteriorScore: 0, exteriorScore: null as number | null,
exteriorComment: "", exteriorComment: "",
skeletonLevel: "", skeletonLevel: "",
skeletonComment: "", skeletonComment: "",
interiorLevel: "", interiorLevel: "",
interiorComment: "", interiorComment: "",
overallScore: 0, overallScore: null as number | null,
overallComment: "", overallComment: "",
}; };
...@@ -411,14 +411,26 @@ export default class TestingScore extends Vue { ...@@ -411,14 +411,26 @@ export default class TestingScore extends Vue {
return changed.filter((k) => !ignoreKeys.has(k)); return changed.filter((k) => !ignoreKeys.has(k));
} }
/** 评分为 0 视为已填写;仅 null / undefined / 空字符串 视为未填 */
isScoreFilled(value: unknown): boolean {
if (value === 0 || value === "0") {
return true;
}
if (value === null || value === undefined || value === "") {
return false;
}
const n = Number(value);
return !Number.isNaN(n);
}
hasRequiredUnfilled(): boolean { hasRequiredUnfilled(): boolean {
return !this.postData.exteriorScore return !this.isScoreFilled(this.postData.exteriorScore)
|| !this.postData.exteriorComment || !this.postData.exteriorComment
|| !this.postData.skeletonLevel || !this.postData.skeletonLevel
|| !this.postData.skeletonComment || !this.postData.skeletonComment
|| !this.postData.interiorLevel || !this.postData.interiorLevel
|| !this.postData.interiorComment || !this.postData.interiorComment
|| !this.postData.overallScore || !this.isScoreFilled(this.postData.overallScore)
|| !this.postData.overallComment; || !this.postData.overallComment;
} }
...@@ -458,7 +470,7 @@ export default class TestingScore extends Vue { ...@@ -458,7 +470,7 @@ export default class TestingScore extends Vue {
} }
submitForm() { submitForm() {
if (!this.postData.exteriorScore) { if (!this.isScoreFilled(this.postData.exteriorScore)) {
message.error("请输入外观评分"); message.error("请输入外观评分");
return; return;
} }
...@@ -482,7 +494,7 @@ export default class TestingScore extends Vue { ...@@ -482,7 +494,7 @@ export default class TestingScore extends Vue {
message.error("请查验车辆内饰相关部位和程度"); message.error("请查验车辆内饰相关部位和程度");
return; return;
} }
if (!this.postData.overallScore) { if (!this.isScoreFilled(this.postData.overallScore)) {
message.error("请输入综合评分"); message.error("请输入综合评分");
return; return;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!