tangning 1 tahun lalu
induk
melakukan
fc0c36d0f5

+ 0 - 1
src/components/Form/src/components/FormItem.vue

@@ -235,7 +235,6 @@
         const isCheck = component && ['Switch', 'Checkbox'].includes(component);
 
         const eventKey = `on${upperFirst(changeEvent)}`;
-        console.log('props',props)
         const on = {
           [eventKey]: (...args: Nullable<Recordable>[]) => {
             const [e] = args;

+ 1 - 0
src/locales/lang/en/code.ts

@@ -22,6 +22,7 @@ export default {
     '4020': 'Multiple login attempts detected, please try again in five minutes!',
     '4021': 'Distributor name already exists',
     '4022': 'The distributor account already exists',
+    '4029': 'There is an error in line {value}',
     '5005': 'Empty scene',
     '5071': 'Duplicated scenes do not support recalculation.',
     '50009': 'Please upgrade the V3 scene before recalculating.',

+ 1 - 0
src/locales/lang/en/common.ts

@@ -21,4 +21,5 @@ export default {
   dark: 'Dark',
   reminder: 'reminder',
   operating: 'Operation',
+  uploadMessge: 'Please select the upload file',
 };

+ 8 - 0
src/locales/lang/en/routes/retailer.ts

@@ -26,5 +26,13 @@ export default {
     tips: 'This account does not exist',
     enable: 'Enable',
     stopUsing: 'Deactivate',
+    d1name: 'Distributor Name',
+  },
+  exportText: 'Successfully imported {value} pieces of data',
+  device: {
+    title: 'Device Bulk Distribution',
+    list: 'Equipment List',
+    dowmTips: 'Download Distributor Device List Template',
+    filename: 'Reseller Device List Template',
   },
 };

+ 1 - 0
src/locales/lang/zh-CN/code.ts

@@ -22,6 +22,7 @@ export default {
     '4020': '频繁登录失败,请五分钟后再次尝试登录!',
     '4021': '分销商名称已存在',
     '4022': '分销商账号已存在',
+    '4029': '第{value}行存在错误。',
     '5005': '场景为空',
     '5071': '复制场景不支持重算',
     '50009': 'V3场景请先升级再重算',

+ 8 - 0
src/locales/lang/zh-CN/routes/retailer.ts

@@ -26,5 +26,13 @@ export default {
     tips: '该账号不存在',
     enable: '启用',
     stopUsing: '停用',
+    dqname: '当前分销商',
+  },
+  exportText: '成功导入{value} 条数据',
+  device: {
+    title: '设备分发',
+    list: '设备清单',
+    dowmTips: '下载分销商设备清单模板',
+    filename: '分销商设备清单模板',
   },
 };

+ 4 - 2
src/utils/http/axios/index.ts

@@ -49,7 +49,6 @@ const transform: AxiosTransform = {
     }
     //  这里 code,result,message为 后台统一的字段,需要在 types.ts内修改为项目自己的接口返回格式
     const { code, result, message } = data;
-
     // 这里逻辑可以根据项目进行修改
     const hasSuccess = data && Reflect.has(data, 'code') && code === ResultEnum.SUCCESS;
     if (hasSuccess) {
@@ -59,6 +58,7 @@ const transform: AxiosTransform = {
     // 在此处根据自己项目的实际情况对不同的code执行不同的操作
     // 如果不希望中断当前请求,请return数据,否则直接抛出异常即可
     let timeoutMsg = '';
+    console.log(code, result, message, data);
     switch (code) {
       case ResultEnum.TIMEOUT:
         timeoutMsg = t('sys.api.timeoutMessage');
@@ -68,7 +68,9 @@ const transform: AxiosTransform = {
         break;
       default:
         if (code) {
-          timeoutMsg = t(`code.apiCode.${code}`);
+          timeoutMsg = data.data
+            ? t(`code.apiCode.${code}`, { value: data.data })
+            : t(`code.apiCode.${code}`);
         } else if (message) {
           timeoutMsg = message;
         }

+ 8 - 7
src/views/device/distributeModal.vue

@@ -2,7 +2,7 @@
   <BasicModal
     v-bind="$attrs"
     @register="register"
-    title="设备入库"
+    :title="t('routes.retailer.device.title')"
     @visible-change="handleVisibleChange"
     @cancel="resetFields"
     @ok="handleSubmit"
@@ -14,7 +14,7 @@
           {{ model[field] }}
         </template>
       </BasicForm>
-      <a v-if="!model.id" @click="getTemplate" style="padding: 20px 0 0 80px">下载分销商设备清单模板</a>
+      <a v-if="!model.id" @click="getTemplate" style="padding: 20px 0 0 80px">{{t('routes.retailer.device.dowmTips')}}</a>
     </div>
   </BasicModal>
 </template>
@@ -57,7 +57,7 @@
         {
           field: 'subAgentId',
           component: 'ApiSelect',
-          label: '分销商名称',
+          label: t('routes.retailer.name'),
           required: true,
           colProps: {
             span: 18,
@@ -78,7 +78,7 @@
         {
           field: 'file',
           component: 'Upload',
-          label: '设备清单',
+          label: t('routes.retailer.device.list'),
           required: true,
           rules: [{ required: true, message: t('common.uploadMessge') }],
           // helpMessage: t('routes.corporation.uploadHelp'),
@@ -134,7 +134,7 @@
         try {
           const res:BlobPart = await downTemplate({ type: 0 });
           console.log('downTemplate',res)
-          downloadByData(res.data,'分销商设备清单模板.xlsx')
+          downloadByData(res.data,t('routes.retailer.device.filename')+'.xlsx')
         } catch (error) {
           console.log('not passing', error);
         }
@@ -148,6 +148,7 @@
           console.log('params', params);
           if (params.id) {
             await giveCamera(params);
+            createMessage.success(t('common.optSuccess'));
           } else {
             const apiData = {
               file: fileFlow.file,
@@ -155,11 +156,11 @@
                 subAgentId: params.subAgentId,
               }
             };
-            await giveCameraBatch(apiData);
+            let num = await giveCameraBatch(apiData);
+            createMessage.success(t('routes.retailer.exportText', { value: num }));
           }
           closeModal();
           resetFields();
-          createMessage.success(t('common.optSuccess'));
           emit('reload');
         } catch (error) {
           console.log('not passing', error);

+ 1 - 1
src/views/device/index.vue

@@ -325,7 +325,7 @@
           totalField: 'total',
         },
         actionColumn: {
-          width: 50,
+          width: 100,
           title: t('common.operating'),
           dataIndex: 'action',
           slots: { customRender: 'action' },

+ 11 - 9
src/views/retailer/EditModal.vue

@@ -9,6 +9,7 @@
     @ok="handleSubmit"
   >
     <div class="pt-2px pr-3px">
+      <div class="name" style="    line-height: 43px;">{{t('routes.retailer.form.dqname')}}:{{ modelRef.name }}</div>
       <BasicForm @register="registerForm">
         <template #text="{ model, field }">
           {{ model[field] }}
@@ -58,15 +59,15 @@
             span: 24,
           },
         },
-        {
-          field: 'name',
-          component: 'Input',
-          label: '当前分销商',
-          slot: 'text',
-          colProps: {
-            span: 24,
-          },
-        },
+        // {
+        //   field: 'name',
+        //   component: 'Input',
+        //   label: t('routes.retailer.form.dqname'),
+        //   slot: 'text',
+        //   colProps: {
+        //     span: 24,
+        //   },
+        // },
         {
           field: 'majorAddNum',
           component: 'InputNumber',
@@ -201,6 +202,7 @@
         addListFunc,
         resetFields,
         t,
+        modelRef,
       };
     },
   });

+ 1 - 1
src/views/retailer/index.vue

@@ -142,7 +142,7 @@
               record.pendingStatus = false;
             }
             return h(Switch, {
-              checked: record.status == '1',
+              checked: record.status == '0',
               checkedChildren: t('routes.retailer.form.enable'),
               unCheckedChildren: t('routes.retailer.form.stopUsing'),
               loading: false,