Merge branch 'master' of http://gitea.zianxin.com/zianxin-tec/biz-pc-cloud
This commit is contained in:
commit
f6a2fb9c7f
6 files changed
+645
No files matched your search
@@ -0,0 +1,48 @@
|
|||||||
|
import request from "/@/utils/request"
|
||||||
|
|
||||||
|
export function pageJoin(query?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/admin/sys-user-transaction/page-join",
|
||||||
|
method: "get",
|
||||||
|
params: query,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fetchList(query?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/admin/sys-user-transaction/page",
|
||||||
|
method: "get",
|
||||||
|
params: query,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addObj(obj?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/admin/sys-user-transaction",
|
||||||
|
method: "post",
|
||||||
|
data: obj,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getObj(id?: string) {
|
||||||
|
return request({
|
||||||
|
url: "/admin/sys-user-transaction/" + id,
|
||||||
|
method: "get",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function delObjs(ids?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/admin/sys-user-transaction",
|
||||||
|
method: "delete",
|
||||||
|
data: ids,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function putObj(obj?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/admin/sys-user-transaction",
|
||||||
|
method: "put",
|
||||||
|
data: obj,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import request from "/@/utils/request"
|
||||||
|
|
||||||
|
export function fetchList(query?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/hard/hard-appt/page",
|
||||||
|
method: "get",
|
||||||
|
params: query,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addObj(obj?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/hard/hard-appt",
|
||||||
|
method: "post",
|
||||||
|
data: obj,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getObj(id?: string) {
|
||||||
|
return request({
|
||||||
|
url: "/hard/hard-appt/" + id,
|
||||||
|
method: "get",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function delObjs(ids?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/hard/hard-appt",
|
||||||
|
method: "delete",
|
||||||
|
data: ids,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function putObj(obj?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/hard/hard-appt",
|
||||||
|
method: "put",
|
||||||
|
data: obj,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
|
||||||
|
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="用户id" prop="userId">
|
||||||
|
<el-input v-model="form.userId" placeholder="请输入用户id" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="业务id" prop="bizId">
|
||||||
|
<el-input v-model="form.bizId" placeholder="请输入业务id" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="业务类型" prop="bizType">
|
||||||
|
<el-input v-model="form.bizType" placeholder="请输入业务类型" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="源部门id" prop="sourceDeptId">
|
||||||
|
<el-input v-model="form.sourceDeptId" placeholder="请输入源部门id" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="目标部门id" prop="targetDeptId">
|
||||||
|
<el-input v-model="form.targetDeptId" placeholder="请输入目标部门id" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="是否离职自动转账" prop="isWalletTransaction">
|
||||||
|
<el-input v-model="form.isWalletTransaction" placeholder="请输入是否离职自动转账" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="离职自动转账时间" prop="walletTransactionTime">
|
||||||
|
<el-input v-model="form.walletTransactionTime" placeholder="请输入离职自动转账时间" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="流程id" prop="processId">
|
||||||
|
<el-input v-model="form.processId" placeholder="请输入流程id" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="审核状体" prop="processStatus">
|
||||||
|
<el-input v-model="form.processStatus" placeholder="请输入审核状体" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="审核时间" prop="processTime">
|
||||||
|
<el-input v-model="form.processTime" placeholder="请输入审核时间" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="visible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="SysUserTransactionDialog">
|
||||||
|
import { useDict } from "/@/hooks/dict"
|
||||||
|
import { useMessage } from "/@/hooks/message"
|
||||||
|
import * as sysUserTransactionApi from "/@/api/admin/sys-user-transaction"
|
||||||
|
import { rule } from "/@/utils/validate"
|
||||||
|
const emit = defineEmits(["refresh"])
|
||||||
|
|
||||||
|
// 定义变量内容
|
||||||
|
const dataFormRef = ref()
|
||||||
|
const visible = ref(false)
|
||||||
|
const loading = ref(false)
|
||||||
|
// 定义字典
|
||||||
|
|
||||||
|
// 提交表单数据
|
||||||
|
const form = reactive({
|
||||||
|
id: "",
|
||||||
|
userId: "",
|
||||||
|
bizId: "",
|
||||||
|
bizType: "",
|
||||||
|
sourceDeptId: "",
|
||||||
|
targetDeptId: "",
|
||||||
|
isWalletTransaction: "",
|
||||||
|
walletTransactionTime: "",
|
||||||
|
processId: "",
|
||||||
|
processStatus: "",
|
||||||
|
processTime: "",
|
||||||
|
})
|
||||||
|
|
||||||
|
// 定义校验规则
|
||||||
|
const dataRules = ref({})
|
||||||
|
|
||||||
|
// 打开弹窗
|
||||||
|
const openDialog = (id: string) => {
|
||||||
|
visible.value = true
|
||||||
|
form.id = ""
|
||||||
|
|
||||||
|
// 重置表单数据
|
||||||
|
nextTick(() => {
|
||||||
|
dataFormRef.value?.resetFields()
|
||||||
|
})
|
||||||
|
|
||||||
|
// 获取sysUserTransaction信息
|
||||||
|
if (id) {
|
||||||
|
form.id = id
|
||||||
|
getsysUserTransactionData(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交
|
||||||
|
const onSubmit = async () => {
|
||||||
|
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||||
|
if (!valid) return false
|
||||||
|
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
form.id ? await sysUserTransactionApi.putObj(form) : await sysUserTransactionApi.addObj(form)
|
||||||
|
useMessage().success(form.id ? "修改成功" : "添加成功")
|
||||||
|
visible.value = false
|
||||||
|
emit("refresh")
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化表单数据
|
||||||
|
const getsysUserTransactionData = (id: string) => {
|
||||||
|
// 获取数据
|
||||||
|
loading.value = true
|
||||||
|
sysUserTransactionApi
|
||||||
|
.getObj(id)
|
||||||
|
.then((res: any) => {
|
||||||
|
Object.assign(form, res.data)
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 暴露变量
|
||||||
|
defineExpose({
|
||||||
|
openDialog,
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
<template>
|
||||||
|
<div class="layout-padding">
|
||||||
|
<div class="layout-padding-auto layout-padding-view">
|
||||||
|
<el-row>
|
||||||
|
<div class="mb8" style="width: 100%">
|
||||||
|
<el-button
|
||||||
|
icon="folder-add"
|
||||||
|
type="primary"
|
||||||
|
class="ml10"
|
||||||
|
@click="formDialogRef.openDialog()"
|
||||||
|
v-auth="'admin_sysUserTransaction_add'"
|
||||||
|
>
|
||||||
|
新 增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
plain
|
||||||
|
:disabled="multiple"
|
||||||
|
icon="Delete"
|
||||||
|
type="primary"
|
||||||
|
v-auth="'admin_sysUserTransaction_del'"
|
||||||
|
@click="handleDelete(selectObjs)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
<right-toolbar
|
||||||
|
v-model:showSearch="showSearch"
|
||||||
|
:export="'admin_sysUserTransaction_export'"
|
||||||
|
@exportExcel="exportExcel"
|
||||||
|
class="ml10 mr20"
|
||||||
|
style="float: right"
|
||||||
|
@queryTable="getDataList"
|
||||||
|
></right-toolbar>
|
||||||
|
</div>
|
||||||
|
</el-row>
|
||||||
|
<el-table
|
||||||
|
:data="state.dataList"
|
||||||
|
v-loading="state.loading"
|
||||||
|
border
|
||||||
|
:cell-style="tableStyle.cellStyle"
|
||||||
|
:header-cell-style="tableStyle.headerCellStyle"
|
||||||
|
@selection-change="selectionChangHandle"
|
||||||
|
@sort-change="sortChangeHandle"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="40" align="center" />
|
||||||
|
<el-table-column type="index" label="#" width="40" />
|
||||||
|
<el-table-column prop="userId" label="用户id" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="bizId" label="业务id" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="bizType" label="业务类型" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="sourceDeptId" label="源部门id" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="targetDeptId" label="目标部门id" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="isWalletTransaction" label="是否离职自动转账" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="walletTransactionTime" label="离职自动转账时间" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="processId" label="流程id" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="processStatus" label="审核状体" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="processTime" label="审核时间" show-overflow-tooltip />
|
||||||
|
<el-table-column label="操作" width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
icon="edit-pen"
|
||||||
|
text
|
||||||
|
type="primary"
|
||||||
|
v-auth="'admin_sysUserTransaction_edit'"
|
||||||
|
@click="formDialogRef.openDialog(scope.row.id)"
|
||||||
|
>编辑</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="delete" text type="primary" v-auth="'admin_sysUserTransaction_del'" @click="handleDelete([scope.row.id])"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 编辑、新增 -->
|
||||||
|
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="systemSysUserTransaction">
|
||||||
|
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||||
|
import * as sysUserTransactionApi from "/@/api/admin/sys-user-transaction"
|
||||||
|
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||||
|
import { useDict } from "/@/hooks/dict"
|
||||||
|
|
||||||
|
// 引入组件
|
||||||
|
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||||
|
// 定义查询字典
|
||||||
|
|
||||||
|
// 定义变量内容
|
||||||
|
const formDialogRef = ref()
|
||||||
|
// 搜索变量
|
||||||
|
const queryRef = ref()
|
||||||
|
const showSearch = ref(true)
|
||||||
|
// 多选变量
|
||||||
|
const selectObjs = ref([]) as any
|
||||||
|
const multiple = ref(true)
|
||||||
|
|
||||||
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
|
queryForm: {},
|
||||||
|
pageList: sysUserTransactionApi.pageJoin,
|
||||||
|
})
|
||||||
|
|
||||||
|
// table hook
|
||||||
|
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||||
|
|
||||||
|
// 清空搜索条件
|
||||||
|
const resetQuery = () => {
|
||||||
|
// 清空搜索条件
|
||||||
|
queryRef.value?.resetFields()
|
||||||
|
// 清空多选
|
||||||
|
selectObjs.value = []
|
||||||
|
getDataList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出excel
|
||||||
|
const exportExcel = () => {
|
||||||
|
downBlobFile("/admin/sysUserTransaction/export", Object.assign(state.queryForm, { ids: selectObjs }), "sysUserTransaction.xlsx")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选事件
|
||||||
|
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||||
|
selectObjs.value = objs.map(({ id }) => id)
|
||||||
|
multiple.value = !objs.length
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除操作
|
||||||
|
const handleDelete = async (ids: string[]) => {
|
||||||
|
try {
|
||||||
|
await useMessageBox().confirm("此操作将永久删除")
|
||||||
|
} catch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await sysUserTransactionApi.delObjs(ids)
|
||||||
|
getDataList()
|
||||||
|
useMessage().success("删除成功")
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="form.id ? '编辑' : '新增'" width="35%" v-model="visible" :close-on-click-modal="false" draggable>
|
||||||
|
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="标题" prop="title">
|
||||||
|
<el-input v-model="form.title" placeholder="请输入标题" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="预约时间" prop="displayTime">
|
||||||
|
<el-time-picker v-model="form.displayTime" value-format="HH:mm" format="HH:mm" is-range />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="是否启用" prop="status">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio v-for="v in yes_no_type" :key="v.value" :label="v.value" border>
|
||||||
|
{{ v.label }}
|
||||||
|
</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" class="mb20">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" type="textarea" :autosize="{ minRows: 6 }" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="visible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="HardApptDialog">
|
||||||
|
import { useDict } from "/@/hooks/dict"
|
||||||
|
import { useMessage } from "/@/hooks/message"
|
||||||
|
import * as hardApptApi from "/@/api/hard/hard-appt"
|
||||||
|
import dayjs from "dayjs"
|
||||||
|
import { rule } from "/@/utils/validate"
|
||||||
|
const emit = defineEmits(["refresh"])
|
||||||
|
|
||||||
|
// 定义变量内容
|
||||||
|
const dataFormRef = ref()
|
||||||
|
const visible = ref(false)
|
||||||
|
const loading = ref(false)
|
||||||
|
// 定义字典
|
||||||
|
const { yes_no_type } = useDict("yes_no_type")
|
||||||
|
// 提交表单数据
|
||||||
|
const form = reactive({
|
||||||
|
id: "",
|
||||||
|
title: "",
|
||||||
|
displayTime: [],
|
||||||
|
startTime: "",
|
||||||
|
endTime: "",
|
||||||
|
status: "1",
|
||||||
|
remark: "",
|
||||||
|
})
|
||||||
|
|
||||||
|
// 定义校验规则
|
||||||
|
const dataRules = ref({
|
||||||
|
title: [{ required: true, message: "标题不能为空", trigger: "blur" }],
|
||||||
|
displayTime: [{ required: true, message: "预约时间不能为空", type: "array", trigger: "change" }],
|
||||||
|
status: [{ required: true, message: "是否启用不能为空", trigger: "change" }],
|
||||||
|
})
|
||||||
|
|
||||||
|
// 打开弹窗
|
||||||
|
const openDialog = (id: string) => {
|
||||||
|
visible.value = true
|
||||||
|
form.id = ""
|
||||||
|
// 重置表单数据
|
||||||
|
nextTick(() => {
|
||||||
|
dataFormRef.value?.resetFields()
|
||||||
|
})
|
||||||
|
// 获取hardAppt信息
|
||||||
|
if (id) {
|
||||||
|
form.id = id
|
||||||
|
gethardApptData(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交
|
||||||
|
const onSubmit = async () => {
|
||||||
|
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||||
|
if (!valid) return false
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
const _pa = {
|
||||||
|
...form,
|
||||||
|
startTime: dayjs(form.displayTime[0], "HH:mm").format("HH:mm:ss"),
|
||||||
|
endTime: dayjs(form.displayTime[1], "HH:mm").format("HH:mm:ss"),
|
||||||
|
}
|
||||||
|
form.id ? await hardApptApi.putObj(_pa) : await hardApptApi.addObj(_pa)
|
||||||
|
useMessage().success(form.id ? "修改成功" : "添加成功")
|
||||||
|
visible.value = false
|
||||||
|
emit("refresh")
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化表单数据
|
||||||
|
const gethardApptData = async (id: string) => {
|
||||||
|
// 获取数据
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const { data } = await hardApptApi.getObj(id)
|
||||||
|
Object.assign(form, data, { displayTime: [data.startTime, data.endTime] })
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 暴露变量
|
||||||
|
defineExpose({
|
||||||
|
openDialog,
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
<template>
|
||||||
|
<div class="layout-padding">
|
||||||
|
<div class="layout-padding-auto layout-padding-view">
|
||||||
|
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
|
||||||
|
<el-row>
|
||||||
|
<el-form-item style="width: 300px" label="标题" prop="title">
|
||||||
|
<el-input v-model="state.queryForm.title" placeholder="请输入标题" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button icon="Search" type="primary" @click="getDataList">{{ $t("common.queryBtn") }}</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">{{ $t("common.resetBtn") }}</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<el-row>
|
||||||
|
<div class="mb8" style="width: 100%">
|
||||||
|
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()" v-auth="'hard_hardAppt_add'">
|
||||||
|
新 增
|
||||||
|
</el-button>
|
||||||
|
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'hard_hardAppt_del'" @click="handleDelete(selectObjs)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
<right-toolbar
|
||||||
|
v-model:showSearch="showSearch"
|
||||||
|
:export="'hard_hardAppt_export'"
|
||||||
|
@exportExcel="exportExcel"
|
||||||
|
class="ml10 mr20"
|
||||||
|
style="float: right"
|
||||||
|
@queryTable="getDataList"
|
||||||
|
></right-toolbar>
|
||||||
|
</div>
|
||||||
|
</el-row>
|
||||||
|
<el-table
|
||||||
|
:data="state.dataList"
|
||||||
|
v-loading="state.loading"
|
||||||
|
border
|
||||||
|
:cell-style="tableStyle.cellStyle"
|
||||||
|
:header-cell-style="tableStyle.headerCellStyle"
|
||||||
|
@selection-change="selectionChangHandle"
|
||||||
|
@sort-change="sortChangeHandle"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="40" align="center" />
|
||||||
|
<el-table-column type="index" label="#" width="40" />
|
||||||
|
<el-table-column prop="title" label="标题" />
|
||||||
|
<el-table-column label="预约时间">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span> {{ row.startTime }}</span>
|
||||||
|
<span>-</span>
|
||||||
|
<span> {{ row.endTime }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="status" label="状态">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<dict-tag :options="yes_no_type" :value="row.status" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="remark" label="备注" />
|
||||||
|
<el-table-column label="操作" width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button icon="edit-pen" text type="primary" v-auth="'hard_hardAppt_edit'" @click="formDialogRef.openDialog(scope.row.id)"
|
||||||
|
>编辑</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="delete" text type="primary" v-auth="'hard_hardAppt_del'" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 编辑、新增 -->
|
||||||
|
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="systemHardAppt">
|
||||||
|
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||||
|
import * as hardApptApi from "/@/api/hard/hard-appt"
|
||||||
|
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||||
|
import { useDict } from "/@/hooks/dict"
|
||||||
|
|
||||||
|
// 引入组件
|
||||||
|
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||||
|
// 定义查询字典
|
||||||
|
const { yes_no_type } = useDict("yes_no_type")
|
||||||
|
// 定义变量内容
|
||||||
|
const formDialogRef = ref()
|
||||||
|
// 搜索变量
|
||||||
|
const queryRef = ref()
|
||||||
|
const showSearch = ref(true)
|
||||||
|
// 多选变量
|
||||||
|
const selectObjs = ref([]) as any
|
||||||
|
const multiple = ref(true)
|
||||||
|
|
||||||
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
|
queryForm: {},
|
||||||
|
pageList: hardApptApi.fetchList,
|
||||||
|
})
|
||||||
|
|
||||||
|
// table hook
|
||||||
|
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||||
|
|
||||||
|
// 清空搜索条件
|
||||||
|
const resetQuery = () => {
|
||||||
|
// 清空搜索条件
|
||||||
|
queryRef.value?.resetFields()
|
||||||
|
// 清空多选
|
||||||
|
selectObjs.value = []
|
||||||
|
getDataList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出excel
|
||||||
|
const exportExcel = () => {
|
||||||
|
downBlobFile("/hard/hardAppt/export", Object.assign(state.queryForm, { ids: selectObjs }), "hardAppt.xlsx")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选事件
|
||||||
|
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||||
|
selectObjs.value = objs.map(({ id }) => id)
|
||||||
|
multiple.value = !objs.length
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除操作
|
||||||
|
const handleDelete = async (ids: string[]) => {
|
||||||
|
try {
|
||||||
|
await useMessageBox().confirm("此操作将永久删除")
|
||||||
|
} catch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await hardApptApi.delObjs(ids)
|
||||||
|
getDataList()
|
||||||
|
useMessage().success("删除成功")
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Reference in new issue
Block a user