Browse Source

fix(#bugs): 新增企业---- 增加操作成功

tangning 3 years ago
parent
commit
f867387683

+ 1 - 1
src/api/corporation/modal.ts

@@ -12,7 +12,7 @@ import {
 import type { Result } from '/#/axios';
 
 enum Api {
-  addDevice = '/kankan-api/api/manager/company/addDevice',
+  addDevice = '/kankan-api/api/manager/camera/bind', ///api/manager/company/addDevice
   checkDevice = '/kankan-api/api/manager/company/checkDevice',
   selectUserList = '/kankan-api/api/manager/company/selectUserList',
   addPoint = '/kankan-api/api/manager/company/addPoint',

+ 1 - 1
src/components/Cropper/src/CopperModal.vue

@@ -22,7 +22,7 @@
         </div>
 
         <div :class="`${prefixCls}-toolbar`">
-          <Upload :fileList="[]" accept="image/*" :beforeUpload="handleBeforeUpload">
+          <Upload :fileList="[]" accept=".jpg,.jpeg.gif,.png" :beforeUpload="handleBeforeUpload">
             <Tooltip :title="t('component.cropper.selectImage')" placement="bottom">
               <a-button size="small" preIcon="ant-design:upload-outlined" type="primary" />
             </Tooltip>

+ 1 - 1
src/components/Upload/src/data.tsx

@@ -40,7 +40,7 @@ export function createTableColumns(): BasicColumn[] {
         return (
           <span>
             <p class="truncate mb-1" title={text}>
-              {text}
+              {text && text.length < 30 ? text : text.slice(0, 30) + '...'}
             </p>
             <Progress percent={percent} size="small" status={status} />
           </span>

+ 1 - 1
src/locales/lang/ja/routes/corporation.ts

@@ -10,7 +10,7 @@ export default {
     9: 'すべて',
   },
   businessAuth: '企業認定',
-  timeField: '時間フィールド',
+  timeField: 'コミット時間',
   phone: '電話番号',
   enterpriseName: '会社名',
   submitTime: '提出時間',

+ 1 - 1
src/locales/lang/ja/routes/devices.ts

@@ -1,7 +1,7 @@
 export default {
   title: '员工账号',
   listTile: '従業員アカウントリスト',
-  deviceList: 'デバイスリスト',
+  deviceList: 'ステータス',
   device: 'デバイス',
   addDevice: 'デバイスを追加',
   addBut: '新規従業員アカウント',

+ 1 - 0
src/locales/lang/ja/sys.ts

@@ -112,5 +112,6 @@ export default {
     corporationMail: '会社のメール',
     fillMail: 'メールアドレスをご記入ください !',
     fillMailCorrect: 'メールボックスに正しく記入してください !',
+    emailSMS: '電子メール確認コード',
   },
 };

+ 1 - 1
src/locales/lang/zh-CN/routes/corporation.ts

@@ -10,7 +10,7 @@ export default {
     9: '全部',
   },
   businessAuth: '企业认证',
-  timeField: '时间字段',
+  timeField: '提交时间',
   phone: '手机号',
   enterpriseName: '企业名称',
   submitTime: '提交时间',

+ 1 - 1
src/locales/lang/zh-CN/routes/devices.ts

@@ -2,7 +2,7 @@ export default {
   title: '员工账号',
   addBut: '新增员工账号',
   listTile: '员工账号列表',
-  deviceList: '设备列表',
+  deviceList: '状态',
   device: '设备',
   addDevice: '新增设备',
   browserDevice: '查看设备',

+ 4 - 0
src/views/corporation/AddCorporationModal.vue

@@ -95,9 +95,12 @@
       label: t('routes.corporation.companyLogo'),
       required: true,
       rules: [{ required: true, message: '请选择上传文件' }],
+      helpMessage: '支持png  jpg图片格式',
       componentProps: {
         api: uploadLogoApi,
         maxNumber: 1,
+        maxSize: 10,
+        accept: ['jpg', 'jpeg', 'gif', 'png'],
         afterFetch: function (data) {
           console.log('data', data);
           Reflect.set(data, 'url', data.data);
@@ -170,6 +173,7 @@
         console.log('res', res);
         emit('submit');
         closeModal();
+        resetFields();
         createMessage.success(t('common.optSuccess'));
       };
       function handleVisibleChange(v) {

+ 1 - 1
src/views/corporation/SubaccountModal.vue

@@ -225,7 +225,7 @@
             content: t('routes.devices.unbindWarning'),
             onOk: async () => {
               // tableRef.value.deleteTableDataRecord(item.id);
-              deleteTableDataRecord(item.id);
+              deleteTableDataRecord(item.userName);
             },
           });
         }

+ 1 - 1
src/views/corporation/detailsModal.vue

@@ -127,7 +127,7 @@
         },
         {
           field: 'introduce',
-          label: `${t('routes.corporation.introduce')} :`,
+          label: `${t('routes.corporation.introduce')}`,
           slot: 'text',
           component: 'Input',
         },

+ 36 - 15
src/views/corporation/deviceModal.vue

@@ -49,7 +49,7 @@
   import { useMessage } from '/@/hooks/web/useMessage';
   import { InputNumber } from 'ant-design-vue';
   // AddDevice
-  import { checkDevice } from '/@/api/corporation/modal';
+  import { checkDevice, AddDevice } from '/@/api/corporation/modal';
   import { useI18n } from '/@/hooks/web/useI18n';
   import { Icon } from '/@/components/Icon/index';
   import { clamp, range } from 'lodash-es';
@@ -94,6 +94,18 @@
       };
       const schemas: FormSchema[] = [
         {
+          field: 'id',
+          label: 'id',
+          show: false,
+          component: 'Input',
+        },
+        {
+          field: 'subNum',
+          label: 'subNum',
+          show: false,
+          component: 'Input',
+        },
+        {
           field: 'companyName',
           label: t('routes.corporation.enterpriseName'),
           slot: 'userName',
@@ -106,11 +118,11 @@
           component: 'Input',
         },
         {
-          field: 'subNum',
+          field: 'deviceNumber',
           component: 'InputNumber',
           label: t('routes.corporation.cameraNum'),
+          defaultValue: 0,
           slot: 'subNum',
-
           colProps: {
             span: 8,
           },
@@ -186,19 +198,28 @@
         try {
           const values = await validate();
           console.log('values,', values);
-          // await AddDevice({
-          //   childNames: childNameList as any as string[],
-          //   companyId: id,
-          //   subNum: String(subNum),
-          //   userName,
-          // });
-          success('11');
+          let childNameList: string[] = [];
+          Object.keys(values).map((ele) => {
+            if (ele.includes('ID')) {
+              childNameList.push(values[ele]);
+            }
+          });
+
+          await AddDevice({
+            childNames: childNameList,
+            companyId: values.id,
+            subNum: String(values.subNum),
+            userName: values.userName,
+          });
+          success(t('common.optSuccess'));
           closeModal();
         } catch (error) {}
       }
 
       function onDataReceive(data) {
         // 方式1;
+        console.log('userName', data.record);
+
         resetFields();
         setFieldsValue({
           ...data.record,
@@ -306,7 +327,7 @@
 
       async function deviceMapping() {
         const values = getFieldsValue();
-        const devices: number = clamp(values.subNum, 0, 20);
+        const devices: number = clamp(values.deviceNumber, 0, 20);
         const currentLength = unref(modelRef).mappingLength;
 
         const rest = devices - currentLength;
@@ -336,19 +357,19 @@
       }
       async function handlePlusDevice() {
         const values = getFieldsValue();
-        const currentsubNum = values.subNum;
+        const currentsubNum = values.deviceNumber;
         const currentDevice = clamp(currentsubNum + 1, 0, 20);
         await setFieldsValue({
-          subNum: currentDevice,
+          deviceNumber: currentDevice,
         });
         deviceMapping();
       }
       async function handleMinusDevice() {
         const values = getFieldsValue();
-        const currentsubNum = values.subNum;
+        const currentsubNum = values.deviceNumber;
         const currentDevice = clamp(currentsubNum - 1, 0, 20);
         await setFieldsValue({
-          subNum: currentDevice,
+          deviceNumber: currentDevice,
         });
         deviceMapping();
       }

+ 1 - 1
src/views/corporation/verify.vue

@@ -106,7 +106,7 @@
           },
           {
             field: 'userName',
-            label: t('routes.corporation.enterpriseId'),
+            label: t('sys.login.corporationMail'),
             component: 'Input',
             colProps: {
               span: 6,

+ 1 - 1
src/views/setting/BaseSetting.vue

@@ -33,7 +33,6 @@
   // import { CropperAvatar } from '/@/components/Cropper';
 
   import { useMessage } from '/@/hooks/web/useMessage';
-
   // import headerImg from '/@/assets/images/header.jpg';
   // import { accountInfoApi } from '/@/api/account/index';
   import { baseSetschemas } from './data';
@@ -89,6 +88,7 @@
           });
           console.log('res', res);
           createMessage.success(t('common.optSuccess'));
+          userStore.logout(true);
         } catch (error) {}
       }
 

+ 3 - 2
src/views/sys/login/RegisterForm.vue

@@ -18,7 +18,7 @@
           class="fix-auto-fill"
         />
       </FormItem>
-      <FormItem name="sms" class="enter-x">
+      <FormItem name="sms" autocomplete="off" class="enter-x">
         <CountdownInput
           size="large"
           class="fix-auto-fill"
@@ -120,7 +120,8 @@
     if (!form) {
       return Promise.resolve(false);
     }
-    if (formData.managerPhone?.length > 0) {
+    const mail_reg = /\S+@\S+\.\S+/;
+    if (formData.managerPhone?.length > 0 && formData.managerPhone.match(mail_reg)) {
       try {
         await getEmailAuthCodeApi(formData.managerPhone);
         return Promise.resolve(true);