This commit is contained in:
zhoutianchi
2026-01-14 10:52:06 +08:00
parent 8c1f4ec05e
commit d0c8ea0223
140 changed files with 16969 additions and 11469 deletions

View File

@@ -0,0 +1,288 @@
<!--
- Copyright (c) 2018-2025, cyweb All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- Neither the name of the pig4cloud.com developer nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-->
<template>
<div class="layout-padding">
<div class="layout-padding-auto layout-padding-view">
<!-- 搜索表单 -->
<el-form :model="queryForm" inline class="mb-4">
<el-form-item>
<el-button type="primary" icon="Search" @click="getDataList">查询</el-button>
<el-button type="primary" plain icon="Refresh" class="ml10" @click="resetQuery">重置</el-button>
</el-form-item>
<el-form-item v-if="permissions.recruit_recruitstudentsignupturnovermoneychange_add">
<el-button type="primary" icon="FolderAdd" class="ml10" @click="handleAdd">新增</el-button>
</el-form-item>
</el-form>
<!-- 表格 -->
<el-table
ref="tableRef"
:data="state.dataList"
v-loading="state.loading"
border
stripe
:cell-style="tableStyle.cellStyle"
:header-cell-style="tableStyle.headerCellStyle"
>
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="turnOverId" label="异动ID" align="center" show-overflow-tooltip />
<el-table-column prop="type" label="退补类型 1学费 2代办费 3捐资费" align="center" show-overflow-tooltip />
<el-table-column prop="oldFee" label="原费用" align="center" show-overflow-tooltip />
<el-table-column prop="newFee" label="变更后费用" align="center" show-overflow-tooltip />
<el-table-column prop="fee" label="变更费用" align="center" show-overflow-tooltip />
<el-table-column prop="incOrDec" label="补还是退 1补 2退" align="center" show-overflow-tooltip />
<el-table-column prop="pushed" label="是否推送,预留字段,单项推送则需要该字段" align="center" show-overflow-tooltip />
<el-table-column prop="pushFailReason" label="推送失败原因" align="center" show-overflow-tooltip />
<el-table-column prop="createBy" label="创建者" align="center" show-overflow-tooltip />
<el-table-column prop="createDate" label="创建时间" align="center" show-overflow-tooltip />
<el-table-column label="操作" width="150" align="center" fixed="right">
<template #default="scope">
<el-button
v-if="permissions.recruit_recruitstudentsignupturnovermoneychange_edit"
type="primary"
link
icon="EditPen"
@click="handleEdit(scope.row)"
>
编辑
</el-button>
<el-button
v-if="permissions.recruit_recruitstudentsignupturnovermoneychange_del"
type="danger"
link
icon="Delete"
@click="handleDel(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination
v-bind="state.pagination"
@current-change="currentChangeHandle"
@size-change="sizeChangeHandle"
/>
<!-- 新增/编辑弹窗 -->
<el-dialog
v-model="dialogVisible"
:title="form.id ? '编辑' : '新增'"
width="600px"
:close-on-click-modal="false"
destroy-on-close
>
<el-form
ref="formRef"
:model="form"
:rules="formRules"
label-width="200px"
>
<el-form-item label="异动ID" prop="turnOverId">
<el-input v-model="form.turnOverId" placeholder="请输入异动ID" clearable />
</el-form-item>
<el-form-item label="退补类型" prop="type">
<el-select v-model="form.type" placeholder="请选择退补类型" clearable style="width: 100%">
<el-option label="学费" value="1" />
<el-option label="代办费" value="2" />
<el-option label="捐资费" value="3" />
</el-select>
</el-form-item>
<el-form-item label="原费用" prop="oldFee">
<el-input-number v-model="form.oldFee" :min="0" :precision="2" placeholder="请输入原费用" style="width: 100%" />
</el-form-item>
<el-form-item label="变更后费用" prop="newFee">
<el-input-number v-model="form.newFee" :min="0" :precision="2" placeholder="请输入变更后费用" style="width: 100%" />
</el-form-item>
<el-form-item label="变更费用" prop="fee">
<el-input-number v-model="form.fee" :precision="2" placeholder="请输入变更费用" style="width: 100%" />
</el-form-item>
<el-form-item label="补还是退" prop="incOrDec">
<el-select v-model="form.incOrDec" placeholder="请选择补还是退" clearable style="width: 100%">
<el-option label="补" value="1" />
<el-option label="退" value="2" />
</el-select>
</el-form-item>
<el-form-item label="是否推送" prop="pushed">
<el-select v-model="form.pushed" placeholder="请选择是否推送" clearable style="width: 100%">
<el-option label="是" value="1" />
<el-option label="否" value="0" />
</el-select>
</el-form-item>
<el-form-item label="推送失败原因" prop="pushFailReason">
<el-input v-model="form.pushFailReason" type="textarea" :rows="3" placeholder="请输入推送失败原因" clearable />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleSubmit" :loading="submitLoading">确定</el-button>
</div>
</template>
</el-dialog>
</div>
</div>
</template>
<script setup lang="ts" name="recruitstudentsignupturnovermoneychange">
import { ref, reactive, computed, onMounted } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { BasicTableProps, useTable } from '/@/hooks/table'
import { useMessage, useMessageBox } from '/@/hooks/message'
import { addObj, delObj, fetchList, putObj } from '/@/api/recruit/recruitstudentsignupturnovermoneychange'
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks
const message = useMessage()
const messageBox = useMessageBox()
// 表格引用
const tableRef = ref()
const formRef = ref()
// 弹窗状态
const dialogVisible = ref(false)
const submitLoading = ref(false)
// 查询表单
const queryForm = reactive({})
// 表单数据
const form = reactive({
id: '',
turnOverId: '',
type: '',
oldFee: undefined,
newFee: undefined,
fee: undefined,
incOrDec: '',
pushed: '',
pushFailReason: ''
})
// 表单验证规则
const formRules = {}
// 表格状态
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: queryForm,
pageList: async (params: any) => {
const response = await fetchList(params)
return {
data: {
records: response.data.data.records,
total: response.data.data.total
}
}
}
})
// 使用 table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state)
// 重置查询
const resetQuery = () => {
Object.keys(queryForm).forEach(key => {
queryForm[key] = ''
})
getDataList()
}
// 新增
const handleAdd = () => {
Object.keys(form).forEach(key => {
if (key === 'id') {
form[key] = ''
} else if (typeof form[key] === 'number') {
form[key] = undefined
} else {
form[key] = ''
}
})
dialogVisible.value = true
}
// 编辑
const handleEdit = async (row: any) => {
Object.keys(form).forEach(key => {
form[key] = row[key]
})
dialogVisible.value = true
}
// 删除
const handleDel = async (row: any) => {
try {
await messageBox.confirm(`是否确认删除ID为${row.id}的记录?`)
await delObj(row.id)
message.success('删除成功')
getDataList()
} catch {
// 用户取消
}
}
// 提交表单
const handleSubmit = async () => {
if (!formRef.value) return
await formRef.value.validate(async (valid: boolean) => {
if (valid) {
submitLoading.value = true
try {
if (form.id) {
await putObj(form)
message.success('修改成功')
} else {
await addObj(form)
message.success('添加成功')
}
dialogVisible.value = false
getDataList()
} catch (error: any) {
message.error(error.msg || '操作失败')
} finally {
submitLoading.value = false
}
}
})
}
onMounted(() => {
getDataList()
})
</script>
<style lang="scss" scoped>
</style>