|
@@ -2,6 +2,7 @@
|
|
|
import Table from '@/components/Table.vue'
|
|
|
import Dialog from '@/components/common/Dialog.vue'
|
|
|
import { useRequest } from '@/hooks/useRequest'
|
|
|
+import { useCommonStore } from '@/stores/useCommon'
|
|
|
|
|
|
import type { TablePaginationSetting, TableFieldInfo, QueryInfo, SelectInfo } from '@/types/table'
|
|
|
import { FieldSpecialEffectType, FilterType } from '@/types/table'
|
|
@@ -11,14 +12,18 @@ import { type DialogConfig } from '@/types/dialog'
|
|
|
import { FormFieldType } from '@/types/form'
|
|
|
import type { FormField } from '@/types/form'
|
|
|
|
|
|
-import { reactive, onMounted, ref } from 'vue'
|
|
|
+import { reactive, onMounted, ref, watch } from 'vue'
|
|
|
|
|
|
import router from '@/router'
|
|
|
|
|
|
+const { selectInfo } = useCommonStore()
|
|
|
+
|
|
|
const { AllApi } = useRequest()
|
|
|
|
|
|
const eventDialog = ref()
|
|
|
|
|
|
+const eventTable = ref()
|
|
|
+
|
|
|
// 主要为了给面包屑导航提供信息
|
|
|
const emits = defineEmits(['enterDetail'])
|
|
|
|
|
@@ -33,6 +38,12 @@ const pagingConfig = reactive<TablePaginationSetting>({
|
|
|
// 表格字段信息
|
|
|
const tableFieldsInfo = reactive<Array<TableFieldInfo>>([
|
|
|
{
|
|
|
+ name: 'id',
|
|
|
+ cnName: 'ID',
|
|
|
+ isShow: true,
|
|
|
+ needSort: true
|
|
|
+ },
|
|
|
+ {
|
|
|
name: 'gid',
|
|
|
cnName: '游戏ID',
|
|
|
isShow: true,
|
|
@@ -72,7 +83,7 @@ const tableFieldsInfo = reactive<Array<TableFieldInfo>>([
|
|
|
name: 'createdAt',
|
|
|
cnName: '创建时间',
|
|
|
isShow: true,
|
|
|
- needSort: true
|
|
|
+ needSort: false
|
|
|
},
|
|
|
{
|
|
|
name: 'updatedAt',
|
|
@@ -85,7 +96,9 @@ const tableFieldsInfo = reactive<Array<TableFieldInfo>>([
|
|
|
// 表格请求配置
|
|
|
const requestConfig = reactive<ReqConfig>({
|
|
|
url: AllApi.gameActionList,
|
|
|
- otherOptions: {}
|
|
|
+ otherOptions: {
|
|
|
+ gid: selectInfo.gid
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
// 事件类型查询信息
|
|
@@ -97,12 +110,12 @@ const eventStatus: Array<SelectInfo> = [
|
|
|
},
|
|
|
{
|
|
|
name: 'use',
|
|
|
- cnName: '已使用',
|
|
|
+ cnName: '启用',
|
|
|
value: '1'
|
|
|
},
|
|
|
{
|
|
|
name: 'nouse',
|
|
|
- cnName: '已弃用',
|
|
|
+ cnName: '禁用',
|
|
|
value: '0'
|
|
|
}
|
|
|
]
|
|
@@ -128,66 +141,75 @@ const queryInfo: Array<QueryInfo> = [
|
|
|
|
|
|
// 对话框表单规则字段
|
|
|
const dilogRuleForm = reactive({
|
|
|
- eventDisplayName: '',
|
|
|
- platform: ''
|
|
|
+ actionId: '',
|
|
|
+ actionName: '',
|
|
|
+ remark: '',
|
|
|
+ status: ''
|
|
|
})
|
|
|
|
|
|
// 对话表单规则
|
|
|
const dialogRules = reactive<FormRules<typeof dilogRuleForm>>({
|
|
|
- eventDisplayName: [
|
|
|
- { required: true, message: 'Event Display Name is required', trigger: 'blur' },
|
|
|
- {
|
|
|
- min: 5,
|
|
|
- max: 10,
|
|
|
- message: 'Event Display Name must be between 5 and 10 characters',
|
|
|
- trigger: 'blur'
|
|
|
- }
|
|
|
+ actionId: [
|
|
|
+ { required: true, message: '事件ID是必填项', trigger: 'blur' },
|
|
|
+ { min: 1, max: 10, message: '事件ID长度必须在1到10之间', trigger: 'blur' }
|
|
|
],
|
|
|
- platform: [
|
|
|
- { required: true, message: 'Platform is required', trigger: 'change' },
|
|
|
- {
|
|
|
- type: 'enum',
|
|
|
- enum: ['web', 'wx', 'tt'],
|
|
|
- message: 'Platform must be either "web", "wx", or "tt"',
|
|
|
- trigger: 'change'
|
|
|
- }
|
|
|
+ actionName: [
|
|
|
+ { required: true, message: '事件名称是必填项', trigger: 'blur' },
|
|
|
+ { min: 5, max: 20, message: '事件名称长度必须在5到20之间', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ remark: [
|
|
|
+ { required: false, message: '备注是可选项', trigger: 'blur' },
|
|
|
+ { max: 100, message: '备注长度不能超过100个字符', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ status: [
|
|
|
+ { required: true, message: '是否启用是必选项', trigger: 'change' },
|
|
|
+ { type: 'number', message: '启用状态必须是数字', trigger: 'change' }
|
|
|
]
|
|
|
})
|
|
|
|
|
|
// 对话框请求参数
|
|
|
const dialogReq = reactive<ReqConfig>({
|
|
|
- url: AllApi.mockEvent,
|
|
|
- otherOptions: {}
|
|
|
+ url: AllApi.setGameAction,
|
|
|
+ otherOptions: {
|
|
|
+ formData: {
|
|
|
+ gid: selectInfo.gid
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
// 对话框表单字段信息
|
|
|
const FormFields: Array<FormField> = [
|
|
|
{
|
|
|
- name: 'eventDisplayName',
|
|
|
- cnName: '事件名',
|
|
|
+ name: 'actionId',
|
|
|
+ cnName: '事件ID',
|
|
|
+ type: FormFieldType.INPUT
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'actionName',
|
|
|
+ cnName: '事件名称',
|
|
|
type: FormFieldType.INPUT
|
|
|
},
|
|
|
{
|
|
|
- name: 'platform',
|
|
|
- cnName: '平台',
|
|
|
+ name: 'remark',
|
|
|
+ cnName: '备注',
|
|
|
+ type: FormFieldType.RICHTEXT
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'status',
|
|
|
+ cnName: '是否启用',
|
|
|
type: FormFieldType.SELECT,
|
|
|
otherOptions: {
|
|
|
- placeholder: '请选择平台',
|
|
|
+ placeholder: '请选择启用状态',
|
|
|
options: [
|
|
|
{
|
|
|
- name: 'wx',
|
|
|
- label: '微信',
|
|
|
- value: 'wx'
|
|
|
+ name: 'use',
|
|
|
+ label: '启用',
|
|
|
+ value: 1
|
|
|
},
|
|
|
{
|
|
|
- name: 'tt',
|
|
|
- label: '抖音',
|
|
|
- value: 'tt'
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'web',
|
|
|
- label: 'Web',
|
|
|
- value: 'web'
|
|
|
+ name: 'nouse',
|
|
|
+ label: '禁用',
|
|
|
+ value: 0
|
|
|
}
|
|
|
]
|
|
|
}
|
|
@@ -231,12 +253,28 @@ const addNewEvent = () => {
|
|
|
eventDialog.value.addForm()
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * @description: 表单提交
|
|
|
+ * @return {*}
|
|
|
+ */
|
|
|
+const subForm = () => {
|
|
|
+ eventTable.value.getData()
|
|
|
+}
|
|
|
+
|
|
|
+watch(
|
|
|
+ () => selectInfo.gid,
|
|
|
+ (val: string) => {
|
|
|
+ requestConfig.otherOptions.gid = val
|
|
|
+ }
|
|
|
+)
|
|
|
+
|
|
|
onMounted(() => {})
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div>
|
|
|
<Table
|
|
|
+ ref="eventTable"
|
|
|
:need-rowindex="false"
|
|
|
:request-config="requestConfig"
|
|
|
:open-page-query="true"
|
|
@@ -258,7 +296,7 @@ onMounted(() => {})
|
|
|
</template>
|
|
|
</Table>
|
|
|
<div class="eventDialog">
|
|
|
- <Dialog ref="eventDialog" :config="dialogInfo"></Dialog>
|
|
|
+ <Dialog ref="eventDialog" @form-submit="subForm" :config="dialogInfo"></Dialog>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|