Forráskód Böngészése

用户、任务、奖励、推进器完成

st 2 hónapja
szülő
commit
a0a6378484

+ 1 - 1
src/apis/production/type.ts

@@ -1,4 +1,4 @@
-// thruster
+// jiangli
 
 export interface ThrusterListResp {
   id: number

+ 21 - 0
src/apis/team/jiangli.ts

@@ -0,0 +1,21 @@
+import type * as T from '@/apis/team/type'
+import http from '@/utils/http'
+
+const BASE_URL = '/team/config'
+
+export function listTeam(query: T.TeamPageQuery) {
+  return http.get<PageRes<T.TeamListResp[]>>(`${BASE_URL}/page`, query)
+}
+export function teamById(id: number) {
+  return http.get<T.TeamListResp[]>(`${BASE_URL}/${id}`)
+}
+export function teamPost(data: T.TeamData) {
+  return http.post<any>(`${BASE_URL}`, data)
+}
+
+export function teamUpdata(id: number, data: T.TeamData) {
+  return http.put<any>(`${BASE_URL}/${id}`, data)
+}
+export function teamDel(id: number) {
+  return http.del<any>(`${BASE_URL}/${id}`)
+}

+ 17 - 0
src/apis/team/type.ts

@@ -0,0 +1,17 @@
+// Team
+export interface TeamListResp {
+  id: number
+  teamAScale: string
+  teamBScale: string
+  inviteOneReward: number
+  createTime: string
+  updateTime: string
+}
+
+export interface TeamData {
+  teamAScale: string
+  teamBScale: string
+  inviteOneReward: number
+}
+export interface TeamPageQuery extends PageQuery {
+}

+ 20 - 20
src/router/route.ts

@@ -43,26 +43,26 @@ export const systemRoutes: RouteRecordRaw[] = [
     component: () => import('@/views/login/pwdExpired/index.vue'),
     meta: { hidden: true },
   },
-  // {
-  //   path: '/setting',
-  //   name: 'Setting',
-  //   component: Layout,
-  //   meta: { hidden: true },
-  //   children: [
-  //     {
-  //       path: '/setting/profile',
-  //       name: 'SettingProfile',
-  //       component: () => import('@/views/setting/profile/index.vue'),
-  //       meta: { title: '个人中心', showInTabs: false },
-  //     },
-  //     {
-  //       path: '/setting/message',
-  //       name: 'SettingMessage',
-  //       component: () => import('@/views/setting/message/index.vue'),
-  //       meta: { title: '消息中心', showInTabs: false },
-  //     },
-  //   ],
-  // },
+  {
+    path: '/setting',
+    name: 'Setting',
+    component: Layout,
+    meta: { hidden: true },
+    children: [
+      {
+        path: '/setting/profile',
+        name: 'SettingProfile',
+        component: () => import('@/views/setting/profile/index.vue'),
+        meta: { title: '个人中心', showInTabs: false },
+      },
+      // {
+      //   path: '/setting/message',
+      //   name: 'SettingMessage',
+      //   component: () => import('@/views/setting/message/index.vue'),
+      //   meta: { title: '消息中心', showInTabs: false },
+      // },
+    ],
+  },
   // {
   //   path: '/about',
   //   name: 'About',

+ 1 - 2
src/views/production/thruster/index.vue

@@ -40,7 +40,6 @@ import ThrusterAddModal from './thrusterAddModal.vue'
 import type { TableInstanceColumns } from '@/components/GiTable/type'
 import { useTable } from '@/hooks'
 import { isMobile } from '@/utils'
-import has from '@/utils/has'
 import { listThruster, thrusterDel } from '@/apis/production/thruster'
 import type { ThrusterListResp } from '@/apis/production/type'
 
@@ -71,7 +70,7 @@ const columns: TableInstanceColumns[] = [
     width: 350,
     align: 'center',
     fixed: !isMobile() ? 'right' : undefined,
-    show: has.hasPermOr(['system:notice:detail', 'system:notice:update', 'system:notice:delete']),
+    show: true,
   },
 ]
 

+ 1 - 2
src/views/task/index.vue

@@ -57,7 +57,6 @@ import TaskAddModal from './taskAddModal.vue'
 import type { TableInstanceColumns } from '@/components/GiTable/type'
 import { useTable } from '@/hooks'
 import { isMobile } from '@/utils'
-import has from '@/utils/has'
 import type { TaskListResp, TaskQuery } from '@/apis/task/type'
 import { listTask, taskDel } from '@/apis/task/taskhome'
 import { TaskStatusList } from '@/constant/common'
