liu_lake преди 6 месеца
родител
ревизия
07ddea4a14

+ 1 - 1
admin-ui/.env.development

@@ -7,5 +7,5 @@ VITE_PUBLIC_PATH = ./
 # 开发环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数")
 VITE_ROUTER_HISTORY = "hash"
 # API访问路径
- VITE_API_SERVER = "http://127.0.0.1:8088/api"
+ VITE_API_SERVER = "https://admin.gagapay.pro/api"
 #VITE_API_SERVER = "https://www.sortebar.com/api"

+ 13 - 4
admin-ui/src/api/platform/index.ts

@@ -6,7 +6,7 @@ import { Result, deleteRequest, get, post, put } from "../base";
  * @returns .
  */
 export function queryPage<T>(query?: any): Promise<Result<T>> {
-  return get("/sys/pay/agent/page", {}, orderId);
+  return get("/sys/pay/platform/setting/page",  query);
 }
 
 /**
@@ -15,7 +15,7 @@ export function queryPage<T>(query?: any): Promise<Result<T>> {
  * @returns .
  */
 export function queryList<T>(query?: any): Promise<Result<T>> {
-  return get("/sys/pay/agent/list", {}, orderId);
+  return get("/sys/pay/platform/setting/list",  query);
 }
 
 /**
@@ -24,7 +24,7 @@ export function queryList<T>(query?: any): Promise<Result<T>> {
  * @returns .
  */
 export function save<T>(data: any): Promise<Result<T>> {
-  return post("/sys/pay/agent/save", data);
+  return post("/sys/pay/platform/setting/save", data);
 }
 
 /**
@@ -34,5 +34,14 @@ export function save<T>(data: any): Promise<Result<T>> {
  * @returns  .
  */
 export function update<T>(id: string, data: any): Promise<Result<T>> {
-  return put(`/sys/pay/agent/update/${id}`, {}, data);
+  return put(`/sys/pay/platform/setting/update`, {}, data);
+}
+
+/**
+ * 删除用户
+ * @param userIds .
+ * @returns  .
+ */
+export function del<T>(userIds: string[]): Promise<Result<T>> {
+  return deleteRequest(`/sys/pay/platform/setting/remove`, {}, userIds);
 }

+ 2 - 2
admin-ui/src/api/sys/config.ts

