Bladeren bron

feat(直播间): 新增

tangning 3 jaren geleden
bovenliggende
commit
b0ce5b089a

+ 10 - 9
src/api/device/list.ts

@@ -5,6 +5,7 @@ enum Api {
   pageList = '/zfb-api/zfb/camera/pageList',
   addCamera = '/zfb-api/zfb/camera/add',
   allCompany = '/zfb-api/zfb/company/listAll',
+  unbindDevice = '/zfb-api/zfb/company/unbindDevice',
 }
 
 /**
@@ -22,15 +23,15 @@ export const ListApi = (params: PageParams) =>
     },
   });
 
-// export const ListApi = (params: PageParams) =>
-//   defHttp.post<RentListGetResultModel>({
-//     url: Api.pageList,
-//     params,
-//     headers: {
-//       // @ts-ignore
-//       ignoreCancelToken: true,
-//     },
-//   });
+export const unDeviceApi = (params: PageParams) =>
+  defHttp.post<RentListGetResultModel>({
+    url: Api.unbindDevice,
+    params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
 export const allCompanyApi = (params: PageParams) =>
   defHttp.post<RentListGetResultModel>({
     url: Api.allCompany,

+ 2 - 3
src/api/scene/live.ts

@@ -105,8 +105,8 @@ export function uploadLiveVideoApi(
   );
 }
 
-export const getAllSceneApi = (params: PageParams) => {
-  defHttp.post<GetAllSceneModel>({
+export const getAllSceneApi = (params: PageParams) =>
+  defHttp.post<RentListGetResultModel>({
     url: Api.getAllScene,
     params,
     headers: {
@@ -114,7 +114,6 @@ export const getAllSceneApi = (params: PageParams) => {
       ignoreCancelToken: true,
     },
   });
-};
 
 export const getLiveInfo = (params: InfoParams) => {
   defHttp.post<SceneLiveModel>({

+ 3 - 0
src/components/Cropper/src/CropperAvatar.vue

@@ -10,6 +10,7 @@
         />
       </div>
       <img :src="sourceValue" v-if="sourceValue" alt="avatar" />
+      <img :src="logo" v-else alt="avatar" />
     </div>
     <a-button
       :class="`${prefixCls}-upload-btn`"
@@ -47,6 +48,7 @@
   import { useI18n } from '/@/hooks/web/useI18n';
   import type { ButtonProps } from '/@/components/Button';
   import Icon from '/@/components/Icon';
+  import logo from '/@/assets/images/header.jpg';
 
   const props = {
     width: { type: [String, Number], default: '200px' },
@@ -113,6 +115,7 @@
         getStyle,
         circled: props.circled,
         handleUploadSuccess,
+        logo,
       };
     },
   });

+ 3 - 2
src/components/Form/src/components/ApiSelect.vue

@@ -73,7 +73,7 @@
 
       const getOptions = computed(() => {
         const { labelField, valueField, numberToString } = props;
-
+        console.log('getOptions', options.value);
         return unref(options).reduce((prev, next: Recordable) => {
           if (next) {
             const value = next[valueField];
@@ -83,6 +83,7 @@
               value: numberToString ? `${value}` : value,
             });
           }
+          console.log('getOptions', prev);
           return prev;
         }, [] as OptionsItem[]);
       });
@@ -116,7 +117,7 @@
           }
           emitChange();
         } catch (error) {
-          console.warn(error);
+          console.warn('error', error);
         } finally {
           loading.value = false;
         }

+ 1 - 0
src/enums/roleEnum.ts

@@ -3,5 +3,6 @@ export enum RoleEnum {
   SUPER = 'super',
 
   // tester
+  PLAT_ADMIN = 'admin',
   TEST = 'test',
 }

+ 26 - 10
src/views/devices/list.vue

@@ -14,17 +14,10 @@
         {{ renderOwnTypeLabel(record.own) }}
       </template>
 
-      <template #action>
+      <template #action="{ record }">
         <TableAction
           :actions="[
             {
-              icon: 'clarity:note-edit-line',
-              label: t('common.operating'),
-              onClick: () => {
-                createMessage.info(`暂未接入`);
-              },
-            },
-            {
               icon: 'ant-design:delete-outlined',
               color: 'error',
               label: t('common.delText'),
@@ -35,6 +28,14 @@
                 },
               },
             },
+            {
+              icon: 'clarity:unlink-line',
+              label: t('common.unbind'),
+              popConfirm: {
+                title: t('routes.corporation.isUnBind'),
+                confirm: handleUnbindDevice.bind(null, record),
+              },
+            },
           ]"
         />
       </template>
@@ -48,9 +49,10 @@
   import { useMessage } from '/@/hooks/web/useMessage';
   import { Tag } from 'ant-design-vue';
   import { useModal } from '/@/components/Modal';
-  import { ListApi } from '/@/api/device/list';
+  import { ListApi, unDeviceApi } from '/@/api/device/list';
   import AddModal from './AddModal.vue';
   import { useI18n } from '/@/hooks/web/useI18n';
+  import { RoleEnum } from '/@/enums/roleEnum';
 
   // param type 0
   export default defineComponent({
@@ -103,6 +105,13 @@
           slots: { customRender: 'own' },
           width: 120,
         },
+        {
+          title: t('common.operating'),
+          dataIndex: 'action',
+          slots: { customRender: 'action' },
+          auth: [RoleEnum.SUPER, RoleEnum.PLAT_ADMIN],
+          width: 140,
+        },
       ];
 
       const searchForm: Partial<FormProps> = {
@@ -173,7 +182,13 @@
           return searchData;
         },
       });
-      // pagination.value = { pageSize: 20 };
+      async function handleUnbindDevice(record: Recordable) {
+        await unDeviceApi({
+          childName: record.childName,
+        });
+        createMessage.success(t('common.optSuccess'));
+        reload();
+      }
       function rendercameraTypeLabel(cameraType: number): string {
         switch (cameraType) {
           case 4:
@@ -212,6 +227,7 @@
         renderOwnTypeLabel,
         registerAddModal,
         openAddModal,
+        handleUnbindDevice,
         t,
         reload,
       };

+ 10 - 4
src/views/scenes/liveDrawer.vue

@@ -141,6 +141,9 @@
           },
           componentProps: {
             api: uploadLiveApi,
+            onChange: async () => {
+              await validateFields(['appListPicUrl']);
+            },
             maxgoodsNumber: 1,
             afterFetch: function (data) {
               Reflect.set(data, 'url', data.message.url);
@@ -160,11 +163,11 @@
             api: getAllSceneApi,
             immediate: true,
             resultField: 'list',
-            labelField: 'id',
-            valueField: 'id',
+            labelField: 'sceneName',
+            valueField: 'webSite',
             params: {
               page: 1,
-              limit: 10,
+              limit: 100,
             },
           },
         },
@@ -262,7 +265,10 @@
         },
       ];
       // updateSchema, validate
-      const [registerForm, { resetFields, setFieldsValue, updateSchema, validate }] = useForm({
+      const [
+        registerForm,
+        { resetFields, setFieldsValue, updateSchema, validate, validateFields },
+      ] = useForm({
         labelWidth: 120,
         schemas: schemas,
         showActionButtonGroup: false,