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