jinx 3 rokov pred
rodič
commit
b8da3fbcdd

+ 40 - 0
src/api/customer/index.ts

@@ -0,0 +1,40 @@
+import { defHttp } from '/@/utils/http/axios';
+import { PageParams, deleteParams, addParams } 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',
+}
+
+export const companyList = (params: PageParams) =>
+  defHttp.post<Result>({
+    url: Api.companyList,
+    params: params,
+    // data: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
+export const companyAdd = (params: addParams) =>
+  defHttp.post<Result>({
+    url: Api.companyAdd,
+    params: params,
+    // data: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
+export const companyDelete = (params: deleteParams) =>
+  defHttp.post<Result>({
+    url: Api.companyDelete,
+    params: params,
+    // data: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });

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

@@ -0,0 +1,17 @@
+import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
+/**
+ * @description: Request list interface parameters
+ */
+export type PageParams = BasicPageParams;
+
+export interface deleteParams {
+  id?: number;
+}
+export interface addParams {
+  companyName: string;
+  companydesc: string;
+  topLogo: string;
+  floorLogo: string;
+  qrLogo: string;
+  showLogo: string;
+}

+ 13 - 3
src/router/routes/modules/customer.ts

@@ -5,19 +5,29 @@ import { LAYOUT } from '/@/router/constant';
 export const customer: AppRouteRecordRaw = {
   path: '/customer',
   name: 'Customer',
-  redirect: '/customer/device',
+  redirect: '/customer/index',
   component: LAYOUT,
   meta: {
     title: t('routes.dashboard.customer'),
     icon: 'raphael:customer',
-    orderNo: 102,
-    // hideChildrenInMenu: true,
+    orderNo: 112,
+    hideChildrenInMenu: true,
   },
   children: [
     {
+      path: 'index',
+      name: 'CustomerIndex',
+      component: () => import('/@/views/customer/index.vue'),
+      meta: {
+        title: t('routes.dashboard.customer'),
+        // icon: 'la:file-invoice-dollar',
+      },
+    },
+    {
       path: 'device',
       name: 'Device',
       component: () => import('/@/views/customer/device.vue'),
+
       meta: {
         title: t('routes.dashboard.customerDevice'),
         // icon: 'la:file-invoice-dollar',

+ 244 - 0
src/views/customer/index.vue

@@ -0,0 +1,244 @@
+<template>
+  <PageWrapper contentBackground>
+    <div class="desc-wrap-BasicTable">
+      <BasicTable @register="registerTable">
+        <template #toolbar>
+          <a-button
+            type="primary"
+            @click="
+              () => {
+                openInfoModal(true);
+              }
+            "
+          >
+            新增客户</a-button
+          >
+        </template>
+
+        <template #action="{ record }">
+          <TableAction
+            stopButtonPropagation
+            :actions="[
+              {
+                label: '设备',
+                onClick: handleRouter.bind(null, 'device'),
+              },
+              {
+                label: '场景',
+              },
+              {
+                label: '编辑',
+                onClick: handleEdit.bind(null, record),
+              },
+              {
+                label: '删除',
+                color: 'error',
+                popConfirm: {
+                  title: '是否删除?',
+                  confirm: handleDelete.bind(null, record),
+                  placement: 'topLeft',
+                },
+              },
+            ]"
+          />
+        </template>
+      </BasicTable>
+    </div>
+    <InfoModal @update="reload" @register="registerInfoModal" />
+  </PageWrapper>
+</template>
+<script lang="ts">
+  import { defineComponent, h, reactive, toRefs } from 'vue';
+  import {
+    BasicTable,
+    useTable,
+    TableAction,
+    BasicColumn,
+    TableImg,
+    FormProps,
+  } from '/@/components/Table';
+  import { router } from '/@/router';
+  import { PageWrapper } from '/@/components/Page';
+  import { Time } from '/@/components/Time';
+  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 } from '/@/api/operate';
+  import { companyList, companyDelete } from '/@/api/customer';
+  import { message } from 'ant-design-vue';
+  import InfoModal from './modal/InfoModal.vue';
+  import { useModal } from '/@/components/Modal';
+  export default defineComponent({
+    components: {
+      BasicTable,
+      TableAction,
+      PageWrapper,
+      TableImg,
+      InfoModal,
+      [Descriptions.name]: Descriptions,
+      [Descriptions.Item.name]: Descriptions.Item,
+    },
+    setup() {
+      const [registerInfoModal, { openModal: openInfoModal }] = useModal();
+      const { t } = useI18n();
+      const { createMessage, createConfirm } = useMessage();
+
+      const columns: BasicColumn[] = [
+        {
+          title: '客户ID',
+          dataIndex: 'id',
+          width: 150,
+        },
+        {
+          title: '客户名称',
+          dataIndex: 'companyName',
+          ellipsis: false,
+          width: 80,
+        },
+
+        {
+          title: '客户描述',
+          dataIndex: 'companyDesc',
+          width: 180,
+          customRender: ({ record }) => {
+            return record.cameraCount ? record.cameraCount : '-';
+          },
+        },
+        {
+          title: '设备数',
+          dataIndex: 'cameraCount',
+          width: 80,
+          customRender: ({ record }) => {
+            return record.cameraCount ? record.cameraCount : '0';
+          },
+        },
+        {
+          title: '场景数',
+          dataIndex: 'sceneCount',
+          width: 80,
+          customRender: ({ record }) => {
+            return record.sceneCount ? record.sceneCount : '0';
+          },
+        },
+        {
+          title: '创建人',
+          dataIndex: 'createUserName',
+          width: 180,
+          customRender: ({ record }) => {
+            return record.createUserName ? record.createUserName : '-';
+          },
+        },
+        {
+          title: '创建时间',
+          dataIndex: 'createTime',
+          width: 180,
+          customRender: ({ record }) => {
+            return record.createTime
+              ? h(Time, {
+                  value: record.createTime,
+                  mode: 'datetime',
+                })
+              : '-';
+          },
+        },
+
+        {
+          title: '操作',
+          dataIndex: 'action',
+          slots: { customRender: 'action' },
+          ifShow: true,
+          fixed: 'right',
+          width: 200,
+        },
+      ];
+      const searchForm: Partial<FormProps> = {
+        labelWidth: 100,
+        schemas: [
+          {
+            field: 'companyName',
+            label: '客户名称',
+            component: 'Input',
+            componentProps: {
+              maxLength: 100,
+            },
+            colProps: {
+              xl: 7,
+              xxl: 7,
+            },
+          },
+        ],
+      };
+      const [registerTable, { reload }] = useTable({
+        api: companyList,
+        title: '客户列表',
+        // titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
+        columns: columns,
+        searchInfo: { companyName: '' },
+        useSearchForm: true,
+        formConfig: searchForm,
+        showTableSetting: true,
+        rowKey: 'id',
+        fetchSetting: {
+          pageField: 'pageNum',
+          sizeField: 'pageSize',
+          listField: 'list',
+          totalField: 'total',
+        },
+        canResize: false,
+      });
+      function handleRouter() {
+        router.push('/customer/device');
+      }
+      function handleEdit(record) {
+        openInfoModal(true, {
+          ...record,
+        });
+      }
+      async function handleDelete(record: Recordable) {
+        console.log('handleDelete', record);
+
+        companyDelete({ id: record.id })
+          .then(() => {
+            message.success({
+              content: '删除成功',
+            });
+
+            reload();
+          })
+          .catch(() => {
+            message.success({
+              content: '删除失败',
+            });
+          });
+      }
+      async function handleMove(record: Recordable) {}
+      function handleDownload(record: Recordable) {
+        console.log('handleDownload', record);
+      }
+      function handleReset(record: Recordable) {
+        console.log('handleReset', record);
+      }
+
+      return {
+        openInfoModal,
+        registerInfoModal,
+        registerTable,
+        handleRouter,
+        handleDelete,
+        handleMove,
+        handleEdit,
+        handleDownload,
+        handleReset,
+      };
+    },
+  });
+</script>
+<style lang="less" scoped>
+  .desc-wrap-BasicTable {
+    background-color: #f0f2f5;
+    .vben-basic-table-form-container {
+      padding: 0;
+    }
+  }
+</style>

+ 255 - 0
src/views/customer/modal/InfoModal.vue

@@ -0,0 +1,255 @@
+<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 { companyAdd } from '/@/api/customer';
+  import { useI18n } from '/@/hooks/web/useI18n';
+  import { uploadApi } from '/@/api/product/index';
+  import { useModalInner } from '/@/components/Modal';
+  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[] = [
+        {
+          component: 'Divider',
+          label: '基本信息',
+          colProps: {
+            span: 24,
+          },
+        },
+        {
+          field: 'companyName',
+          component: 'Input',
+          label: '客户名称',
+          required: true,
+          defaultValue: '',
+          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: '请输入',
+            maxLength: 15,
+            onChange: (data) => {
+              // console.log('data', data);
+            },
+          },
+        },
+        {
+          field: 'companyDesc',
+          component: 'InputTextArea',
+          label: '客户描述',
+          defaultValue: '',
+          colProps: {
+            span: 24,
+          },
+          componentProps: {
+            placeholder: '请输入内容',
+            maxLength: 200,
+            onChange: (data) => {
+              // console.log('data', data);
+            },
+          },
+        },
+        {
+          component: 'Divider',
+          label: 'Logo信息',
+          colProps: {
+            span: 24,
+          },
+        },
+        {
+          field: 'topLogo',
+          component: 'Upload',
+          label: '顶部LOGO',
+          defaultValue: null,
+          componentProps: {
+            api: uploadApi,
+            maxNumber: 1,
+            maxSize: 5,
+            fileFlow: true,
+            accept: ['jpg', 'png'],
+            afterFetch: function (data) {
+              console.log('uploadApi', data);
+              // Reflect.set(data, 'url', data.file);
+              // fileFlow.file = data.file;
+              return data;
+            },
+          },
+          colProps: {
+            span: 22,
+          },
+        },
+        {
+          field: 'floorLogo',
+          component: 'Upload',
+          label: '地面LOGO',
+          defaultValue: null,
+          componentProps: {
+            api: uploadApi,
+            maxNumber: 1,
+            maxSize: 5,
+            fileFlow: true,
+            accept: ['jpg', 'png'],
+            afterFetch: function (data) {
+              console.log('uploadApi', data);
+              // Reflect.set(data, 'url', data.file);
+              // fileFlow.file = data.file;
+              return data;
+            },
+          },
+          colProps: {
+            span: 22,
+          },
+        },
+        {
+          field: 'qrLogo',
+          component: 'Upload',
+          label: '二维码LOGO',
+          defaultValue: null,
+          componentProps: {
+            api: uploadApi,
+            maxNumber: 1,
+            maxSize: 5,
+            fileFlow: true,
+            accept: ['jpg', 'png'],
+            afterFetch: function (data) {
+              console.log('uploadApi', data);
+              // Reflect.set(data, 'url', data.file);
+              // fileFlow.file = data.file;
+              return data;
+            },
+          },
+          colProps: {
+            span: 22,
+          },
+        },
+        {
+          field: 'showLogo',
+          component: 'RadioGroup',
+          label: '初始LOGO',
+          defaultValue: '1',
+          componentProps: {
+            options: [
+              {
+                label: '显示',
+                value: '1',
+              },
+              {
+                label: '不显示',
+                value: '2',
+              },
+            ],
+          },
+          colProps: {
+            span: 22,
+          },
+        },
+      ];
+      const [registerForm, { validate, resetFields, setFieldsValue }] = useForm({
+        labelWidth: 120,
+        schemas,
+        showActionButtonGroup: false,
+        actionColOptions: {
+          span: 24,
+        },
+      });
+
+      onMounted(() => {});
+      let addListFunc = () => {};
+      const [register, { closeModal }] = useModalInner((data) => {
+        if (data) {
+          console.log(data);
+          modelRef.value = data;
+          setFieldsValue({
+            ...data,
+          });
+        }
+      });
+
+      // function onDataReceive(data) {
+      //   modelRef.value = data;
+      //   resetFields();
+      //   setFieldsValue({
+      //     type: data.sceneName,
+      //   });
+      // }
+      const handleSubmit = async () => {
+        try {
+          const params = await validate();
+          const apiData = { ...params };
+          const res = await companyAdd(apiData);
+          closeModal();
+          resetFields();
+          emit('update');
+          createMessage.success('添加成功。');
+        } 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>

+ 3 - 1
src/views/productOperation/cameraScene.vue

@@ -129,6 +129,7 @@
       const { t } = useI18n();
       const { createMessage, createConfirm } = useMessage();
       const tableType = ref<Recordable>(0); //0看看 、1看见、2深时
+      const tabList = ref<Array>(['四维看看', '四维看见', '四维双目深时', '四维双目Lite']);
       const columns: BasicColumn[] = [
         {
           title: '场景标题',
@@ -297,7 +298,7 @@
       const [registerMoveModal, { openModal: openMoveModal }] = useModal();
       const [registerTable, { reload }] = useTable({
         api: operateSceneList,
-        title: '四维深时场景列表',
+        title: `场景列表`,
         // titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
         columns: columns,
         searchInfo: { type: tableType },
@@ -314,6 +315,7 @@
         canResize: false,
       });
       function changeTable(val: string) {
+        tableType.value = val;
         reload();
       }
       async function handleCopy(record: Recordable) {

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

@@ -154,7 +154,7 @@
       };
       const [registerTable, { reload }] = useTable({
         api: overallList,
-        title: '四维深时场景列表',
+        title: '全景看看作品列表',
         // titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
         columns: columns,
         searchInfo: { type: 1 },