Sfoglia il codice sorgente

feat:客户设备,客户场景

jinx 3 anni fa
parent
commit
a69d2854f9

+ 12 - 1
src/api/customer/index.ts

@@ -1,11 +1,12 @@
 import { defHttp } from '/@/utils/http/axios';
-import { PageParams, deleteParams, addParams } from './model';
+import { PageParams, deleteParams, addParams, cameraListParams } from './model';
 import { Result } from '/#/axios';
 
 enum Api {
   companyList = '/newV4/service/manage/company/list',
   companyAdd = '/newV4/service/manage/company/add',
   companyDelete = '/newV4/service/manage/company/delete',
+  cameraList = '/newV4/service/manage/camera/list',
 }
 
 export const companyList = (params: PageParams) =>
@@ -38,3 +39,13 @@ export const companyDelete = (params: deleteParams) =>
       ignoreCancelToken: true,
     },
   });
+export const cameraList = (params: cameraListParams) =>
+  defHttp.post<Result>({
+    url: Api.cameraList,
+    params: params,
+    // data: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });

+ 12 - 0
src/api/customer/model.ts

@@ -15,3 +15,15 @@ export interface addParams {
   qrLogo: string;
   showLogo: string;
 }
+export interface cameraListParams {
+  snCode: string;
+  companyName: string;
+  userName: string;
+  outType?: number;
+  type: string;
+  activatedStartTime: string;
+  activatedEndTime: string;
+  pageNum?: number;
+  pageSize?: number;
+  companyId?: number;
+}

+ 1 - 0
src/api/operate/model.ts

@@ -4,6 +4,7 @@ import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
  */
 export type PageParams = BasicPageParams;
 export interface operateList {
+  companyId?: number;
   sceneName: string;
   snCode: string;
   userName: string;

+ 2 - 2
src/router/routes/modules/customer.ts

@@ -24,7 +24,7 @@ export const customer: AppRouteRecordRaw = {
       },
     },
     {
-      path: 'device',
+      path: 'device/:id',
       name: 'Device',
       component: () => import('/@/views/customer/device.vue'),
 
@@ -36,7 +36,7 @@ export const customer: AppRouteRecordRaw = {
       },
     },
     {
-      path: 'scene',
+      path: 'scene/:id',
       name: 'Scene',
       component: () => import('/@/views/customer/scene.vue'),
       meta: {

+ 94 - 110
src/views/customer/device.vue

@@ -1,22 +1,18 @@
 <template>
   <BasicTable @register="registerTable">
     <template #toolbar>
-      <!-- <a-button type="primary" @click="exportExcel"> 导出1</a-button> -->
+      <a-button type="primary" @click="deviceLink"> 设备关联</a-button>
+      <a-button type="primary" @click="back">返回</a-button>
     </template>
     <template #action="{ record }">
       <TableAction
         stopButtonPropagation
         :actions="[
           {
-            label: '同屏',
-            icon: 'akar-icons:double-check',
-          },
-          {
-            label: '删除',
-            icon: 'ic:outline-delete-outline',
+            label: '解绑',
             color: 'error',
             popConfirm: {
-              title: '是否删除?',
+              title: '是否解绑?',
               confirm: handleDelete.bind(null, record),
               placement: 'topLeft',
             },
@@ -27,7 +23,7 @@
   </BasicTable>
 </template>
 <script lang="ts">
-  import { defineComponent, h, reactive, toRefs } from 'vue';
+  import { defineComponent, h, reactive, toRefs, onMounted } from 'vue';
   import {
     BasicTable,
     useTable,
@@ -41,16 +37,10 @@
   import { Descriptions } from 'ant-design-vue';
   import { useI18n } from '/@/hooks/web/useI18n';
   import { useMessage } from '/@/hooks/web/useMessage';
-  import { Switch } from 'ant-design-vue';
-  import {
-    operateSceneList,
-    sceneMove,
-    sceneDelete,
-    sceneReset,
-    sceneDownload,
-    sceneCopy,
-  } from '/@/api/operate';
+  import { cameraList } from '/@/api/customer';
   import { message } from 'ant-design-vue';
+
+  import { useRouter } from 'vue-router';
   export default defineComponent({
     components: {
       BasicTable,
@@ -63,73 +53,48 @@
     setup() {
       const { t } = useI18n();
       const { createMessage, createConfirm } = useMessage();
-
+      const router = useRouter();
+      const companyId: Number = router.currentRoute.value.params.id - 0;
+      onMounted(() => {
+        // console.log(router.currentRoute.value.params.id);
+      });
       const columns: BasicColumn[] = [
         {
-          title: '场景标题',
-          dataIndex: 'sceneName',
+          title: 'sn码',
+          dataIndex: 'snCode',
+          width: 180,
+        },
+        {
+          title: 'wifi名称',
+          dataIndex: 'wifiName',
           width: 150,
         },
         {
-          title: '场景码',
-          dataIndex: 'num',
+          title: '设备类型',
+          dataIndex: 'type',
           ellipsis: false,
           width: 80,
         },
 
         {
-          title: 'sn码',
-          dataIndex: 'snCode',
+          title: '激活时间',
+          dataIndex: 'activatedTime',
           width: 180,
         },
         {
-          title: '方案标题',
-          dataIndex: 'sceneSize',
+          title: '出库类型',
+          dataIndex: 'outType',
           width: 80,
         },
         {
-          title: '发布状态',
-          dataIndex: 'sceneSize',
+          title: '客户名称',
+          dataIndex: 'companyName',
           width: 80,
         },
         {
-          title: '是否精品',
-          dataIndex: 'isCopy',
-          width: 80,
-          customRender: ({ record }) => {
-            return record.isCopy ? '是' : '否';
-          },
-        },
-        {
-          title: '创建时间',
-          dataIndex: 'copyTime',
-          width: 180,
-          customRender: ({ record }) => {
-            return record.copyTime
-              ? h(Time, {
-                  value: record.copyTime,
-                  mode: 'datetime',
-                })
-              : '-';
-          },
-        },
-        {
-          title: '最新编辑时间',
-          dataIndex: 'copyTime',
-          width: 180,
-          customRender: ({ record }) => {
-            return record.copyTime
-              ? h(Time, {
-                  value: record.copyTime,
-                  mode: 'datetime',
-                })
-              : '-';
-          },
-        },
-        {
-          title: '用户账号',
+          title: '绑定账号',
           dataIndex: 'userName',
-          width: 100,
+          width: 180,
         },
 
         {
@@ -138,28 +103,63 @@
           slots: { customRender: 'action' },
           ifShow: true,
           fixed: 'right',
-          width: 110,
+          flag: 'ACTION',
+          width: 60,
         },
       ];
       const searchForm: Partial<FormProps> = {
         labelWidth: 100,
         schemas: [
           {
-            field: 'sceneName',
-            label: '场景标题',
+            field: 'snCode',
+            label: 'SN码',
             component: 'Input',
             componentProps: {
               maxLength: 100,
             },
             colProps: {
-              xl: 7,
-              xxl: 7,
+              xl: 4,
+              xxl: 4,
             },
           },
           {
-            field: 'snCode',
-            label: '方案名称',
-            component: 'Input',
+            field: 'type',
+            label: '设备类型',
+            component: 'Select',
+            componentProps: {
+              maxLength: 100,
+              options: [
+                {
+                  label: '旧双目相机',
+                  value: '0',
+                },
+                {
+                  label: '四维看看',
+                  value: '1',
+                },
+                {
+                  label: '四维看看lite',
+                  value: '2',
+                },
+                {
+                  label: '四维看见',
+                  value: '9',
+                },
+                {
+                  label: '四维深时',
+                  value: '10',
+                },
+              ],
+            },
+            colProps: {
+              xl: 4,
+              xxl: 4,
+            },
+          },
+          {
+            field: 'activatedTime',
+            label: '激活时间',
+            component: 'RangePicker',
             componentProps: {
               maxLength: 100,
             },
@@ -170,28 +170,28 @@
           },
           {
             field: 'userName',
-            label: '用户账号',
+            label: '绑定账号',
             component: 'Input',
             componentProps: {
               maxLength: 100,
             },
             colProps: {
-              xl: 6,
-              xxl: 6,
+              xl: 4,
+              xxl: 4,
             },
           },
         ],
       };
       const [registerTable, { reload }] = useTable({
-        api: operateSceneList,
-        title: '四维深时场景列表',
+        api: cameraList,
+        // title: '四维深时场景列表',
         // titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
         columns: columns,
-        searchInfo: { type: 1 },
+        searchInfo: { companyId },
         useSearchForm: true,
         formConfig: searchForm,
         showTableSetting: true,
-        rowKey: 'num',
+        rowKey: 'id',
         fetchSetting: {
           pageField: 'pageNum',
           sizeField: 'pageSize',
@@ -217,41 +217,25 @@
             });
           });
       }
-      async function handleMove(record: Recordable) {
-        sceneMove({ snCode: record.snCode, num: record.num })
-          .then(() => {
-            message.success({
-              content: '迁移成功',
-            });
-          })
-          .catch(() => {
-            message.success({
-              content: '迁移失败',
-            });
-          });
-      }
-      function handleDownload(record: Recordable) {
-        console.log('handleDownload', record);
+
+      function deviceLink() {
+        createConfirm({
+          iconType: 'warning',
+          title: () => h('span', '温馨提示'),
+          content: () => h('span', '确定当前标签下的订单记录?'),
+          onOk: async () => {
+            // await DownExport();
+          },
+        });
       }
-      function handleReset(record: Recordable) {
-        console.log('handleReset', record);
+      function back() {
+        router.push('/customer/index');
       }
-      // function exportExcel() {
-      //   createConfirm({
-      //     iconType: 'warning',
-      //     title: () => h('span', '温馨提示'),
-      //     content: () => h('span', '确定当前标签下的订单记录?'),
-      //     onOk: async () => {
-      //       // await DownExport();
-      //     },
-      //   });
-      // }
       return {
         registerTable,
         handleDelete,
-        handleMove,
-        handleDownload,
-        handleReset,
+        deviceLink,
+        back,
       };
     },
   });

+ 10 - 3
src/views/customer/index.vue

@@ -21,10 +21,11 @@
             :actions="[
               {
                 label: '设备',
-                onClick: handleRouter.bind(null, 'device'),
+                onClick: handleRouter.bind(null, { type: 'device', id: record.id }),
               },
               {
                 label: '场景',
+                onClick: handleRouter.bind(null, { type: 'scene', id: record.id }),
               },
               {
                 label: '编辑',
@@ -148,6 +149,7 @@
           dataIndex: 'action',
           slots: { customRender: 'action' },
           ifShow: true,
+          flag: 'ACTION',
           fixed: 'right',
           width: 200,
         },
@@ -187,8 +189,12 @@
         },
         canResize: false,
       });
-      function handleRouter() {
-        router.push('/customer/device');
+      function handleRouter(options) {
+        if (options.type == 'device') {
+          router.push('/customer/device/' + options.id);
+        } else {
+          router.push('/customer/scene/' + options.id);
+        }
       }
       function handleEdit(record) {
         openInfoModal(true, {
@@ -230,6 +236,7 @@
         handleEdit,
         handleDownload,
         handleReset,
+        reload,
       };
     },
   });

+ 77 - 0
src/views/customer/modal/DownLoadModal.vue

@@ -0,0 +1,77 @@
+<template>
+  <BasicModal
+    v-bind="$attrs"
+    @register="register"
+    title="场景下载"
+    :minHeight="0"
+    @visible-change="handleVisibleChange"
+    @cancel="hundleCancel"
+    @ok="handleSubmit"
+  >
+    <div class="pt-2px pr-3px">
+      <div class="warp">
+        <p>正在打包场景离线数据{{ downloadPercent }}</p>
+        <span>{{ modelRef.sceneName }}.zip</span>
+        <Progress :percent="downloadOption.percent" />
+      </div>
+    </div>
+  </BasicModal>
+</template>
+<script lang="ts">
+  import { defineComponent, ref, nextTick, onMounted, reactive } from 'vue';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { useI18n } from '/@/hooks/web/useI18n';
+  import { Progress } from 'ant-design-vue';
+  const { t } = useI18n();
+
+  export default defineComponent({
+    components: { BasicModal, Progress },
+    props: {
+      userData: { type: Object },
+      downloadOption: { type: Object },
+    },
+    emits: ['update', 'register', 'cancelDownload'],
+    setup(props, { emit }) {
+      const modelRef = ref({});
+
+      const { createMessage } = useMessage();
+
+      onMounted(() => {});
+      let addListFunc = () => {};
+      const [register, { closeModal }] = useModalInner((data) => {
+        // data && onDataReceive(data);
+        modelRef.value = data;
+      });
+
+      const handleSubmit = async () => {
+        console.log(props.downloadOption);
+        if (props.downloadOption.url) {
+          window.open(props.downloadOption.url);
+        }
+      };
+      const hundleCancel = async () => {
+        emit('cancelDownload');
+      };
+
+      return {
+        register,
+        modelRef,
+        handleSubmit,
+        hundleCancel,
+        addListFunc,
+        t,
+      };
+    },
+  });
+</script>
+<style lang="less" scoped>
+  .pt-2px {
+  }
+  .warp {
+    display: flex;
+    align-items: flex-start;
+    justify-content: flex-start;
+    flex-flow: column;
+  }
+</style>

+ 146 - 0
src/views/customer/modal/MoveModal.vue

@@ -0,0 +1,146 @@
+<template>
+  <BasicModal
+    v-bind="$attrs"
+    @register="register"
+    title="新增相机"
+    @visible-change="handleVisibleChange"
+    @cancel="resetFields"
+    @ok="handleSubmit"
+    :min-height="0"
+  >
+    <div class="pt-2px pr-3px">
+      <BasicForm @register="registerForm" :model="model">
+        <template #text="{ model, field }">
+          {{ model[field] }}
+        </template>
+      </BasicForm>
+    </div>
+  </BasicModal>
+</template>
+<script lang="ts">
+  import { defineComponent, ref, nextTick, onMounted, reactive } from 'vue';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { sceneMove } from '/@/api/operate';
+  import { useI18n } from '/@/hooks/web/useI18n';
+
+  const { t } = useI18n();
+  export default defineComponent({
+    components: { BasicModal, BasicForm },
+    props: {
+      userData: { type: Object },
+    },
+    emits: ['update', 'register'],
+    setup(props, { emit }) {
+      const modelRef = ref({});
+      const fileFlow = reactive({
+        file: null,
+      });
+      const { createMessage } = useMessage();
+      const schemas: FormSchema[] = [
+        {
+          field: 'type',
+          component: 'Input',
+          // defaultValue: '场景标题',
+          label: '场景标题',
+          slot: 'text',
+          colProps: {
+            span: 24,
+          },
+          // required: true,
+        },
+        {
+          field: 'snCode',
+          component: 'Input',
+          label: '迁移至',
+
+          required: true,
+          colProps: {
+            span: 24,
+          },
+          rules: [
+            {
+              required: true,
+              // @ts-ignore
+              validator: async (rule, value) => {
+                if (!value) {
+                  return Promise.reject('请输入相机sn码');
+                }
+                if (/.*[\u4e00-\u9fa5]+.*$/.test(value)) {
+                  /* eslint-disable-next-line */
+                  return Promise.reject('不支持中文字符');
+                }
+                return Promise.resolve();
+              },
+              trigger: 'change',
+            },
+          ],
+          componentProps: {
+            placeholder: '请输入相机sn码',
+            maxLength: 15,
+            onChange: (data) => {
+              console.log('data', data);
+            },
+          },
+        },
+      ];
+      const [registerForm, { validate, resetFields, setFieldsValue }] = useForm({
+        labelWidth: 120,
+        schemas,
+        showActionButtonGroup: false,
+        actionColOptions: {
+          span: 24,
+        },
+      });
+      onMounted(() => {});
+      let addListFunc = () => {};
+      const [register, { closeModal }] = useModalInner((data) => {
+        console.log(data);
+        data && onDataReceive(data);
+      });
+
+      function onDataReceive(data) {
+        modelRef.value = data;
+        resetFields();
+        setFieldsValue({
+          type: data.sceneName,
+        });
+      }
+      const handleSubmit = async () => {
+        try {
+          const params = await validate();
+          const apiData = {
+            snCode: params.snCode,
+            num: modelRef.value.num,
+          };
+          console.log('res', apiData, params);
+          const res = await sceneMove(apiData);
+          console.log('res', res);
+          closeModal();
+          resetFields();
+          createMessage.success('场景迁移成功。');
+          emit('update');
+        } catch (error) {
+          console.log('not passing', error);
+        }
+      };
+      function handleVisibleChange(v) {
+        // console.log(v);
+        // v && props.userData && nextTick(() => onDataReceive(props.userData));
+      }
+      return {
+        register,
+        schemas,
+        registerForm,
+        model: modelRef,
+        fileFlow,
+        handleVisibleChange,
+        handleSubmit,
+        addListFunc,
+        resetFields,
+        t,
+      };
+    },
+  });
+</script>

+ 305 - 82
src/views/customer/scene.vue

@@ -1,33 +1,88 @@
 <template>
-  <BasicTable @register="registerTable">
-    <template #toolbar>
-      <!-- <a-button type="primary" @click="exportExcel"> 导出1</a-button> -->
-    </template>
-    <template #action="{ record }">
-      <TableAction
-        stopButtonPropagation
-        :actions="[
-          {
-            label: '同屏',
-            icon: 'akar-icons:double-check',
-          },
-          {
-            label: '删除',
-            icon: 'ic:outline-delete-outline',
-            color: 'error',
-            popConfirm: {
-              title: '是否删除?',
-              confirm: handleDelete.bind(null, record),
-              placement: 'topLeft',
-            },
-          },
-        ]"
-      />
-    </template>
-  </BasicTable>
+  <PageWrapper contentBackground>
+    <!-- <template #footer>
+      <a-tabs v-model:activeKey="tableType" @change="changeTable">
+        <a-tab-pane :key="0" tab="四维看看" />
+        <a-tab-pane :key="1" tab="四维看见" />
+        <a-tab-pane :key="2" tab="四维双目深时" />
+        <a-tab-pane :key="3" tab="四维双目Lite" /> </a-tabs
+    ></template> -->
+    <div class="desc-wrap-BasicTable">
+      <BasicTable @register="registerTable">
+        <template #toolbar>
+          <a-button type="primary" @click="back">返回</a-button>
+        </template>
+
+        <template #action="{ record }">
+          <TableAction
+            stopButtonPropagation
+            :actions="[
+              {
+                label: '迁移',
+                //icon: 'bx:move-horizontal',
+
+                onClick: handleMove.bind(null, record),
+              },
+              {
+                label: '下载',
+                disabled:
+                  (record.payStatus - 0 != 1 && record.status - 0 == 0) ||
+                  (record.payStatus - 0 != 1 && record.status - 0 == -1),
+                //icon: 'carbon:download',
+                onClick: handleDownload.bind(null, record),
+              },
+              {
+                label: '重算',
+                disabled: record.payStatus != 1 && record.status - 0 == 0,
+                //icon: 'bx:reset',
+                popConfirm: {
+                  title: '是否重算?',
+                  confirm: handleReset.bind(null, record),
+                },
+              },
+              {
+                label: '复制',
+                disabled:
+                  (record.payStatus != 1 && record.status - 0 == 0) ||
+                  (record.payStatus != 1 && record.status - 0 == -1),
+                //icon: 'akar-icons:copy',
+                //onClick: handleCopy.bind(null, record),
+                popConfirm: {
+                  title: '是否复制?',
+                  confirm: handleCopy.bind(null, record),
+                },
+              },
+              {
+                label: '删除',
+                //icon: 'ic:outline-delete-outline',
+                color: 'error',
+                //onClick: handleDelete.bind(null, record),
+                popConfirm: {
+                  title: '是否删除?',
+                  confirm: handleDelete.bind(null, record),
+                  placement: 'topRight',
+                },
+              },
+            ]"
+          />
+        </template>
+      </BasicTable>
+    </div>
+    <DownLoadModal
+      :downloadOption="downloadOption"
+      @cancel="afterClose"
+      @register="registerDownModal"
+      @update="reload"
+      cancelText="取消下载"
+      okText="下载"
+      @cancelDownload="cancelDownload"
+      :okButtonProps="{ disabled: canDownload }"
+    />
+    <MoveModal @register="registerMoveModal" />
+  </PageWrapper>
 </template>
 <script lang="ts">
-  import { defineComponent, h, reactive, toRefs } from 'vue';
+  import { defineComponent, h, reactive, toRefs, ref } from 'vue';
   import {
     BasicTable,
     useTable,
@@ -37,33 +92,47 @@
     FormProps,
   } from '/@/components/Table';
   import { PageWrapper } from '/@/components/Page';
+  import DownLoadModal from './modal/DownLoadModal.vue';
+  import MoveModal from './modal/MoveModal.vue';
   import { Time } from '/@/components/Time';
-  import { Descriptions } from 'ant-design-vue';
+  import { Descriptions, Tabs, Progress } from 'ant-design-vue';
   import { useI18n } from '/@/hooks/web/useI18n';
   import { useMessage } from '/@/hooks/web/useMessage';
-  import { Switch } from 'ant-design-vue';
+  import { useModal } from '/@/components/Modal';
+  import { useRouter } from 'vue-router';
   import {
     operateSceneList,
     sceneMove,
     sceneDelete,
     sceneReset,
     sceneDownload,
+    checkDownLoad,
+    downloadProcess,
     sceneCopy,
+    rebuildScene,
   } from '/@/api/operate';
   import { message } from 'ant-design-vue';
+  import { func } from 'vue-types';
   export default defineComponent({
     components: {
+      DownLoadModal,
+      MoveModal,
       BasicTable,
       TableAction,
       PageWrapper,
-      TableImg,
       [Descriptions.name]: Descriptions,
       [Descriptions.Item.name]: Descriptions.Item,
+
+      [Tabs.name]: Tabs,
+      [Tabs.TabPane.name]: Tabs.TabPane,
     },
     setup() {
       const { t } = useI18n();
+      const router = useRouter();
+      const companyId: Number = router.currentRoute.value.params.id - 0;
       const { createMessage, createConfirm } = useMessage();
-
+      const tableType = ref<Recordable>(0); //0看看 、1看见、2深时
+      const tabList = ref<Array>(['四维看看', '四维看见', '四维双目深时', '四维双目Lite']);
       const columns: BasicColumn[] = [
         {
           title: '场景标题',
@@ -76,45 +145,61 @@
           ellipsis: false,
           width: 80,
         },
-
         {
-          title: 'sn码',
-          dataIndex: 'snCode',
+          title: '拍摄时间',
+          dataIndex: 'createTime',
           width: 180,
+          customRender: ({ record }) => {
+            return (
+              record.createTime &&
+              h(Time, {
+                value: record.createTime,
+                mode: 'datetime',
+              })
+            );
+          },
         },
         {
-          title: '方案标题',
-          dataIndex: 'sceneSize',
-          width: 80,
+          title: '计算完成时间',
+          dataIndex: 'amount',
+          width: 180,
+          customRender: ({ record }) => {
+            return (
+              record.createTime &&
+              h(Time, {
+                value: record.createTime,
+                mode: 'datetime',
+              })
+            );
+          },
         },
         {
-          title: '发布状态',
-          dataIndex: 'sceneSize',
-          width: 80,
+          title: 'sn码',
+          dataIndex: 'snCode',
+          width: 180,
         },
         {
-          title: '是否精品',
-          dataIndex: 'isCopy',
+          title: '场景大小',
+          dataIndex: 'sceneSize',
           width: 80,
           customRender: ({ record }) => {
-            return record.isCopy ? '是' : '否';
+            return h(
+              'span',
+              { class: 'sceneSize' },
+              Math.ceil(record.sceneSize / 1024 / 1024) + 'M',
+            );
           },
         },
         {
-          title: '创建时间',
-          dataIndex: 'copyTime',
-          width: 180,
+          title: '是否复制',
+          dataIndex: 'isCopy',
+          width: 80,
           customRender: ({ record }) => {
-            return record.copyTime
-              ? h(Time, {
-                  value: record.copyTime,
-                  mode: 'datetime',
-                })
-              : '-';
+            return record.isCopy ? '是' : '否';
           },
         },
         {
-          title: '最新编辑时间',
+          title: '复制时间',
           dataIndex: 'copyTime',
           width: 180,
           customRender: ({ record }) => {
@@ -127,18 +212,46 @@
           },
         },
         {
-          title: '用户账号',
+          title: '绑定账号',
           dataIndex: 'userName',
           width: 100,
         },
-
+        {
+          title: '浏览量',
+          dataIndex: 'viewCount',
+          width: 80,
+        },
+        {
+          title: '状态',
+          dataIndex: 'statusString',
+          width: 80,
+          customRender: ({ record }) => {
+            let str;
+            switch (record.status - 0) {
+              case 0:
+                str = '计算中';
+                break;
+              case 1:
+                str = '计算成功';
+                break;
+              case -2:
+                str = '计算成功';
+                break;
+              case -1:
+                str = '计算失败';
+                break;
+            }
+            return record.payStatus == 1 ? '封存' : str;
+          },
+        },
         {
           title: '操作',
           dataIndex: 'action',
           slots: { customRender: 'action' },
           ifShow: true,
           fixed: 'right',
-          width: 110,
+          flag: 'ACTION',
+          width: 250,
         },
       ];
       const searchForm: Partial<FormProps> = {
@@ -158,7 +271,7 @@
           },
           {
             field: 'snCode',
-            label: '方案名称',
+            label: 'sn码',
             component: 'Input',
             componentProps: {
               maxLength: 100,
@@ -170,7 +283,7 @@
           },
           {
             field: 'userName',
-            label: '用户账号',
+            label: '绑定账号',
             component: 'Input',
             componentProps: {
               maxLength: 100,
@@ -182,12 +295,17 @@
           },
         ],
       };
+      function cancelDownload() {
+        downloadOption.value = {};
+      }
+      const [registerDownModal, { openModal: openDownModal }] = useModal();
+      const [registerMoveModal, { openModal: openMoveModal }] = useModal();
       const [registerTable, { reload }] = useTable({
         api: operateSceneList,
-        title: '四维深时场景列表',
+        // title: `场景列表`,
         // titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
         columns: columns,
-        searchInfo: { type: 1 },
+        searchInfo: { companyId },
         useSearchForm: true,
         formConfig: searchForm,
         showTableSetting: true,
@@ -200,9 +318,35 @@
         },
         canResize: false,
       });
+      function changeTable(val: string) {
+        tableType.value = val;
+        reload();
+      }
+      async function handleCopy(record: Recordable) {
+        createConfirm({
+          title: '复制场景',
+          content: '复制场景,场景归属在原相机下。<br/>确定要复制场景吗?',
+          onOk: async () => {
+            sceneCopy({ num: record.num })
+              .then(() => {
+                message.success({
+                  content: '删除成功',
+                });
+              })
+              .catch(() => {
+                message.success({
+                  content: '删除失败',
+                });
+              });
+          },
+        });
+      }
       async function handleDelete(record: Recordable) {
         console.log('handleDelete', record);
-
+        // createConfirm({
+        //   title: '删除',
+        //   content: '确定要删除场景吗?',
+        //   onOk: async () => {
         sceneDelete({ num: record.num })
           .then(() => {
             message.success({
@@ -216,43 +360,122 @@
               content: '删除失败',
             });
           });
+        //   },
+        // });
       }
       async function handleMove(record: Recordable) {
-        sceneMove({ snCode: record.snCode, num: record.num })
-          .then(() => {
-            message.success({
-              content: '迁移成功',
-            });
-          })
-          .catch(() => {
-            message.success({
-              content: '迁移失败',
-            });
-          });
+        openMoveModal(true, {
+          ...record,
+        });
+        // sceneMove({ snCode: record.snCode, num: record.num })
+        //   .then(() => {
+        //     message.success({
+        //       content: '迁移成功',
+        //     });
+        //   })
+        //   .catch(() => {
+        //     message.success({
+        //       content: '迁移失败',
+        //     });
+        //   });
       }
+      let timer: null = ref(null);
+      const downloadOption = ref<Object>({});
+      const canDownload = ref<boolean>(true);
       function handleDownload(record: Recordable) {
         console.log('handleDownload', record);
+
+        checkDownLoad({ num: record.num }).then((res) => {
+          console.log(res);
+          if (res.downloadStatus == 0) {
+            // 未下载过,需要打包
+            sceneDownload({ num: record.num }).then((res) => {
+              console.log(res);
+              openDownModal(true, {
+                ...record,
+              });
+              if (res.downloadStatus == 1) {
+                if (timer.value) {
+                  afterClose();
+                }
+                timer.value = setInterval(() => {
+                  downloadProcess({ num: record.num }).then((res) => {
+                    if (res.percent >= 100) {
+                      canDownload.value = false;
+                      afterClose();
+                    }
+                    downloadOption.value = res;
+                    console.log(res);
+                  });
+                }, 1000);
+              }
+            });
+          } else {
+          }
+        });
+      }
+      function afterClose() {
+        clearInterval(timer.value);
+        timer.value = null;
       }
       function handleReset(record: Recordable) {
         console.log('handleReset', record);
+        rebuildScene({ num: record.num })
+          .then(() => {
+            message.success({
+              content: '操作成功',
+            });
+            reload();
+          })
+          .catch(() => {});
+      }
+      function back() {
+        router.push('/customer/index');
       }
-      // function exportExcel() {
-      //   createConfirm({
-      //     iconType: 'warning',
-      //     title: () => h('span', '温馨提示'),
-      //     content: () => h('span', '确定当前标签下的订单记录?'),
-      //     onOk: async () => {
-      //       // await DownExport();
-      //     },
-      //   });
-      // }
       return {
         registerTable,
         handleDelete,
+        handleCopy,
         handleMove,
         handleDownload,
         handleReset,
+        tableType,
+        changeTable,
+        t,
+        openDownModal,
+        registerDownModal,
+        registerMoveModal,
+        afterClose,
+        timer,
+        canDownload,
+        downloadOption,
+        cancelDownload,
+        back,
       };
     },
   });
 </script>
+<style lang="less" scoped>
+  // .tableHeader {
+  //   height: 50px;
+  //   display: flex;
+  //   align-items: center;
+
+  //   .item {
+  //     font-size: 14px;
+  //     color: #666;
+  //     margin-right: 10px;
+  //     cursor: pointer;
+  //     &.active {
+  //       font-weight: bold;
+  //       color: #222;
+  //     }
+  //   }
+  // }
+  .desc-wrap-BasicTable {
+    background-color: #f0f2f5;
+    .vben-basic-table-form-container {
+      padding: 0;
+    }
+  }
+</style>

+ 7 - 6
src/views/productOperation/cameraScene.vue

@@ -19,7 +19,7 @@
             :actions="[
               {
                 label: '迁移',
-                icon: 'bx:move-horizontal',
+                //icon: 'bx:move-horizontal',
 
                 onClick: handleMove.bind(null, record),
               },
@@ -28,13 +28,13 @@
                 disabled:
                   (record.payStatus - 0 != 1 && record.status - 0 == 0) ||
                   (record.payStatus - 0 != 1 && record.status - 0 == -1),
-                icon: 'carbon:download',
+                //icon: 'carbon:download',
                 onClick: handleDownload.bind(null, record),
               },
               {
                 label: '重算',
                 disabled: record.payStatus != 1 && record.status - 0 == 0,
-                icon: 'bx:reset',
+                //icon: 'bx:reset',
                 popConfirm: {
                   title: '是否重算?',
                   confirm: handleReset.bind(null, record),
@@ -45,7 +45,7 @@
                 disabled:
                   (record.payStatus != 1 && record.status - 0 == 0) ||
                   (record.payStatus != 1 && record.status - 0 == -1),
-                icon: 'akar-icons:copy',
+                //icon: 'akar-icons:copy',
                 //onClick: handleCopy.bind(null, record),
                 popConfirm: {
                   title: '是否复制?',
@@ -54,7 +54,7 @@
               },
               {
                 label: '删除',
-                icon: 'ic:outline-delete-outline',
+                //icon: 'ic:outline-delete-outline',
                 color: 'error',
                 //onClick: handleDelete.bind(null, record),
                 popConfirm: {
@@ -247,7 +247,8 @@
           slots: { customRender: 'action' },
           ifShow: true,
           fixed: 'right',
-          width: 350,
+          flag: 'ACTION',
+          width: 250,
         },
       ];
       const searchForm: Partial<FormProps> = {

+ 1 - 1
src/views/productOperation/viewKankan.vue

@@ -9,7 +9,6 @@
         :actions="[
           {
             label: '删除',
-            icon: 'ic:outline-delete-outline',
             color: 'error',
             popConfirm: {
               title: '是否删除?',
@@ -119,6 +118,7 @@
           slots: { customRender: 'action' },
           ifShow: true,
           fixed: 'right',
+          flag: 'ACTION',
           width: 50,
         },
       ];