tangning пре 1 година
родитељ
комит
321daded67
2 измењених фајлова са 60 додато и 35 уклоњено
  1. 12 0
      src/api/account/index.ts
  2. 48 35
      src/views/device/index.vue

+ 12 - 0
src/api/account/index.ts

@@ -12,6 +12,7 @@ enum Api {
   getCameraDetail = '/service/manage/user/getCameraDetail',
   unbindCamera = '/service/manage/user/unbindCamera',
   allList = '/service/manage/incrementType/allList',
+  cameraAllType = '/service/manage/cameraType',
   incrementUseTypeList = '/service/manage/incrementUseType/allList',
 }
 
@@ -130,3 +131,14 @@ export const incrementUseTypeList = (params: PageParams) =>
       ignoreCancelToken: true,
     },
   });
+
+//设备类型字典
+export const cameraAllType = (params: PageParams) =>
+  defHttp.get<userList>({
+    url: Api.cameraAllType,
+    params: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });

+ 48 - 35
src/views/device/index.vue

@@ -68,7 +68,7 @@
   import editModal from './editModal.vue';
   import { useModal } from '/@/components/Modal';
   import { useRouter } from 'vue-router';
-  import { UnbindCameraApi } from '/@/api/account';
+  import { UnbindCameraApi, cameraAllType } from '/@/api/account';
   import { usePermissionStore } from '/@/store/modules/permission';
 import { lte } from 'lodash';
   export default defineComponent({
@@ -118,21 +118,21 @@ import { lte } from 'lodash';
         },
         {
           title: '设备类型',
-          dataIndex: 'type',
+          dataIndex: 'typeStr',
           ellipsis: false,
-          width: 80,  
-          customRender: ({ record }) => {
-            let typeObj ={
-              '0':'旧双目相机',
-              '1':'四维看看',
-              '2':'四维看看lite',
-              '3':'四维看看',
-              '9':'四维看见',
-              '10':'四维深时',
-              '11':'四维深光',
-            }
-            return typeObj[record.type]
-          }        
+          width: 80,
+          // customRender: ({ record }) => {
+          //   let typeObj ={
+          //     '0':'旧双目相机',
+          //     '1':'四维看看',
+          //     '2':'四维看看lite',
+          //     '3':'四维看看',
+          //     '9':'四维看见',
+          //     '10':'四维深时',
+          //     '11':'四维深光',
+          //   }
+          //   return typeObj[record.type]
+          // }
         },
 
         {
@@ -261,32 +261,45 @@ import { lte } from 'lodash';
           },
           {
             field: 'outType',
-            component: 'Select',
+            component: 'ApiSelect',
             label: '出库类型',
             colProps: {
               xl: 6,
               xxl: 6,
             },
             componentProps: {
-              options: [
-                {
-                  label: t('routes.product.outType.0'),
-                  value: 0,
-                  key: '0',
-                },{
-                  label: t('routes.product.outType.1'),
-                  value: 1,
-                  key: '1',
-                },{
-                  label: t('routes.product.outType.2'),
-                  value: 2,
-                  key: '2',
-                },{
-                  label: t('routes.product.outType.3'),
-                  value: 3,
-                  key: '3',
-                },
-              ],
+              api: async function () {
+                const res = await cameraAllType();
+                return res.map((ele) => {
+                  return { name: ele.name, value: ele.id };
+                });
+              },
+              // numberToString: true,
+              labelField: 'name',
+              valueField: 'value',
+              immediate: true,
+              params: {
+                agentName: '',
+              },
+              // options: [
+              //   {
+              //     label: t('routes.product.outType.0'),
+              //     value: 0,
+              //     key: '0',
+              //   },{
+              //     label: t('routes.product.outType.1'),
+              //     value: 1,
+              //     key: '1',
+              //   },{
+              //     label: t('routes.product.outType.2'),
+              //     value: 2,
+              //     key: '2',
+              //   },{
+              //     label: t('routes.product.outType.3'),
+              //     value: 3,
+              //     key: '3',
+              //   },
+              // ],
             },
           },
           {