Browse Source

feat(stff): staff

gemercheung 3 years ago
parent
commit
2705c8ed84

+ 10 - 0
src/api/scene/live.ts

@@ -3,6 +3,7 @@ import { PageParams, RentListGetResultModel } from './model';
 
 enum Api {
   pageList = '/basic-api/brand/brandBindList',
+  bindAnchorList = '/basic-api/sys/user/bindList',
 }
 
 /**
@@ -18,3 +19,12 @@ export const ListApi = (params: PageParams) =>
       ignoreCancelToken: true,
     },
   });
+export const bindAnchorListApi = (params: PageParams) =>
+  defHttp.post<RentListGetResultModel>({
+    url: Api.bindAnchorList,
+    params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });

+ 2 - 2
src/api/staff/list.ts

@@ -2,7 +2,7 @@ import { defHttp } from '/@/utils/http/axios';
 import { PageParams, ListGetResultModel } from './model';
 
 enum Api {
-  pageList = '/basic-api/sys/user/staffList',
+  pageList = '/zfb-api/zfb/shop/sys/user/staffList',
 }
 
 /**
@@ -10,7 +10,7 @@ enum Api {
  */
 
 export const ListApi = (params: PageParams) =>
-  defHttp.get<ListGetResultModel>({
+  defHttp.post<ListGetResultModel>({
     url: Api.pageList,
     params,
     headers: {

+ 166 - 0
src/views/scenes/bindModal.vue

@@ -0,0 +1,166 @@
+<template>
+  <BasicModal
+    v-bind="$attrs"
+    @register="register"
+    title="绑定主播"
+    @visible-change="handleVisibleChange"
+    @ok="handleSubmit"
+  >
+    <div class="pt-2px pr-3px">
+      <BasicForm @register="registerForm" :model="model" />
+    </div>
+  </BasicModal>
+</template>
+<script lang="ts">
+  import { defineComponent, ref, nextTick } from 'vue';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
+  // import { useMessage } from '/@/hooks/web/useMessage';
+  // import { checkUserAddAble } from '/@/api/corporation/modal';
+  import { useI18n } from '/@/hooks/web/useI18n';
+  // import { bindAnchorListApi } from '/@/api/scene/live';
+
+  const { t } = useI18n();
+  const schemas: FormSchema[] = [
+    {
+      field: 'own',
+      component: 'Input',
+      label: t('routes.devices.own'),
+      colProps: {
+        span: 24,
+      },
+      componentProps: {
+        options: [
+          {
+            label: '全部',
+            value: '1',
+            key: '1',
+          },
+          {
+            label: '正常',
+            value: '2',
+            key: '2',
+          },
+          {
+            label: '已关闭',
+            value: '2',
+            key: '2',
+          },
+        ],
+      },
+      required: true,
+    },
+    {
+      field: 'cameraType',
+      component: 'Select',
+      label: t('routes.devices.cameraType'),
+      required: true,
+      colProps: {
+        span: 24,
+      },
+    },
+    {
+      field: 'childName',
+      component: 'Input',
+      label: t('routes.devices.childName'),
+      required: true,
+      colProps: {
+        span: 24,
+      },
+    },
+    {
+      field: 'wifiName',
+      component: 'Input',
+      label: t('routes.devices.wifiName'),
+      colProps: {
+        span: 24,
+      },
+    },
+    {
+      field: 'address',
+      component: 'Input',
+      label: t('routes.devices.address'),
+      colProps: {
+        span: 24,
+      },
+    },
+    {
+      field: 'balance',
+      component: 'Input',
+      label: t('routes.devices.balance'),
+      colProps: {
+        span: 24,
+      },
+    },
+    {
+      field: 'orderSn',
+      component: 'Input',
+      label: t('routes.devices.orderSn'),
+      colProps: {
+        span: 24,
+      },
+      required: true,
+    },
+    {
+      field: 'companyId',
+      component: 'Input',
+      label: t('routes.devices.companyId'),
+      colProps: {
+        span: 24,
+      },
+    },
+  ];
+  export default defineComponent({
+    components: { BasicModal, BasicForm },
+    props: {
+      userData: { type: Object },
+    },
+    setup(props) {
+      const modelRef = ref({});
+      // const { createMessage } = useMessage();
+      const [
+        registerForm,
+        {
+          // getFieldsValue,
+          // setFieldsValue,
+          // setProps
+        },
+      ] = useForm({
+        labelWidth: 120,
+        schemas,
+        showActionButtonGroup: false,
+        actionColOptions: {
+          span: 24,
+        },
+      });
+      let addListFunc = () => {};
+      const [register, { closeModal }] = useModalInner((data) => {
+        data && onDataReceive(data);
+      });
+
+      function onDataReceive(data) {
+        console.log('Data Received', data);
+        const { addList } = data;
+        if (typeof addList === 'function') {
+          //是函数    其中 FunName 为函数名称
+          addListFunc = addList;
+        }
+      }
+      const handleSubmit = async () => {};
+      function handleVisibleChange(v) {
+        v && props.userData && nextTick(() => onDataReceive(props.userData));
+      }
+
+      return {
+        register,
+        schemas,
+        registerForm,
+        model: modelRef,
+        handleVisibleChange,
+        handleSubmit,
+        addListFunc,
+        closeModal,
+      };
+    },
+  });
+</script>

+ 0 - 176
src/views/scenes/list copy.vue

@@ -1,176 +0,0 @@
-<template>
-  <div class="p-4">
-    <BasicTable @register="registerTable">
-      <template #toolbar> </template>
-      <template #cover="{ record }">
-        <TableImg :size="150" :simpleShow="true" :imgList="[record.cover]" />
-      </template>
-      <template #action>
-        <TableAction
-          :actions="[
-            {
-              icon: 'clarity:note-edit-line',
-              label: '编辑',
-              onClick: () => {
-                createMessage.info(`暂未接入`);
-              },
-            },
-            {
-              icon: 'ant-design:delete-outlined',
-              color: 'error',
-              label: '删除',
-              popConfirm: {
-                title: '是否确认删除',
-                confirm: () => {
-                  createMessage.info(`暂未接入`);
-                },
-              },
-            },
-          ]"
-        />
-      </template>
-    </BasicTable>
-  </div>
-</template>
-<script lang="ts">
-  import { defineComponent } from 'vue';
-  import {
-    BasicTable,
-    useTable,
-    BasicColumn,
-    FormProps,
-    TableAction,
-    TableImg,
-  } from '/@/components/Table';
-  import { useMessage } from '/@/hooks/web/useMessage';
-  import { uploadApi } from '/@/api/sys/upload';
-  import { Switch } from 'ant-design-vue';
-  import { h } from 'vue';
-  import { ListApi } from '/@/api/scene/list';
-  import { useI18n } from '/@/hooks/web/useI18n';
-
-  export default defineComponent({
-    components: { BasicTable, TableAction, TableImg },
-    setup() {
-      const { createMessage } = useMessage();
-      const { t } = useI18n();
-      const columns: BasicColumn[] = [
-        {
-          title: 'ID',
-          dataIndex: 'id',
-          fixed: 'left',
-          width: 100,
-        },
-        {
-          title: '场景名称',
-          dataIndex: 'name',
-          width: 230,
-        },
-        {
-          title: '封面',
-          dataIndex: 'cover',
-          slots: { customRender: 'cover' },
-          width: 120,
-        },
-        {
-          title: '场景链接',
-          dataIndex: 'link',
-          slots: { customRender: 'link' },
-          width: 180,
-        },
-        {
-          title: '是否显示',
-          dataIndex: 'isShow',
-          width: 180,
-          customRender: ({ record }) => {
-            if (!Reflect.has(record, 'pendingStatus')) {
-              record.pendingStatus = false;
-            }
-            return h(Switch, {
-              checked: record.isShow,
-              checkedChildren: t('common.yes'),
-              unCheckedChildren: t('common.no'),
-              loading: false,
-              onChange(checked: boolean) {
-                record.pendingStatus = true;
-                const newStatus = checked ? '1' : '0';
-                const { createMessage } = useMessage();
-                createMessage.info(`暂未接入` + newStatus);
-                // setRoleStatus(record.id, newStatus)
-                //   .then(() => {
-                //     record.status = newStatus;
-                //     createMessage.success(`已成功修改角色状态`);
-                //   })
-                //   .catch(() => {
-                //     createMessage.error('修改角色状态失败');
-                //   })
-                //   .finally(() => {
-                //     record.pendingStatus = false;
-                //   });
-              },
-            });
-          },
-        },
-
-        {
-          title: '操作',
-          dataIndex: '',
-          slots: { customRender: 'action' },
-          width: 120,
-        },
-      ];
-
-      const searchForm: Partial<FormProps> = {
-        labelWidth: 100,
-        schemas: [
-          {
-            field: 'id',
-            label: 'id',
-            component: 'Input',
-            colProps: {
-              xl: 3,
-              xxl: 3,
-            },
-          },
-          {
-            field: 'userName',
-            label: '企业账号',
-            component: 'Input',
-            colProps: {
-              xl: 12,
-              xxl: 8,
-            },
-          },
-        ],
-      };
-      // { getForm }
-      const [registerTable] = useTable({
-        title: '场景列表',
-        api: ListApi,
-        columns: columns,
-        useSearchForm: false,
-        formConfig: searchForm,
-        showTableSetting: true,
-        tableSetting: { fullScreen: true },
-        showIndexColumn: false,
-        rowKey: 'id',
-        //TODO
-        fetchSetting: {
-          pageField: 'pageNum',
-          sizeField: 'pageSize',
-          listField: 'list',
-          totalField: 'total',
-        },
-        pagination: { pageSize: 20 },
-      });
-
-      // pagination.value = { pageSize: 20 };
-      return {
-        registerTable,
-        createMessage,
-        t,
-        uploadApi: uploadApi as any,
-      };
-    },
-  });
-</script>

+ 23 - 11
src/views/scenes/live.vue

@@ -44,16 +44,16 @@ updateUserId: null -->
       <template #houseType="{ record }">
         {{ renderHouseType(record.houseType) }}
       </template>
-      <template #action>
+      <template #action="{ record }">
         <TableAction
           :actions="[
             {
-              icon: 'clarity:note-edit-line',
-              label: '编辑',
-              onClick: () => {
-                createMessage.info(`暂未接入`);
-              },
+              icon: 'eos-icons:role-binding',
+              label: '绑定主播',
+              color: 'warning',
+              onClick: handleBindAnchor.bind(null, record),
             },
+
             {
               icon: 'ant-design:delete-outlined',
               color: 'error',
@@ -69,6 +69,7 @@ updateUserId: null -->
         />
       </template>
     </BasicTable>
+    <bindModal @register="registerBindModal" />
   </div>
 </template>
 <script lang="ts">
@@ -77,22 +78,26 @@ updateUserId: null -->
     BasicTable,
     useTable,
     BasicColumn,
+    // FormSchema,
     FormProps,
     TableAction,
     TableImg,
   } from '/@/components/Table';
   import { useMessage } from '/@/hooks/web/useMessage';
-  import { uploadApi } from '/@/api/sys/upload';
+  // import { uploadApi } from '/@/api/sys/upload';
   import { Switch } from 'ant-design-vue';
   import { h } from 'vue';
   import { ListApi } from '/@/api/scene/live';
   import { useI18n } from '/@/hooks/web/useI18n';
+  import { useModal } from '/@/components/Modal';
+  import bindModal from './bindModal.vue';
 
   export default defineComponent({
-    components: { BasicTable, TableAction, TableImg },
+    components: { BasicTable, TableAction, TableImg, bindModal },
     setup() {
       const { createMessage } = useMessage();
       const { t } = useI18n();
+      const [registerBindModal, { openModal: openBindModal }] = useModal();
 
       const columns: BasicColumn[] = [
         {
@@ -168,7 +173,8 @@ updateUserId: null -->
           title: '操作',
           dataIndex: '',
           slots: { customRender: 'action' },
-          width: 120,
+          width: 200,
+          fixed: 'right',
         },
       ];
 
@@ -214,7 +220,7 @@ updateUserId: null -->
         title: '直播列表',
         api: ListApi,
         columns: columns,
-        useSearchForm: false,
+        useSearchForm: true,
         formConfig: searchForm,
         showTableSetting: true,
         tableSetting: { fullScreen: true },
@@ -233,12 +239,18 @@ updateUserId: null -->
         },
       });
 
+      function handleBindAnchor(record: Recordable) {
+        console.log('record', record);
+        openBindModal(true, record);
+      }
+
       return {
         registerTable,
         createMessage,
         renderHouseType,
         t,
-        uploadApi: uploadApi as any,
+        registerBindModal,
+        handleBindAnchor,
       };
     },
   });

+ 0 - 6
src/views/staff/list.vue

@@ -133,12 +133,6 @@
         rowKey: 'id',
         pagination: { pageSize: 20 },
         bordered: true,
-        fetchSetting: {
-          pageField: 'pageNum',
-          sizeField: 'pageSize',
-          listField: 'list',
-          totalField: 'totalCount',
-        },
       });
 
       function renderRoleType(type: number): string {