mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-12-24 08:12:55 +08:00
大量更改,主要是int,float类型支持null、字符串
This commit is contained in:
@@ -1,88 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
import type { Pages } from '@/utils/request'
|
||||
|
||||
import config from '@/config'
|
||||
import queryString from 'query-string'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { clearEmpty } from '@/utils/util'
|
||||
|
||||
export type type_system_log_sms = {
|
||||
Id?: number
|
||||
Scene?: number
|
||||
Mobile?: string
|
||||
Content?: string
|
||||
Status?: number
|
||||
Results?: string
|
||||
SendTime?: string
|
||||
CreateTime?: string
|
||||
UpdateTime?: string
|
||||
}
|
||||
// 查询
|
||||
export type type_system_log_sms_query = {
|
||||
Scene?: number
|
||||
Mobile?: string
|
||||
Content?: string
|
||||
Status?: number
|
||||
Results?: string
|
||||
SendTimeStart?: string
|
||||
SendTimeEnd?: string
|
||||
CreateTimeStart?: string
|
||||
CreateTimeEnd?: string
|
||||
UpdateTimeStart?: string
|
||||
UpdateTimeEnd?: string
|
||||
}
|
||||
// 添加编辑
|
||||
export type type_system_log_sms_edit = {
|
||||
Id?: number
|
||||
Scene?: number
|
||||
Mobile?: string
|
||||
Content?: string
|
||||
Status?: number
|
||||
Results?: string
|
||||
SendTime?: string
|
||||
}
|
||||
|
||||
// 系统短信日志列表
|
||||
export function system_log_sms_list(params?: type_system_log_sms_query) {
|
||||
return request.get<Pages<type_system_log_sms>>({
|
||||
url: '/system_log_sms/list',
|
||||
params: clearEmpty(params)
|
||||
})
|
||||
}
|
||||
// 系统短信日志列表-所有
|
||||
export function system_log_sms_list_all(params?: type_system_log_sms_query) {
|
||||
return request.get<type_system_log_sms[]>({
|
||||
url: '/system_log_sms/listAll',
|
||||
params: clearEmpty(params)
|
||||
})
|
||||
}
|
||||
|
||||
// 系统短信日志详情
|
||||
export function system_log_sms_detail(Id: number | string) {
|
||||
return request.get<type_system_log_sms>({ url: '/system_log_sms/detail', params: { Id } })
|
||||
}
|
||||
|
||||
// 系统短信日志新增
|
||||
export function system_log_sms_add(data: type_system_log_sms_edit) {
|
||||
return request.post<null>({ url: '/system_log_sms/add', data })
|
||||
}
|
||||
|
||||
// 系统短信日志编辑
|
||||
export function system_log_sms_edit(data: type_system_log_sms_edit) {
|
||||
return request.post<null>({ url: '/system_log_sms/edit', data })
|
||||
}
|
||||
|
||||
// 系统短信日志删除
|
||||
export function system_log_sms_delete(Id: number | string) {
|
||||
return request.post<null>({ url: '/system_log_sms/del', data: { Id } })
|
||||
}
|
||||
|
||||
// 系统短信日志导入
|
||||
export const system_log_sms_import_file = '/system_log_sms/ImportFile'
|
||||
|
||||
// 系统短信日志导出
|
||||
export function system_log_sms_export_file(params: any) {
|
||||
return (window.location.href =
|
||||
`${config.baseUrl}${config.urlPrefix}/system_log_sms/ExportFile?token=${getToken()}&` +
|
||||
queryString.stringify(clearEmpty(params)))
|
||||
}
|
||||
72
admin/src/api/user/protocol.ts
Normal file
72
admin/src/api/user/protocol.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import request from '@/utils/request'
|
||||
import type { Pages } from '@/utils/request'
|
||||
|
||||
import config from '@/config'
|
||||
import queryString from 'query-string'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { clearEmpty } from '@/utils/util'
|
||||
|
||||
export type type_user_protocol = {
|
||||
Id?: number
|
||||
Title?: string
|
||||
Content?: string
|
||||
Sort?: number
|
||||
IsDelete?: number
|
||||
CreateTime?: string
|
||||
UpdateTime?: string
|
||||
DeleteTime?: string
|
||||
}
|
||||
// 查询
|
||||
export type type_user_protocol_query = {
|
||||
Title?: string
|
||||
Content?: string
|
||||
Sort?: number
|
||||
CreateTimeStart?: string
|
||||
CreateTimeEnd?: string
|
||||
UpdateTimeStart?: string
|
||||
UpdateTimeEnd?: string
|
||||
}
|
||||
// 添加编辑
|
||||
export type type_user_protocol_edit = {
|
||||
Id?: number
|
||||
Title?: string
|
||||
Content?: string
|
||||
Sort?: number
|
||||
}
|
||||
|
||||
// 用户协议列表
|
||||
export function user_protocol_list(params?: type_user_protocol_query) {
|
||||
return request.get<Pages<type_user_protocol>>({ url: '/user_protocol/list', params: clearEmpty(params) })
|
||||
}
|
||||
// 用户协议列表-所有
|
||||
export function user_protocol_list_all(params?: type_user_protocol_query) {
|
||||
return request.get<type_user_protocol[]>({ url: '/user_protocol/listAll', params: clearEmpty(params) })
|
||||
}
|
||||
|
||||
// 用户协议详情
|
||||
export function user_protocol_detail(Id: number | string) {
|
||||
return request.get<type_user_protocol>({ url: '/user_protocol/detail', params: { Id } })
|
||||
}
|
||||
|
||||
// 用户协议新增
|
||||
export function user_protocol_add(data: type_user_protocol_edit) {
|
||||
return request.post<null>({ url: '/user_protocol/add', data })
|
||||
}
|
||||
|
||||
// 用户协议编辑
|
||||
export function user_protocol_edit(data: type_user_protocol_edit) {
|
||||
return request.post<null>({ url: '/user_protocol/edit', data })
|
||||
}
|
||||
|
||||
// 用户协议删除
|
||||
export function user_protocol_delete(Id: number | string) {
|
||||
return request.post<null>({ url: '/user_protocol/del', data: { Id } })
|
||||
}
|
||||
|
||||
// 用户协议导入
|
||||
export const user_protocol_import_file = '/user_protocol/ImportFile'
|
||||
|
||||
// 用户协议导出
|
||||
export function user_protocol_export_file(params: any) {
|
||||
return (window.location.href =`${config.baseUrl}${config.urlPrefix}/user_protocol/ExportFile?token=${getToken()}&` + queryString.stringify(clearEmpty(params)))
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
:title="popupTitle"
|
||||
:async="true"
|
||||
width="550px"
|
||||
:clickModalClose="true"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
||||
<el-form-item label="场景编号" prop="Scene">
|
||||
<el-input v-model="formData.Scene" type="number" placeholder="请输入场景编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号码" prop="Mobile">
|
||||
<el-input v-model="formData.Mobile" placeholder="请输入手机号码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发送内容" prop="Content">
|
||||
<editor v-model="formData.Content" :height="500" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发送状态:[0=发送中, 1=发送成功, 2=发送失败]" prop="Status">
|
||||
<el-radio-group
|
||||
v-model="formData.Status"
|
||||
placeholder="请选择发送状态:[0=发送中, 1=发送成功, 2=发送失败]"
|
||||
>
|
||||
<el-radio label="0">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="短信结果" prop="Results">
|
||||
<el-input
|
||||
v-model="formData.Results"
|
||||
placeholder="请输入短信结果"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 4, maxRows: 6 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="发送时间" prop="SendTime">
|
||||
<el-date-picker
|
||||
class="flex-1 !flex"
|
||||
v-model="formData.SendTime"
|
||||
type="datetime"
|
||||
clearable
|
||||
value-format="YYYY-MM-DD hh:mm:ss"
|
||||
placeholder="请选择发送时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import {
|
||||
system_log_sms_edit,
|
||||
system_log_sms_add,
|
||||
system_log_sms_detail
|
||||
} from '@/api/system_log_sms'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
},
|
||||
listAllData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
const popupTitle = computed(() => {
|
||||
return mode.value == 'edit' ? '编辑系统短信日志' : '新增系统短信日志'
|
||||
})
|
||||
|
||||
const formData = reactive({
|
||||
Id: null,
|
||||
Scene: null,
|
||||
Mobile: null,
|
||||
Content: null,
|
||||
Status: null,
|
||||
Results: null,
|
||||
SendTime: null
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
Id: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入id',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
Scene: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入场景编号',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
Mobile: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入手机号码',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
Content: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入发送内容',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
Status: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择发送状态:[0=发送中, 1=发送成功, 2=发送失败]',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
Results: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入短信结果',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
SendTime: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择发送时间',
|
||||
trigger: ['blur']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
await formRef.value?.validate()
|
||||
const data: any = { ...formData }
|
||||
mode.value == 'edit' ? await system_log_sms_edit(data) : await system_log_sms_add(data)
|
||||
popupRef.value?.close()
|
||||
feedback.msgSuccess('操作成功')
|
||||
emit('success')
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
const open = (type = 'add') => {
|
||||
mode.value = type
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
const setFormData = async (data: Record<string, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
try {
|
||||
const data = await system_log_sms_detail(row.Id)
|
||||
setFormData(data)
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
||||
129
admin/src/views/user/protocol/edit.vue
Normal file
129
admin/src/views/user/protocol/edit.vue
Normal file
@@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
:title="popupTitle"
|
||||
:async="true"
|
||||
width="550px"
|
||||
:clickModalClose="true"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
||||
<el-form-item label="标题" prop="Title">
|
||||
<el-input v-model="formData.Title" placeholder="请输入标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="协议内容" prop="Content">
|
||||
<editor v-model="formData.Content" :height="500" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="Sort">
|
||||
<el-input v-model="formData.Sort" type="number" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { user_protocol_edit, user_protocol_add, user_protocol_detail } from '@/api/user/protocol'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
},
|
||||
listAllData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
const popupTitle = computed(() => {
|
||||
return mode.value == 'edit' ? '编辑用户协议' : '新增用户协议'
|
||||
})
|
||||
|
||||
const formData = reactive({
|
||||
Id: null,
|
||||
Title: null,
|
||||
Content: null,
|
||||
Sort: null
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
Id: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
Title: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入标题',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
Content: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入协议内容',
|
||||
trigger: ['blur']
|
||||
}
|
||||
]
|
||||
// Sort: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '请输入排序',
|
||||
// trigger: ['blur']
|
||||
// }
|
||||
// ],
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
await formRef.value?.validate()
|
||||
const data: any = { ...formData }
|
||||
mode.value == 'edit' ? await user_protocol_edit(data) : await user_protocol_add(data)
|
||||
popupRef.value?.close()
|
||||
feedback.msgSuccess('操作成功')
|
||||
emit('success')
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
const open = (type = 'add') => {
|
||||
mode.value = type
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
const setFormData = async (data: Record<string, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
try {
|
||||
const data = await user_protocol_detail(row.Id)
|
||||
setFormData(data)
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
||||
@@ -3,22 +3,8 @@
|
||||
<el-card class="!border-none" shadow="never">
|
||||
<el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true" label-width="70px"
|
||||
label-position="left">
|
||||
<el-form-item label="手机号码" prop="Mobile" class="w-[280px]">
|
||||
<el-input v-model="queryParams.Mobile" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发送状态:[0=发送中, 1=发送成功, 2=发送失败]" prop="Status" class="w-[280px]">
|
||||
<el-select
|
||||
v-model="queryParams.Status"
|
||||
clearable
|
||||
>
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="发送时间" prop="SendTime" class="w-[280px]">
|
||||
<daterange-picker
|
||||
v-model:startTime="queryParams.SendTimeStart"
|
||||
v-model:endTime="queryParams.SendTimeEnd"
|
||||
/>
|
||||
<el-form-item label="标题" prop="Title" class="w-[280px]">
|
||||
<el-input v-model="queryParams.Title" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="CreateTime" class="w-[280px]">
|
||||
<daterange-picker
|
||||
@@ -40,7 +26,7 @@
|
||||
</el-card>
|
||||
<el-card class="!border-none mt-4" shadow="never">
|
||||
<div>
|
||||
<el-button v-perms="['admin:system_log_sms:add']" type="primary" @click="handleAdd()">
|
||||
<el-button v-perms="['admin:user_protocol:add']" type="primary" @click="handleAdd()">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
@@ -48,7 +34,7 @@
|
||||
</el-button>
|
||||
<upload
|
||||
class="ml-3 mr-3"
|
||||
:url="system_log_sms_import_file"
|
||||
:url="user_protocol_import_file"
|
||||
:data="{ cid: 0 }"
|
||||
type="file"
|
||||
:show-progress="true"
|
||||
@@ -74,18 +60,15 @@
|
||||
v-loading="pager.loading"
|
||||
:data="pager.lists"
|
||||
>
|
||||
<el-table-column label="场景编号" prop="Scene" min-width="130" />
|
||||
<el-table-column label="手机号码" prop="Mobile" min-width="130" />
|
||||
<el-table-column label="发送内容" prop="Content" min-width="130" />
|
||||
<el-table-column label="发送状态:[0=发送中, 1=发送成功, 2=发送失败]" prop="Status" min-width="130" />
|
||||
<el-table-column label="短信结果" prop="Results" min-width="130" />
|
||||
<el-table-column label="发送时间" prop="SendTime" min-width="130" />
|
||||
<el-table-column label="标题" prop="Title" min-width="130" />
|
||||
<el-table-column label="协议内容" prop="Content" min-width="130" />
|
||||
<el-table-column label="排序" prop="Sort" min-width="130" />
|
||||
<el-table-column label="创建时间" prop="CreateTime" min-width="130" />
|
||||
<el-table-column label="更新时间" prop="UpdateTime" min-width="130" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-perms="['admin:system_log_sms:edit']"
|
||||
v-perms="['admin:user_protocol:edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(row)"
|
||||
@@ -93,7 +76,7 @@
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['admin:system_log_sms:del']"
|
||||
v-perms="['admin:user_protocol:del']"
|
||||
type="danger"
|
||||
link
|
||||
@click="handleDelete(row.Id)"
|
||||
@@ -116,8 +99,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { system_log_sms_delete, system_log_sms_list,system_log_sms_import_file, system_log_sms_export_file } from '@/api/system_log_sms'
|
||||
import type { type_system_log_sms,type_system_log_sms_query } from "@/api/system_log_sms";
|
||||
import { user_protocol_delete, user_protocol_list,user_protocol_import_file, user_protocol_export_file } from '@/api/user/protocol'
|
||||
import type { type_user_protocol,type_user_protocol_query } from "@/api/user/protocol";
|
||||
|
||||
|
||||
import { useDictData,useListAllData } from '@/hooks/useDictOptions'
|
||||
@@ -127,26 +110,22 @@ import { usePaging } from '@/hooks/usePaging'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
defineOptions({
|
||||
name:"system_log_sms"
|
||||
name:"user_protocol"
|
||||
})
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
const showEdit = ref(false)
|
||||
const queryParams = reactive<type_system_log_sms_query>({
|
||||
Scene: null,
|
||||
Mobile: null,
|
||||
const queryParams = reactive<type_user_protocol_query>({
|
||||
Title: null,
|
||||
Content: null,
|
||||
Status: null,
|
||||
Results: null,
|
||||
SendTimeStart: null,
|
||||
SendTimeEnd: null,
|
||||
Sort: null,
|
||||
CreateTimeStart: null,
|
||||
CreateTimeEnd: null,
|
||||
UpdateTimeStart: null,
|
||||
UpdateTimeEnd: null,
|
||||
})
|
||||
|
||||
const { pager, getLists, resetPage, resetParams } = usePaging<type_system_log_sms>({
|
||||
fetchFun: system_log_sms_list,
|
||||
const { pager, getLists, resetPage, resetParams } = usePaging<type_user_protocol>({
|
||||
fetchFun: user_protocol_list,
|
||||
params: queryParams
|
||||
})
|
||||
|
||||
@@ -167,7 +146,7 @@ const handleEdit = async (data: any) => {
|
||||
const handleDelete = async (Id: number) => {
|
||||
try {
|
||||
await feedback.confirm('确定要删除?')
|
||||
await system_log_sms_delete( Id )
|
||||
await user_protocol_delete( Id )
|
||||
feedback.msgSuccess('删除成功')
|
||||
getLists()
|
||||
} catch (error) {}
|
||||
@@ -175,7 +154,7 @@ const handleDelete = async (Id: number) => {
|
||||
const exportFile = async () => {
|
||||
try {
|
||||
await feedback.confirm('确定要导出?')
|
||||
await system_log_sms_export_file(queryParams)
|
||||
await user_protocol_export_file(queryParams)
|
||||
} catch (error) {}
|
||||
}
|
||||
getLists()
|
||||
Reference in New Issue
Block a user