Selaa lähdekoodia

feat: 调整小区名称字符长度和接口报错的code规则;

liujia 1 viikko sitten
vanhempi
commit
f0f7b8f

+ 1 - 1
src/components/DetectionAreaView/index.vue

@@ -515,7 +515,7 @@ const drawAreaBorder = () => {
 
   // 绘制蓝色边框
   ctx.strokeStyle = '#1677ff'
-  ctx.lineWidth = 3
+  ctx.lineWidth = 1
   ctx.strokeRect(canvasRect.left, canvasRect.top, canvasRect.width, canvasRect.height)
 
   // 添加半透明蓝色填充

+ 16 - 13
src/views/community/components/add/index.vue

@@ -23,7 +23,7 @@
             <a-input
               v-model:value.trim="formState.tenantName"
               placeholder="请输入小区名称,如:天鹅湖畔(南区)"
-              :maxlength="300"
+              :maxlength="60"
               show-count
               allow-clear
             >
@@ -144,9 +144,10 @@ import { message, type FormInstance } from 'ant-design-vue'
 import * as tenantApi from '@/api/tenant'
 import pcdCascader from '../pcdCascader/index.vue'
 import { InfoCircleOutlined } from '@ant-design/icons-vue'
-import TinyPinyin from 'tiny-pinyin'
+// import TinyPinyin from 'tiny-pinyin'
 import * as systemApi from '@/api/system'
 import { useDict } from '@/hooks/useDict'
+import { customAlphabet } from 'nanoid'
 
 defineOptions({
   name: 'addCommunity',
@@ -320,18 +321,20 @@ const cancel = () => {
 // 添加小区
 const addCommunity = async () => {
   try {
-    const getTenantCode = (name: string): string => {
-      if (!TinyPinyin.isSupported()) return ''
-      return name
-        .split('')
-        .map((char) => {
-          const py = TinyPinyin.convertToPinyin(char)
-          return py.charAt(0)
-        })
-        .join('')
-    }
+    // const getTenantCode = (name: string): string => {
+    //   if (!TinyPinyin.isSupported()) return ''
+    //   return name
+    //     .split('')
+    //     .map((char) => {
+    //       const py = TinyPinyin.convertToPinyin(char)
+    //       return py.charAt(0)
+    //     })
+    //     .join('')
+    // }
 
-    const tenantCodes = getTenantCode(formState.tenantName)
+    // const tenantCodes = getTenantCode(formState.tenantName)
+    const nanoid = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyz', 30)
+    const tenantCodes = nanoid()
     const res = await tenantApi.queryTenantAdd({
       tenantId: formState.tenantId || '',
       tenantCode: tenantCodes,

+ 1 - 1
src/views/community/list/index.vue

@@ -6,7 +6,7 @@
           <a-input
             v-model:value.trim="searchState.tenantName"
             placeholder="小区名称"
-            :maxlength="300"
+            :maxlength="60"
             show-count
             allow-clear
             @change="clearHandler"