tangning vor 1 Jahr
Ursprung
Commit
ed7b26d0e9
4 geänderte Dateien mit 498 neuen und 1 gelöschten Zeilen
  1. 1 1
      .env.development
  2. 47 0
      src/api/product/index.ts
  3. 228 0
      src/views/product/rtk/AddModal.vue
  4. 222 0
      src/views/product/rtk/list.vue

+ 1 - 1
.env.development

@@ -6,7 +6,7 @@ VITE_PUBLIC_PATH = ./
 
 # Cross-domain proxy, you can configure multiple
 # Please note that no line breaks
-VITE_PROXY = [["/qjkankan","https://test.4dkankan.com/qjkankan"],["/takelook","https://v4-test.4dkankan.com/takelook"],["/upload","https://v4-uat.4dkankan.com/service/manage/common/upload/files"],["/service","https://testeur.4dkankan.com/service"],["/ucenter","https://testeur.4dkankan.com/ucenter"]]
+VITE_PROXY = [["/qjkankan","https://test.4dkankan.com/qjkankan"],["/takelook","https://v4-test.4dkankan.com/takelook"],["/upload","https://v4-uat.4dkankan.com/service/manage/common/upload/files"],["/service","https://v4-uat.4dkankan.com/service"],["/ucenter","https://v4-uat.4dkankan.com/ucenter"]]
 # VITE_PROXY=[["/api","https://vvbin.cn/test"]]
 
 # Delete console

+ 47 - 0
src/api/product/index.ts

@@ -31,7 +31,54 @@ enum Api {
   tipList = '/service/manage/serviceUpTip/list',
   tipUpdata = '/service/manage/serviceUpTip/saveOrUpdate',
   tipDelete = '/service/manage/serviceUpTip/delete',
+  rtkInfoList = '/service/manage/rtkInfo/list',
+  rtksaveOrEdit = '/service/manage/rtkInfo/saveOrEdit',
+  rtkdelOrEdit = '/service/manage/rtkInfo/del',
 }
