gemercheung 1 year ago
parent
commit
e31cfc6424
2 changed files with 6 additions and 14 deletions
  1. 5 14
      src/components/single-input.vue
  2. 1 0
      src/view/map/coord.vue

+ 5 - 14
src/components/single-input.vue

@@ -1,17 +1,7 @@
 <template>
-  <el-dialog
-    :model-value="visible"
-    @update:model-value="(val) => emit('update:visible', val)"
-    :title="title"
-    width="500"
-  >
-    <el-input
-      v-model.trim="ivalue"
-      :maxlength="100"
-      show-word-limit
-      type="textarea"
-      :placeholder="placeholder"
-    />
+  <el-dialog :model-value="visible" @update:model-value="(val) => emit('update:visible', val)" :title="title"
+    width="500">
+    <el-input v-model.trim="ivalue" :maxlength="100" show-word-limit type="textarea" :placeholder="placeholder" />
     <template #footer>
       <div class="dialog-footer">
         <el-button @click="emit('update:visible', false)">取消</el-button>
@@ -32,6 +22,7 @@ const props = withDefaults(
     title: string;
     name?: string;
     placeholder: string;
+    isAllowEmpty?: boolean;
     updateValue: (value: string) => void;
   }>(),
   {
@@ -48,7 +39,7 @@ watchEffect(() => {
 });
 
 const submit = async () => {
-  if (ivalue.value.length === 0) {
+  if (ivalue.value.length === 0 && !props.isAllowEmpty) {
     return ElMessage.error(`${props.name || "点位"}名称不能为空!`);
   }
   await props.updateValue(ivalue.value);

+ 1 - 0
src/view/map/coord.vue

@@ -136,6 +136,7 @@
     @update:visible="inputPoint = null"
     :value="inputPoint?.name || ''"
     :update-value="updatePointName"
+    is-allow-empty
     title="测点说明"
     placeholder="请填写测点说明"
   />