Commit 03afa35101d8d573c6249a5583c0b897685ecbc7
1 parent
7b806ddb
'wip:联调设备,fix:修复eslint警告,表单加自定义验证,重写oem省市联动,fix:修改bug'
Showing
38 changed files
with
349 additions
and
372 deletions
| ... | ... | @@ -3,14 +3,12 @@ import { FileUploadResponse } from './model/index'; |
| 3 | 3 | enum API { |
| 4 | 4 | SELECT_DETAIL = '/enterprise/get', |
| 5 | 5 | UPDATE_DETAIL = '/enterprise/update', |
| 6 | - TOWN_LIST = '/town/list', | |
| 7 | - TOWN_CHILDS = '/town/childs', | |
| 8 | 6 | BaseUploadUrl = '/oss/upload', |
| 9 | 7 | SELECT_PLATFORM = '/platform/get', |
| 10 | 8 | UPDATE_PLATFORM = '/platform/update', |
| 11 | - | |
| 12 | 9 | SELECT_APP_DESIGN = '/appDesign/get', |
| 13 | 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 | 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 | 24 | }; |
| 25 | 25 | |
| 26 | 26 | export const delMenu = (menuIds: string[]) => { |
| 27 | - let url = Api.BaseMenuUrl; | |
| 27 | + const url = Api.BaseMenuUrl; | |
| 28 | 28 | return defHttp.delete({ url: url, data: menuIds }); |
| 29 | 29 | }; |
| 30 | 30 | export const getMenusIdsByRoleId = (roleId: string) => { |
| 31 | - let url = Api.GetMenuIdsByRoleId + roleId; | |
| 31 | + const url = Api.GetMenuIdsByRoleId + roleId; | |
| 32 | 32 | return defHttp.get<Array<string>>({ url: url }); |
| 33 | 33 | }; | ... | ... |
| ... | ... | @@ -56,16 +56,11 @@ |
| 56 | 56 | </template> |
| 57 | 57 | <script lang="ts"> |
| 58 | 58 | import { defineComponent, unref, computed } from 'vue'; |
| 59 | - | |
| 60 | 59 | import { propTypes } from '/@/utils/propTypes'; |
| 61 | - | |
| 62 | 60 | import { Layout } from 'ant-design-vue'; |
| 63 | 61 | import { AppLogo } from '/@/components/Application'; |
| 64 | 62 | import LayoutMenu from '../menu/index.vue'; |
| 65 | 63 | import LayoutTrigger from '../trigger/index.vue'; |
| 66 | - | |
| 67 | - import { AppSearch } from '/@/components/Application'; | |
| 68 | - | |
| 69 | 64 | import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting'; |
| 70 | 65 | import { useMenuSetting } from '/@/hooks/setting/useMenuSetting'; |
| 71 | 66 | import { useRootSetting } from '/@/hooks/setting/useRootSetting'; |
| ... | ... | @@ -93,7 +88,6 @@ |
| 93 | 88 | AppLocalePicker, |
| 94 | 89 | FullScreen, |
| 95 | 90 | Notify, |
| 96 | - AppSearch, | |
| 97 | 91 | ErrorAction, |
| 98 | 92 | SettingDrawer: createAsyncComponent(() => import('/@/layouts/default/setting/index.vue'), { |
| 99 | 93 | loading: true, | ... | ... |
| ... | ... | @@ -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 | 16 | import { useI18n } from '/@/hooks/web/useI18n'; |
| 17 | 17 | import { joinTimestamp, formatRequestDate } from './helper'; |
| 18 | 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 | 20 | import { router } from '/@/router'; |
| 21 | 21 | // import { useUserStore } from '/@/store/modules/user'; |
| 22 | 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 | 42 | componentProps: { |
| 43 | 43 | size: 'small', |
| 44 | 44 | options: [ |
| 45 | + { label: '全部', value: 'ALL' }, | |
| 45 | 46 | { label: '待激活', value: 'INACTIVE' }, |
| 46 | 47 | { label: '在线', value: 'ONLINE' }, |
| 47 | 48 | { label: '离线', value: 'OFFLINE' }, |
| 48 | - { label: '报警', value: 'hhh' }, | |
| 49 | 49 | ], |
| 50 | 50 | }, |
| 51 | 51 | }, |
| 52 | 52 | { |
| 53 | 53 | field: 'alarmStatus', |
| 54 | - label: '', | |
| 54 | + label: '是否报警', | |
| 55 | 55 | component: 'RadioGroup', |
| 56 | + labelWidth: '85px', | |
| 56 | 57 | componentProps: { |
| 57 | 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 | 2 | <div class="wrapper"> |
| 3 | 3 | <div ref="wrapRef" :style="{ height, width }"> </div> |
| 4 | 4 | <div class="right-wrap"> |
| 5 | - <BasicTable @register="registerTable"> | |
| 5 | + <BasicTable @register="registerTable" @rowClick="deviceRowClick"> | |
| 6 | 6 | <template #deviceState="{ record }"> |
| 7 | 7 | <Tag |
| 8 | 8 | :color=" |
| ... | ... | @@ -35,6 +35,7 @@ |
| 35 | 35 | import { devicePage } from '/@/api/alarm/contact/alarmContact'; |
| 36 | 36 | import { Tag } from 'ant-design-vue'; |
| 37 | 37 | import { DeviceState } from '/@/api/device/model/deviceModel'; |
| 38 | + import { BAI_DU_MAP_URL } from '/@/utils/fnUtils'; | |
| 38 | 39 | export default defineComponent({ |
| 39 | 40 | name: 'BaiduMap', |
| 40 | 41 | components: { |
| ... | ... | @@ -52,8 +53,6 @@ |
| 52 | 53 | }, |
| 53 | 54 | }, |
| 54 | 55 | setup() { |
| 55 | - const BAI_DU_MAP_URL = | |
| 56 | - 'https://api.map.baidu.com/getscript?v=3.0&ak=7uOPPyAHn2Y2ZryeQqHtcRqtIY374vKa'; | |
| 57 | 56 | const wrapRef = ref<HTMLDivElement | null>(null); |
| 58 | 57 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); |
| 59 | 58 | |
| ... | ... | @@ -72,23 +71,25 @@ |
| 72 | 71 | initMap(); |
| 73 | 72 | }); |
| 74 | 73 | |
| 75 | - const [registerTable, { reload }] = useTable({ | |
| 74 | + const [registerTable] = useTable({ | |
| 76 | 75 | api: devicePage, |
| 77 | 76 | columns, |
| 78 | 77 | formConfig: { |
| 79 | - labelWidth: 120, | |
| 80 | 78 | schemas: formSchema, |
| 79 | + labelAlign: 'left', | |
| 81 | 80 | }, |
| 82 | 81 | showIndexColumn: false, |
| 83 | 82 | useSearchForm: true, |
| 84 | 83 | }); |
| 85 | - const handleSuccess = () => { | |
| 86 | - reload(); | |
| 84 | + // 点击表格某一行触发 | |
| 85 | + const deviceRowClick = (record) => { | |
| 86 | + console.log(record); | |
| 87 | 87 | }; |
| 88 | + | |
| 88 | 89 | return { |
| 89 | 90 | wrapRef, |
| 90 | 91 | registerTable, |
| 91 | - handleSuccess, | |
| 92 | + deviceRowClick, | |
| 92 | 93 | DeviceState, |
| 93 | 94 | }; |
| 94 | 95 | }, | ... | ... |
| 1 | 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
| 2 | 2 | import { getOrganizationList } from '/@/api/system/system'; |
| 3 | 3 | import { copyTransFun } from '/@/utils/fnUtils'; |
| 4 | +import { emailRule, phoneRule } from '/@/utils/rules'; | |
| 4 | 5 | |
| 5 | 6 | // 表格列数据 |
| 6 | 7 | export const columns: BasicColumn[] = [ |
| ... | ... | @@ -90,21 +91,7 @@ export const formSchema: FormSchema[] = [ |
| 90 | 91 | componentProps: { |
| 91 | 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 | 97 | field: 'email', |
| ... | ... | @@ -113,20 +100,7 @@ export const formSchema: FormSchema[] = [ |
| 113 | 100 | componentProps: { |
| 114 | 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 | 106 | field: 'wechat', | ... | ... |
| ... | ... | @@ -58,7 +58,7 @@ export const searchFormSchema: FormSchema[] = [ |
| 58 | 58 | { label: '网关子设备', value: DeviceTypeEnum.SENSOR }, |
| 59 | 59 | ], |
| 60 | 60 | }, |
| 61 | - colProps: { span: 4 }, | |
| 61 | + colProps: { span: 6 }, | |
| 62 | 62 | }, |
| 63 | 63 | { |
| 64 | 64 | field: 'deviceState', |
| ... | ... | @@ -71,12 +71,12 @@ export const searchFormSchema: FormSchema[] = [ |
| 71 | 71 | { label: '离线', value: DeviceState.OFFLINE }, |
| 72 | 72 | ], |
| 73 | 73 | }, |
| 74 | - colProps: { span: 4 }, | |
| 74 | + colProps: { span: 6 }, | |
| 75 | 75 | }, |
| 76 | 76 | { |
| 77 | 77 | field: 'name', |
| 78 | 78 | label: '设备名称', |
| 79 | 79 | component: 'Input', |
| 80 | - colProps: { span: 8 }, | |
| 80 | + colProps: { span: 6 }, | |
| 81 | 81 | }, |
| 82 | 82 | ]; | ... | ... |
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | @register="register" |
| 6 | 6 | :destroyOnClose="true" |
| 7 | 7 | @close="closeDrawer" |
| 8 | + :title="deviceDetail.name" | |
| 8 | 9 | > |
| 9 | 10 | <Tabs v-model:activeKey="activeKey" :size="size" type="card"> |
| 10 | 11 | <TabPane key="1" tab="详情" |
| ... | ... | @@ -41,6 +42,7 @@ |
| 41 | 42 | Alarm, |
| 42 | 43 | ChildDevice, |
| 43 | 44 | }, |
| 45 | + | |
| 44 | 46 | emits: ['reload', 'register'], |
| 45 | 47 | setup() { |
| 46 | 48 | const activeKey = ref('1'); |
| ... | ... | @@ -52,10 +54,11 @@ |
| 52 | 54 | const { id } = data; |
| 53 | 55 | const res = await getDeviceDetail(id); |
| 54 | 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 | 62 | const closeDrawer = () => { |
| 60 | 63 | activeKey.value = '1'; |
| 61 | 64 | }; | ... | ... |
| ... | ... | @@ -64,6 +64,7 @@ |
| 64 | 64 | import { EnvironmentTwoTone, PlusOutlined } from '@ant-design/icons-vue'; |
| 65 | 65 | import { upload } from '/@/api/oss/ossFileUploader'; |
| 66 | 66 | import { FileItem } from '/@/components/Upload/src/typing'; |
| 67 | + import { BAI_DU_MAP_URL } from '/@/utils/fnUtils'; | |
| 67 | 68 | export default defineComponent({ |
| 68 | 69 | components: { |
| 69 | 70 | BasicForm, |
| ... | ... | @@ -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 | 164 | const wrapRef = ref<HTMLDivElement | null>(null); |
| 166 | 165 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); |
| 167 | 166 | ... | ... |
| ... | ... | @@ -2,15 +2,22 @@ |
| 2 | 2 | <div class="tabs-detail"> |
| 3 | 3 | <div v-if="deviceDetail?.deviceInfo?.avatar"> |
| 4 | 4 | <p>设备图片</p> |
| 5 | - <Image :src="deviceDetail?.deviceInfo?.avatar" /> | |
| 5 | + <Image :src="deviceDetail.deviceInfo.avatar" :width="100" /> | |
| 6 | 6 | </div> |
| 7 | 7 | <div> |
| 8 | 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 | 17 | </div> |
| 11 | - <div v-if="deviceDetail?.deviceInfo?.address"> | |
| 18 | + <div v-if="deviceDetail?.deviceInfo?.address" class="mt-4"> | |
| 12 | 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 | 21 | </div> |
| 15 | 22 | <div class="mt-4"> |
| 16 | 23 | <a-button type="primary" class="mr-4" @click="copyTbDeviceId">复制设备ID</a-button> |
| ... | ... | @@ -25,6 +32,7 @@ |
| 25 | 32 | import { useScript } from '/@/hooks/web/useScript'; |
| 26 | 33 | import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; |
| 27 | 34 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 35 | + import { BAI_DU_MAP_URL } from '/@/utils/fnUtils'; | |
| 28 | 36 | export default defineComponent({ |
| 29 | 37 | components: { |
| 30 | 38 | Image, |
| ... | ... | @@ -38,8 +46,6 @@ |
| 38 | 46 | }, |
| 39 | 47 | setup(props) { |
| 40 | 48 | // 地图 |
| 41 | - const BAI_DU_MAP_URL = | |
| 42 | - 'https://api.map.baidu.com/getscript?v=3.0&ak=7uOPPyAHn2Y2ZryeQqHtcRqtIY374vKa'; | |
| 43 | 49 | const wrapRef = ref<HTMLDivElement | null>(null); |
| 44 | 50 | const { toPromise } = useScript({ src: BAI_DU_MAP_URL }); |
| 45 | 51 | ... | ... |
| ... | ... | @@ -8,9 +8,9 @@ |
| 8 | 8 | <template #toolbar> |
| 9 | 9 | <a-button type="primary" @click="handleCreate"> 新增设备配置 </a-button> |
| 10 | 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 | 12 | </ImpExcel> |
| 13 | - <a-button type="danger" @click="handleTableDel"> 删除 </a-button> | |
| 13 | + <a-button danger color="error" @click="handleTableDel"> 删除 </a-button> | |
| 14 | 14 | </template> |
| 15 | 15 | <template #action="{ record }"> |
| 16 | 16 | <TableAction |
| ... | ... | @@ -62,6 +62,7 @@ |
| 62 | 62 | export default defineComponent({ |
| 63 | 63 | name: 'DeviceProfileManagement', |
| 64 | 64 | components: { BasicTable, DeviceProfileModal, TableAction, ImpExcel, DeviceConfigDetail }, |
| 65 | + | |
| 65 | 66 | setup() { |
| 66 | 67 | let selectedRowKeys: string[] = reactive([]); |
| 67 | 68 | let isJudgeStatus = ref(true); | ... | ... |
| ... | ... | @@ -30,18 +30,16 @@ |
| 30 | 30 | </template> |
| 31 | 31 | <script lang="ts"> |
| 32 | 32 | import { defineComponent } from 'vue'; |
| 33 | - | |
| 34 | 33 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 35 | - import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | |
| 34 | + import { useDrawerInner } from '/@/components/Drawer'; | |
| 36 | 35 | import { columns, searchFormSchema } from './email.data'; |
| 37 | - import { Tag } from 'ant-design-vue'; | |
| 38 | 36 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 39 | 37 | import { deleteSmsLog, mailLogPage } from '/@/api/message/records'; |
| 40 | 38 | import { useModal } from '/@/components/Modal'; |
| 41 | 39 | import EmailDetail from '/@/views/message/records/item/EmailDetail.vue'; |
| 42 | 40 | export default defineComponent({ |
| 43 | 41 | name: 'EmailLog', |
| 44 | - components: { EmailDetail, BasicDrawer, BasicTable, TableAction, Tag }, | |
| 42 | + components: { EmailDetail, BasicTable, TableAction }, | |
| 45 | 43 | setup() { |
| 46 | 44 | const [registerModal, { openModal }] = useModal(); |
| 47 | 45 | const { createMessage } = useMessage(); | ... | ... |
| ... | ... | @@ -31,16 +31,16 @@ |
| 31 | 31 | import { defineComponent, h } from 'vue'; |
| 32 | 32 | |
| 33 | 33 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| 34 | - import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | |
| 34 | + import { useDrawerInner } from '/@/components/Drawer'; | |
| 35 | 35 | import { columns, searchFormSchema } from './sms.data'; |
| 36 | - import { Modal, Tag } from 'ant-design-vue'; | |
| 36 | + import { Modal } from 'ant-design-vue'; | |
| 37 | 37 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 38 | 38 | import { smsLogPage, deleteSmsLog } from '/@/api/message/records'; |
| 39 | 39 | import { JsonPreview } from '/@/components/CodeEditor'; |
| 40 | 40 | |
| 41 | 41 | export default defineComponent({ |
| 42 | 42 | name: 'SmsLog', |
| 43 | - components: { BasicDrawer, BasicTable, TableAction, Tag }, | |
| 43 | + components: { BasicTable, TableAction }, | |
| 44 | 44 | setup() { |
| 45 | 45 | const { createMessage } = useMessage(); |
| 46 | 46 | const [register] = useDrawerInner(() => {}); | ... | ... |
| ... | ... | @@ -23,8 +23,8 @@ export const columns: BasicColumn[] = [ |
| 23 | 23 | const status = record.status; |
| 24 | 24 | const success = status === 'SUCCESS'; |
| 25 | 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 | 28 | const text = success ? successText : failedText; |
| 29 | 29 | return h(Tag, { color: color }, () => text); |
| 30 | 30 | }, | ... | ... |
| ... | ... | @@ -28,8 +28,8 @@ export const columns: BasicColumn[] = [ |
| 28 | 28 | const status = record.status; |
| 29 | 29 | const success = status === 'SUCCESS'; |
| 30 | 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 | 33 | const text = success ? successText : failedText; |
| 34 | 34 | return h(Tag, { color: color }, () => text); |
| 35 | 35 | }, | ... | ... |
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; |
| 12 | 12 | import { sendSms } from '/@/api/message/template'; |
| 13 | 13 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 14 | + import { phoneRule } from '/@/utils/rules'; | |
| 14 | 15 | const schemas: FormSchema[] = [ |
| 15 | 16 | { |
| 16 | 17 | field: 'id', |
| ... | ... | @@ -34,7 +35,7 @@ |
| 34 | 35 | field: 'phoneNumbers', |
| 35 | 36 | component: 'Input', |
| 36 | 37 | label: '手机号码', |
| 37 | - required: true, | |
| 38 | + rules: phoneRule, | |
| 38 | 39 | }, |
| 39 | 40 | { |
| 40 | 41 | field: 'params', | ... | ... |
| ... | ... | @@ -47,10 +47,8 @@ |
| 47 | 47 | import { useDrawer } from '/@/components/Drawer'; |
| 48 | 48 | import TemplateDrawer from './TemplateDrawer.vue'; |
| 49 | 49 | import { columns, searchFormSchema } from './template.data'; |
| 50 | - import { CodeEditor } from '/@/components/CodeEditor'; | |
| 51 | 50 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 52 | 51 | import { deleteMessageTemplate, messageTemplatePage } from '/@/api/message/template'; |
| 53 | - import { Tag } from 'ant-design-vue'; | |
| 54 | 52 | import { useGo } from '/@/hooks/web/usePage'; |
| 55 | 53 | import { PageEnum } from '/@/enums/pageEnum'; |
| 56 | 54 | import { useModal } from '/@/components/Modal'; |
| ... | ... | @@ -60,7 +58,7 @@ |
| 60 | 58 | |
| 61 | 59 | export default defineComponent({ |
| 62 | 60 | name: 'MessageTemplateManagement', |
| 63 | - components: { SendSms, SendEmail, BasicTable, TemplateDrawer, TableAction, CodeEditor, Tag }, | |
| 61 | + components: { SendSms, SendEmail, BasicTable, TemplateDrawer, TableAction }, | |
| 64 | 62 | setup() { |
| 65 | 63 | const [registerModal, { openModal: openModal }] = useModal(); |
| 66 | 64 | const [registerMailModal, { openModal: openMailModal }] = useModal(); | ... | ... |
| ... | ... | @@ -47,7 +47,7 @@ |
| 47 | 47 | import { screenLinkPageGetApi, screenLinkPageDeleteApi } from '/@/api/ruleengine/ruleengineApi'; |
| 48 | 48 | |
| 49 | 49 | export default defineComponent({ |
| 50 | - name: 'index', | |
| 50 | + name: 'Index', | |
| 51 | 51 | components: { BasicTable, SceneLinkAgeDrawer, TableAction }, |
| 52 | 52 | setup() { |
| 53 | 53 | let selectedRowKeys: Array<string> = []; | ... | ... |
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | import { notifyMyGetrPageApi } from '/@/api/stationnotification/stationnotifyApi'; |
| 32 | 32 | |
| 33 | 33 | export default defineComponent({ |
| 34 | - name: 'index', | |
| 34 | + name: 'Index', | |
| 35 | 35 | components: { BasicTable, NotifyDetailDrawer, TableAction }, |
| 36 | 36 | setup() { |
| 37 | 37 | let selectedRowKeys: Array<string> = []; | ... | ... |
| ... | ... | @@ -63,8 +63,6 @@ |
| 63 | 63 | import RegisterForm from './RegisterForm.vue'; |
| 64 | 64 | import MobileForm from './MobileForm.vue'; |
| 65 | 65 | import QrCodeForm from './QrCodeForm.vue'; |
| 66 | - import { useGlobSetting } from '/@/hooks/setting'; | |
| 67 | - import { useI18n } from '/@/hooks/web/useI18n'; | |
| 68 | 66 | import { useDesign } from '/@/hooks/web/useDesign'; |
| 69 | 67 | import { useLocaleStore } from '/@/store/modules/locale'; |
| 70 | 68 | import { useUserStore } from '/@/store/modules/user'; |
| ... | ... | @@ -75,12 +73,9 @@ |
| 75 | 73 | }, |
| 76 | 74 | }); |
| 77 | 75 | |
| 78 | - const globSetting = useGlobSetting(); | |
| 79 | 76 | const { prefixCls } = useDesign('login'); |
| 80 | - const { t } = useI18n(); | |
| 81 | 77 | const localeStore = useLocaleStore(); |
| 82 | 78 | const showLocale = localeStore.getShowPicker; |
| 83 | - const title = computed(() => globSetting?.title ?? ''); | |
| 84 | 79 | const isDark = ref(true); |
| 85 | 80 | const toggleDark = () => { |
| 86 | 81 | isDark.value = !isDark.value; | ... | ... |
| ... | ... | @@ -38,10 +38,10 @@ |
| 38 | 38 | import LoginFormTitle from './LoginFormTitle.vue'; |
| 39 | 39 | import { useI18n } from '/@/hooks/web/useI18n'; |
| 40 | 40 | import { useLoginState, useFormRules, useFormValid, LoginStateEnum } from './useLogin'; |
| 41 | - import { SendLoginSmsCode, smsCodeLoginApi } from '/@/api/sys/user'; | |
| 41 | + import { SendLoginSmsCode } from '/@/api/sys/user'; | |
| 42 | 42 | import { useUserStore } from '/@/store/modules/user'; |
| 43 | 43 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 44 | - const { notification, createErrorModal } = useMessage(); | |
| 44 | + const { notification } = useMessage(); | |
| 45 | 45 | |
| 46 | 46 | const FormItem = Form.Item; |
| 47 | 47 | const { t } = useI18n(); | ... | ... |
| 1 | 1 | import { getAllRoleList, isAccountExist } from '/@/api/system/system'; |
| 2 | 2 | import { BasicColumn } from '/@/components/Table'; |
| 3 | 3 | import { FormSchema } from '/@/components/Table'; |
| 4 | +import { emailRule, phoneRule } from '/@/utils/rules'; | |
| 4 | 5 | |
| 5 | 6 | export const columns: BasicColumn[] = [ |
| 6 | 7 | { |
| ... | ... | @@ -133,42 +134,14 @@ export const accountFormSchema: FormSchema[] = [ |
| 133 | 134 | field: 'phoneNumber', |
| 134 | 135 | component: 'Input', |
| 135 | 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 | 140 | label: '邮箱', |
| 154 | 141 | field: 'email', |
| 155 | 142 | component: 'Input', |
| 156 | 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 | 147 | field: 'accountExpireTime', | ... | ... |
| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | </div> |
| 13 | 13 | </template> |
| 14 | 14 | <script lang="ts"> |
| 15 | - import { defineComponent, ref } from 'vue'; | |
| 15 | + import { defineComponent } from 'vue'; | |
| 16 | 16 | import { PageWrapper } from '/@/components/Page'; |
| 17 | 17 | import { BasicForm, useForm } from '/@/components/Form'; |
| 18 | 18 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | ... | ... |
| ... | ... | @@ -19,8 +19,7 @@ |
| 19 | 19 | > |
| 20 | 20 | <img v-if="tenantLogo" :src="tenantLogo" alt="avatar" /> |
| 21 | 21 | <div v-else> |
| 22 | - <loading-outlined v-if="loading"></loading-outlined> | |
| 23 | - <plus-outlined v-else></plus-outlined> | |
| 22 | + <plus-outlined /> | |
| 24 | 23 | <div class="ant-upload-text">上传</div> |
| 25 | 24 | </div> |
| 26 | 25 | </Upload> |
| ... | ... | @@ -32,9 +31,7 @@ |
| 32 | 31 | import { defineComponent, ref, computed, unref } from 'vue'; |
| 33 | 32 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 34 | 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 | 35 | import { message, Upload } from 'ant-design-vue'; |
| 39 | 36 | |
| 40 | 37 | import { useI18n } from '/@/hooks/web/useI18n'; |
| ... | ... | @@ -48,12 +45,8 @@ |
| 48 | 45 | components: { |
| 49 | 46 | BasicDrawer, |
| 50 | 47 | BasicForm, |
| 51 | - CropperImage, | |
| 52 | - CollapseContainer, | |
| 53 | - CropperAvatar, | |
| 54 | 48 | Upload, |
| 55 | 49 | PlusOutlined, |
| 56 | - LoadingOutlined, | |
| 57 | 50 | }, |
| 58 | 51 | emits: ['success', 'register'], |
| 59 | 52 | setup(_, { emit }) { | ... | ... |
| 1 | 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 | 5 | export const schemas: FormSchema[] = [ |
| 5 | 6 | { |
| ... | ... | @@ -42,10 +43,10 @@ export const schemas: FormSchema[] = [ |
| 42 | 43 | colProps: { |
| 43 | 44 | span: 24, |
| 44 | 45 | }, |
| 45 | - | |
| 46 | 46 | componentProps: { |
| 47 | 47 | placeholder: '请输入公司邮箱', |
| 48 | 48 | }, |
| 49 | + rules: emailRule, | |
| 49 | 50 | }, |
| 50 | 51 | { |
| 51 | 52 | field: 'synopsis', |
| ... | ... | @@ -63,20 +64,17 @@ export const schemas: FormSchema[] = [ |
| 63 | 64 | }, |
| 64 | 65 | { |
| 65 | 66 | field: 'country', |
| 66 | - component: 'Select', | |
| 67 | + component: 'ApiSelect', | |
| 67 | 68 | label: '国家/地区', |
| 68 | 69 | colProps: { |
| 69 | 70 | span: 24, |
| 70 | 71 | }, |
| 71 | - defaultValue: '1', | |
| 72 | 72 | componentProps: { |
| 73 | + api: getAreaList, | |
| 74 | + params: { parentId: 0 }, | |
| 75 | + labelField: 'name', | |
| 76 | + valueField: 'parentId', | |
| 73 | 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 | 84 | colProps: { |
| 87 | 85 | span: 5, |
| 88 | 86 | }, |
| 89 | - componentProps: ({ formModel, formActionType }) => { | |
| 87 | + componentProps({ formModel, formActionType }) { | |
| 88 | + const { updateSchema } = formActionType; | |
| 90 | 89 | return { |
| 91 | - api: getTownList, | |
| 92 | - labelField: 'nameProv', | |
| 93 | - valueField: 'codeProv', | |
| 90 | + api: getAreaList, | |
| 91 | + labelField: 'name', | |
| 92 | + valueField: 'code', | |
| 94 | 93 | placeholder: '请选择省份', |
| 94 | + params: { parentId: 1 }, | |
| 95 | 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 | 96 | if (value === undefined) { |
| 103 | 97 | formModel.nameCity = undefined; // reset city value |
| 104 | 98 | formModel.nameCoun = undefined; |
| 105 | 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 | 129 | updateSchema({ |
| 114 | - field: 'nameTown', | |
| 130 | + field: 'nameCity', | |
| 115 | 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 | 132 | options: nameCity, |
| 128 | 133 | placeholder: '请选择城市', |
| 129 | 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 | 135 | if (value === undefined) { |
| 137 | 136 | formModel.nameCoun = undefined; // reset city value |
| 138 | 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 | 159 | updateSchema({ |
| 141 | - field: 'nameTown', | |
| 160 | + field: 'nameCoun', | |
| 142 | 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 | 269 | componentProps: { |
| 256 | 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 | 275 | field: 'qrcode', | ... | ... |
| ... | ... | @@ -46,7 +46,6 @@ |
| 46 | 46 | import { getEnterPriseDetail, updateEnterPriseDetail } from '/@/api/oem/index'; |
| 47 | 47 | import { Loading } from '/@/components/Loading'; |
| 48 | 48 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 49 | - import { getTownChild } from '/@/api/oem/index'; | |
| 50 | 49 | import { useUserStore } from '/@/store/modules/user'; |
| 51 | 50 | import { createLocalStorage } from '/@/utils/cache'; |
| 52 | 51 | import { PlusOutlined } from '@ant-design/icons-vue'; |
| ... | ... | @@ -132,135 +131,135 @@ |
| 132 | 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 | 259 | onMounted(async () => { |
| 261 | 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 | 263 | setFieldsValue(res); |
| 265 | 264 | qrcodePic.value = res.qrCode; |
| 266 | 265 | }); | ... | ... |
| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 | import { CollapseContainer } from '/@/components/Container/index'; |
| 11 | 11 | |
| 12 | 12 | export default defineComponent({ |
| 13 | - name: 'index', | |
| 13 | + name: 'Index', | |
| 14 | 14 | components: { BasicForm, CollapseContainer }, |
| 15 | 15 | emits: ['success', 'register', 'funcResetFields'], |
| 16 | 16 | setup() { | ... | ... |
| ... | ... | @@ -47,7 +47,7 @@ |
| 47 | 47 | import { getTableTenantProfileApi } from '/@/api/tenant/tenantApi'; |
| 48 | 48 | |
| 49 | 49 | export default defineComponent({ |
| 50 | - name: 'index', | |
| 50 | + name: 'Index', | |
| 51 | 51 | components: { BasicTable, TenantSettingDrawer, TableAction }, |
| 52 | 52 | setup() { |
| 53 | 53 | // let selectedRowKeys: Array<string> = []; | ... | ... |