施工人员黑名单后端逻辑优化,增加前端页面
This commit is contained in:
163
plus-ui/src/views/project/constructionBlacklist/index.vue
Normal file
163
plus-ui/src/views/project/constructionBlacklist/index.vue
Normal file
@ -0,0 +1,163 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="名字" prop="userName">
|
||||
<el-input v-model="queryParams.userName" placeholder="请输入名字" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="身份证号码" prop="sfzNumber" label-width="120">
|
||||
<el-input v-model="queryParams.sfzNumber" placeholder="请输入身份证号码" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete()"
|
||||
v-hasPermi="['project:constructionBlacklist:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="constructionBlacklistList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" type="index" width="60" align="center" />
|
||||
<el-table-column label="名字" align="center" prop="userName" />
|
||||
<el-table-column label="身份证号码" align="center" prop="sfzNumber" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:constructionBlacklist:remove']">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="ConstructionBlacklist" lang="ts">
|
||||
import { delConstructionBlacklist, listConstructionBlacklist } from '@/api/project/constructionBlacklist';
|
||||
import { ConstructionBlacklistForm, ConstructionBlacklistQuery, ConstructionBlacklistVO } from '@/api/project/constructionBlacklist/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
// 获取用户 store
|
||||
const userStore = useUserStoreHook();
|
||||
// 从 store 中获取项目列表和当前选中的项目
|
||||
const currentProject = computed(() => userStore.selectedProject);
|
||||
const constructionBlacklistList = ref<ConstructionBlacklistVO[]>([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const constructionBlacklistFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: ConstructionBlacklistForm = {
|
||||
projectId: currentProject.value.id,
|
||||
userId: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
const data = reactive<PageData<ConstructionBlacklistForm, ConstructionBlacklistQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
id: undefined,
|
||||
projectId: currentProject.value.id,
|
||||
userId: undefined,
|
||||
userName: undefined,
|
||||
sfzNumber: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
projectId: [{ required: true, message: '项目id不能为空', trigger: 'blur' }],
|
||||
userId: [{ required: true, message: '用户id不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询黑名单列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listConstructionBlacklist(queryParams.value);
|
||||
constructionBlacklistList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
constructionBlacklistFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: ConstructionBlacklistVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ConstructionBlacklistVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除黑名单编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delConstructionBlacklist(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
@ -12,6 +12,11 @@
|
||||
<el-option v-for="item in contractorOpt" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="班组" prop="contractorId">
|
||||
<el-select v-model="queryParams.teamId" clearable placeholder="请选择班组">
|
||||
<el-option v-for="item in projectTeamOpt" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工种" prop="typeOfWork">
|
||||
<el-select v-model="queryParams.typeOfWork" clearable placeholder="请选择工种">
|
||||
<el-option v-for="item in type_of_work" :key="item.value" :label="item.label" :value="item.value" />
|
||||
@ -71,16 +76,15 @@
|
||||
{{ getTeamName(scope.row.teamId) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status" />
|
||||
<el-table-column label="联系电话" align="center" prop="phone" />
|
||||
<el-table-column label="联系电话" align="center" prop="phone" min-width="120" />
|
||||
<el-table-column label="性别" align="center" prop="sex">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="user_sex_type" :value="scope.row.sex" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="民族" align="center" prop="nation" />
|
||||
<el-table-column label="身份证号码" align="center" prop="sfzNumber" />
|
||||
<el-table-column label="工种" align="center" prop="typeOfWork">
|
||||
<el-table-column label="身份证号码" align="center" prop="sfzNumber" min-width="180" />
|
||||
<el-table-column label="工种" align="center" prop="typeOfWork" min-width="120">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="type_of_work" :value="scope.row.typeOfWork" />
|
||||
</template>
|
||||
@ -90,11 +94,16 @@
|
||||
<dict-tag :options="user_clock_type" :value="scope.row.clock" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="入场时间" align="center" prop="entryDate" />
|
||||
<el-table-column label="离场时间" align="center" prop="leaveDate" />
|
||||
<el-table-column label="入场时间" align="center" prop="entryDate" min-width="180" />
|
||||
<el-table-column label="离场时间" align="center" prop="leaveDate" min-width="180" />
|
||||
<el-table-column label="薪水" align="center" prop="salary" />
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
{{ scope.row.status == 0 ? '在职' : '离职' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" min-width="300">
|
||||
<template #default="scope">
|
||||
<el-space wrap>
|
||||
<el-button link type="primary" icon="View" @click="handleShowDrawer(scope.row)" v-hasPermi="['project:constructionUser:query']">
|
||||
@ -103,6 +112,9 @@
|
||||
<el-button link type="success" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['project:constructionUser:edit']">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button link type="danger" icon="Avatar" @click="handleJoinBlacklist(scope.row)" v-hasPermi="['project:constructionBlacklist:add']">
|
||||
黑名单
|
||||
</el-button>
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['project:constructionUser:remove']">
|
||||
删除
|
||||
</el-button>
|
||||
@ -271,7 +283,7 @@ import { listProjectTeam } from '@/api/project/projectTeam';
|
||||
import { ContractorVO } from '@/api/project/contractor/types';
|
||||
import { ProjectTeamVO } from '@/api/project/projectTeam/types';
|
||||
import ConstructionUserDetail from '@/views/project/constructionUser/component/ConstructionUserDetail.vue';
|
||||
import ProjectTypes from '@/utils/propTypes';
|
||||
import { addConstructionBlacklist } from '@/api/project/constructionBlacklist';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { type_of_work, user_sex_type, user_clock_type } = toRefs<any>(proxy?.useDict('type_of_work', 'user_sex_type', 'user_clock_type'));
|
||||
@ -494,6 +506,17 @@ const submitForm = () => {
|
||||
});
|
||||
};
|
||||
|
||||
/** 加入黑名单按钮操作 */
|
||||
const handleJoinBlacklist = async (row?: ConstructionUserVO) => {
|
||||
await proxy?.$modal.confirm('确认要将该员工加入黑名单吗?').finally(() => (loading.value = false));
|
||||
await addConstructionBlacklist({
|
||||
userId: row.id,
|
||||
projectId: currentProject.value.id
|
||||
});
|
||||
proxy?.$modal.msgSuccess('加入成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ConstructionUserVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
|
@ -86,7 +86,7 @@
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="projectTeamMemberFormRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="施工人员" prop="memberId">
|
||||
<el-select v-model="form.memberId" clearable placeholder="请选择人员">
|
||||
<el-select v-model="form.memberId" clearable placeholder="请选择人员" filterable>
|
||||
<el-option v-for="item in userNotInTeamOpt" :key="item.value" :label="item.label" :value="item.value" />
|
||||
<pagination
|
||||
size="small"
|
||||
@ -231,7 +231,8 @@ const userQueryParams = ref<ConstructionUserQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
orderByColumn: 'createTime',
|
||||
isAsc: 'desc'
|
||||
isAsc: 'desc',
|
||||
projectId: currentProject.value.id
|
||||
});
|
||||
|
||||
// 获取不在当前班组的成员
|
||||
|
@ -5,18 +5,18 @@
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="工种" prop="workType">
|
||||
<el-select v-model="queryParams.workType" placeholder="请选择工种" clearable >
|
||||
<el-option v-for="dict in type_of_work" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
<el-select v-model="queryParams.workType" placeholder="请选择工种" clearable>
|
||||
<el-option v-for="dict in type_of_work" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工资计算方式" prop="wageCalculationType" label-width="100px">
|
||||
<el-select v-model="queryParams.wageCalculationType" placeholder="请选择工资计算方式" clearable >
|
||||
<el-option v-for="dict in wageCalculationTypeList" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
<el-select v-model="queryParams.wageCalculationType" placeholder="请选择工资计算方式" clearable>
|
||||
<el-option v-for="dict in wageCalculationTypeList" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工资计量单位" prop="wageMeasureUnit" label-width="100px">
|
||||
<el-select v-model="queryParams.wageMeasureUnit" placeholder="请选择工资计量单位" clearable >
|
||||
<el-option v-for="dict in wage_measure_unit_type" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
<el-select v-model="queryParams.wageMeasureUnit" placeholder="请选择工资计量单位" clearable>
|
||||
<el-option v-for="dict in wage_measure_unit_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
@ -32,16 +32,20 @@
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['project:workWage:add']">新增</el-button>
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['project:workWage:add']">新增 </el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['project:workWage:edit']">修改</el-button>
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['project:workWage:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['project:workWage:remove']">删除</el-button>
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['project:workWage:remove']"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['project:workWage:export']">导出</el-button>
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['project:workWage:export']">导出 </el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@ -49,28 +53,28 @@
|
||||
|
||||
<el-table v-loading="loading" :data="workWageList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" type="index" width="60px"/>
|
||||
<el-table-column label="序号" align="center" type="index" width="60px" />
|
||||
<!-- <el-table-column label="主键id" align="center" prop="id" v-if="true" /> -->
|
||||
<!-- <el-table-column label="项目id" align="center" prop="projectId" /> -->
|
||||
<el-table-column label="工种" align="center" prop="workType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="type_of_work" :value="scope.row.workType"/>
|
||||
<dict-tag :options="type_of_work" :value="scope.row.workType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否是特种兵" align="center" prop="isSpecialType" >
|
||||
<el-table-column label="是否是特种兵" align="center" prop="isSpecialType">
|
||||
<template #default="scope">
|
||||
{{ scope.row.isSpecialType==1?'是':"否" }}
|
||||
{{ scope.row.isSpecialType == 1 ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工资计算方式" align="center" prop="wageCalculationType" >
|
||||
<el-table-column label="工资计算方式" align="center" prop="wageCalculationType">
|
||||
<template #default="scope">
|
||||
{{ scope.row.wageCalculationType==1?'计时':"计件" }}
|
||||
{{ scope.row.wageCalculationType == 1 ? '计时' : '计件' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工资标准" align="center" prop="wage" />
|
||||
<el-table-column label="工资计量单位" align="center" prop="wageMeasureUnit">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="wage_measure_unit_type" :value="scope.row.wageMeasureUnit"/>
|
||||
<dict-tag :options="wage_measure_unit_type" :value="scope.row.wageMeasureUnit" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" />
|
||||
@ -97,32 +101,17 @@
|
||||
</el-form-item> -->
|
||||
<el-form-item label="工种" prop="workType">
|
||||
<el-select v-model="form.workType" placeholder="请选择工种">
|
||||
<el-option
|
||||
v-for="dict in type_of_work"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option v-for="dict in type_of_work" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否是特种兵 " prop="isSpecialType">
|
||||
<el-select v-model="form.isSpecialType" placeholder="请选择是否是特种兵">
|
||||
<el-option
|
||||
v-for="dict in isSpecialTypeList"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option v-for="dict in isSpecialTypeList" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工资计算方式" prop="wageCalculationType">
|
||||
<el-select v-model="form.wageCalculationType" placeholder="请选择工资计算方式">
|
||||
<el-option
|
||||
v-for="dict in wageCalculationTypeList"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option v-for="dict in wageCalculationTypeList" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工资标准" prop="wage">
|
||||
@ -130,16 +119,11 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="工资计量单位" prop="wageMeasureUnit">
|
||||
<el-select v-model="form.wageMeasureUnit" placeholder="请选择工资计量单位">
|
||||
<el-option
|
||||
v-for="dict in wage_measure_unit_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
<el-option v-for="dict in wage_measure_unit_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@ -154,8 +138,9 @@
|
||||
|
||||
<script setup name="WorkWage" lang="ts">
|
||||
import { listWorkWage, getWorkWage, delWorkWage, addWorkWage, updateWorkWage } from '@/api/project/workWage';
|
||||
import { WorkWageVO, WorkWageQuery, WorkWageForm,SpecialType } from '@/api/project/workWage/types';
|
||||
import { WorkWageVO, WorkWageQuery, WorkWageForm, SpecialType } from '@/api/project/workWage/types';
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { type_of_work, wage_measure_unit_type } = toRefs<any>(proxy?.useDict('type_of_work', 'wage_measure_unit_type'));
|
||||
console.log(type_of_work);
|
||||
@ -175,15 +160,15 @@ const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const workWageFormRef = ref<ElFormInstance>();
|
||||
const isSpecialTypeList=ref<Array<SpecialType>>([
|
||||
{label:"是",value:"1"},
|
||||
{label:"否",value:"2"}
|
||||
])
|
||||
const isSpecialTypeList = ref<Array<SpecialType>>([
|
||||
{ label: '是', value: '1' },
|
||||
{ label: '否', value: '2' }
|
||||
]);
|
||||
|
||||
const wageCalculationTypeList=ref<Array<SpecialType>>([
|
||||
{label:"计时",value:"1"},
|
||||
{label:"计件",value:"2"}
|
||||
])
|
||||
const wageCalculationTypeList = ref<Array<SpecialType>>([
|
||||
{ label: '计时', value: '1' },
|
||||
{ label: '计件', value: '2' }
|
||||
]);
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
@ -197,10 +182,10 @@ const initFormData: WorkWageForm = {
|
||||
wageCalculationType: undefined,
|
||||
wage: undefined,
|
||||
wageMeasureUnit: undefined,
|
||||
remark: undefined,
|
||||
}
|
||||
remark: undefined
|
||||
};
|
||||
const data = reactive<PageData<WorkWageForm, WorkWageQuery>>({
|
||||
form: {...initFormData},
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
@ -210,13 +195,10 @@ const data = reactive<PageData<WorkWageForm, WorkWageQuery>>({
|
||||
wageCalculationType: undefined,
|
||||
wage: undefined,
|
||||
wageMeasureUnit: undefined,
|
||||
params: {
|
||||
}
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: "主键id不能为空", trigger: "blur" }
|
||||
],
|
||||
id: [{ required: true, message: '主键id不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
@ -229,55 +211,55 @@ const getList = async () => {
|
||||
workWageList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = {...initFormData};
|
||||
form.value = { ...initFormData };
|
||||
workWageFormRef.value?.resetFields();
|
||||
}
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: WorkWageVO[]) => {
|
||||
ids.value = selection.map(item => item.id);
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
};
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = "添加工种薪水";
|
||||
}
|
||||
dialog.title = '添加工种薪水';
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: WorkWageVO) => {
|
||||
reset();
|
||||
const _id = row?.id || ids.value[0]
|
||||
const _id = row?.id || ids.value[0];
|
||||
const res = await getWorkWage(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = "修改工种薪水";
|
||||
}
|
||||
dialog.title = '修改工种薪水';
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
@ -285,32 +267,36 @@ const submitForm = () => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateWorkWage(form.value).finally(() => buttonLoading.value = false);
|
||||
await updateWorkWage(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addWorkWage(form.value).finally(() => buttonLoading.value = false);
|
||||
await addWorkWage(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess("操作成功");
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: WorkWageVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除工种薪水编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
|
||||
await proxy?.$modal.confirm('是否确认删除工种薪水编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delWorkWage(_ids);
|
||||
proxy?.$modal.msgSuccess("删除成功");
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
}
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download('project/workWage/export', {
|
||||
...queryParams.value
|
||||
}, `workWage_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
proxy?.download(
|
||||
'project/workWage/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`workWage_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
|
Reference in New Issue
Block a user