Bladeren bron

feat(live): modal save

gemercheung 3 jaren geleden
bovenliggende
commit
33fefc7346
3 gewijzigde bestanden met toevoegingen van 106 en 40 verwijderingen
  1. 3 3
      src/api/scene/live.ts
  2. 31 5
      src/api/scene/model.ts
  3. 72 32
      src/views/scenes/bindModal.vue

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

@@ -1,11 +1,11 @@
 import { defHttp } from '/@/utils/http/axios';
-import { PageParams, RentListGetResultModel } from './model';
+import { PageParams, RentListGetResultModel, SceneLiveItem } from './model';
 
 enum Api {
   pageList = '/basic-api/brand/brandBindList',
-  bindAnchorList = '/basic-api/sys/user/bindList',
+  bindAnchorList = '/zfb-api/zfb/shop/sys/user/bindList',
 }
-
+export type SceneLiveItemResult = SceneLiveItem;
 /**
  * @description: Get sample list value
  */

+ 31 - 5
src/api/scene/model.ts

@@ -9,16 +9,42 @@ export interface SceneEditParam {
   userName: string;
 }
 
-export interface DeviceListItem {
+export interface SceneLiveItem {
+  address: string;
+  adminId: number;
+  appListPicUrl: string;
+  bindShowerId: number;
+  bindShowerName: string;
+  bindShowerNameList: string;
+  city: string;
+  contractPhone: string;
+  createTime: number;
+  createUserDeptId: number;
+  createUserId: number;
+  deleted: number;
   id: number;
+  introduceVideo: string;
+  introduceVideoCover: string;
+  latitude: number;
+  liveRoomUrl: string;
+  livestreamStatus: number;
+  longitude: number;
   name: string;
-  image: string;
-  link: string;
-  createTime: string;
-  isShow: boolean;
+  picList: string;
+  sceneName: string;
+  sceneNum: string;
+  sceneUrl: string;
+  shareWxQrCode: string;
+  simpleDesc: string;
+  sortOrder: number;
+  token: string;
+  type: number;
+  updateTime: number;
+  updateUserId: number;
 }
 
 /**
  * @description: Request list return value
  */
 export type RentListGetResultModel = BasicFetchResult<DeviceListItem>;
+export type LiveListGetResultModel = BasicFetchResult<SceneLiveItem>;

+ 72 - 32
src/views/scenes/bindModal.vue

@@ -3,18 +3,28 @@
     v-bind="$attrs"
     @register="register"
     title="绑定主播"
+    width="700px"
     @visible-change="handleVisibleChange"
     @ok="handleSubmit"
   >
     <div class="pt-2px pr-3px">
-      <BasicForm @register="registerForm" :model="model" />
+      <BasicTable
+        @register="registerTable"
+        :searchInfo="searchInfo"
+        :rowSelection="{ type: 'checkbox' }"
+      />
+      <!-- <BasicForm @register="registerForm" :model="model" /> -->
     </div>
+    <template #centerFooter>
+      <!-- <a-button>xxxx</a-button> -->
+    </template>
   </BasicModal>
 </template>
 <script lang="ts">
-  import { defineComponent, ref, nextTick } from 'vue';
+  import { defineComponent, reactive, nextTick } from 'vue';
   import { BasicModal, useModalInner } from '/@/components/Modal';
-  import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
+  // import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
+  import { BasicTable, useTable, BasicColumn } from '/@/components/Table';
   // import { useMessage } from '/@/hooks/web/useMessage';
   // import { checkUserAddAble } from '/@/api/corporation/modal';
   // import { useI18n } from '/@/hooks/web/useI18n';
@@ -35,47 +45,78 @@
         immediate: true,
         params: {
           page: 1,
+          // brandId:
           limit: 1000,
         },
       },
     },
   ];
+  const columns: BasicColumn[] = [
+    {
+      title: 'ID',
+      dataIndex: 'id',
+      fixed: 'left',
+      width: 40,
+    },
+    {
+      title: '员工名称',
+      dataIndex: 'name',
+      width: 100,
+    },
+    {
+      title: '角色',
+      dataIndex: 'roleName',
+      width: 100,
+    },
+
+    {
+      title: '手机号',
+      dataIndex: 'phone',
+      width: 100,
+    },
+    {
+      title: '绑定时间',
+      dataIndex: 'createTime',
+      width: 100,
+    },
+  ];
   export default defineComponent({
-    components: { BasicModal, BasicForm },
+    components: { BasicModal, BasicTable },
     props: {
       userData: { type: Object },
     },
     setup(props) {
-      const modelRef = ref({});
-      // const { createMessage } = useMessage();
-      const [
-        registerForm,
-        {
-          // getFieldsValue,
-          // setFieldsValue,
-          // setProps
-        },
-      ] = useForm({
-        labelWidth: 120,
-        schemas,
-        // api: bindAnchorListApi,
-        showActionButtonGroup: false,
-        actionColOptions: {
-          span: 24,
-        },
-      });
-      let addListFunc = () => {};
       const [register, { closeModal }] = useModalInner((data) => {
         data && onDataReceive(data);
       });
 
+      const searchInfo = reactive<Recordable>({});
+      const [registerTable, { reload }] = useTable({
+        title: '主播列表',
+        api: bindAnchorListApi,
+        columns: columns,
+        useSearchForm: false,
+        // formConfig: searchForm,
+        showTableSetting: false,
+        tableSetting: { fullScreen: true },
+        showIndexColumn: false,
+        immediate: false,
+        rowKey: 'id',
+        pagination: { pageSize: 20 },
+        bordered: true,
+
+        fetchSetting: {
+          pageField: 'pageNum',
+          sizeField: 'pageSize',
+          listField: 'list',
+          totalField: 'totalCount',
+        },
+      });
+
       function onDataReceive(data) {
-        console.log('Data Received', data);
-        const { addList } = data;
-        if (typeof addList === 'function') {
-          //是函数    其中 FunName 为函数名称
-          addListFunc = addList;
-        }
+        console.log('Data Received', data.id);
+        searchInfo.brandId = data.id;
+        reload();
       }
       const handleSubmit = async () => {};
       function handleVisibleChange(v) {
@@ -85,11 +126,10 @@
       return {
         register,
         schemas,
-        registerForm,
-        model: modelRef,
+        registerTable,
         handleVisibleChange,
         handleSubmit,
-        addListFunc,
+        searchInfo,
         closeModal,
       };
     },