@@ -6,7 +6,7 @@ import { get, Result, post, put, deleteRequest } from "../base";
  * @returns .
  */
 export function queryPage<T>(query?: any): Promise<Result<T>> {
-  return get("/sys/config/query/page", {}, orderId);
+  return get("/sys/config/query/page",  query);
 }
 /**
  * 列表查询
@@ -14,7 +14,7 @@ export function queryPage<T>(query?: any): Promise<Result<T>> {
  * @returns .
  */
 export function queryList<T>(query?: any): Promise<Result<T>> {
-  return get("/sys/config/query/list", {}, orderId);
+  return get("/sys/config/query/list", query);
 }
 /**
  *  保存

+ 2 - 2
admin-ui/src/api/sys/permission.ts

@@ -8,7 +8,7 @@ import { BaseQuery, deleteRequest, get, post, put, Result } from "../base";
 export function treeList<P extends BaseQuery, T>(
   query?: P
 ): Promise<Result<T>> {
-  return get("/sys/permission/tree", {}, orderId);
+  return get("/sys/permission/tree",  query);
 }
 /**
  * 菜单树形列表
@@ -17,7 +17,7 @@ export function treeList<P extends BaseQuery, T>(
 export function treeMenus<P extends BaseQuery, T>(
   query?: P
 ): Promise<Result<T>> {
-  return get("/sys/permission/tree/menu", {}, orderId);
+  return get("/sys/permission/tree/menu",  query);
 }
 /**
  * 新增

+ 4 - 4
admin-ui/src/api/sys/role.ts

@@ -6,7 +6,7 @@ import { get, Result, post, put } from "../base";
  * @returns .
  */
 export function roleQueryPage<T>(query?: any): Promise<Result<T>> {
-  return get("/sys/role/query/page", {}, orderId);
+  return get("/sys/role/query/page",  query);
 }
 /**
  * 查询角色列表
@@ -14,7 +14,7 @@ export function roleQueryPage<T>(query?: any): Promise<Result<T>> {
  * @returns .
  */
 export function roleQueryList<T>(query?: any): Promise<Result<T>> {
-  return get("/sys/role/query/list", {}, orderId);
+  return get("/sys/role/query/list",  query);
 }
 /**
  *  检查code是否重复
@@ -27,7 +27,7 @@ export function checkCode<T>(code: string, id?: string): Promise<Result<T>> {
   if (id) {
     _data.id = id;
   }
-  return get("/sys/role/check/code", {}, orderId);
+  return get("/sys/role/check/code",  code);
 }
 /**
  *  保存角色
@@ -52,7 +52,7 @@ export function roleUpdate<T>(id: string, data?: T): Promise<Result<T>> {
  * @returns .
  */
 export function queryPermission(id: string): Promise<Result<string[]>> {
-  return get("/sys/role/permission", {}, orderId);
+  return get("/sys/role/permission",  id);
 }
 /**
  * 更新权限

+ 5 - 5
admin-ui/src/api/sys/user.ts

@@ -5,7 +5,7 @@ import { Result, deleteRequest, get, post, put } from "../base";
  * @returns .
  */
 export function queryPage<T>(query?: any): Promise<Result<T>> {
-  return get("/sys/user/query/page", {}, orderId);
+  return get("/sys/user/query/page",  query);
 }
 /**
  * 列表查询
@@ -13,7 +13,7 @@ export function queryPage<T>(query?: any): Promise<Result<T>> {
  * @returns .
  */
 export function queryList<T>(query?: any): Promise<Result<T>> {
-  return get("/sys/user/query/list", {}, orderId);
+  return get("/sys/user/query/list",  query);
 }
 /**
  * 检查用户名是否存在
@@ -21,7 +21,7 @@ export function queryList<T>(query?: any): Promise<Result<T>> {
  * @returns .
  */
 export function hashUsername(username: string): Promise<Result<Boolean>> {
-  return get("/sys/user/check/username", {}, orderId);
+  return get("/sys/user/check/username",  username);
 }
 /**
  * 新增
@@ -38,7 +38,7 @@ export function save<T>(data: any): Promise<Result<T>> {
  * @returns  .
  */
 export function update<T>(id: string, data: any): Promise<Result<T>> {
-  return put(`/sys/user/update/${id}`, {}, data);
+  return put(`/sys/user/update/${id}`,  data);
 }
 
 /**
@@ -47,7 +47,7 @@ export function update<T>(id: string, data: any): Promise<Result<T>> {
  * @returns .
  */
 export function queryRoleIds<T>(userId: string): Promise<Result<T>> {
-  return get(`/sys/user/query/role/ids`, {}, orderId);
+  return get(`/sys/user/query/role/ids`, userId);
 }
 /**
  * 删除用户

+ 6 - 6
admin-ui/src/views/platform/index.vue

@@ -1,8 +1,9 @@
 <script setup lang="ts">
 import { reactive } from "vue";
+import list from "./modules/list.vue";
 
 defineOptions({
-  name: "platformSetting"
+  name: "platformManage"
 });
 const pageData: any = reactive({
   mode: "table"
@@ -11,9 +12,8 @@ const pageData: any = reactive({
 
 <template>
   <el-card :shadow="'never'">
-        <div>服务商id</div>
-        <div>密钥</div>
-        <div>公钥</div>
-        <div>Google检验器</div>
+    <template #default>
+      <list :mode="pageData.mode" />
+    </template>
   </el-card>
-</template>
+</template>

+ 179 - 0
admin-ui/src/views/platform/modules/edit.vue

@@ -0,0 +1,179 @@
+<script setup lang="ts">
+import { reactive, ref } from "vue";
+import * as $api from "@/api/platform/index";
+import { message } from "@/utils/message";
+import type { FormInstance } from "element-plus";
+import { cloneDeep } from "@pureadmin/utils";
+import {enableOptions} from "@/constants/constants";
+
+const title = "";
+defineOptions({ name: "templateEdit" });
+const isDetail = ref(false);
+const formRef = ref<FormInstance>();
+// 初始化数据
+const initData = {
+  serviceId: undefined,
+  privateKey: undefined,
+  publicKey: undefined,
+  status: 1
+};
+
+// 表单校验规则
+const formRules = {};
+
+// 页面数据
+const pageData: any = reactive({
+  dialogVisible: false,
+  title: "",
+  formLoading: false,
+  mode: "add",
+  isUpdate: false,
+  // 表单数据
+  formData: initData,
+  formRules: formRules
+});
+// 暴露给父级调用
+const emits = defineEmits(["ok", "close"]);
+// 打开弹窗
+const open = (data: any, dataSource: any, mode: string) => {
+  pageData.formData = cloneDeep(data) || initData;
+  if (mode === "edit") {
+    pageData.title = `${title} - 编辑`;
+    isDetail.value = false;
+  } else if (mode === "detail") {
+    pageData.title = `${title} - 查看`;
+    isDetail.value = true;
+  } else {
+    pageData.title = `${title} - 新增`;
+    isDetail.value = false;
+  }
+  pageData.dataSource = dataSource;
+  pageData.isUpdate = !!pageData.formData.id;
+  pageData.dialogVisible = true;
+};
+// 关闭弹窗
+const handleClose = () => {
+  pageData.dialogVisible = false;
+  emits("close");
+};
+// 确定并关闭弹窗
+const handleConfirm = () => {
+  formRef.value!.validate((isValid: boolean) => {
+    if (isValid) {
+      const { id } = pageData.formData;
+      if (id) {
+        _update();
+      } else {
+        _save();
+      }
+    } else {
+      message("表单校验失败", { type: "warning" });
+    }
+  });
+};
+const _save = () => {
+  pageData.formLoading = true;
+  const _data = cloneDeep(pageData.formData);
+  $api
+    .save(_data)
+    .then((res: any) => {
+      if (res.success) {
+        _confirm();
+      } else {
+        message(res.message, { type: "warning" });
+      }
+    })
+    .finally(() => {
+      pageData.formLoading = false;
+    });
+};
+const _update = () => {
+  pageData.formLoading = true;
+  const _data = cloneDeep(pageData.formData);
+  $api
+    .update(pageData.formData.id, _data)
+    .then((res: any) => {
+      if (res.success) {
+        _confirm();
+      } else {
+        message(res.message, { type: "warning" });
+      }
+    })
+    .finally(() => {
+      pageData.formLoading = false;
+    });
+};
+const _confirm = () => {
+  pageData.dialogVisible = false;
+  emits("ok");
+};
+defineExpose({ open });
+</script>
+
+<template>
+  <el-dialog v-model="pageData.dialogVisible" destroy-on-close :width="500">
+    <template #header>
+      <el-text class="mx-1" type="primary" size="large">{{
+        pageData.title
+      }}</el-text>
+    </template>
+    <div class="el-dialog-content">
+      <el-form
+        ref="formRef"
+        :model="pageData.formData"
+        style="width: 90%; margin: 20px auto 0"
+        label-width="auto"
+        :rules="pageData.formRules"
+        :loading="pageData.formLoading"
+      >
+        <el-form-item label="服务商id" prop="userName">
+          <el-input
+            v-model="pageData.formData.serviceId"
+            clearable
+            placeholder="请输入名称"
+            size="small"
+            :readonly="isDetail"
+          />
+        </el-form-item>
+        <el-form-item label="密钥" prop="password">
+          <el-input
+            v-model="pageData.formData.privateKey"
+            clearable
+            placeholder="请输入密钥"
+            size="small"
+            :readonly="isDetail"
+          />
+        </el-form-item>
+        <el-form-item label="公钥" prop="password">
+          <el-input
+            v-model="pageData.formData.publicKey"
+            clearable
+            placeholder="请输入公钥"
+            size="small"
+            :readonly="isDetail"
+          />
+        </el-form-item>
+        <el-form-item label="状态" prop="password">
+          <el-select
+              v-model="pageData.formData.status"
+              clearable
+              placeholder="请选择状态"
+          >
+            <el-option
+                v-for="item in enableOptions"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+            />
+          </el-select>
+        </el-form-item>
+      </el-form>
+    </div>
+    <template #footer>
+      <el-button v-if="!isDetail" @click="handleClose">取消</el-button>
+      <el-button v-if="!isDetail" type="primary" @click="handleConfirm"
+        >确认</el-button
+      >
+    </template>
+  </el-dialog>
+</template>

+ 359 - 0
admin-ui/src/views/platform/modules/list.vue

@@ -0,0 +1,359 @@
+<script setup lang="ts">
+import FormSearch, { type FormField } from "@/components/opts/form-search.vue";
+import TableButtons from "@/components/opts/btns2.vue";
+import Edit from "./edit.vue";
+import { PureTable } from "@pureadmin/table";
+import { computed, onBeforeMount, onMounted, reactive, ref, watch } from "vue";
+import * as $api from "@/api/platform/index";
+import { hasAuth } from "@/router/utils";
+import message from "@/utils/message";
+import { enableOptions } from "@/constants/constants";
+import { cloneDeep } from "@pureadmin/utils";
+
+const editRef = ref();
+
+defineOptions({
+  name: "platsettingList"
+});
+
+const props: any = defineProps({
+  mode: {
+    required: false,
+    type: String,
+    default: "table"
+  }
+});
+
+const searchFormFields = computed((): FormField[] => {
+  const fields: FormField[] = [
+
+    {
+      type: "select",
+      label: "状态",
+      prop: "status",
+      placeholder: "请选择",
+      dataSourceKey: "enableOptions",
+      options: {
+        keys: {
+          label: "label",
+          value: "value",
+          prop: "value"
+        },
+        filterable: true
+      }
+    }
+  ];
+  if (props.mode === "table") {
+    return fields;
+  } else {
+    return fields;
+  }
+});
+
+const pageData: any = reactive({
+  mode: "table",
+  permission: {
+  },
+  searchParam: {
+    searchState: true,
+    searchForm: {}
+  },
+  dataSource: {
+    enableOptions: enableOptions
+  },
+  /*按钮 */
+  btnOpts: {
+    size: "small",
+    leftBtns: [
+      {
+        key: "add",
+        label: "新增",
+        type: "primary",
+        icon: "ep:plus",
+        state: true,
+        permission: ["user:save"]
+      }
+    ],
+    rightBtns: [
+      {
+        key: "search",
+        label: "查询",
+        icon: "ep:search",
+        state: true,
+        options: {
+          circle: true
+        }
+      },
+      {
+        key: "refresh",
+        label: "刷新",
+        icon: "ep:refresh",
+        state: true,
+        options: {
+          circle: true
+        }
+      }
+    ]
+  },
+  tableParam: {
+    list: [],
+    columns: [
+      {
+        label: "ID",
+        prop: "id",
+        slot: "id",
+        width: 220
+      },
+      {
+        label: "服务商id",
+        prop: "serviceId",
+        slot: "serviceId"
+      },
+      {
+        label: "密钥",
+        prop: "privateKey",
+        slot: "privateKey"
+      },
+      {
+        label: "公钥",
+        prop: "publicKey",
+        slot: "publicKey"
+      },
+      {
+        label: "状态",
+        prop: "status",
+        slot: "enableOptions"
+      },
+      {
+        label: "更新时间",
+        prop: "updateTime",
+        slot: "updateTime"
+      },
+      {
+        label: "操作",
+        fixed: "right",
+        slot: "operation"
+      }
+    ],
+    loading: false,
+    pagination: {
+      small: true,
+      pageSize: 10,
+      defaultPageSize: 10,
+      currentPage: 1,
+      background: true,
+      total: 0
+    }
+  }
+});
+
+const btnClickHandle = (val: string) => {
+  switch (val) {
+    case "add":
+      editRef.value!.open({ enable: 1 }, pageData.dataSource, "add");
+      break;
+    case "update":
+      break;
+    case "search":
+      _updateSearchState();
+      break;
+    case "refresh":
+      _loadData();
+      break;
+    case "switch":
+      break;
+    default:
+      break;
+  }
+};
+
+/**
+ *  更新搜索表单
+ * @param data .
+ */
+const _updateSearchFormData = (data: any) => {
+  pageData.searchParam.searchForm = data;
+};
+/**
+ * 点击搜索按钮
+ */
+const _searchForm = (data: any) => {
+  pageData.searchParam.searchForm = data;
+  _loadData();
+};
+/**
+ * 重置
+ */
+const _resetSearchForm = (data?: any) => {
+  pageData.searchParam.searchForm = data;
+};
+/**
+ * 更新搜索表达的状态
+ */
+const _updateSearchState = () => {
+  pageData.searchParam.searchState = !pageData.searchParam.searchState;
+};
+/**
+ * 分页 - 改变每页条数
+ * @param val .
+ */
+const handleChangePageSize = (val: any) => {
+  pageData.tableParam.pagination.pageSize = val;
+  _loadData();
+};
+/**
+ * 分页 - 改变页码
+ * @param val .
+ */
+const handleChangeCurrentPage = (val: any) => {
+  pageData.tableParam.pagination.currentPage = val;
+  _loadData();
+};
+/**
+ * 获取查询参数
+ */
+const getQueryParams = () => {
+  const sqp = {};
+  const param = Object.assign(sqp, pageData.searchParam.searchForm);
+  param.current = pageData.tableParam.pagination.currentPage;
+  param.size = pageData.tableParam.pagination.pageSize;
+  return param;
+};
+/**
+ * 获取列表数据
+ * @param page .
+ */
+const _loadData = (page?: number) => {
+  const query = getQueryParams();
+  if (page) {
+    query.current = page;
+  }
+  pageData.tableParam.loading = true;
+  $api
+    .queryPage(query)
+    .then((res: any) => {
+      if (res.success) {
+        pageData.tableParam.list = res.result.records;
+        pageData.tableParam.pagination.total = Number(res.result.total);
+      }
+    })
+    .finally(() => {
+      pageData.tableParam.loading = false;
+    });
+};
+/**
+ * 查看详情
+ * @param row .
+ */
+const handleDetail = (row: any) => {
+  editRef.value!.open(cloneDeep(row), pageData.dataSource, "detail");
+};
+/**
+ * 编辑
+ * @param row .
+ */
+const handleEdit = (row: any) => {
+  editRef.value!.open(cloneDeep(row), pageData.dataSource, "edit");
+};
+/**
+ * 删除
+ * @param row .
+ */
+const handleDel = (row: any) => {
+  message.confirm(`确认删除 id 为 (${row.id}) 的数据?`).then(() => {
+    batchDel([row.id]);
+  });
+};
+/**
+ * 批量删除
+ * @param ids .
+ */
+const batchDel = (ids: string[]) => {
+  if (ids && ids.length > 0) {
+    $api.del(ids).then((res: any) => {
+      if (res.success) {
+        message.success("删除成功");
+        _loadData();
+      } else {
+        message.warning(res.message);
+      }
+    });
+  }
+};
+watch(
+  () => props.orgInfo,
+  val => {
+    if (val) {
+      _loadData();
+    }
+  }
+);
+onBeforeMount(() => {});
+onMounted(() => {
+  _loadData(1);
+});
+</script>
+
+<template>
+  <div>
+    <form-search
+      size="small"
+      :show="pageData.searchParam.searchState"
+      :form-field="searchFormFields"
+      :data-source="pageData.dataSource"
+      :query-permission="pageData.permission.query"
+      @search-form="_updateSearchFormData"
+      @search="_searchForm"
+      @reset="_resetSearchForm"
+    />
+    <!--operate-->
+    <table-buttons
+      :size="pageData.btnOpts.size"
+      :left-btns="pageData.btnOpts.leftBtns"
+      :right-btns="pageData.btnOpts.rightBtns"
+      @click="btnClickHandle"
+    />
+    <!--table-->
+    <pure-table
+      :data="pageData.tableParam.list"
+      :columns="pageData.tableParam.columns"
+      row-key="id"
+      size="small"
+      border
+      stripe
+      :header-row-class-name="'table-header'"
+      :loading="pageData.tableParam.loading"
+      :pagination="pageData.tableParam.pagination"
+      @page-current-change="handleChangeCurrentPage"
+      @page-size-change="handleChangePageSize"
+    >
+      <template #ellipsis="{ row, column }">
+        <el-tooltip placement="top-start" :content="row[column.property]"
+          >{{ row[column.property] }}
+        </el-tooltip>
+      </template>
+      <template #enableOptions="scope">
+        <el-tag v-if="scope.row.status==1">启用</el-tag>
+        <el-tag v-if="scope.row.status==0">禁用</el-tag>
+      </template>
+      <template #operation="{ row }">
+        <div class="flex justify-center items-center">
+          <el-link
+            type="primary"
+            @click="handleEdit(row)"
+            >编辑
+          </el-link>
+          <el-divider
+            direction="vertical"
+          />
+          <el-link
+            type="primary"
+            @click="handleDel(row)"
+            >删除
+          </el-link>
+        </div>
+      </template>
+    </pure-table>
+    <edit ref="editRef" @ok="_loadData" />
+  </div>
+</template>