@@ -94,7 +93,7 @@ const columns: TableInstanceColumns[] = [
     width: 350,
     align: 'center',
     fixed: !isMobile() ? 'right' : undefined,
-    show: has.hasPermOr(['system:notice:detail', 'system:notice:update', 'system:notice:delete']),
+    show: true,
   },
 ]
 

+ 98 - 0
src/views/team/jiangli/index.vue

@@ -0,0 +1,98 @@
+<template>
+  <div class="table-page">
+    <GiTable
+      row-key="id"
+      title="团队奖励列表"
+      :data="dataList"
+      :columns="columns"
+      :loading="loading"
+      :scroll="{ x: '100%', y: '100%', minWidth: 1200 }"
+      :pagination="pagination"
+      :disabled-tools="['size']"
+      :disabled-column-keys="['title']"
+      @refresh="search"
+    >
+      <template #toolbar-left>
+        <a-button @click="reset">
+          <template #icon><icon-refresh /></template>
+          <template #default>重置</template>
+        </a-button>
+      </template>
+      <template #toolbar-right>
+        <a-button type="primary" @click="onAdd">
+          <template #icon><icon-plus /></template>
+          <template #default>新增</template>
+        </a-button>
+      </template>
+      <template #action="{ record }">
+        <a-space>
+          <a-link title="修改" @click="onUpdate(record)">修改</a-link>
+          <a-link status="danger" title="删除" @click="onDelete(record)"> 删除 </a-link>
+        </a-space>
+      </template>
+    </GiTable>
+    <JiangliAddModal ref="JiangliAddModalRef" @save-success="search"></JiangliAddModal>
+  </div>
+</template>
+
+<script setup lang="ts">
+import JiangliAddModal from './jiangliAddModal.vue'
+import type { TableInstanceColumns } from '@/components/GiTable/type'
+import { useTable } from '@/hooks'
+import { isMobile } from '@/utils'
+import { listTeam, teamDel } from '@/apis/team/jiangli'
+import type { TeamListResp } from '@/apis/team/type'
+
+defineOptions({ name: 'Jiangli' })
+
+const {
+  tableData: dataList,
+  loading,
+  pagination,
+  search,
+  handleDelete,
+} = useTable((page) => listTeam({ ...page }), { immediate: true })
+const columns: TableInstanceColumns[] = [
+  {
+    title: '序号',
+    width: 66,
+    align: 'center',
+    render: ({ rowIndex }) => h('span', {}, rowIndex + 1 + (pagination.current - 1) * pagination.pageSize),
+  },
+  { title: '邀请个人奖励', dataIndex: 'inviteOneReward', slotName: 'inviteOneReward', align: 'center', width: 180 },
+  { title: '团队A个人奖励', dataIndex: 'teamAScale', slotName: 'teamAScale', align: 'center', width: 180 },
+  { title: '团队B个人奖励', dataIndex: 'teamBScale', slotName: 'teamBScale', align: 'center', width: 180 },
+  {
+    title: '操作',
+    dataIndex: 'action',
+    slotName: 'action',
+    width: 350,
+    align: 'center',
+    fixed: !isMobile() ? 'right' : undefined,
+    show: true,
+  },
+]
+
+// 重置
+const reset = () => {
+  search()
+}
+
+// 新增
+const JiangliAddModalRef = ref<InstanceType<typeof JiangliAddModal>>()
+const onAdd = () => {
+  JiangliAddModalRef.value?.onAdd()
+}
+const onUpdate = (record: TeamListResp) => {
+  JiangliAddModalRef.value?.onUpdate(record.id)
+}
+
+const onDelete = (record: TeamListResp) => {
+  return handleDelete(() => teamDel(record.id), {
+    content: `是否确定删除该团队奖励`,
+    showModal: true,
+  })
+}
+</script>
+
+<style scoped lang="scss"></style>

+ 94 - 0
src/views/team/jiangli/jiangliAddModal.vue

