修改bug
This commit is contained in:
File diff suppressed because it is too large
Load Diff
79
src/api/finance/purchasingschoolleader.ts
Normal file
79
src/api/finance/purchasingschoolleader.ts
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
import request from '/@/utils/request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param params 查询参数
|
||||||
|
*/
|
||||||
|
export function getPage(params?: any) {
|
||||||
|
return request({
|
||||||
|
url: '/purchase/purchasingSchoolLeader/page',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id查询
|
||||||
|
* @param id ID
|
||||||
|
*/
|
||||||
|
export function getObj(id: string | number) {
|
||||||
|
return request({
|
||||||
|
url: '/purchase/purchasingSchoolLeader/details',
|
||||||
|
method: 'get',
|
||||||
|
params: { id }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增校领导(党委)
|
||||||
|
* @param obj 对象数据
|
||||||
|
*/
|
||||||
|
export function addObj(obj: any) {
|
||||||
|
return request({
|
||||||
|
url: '/purchase/purchasingSchoolLeader',
|
||||||
|
method: 'post',
|
||||||
|
data: obj
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改校领导(党委)
|
||||||
|
* @param obj 对象数据
|
||||||
|
*/
|
||||||
|
export function editObj(obj: any) {
|
||||||
|
return request({
|
||||||
|
url: '/purchase/purchasingSchoolLeader',
|
||||||
|
method: 'put',
|
||||||
|
data: obj
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除校领导(党委)
|
||||||
|
* @param ids ID数组
|
||||||
|
*/
|
||||||
|
export function delObj(ids: string[] | number[]) {
|
||||||
|
return request({
|
||||||
|
url: '/purchase/purchasingSchoolLeader',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@@ -808,7 +808,7 @@ const isGoodsCategory = computed(() => {
|
|||||||
const isSpecialServiceCategory = computed(() => {
|
const isSpecialServiceCategory = computed(() => {
|
||||||
const category = getCategoryInfo();
|
const category = getCategoryInfo();
|
||||||
if (!category) return false;
|
if (!category) return false;
|
||||||
return category.isMallService === 1 && category.isProjectService === 1;
|
return Number(category.isMallService) === 1 || Number(category.isProjectService) === 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 判断是否自动选择网上商城采购方式(5万<=金额<40万,服务类目,特殊服务类目)
|
// 判断是否自动选择网上商城采购方式(5万<=金额<40万,服务类目,特殊服务类目)
|
||||||
|
|||||||
@@ -1,142 +1,227 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible"
|
<el-dialog
|
||||||
:close-on-click-modal="false" draggable>
|
:title="form.id ? '编辑' : '新增'"
|
||||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
v-model="visible"
|
||||||
<el-row :gutter="24">
|
width="700px"
|
||||||
<el-col :span="12" class="mb20">
|
:close-on-click-modal="false"
|
||||||
<el-form-item label="备注" prop="remark">
|
draggable>
|
||||||
<el-input v-model="form.remark" placeholder="请输入备注"/>
|
<el-form
|
||||||
</el-form-item>
|
ref="dataFormRef"
|
||||||
</el-col>
|
:model="form"
|
||||||
<el-col :span="12" class="mb20">
|
:rules="dataRules"
|
||||||
<el-form-item label="部门ID" prop="deptId">
|
label-width="120px"
|
||||||
<el-input v-model="form.deptId" placeholder="请输入部门ID"/>
|
v-loading="loading">
|
||||||
</el-form-item>
|
<el-form-item label="部门" prop="deptId">
|
||||||
</el-col>
|
<org-selector
|
||||||
<el-col :span="12" class="mb20">
|
v-model:orgList="deptList"
|
||||||
<el-form-item label="部门名称" prop="deptName">
|
type="dept"
|
||||||
<el-input v-model="form.deptName" placeholder="请输入部门名称"/>
|
:multiple="false"
|
||||||
</el-form-item>
|
@update:orgList="handleDeptChange" />
|
||||||
</el-col>
|
</el-form-item>
|
||||||
<el-col :span="12" class="mb20">
|
<el-form-item label="部门名称" prop="deptName">
|
||||||
<el-form-item label="分管负责人ID" prop="userId">
|
<el-input
|
||||||
<el-input v-model="form.userId" placeholder="请输入分管负责人ID"/>
|
v-model="form.deptName"
|
||||||
</el-form-item>
|
placeholder="请选择部门后自动填充"
|
||||||
</el-col>
|
readonly />
|
||||||
<el-col :span="12" class="mb20">
|
</el-form-item>
|
||||||
<el-form-item label="分管负责人工号" prop="username">
|
<el-form-item label="分管负责人" prop="userId">
|
||||||
<el-input v-model="form.username" placeholder="请输入分管负责人工号"/>
|
<org-selector
|
||||||
</el-form-item>
|
v-model:orgList="userList"
|
||||||
</el-col>
|
type="user"
|
||||||
<el-col :span="12" class="mb20">
|
:multiple="false"
|
||||||
<el-form-item label="姓名" prop="name">
|
@update:orgList="handleUserChange" />
|
||||||
<el-input v-model="form.name" placeholder="请输入姓名"/>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="姓名" prop="name">
|
||||||
</el-col>
|
<el-input
|
||||||
</el-row>
|
v-model="form.name"
|
||||||
|
placeholder="请选择用户后自动填充"
|
||||||
|
readonly />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户工号" prop="username">
|
||||||
|
<el-input
|
||||||
|
v-model="form.username"
|
||||||
|
placeholder="请选择用户后自动填充"
|
||||||
|
readonly />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input
|
||||||
|
v-model="form.remark"
|
||||||
|
type="textarea"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入备注"
|
||||||
|
clearable />
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="visible = false">取 消</el-button>
|
<el-button @click="visible = false">取 消</el-button>
|
||||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确 认</el-button>
|
<el-button type="primary" @click="onSubmit" :disabled="loading">确 定</el-button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="PurchasingBusinessDeptDialog">
|
<script setup lang="ts" name="PurchasingBusinessDeptForm">
|
||||||
// ========== 1. 导入语句 ==========
|
import { reactive, ref, nextTick } from 'vue'
|
||||||
import { useDict } from '/@/hooks/dict';
|
import { getObj, addObj, putObj } from '/@/api/purchase/purchasingBusinessDept';
|
||||||
import { rule } from '/@/utils/validate';
|
import { useMessage } from '/@/hooks/message';
|
||||||
import { useMessage } from "/@/hooks/message";
|
import orgSelector from '/@/components/OrgSelector/index.vue';
|
||||||
import { getObj, addObj, putObj, validateExist } from '/@/api/purchase/purchasingBusinessDept';
|
|
||||||
|
|
||||||
// ========== 2. 组件定义 ==========
|
// 定义子组件向父组件传值/事件
|
||||||
// 定义组件事件
|
|
||||||
const emit = defineEmits(['refresh']);
|
const emit = defineEmits(['refresh']);
|
||||||
|
|
||||||
// ========== 3. 响应式数据定义 ==========
|
// 定义变量内容
|
||||||
// 基础响应式变量
|
const dataFormRef = ref();
|
||||||
const dataFormRef = ref(); // 表单引用
|
const deptList = ref<any[]>([]);
|
||||||
const visible = ref(false); // 弹窗显示状态
|
const userList = ref<any[]>([]);
|
||||||
const loading = ref(false); // 加载状态
|
const dataForm = reactive({
|
||||||
|
id: '',
|
||||||
// 表单数据对象
|
deptId: '',
|
||||||
const form = reactive({
|
deptName: '',
|
||||||
id: '', // 主键
|
userId: '',
|
||||||
remark: '', // 备注
|
username: '',
|
||||||
deptId: '', // 部门ID
|
name: '',
|
||||||
deptName: '', // 部门名称
|
remark: '',
|
||||||
userId: '', // 分管负责人ID
|
|
||||||
username: '', // 分管负责人工号
|
|
||||||
name: '', // 姓名
|
|
||||||
});
|
});
|
||||||
|
const visible = ref(false);
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
// ========== 4. 字典数据处理 ==========
|
|
||||||
|
|
||||||
// ========== 5. 表单校验规则 ==========
|
|
||||||
const dataRules = ref({
|
const dataRules = ref({
|
||||||
|
deptId: [
|
||||||
|
{ required: true, message: '请选择部门', trigger: 'change' }
|
||||||
|
],
|
||||||
|
userId: [
|
||||||
|
{ required: true, message: '请选择分管负责人', trigger: 'change' }
|
||||||
|
],
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '姓名不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
username: [
|
||||||
|
{ required: true, message: '用户工号不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
// ========== 6. 方法定义 ==========
|
// 处理部门选择变化
|
||||||
// 获取详情数据
|
const handleDeptChange = (list: any[]) => {
|
||||||
const getPurchasingBusinessDeptData = async (id: string) => {
|
if (list && list.length > 0) {
|
||||||
try {
|
const dept = list[0];
|
||||||
loading.value = true;
|
dataForm.deptId = dept.deptId || dept.id || '';
|
||||||
const { data } = await getObj({ id: id });
|
dataForm.deptName = dept.name || dept.deptName || '';
|
||||||
// 直接将第一条数据赋值给表单
|
} else {
|
||||||
Object.assign(form, data[0]);
|
dataForm.deptId = '';
|
||||||
} catch (error) {
|
dataForm.deptName = '';
|
||||||
useMessage().error('获取数据失败');
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开弹窗方法
|
// 处理用户选择变化
|
||||||
const openDialog = (id: string) => {
|
const handleUserChange = (list: any[]) => {
|
||||||
visible.value = true;
|
if (list && list.length > 0) {
|
||||||
form.id = '';
|
const user = list[0];
|
||||||
|
dataForm.userId = user.userId || user.id || '';
|
||||||
|
dataForm.username = user.username || user.userName || '';
|
||||||
|
dataForm.name = user.name || user.realName || '';
|
||||||
|
} else {
|
||||||
|
dataForm.userId = '';
|
||||||
|
dataForm.username = '';
|
||||||
|
dataForm.name = '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 打开弹窗
|
||||||
|
const openDialog = async (id?: string) => {
|
||||||
|
visible.value = true;
|
||||||
|
dataForm.id = '';
|
||||||
|
dataForm.deptId = '';
|
||||||
|
dataForm.deptName = '';
|
||||||
|
dataForm.userId = '';
|
||||||
|
dataForm.username = '';
|
||||||
|
dataForm.name = '';
|
||||||
|
dataForm.remark = '';
|
||||||
|
deptList.value = [];
|
||||||
|
userList.value = [];
|
||||||
|
|
||||||
// 重置表单数据
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
dataFormRef.value?.resetFields();
|
dataFormRef.value?.resetFields();
|
||||||
|
if (id) {
|
||||||
|
// 编辑时,先获取详情数据
|
||||||
|
loading.value = true;
|
||||||
|
getObj({ id }).then((res: any) => {
|
||||||
|
if (res.data && res.data.length > 0) {
|
||||||
|
const data = res.data[0];
|
||||||
|
Object.assign(dataForm, {
|
||||||
|
id: data.id || '',
|
||||||
|
deptId: data.deptId || '',
|
||||||
|
deptName: data.deptName || '',
|
||||||
|
userId: data.userId || '',
|
||||||
|
username: data.username || '',
|
||||||
|
name: data.name || '',
|
||||||
|
remark: data.remark || '',
|
||||||
|
});
|
||||||
|
// 设置部门列表用于回显
|
||||||
|
if (data.deptId) {
|
||||||
|
deptList.value = [{
|
||||||
|
deptId: data.deptId,
|
||||||
|
name: data.deptName,
|
||||||
|
id: data.deptId,
|
||||||
|
type: 'dept',
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
// 设置用户列表用于回显
|
||||||
|
if (data.userId) {
|
||||||
|
userList.value = [{
|
||||||
|
userId: data.userId,
|
||||||
|
username: data.username,
|
||||||
|
name: data.name,
|
||||||
|
id: data.userId,
|
||||||
|
userName: data.username,
|
||||||
|
realName: data.name,
|
||||||
|
type: 'user',
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
}).catch((err: any) => {
|
||||||
|
useMessage().error(err.msg || '获取详情失败');
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 获取PurchasingBusinessDept信息
|
|
||||||
if (id) {
|
|
||||||
form.id = id;
|
|
||||||
getPurchasingBusinessDeptData(id);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 提交表单方法
|
// 提交
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
loading.value = true; // 防止重复提交
|
// 立即设置 loading,防止重复点击
|
||||||
|
if (loading.value) return;
|
||||||
// 表单校验
|
loading.value = true;
|
||||||
const valid = await dataFormRef.value.validate().catch(() => {});
|
|
||||||
if (!valid) {
|
|
||||||
loading.value = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 根据是否有ID判断是新增还是修改
|
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||||
form.id ? await putObj(form) : await addObj(form);
|
if (!valid) {
|
||||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
loading.value = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataForm.id) {
|
||||||
|
await putObj(dataForm);
|
||||||
|
useMessage().success('编辑成功');
|
||||||
|
} else {
|
||||||
|
await addObj(dataForm);
|
||||||
|
useMessage().success('新增成功');
|
||||||
|
}
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
emit('refresh'); // 通知父组件刷新列表
|
emit('refresh');
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
useMessage().error(err.msg);
|
useMessage().error(err.msg || (dataForm.id ? '编辑失败' : '新增失败'));
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ========== 7. 对外暴露 ==========
|
// 暴露变量
|
||||||
// 暴露方法给父组件
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
openDialog
|
openDialog,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
@@ -1,129 +1,177 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="layout-padding">
|
<div class="modern-page-container">
|
||||||
<div class="layout-padding-auto layout-padding-view">
|
<div class="page-wrapper">
|
||||||
|
<!-- 搜索表单卡片 -->
|
||||||
|
<el-card v-show="showSearch" class="search-card" shadow="never">
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">
|
||||||
|
<span class="card-title">
|
||||||
|
<el-icon class="title-icon"><Search /></el-icon>
|
||||||
|
筛选条件
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<el-form :model="state.queryForm" ref="queryRef" :inline="true" @keyup.enter="getDataList" class="search-form">
|
||||||
|
<el-form-item label="部门名称" prop="deptName">
|
||||||
|
<el-input
|
||||||
|
v-model="state.queryForm.deptName"
|
||||||
|
placeholder="请输入部门名称"
|
||||||
|
clearable
|
||||||
|
style="width: 200px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户工号" prop="username">
|
||||||
|
<el-input
|
||||||
|
v-model="state.queryForm.username"
|
||||||
|
placeholder="请输入用户工号"
|
||||||
|
clearable
|
||||||
|
style="width: 200px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="姓名" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="state.queryForm.name"
|
||||||
|
placeholder="请输入姓名"
|
||||||
|
clearable
|
||||||
|
style="width: 200px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="getDataList">查询</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
<!-- 操作按钮区域 -->
|
<!-- 内容卡片 -->
|
||||||
<el-row>
|
<el-card class="content-card" shadow="never">
|
||||||
<div class="mb8" style="width: 100%">
|
<template #header>
|
||||||
<el-button
|
<div class="card-header">
|
||||||
icon="folder-add"
|
<span class="card-title">
|
||||||
type="primary"
|
<el-icon class="title-icon"><Document /></el-icon>
|
||||||
class="ml10"
|
业务分管管理
|
||||||
@click="formDialogRef.openDialog()"
|
</span>
|
||||||
v-auth="'purchase_purchasingBusinessDept_add'"
|
<div class="header-actions">
|
||||||
>
|
<el-button
|
||||||
新增
|
icon="FolderAdd"
|
||||||
</el-button>
|
type="primary"
|
||||||
<el-button
|
@click="formDialogRef.openDialog()"
|
||||||
plain
|
v-auth="'purchase_purchasingBusinessDept_add'">
|
||||||
icon="upload-filled"
|
新增
|
||||||
type="primary"
|
</el-button>
|
||||||
class="ml10"
|
<el-button
|
||||||
@click="excelUploadRef.show()"
|
plain
|
||||||
v-auth="'purchase_purchasingBusinessDept_add'"
|
icon="UploadFilled"
|
||||||
>
|
type="primary"
|
||||||
导入
|
class="ml10"
|
||||||
</el-button>
|
@click="excelUploadRef.show()"
|
||||||
<el-button
|
v-auth="'purchase_purchasingBusinessDept_add'">
|
||||||
plain
|
导入
|
||||||
:disabled="multiple"
|
</el-button>
|
||||||
icon="Delete"
|
<el-button
|
||||||
type="primary"
|
plain
|
||||||
v-auth="'purchase_purchasingBusinessDept_del'"
|
:disabled="multiple"
|
||||||
@click="handleDelete(selectObjs)"
|
icon="Delete"
|
||||||
>
|
type="primary"
|
||||||
删除
|
class="ml10"
|
||||||
</el-button>
|
v-auth="'purchase_purchasingBusinessDept_del'"
|
||||||
<right-toolbar
|
@click="handleDelete(selectObjs)">
|
||||||
v-model:showSearch="showSearch"
|
删除
|
||||||
:export="'purchase_purchasingBusinessDept_export'"
|
</el-button>
|
||||||
@exportExcel="exportExcel"
|
<right-toolbar
|
||||||
class="ml10 mr20"
|
v-model:showSearch="showSearch"
|
||||||
style="float: right;"
|
:export="'purchase_purchasingBusinessDept_export'"
|
||||||
@queryTable="getDataList"
|
@exportExcel="exportExcel"
|
||||||
/>
|
class="ml10"
|
||||||
</div>
|
@queryTable="getDataList" />
|
||||||
</el-row>
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- 数据表格区域 -->
|
<!-- 表格 -->
|
||||||
<el-table
|
<el-table
|
||||||
:data="state.dataList"
|
ref="tableRef"
|
||||||
v-loading="state.loading"
|
:data="state.dataList"
|
||||||
border
|
v-loading="state.loading"
|
||||||
:cell-style="tableStyle.cellStyle"
|
stripe
|
||||||
:header-cell-style="tableStyle.headerCellStyle"
|
:cell-style="tableStyle.cellStyle"
|
||||||
@selection-change="selectionChangHandle"
|
:header-cell-style="tableStyle.headerCellStyle"
|
||||||
@sort-change="sortChangeHandle"
|
@selection-change="selectionChangHandle"
|
||||||
>
|
@sort-change="sortChangeHandle"
|
||||||
<el-table-column type="selection" width="40" align="center" />
|
class="modern-table">
|
||||||
<el-table-column type="index" label="#" width="40" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column
|
<el-table-column type="index" label="序号" width="70" align="center">
|
||||||
prop="remark"
|
<template #header>
|
||||||
label="备注"
|
<el-icon><List /></el-icon>
|
||||||
show-overflow-tooltip
|
</template>
|
||||||
/>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column prop="deptName" label="部门名称" min-width="200" show-overflow-tooltip>
|
||||||
prop="deptId"
|
<template #header>
|
||||||
label="部门ID"
|
<el-icon><OfficeBuilding /></el-icon>
|
||||||
show-overflow-tooltip
|
<span style="margin-left: 4px">部门名称</span>
|
||||||
/>
|
</template>
|
||||||
<el-table-column
|
</el-table-column>
|
||||||
prop="deptName"
|
<el-table-column prop="name" label="姓名" min-width="120" show-overflow-tooltip>
|
||||||
label="部门名称"
|
<template #header>
|
||||||
show-overflow-tooltip
|
<el-icon><User /></el-icon>
|
||||||
/>
|
<span style="margin-left: 4px">姓名</span>
|
||||||
<el-table-column
|
</template>
|
||||||
prop="userId"
|
</el-table-column>
|
||||||
label="分管负责人ID"
|
<el-table-column prop="username" label="用户工号" min-width="150" show-overflow-tooltip>
|
||||||
show-overflow-tooltip
|
<template #header>
|
||||||
/>
|
<el-icon><UserFilled /></el-icon>
|
||||||
<el-table-column
|
<span style="margin-left: 4px">用户工号</span>
|
||||||
prop="username"
|
</template>
|
||||||
label="分管负责人工号"
|
</el-table-column>
|
||||||
show-overflow-tooltip
|
<el-table-column prop="remark" label="备注" min-width="300" show-overflow-tooltip>
|
||||||
/>
|
<template #header>
|
||||||
<el-table-column
|
<el-icon><EditPen /></el-icon>
|
||||||
prop="name"
|
<span style="margin-left: 4px">备注</span>
|
||||||
label="姓名"
|
</template>
|
||||||
show-overflow-tooltip
|
</el-table-column>
|
||||||
/>
|
<el-table-column prop="createTime" label="创建时间" width="180" show-overflow-tooltip>
|
||||||
<el-table-column label="操作" width="150">
|
<template #header>
|
||||||
<template #default="scope">
|
<el-icon><Clock /></el-icon>
|
||||||
<el-button
|
<span style="margin-left: 4px">创建时间</span>
|
||||||
icon="edit-pen"
|
</template>
|
||||||
text
|
</el-table-column>
|
||||||
type="primary"
|
<el-table-column label="操作" align="center" fixed="right" width="150">
|
||||||
v-auth="'purchase_purchasingBusinessDept_edit'"
|
<template #default="scope">
|
||||||
@click="formDialogRef.openDialog(scope.row.id)"
|
<el-button
|
||||||
>
|
icon="Edit"
|
||||||
编辑
|
link
|
||||||
</el-button>
|
type="primary"
|
||||||
<el-button
|
v-auth="'purchase_purchasingBusinessDept_edit'"
|
||||||
icon="delete"
|
@click="formDialogRef.openDialog(scope.row.id)">
|
||||||
text
|
编辑
|
||||||
type="primary"
|
</el-button>
|
||||||
v-auth="'purchase_purchasingBusinessDept_del'"
|
<el-button
|
||||||
@click="handleDelete([scope.row.id])"
|
icon="Delete"
|
||||||
>
|
link
|
||||||
删除
|
type="danger"
|
||||||
</el-button>
|
v-auth="'purchase_purchasingBusinessDept_del'"
|
||||||
</template>
|
@click="handleDelete([scope.row.id])">
|
||||||
</el-table-column>
|
删除
|
||||||
</el-table>
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
<!-- 分页组件 -->
|
<!-- 分页 -->
|
||||||
<pagination
|
<pagination
|
||||||
@size-change="sizeChangeHandle"
|
v-if="state.pagination"
|
||||||
@current-change="currentChangeHandle"
|
v-show="state.pagination.total && state.pagination.total > 0"
|
||||||
v-bind="state.pagination"
|
:total="state.pagination.total"
|
||||||
/>
|
:current="state.pagination.current"
|
||||||
|
:size="state.pagination.size"
|
||||||
|
@size-change="sizeChangeHandle"
|
||||||
|
@current-change="currentChangeHandle"
|
||||||
|
/>
|
||||||
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 编辑、新增弹窗 -->
|
<!-- 编辑、新增表单对话框 -->
|
||||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
<form-dialog ref="formDialogRef" @refresh="getDataList" />
|
||||||
|
|
||||||
<!-- 导入excel弹窗 (需要在 upms-biz/resources/file 下维护模板) -->
|
<!-- 导入excel弹窗 -->
|
||||||
<upload-excel
|
<uploadExcel
|
||||||
ref="excelUploadRef"
|
ref="excelUploadRef"
|
||||||
title="导入"
|
title="导入"
|
||||||
url="/purchase/purchasingBusinessDept/import"
|
url="/purchase/purchasingBusinessDept/import"
|
||||||
@@ -133,37 +181,41 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="systemPurchasingBusinessDept">
|
<script setup lang="ts" name="PurchasingBusinessDept">
|
||||||
// ========== 导入声明 ==========
|
import { ref, reactive, defineAsyncComponent } from 'vue'
|
||||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||||
import { fetchList, delObjs } from "/@/api/purchase/purchasingBusinessDept";
|
import { fetchList, delObjs } from "/@/api/purchase/purchasingBusinessDept";
|
||||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||||
import { useDict } from '/@/hooks/dict';
|
import { List, Document, User, UserFilled, EditPen, Clock, Search, OfficeBuilding } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
// ========== 组件声明 ==========
|
// 引入组件
|
||||||
// 异步加载表单弹窗组件
|
|
||||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||||
|
|
||||||
// ========== 字典数据 ==========
|
// 定义变量内容
|
||||||
|
const tableRef = ref()
|
||||||
|
const formDialogRef = ref()
|
||||||
|
const excelUploadRef = ref()
|
||||||
|
const queryRef = ref()
|
||||||
|
const showSearch = ref(true)
|
||||||
|
const selectObjs = ref([]) as any
|
||||||
|
const multiple = ref(true)
|
||||||
|
|
||||||
// ========== 组件引用 ==========
|
/**
|
||||||
const formDialogRef = ref(); // 表单弹窗引用
|
* 定义响应式表格数据
|
||||||
const excelUploadRef = ref(); // Excel上传弹窗引用
|
*/
|
||||||
const queryRef = ref(); // 查询表单引用
|
|
||||||
|
|
||||||
// ========== 响应式数据 ==========
|
|
||||||
const showSearch = ref(true); // 是否显示搜索区域
|
|
||||||
const selectObjs = ref([]) as any; // 表格多选数据
|
|
||||||
const multiple = ref(true); // 是否多选
|
|
||||||
|
|
||||||
// ========== 表格状态 ==========
|
|
||||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
queryForm: {}, // 查询参数
|
pageList: fetchList,
|
||||||
pageList: fetchList // 分页查询方法
|
queryForm: {
|
||||||
|
deptName: '',
|
||||||
|
username: '',
|
||||||
|
name: '',
|
||||||
|
},
|
||||||
|
createdIsNeed: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// ========== Hook引用 ==========
|
/**
|
||||||
// 表格相关Hook
|
* 使用 useTable 定义表格相关操作
|
||||||
|
*/
|
||||||
const {
|
const {
|
||||||
getDataList,
|
getDataList,
|
||||||
currentChangeHandle,
|
currentChangeHandle,
|
||||||
@@ -173,16 +225,13 @@ const {
|
|||||||
tableStyle
|
tableStyle
|
||||||
} = useTable(state);
|
} = useTable(state);
|
||||||
|
|
||||||
// ========== 方法定义 ==========
|
|
||||||
/**
|
/**
|
||||||
* 重置查询条件
|
* 重置搜索表单
|
||||||
*/
|
*/
|
||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
// 清空搜索条件
|
|
||||||
queryRef.value?.resetFields();
|
queryRef.value?.resetFields();
|
||||||
// 清空多选
|
|
||||||
selectObjs.value = [];
|
selectObjs.value = [];
|
||||||
// 重新查询
|
multiple.value = true;
|
||||||
getDataList();
|
getDataList();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -192,7 +241,7 @@ const resetQuery = () => {
|
|||||||
const exportExcel = () => {
|
const exportExcel = () => {
|
||||||
downBlobFile(
|
downBlobFile(
|
||||||
'/purchase/purchasingBusinessDept/export',
|
'/purchase/purchasingBusinessDept/export',
|
||||||
Object.assign(state.queryForm, { ids: selectObjs }),
|
Object.assign(state.queryForm, { ids: selectObjs.value }),
|
||||||
'purchasingBusinessDept.xlsx'
|
'purchasingBusinessDept.xlsx'
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -207,22 +256,26 @@ const selectionChangHandle = (objs: { id: string }[]) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除数据处理
|
* 删除当前行
|
||||||
* @param ids 要删除的数据ID数组
|
* @param ids - 要删除的ID数组
|
||||||
*/
|
*/
|
||||||
const handleDelete = async (ids: string[]) => {
|
const handleDelete = async (ids: string[]) => {
|
||||||
try {
|
try {
|
||||||
await useMessageBox().confirm('此操作将永久删除');
|
await useMessageBox().confirm('确定要删除该记录吗?');
|
||||||
} catch {
|
} catch {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await delObjs(ids);
|
await delObjs(ids);
|
||||||
getDataList();
|
|
||||||
useMessage().success('删除成功');
|
useMessage().success('删除成功');
|
||||||
|
getDataList();
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
useMessage().error(err.msg);
|
useMessage().error(err.msg || '删除失败');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '/@/assets/styles/modern-page.scss';
|
||||||
|
</style>
|
||||||
|
|||||||
181
src/views/purchase/purchasingSchoolLeader/form.vue
Normal file
181
src/views/purchase/purchasingSchoolLeader/form.vue
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:title="dataForm.id ? '编辑' : '新增'"
|
||||||
|
v-model="visible"
|
||||||
|
width="600px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
draggable>
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="dataForm"
|
||||||
|
:rules="dataRules"
|
||||||
|
label-width="100px"
|
||||||
|
v-loading="loading">
|
||||||
|
<el-form-item label="用户" prop="userId">
|
||||||
|
<org-selector
|
||||||
|
v-model:orgList="userList"
|
||||||
|
type="user"
|
||||||
|
:multiple="false"
|
||||||
|
@update:orgList="handleUserChange" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="姓名" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="dataForm.name"
|
||||||
|
placeholder="请选择用户后自动填充"
|
||||||
|
readonly />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户工号" prop="username">
|
||||||
|
<el-input
|
||||||
|
v-model="dataForm.username"
|
||||||
|
placeholder="请选择用户后自动填充"
|
||||||
|
readonly />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input
|
||||||
|
v-model="dataForm.remark"
|
||||||
|
type="textarea"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入备注"
|
||||||
|
clearable />
|
||||||
|
</el-form-item>
|
||||||
|
</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="PurchasingSchoolLeaderForm">
|
||||||
|
import { reactive, ref, nextTick } from 'vue'
|
||||||
|
import { getObj, addObj, editObj } from '/@/api/finance/purchasingschoolleader';
|
||||||
|
import { useMessage } from '/@/hooks/message';
|
||||||
|
import orgSelector from '/@/components/OrgSelector/index.vue';
|
||||||
|
|
||||||
|
// 定义子组件向父组件传值/事件
|
||||||
|
const emit = defineEmits(['refresh']);
|
||||||
|
|
||||||
|
// 定义变量内容
|
||||||
|
const formRef = ref();
|
||||||
|
const userList = ref<any[]>([]);
|
||||||
|
const dataForm = reactive({
|
||||||
|
id: '',
|
||||||
|
userId: '',
|
||||||
|
username: '',
|
||||||
|
name: '',
|
||||||
|
remark: '',
|
||||||
|
});
|
||||||
|
const visible = ref(false);
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
const dataRules = ref({
|
||||||
|
userId: [
|
||||||
|
{ required: true, message: '请选择用户', trigger: 'change' }
|
||||||
|
],
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '姓名不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
username: [
|
||||||
|
{ required: true, message: '用户工号不能为空', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
// 处理用户选择变化
|
||||||
|
const handleUserChange = (list: any[]) => {
|
||||||
|
if (list && list.length > 0) {
|
||||||
|
const user = list[0];
|
||||||
|
dataForm.userId = user.userId || user.id || '';
|
||||||
|
dataForm.username = user.username || user.userName || '';
|
||||||
|
dataForm.name = user.name || user.realName || '';
|
||||||
|
} else {
|
||||||
|
dataForm.userId = '';
|
||||||
|
dataForm.username = '';
|
||||||
|
dataForm.name = '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 打开弹窗
|
||||||
|
const openDialog = async (type: string, rowData?: any) => {
|
||||||
|
visible.value = true;
|
||||||
|
dataForm.id = '';
|
||||||
|
dataForm.userId = '';
|
||||||
|
dataForm.username = '';
|
||||||
|
dataForm.name = '';
|
||||||
|
dataForm.remark = '';
|
||||||
|
userList.value = [];
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
formRef.value?.resetFields();
|
||||||
|
if (type === 'edit' && rowData?.id) {
|
||||||
|
// 编辑时,先获取详情数据
|
||||||
|
loading.value = true;
|
||||||
|
getObj(rowData.id).then((res: any) => {
|
||||||
|
if (res.data) {
|
||||||
|
Object.assign(dataForm, {
|
||||||
|
id: res.data.id || '',
|
||||||
|
userId: res.data.userId || '',
|
||||||
|
username: res.data.username || '',
|
||||||
|
name: res.data.name || '',
|
||||||
|
remark: res.data.remark || '',
|
||||||
|
});
|
||||||
|
// 设置用户列表用于回显
|
||||||
|
if (res.data.userId) {
|
||||||
|
userList.value = [{
|
||||||
|
userId: res.data.userId,
|
||||||
|
username: res.data.username,
|
||||||
|
name: res.data.name,
|
||||||
|
id: res.data.userId,
|
||||||
|
userName: res.data.username,
|
||||||
|
realName: res.data.name,
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
}).catch((err: any) => {
|
||||||
|
useMessage().error(err.msg || '获取详情失败');
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 提交
|
||||||
|
const onSubmit = async () => {
|
||||||
|
// 立即设置 loading,防止重复点击
|
||||||
|
if (loading.value) return;
|
||||||
|
loading.value = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const valid = await formRef.value.validate().catch(() => {});
|
||||||
|
if (!valid) {
|
||||||
|
loading.value = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataForm.id) {
|
||||||
|
await editObj(dataForm);
|
||||||
|
useMessage().success('编辑成功');
|
||||||
|
} else {
|
||||||
|
await addObj(dataForm);
|
||||||
|
useMessage().success('新增成功');
|
||||||
|
}
|
||||||
|
visible.value = false;
|
||||||
|
emit('refresh');
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg || (dataForm.id ? '编辑失败' : '新增失败'));
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 暴露变量
|
||||||
|
defineExpose({
|
||||||
|
openDialog,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
|
|
||||||
197
src/views/purchase/purchasingSchoolLeader/index.vue
Normal file
197
src/views/purchase/purchasingSchoolLeader/index.vue
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
<template>
|
||||||
|
<div class="modern-page-container">
|
||||||
|
<div class="page-wrapper">
|
||||||
|
<!-- 搜索表单卡片 -->
|
||||||
|
<el-card v-show="showSearch" class="search-card" shadow="never">
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">
|
||||||
|
<span class="card-title">
|
||||||
|
<el-icon class="title-icon"><Search /></el-icon>
|
||||||
|
筛选条件
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<el-form :model="state.queryForm" ref="searchFormRef" :inline="true" @keyup.enter="getDataList" class="search-form">
|
||||||
|
<el-form-item label="姓名" prop="name">
|
||||||
|
<el-input
|
||||||
|
v-model="state.queryForm.name"
|
||||||
|
placeholder="请输入姓名"
|
||||||
|
clearable
|
||||||
|
style="width: 200px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户工号" prop="username">
|
||||||
|
<el-input
|
||||||
|
v-model="state.queryForm.username"
|
||||||
|
placeholder="请输入用户工号"
|
||||||
|
clearable
|
||||||
|
style="width: 200px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="getDataList">查询</el-button>
|
||||||
|
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<!-- 内容卡片 -->
|
||||||
|
<el-card class="content-card" shadow="never">
|
||||||
|
<template #header>
|
||||||
|
<div class="card-header">
|
||||||
|
<span class="card-title">
|
||||||
|
<el-icon class="title-icon"><User /></el-icon>
|
||||||
|
校领导(党委)管理
|
||||||
|
</span>
|
||||||
|
<div class="header-actions">
|
||||||
|
<el-button
|
||||||
|
icon="FolderAdd"
|
||||||
|
type="primary"
|
||||||
|
@click="formDialogRef.openDialog('add')">
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" class="ml10" @queryTable="getDataList" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 表格 -->
|
||||||
|
<el-table
|
||||||
|
ref="tableRef"
|
||||||
|
:data="state.dataList"
|
||||||
|
v-loading="state.loading"
|
||||||
|
stripe
|
||||||
|
:cell-style="tableStyle.cellStyle"
|
||||||
|
:header-cell-style="tableStyle.headerCellStyle"
|
||||||
|
class="modern-table">
|
||||||
|
<el-table-column type="index" label="序号" width="70" align="center">
|
||||||
|
<template #header>
|
||||||
|
<el-icon><List /></el-icon>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="name" label="姓名" min-width="120" show-overflow-tooltip>
|
||||||
|
<template #header>
|
||||||
|
<el-icon><User /></el-icon>
|
||||||
|
<span style="margin-left: 4px">姓名</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="username" label="用户工号" min-width="150" show-overflow-tooltip>
|
||||||
|
<template #header>
|
||||||
|
<el-icon><UserFilled /></el-icon>
|
||||||
|
<span style="margin-left: 4px">用户工号</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="remark" label="备注" min-width="300" show-overflow-tooltip>
|
||||||
|
<template #header>
|
||||||
|
<el-icon><EditPen /></el-icon>
|
||||||
|
<span style="margin-left: 4px">备注</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="createTime" label="创建时间" width="180" show-overflow-tooltip>
|
||||||
|
<template #header>
|
||||||
|
<el-icon><Clock /></el-icon>
|
||||||
|
<span style="margin-left: 4px">创建时间</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" fixed="right" width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
icon="Edit"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="formDialogRef.openDialog('edit', scope.row)">
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
icon="Delete"
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页 -->
|
||||||
|
<pagination
|
||||||
|
v-if="state.pagination"
|
||||||
|
v-show="state.pagination.total && state.pagination.total > 0"
|
||||||
|
:total="state.pagination.total"
|
||||||
|
:current="state.pagination.current"
|
||||||
|
:size="state.pagination.size"
|
||||||
|
@size-change="sizeChangeHandle"
|
||||||
|
@current-change="currentChangeHandle"
|
||||||
|
/>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 编辑、新增表单对话框 -->
|
||||||
|
<FormDialog ref="formDialogRef" @refresh="getDataList" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="PurchasingSchoolLeader">
|
||||||
|
import { ref, reactive, defineAsyncComponent } from 'vue'
|
||||||
|
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||||
|
import { getPage, delObj } from "/@/api/finance/purchasingschoolleader";
|
||||||
|
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||||
|
import { List, User, UserFilled, EditPen, Clock, Search } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
|
// 引入组件
|
||||||
|
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||||
|
|
||||||
|
// 定义变量内容
|
||||||
|
const tableRef = ref()
|
||||||
|
const formDialogRef = ref()
|
||||||
|
const searchFormRef = ref()
|
||||||
|
const showSearch = ref(true)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义响应式表格数据
|
||||||
|
*/
|
||||||
|
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||||
|
pageList: getPage,
|
||||||
|
queryForm: {
|
||||||
|
name: '',
|
||||||
|
username: '',
|
||||||
|
},
|
||||||
|
createdIsNeed: true
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用 useTable 定义表格相关操作
|
||||||
|
*/
|
||||||
|
const { getDataList, tableStyle, sizeChangeHandle, currentChangeHandle } = useTable(state);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置搜索表单
|
||||||
|
*/
|
||||||
|
const handleReset = () => {
|
||||||
|
searchFormRef.value?.resetFields();
|
||||||
|
getDataList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除当前行
|
||||||
|
* @param row - 当前行数据
|
||||||
|
*/
|
||||||
|
const handleDelete = async (row: any) => {
|
||||||
|
try {
|
||||||
|
await useMessageBox().confirm('确定要删除该记录吗?');
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await delObj([row.id]);
|
||||||
|
useMessage().success('删除成功');
|
||||||
|
getDataList();
|
||||||
|
} catch (err: any) {
|
||||||
|
useMessage().error(err.msg || '删除失败');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '/@/assets/styles/modern-page.scss';
|
||||||
|
</style>
|
||||||
|
|
||||||
Reference in New Issue
Block a user