Commit 03afa35101d8d573c6249a5583c0b897685ecbc7
1 parent
7b806ddb
'wip:联调设备,fix:修复eslint警告,表单加自定义验证,重写oem省市联动,fix:修改bug'
Showing
38 changed files
with
349 additions
and
372 deletions
| 1 | import { defHttp } from '/@/utils/http/axios'; | 1 | import { defHttp } from '/@/utils/http/axios'; |
| 2 | 2 | ||
| 3 | +// 获取设备配置 | ||
| 3 | export const getDeviceProfile = () => { | 4 | export const getDeviceProfile = () => { |
| 4 | return defHttp.get({ | 5 | return defHttp.get({ |
| 5 | - url: '/deviceProfile/me', | 6 | + url: '/deviceProfile/me/list', |
| 6 | }); | 7 | }); |
| 7 | }; | 8 | }; |
| @@ -3,14 +3,12 @@ import { FileUploadResponse } from './model/index'; | @@ -3,14 +3,12 @@ import { FileUploadResponse } from './model/index'; | ||
| 3 | enum API { | 3 | enum API { |
| 4 | SELECT_DETAIL = '/enterprise/get', | 4 | SELECT_DETAIL = '/enterprise/get', |
| 5 | UPDATE_DETAIL = '/enterprise/update', | 5 | UPDATE_DETAIL = '/enterprise/update', |
| 6 | - TOWN_LIST = '/town/list', | ||
| 7 | - TOWN_CHILDS = '/town/childs', | ||
| 8 | BaseUploadUrl = '/oss/upload', | 6 | BaseUploadUrl = '/oss/upload', |
| 9 | SELECT_PLATFORM = '/platform/get', | 7 | SELECT_PLATFORM = '/platform/get', |
| 10 | UPDATE_PLATFORM = '/platform/update', | 8 | UPDATE_PLATFORM = '/platform/update', |
| 11 | - | ||
| 12 | SELECT_APP_DESIGN = '/appDesign/get', | 9 | SELECT_APP_DESIGN = '/appDesign/get', |
| 13 | UPDATE_APP_DESIGN = '/appDesign/update', | 10 | UPDATE_APP_DESIGN = '/appDesign/update', |
| 11 | + SELECT_AREALIST = '/area/areaList', | ||
| 14 | } | 12 | } |
| 15 | 13 | ||
| 16 | // 查询企业信息 | 14 | // 查询企业信息 |
| @@ -28,21 +26,12 @@ export const updateEnterPriseDetail = (data) => { | @@ -28,21 +26,12 @@ export const updateEnterPriseDetail = (data) => { | ||
| 28 | }); | 26 | }); |
| 29 | }; | 27 | }; |
| 30 | 28 | ||
| 31 | -// 获取所有省份 | ||
| 32 | -export const getTownList = () => { | ||
| 33 | - return defHttp.get({ | ||
| 34 | - url: API.TOWN_LIST, | ||
| 35 | - }); | ||
| 36 | -}; | 29 | +// 获取地区 |
| 37 | 30 | ||
| 38 | -// 获取省份下面的地址 | ||
| 39 | -export const getTownChild = (key, value) => { | ||
| 40 | - return defHttp.get({ | ||
| 41 | - url: API.TOWN_CHILDS + `/${key}/${value}`, | ||
| 42 | - params: { | ||
| 43 | - variable: key, | ||
| 44 | - value, | ||
| 45 | - }, | 31 | +export const getAreaList = (data) => { |
| 32 | + return defHttp.post({ | ||
| 33 | + url: API.SELECT_AREALIST, | ||
| 34 | + data, | ||
| 46 | }); | 35 | }); |
| 47 | }; | 36 | }; |
| 48 | 37 |
| @@ -24,10 +24,10 @@ export const getMenuList = () => { | @@ -24,10 +24,10 @@ export const getMenuList = () => { | ||
| 24 | }; | 24 | }; |
| 25 | 25 | ||
| 26 | export const delMenu = (menuIds: string[]) => { | 26 | export const delMenu = (menuIds: string[]) => { |
| 27 | - let url = Api.BaseMenuUrl; | 27 | + const url = Api.BaseMenuUrl; |
| 28 | return defHttp.delete({ url: url, data: menuIds }); | 28 | return defHttp.delete({ url: url, data: menuIds }); |
| 29 | }; | 29 | }; |
| 30 | export const getMenusIdsByRoleId = (roleId: string) => { | 30 | export const getMenusIdsByRoleId = (roleId: string) => { |
| 31 | - let url = Api.GetMenuIdsByRoleId + roleId; | 31 | + const url = Api.GetMenuIdsByRoleId + roleId; |
| 32 | return defHttp.get<Array<string>>({ url: url }); | 32 | return defHttp.get<Array<string>>({ url: url }); |
| 33 | }; | 33 | }; |
| @@ -32,7 +32,6 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') | @@ -32,7 +32,6 @@ export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') | ||
| 32 | }, | 32 | }, |
| 33 | { | 33 | { |
| 34 | errorMessageMode: mode, | 34 | errorMessageMode: mode, |
| 35 | - joinPrefix: false, | ||
| 36 | } | 35 | } |
| 37 | ); | 36 | ); |
| 38 | } | 37 | } |
| @@ -11,7 +11,7 @@ enum Api { | @@ -11,7 +11,7 @@ enum Api { | ||
| 11 | */ | 11 | */ |
| 12 | export function saveMenuApi( | 12 | export function saveMenuApi( |
| 13 | params: MenuOperationParams, | 13 | params: MenuOperationParams, |
| 14 | - update: boolean = false, | 14 | + update = false, |
| 15 | mode: ErrorMessageMode = 'modal' | 15 | mode: ErrorMessageMode = 'modal' |
| 16 | ) { | 16 | ) { |
| 17 | console.log(params); | 17 | console.log(params); |
| @@ -56,16 +56,11 @@ | @@ -56,16 +56,11 @@ | ||
| 56 | </template> | 56 | </template> |
| 57 | <script lang="ts"> | 57 | <script lang="ts"> |
| 58 | import { defineComponent, unref, computed } from 'vue'; | 58 | import { defineComponent, unref, computed } from 'vue'; |
| 59 | - | ||
| 60 | import { propTypes } from '/@/utils/propTypes'; | 59 | import { propTypes } from '/@/utils/propTypes'; |
| 61 | - | ||
| 62 | import { Layout } from 'ant-design-vue'; | 60 | import { Layout } from 'ant-design-vue'; |
| 63 | import { AppLogo } from '/@/components/Application'; | 61 | import { AppLogo } from '/@/components/Application'; |
| 64 | import LayoutMenu from '../menu/index.vue'; | 62 | import LayoutMenu from '../menu/index.vue'; |
| 65 | import LayoutTrigger from '../trigger/index.vue'; | 63 | import LayoutTrigger from '../trigger/index.vue'; |
| 66 | - | ||
| 67 | - import { AppSearch } from '/@/components/Application'; | ||
| 68 | - | ||
| 69 | import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting'; | 64 | import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting'; |
| 70 | import { useMenuSetting } from '/@/hooks/setting/useMenuSetting'; | 65 | import { useMenuSetting } from '/@/hooks/setting/useMenuSetting'; |
| 71 | import { useRootSetting } from '/@/hooks/setting/useRootSetting'; | 66 | import { useRootSetting } from '/@/hooks/setting/useRootSetting'; |
| @@ -93,7 +88,6 @@ | @@ -93,7 +88,6 @@ | ||
| 93 | AppLocalePicker, | 88 | AppLocalePicker, |
| 94 | FullScreen, | 89 | FullScreen, |
| 95 | Notify, | 90 | Notify, |
| 96 | - AppSearch, | ||
| 97 | ErrorAction, | 91 | ErrorAction, |
| 98 | SettingDrawer: createAsyncComponent(() => import('/@/layouts/default/setting/index.vue'), { | 92 | SettingDrawer: createAsyncComponent(() => import('/@/layouts/default/setting/index.vue'), { |
| 99 | loading: true, | 93 | loading: true, |
| @@ -35,3 +35,10 @@ export const copyTransTreeFun = (arr: any[]) => { | @@ -35,3 +35,10 @@ export const copyTransTreeFun = (arr: any[]) => { | ||
| 35 | } | 35 | } |
| 36 | }); | 36 | }); |
| 37 | }; | 37 | }; |
| 38 | + | ||
| 39 | +// 百度地图url | ||
| 40 | +export const register_BAI_DU_MAP_URL = (ak: string) => { | ||
| 41 | + return `https://api.map.baidu.com/getscript?v=3.0&ak=${ak}`; | ||
| 42 | +}; | ||
| 43 | + | ||
| 44 | +export const BAI_DU_MAP_URL = register_BAI_DU_MAP_URL('7uOPPyAHn2Y2ZryeQqHtcRqtIY374vKa'); |
| @@ -16,7 +16,7 @@ import { useErrorLogStoreWithOut } from '/@/store/modules/errorLog'; | @@ -16,7 +16,7 @@ import { useErrorLogStoreWithOut } from '/@/store/modules/errorLog'; | ||
| 16 | import { useI18n } from '/@/hooks/web/useI18n'; | 16 | import { useI18n } from '/@/hooks/web/useI18n'; |
| 17 | import { joinTimestamp, formatRequestDate } from './helper'; | 17 | import { joinTimestamp, formatRequestDate } from './helper'; |
| 18 | // import { PageEnum } from '/@/enums/pageEnum'; | 18 | // import { PageEnum } from '/@/enums/pageEnum'; |
| 19 | -import { JWT_TOKEN_KEY, REFRESH_TOKEN_KEY, PROJ_CFG_KEY } from '/@/enums/cacheEnum'; | 19 | +import { REFRESH_TOKEN_KEY } from '/@/enums/cacheEnum'; |
| 20 | import { router } from '/@/router'; | 20 | import { router } from '/@/router'; |
| 21 | // import { useUserStore } from '/@/store/modules/user'; | 21 | // import { useUserStore } from '/@/store/modules/user'; |
| 22 | // const userStore = useUserStore(); | 22 | // const userStore = useUserStore(); |
src/utils/rules.ts
0 → 100644
| 1 | +import { Rule } from 'ant-design-vue/lib/form/interface'; | ||
| 2 | +/** | ||
| 3 | + * 常用表单自定义验证规则 | ||
| 4 | + * | ||
| 5 | + */ | ||
| 6 | + | ||
| 7 | +// 手机号验证 | ||
| 8 | +export const phoneRule: Rule[] = [ | ||
| 9 | + { | ||
| 10 | + required: true, | ||
| 11 | + validator: (_, value: string) => { | ||
| 12 | + const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; | ||
| 13 | + if (value === '') { | ||
| 14 | + return Promise.reject('请输入手机号码'); | ||
| 15 | + } else if (!reg.test(value)) { | ||
| 16 | + return Promise.reject('手机号格式不正确'); | ||
| 17 | + } | ||
| 18 | + return Promise.resolve(); | ||
| 19 | + }, | ||
| 20 | + validateTrigger: 'blur', | ||
| 21 | + }, | ||
| 22 | +]; | ||
| 23 | + | ||
| 24 | +// 电子邮箱验证 | ||
| 25 | +export const emailRule: Rule[] = [ | ||
| 26 | + { | ||
| 27 | + validator: (_, value: string) => { | ||
| 28 | + const reg = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/; | ||
| 29 | + if (value === '') { | ||
| 30 | + return Promise.resolve(); | ||
| 31 | + } else if (!reg.test(value)) { | ||
| 32 | + return Promise.reject('电子邮箱格式不正确'); | ||
| 33 | + } | ||
| 34 | + return Promise.resolve(); | ||
| 35 | + }, | ||
| 36 | + validateTrigger: 'blur', | ||
| 37 | + }, | ||
| 38 | +]; |
| @@ -42,20 +42,24 @@ export const formSchema: FormSchema[] = [ | @@ -42,20 +42,24 @@ export const formSchema: FormSchema[] = [ | ||
| 42 | componentProps: { | 42 | componentProps: { |
| 43 | size: 'small', | 43 | size: 'small', |
| 44 | options: [ | 44 | options: [ |
| 45 | + { label: '全部', value: 'ALL' }, | ||
| 45 | { label: '待激活', value: 'INACTIVE' }, | 46 | { label: '待激活', value: 'INACTIVE' }, |
| 46 | { label: '在线', value: 'ONLINE' }, | 47 | { label: '在线', value: 'ONLINE' }, |
| 47 | { label: '离线', value: 'OFFLINE' }, | 48 | { label: '离线', value: 'OFFLINE' }, |
| 48 | - { label: '报警', value: 'hhh' }, | ||
| 49 | ], | 49 | ], |
| 50 | }, | 50 | }, |
| 51 | }, | 51 | }, |
| 52 | { | 52 | { |
| 53 | field: 'alarmStatus', | 53 | field: 'alarmStatus', |
| 54 | - label: '', | 54 | + label: '是否报警', |
| 55 | component: 'RadioGroup', | 55 | component: 'RadioGroup', |
| 56 | + labelWidth: '85px', | ||
| 56 | componentProps: { | 57 | componentProps: { |
| 57 | size: 'small', | 58 | size: 'small', |
| 58 | - options: [{ label: '是否报警', value: '' }], | 59 | + options: [ |
| 60 | + { label: '是', value: '1' }, | ||
| 61 | + { label: '否', value: '2' }, | ||
| 62 | + ], | ||
| 59 | }, | 63 | }, |
| 60 | }, | 64 | }, |
| 61 | ]; | 65 | ]; |
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | <div class="wrapper"> | 2 | <div class="wrapper"> |
| 3 | <div ref="wrapRef" :style="{ height, width }"> </div> | 3 | <div ref="wrapRef" :style="{ height, width }"> </div> |
| 4 | <div class="right-wrap"> | 4 | <div class="right-wrap"> |
| 5 | - <BasicTable @register="registerTable"> | 5 | + <BasicTable @register="registerTable" @rowClick="deviceRowClick"> |
| 6 | <template #deviceState="{ record }"> | 6 | <template #deviceState="{ record }"> |
| 7 | <Tag | 7 | <Tag |
| 8 | :color=" | 8 | :color=" |
| @@ -35,6 +35,7 @@ | @@ -35,6 +35,7 @@ | ||
| 35 | import { devicePage } from '/@/api/alarm/contact/alarmContact'; | 35 | import { devicePage } from '/@/api/alarm/contact/alarmContact'; |
| 36 | import { Tag } from 'ant-design-vue'; | 36 | import { Tag } from 'ant-design-vue'; |
| 37 | import { DeviceState } from '/@/api/device/model/deviceModel'; | 37 | import { DeviceState } from '/@/api/device/model/deviceModel'; |
| 38 | + import { BAI_DU_MAP_URL } from '/@/utils/fnUtils'; | ||
| 38 | export default defineComponent({ | 39 | export default defineComponent({ |
| 39 | name: 'BaiduMap', | 40 | name: 'BaiduMap', |
| 40 | components: { | 41 | components: { |
| @@ -52,8 +53,6 @@ | @@ -52,8 +53,6 @@ | ||
| 52 | }, | 53 | }, |
| 53 | }, | 54 | }, |
| 54 | setup() { | 55 | setup() { |
| 55 | - const BAI_DU_MAP_URL = | ||
| 56 | - 'https://api.map.baidu.com/getscript?v=3.0&ak=7uOPPyAHn2Y2ZryeQqHtcRqtIY374vKa'; | ||
| 57 | const wrapRef = ref<HTMLDivElement | null>(null); | 56 | const wrapRef = ref<HTMLDivElement | null>(null); |
| 58 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); | 57 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); |
| 59 | 58 | ||
| @@ -72,23 +71,25 @@ | @@ -72,23 +71,25 @@ | ||
| 72 | initMap(); | 71 | initMap(); |
| 73 | }); | 72 | }); |
| 74 | 73 | ||
| 75 | - const [registerTable, { reload }] = useTable({ | 74 | + const [registerTable] = useTable({ |
| 76 | api: devicePage, | 75 | api: devicePage, |
| 77 | columns, | 76 | columns, |
| 78 | formConfig: { | 77 | formConfig: { |
| 79 | - labelWidth: 120, | ||
| 80 | schemas: formSchema, | 78 | schemas: formSchema, |
| 79 | + labelAlign: 'left', | ||
| 81 | }, | 80 | }, |
| 82 | showIndexColumn: false, | 81 | showIndexColumn: false, |
| 83 | useSearchForm: true, | 82 | useSearchForm: true, |
| 84 | }); | 83 | }); |
| 85 | - const handleSuccess = () => { | ||
| 86 | - reload(); | 84 | + // 点击表格某一行触发 |
| 85 | + const deviceRowClick = (record) => { | ||
| 86 | + console.log(record); | ||
| 87 | }; | 87 | }; |
| 88 | + | ||
| 88 | return { | 89 | return { |
| 89 | wrapRef, | 90 | wrapRef, |
| 90 | registerTable, | 91 | registerTable, |
| 91 | - handleSuccess, | 92 | + deviceRowClick, |
| 92 | DeviceState, | 93 | DeviceState, |
| 93 | }; | 94 | }; |
| 94 | }, | 95 | }, |
| 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
| 2 | import { getOrganizationList } from '/@/api/system/system'; | 2 | import { getOrganizationList } from '/@/api/system/system'; |
| 3 | import { copyTransFun } from '/@/utils/fnUtils'; | 3 | import { copyTransFun } from '/@/utils/fnUtils'; |
| 4 | +import { emailRule, phoneRule } from '/@/utils/rules'; | ||
| 4 | 5 | ||
| 5 | // 表格列数据 | 6 | // 表格列数据 |
| 6 | export const columns: BasicColumn[] = [ | 7 | export const columns: BasicColumn[] = [ |
| @@ -90,21 +91,7 @@ export const formSchema: FormSchema[] = [ | @@ -90,21 +91,7 @@ export const formSchema: FormSchema[] = [ | ||
| 90 | componentProps: { | 91 | componentProps: { |
| 91 | placeholder: '请输入手机号码', | 92 | placeholder: '请输入手机号码', |
| 92 | }, | 93 | }, |
| 93 | - rules: [ | ||
| 94 | - { | ||
| 95 | - required: true, | ||
| 96 | - validator: (_, value: string) => { | ||
| 97 | - const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; | ||
| 98 | - if (value === '') { | ||
| 99 | - return Promise.reject('请输入手机号码'); | ||
| 100 | - } else if (!reg.test(value)) { | ||
| 101 | - return Promise.reject('请输入正确的手机号码'); | ||
| 102 | - } | ||
| 103 | - return Promise.resolve(); | ||
| 104 | - }, | ||
| 105 | - trigger: 'blur', | ||
| 106 | - }, | ||
| 107 | - ], | 94 | + rules: phoneRule, |
| 108 | }, | 95 | }, |
| 109 | { | 96 | { |
| 110 | field: 'email', | 97 | field: 'email', |
| @@ -113,20 +100,7 @@ export const formSchema: FormSchema[] = [ | @@ -113,20 +100,7 @@ export const formSchema: FormSchema[] = [ | ||
| 113 | componentProps: { | 100 | componentProps: { |
| 114 | placeholder: '请输入电子邮箱', | 101 | placeholder: '请输入电子邮箱', |
| 115 | }, | 102 | }, |
| 116 | - rules: [ | ||
| 117 | - { | ||
| 118 | - validator: (_, value: string) => { | ||
| 119 | - const reg = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/; | ||
| 120 | - if (value === '') { | ||
| 121 | - return Promise.resolve(); | ||
| 122 | - } else if (!reg.test(value)) { | ||
| 123 | - return Promise.reject('请输入正确的电子邮箱'); | ||
| 124 | - } | ||
| 125 | - return Promise.resolve(); | ||
| 126 | - }, | ||
| 127 | - trigger: 'blur', | ||
| 128 | - }, | ||
| 129 | - ], | 103 | + rules: emailRule, |
| 130 | }, | 104 | }, |
| 131 | { | 105 | { |
| 132 | field: 'wechat', | 106 | field: 'wechat', |
| @@ -125,6 +125,7 @@ | @@ -125,6 +125,7 @@ | ||
| 125 | try { | 125 | try { |
| 126 | await deleteAlarmContact(selectedRowIds.value); | 126 | await deleteAlarmContact(selectedRowIds.value); |
| 127 | createMessage.success('批量删除联系人成功'); | 127 | createMessage.success('批量删除联系人成功'); |
| 128 | + selectedRowIds.value = []; | ||
| 128 | handleSuccess(); | 129 | handleSuccess(); |
| 129 | } catch (e) { | 130 | } catch (e) { |
| 130 | createMessage.info('删除失败'); | 131 | createMessage.info('删除失败'); |
| @@ -58,7 +58,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -58,7 +58,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 58 | { label: '网关子设备', value: DeviceTypeEnum.SENSOR }, | 58 | { label: '网关子设备', value: DeviceTypeEnum.SENSOR }, |
| 59 | ], | 59 | ], |
| 60 | }, | 60 | }, |
| 61 | - colProps: { span: 4 }, | 61 | + colProps: { span: 6 }, |
| 62 | }, | 62 | }, |
| 63 | { | 63 | { |
| 64 | field: 'deviceState', | 64 | field: 'deviceState', |
| @@ -71,12 +71,12 @@ export const searchFormSchema: FormSchema[] = [ | @@ -71,12 +71,12 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 71 | { label: '离线', value: DeviceState.OFFLINE }, | 71 | { label: '离线', value: DeviceState.OFFLINE }, |
| 72 | ], | 72 | ], |
| 73 | }, | 73 | }, |
| 74 | - colProps: { span: 4 }, | 74 | + colProps: { span: 6 }, |
| 75 | }, | 75 | }, |
| 76 | { | 76 | { |
| 77 | field: 'name', | 77 | field: 'name', |
| 78 | label: '设备名称', | 78 | label: '设备名称', |
| 79 | component: 'Input', | 79 | component: 'Input', |
| 80 | - colProps: { span: 8 }, | 80 | + colProps: { span: 6 }, |
| 81 | }, | 81 | }, |
| 82 | ]; | 82 | ]; |
| @@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
| 5 | @register="register" | 5 | @register="register" |
| 6 | :destroyOnClose="true" | 6 | :destroyOnClose="true" |
| 7 | @close="closeDrawer" | 7 | @close="closeDrawer" |
| 8 | + :title="deviceDetail.name" | ||
| 8 | > | 9 | > |
| 9 | <Tabs v-model:activeKey="activeKey" :size="size" type="card"> | 10 | <Tabs v-model:activeKey="activeKey" :size="size" type="card"> |
| 10 | <TabPane key="1" tab="详情" | 11 | <TabPane key="1" tab="详情" |
| @@ -41,6 +42,7 @@ | @@ -41,6 +42,7 @@ | ||
| 41 | Alarm, | 42 | Alarm, |
| 42 | ChildDevice, | 43 | ChildDevice, |
| 43 | }, | 44 | }, |
| 45 | + | ||
| 44 | emits: ['reload', 'register'], | 46 | emits: ['reload', 'register'], |
| 45 | setup() { | 47 | setup() { |
| 46 | const activeKey = ref('1'); | 48 | const activeKey = ref('1'); |
| @@ -52,10 +54,11 @@ | @@ -52,10 +54,11 @@ | ||
| 52 | const { id } = data; | 54 | const { id } = data; |
| 53 | const res = await getDeviceDetail(id); | 55 | const res = await getDeviceDetail(id); |
| 54 | deviceDetail.value = res; | 56 | deviceDetail.value = res; |
| 55 | - // const { latitude, longitude, address } = data.record.deviceInfo; | ||
| 56 | - // deviceDetailRef.value.initMap(longitude, latitude, address); | 57 | + const { latitude, longitude, address } = res.deviceInfo; |
| 58 | + if (latitude) { | ||
| 59 | + deviceDetailRef.value.initMap(longitude, latitude, address); | ||
| 60 | + } | ||
| 57 | }); | 61 | }); |
| 58 | - | ||
| 59 | const closeDrawer = () => { | 62 | const closeDrawer = () => { |
| 60 | activeKey.value = '1'; | 63 | activeKey.value = '1'; |
| 61 | }; | 64 | }; |
| @@ -70,6 +70,7 @@ | @@ -70,6 +70,7 @@ | ||
| 70 | profile: data.record.deviceProfile.name, | 70 | profile: data.record.deviceProfile.name, |
| 71 | remark: data.record.deviceInfo.description, | 71 | remark: data.record.deviceInfo.description, |
| 72 | profileId: data.record.profileId, | 72 | profileId: data.record.profileId, |
| 73 | + deviceType: data.record.deviceType, | ||
| 73 | }); | 74 | }); |
| 74 | deviceInfo.value = data.record.deviceInfo; | 75 | deviceInfo.value = data.record.deviceInfo; |
| 75 | } else { | 76 | } else { |
| @@ -64,6 +64,7 @@ | @@ -64,6 +64,7 @@ | ||
| 64 | import { EnvironmentTwoTone, PlusOutlined } from '@ant-design/icons-vue'; | 64 | import { EnvironmentTwoTone, PlusOutlined } from '@ant-design/icons-vue'; |
| 65 | import { upload } from '/@/api/oss/ossFileUploader'; | 65 | import { upload } from '/@/api/oss/ossFileUploader'; |
| 66 | import { FileItem } from '/@/components/Upload/src/typing'; | 66 | import { FileItem } from '/@/components/Upload/src/typing'; |
| 67 | + import { BAI_DU_MAP_URL } from '/@/utils/fnUtils'; | ||
| 67 | export default defineComponent({ | 68 | export default defineComponent({ |
| 68 | components: { | 69 | components: { |
| 69 | BasicForm, | 70 | BasicForm, |
| @@ -160,8 +161,6 @@ | @@ -160,8 +161,6 @@ | ||
| 160 | }; | 161 | }; |
| 161 | 162 | ||
| 162 | // 地图 | 163 | // 地图 |
| 163 | - const BAI_DU_MAP_URL = | ||
| 164 | - 'https://api.map.baidu.com/getscript?v=3.0&ak=7uOPPyAHn2Y2ZryeQqHtcRqtIY374vKa'; | ||
| 165 | const wrapRef = ref<HTMLDivElement | null>(null); | 164 | const wrapRef = ref<HTMLDivElement | null>(null); |
| 166 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); | 165 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); |
| 167 | 166 |
| @@ -2,15 +2,22 @@ | @@ -2,15 +2,22 @@ | ||
| 2 | <div class="tabs-detail"> | 2 | <div class="tabs-detail"> |
| 3 | <div v-if="deviceDetail?.deviceInfo?.avatar"> | 3 | <div v-if="deviceDetail?.deviceInfo?.avatar"> |
| 4 | <p>设备图片</p> | 4 | <p>设备图片</p> |
| 5 | - <Image :src="deviceDetail?.deviceInfo?.avatar" /> | 5 | + <Image :src="deviceDetail.deviceInfo.avatar" :width="100" /> |
| 6 | </div> | 6 | </div> |
| 7 | <div> | 7 | <div> |
| 8 | <p>设备信息</p> | 8 | <p>设备信息</p> |
| 9 | - <Table bordered :columns="columns" :data-source="[deviceDetail]" :pagination="false" /> | 9 | + <Table |
| 10 | + bordered | ||
| 11 | + :columns="columns" | ||
| 12 | + :data-source="[deviceDetail]" | ||
| 13 | + :pagination="false" | ||
| 14 | + rowKey="tbDeviceId" | ||
| 15 | + style="width: 800px" | ||
| 16 | + /> | ||
| 10 | </div> | 17 | </div> |
| 11 | - <div v-if="deviceDetail?.deviceInfo?.address"> | 18 | + <div v-if="deviceDetail?.deviceInfo?.address" class="mt-4"> |
| 12 | <p>设备位置</p> | 19 | <p>设备位置</p> |
| 13 | - <div ref="wrapRef" style="height: 400px; width: 90%" class="ml-6"></div> | 20 | + <div ref="wrapRef" style="height: 400px; width: 90%"></div> |
| 14 | </div> | 21 | </div> |
| 15 | <div class="mt-4"> | 22 | <div class="mt-4"> |
| 16 | <a-button type="primary" class="mr-4" @click="copyTbDeviceId">复制设备ID</a-button> | 23 | <a-button type="primary" class="mr-4" @click="copyTbDeviceId">复制设备ID</a-button> |
| @@ -25,6 +32,7 @@ | @@ -25,6 +32,7 @@ | ||
| 25 | import { useScript } from '/@/hooks/web/useScript'; | 32 | import { useScript } from '/@/hooks/web/useScript'; |
| 26 | import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; | 33 | import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; |
| 27 | import { useMessage } from '/@/hooks/web/useMessage'; | 34 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 35 | + import { BAI_DU_MAP_URL } from '/@/utils/fnUtils'; | ||
| 28 | export default defineComponent({ | 36 | export default defineComponent({ |
| 29 | components: { | 37 | components: { |
| 30 | Image, | 38 | Image, |
| @@ -38,8 +46,6 @@ | @@ -38,8 +46,6 @@ | ||
| 38 | }, | 46 | }, |
| 39 | setup(props) { | 47 | setup(props) { |
| 40 | // 地图 | 48 | // 地图 |
| 41 | - const BAI_DU_MAP_URL = | ||
| 42 | - 'https://api.map.baidu.com/getscript?v=3.0&ak=7uOPPyAHn2Y2ZryeQqHtcRqtIY374vKa'; | ||
| 43 | const wrapRef = ref<HTMLDivElement | null>(null); | 49 | const wrapRef = ref<HTMLDivElement | null>(null); |
| 44 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); | 50 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); |
| 45 | 51 |
| @@ -64,7 +64,7 @@ | @@ -64,7 +64,7 @@ | ||
| 64 | props: { | 64 | props: { |
| 65 | userData: { type: Object }, | 65 | userData: { type: Object }, |
| 66 | }, | 66 | }, |
| 67 | - emits: ['success'], | 67 | + emits: ['success', 'register'], |
| 68 | setup(_, { emit }) { | 68 | setup(_, { emit }) { |
| 69 | const { createMessage } = useMessage(); | 69 | const { createMessage } = useMessage(); |
| 70 | const getStepData = ref(null); | 70 | const getStepData = ref(null); |
| @@ -8,9 +8,9 @@ | @@ -8,9 +8,9 @@ | ||
| 8 | <template #toolbar> | 8 | <template #toolbar> |
| 9 | <a-button type="primary" @click="handleCreate"> 新增设备配置 </a-button> | 9 | <a-button type="primary" @click="handleCreate"> 新增设备配置 </a-button> |
| 10 | <ImpExcel @success="loadDataSuccess" dateFormat="YYYY-MM-DD"> | 10 | <ImpExcel @success="loadDataSuccess" dateFormat="YYYY-MM-DD"> |
| 11 | - <a-button type="info" @click="handleImport"> 导入设备配置 </a-button> | 11 | + <a-button @click="handleImport"> 导入设备配置 </a-button> |
| 12 | </ImpExcel> | 12 | </ImpExcel> |
| 13 | - <a-button type="danger" @click="handleTableDel"> 删除 </a-button> | 13 | + <a-button danger color="error" @click="handleTableDel"> 删除 </a-button> |
| 14 | </template> | 14 | </template> |
| 15 | <template #action="{ record }"> | 15 | <template #action="{ record }"> |
| 16 | <TableAction | 16 | <TableAction |
| @@ -62,6 +62,7 @@ | @@ -62,6 +62,7 @@ | ||
| 62 | export default defineComponent({ | 62 | export default defineComponent({ |
| 63 | name: 'DeviceProfileManagement', | 63 | name: 'DeviceProfileManagement', |
| 64 | components: { BasicTable, DeviceProfileModal, TableAction, ImpExcel, DeviceConfigDetail }, | 64 | components: { BasicTable, DeviceProfileModal, TableAction, ImpExcel, DeviceConfigDetail }, |
| 65 | + | ||
| 65 | setup() { | 66 | setup() { |
| 66 | let selectedRowKeys: string[] = reactive([]); | 67 | let selectedRowKeys: string[] = reactive([]); |
| 67 | let isJudgeStatus = ref(true); | 68 | let isJudgeStatus = ref(true); |
| @@ -30,18 +30,16 @@ | @@ -30,18 +30,16 @@ | ||
| 30 | </template> | 30 | </template> |
| 31 | <script lang="ts"> | 31 | <script lang="ts"> |
| 32 | import { defineComponent } from 'vue'; | 32 | import { defineComponent } from 'vue'; |
| 33 | - | ||
| 34 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 33 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 35 | - import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 34 | + import { useDrawerInner } from '/@/components/Drawer'; |
| 36 | import { columns, searchFormSchema } from './email.data'; | 35 | import { columns, searchFormSchema } from './email.data'; |
| 37 | - import { Tag } from 'ant-design-vue'; | ||
| 38 | import { useMessage } from '/@/hooks/web/useMessage'; | 36 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 39 | import { deleteSmsLog, mailLogPage } from '/@/api/message/records'; | 37 | import { deleteSmsLog, mailLogPage } from '/@/api/message/records'; |
| 40 | import { useModal } from '/@/components/Modal'; | 38 | import { useModal } from '/@/components/Modal'; |
| 41 | import EmailDetail from '/@/views/message/records/item/EmailDetail.vue'; | 39 | import EmailDetail from '/@/views/message/records/item/EmailDetail.vue'; |
| 42 | export default defineComponent({ | 40 | export default defineComponent({ |
| 43 | name: 'EmailLog', | 41 | name: 'EmailLog', |
| 44 | - components: { EmailDetail, BasicDrawer, BasicTable, TableAction, Tag }, | 42 | + components: { EmailDetail, BasicTable, TableAction }, |
| 45 | setup() { | 43 | setup() { |
| 46 | const [registerModal, { openModal }] = useModal(); | 44 | const [registerModal, { openModal }] = useModal(); |
| 47 | const { createMessage } = useMessage(); | 45 | const { createMessage } = useMessage(); |
| @@ -31,16 +31,16 @@ | @@ -31,16 +31,16 @@ | ||
| 31 | import { defineComponent, h } from 'vue'; | 31 | import { defineComponent, h } from 'vue'; |
| 32 | 32 | ||
| 33 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; | 33 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 34 | - import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 34 | + import { useDrawerInner } from '/@/components/Drawer'; |
| 35 | import { columns, searchFormSchema } from './sms.data'; | 35 | import { columns, searchFormSchema } from './sms.data'; |
| 36 | - import { Modal, Tag } from 'ant-design-vue'; | 36 | + import { Modal } from 'ant-design-vue'; |
| 37 | import { useMessage } from '/@/hooks/web/useMessage'; | 37 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 38 | import { smsLogPage, deleteSmsLog } from '/@/api/message/records'; | 38 | import { smsLogPage, deleteSmsLog } from '/@/api/message/records'; |
| 39 | import { JsonPreview } from '/@/components/CodeEditor'; | 39 | import { JsonPreview } from '/@/components/CodeEditor'; |
| 40 | 40 | ||
| 41 | export default defineComponent({ | 41 | export default defineComponent({ |
| 42 | name: 'SmsLog', | 42 | name: 'SmsLog', |
| 43 | - components: { BasicDrawer, BasicTable, TableAction, Tag }, | 43 | + components: { BasicTable, TableAction }, |
| 44 | setup() { | 44 | setup() { |
| 45 | const { createMessage } = useMessage(); | 45 | const { createMessage } = useMessage(); |
| 46 | const [register] = useDrawerInner(() => {}); | 46 | const [register] = useDrawerInner(() => {}); |
| @@ -23,8 +23,8 @@ export const columns: BasicColumn[] = [ | @@ -23,8 +23,8 @@ export const columns: BasicColumn[] = [ | ||
| 23 | const status = record.status; | 23 | const status = record.status; |
| 24 | const success = status === 'SUCCESS'; | 24 | const success = status === 'SUCCESS'; |
| 25 | const color = success ? 'green' : 'red'; | 25 | const color = success ? 'green' : 'red'; |
| 26 | - let successText: string = t('routes.common.system.tableSuccessStatus'); | ||
| 27 | - let failedText: string = t('routes.common.system.tableFailedStatus'); | 26 | + const successText: string = t('routes.common.system.tableSuccessStatus'); |
| 27 | + const failedText: string = t('routes.common.system.tableFailedStatus'); | ||
| 28 | const text = success ? successText : failedText; | 28 | const text = success ? successText : failedText; |
| 29 | return h(Tag, { color: color }, () => text); | 29 | return h(Tag, { color: color }, () => text); |
| 30 | }, | 30 | }, |
| @@ -28,8 +28,8 @@ export const columns: BasicColumn[] = [ | @@ -28,8 +28,8 @@ export const columns: BasicColumn[] = [ | ||
| 28 | const status = record.status; | 28 | const status = record.status; |
| 29 | const success = status === 'SUCCESS'; | 29 | const success = status === 'SUCCESS'; |
| 30 | const color = success ? 'green' : 'red'; | 30 | const color = success ? 'green' : 'red'; |
| 31 | - let successText: string = t('routes.common.system.tableSuccessStatus'); | ||
| 32 | - let failedText: string = t('routes.common.system.tableFailedStatus'); | 31 | + const successText: string = t('routes.common.system.tableSuccessStatus'); |
| 32 | + const failedText: string = t('routes.common.system.tableFailedStatus'); | ||
| 33 | const text = success ? successText : failedText; | 33 | const text = success ? successText : failedText; |
| 34 | return h(Tag, { color: color }, () => text); | 34 | return h(Tag, { color: color }, () => text); |
| 35 | }, | 35 | }, |
| @@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
| 11 | import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; | 11 | import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; |
| 12 | import { sendSms } from '/@/api/message/template'; | 12 | import { sendSms } from '/@/api/message/template'; |
| 13 | import { useMessage } from '/@/hooks/web/useMessage'; | 13 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 14 | + import { phoneRule } from '/@/utils/rules'; | ||
| 14 | const schemas: FormSchema[] = [ | 15 | const schemas: FormSchema[] = [ |
| 15 | { | 16 | { |
| 16 | field: 'id', | 17 | field: 'id', |
| @@ -34,7 +35,7 @@ | @@ -34,7 +35,7 @@ | ||
| 34 | field: 'phoneNumbers', | 35 | field: 'phoneNumbers', |
| 35 | component: 'Input', | 36 | component: 'Input', |
| 36 | label: '手机号码', | 37 | label: '手机号码', |
| 37 | - required: true, | 38 | + rules: phoneRule, |
| 38 | }, | 39 | }, |
| 39 | { | 40 | { |
| 40 | field: 'params', | 41 | field: 'params', |
| @@ -47,10 +47,8 @@ | @@ -47,10 +47,8 @@ | ||
| 47 | import { useDrawer } from '/@/components/Drawer'; | 47 | import { useDrawer } from '/@/components/Drawer'; |
| 48 | import TemplateDrawer from './TemplateDrawer.vue'; | 48 | import TemplateDrawer from './TemplateDrawer.vue'; |
| 49 | import { columns, searchFormSchema } from './template.data'; | 49 | import { columns, searchFormSchema } from './template.data'; |
| 50 | - import { CodeEditor } from '/@/components/CodeEditor'; | ||
| 51 | import { useMessage } from '/@/hooks/web/useMessage'; | 50 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 52 | import { deleteMessageTemplate, messageTemplatePage } from '/@/api/message/template'; | 51 | import { deleteMessageTemplate, messageTemplatePage } from '/@/api/message/template'; |
| 53 | - import { Tag } from 'ant-design-vue'; | ||
| 54 | import { useGo } from '/@/hooks/web/usePage'; | 52 | import { useGo } from '/@/hooks/web/usePage'; |
| 55 | import { PageEnum } from '/@/enums/pageEnum'; | 53 | import { PageEnum } from '/@/enums/pageEnum'; |
| 56 | import { useModal } from '/@/components/Modal'; | 54 | import { useModal } from '/@/components/Modal'; |
| @@ -60,7 +58,7 @@ | @@ -60,7 +58,7 @@ | ||
| 60 | 58 | ||
| 61 | export default defineComponent({ | 59 | export default defineComponent({ |
| 62 | name: 'MessageTemplateManagement', | 60 | name: 'MessageTemplateManagement', |
| 63 | - components: { SendSms, SendEmail, BasicTable, TemplateDrawer, TableAction, CodeEditor, Tag }, | 61 | + components: { SendSms, SendEmail, BasicTable, TemplateDrawer, TableAction }, |
| 64 | setup() { | 62 | setup() { |
| 65 | const [registerModal, { openModal: openModal }] = useModal(); | 63 | const [registerModal, { openModal: openModal }] = useModal(); |
| 66 | const [registerMailModal, { openModal: openMailModal }] = useModal(); | 64 | const [registerMailModal, { openModal: openMailModal }] = useModal(); |
| @@ -47,7 +47,7 @@ | @@ -47,7 +47,7 @@ | ||
| 47 | import { screenLinkPageGetApi, screenLinkPageDeleteApi } from '/@/api/ruleengine/ruleengineApi'; | 47 | import { screenLinkPageGetApi, screenLinkPageDeleteApi } from '/@/api/ruleengine/ruleengineApi'; |
| 48 | 48 | ||
| 49 | export default defineComponent({ | 49 | export default defineComponent({ |
| 50 | - name: 'index', | 50 | + name: 'Index', |
| 51 | components: { BasicTable, SceneLinkAgeDrawer, TableAction }, | 51 | components: { BasicTable, SceneLinkAgeDrawer, TableAction }, |
| 52 | setup() { | 52 | setup() { |
| 53 | let selectedRowKeys: Array<string> = []; | 53 | let selectedRowKeys: Array<string> = []; |
| @@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
| 31 | import { notifyMyGetrPageApi } from '/@/api/stationnotification/stationnotifyApi'; | 31 | import { notifyMyGetrPageApi } from '/@/api/stationnotification/stationnotifyApi'; |
| 32 | 32 | ||
| 33 | export default defineComponent({ | 33 | export default defineComponent({ |
| 34 | - name: 'index', | 34 | + name: 'Index', |
| 35 | components: { BasicTable, NotifyDetailDrawer, TableAction }, | 35 | components: { BasicTable, NotifyDetailDrawer, TableAction }, |
| 36 | setup() { | 36 | setup() { |
| 37 | let selectedRowKeys: Array<string> = []; | 37 | let selectedRowKeys: Array<string> = []; |
| @@ -63,8 +63,6 @@ | @@ -63,8 +63,6 @@ | ||
| 63 | import RegisterForm from './RegisterForm.vue'; | 63 | import RegisterForm from './RegisterForm.vue'; |
| 64 | import MobileForm from './MobileForm.vue'; | 64 | import MobileForm from './MobileForm.vue'; |
| 65 | import QrCodeForm from './QrCodeForm.vue'; | 65 | import QrCodeForm from './QrCodeForm.vue'; |
| 66 | - import { useGlobSetting } from '/@/hooks/setting'; | ||
| 67 | - import { useI18n } from '/@/hooks/web/useI18n'; | ||
| 68 | import { useDesign } from '/@/hooks/web/useDesign'; | 66 | import { useDesign } from '/@/hooks/web/useDesign'; |
| 69 | import { useLocaleStore } from '/@/store/modules/locale'; | 67 | import { useLocaleStore } from '/@/store/modules/locale'; |
| 70 | import { useUserStore } from '/@/store/modules/user'; | 68 | import { useUserStore } from '/@/store/modules/user'; |
| @@ -75,12 +73,9 @@ | @@ -75,12 +73,9 @@ | ||
| 75 | }, | 73 | }, |
| 76 | }); | 74 | }); |
| 77 | 75 | ||
| 78 | - const globSetting = useGlobSetting(); | ||
| 79 | const { prefixCls } = useDesign('login'); | 76 | const { prefixCls } = useDesign('login'); |
| 80 | - const { t } = useI18n(); | ||
| 81 | const localeStore = useLocaleStore(); | 77 | const localeStore = useLocaleStore(); |
| 82 | const showLocale = localeStore.getShowPicker; | 78 | const showLocale = localeStore.getShowPicker; |
| 83 | - const title = computed(() => globSetting?.title ?? ''); | ||
| 84 | const isDark = ref(true); | 79 | const isDark = ref(true); |
| 85 | const toggleDark = () => { | 80 | const toggleDark = () => { |
| 86 | isDark.value = !isDark.value; | 81 | isDark.value = !isDark.value; |
| @@ -38,10 +38,10 @@ | @@ -38,10 +38,10 @@ | ||
| 38 | import LoginFormTitle from './LoginFormTitle.vue'; | 38 | import LoginFormTitle from './LoginFormTitle.vue'; |
| 39 | import { useI18n } from '/@/hooks/web/useI18n'; | 39 | import { useI18n } from '/@/hooks/web/useI18n'; |
| 40 | import { useLoginState, useFormRules, useFormValid, LoginStateEnum } from './useLogin'; | 40 | import { useLoginState, useFormRules, useFormValid, LoginStateEnum } from './useLogin'; |
| 41 | - import { SendLoginSmsCode, smsCodeLoginApi } from '/@/api/sys/user'; | 41 | + import { SendLoginSmsCode } from '/@/api/sys/user'; |
| 42 | import { useUserStore } from '/@/store/modules/user'; | 42 | import { useUserStore } from '/@/store/modules/user'; |
| 43 | import { useMessage } from '/@/hooks/web/useMessage'; | 43 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 44 | - const { notification, createErrorModal } = useMessage(); | 44 | + const { notification } = useMessage(); |
| 45 | 45 | ||
| 46 | const FormItem = Form.Item; | 46 | const FormItem = Form.Item; |
| 47 | const { t } = useI18n(); | 47 | const { t } = useI18n(); |
| 1 | import { getAllRoleList, isAccountExist } from '/@/api/system/system'; | 1 | import { getAllRoleList, isAccountExist } from '/@/api/system/system'; |
| 2 | import { BasicColumn } from '/@/components/Table'; | 2 | import { BasicColumn } from '/@/components/Table'; |
| 3 | import { FormSchema } from '/@/components/Table'; | 3 | import { FormSchema } from '/@/components/Table'; |
| 4 | +import { emailRule, phoneRule } from '/@/utils/rules'; | ||
| 4 | 5 | ||
| 5 | export const columns: BasicColumn[] = [ | 6 | export const columns: BasicColumn[] = [ |
| 6 | { | 7 | { |
| @@ -133,42 +134,14 @@ export const accountFormSchema: FormSchema[] = [ | @@ -133,42 +134,14 @@ export const accountFormSchema: FormSchema[] = [ | ||
| 133 | field: 'phoneNumber', | 134 | field: 'phoneNumber', |
| 134 | component: 'Input', | 135 | component: 'Input', |
| 135 | colProps: { span: 12 }, | 136 | colProps: { span: 12 }, |
| 136 | - rules: [ | ||
| 137 | - { | ||
| 138 | - required: true, | ||
| 139 | - validator: (_, value: string) => { | ||
| 140 | - const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; | ||
| 141 | - if (value === '') { | ||
| 142 | - return Promise.reject('请输入手机号码'); | ||
| 143 | - } else if (!reg.test(value)) { | ||
| 144 | - return Promise.reject('手机号码不正确'); | ||
| 145 | - } | ||
| 146 | - return Promise.resolve(); | ||
| 147 | - }, | ||
| 148 | - trigger: 'blur', | ||
| 149 | - }, | ||
| 150 | - ], | 137 | + rules: phoneRule, |
| 151 | }, | 138 | }, |
| 152 | { | 139 | { |
| 153 | label: '邮箱', | 140 | label: '邮箱', |
| 154 | field: 'email', | 141 | field: 'email', |
| 155 | component: 'Input', | 142 | component: 'Input', |
| 156 | colProps: { span: 12 }, | 143 | colProps: { span: 12 }, |
| 157 | - rules: [ | ||
| 158 | - { | ||
| 159 | - required: true, | ||
| 160 | - validator: (_, value: string) => { | ||
| 161 | - const reg = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/; | ||
| 162 | - if (value === '') { | ||
| 163 | - return Promise.resolve(); | ||
| 164 | - } else if (!reg.test(value)) { | ||
| 165 | - return Promise.reject('电子邮箱格式不正确'); | ||
| 166 | - } | ||
| 167 | - return Promise.resolve(); | ||
| 168 | - }, | ||
| 169 | - trigger: 'blur', | ||
| 170 | - }, | ||
| 171 | - ], | 144 | + rules: emailRule, |
| 172 | }, | 145 | }, |
| 173 | { | 146 | { |
| 174 | field: 'accountExpireTime', | 147 | field: 'accountExpireTime', |
| @@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
| 12 | </div> | 12 | </div> |
| 13 | </template> | 13 | </template> |
| 14 | <script lang="ts"> | 14 | <script lang="ts"> |
| 15 | - import { defineComponent, ref } from 'vue'; | 15 | + import { defineComponent } from 'vue'; |
| 16 | import { PageWrapper } from '/@/components/Page'; | 16 | import { PageWrapper } from '/@/components/Page'; |
| 17 | import { BasicForm, useForm } from '/@/components/Form'; | 17 | import { BasicForm, useForm } from '/@/components/Form'; |
| 18 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | 18 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; |
| @@ -23,6 +23,7 @@ | @@ -23,6 +23,7 @@ | ||
| 23 | BasicDrawer, | 23 | BasicDrawer, |
| 24 | BasicForm, | 24 | BasicForm, |
| 25 | }, | 25 | }, |
| 26 | + emits: ['success'], | ||
| 26 | setup(_, { emit }) { | 27 | setup(_, { emit }) { |
| 27 | const isUpdate = ref(true); | 28 | const isUpdate = ref(true); |
| 28 | const tenantId = ref(''); | 29 | const tenantId = ref(''); |
| @@ -19,8 +19,7 @@ | @@ -19,8 +19,7 @@ | ||
| 19 | > | 19 | > |
| 20 | <img v-if="tenantLogo" :src="tenantLogo" alt="avatar" /> | 20 | <img v-if="tenantLogo" :src="tenantLogo" alt="avatar" /> |
| 21 | <div v-else> | 21 | <div v-else> |
| 22 | - <loading-outlined v-if="loading"></loading-outlined> | ||
| 23 | - <plus-outlined v-else></plus-outlined> | 22 | + <plus-outlined /> |
| 24 | <div class="ant-upload-text">上传</div> | 23 | <div class="ant-upload-text">上传</div> |
| 25 | </div> | 24 | </div> |
| 26 | </Upload> | 25 | </Upload> |
| @@ -32,9 +31,7 @@ | @@ -32,9 +31,7 @@ | ||
| 32 | import { defineComponent, ref, computed, unref } from 'vue'; | 31 | import { defineComponent, ref, computed, unref } from 'vue'; |
| 33 | import { BasicForm, useForm } from '/@/components/Form/index'; | 32 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 34 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 33 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
| 35 | - import { CollapseContainer } from '/@/components/Container'; | ||
| 36 | - import { CropperImage, CropperAvatar } from '/@/components/Cropper'; | ||
| 37 | - import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; | 34 | + import { PlusOutlined } from '@ant-design/icons-vue'; |
| 38 | import { message, Upload } from 'ant-design-vue'; | 35 | import { message, Upload } from 'ant-design-vue'; |
| 39 | 36 | ||
| 40 | import { useI18n } from '/@/hooks/web/useI18n'; | 37 | import { useI18n } from '/@/hooks/web/useI18n'; |
| @@ -48,12 +45,8 @@ | @@ -48,12 +45,8 @@ | ||
| 48 | components: { | 45 | components: { |
| 49 | BasicDrawer, | 46 | BasicDrawer, |
| 50 | BasicForm, | 47 | BasicForm, |
| 51 | - CropperImage, | ||
| 52 | - CollapseContainer, | ||
| 53 | - CropperAvatar, | ||
| 54 | Upload, | 48 | Upload, |
| 55 | PlusOutlined, | 49 | PlusOutlined, |
| 56 | - LoadingOutlined, | ||
| 57 | }, | 50 | }, |
| 58 | emits: ['success', 'register'], | 51 | emits: ['success', 'register'], |
| 59 | setup(_, { emit }) { | 52 | setup(_, { emit }) { |
| 1 | import type { FormSchema } from '/@/components/Form/index'; | 1 | import type { FormSchema } from '/@/components/Form/index'; |
| 2 | -import { getTownList, getTownChild } from '/@/api/oem/index'; | 2 | +import { getAreaList } from '/@/api/oem/index'; |
| 3 | +import { emailRule, phoneRule } from '/@/utils/rules'; | ||
| 3 | 4 | ||
| 4 | export const schemas: FormSchema[] = [ | 5 | export const schemas: FormSchema[] = [ |
| 5 | { | 6 | { |
| @@ -42,10 +43,10 @@ export const schemas: FormSchema[] = [ | @@ -42,10 +43,10 @@ export const schemas: FormSchema[] = [ | ||
| 42 | colProps: { | 43 | colProps: { |
| 43 | span: 24, | 44 | span: 24, |
| 44 | }, | 45 | }, |
| 45 | - | ||
| 46 | componentProps: { | 46 | componentProps: { |
| 47 | placeholder: '请输入公司邮箱', | 47 | placeholder: '请输入公司邮箱', |
| 48 | }, | 48 | }, |
| 49 | + rules: emailRule, | ||
| 49 | }, | 50 | }, |
| 50 | { | 51 | { |
| 51 | field: 'synopsis', | 52 | field: 'synopsis', |
| @@ -63,20 +64,17 @@ export const schemas: FormSchema[] = [ | @@ -63,20 +64,17 @@ export const schemas: FormSchema[] = [ | ||
| 63 | }, | 64 | }, |
| 64 | { | 65 | { |
| 65 | field: 'country', | 66 | field: 'country', |
| 66 | - component: 'Select', | 67 | + component: 'ApiSelect', |
| 67 | label: '国家/地区', | 68 | label: '国家/地区', |
| 68 | colProps: { | 69 | colProps: { |
| 69 | span: 24, | 70 | span: 24, |
| 70 | }, | 71 | }, |
| 71 | - defaultValue: '1', | ||
| 72 | componentProps: { | 72 | componentProps: { |
| 73 | + api: getAreaList, | ||
| 74 | + params: { parentId: 0 }, | ||
| 75 | + labelField: 'name', | ||
| 76 | + valueField: 'parentId', | ||
| 73 | placeholder: '请选择国家/地区', | 77 | placeholder: '请选择国家/地区', |
| 74 | - options: [ | ||
| 75 | - { | ||
| 76 | - label: '中国', | ||
| 77 | - value: '1', | ||
| 78 | - }, | ||
| 79 | - ], | ||
| 80 | }, | 78 | }, |
| 81 | }, | 79 | }, |
| 82 | { | 80 | { |
| @@ -86,99 +84,115 @@ export const schemas: FormSchema[] = [ | @@ -86,99 +84,115 @@ export const schemas: FormSchema[] = [ | ||
| 86 | colProps: { | 84 | colProps: { |
| 87 | span: 5, | 85 | span: 5, |
| 88 | }, | 86 | }, |
| 89 | - componentProps: ({ formModel, formActionType }) => { | 87 | + componentProps({ formModel, formActionType }) { |
| 88 | + const { updateSchema } = formActionType; | ||
| 90 | return { | 89 | return { |
| 91 | - api: getTownList, | ||
| 92 | - labelField: 'nameProv', | ||
| 93 | - valueField: 'codeProv', | 90 | + api: getAreaList, |
| 91 | + labelField: 'name', | ||
| 92 | + valueField: 'code', | ||
| 94 | placeholder: '请选择省份', | 93 | placeholder: '请选择省份', |
| 94 | + params: { parentId: 1 }, | ||
| 95 | async onChange(value) { | 95 | async onChange(value) { |
| 96 | - let nameCity = await getTownChild('codeProv', value); | ||
| 97 | - nameCity.forEach((item) => { | ||
| 98 | - item.label = item.nameCity; | ||
| 99 | - item.value = item.codeCity; | ||
| 100 | - }); | ||
| 101 | - const { updateSchema } = formActionType; | ||
| 102 | if (value === undefined) { | 96 | if (value === undefined) { |
| 103 | formModel.nameCity = undefined; // reset city value | 97 | formModel.nameCity = undefined; // reset city value |
| 104 | formModel.nameCoun = undefined; | 98 | formModel.nameCoun = undefined; |
| 105 | formModel.nameTown = undefined; | 99 | formModel.nameTown = undefined; |
| 106 | - nameCity = []; | ||
| 107 | - updateSchema({ | ||
| 108 | - field: 'nameCoun', | ||
| 109 | - componentProps: { | ||
| 110 | - options: [], | 100 | + updateSchema([ |
| 101 | + { | ||
| 102 | + field: 'nameCity', | ||
| 103 | + componentProps: { | ||
| 104 | + options: [], | ||
| 105 | + }, | ||
| 111 | }, | 106 | }, |
| 107 | + { | ||
| 108 | + field: 'nameCoun', | ||
| 109 | + componentProps: { | ||
| 110 | + options: [], | ||
| 111 | + }, | ||
| 112 | + }, | ||
| 113 | + { | ||
| 114 | + field: 'nameTown', | ||
| 115 | + componentProps: { | ||
| 116 | + options: [], | ||
| 117 | + }, | ||
| 118 | + }, | ||
| 119 | + ]); | ||
| 120 | + } else { | ||
| 121 | + const nameCity = await getAreaList({ parentId: value }); | ||
| 122 | + nameCity.forEach((item) => { | ||
| 123 | + item.label = item.name; | ||
| 124 | + item.value = item.code; | ||
| 112 | }); | 125 | }); |
| 126 | + formModel.nameCity = undefined; // reset city value | ||
| 127 | + formModel.nameCoun = undefined; | ||
| 128 | + formModel.nameTown = undefined; | ||
| 113 | updateSchema({ | 129 | updateSchema({ |
| 114 | - field: 'nameTown', | 130 | + field: 'nameCity', |
| 115 | componentProps: { | 131 | componentProps: { |
| 116 | - options: [], | ||
| 117 | - }, | ||
| 118 | - }); | ||
| 119 | - } | ||
| 120 | - formModel.nameCity = undefined; // reset city value | ||
| 121 | - formModel.nameCoun = undefined; | ||
| 122 | - formModel.nameTown = undefined; | ||
| 123 | - updateSchema({ | ||
| 124 | - field: 'nameCity', | ||
| 125 | - componentProps: () => { | ||
| 126 | - return { | ||
| 127 | options: nameCity, | 132 | options: nameCity, |
| 128 | placeholder: '请选择城市', | 133 | placeholder: '请选择城市', |
| 129 | async onChange(value) { | 134 | async onChange(value) { |
| 130 | - // 获取区数据 | ||
| 131 | - let nameCoun = await getTownChild('codeCity', value); | ||
| 132 | - nameCoun.forEach((item) => { | ||
| 133 | - item.label = item.nameCoun; | ||
| 134 | - item.value = item.codeCoun; | ||
| 135 | - }); | ||
| 136 | if (value === undefined) { | 135 | if (value === undefined) { |
| 137 | formModel.nameCoun = undefined; // reset city value | 136 | formModel.nameCoun = undefined; // reset city value |
| 138 | formModel.nameTown = undefined; | 137 | formModel.nameTown = undefined; |
| 139 | - nameCoun = []; | 138 | + updateSchema([ |
| 139 | + { | ||
| 140 | + field: 'nameCoun', | ||
| 141 | + componentProps: { | ||
| 142 | + options: [], | ||
| 143 | + }, | ||
| 144 | + }, | ||
| 145 | + { | ||
| 146 | + field: 'nameTown', | ||
| 147 | + componentProps: { | ||
| 148 | + options: [], | ||
| 149 | + }, | ||
| 150 | + }, | ||
| 151 | + ]); | ||
| 152 | + } else { | ||
| 153 | + // 获取区数据 | ||
| 154 | + const nameCoun = await getAreaList({ parentId: value }); | ||
| 155 | + nameCoun.forEach((item) => { | ||
| 156 | + item.label = item.name; | ||
| 157 | + item.value = item.code; | ||
| 158 | + }); | ||
| 140 | updateSchema({ | 159 | updateSchema({ |
| 141 | - field: 'nameTown', | 160 | + field: 'nameCoun', |
| 142 | componentProps: { | 161 | componentProps: { |
| 143 | - options: [], | 162 | + // 请选择区 |
| 163 | + options: nameCoun, | ||
| 164 | + async onChange(value) { | ||
| 165 | + if (value === undefined) { | ||
| 166 | + formModel.nameTown = undefined; | ||
| 167 | + updateSchema({ | ||
| 168 | + field: 'nameTown', | ||
| 169 | + componentProps: { | ||
| 170 | + placeholder: '请选择街道/城镇', | ||
| 171 | + options: [], | ||
| 172 | + }, | ||
| 173 | + }); | ||
| 174 | + } else { | ||
| 175 | + const nameTown = await getAreaList({ parentId: value }); | ||
| 176 | + nameTown.forEach((item) => { | ||
| 177 | + item.label = item.name; | ||
| 178 | + item.value = item.code; | ||
| 179 | + }); | ||
| 180 | + updateSchema({ | ||
| 181 | + field: 'nameTown', | ||
| 182 | + componentProps: { | ||
| 183 | + placeholder: '请选择街道/城镇', | ||
| 184 | + options: nameTown, | ||
| 185 | + }, | ||
| 186 | + }); | ||
| 187 | + } | ||
| 188 | + }, | ||
| 144 | }, | 189 | }, |
| 145 | }); | 190 | }); |
| 146 | } | 191 | } |
| 147 | - updateSchema({ | ||
| 148 | - field: 'nameCoun', | ||
| 149 | - componentProps: { | ||
| 150 | - // 请选择区 | ||
| 151 | - options: nameCoun, | ||
| 152 | - async onChange(value) { | ||
| 153 | - const nameTown = await getTownChild('codeCoun', value); | ||
| 154 | - nameTown.forEach((item) => { | ||
| 155 | - item.label = item.nameTown; | ||
| 156 | - item.value = item.codeTown; | ||
| 157 | - }); | ||
| 158 | - if (value === undefined) { | ||
| 159 | - formModel.nameTown = undefined; | ||
| 160 | - updateSchema({ | ||
| 161 | - field: 'nameTown', | ||
| 162 | - componentProps: { | ||
| 163 | - placeholder: '请选择街道/城镇', | ||
| 164 | - options: [], | ||
| 165 | - }, | ||
| 166 | - }); | ||
| 167 | - } | ||
| 168 | - updateSchema({ | ||
| 169 | - field: 'nameTown', | ||
| 170 | - componentProps: { | ||
| 171 | - placeholder: '请选择街道/城镇', | ||
| 172 | - options: nameTown, | ||
| 173 | - }, | ||
| 174 | - }); | ||
| 175 | - }, | ||
| 176 | - }, | ||
| 177 | - }); | ||
| 178 | }, | 192 | }, |
| 179 | - }; | ||
| 180 | - }, | ||
| 181 | - }); | 193 | + }, |
| 194 | + }); | ||
| 195 | + } | ||
| 182 | }, | 196 | }, |
| 183 | }; | 197 | }; |
| 184 | }, | 198 | }, |
| @@ -255,20 +269,7 @@ export const schemas: FormSchema[] = [ | @@ -255,20 +269,7 @@ export const schemas: FormSchema[] = [ | ||
| 255 | componentProps: { | 269 | componentProps: { |
| 256 | placeholder: '请输入联系电话', | 270 | placeholder: '请输入联系电话', |
| 257 | }, | 271 | }, |
| 258 | - rules: [ | ||
| 259 | - { | ||
| 260 | - validator: (_, value: string) => { | ||
| 261 | - const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; | ||
| 262 | - if (value === '') { | ||
| 263 | - return Promise.resolve(); | ||
| 264 | - } else if (!reg.test(value)) { | ||
| 265 | - return Promise.reject('请输入正确的手机号码'); | ||
| 266 | - } | ||
| 267 | - return Promise.resolve(); | ||
| 268 | - }, | ||
| 269 | - trigger: 'blur', | ||
| 270 | - }, | ||
| 271 | - ], | 272 | + rules: phoneRule, |
| 272 | }, | 273 | }, |
| 273 | { | 274 | { |
| 274 | field: 'qrcode', | 275 | field: 'qrcode', |
| @@ -46,7 +46,6 @@ | @@ -46,7 +46,6 @@ | ||
| 46 | import { getEnterPriseDetail, updateEnterPriseDetail } from '/@/api/oem/index'; | 46 | import { getEnterPriseDetail, updateEnterPriseDetail } from '/@/api/oem/index'; |
| 47 | import { Loading } from '/@/components/Loading'; | 47 | import { Loading } from '/@/components/Loading'; |
| 48 | import { useMessage } from '/@/hooks/web/useMessage'; | 48 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 49 | - import { getTownChild } from '/@/api/oem/index'; | ||
| 50 | import { useUserStore } from '/@/store/modules/user'; | 49 | import { useUserStore } from '/@/store/modules/user'; |
| 51 | import { createLocalStorage } from '/@/utils/cache'; | 50 | import { createLocalStorage } from '/@/utils/cache'; |
| 52 | import { PlusOutlined } from '@ant-design/icons-vue'; | 51 | import { PlusOutlined } from '@ant-design/icons-vue'; |
| @@ -132,135 +131,135 @@ | @@ -132,135 +131,135 @@ | ||
| 132 | storage.set('enterpriseInfo', newFieldValue); | 131 | storage.set('enterpriseInfo', newFieldValue); |
| 133 | } | 132 | } |
| 134 | 133 | ||
| 135 | - // 地区显示回显和数据联动 | ||
| 136 | - async function updateCityData( | ||
| 137 | - codeProv: string, | ||
| 138 | - codeCity: string, | ||
| 139 | - codeCoun: string, | ||
| 140 | - codeTown: string | ||
| 141 | - ) { | ||
| 142 | - const nameCity = await getTownChild('codeProv', codeProv); | ||
| 143 | - const nameCoun = await getTownChild('codeCity', codeCity); | ||
| 144 | - const nameTown = await getTownChild('codeCoun', codeCoun); | ||
| 145 | - nameCity.forEach((item) => { | ||
| 146 | - item.label = item.nameCity; | ||
| 147 | - item.value = item.codeCity; | ||
| 148 | - }); | ||
| 149 | - nameCoun.forEach((item) => { | ||
| 150 | - item.label = item.nameCoun; | ||
| 151 | - item.value = item.codeCoun; | ||
| 152 | - }); | ||
| 153 | - nameTown.forEach((item) => { | ||
| 154 | - item.label = item.nameTown; | ||
| 155 | - item.value = item.codeTown; | ||
| 156 | - }); | ||
| 157 | - setFieldsValue({ | ||
| 158 | - nameProv: codeProv, | ||
| 159 | - nameCity: codeCity, | ||
| 160 | - nameCoun: codeCoun, | ||
| 161 | - nameTown: codeTown, | ||
| 162 | - }); | ||
| 163 | - updateSchema({ | ||
| 164 | - field: 'nameTown', | ||
| 165 | - componentProps: { | ||
| 166 | - options: nameTown, | ||
| 167 | - }, | ||
| 168 | - }); | ||
| 169 | - updateSchema({ | ||
| 170 | - field: 'nameCoun', | ||
| 171 | - componentProps: { | ||
| 172 | - options: nameCoun, | ||
| 173 | - async onChange(value) { | ||
| 174 | - if (value === undefined) { | ||
| 175 | - setFieldsValue({ | ||
| 176 | - nameTown: undefined, | ||
| 177 | - }); | ||
| 178 | - updateSchema({ | ||
| 179 | - field: 'nameTown', | ||
| 180 | - componentProps: { | ||
| 181 | - options: [], | ||
| 182 | - }, | ||
| 183 | - }); | ||
| 184 | - } | ||
| 185 | - let nameTown = await getTownChild('codeCoun', value); | ||
| 186 | - nameTown.forEach((item) => { | ||
| 187 | - item.label = item.nameTown; | ||
| 188 | - item.value = item.codeTown; | ||
| 189 | - }); | ||
| 190 | - setFieldsValue({ | ||
| 191 | - nameTown: undefined, | ||
| 192 | - }); | ||
| 193 | - updateSchema({ | ||
| 194 | - field: 'nameTown', | ||
| 195 | - componentProps: { | ||
| 196 | - placeholder: '请选择街道/城镇', | ||
| 197 | - options: nameTown, | ||
| 198 | - }, | ||
| 199 | - }); | ||
| 200 | - }, | ||
| 201 | - }, | ||
| 202 | - }); | ||
| 203 | - updateSchema({ | ||
| 204 | - field: 'nameCity', | ||
| 205 | - componentProps: ({ formModel }) => { | ||
| 206 | - return { | ||
| 207 | - options: nameCity, | ||
| 208 | - onChange: async (value) => { | ||
| 209 | - let nameCoun = await getTownChild('codeCity', value); | ||
| 210 | - if (value === undefined) { | ||
| 211 | - formModel.nameCoun = undefined; // reset city value | ||
| 212 | - formModel.nameTown = undefined; | ||
| 213 | - nameCoun = []; | ||
| 214 | - updateSchema({ | ||
| 215 | - field: 'nameTown', | ||
| 216 | - componentProps: { | ||
| 217 | - options: [], | ||
| 218 | - }, | ||
| 219 | - }); | ||
| 220 | - } | ||
| 221 | - nameCoun.forEach((item) => { | ||
| 222 | - item.label = item.nameCoun; | ||
| 223 | - item.value = item.codeCoun; | ||
| 224 | - }); | ||
| 225 | - formModel.nameCoun = undefined; // reset city value | ||
| 226 | - formModel.nameTown = undefined; | ||
| 227 | - updateSchema({ | ||
| 228 | - field: 'nameCoun', | ||
| 229 | - componentProps: { | ||
| 230 | - // 请选择区 | ||
| 231 | - options: nameCoun, | ||
| 232 | - async onChange(value) { | ||
| 233 | - let nameTown = await getTownChild('codeCoun', value); | ||
| 234 | - if (value === undefined) { | ||
| 235 | - formModel.nameTown = undefined; | ||
| 236 | - nameTown = []; | ||
| 237 | - } | ||
| 238 | - nameTown.forEach((item) => { | ||
| 239 | - item.label = item.nameTown; | ||
| 240 | - item.value = item.codeTown; | ||
| 241 | - }); | 134 | + // // 地区显示回显和数据联动 |
| 135 | + // async function updateCityData( | ||
| 136 | + // codeProv: string, | ||
| 137 | + // codeCity: string, | ||
| 138 | + // codeCoun: string, | ||
| 139 | + // codeTown: string | ||
| 140 | + // ) { | ||
| 141 | + // const nameCity = await getTownChild('codeProv', codeProv); | ||
| 142 | + // const nameCoun = await getTownChild('codeCity', codeCity); | ||
| 143 | + // const nameTown = await getTownChild('codeCoun', codeCoun); | ||
| 144 | + // nameCity.forEach((item) => { | ||
| 145 | + // item.label = item.nameCity; | ||
| 146 | + // item.value = item.codeCity; | ||
| 147 | + // }); | ||
| 148 | + // nameCoun.forEach((item) => { | ||
| 149 | + // item.label = item.nameCoun; | ||
| 150 | + // item.value = item.codeCoun; | ||
| 151 | + // }); | ||
| 152 | + // nameTown.forEach((item) => { | ||
| 153 | + // item.label = item.nameTown; | ||
| 154 | + // item.value = item.codeTown; | ||
| 155 | + // }); | ||
| 156 | + // setFieldsValue({ | ||
| 157 | + // nameProv: codeProv, | ||
| 158 | + // nameCity: codeCity, | ||
| 159 | + // nameCoun: codeCoun, | ||
| 160 | + // nameTown: codeTown, | ||
| 161 | + // }); | ||
| 162 | + // updateSchema({ | ||
| 163 | + // field: 'nameTown', | ||
| 164 | + // componentProps: { | ||
| 165 | + // options: nameTown, | ||
| 166 | + // }, | ||
| 167 | + // }); | ||
| 168 | + // updateSchema({ | ||
| 169 | + // field: 'nameCoun', | ||
| 170 | + // componentProps: { | ||
| 171 | + // options: nameCoun, | ||
| 172 | + // async onChange(value) { | ||
| 173 | + // if (value === undefined) { | ||
| 174 | + // setFieldsValue({ | ||
| 175 | + // nameTown: undefined, | ||
| 176 | + // }); | ||
| 177 | + // updateSchema({ | ||
| 178 | + // field: 'nameTown', | ||
| 179 | + // componentProps: { | ||
| 180 | + // options: [], | ||
| 181 | + // }, | ||
| 182 | + // }); | ||
| 183 | + // } | ||
| 184 | + // let nameTown = await getTownChild('codeCoun', value); | ||
| 185 | + // nameTown.forEach((item) => { | ||
| 186 | + // item.label = item.nameTown; | ||
| 187 | + // item.value = item.codeTown; | ||
| 188 | + // }); | ||
| 189 | + // setFieldsValue({ | ||
| 190 | + // nameTown: undefined, | ||
| 191 | + // }); | ||
| 192 | + // updateSchema({ | ||
| 193 | + // field: 'nameTown', | ||
| 194 | + // componentProps: { | ||
| 195 | + // placeholder: '请选择街道/城镇', | ||
| 196 | + // options: nameTown, | ||
| 197 | + // }, | ||
| 198 | + // }); | ||
| 199 | + // }, | ||
| 200 | + // }, | ||
| 201 | + // }); | ||
| 202 | + // updateSchema({ | ||
| 203 | + // field: 'nameCity', | ||
| 204 | + // componentProps: ({ formModel }) => { | ||
| 205 | + // return { | ||
| 206 | + // options: nameCity, | ||
| 207 | + // onChange: async (value) => { | ||
| 208 | + // let nameCoun = await getTownChild('codeCity', value); | ||
| 209 | + // if (value === undefined) { | ||
| 210 | + // formModel.nameCoun = undefined; // reset city value | ||
| 211 | + // formModel.nameTown = undefined; | ||
| 212 | + // nameCoun = []; | ||
| 213 | + // updateSchema({ | ||
| 214 | + // field: 'nameTown', | ||
| 215 | + // componentProps: { | ||
| 216 | + // options: [], | ||
| 217 | + // }, | ||
| 218 | + // }); | ||
| 219 | + // } | ||
| 220 | + // nameCoun.forEach((item) => { | ||
| 221 | + // item.label = item.nameCoun; | ||
| 222 | + // item.value = item.codeCoun; | ||
| 223 | + // }); | ||
| 224 | + // formModel.nameCoun = undefined; // reset city value | ||
| 225 | + // formModel.nameTown = undefined; | ||
| 226 | + // updateSchema({ | ||
| 227 | + // field: 'nameCoun', | ||
| 228 | + // componentProps: { | ||
| 229 | + // // 请选择区 | ||
| 230 | + // options: nameCoun, | ||
| 231 | + // async onChange(value) { | ||
| 232 | + // let nameTown = await getTownChild('codeCoun', value); | ||
| 233 | + // if (value === undefined) { | ||
| 234 | + // formModel.nameTown = undefined; | ||
| 235 | + // nameTown = []; | ||
| 236 | + // } | ||
| 237 | + // nameTown.forEach((item) => { | ||
| 238 | + // item.label = item.nameTown; | ||
| 239 | + // item.value = item.codeTown; | ||
| 240 | + // }); | ||
| 242 | 241 | ||
| 243 | - formModel.nameTown = undefined; | ||
| 244 | - updateSchema({ | ||
| 245 | - field: 'nameTown', | ||
| 246 | - componentProps: { | ||
| 247 | - placeholder: '请选择街道/城镇', | ||
| 248 | - options: nameTown, | ||
| 249 | - }, | ||
| 250 | - }); | ||
| 251 | - }, | ||
| 252 | - }, | ||
| 253 | - }); | ||
| 254 | - }, | ||
| 255 | - }; | ||
| 256 | - }, | ||
| 257 | - }); | ||
| 258 | - } | 242 | + // formModel.nameTown = undefined; |
| 243 | + // updateSchema({ | ||
| 244 | + // field: 'nameTown', | ||
| 245 | + // componentProps: { | ||
| 246 | + // placeholder: '请选择街道/城镇', | ||
| 247 | + // options: nameTown, | ||
| 248 | + // }, | ||
| 249 | + // }); | ||
| 250 | + // }, | ||
| 251 | + // }, | ||
| 252 | + // }); | ||
| 253 | + // }, | ||
| 254 | + // }; | ||
| 255 | + // }, | ||
| 256 | + // }); | ||
| 257 | + // } | ||
| 259 | 258 | ||
| 260 | onMounted(async () => { | 259 | onMounted(async () => { |
| 261 | const res = await getEnterPriseDetail(); | 260 | const res = await getEnterPriseDetail(); |
| 262 | - const { codeProv, codeCity, codeCoun, codeTown } = res.sysTown; | ||
| 263 | - updateCityData(codeProv, codeCity, codeCoun, codeTown); | 261 | + // const { codeProv, codeCity, codeCoun, codeTown } = res; |
| 262 | + // updateCityData(codeProv, codeCity, codeCoun, codeTown); | ||
| 264 | setFieldsValue(res); | 263 | setFieldsValue(res); |
| 265 | qrcodePic.value = res.qrCode; | 264 | qrcodePic.value = res.qrCode; |
| 266 | }); | 265 | }); |
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | import { CollapseContainer } from '/@/components/Container/index'; | 10 | import { CollapseContainer } from '/@/components/Container/index'; |
| 11 | 11 | ||
| 12 | export default defineComponent({ | 12 | export default defineComponent({ |
| 13 | - name: 'index', | 13 | + name: 'Index', |
| 14 | components: { BasicForm, CollapseContainer }, | 14 | components: { BasicForm, CollapseContainer }, |
| 15 | emits: ['success', 'register', 'funcResetFields'], | 15 | emits: ['success', 'register', 'funcResetFields'], |
| 16 | setup() { | 16 | setup() { |
| @@ -47,7 +47,7 @@ | @@ -47,7 +47,7 @@ | ||
| 47 | import { getTableTenantProfileApi } from '/@/api/tenant/tenantApi'; | 47 | import { getTableTenantProfileApi } from '/@/api/tenant/tenantApi'; |
| 48 | 48 | ||
| 49 | export default defineComponent({ | 49 | export default defineComponent({ |
| 50 | - name: 'index', | 50 | + name: 'Index', |
| 51 | components: { BasicTable, TenantSettingDrawer, TableAction }, | 51 | components: { BasicTable, TenantSettingDrawer, TableAction }, |
| 52 | setup() { | 52 | setup() { |
| 53 | // let selectedRowKeys: Array<string> = []; | 53 | // let selectedRowKeys: Array<string> = []; |