+/**
+ * @description: Get sample list value
+ */
+
+export const rtkInfoList = (params: PageParams) =>
+  defHttp.post<Result>({
+    url: Api.rtkInfoList,
+    params: params,
+    // data: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
+
+/**
+ * @description: Get sample list value
+ */
+
+export const rtksaveOrEdit = (params: PageParams) =>
+  defHttp.post<Result>({
+    url: Api.rtksaveOrEdit,
+    params: params,
+    // data: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
+
+/**
+ * @description: Get sample list value
+ */
+
+export const rtkdelOrEdit = (params: PageParams) =>
+  defHttp.post<Result>({
+    url: Api.rtkdelOrEdit,
+    params: params,
+    // data: params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
 
 /**
  * @description: Get sample list value

+ 228 - 0
src/views/product/rtk/AddModal.vue

@@ -0,0 +1,228 @@
+<template>
+  <BasicModal
+    v-bind="$attrs"
+    @register="register"
+    title="新增RTK账号"
+    @visible-change="handleVisibleChange"
+    @cancel="resetFields"
+    @ok="handleSubmit"
+  >
+    <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 { uploadApi, rtksaveOrEdit } from '/@/api/product/index';
+  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: 'id',
+          component: 'Input',
+          label: 'id',
+          show: false,
+          colProps: {
+            span: 20,
+          },
+        },
+        {
+          field: 'rtkType',
+          component: 'Select',
+          label: '板卡类型',
+          required: true,
+          colProps: {
+            span: 20,
+          },
+          componentProps: {
+            options: [
+              {
+                label: '千寻板卡千寻账号',
+                value: 0,
+                key: 0,
+              },
+              {
+                label: '千寻板卡移动账号',
+                value: 1,
+                key: 1,
+              },
+              {
+                label: '北云板卡移动账号',
+                value: 2,
+                key: 2,
+              },
+            ],
+          },
+          // required: true,
+        },
+        {
+          field: 'ipAddr',
+          component: 'Input',
+          label: 'IP地址',
+          required: true,
+          colProps: {
+            span: 20,
+          },
+          rules: [
+            {
+              required: true,
+              // @ts-ignore
+              validator: async (rule, value) => {
+                if (!value) {
+                  return Promise.reject('请输入IP地址');
+                }
+                if (/.*[\u4e00-\u9fa5]+.*$/.test(value)) {
+                  /* eslint-disable-next-line */
+                  return Promise.reject('不支持中文字符');
+                }
+                return Promise.resolve();
+              },
+              trigger: 'change',
+            },
+          ],
+          componentProps: {
+            maxLength: 15,
+            onChange: (data) => {
+              console.log('data', data);
+            },
+          },
+        },
+        {
+          field: 'mountPoint',
+          component: 'Input',
+          required: true,
+          label: '挂载点',
+          componentProps: {
+            maxLength: 50,
+          },
+          colProps: {
+            span: 20,
+          },
+        },
+        {
+          field: 'port',
+          component: 'Input',
+          required: true,
+          label: '端口',
+          componentProps: {
+            maxLength: 50,
+          },
+          colProps: {
+            span: 20,
+          },
+        },
+        {
+          field: 'userName',
+          component: 'Input',
+          required: true,
+          label: '用户名称',
+          componentProps: {
+            maxLength: 50,
+          },
+          colProps: {
+            span: 20,
+          },
+        },
+        {
+          field: 'password',
+          component: 'StrengthMeter',
+          label: '密码',
+          required: true,
+          componentProps: {
+            maxLength: 50,
+            // readonly:preventAutoFill.value,
+            placeholder:"请输入数字、字母大小写组合"
+          },
+          colProps: { span: 20 },
+        },
+        {
+          field: 'rtkSnCode',
+          component: 'Input',
+          required: true,
+          label: '板卡sn号',
+          colProps: {
+            span: 20,
+          },
+        },
+        {
+          field: 'operator',
+          component: 'Input',
+          required: true,
+          label: '运营商',
+          colProps: {
+            span: 20,
+          },
+        },
+      ];
+      const [registerForm, { validate, resetFields, setFieldsValue }] = useForm({
+        labelWidth: 120,
+        schemas,
+        showActionButtonGroup: false,
+        actionColOptions: {
+          span: 20,
+        },
+      });
+      onMounted(() => {});
+      let addListFunc = () => {};
+      const [register, { closeModal }] = useModalInner((data) => {
+        data && onDataReceive(data);
+      });
+
+      function onDataReceive(data) {
+        modelRef.value = data;
+        resetFields();
+        console.log('data', data);
+        setFieldsValue(data);
+      }
+      const handleSubmit = async () => {
+        try {
+          const params = await validate();
+          const res = await rtksaveOrEdit(params);
+          console.log('res', res);
+          closeModal();
+          resetFields();
+          createMessage.success(t('common.optSuccess'));
+          emit('update');
+        } catch (error) {
+          console.log('not passing', error);
+        }
+      };
+      function handleVisibleChange(v) {
+        v && props.userData && nextTick(() => onDataReceive(props.userData));
+      }
+      return {
+        register,
+        schemas,
+        registerForm,
+        model: modelRef,
+        fileFlow,
+        handleVisibleChange,
+        handleSubmit,
+        addListFunc,
+        resetFields,
+        t,
+      };
+    },
+  });
+</script>

+ 222 - 0
src/views/product/rtk/list.vue

