This commit is contained in:
oneao committed 2026-03-31 17:19:34 +08:00
1 parent 422d206bd6
commit a4bd92264d
108 files changed
+16862 -35

No files matched your search

@@ -53,7 +53,7 @@ const pagination = reactive({
const fileCategories = [
{
label: "集装箱号",
label: "箱门照",
cateId: "0",
},
{
@@ -718,7 +718,7 @@ function buildFileName(containerNo, index, fileName) {
/>
<HighDownloadDialog v-model="showHighDownload" />
<UpdateDialog v-model="showUpdate" :data="currentRow" />
<UpdateDialog v-model="showUpdate" :data="currentRow" @update="loadTableDatas" />
</div>
</template>
@@ -1,4 +1,7 @@
<script lang="js" setup>
import { ElMessage } from "element-plus";
import { saveObjectApi } from "@/request/api";
const visible = defineModel(false);
const props = defineProps({
@@ -8,6 +11,8 @@ const props = defineProps({
},
});
const emits = defineEmits(["update"]);
const loading = ref(false);
const form = ref({
@@ -26,18 +31,79 @@ const title = computed(() => {
});
function onOpened() {
loading.global = true;
console.log("对话框已打开");
//
form.value = {
b_id: props.data.b_id,
b_container_no: props.data.b_container_no,
};
}
function onClosed() {
loading.value = true;
form.value = {
b_id: "",
b_container_no: "",
};
}
async function handleSave() {
loading.value = true;
// 检查是否符合规则
if (!validateContainerNo(form.value.b_container_no)) {
ElMessage.error("箱号格式不正确,请输入4个字母加7个数字的格式");
loading.value = false;
return;
}
// 检查是否有修改
if (form.value.b_container_no === props.data.b_container_no) {
ElMessage.success("保存成功");
loading.value = false;
visible.value = false;
return;
}
let updateObj = {
b_id: form.value.b_id,
b_container_no: form.value.b_container_no,
};
// 保存
await saveObjectApi([
{
tableName: "b_container",
keyField: "b_id",
inserts: [],
updates: [updateObj],
deletes: [],
},
])
.then((res) => {
if (res.success) {
ElMessage.success("保存成功");
emits("update");
visible.value = false;
} else {
ElMessage.error(res.message || "保存失败");
}
})
.finally(() => {
loading.value = false;
});
}
// 集装箱号校验
function validateContainerNo(containerNo) {
// 正则表达式: 4个字母 + 7个数字
const pattern = /^[A-Z]{4}\d{7}$/i;
// 使用正则进行匹配
if (pattern.test(containerNo)) {
return true;
} else {
return false;
}
}
</script>
<template>
@@ -66,7 +132,7 @@ function onClosed() {
</el-icon>
取消
</el-button>
<el-button type="primary">
<el-button type="primary" :loading="loading" @click="handleSave">
<el-icon class="el-icon--left">
<G3Icon icon="lucide:save" />
</el-icon>