@@ -0,0 +1,94 @@
+<template>
+  <a-modal
+    v-model:visible="visible"
+    :title="title"
+    :mask-closable="false"
+    :esc-to-close="false"
+    :width="width >= 500 ? 500 : '100%'"
+    draggable
+    @before-ok="save"
+    @close="reset"
+  >
+    <GiForm ref="formRef" v-model="form" :options="options" :columns="columns">
+    </GiForm>
+  </a-modal>
+</template>
+
+<script setup lang="ts">
+import { Message } from '@arco-design/web-vue'
+import { useWindowSize } from '@vueuse/core'
+import type { Columns, GiForm, Options } from '@/components/GiForm'
+
+import { useResetReactive } from '@/hooks'
+import { teamById, teamPost, teamUpdata } from '@/apis/team/jiangli'
+
+const emit = defineEmits<{
+  (e: 'save-success'): void
+}>()
+
+const { width } = useWindowSize()
+
+const dataId = ref()
+const visible = ref(false)
+const isUpdate = computed(() => !!dataId.value)
+const title = computed(() => (isUpdate.value ? '修改团队奖励' : '新增团队奖励'))
+const formRef = ref<InstanceType<typeof GiForm>>()
+
+const [form, resetForm] = useResetReactive({
+
+})
+const options: Options = {
+  form: { size: 'large' },
+  btns: { hide: true },
+}
+const columns: Columns = reactive([
+  { label: '邀请个人奖励', field: 'inviteOneReward', type: 'input', rules: [{ required: true, message: '请输入邀请个人奖励' }] },
+  { label: '团队A个人奖励', field: 'teamAScale', type: 'input', rules: [{ required: true, message: '请输入团队A个人奖励' }] },
+  { label: '团队B个人奖励', field: 'teamBScale', type: 'input', rules: [{ required: true, message: '请输入团队B个人奖励' }] },
+])
+
+// 重置
+const reset = () => {
+  formRef.value?.formRef?.resetFields()
+  resetForm()
+}
+
+// 保存
+const save = async () => {
+  try {
+    const isInvalid = await formRef.value?.formRef?.validate()
+    if (isInvalid) return false
+    if (isUpdate.value) {
+      await teamUpdata(dataId.value, form)
+      Message.success('修改成功')
+    } else {
+      await teamPost({ ...form })
+      Message.success('新增成功')
+    }
+    emit('save-success')
+    return true
+  } catch (error) {
+    return false
+  }
+}
+
+// 新增
+const onAdd = () => {
+  reset()
+  dataId.value = null
+  visible.value = true
+}
+
+// 修改
+const onUpdate = async (id: number) => {
+  reset()
+  dataId.value = id
+  const { data } = await teamById(id)
+  Object.assign(form, data[0])
+  visible.value = true
+}
+
+defineExpose({ onAdd, onUpdate })
+</script>
+
+<style scoped lang="scss"></style>

+ 1 - 2
src/views/user/jiangli/index.vue

@@ -44,7 +44,6 @@ import JiangliAddModal from './jiangliAddModal.vue'
 import type { TableInstanceColumns } from '@/components/GiTable/type'
 import { useTable } from '@/hooks'
 import { isMobile } from '@/utils'
-import has from '@/utils/has'
 import type { JiangliListResp, JiangliQuery } from '@/apis/user/type'
 import { jiangliDel, listJiangli } from '@/apis/user/userlist'
 
@@ -77,7 +76,7 @@ const columns: TableInstanceColumns[] = [
     width: 350,
     align: 'center',
     fixed: !isMobile() ? 'right' : undefined,
-    show: has.hasPermOr(['system:notice:detail', 'system:notice:update', 'system:notice:delete']),
+    show: true,
   },
 ]
 

+ 2 - 3
src/views/user/userlist/index.vue

@@ -43,7 +43,7 @@
           <a-link title="一级" @click="onDetail(record)">一级</a-link>
           <a-link title="二级" @click="onDetail(record)">二级</a-link>
           <a-link title="空投" @click="onDetail(record)">空投</a-link>
-          <a-link title="升级成分销商" @click="onDetail(record)">升级成分销商</a-link>
+          <a-link title="空投" @click="onDetail(record)">禁用</a-link>
           <!--          <a-link v-permission="['system:notice:update']" title="修改" @click="onUpdate(record)">修改</a-link> -->
           <!--          <a-link v-permission="['system:notice:delete']" status="danger" title="删除" @click="onDelete(record)"> 删除 </a-link> -->
         </a-space>
@@ -57,7 +57,6 @@ import type { TableInstanceColumns } from '@/components/GiTable/type'
 import { useTable } from '@/hooks'
 import { useDict } from '@/hooks/app'
 import { isMobile } from '@/utils'
-import has from '@/utils/has'
 import DateRangePicker from '@/components/DateRangePicker/index.vue'
 import type { UserListResp, UserQuery } from '@/apis/user/type'
 import { listUserTg } from '@/apis/user/userlist'
@@ -101,7 +100,7 @@ const columns: TableInstanceColumns[] = [
     width: 350,
     align: 'center',
     fixed: !isMobile() ? 'right' : undefined,
-    show: has.hasPermOr(['system:notice:detail', 'system:notice:update', 'system:notice:delete']),
+    show: true,
   },
 ]