@@ -0,0 +1,222 @@
+<template>
+  <div>
+    <BasicTable @register="registerTable">
+      <template #toolbar>
+        <a-button type="primary" @click="handleEdit" v-if="getCheckPerm('algorithm-add')"
+          >授权</a-button
+        >
+      </template>
+      <template #copy="{ record }">
+        <a @click="handleCopy(record.authorizeKey)">
+          {{ record.authorizeKey }}
+        </a>
+      </template>
+      <template #action="{ record }">
+        <TableAction
+          :actions="[
+            {
+              label: '编辑',
+              ifShow: getCheckPerm('algorithm-updata'),
+              onClick: handleEdit.bind(null, record),
+            },
+            {
+              label: '删除',
+              color: 'error',
+              ifShow: getCheckPerm('algorithm-delete'),
+              onClick: handleDelete.bind(null, record),
+            },
+          ]"
+        />
+      </template>
+    </BasicTable>
+    <AddModal @register="register" @update="reload" />
+  </div>
+</template>
+<script lang="ts">
+  import { defineComponent, h } from 'vue';
+  import {
+    BasicTable,
+    useTable,
+    TableAction,
+    BasicColumn,
+    TableImg,
+    FormProps,
+  } from '/@/components/Table';
+  import { rtkInfoList, rtkdelOrEdit } from '/@/api/product';
+  import { useModal } from '/@/components/Modal';
+  import { useI18n } from '/@/hooks/web/useI18n';
+  import { copyTextToClipboard } from '/@/hooks/web/useCopyToClipboard';
+  import AddModal from './AddModal.vue';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { usePermissionStore } from '/@/store/modules/permission';
+  import { incrementUseTypeList } from '/@/api/account';
+  export default defineComponent({
+    components: {
+      BasicTable,
+      AddModal,
+      TableAction,
+      TableImg,
+    },
+    setup() {
+      const { t } = useI18n();
+      const { createMessage, createConfirm } = useMessage();
+      const permissionStore = usePermissionStore();
+      const { getCheckPerm } = permissionStore;
+      const [register, { openModal }] = useModal();
+      const columns: BasicColumn[] = [
+        {
+          title: '板卡类型',
+          dataIndex: 'rtkType',
+          ellipsis: true,
+          width: 120,
+          customRender: ({ record }) => {
+            let obj = {
+              0: '千寻板卡千寻账号',
+              1: '千寻板卡移动账号',
+              2: '北云板卡移动账号',
+            };
+            return obj[record.rtkType] || '-';
+          },
+        },
+        {
+          title: 'IP地址',
+          ellipsis: true,
+          dataIndex: 'ipAddr',
+          width: 100,
+        },
+        {
+          title: '挂载点',
+          ellipsis: true,
+          dataIndex: 'mountPoint',
+          width: 120,
+        },
+        {
+          title: '端口',
+          ellipsis: true,
+          dataIndex: 'port',
+          width: 50,
+        },
+        {
+          title: '用户名称',
+          ellipsis: true,
+          dataIndex: 'userName',
+          width: 120,
+        },
+        {
+          title: '板卡sn号',
+          ellipsis: true,
+          dataIndex: 'rtkSnCode',
+          width: 150,
+        },
+        {
+          title: '运营商',
+          ellipsis: true,
+          dataIndex: 'operator',
+          width: 120,
+        },
+        {
+          title: '创建时间',
+          ellipsis: true,
+          dataIndex: 'createTime',
+          width: 160,
+        },
+        {
+          title: 'RTK使用状态',
+          dataIndex: 'status',
+          ellipsis: true,
+          width: 120,
+          customRender: ({ record }) => {
+            return record.status == 0 ? '正常' : '待激活';
+          },
+        },
+      ];
+      const searchForm: Partial<FormProps> = {
+        labelWidth: 100,
+        autoSubmitOnEnter: true,
+        schemas: [
+          {
+            field: 'rtkSnCode',
+            label: '板卡sn号',
+            component: 'Input',
+            colProps: {
+              xl: 8,
+              xxl: 8,
+            },
+          },
+          {
+            field: 'userName',
+            label: '用户名称',
+            component: 'Input',
+            colProps: {
+              xl: 8,
+              xxl: 8,
+            },
+          },
+          {
+            field: 'operator',
+            label: '运营商',
+            component: 'Input',
+            colProps: {
+              xl: 8,
+              xxl: 8,
+            },
+          },
+        ],
+      };
+      const [registerTable, { reload }] = useTable({
+        api: rtkInfoList,
+        title: 'rtk列表',
+        columns: columns,
+        useSearchForm: true,
+        showIndexColumn: true,
+        formConfig: searchForm,
+        showTableSetting: true,
+        fetchSetting: {
+          pageField: 'pageNum',
+          sizeField: 'pageSize',
+          listField: 'list',
+          totalField: 'total',
+        },
+        actionColumn: {
+          width: 100,
+          title: '操作',
+          dataIndex: 'action',
+          slots: { customRender: 'action' },
+        },
+        rowKey: 'id',
+        canResize: true,
+      });
+      async function handleDelete(record) {
+        createConfirm({
+          iconType: 'warning',
+          title: () => h('span', '温馨提示'),
+          content: () => h('span', '确定要删除吗?'),
+          onOk: async () => {
+            await rtkdelOrEdit({ id: record.id });
+            reload();
+            createMessage.success(t('common.optSuccess'));
+          },
+        });
+      }
+      function handleCopy(str: string) {
+        copyTextToClipboard(str)
+        createMessage.success('复制成功');
+      }
+      function handleEdit(record = {}) {
+        openModal(true, {
+          ...record,
+          authorizeTime: `${record.authorizeTime || '10'}_${record.authorizeTimeUnit || '1'}`,
+        });
+      }
+      return {
+        registerTable,
+        handleCopy,
+        handleDelete,
+        reload,
+        register,
+        getCheckPerm,
+        handleEdit,
+      };
+    },
+  });
+</script>