岗位管理 人员性质管理 人员分类管理 模块接口调试完成
This commit is contained in:
parent
ce7eedfd37
commit
727deb8b4b
10
src/App.vue
10
src/App.vue
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<router-view />
|
||||
<router-view />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
|
@ -7,9 +7,9 @@ import useSettingsStore from '@/store/modules/settings'
|
|||
import { handleThemeStyle } from '@/utils/theme'
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
// 初始化主题样式
|
||||
handleThemeStyle(useSettingsStore().theme)
|
||||
})
|
||||
nextTick(() => {
|
||||
// 初始化主题样式
|
||||
handleThemeStyle(useSettingsStore().theme)
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -3,25 +3,17 @@ import request from '@/utils/request'
|
|||
// 人员分类管理 - 查询列表
|
||||
export function listPersonCategoryAPI(query) {
|
||||
return request({
|
||||
url: '/basic/personCategory/list',
|
||||
method: 'get',
|
||||
url: '/personnelClassification/getClassificationList',
|
||||
method: 'GET',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 人员分类管理 - 查询详情
|
||||
export function getPersonCategoryAPI(id) {
|
||||
return request({
|
||||
url: `/basic/personCategory/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 人员分类管理 - 新增
|
||||
export function addPersonCategoryAPI(data) {
|
||||
return request({
|
||||
url: '/basic/personCategory',
|
||||
method: 'post',
|
||||
url: '/personnelClassification/addClassification',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -29,16 +21,17 @@ export function addPersonCategoryAPI(data) {
|
|||
// 人员分类管理 - 修改
|
||||
export function updatePersonCategoryAPI(data) {
|
||||
return request({
|
||||
url: '/basic/personCategory',
|
||||
method: 'put',
|
||||
url: '/personnelClassification/updateClassification',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 人员分类管理 - 删除
|
||||
export function delPersonCategoryAPI(id) {
|
||||
export function delPersonCategoryAPI(data) {
|
||||
return request({
|
||||
url: `/basic/personCategory/${id}`,
|
||||
method: 'delete',
|
||||
url: `/personnelClassification/delClassification`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,25 +3,17 @@ import request from '@/utils/request'
|
|||
// 人员性质管理 - 查询列表
|
||||
export function listPersonNatureAPI(query) {
|
||||
return request({
|
||||
url: '/basic/personNature/list',
|
||||
method: 'get',
|
||||
url: '/personnelClassification/getClassificationList',
|
||||
method: 'GET',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 人员性质管理 - 查询详情
|
||||
export function getPersonNatureAPI(id) {
|
||||
return request({
|
||||
url: `/basic/personNature/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 人员性质管理 - 新增
|
||||
export function addPersonNatureAPI(data) {
|
||||
return request({
|
||||
url: '/basic/personNature',
|
||||
method: 'post',
|
||||
url: '/personnelClassification/addClassification',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -29,16 +21,17 @@ export function addPersonNatureAPI(data) {
|
|||
// 人员性质管理 - 修改
|
||||
export function updatePersonNatureAPI(data) {
|
||||
return request({
|
||||
url: '/basic/personNature',
|
||||
method: 'put',
|
||||
url: '/personnelClassification/updateClassification',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 人员性质管理 - 删除
|
||||
export function delPersonNatureAPI(id) {
|
||||
export function delPersonNatureAPI(data) {
|
||||
return request({
|
||||
url: `/basic/personNature/${id}`,
|
||||
method: 'delete',
|
||||
url: `/personnelClassification/delClassification`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,25 +3,17 @@ import request from '@/utils/request'
|
|||
// 岗位管理 - 查询列表
|
||||
export function listPositionAPI(query) {
|
||||
return request({
|
||||
url: '/basic/position/list',
|
||||
method: 'get',
|
||||
url: '/personnelClassification/getClassificationList',
|
||||
method: 'GET',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 岗位管理 - 查询详情
|
||||
export function getPositionAPI(id) {
|
||||
return request({
|
||||
url: `/basic/position/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 岗位管理 - 新增
|
||||
export function addPositionAPI(data) {
|
||||
return request({
|
||||
url: '/basic/position',
|
||||
method: 'post',
|
||||
url: '/personnelClassification/addClassification',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -29,16 +21,17 @@ export function addPositionAPI(data) {
|
|||
// 岗位管理 - 修改
|
||||
export function updatePositionAPI(data) {
|
||||
return request({
|
||||
url: '/basic/position',
|
||||
method: 'put',
|
||||
url: '/personnelClassification/updateClassification',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 岗位管理 - 删除
|
||||
export function delPositionAPI(id) {
|
||||
export function delPositionAPI(data) {
|
||||
return request({
|
||||
url: `/basic/position/${id}`,
|
||||
method: 'delete',
|
||||
url: `/personnelClassification/delClassification`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,25 +3,17 @@ import request from '@/utils/request'
|
|||
// 项目部管理 - 查询列表
|
||||
export function listProjectDeptAPI(query) {
|
||||
return request({
|
||||
url: '/basic/projectDept/list',
|
||||
method: 'get',
|
||||
url: '/inspectionStation/getInspectionStationList',
|
||||
method: 'GET',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 项目部管理 - 查询详情
|
||||
export function getProjectDeptAPI(id) {
|
||||
return request({
|
||||
url: `/basic/projectDept/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 项目部管理 - 新增
|
||||
export function addProjectDeptAPI(data) {
|
||||
return request({
|
||||
url: '/basic/projectDept',
|
||||
method: 'post',
|
||||
url: '/inspectionStation/addInspectionStation',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -29,16 +21,17 @@ export function addProjectDeptAPI(data) {
|
|||
// 项目部管理 - 修改
|
||||
export function updateProjectDeptAPI(data) {
|
||||
return request({
|
||||
url: '/basic/projectDept',
|
||||
method: 'put',
|
||||
url: '/inspectionStation/updateInspectionStation',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 项目部管理 - 删除
|
||||
export function delProjectDeptAPI(id) {
|
||||
export function delProjectDeptAPI(data) {
|
||||
return request({
|
||||
url: `/basic/projectDept/${id}`,
|
||||
method: 'delete',
|
||||
url: `/inspectionStation/delInspectionStation`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ export default {
|
|||
formColumns: [
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'name',
|
||||
prop: 'inspectionStationName',
|
||||
placeholder: '请输入运检站名称',
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<!-- 运检站管理 -->
|
||||
<div class="app-container">
|
||||
<!-- 运检站管理 -->
|
||||
<ComTable
|
||||
ref="comTableRef"
|
||||
:form-columns="formColumns"
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
>
|
||||
<!-- 工具栏插槽 -->
|
||||
<template #toolbar>
|
||||
<ComButton type="primary" icon="Plus" @click="onHandleAdd">新增</ComButton>
|
||||
<ComButton type="primary" icon="Plus" @click="onHandleAdd">新建运检站</ComButton>
|
||||
</template>
|
||||
</ComTable>
|
||||
|
||||
|
|
@ -51,7 +51,6 @@
|
|||
|
||||
<script setup name="inspectionStation">
|
||||
import { ref } from 'vue'
|
||||
const { proxy } = getCurrentInstance()
|
||||
import {
|
||||
listInspectionStationAPI,
|
||||
addInspectionStationAPI,
|
||||
|
|
@ -64,6 +63,7 @@ import ComButton from '@/components/ComButton/index.vue'
|
|||
import ComDialog from '@/components/ComDialog/index.vue'
|
||||
|
||||
const { formColumns, tableColumns, dialogConfig } = config
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const addAndEditFormRef = ref(null)
|
||||
const comTableRef = ref(null)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
import { reactive } from 'vue'
|
||||
export default {
|
||||
formColumns: [
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'personnelClassificationName',
|
||||
placeholder: '请输入人员分类名称',
|
||||
},
|
||||
],
|
||||
tableColumns: [
|
||||
{
|
||||
prop: 'personnelClassificationName',
|
||||
label: '人员分类名称',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
},
|
||||
],
|
||||
|
||||
dialogConfig: reactive({
|
||||
outerVisible: false,
|
||||
outerTitle: '新增人员分类',
|
||||
outerWidth: '720px',
|
||||
minHeight: '320px',
|
||||
maxHeight: '80vh',
|
||||
}),
|
||||
}
|
||||
|
|
@ -1,9 +1,158 @@
|
|||
<template>
|
||||
<div>
|
||||
<h1>人员分类管理</h1>
|
||||
<div class="app-container">
|
||||
<!-- 人员分类管理 -->
|
||||
<ComTable
|
||||
ref="comTableRef"
|
||||
:form-columns="formColumns"
|
||||
:table-columns="tableColumns"
|
||||
:load-data="listPersonCategoryAPI"
|
||||
:show-toolbar="true"
|
||||
:show-action="true"
|
||||
:action-columns="actionColumns"
|
||||
:default-query-params="{
|
||||
category: 1, // 0:人员分类 1:人员性质 2:岗位列表
|
||||
}"
|
||||
>
|
||||
<!-- 工具栏插槽 -->
|
||||
<template #toolbar>
|
||||
<ComButton type="primary" icon="Plus" @click="onHandleAdd">新建人员分类</ComButton>
|
||||
</template>
|
||||
</ComTable>
|
||||
|
||||
<ComDialog :dialog-config="dialogConfig" @closeDialogOuter="onCloseDialogOuter">
|
||||
<template #outerContent>
|
||||
<el-form
|
||||
size="large"
|
||||
label-width="100px"
|
||||
:model="addAndEditForm"
|
||||
ref="addAndEditFormRef"
|
||||
:rules="addAndEditRules"
|
||||
>
|
||||
<el-form-item label="人员分类名称" prop="personnelClassificationName">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入人员分类名称"
|
||||
v-model.trim="addAndEditForm.personnelClassificationName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="addAndEditForm.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row class="common-btn-row">
|
||||
<ComButton plain type="info" @click="onHandleCancel">取消</ComButton>
|
||||
<ComButton @click="onHandleSave">保存</ComButton>
|
||||
</el-row>
|
||||
</template>
|
||||
</ComDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="PersonCategory"></script>
|
||||
<script setup name="PersonNature">
|
||||
import { ref } from 'vue'
|
||||
import {
|
||||
listPersonCategoryAPI,
|
||||
addPersonCategoryAPI,
|
||||
delPersonCategoryAPI,
|
||||
updatePersonCategoryAPI,
|
||||
} from '@/api/basicManage/personCategory'
|
||||
import config from './config'
|
||||
import ComTable from '@/components/ComTable/index.vue'
|
||||
import ComButton from '@/components/ComButton/index.vue'
|
||||
import ComDialog from '@/components/ComDialog/index.vue'
|
||||
|
||||
<style></style>
|
||||
const { formColumns, tableColumns, dialogConfig } = config
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const addAndEditFormRef = ref(null)
|
||||
const comTableRef = ref(null)
|
||||
const editId = ref(null)
|
||||
const addAndEditForm = ref({
|
||||
personnelClassificationName: '',
|
||||
remark: '',
|
||||
category: 1,
|
||||
})
|
||||
|
||||
const addAndEditRules = ref({
|
||||
personnelClassificationName: [
|
||||
{ required: true, message: '请输入人员分类名称', trigger: 'blur' },
|
||||
],
|
||||
})
|
||||
|
||||
const actionColumns = [
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'primary',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
const { personnelClassificationId, personnelClassificationName, remark } = row
|
||||
addAndEditForm.value = {
|
||||
personnelClassificationId,
|
||||
personnelClassificationName,
|
||||
remark,
|
||||
}
|
||||
editId.value = row.personnelClassificationId
|
||||
dialogConfig.outerTitle = '编辑人员分类'
|
||||
dialogConfig.outerVisible = true
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
type: 'danger',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
proxy.$modal.confirm('是否确认删除该人员分类?').then(async () => {
|
||||
const result = await delPersonCategoryAPI({
|
||||
personnelClassificationId: row.personnelClassificationId,
|
||||
})
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
// 新增
|
||||
const onHandleAdd = () => {
|
||||
editId.value = null
|
||||
dialogConfig.outerVisible = true
|
||||
}
|
||||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
dialogConfig.outerVisible = false
|
||||
}
|
||||
|
||||
// 保存
|
||||
const onHandleSave = async () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
addAndEditFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const API = editId.value ? updatePersonCategoryAPI : addPersonCategoryAPI
|
||||
const params = JSON.parse(JSON.stringify(addAndEditForm.value))
|
||||
editId.value ? (params.personnelClassificationId = editId.value) : null
|
||||
|
||||
const result = await API(params)
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess(editId.value ? '编辑成功' : '新增成功')
|
||||
addAndEditFormRef.value.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
resolve(result)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const onCloseDialogOuter = (visible) => {
|
||||
dialogConfig.outerVisible = visible
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
import { reactive } from 'vue'
|
||||
export default {
|
||||
formColumns: [
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'personnelClassificationName',
|
||||
placeholder: '请输入人员性质名称',
|
||||
},
|
||||
],
|
||||
tableColumns: [
|
||||
{
|
||||
prop: 'personnelClassificationName',
|
||||
label: '人员性质名称',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
},
|
||||
],
|
||||
|
||||
dialogConfig: reactive({
|
||||
outerVisible: false,
|
||||
outerTitle: '新增人员性质',
|
||||
outerWidth: '720px',
|
||||
minHeight: '320px',
|
||||
maxHeight: '80vh',
|
||||
}),
|
||||
}
|
||||
|
|
@ -1,9 +1,158 @@
|
|||
<template>
|
||||
<div>
|
||||
<h1>人员性质管理</h1>
|
||||
<div class="app-container">
|
||||
<!-- 人员性质管理 -->
|
||||
<ComTable
|
||||
ref="comTableRef"
|
||||
:form-columns="formColumns"
|
||||
:table-columns="tableColumns"
|
||||
:load-data="listPersonNatureAPI"
|
||||
:show-toolbar="true"
|
||||
:show-action="true"
|
||||
:action-columns="actionColumns"
|
||||
:default-query-params="{
|
||||
category: 1, // 0:人员分类 1:人员性质 2:岗位列表
|
||||
}"
|
||||
>
|
||||
<!-- 工具栏插槽 -->
|
||||
<template #toolbar>
|
||||
<ComButton type="primary" icon="Plus" @click="onHandleAdd">新建人员性质</ComButton>
|
||||
</template>
|
||||
</ComTable>
|
||||
|
||||
<ComDialog :dialog-config="dialogConfig" @closeDialogOuter="onCloseDialogOuter">
|
||||
<template #outerContent>
|
||||
<el-form
|
||||
size="large"
|
||||
label-width="auto"
|
||||
:model="addAndEditForm"
|
||||
ref="addAndEditFormRef"
|
||||
:rules="addAndEditRules"
|
||||
>
|
||||
<el-form-item label="人员性质名称" prop="personnelClassificationName">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入人员性质名称"
|
||||
v-model.trim="addAndEditForm.personnelClassificationName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="addAndEditForm.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row class="common-btn-row">
|
||||
<ComButton plain type="info" @click="onHandleCancel">取消</ComButton>
|
||||
<ComButton @click="onHandleSave">保存</ComButton>
|
||||
</el-row>
|
||||
</template>
|
||||
</ComDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="PersonNature"></script>
|
||||
<script setup name="PersonNature">
|
||||
import { ref } from 'vue'
|
||||
import {
|
||||
listPersonNatureAPI,
|
||||
addPersonNatureAPI,
|
||||
delPersonNatureAPI,
|
||||
updatePersonNatureAPI,
|
||||
} from '@/api/basicManage/personNature'
|
||||
import config from './config'
|
||||
import ComTable from '@/components/ComTable/index.vue'
|
||||
import ComButton from '@/components/ComButton/index.vue'
|
||||
import ComDialog from '@/components/ComDialog/index.vue'
|
||||
|
||||
<style></style>
|
||||
const { formColumns, tableColumns, dialogConfig } = config
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const addAndEditFormRef = ref(null)
|
||||
const comTableRef = ref(null)
|
||||
const editId = ref(null)
|
||||
const addAndEditForm = ref({
|
||||
personnelClassificationName: '',
|
||||
remark: '',
|
||||
category: 1,
|
||||
})
|
||||
|
||||
const addAndEditRules = ref({
|
||||
personnelClassificationName: [
|
||||
{ required: true, message: '请输入人员性质名称', trigger: 'blur' },
|
||||
],
|
||||
})
|
||||
|
||||
const actionColumns = [
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'primary',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
const { personnelClassificationId, personnelClassificationName, remark } = row
|
||||
addAndEditForm.value = {
|
||||
personnelClassificationId,
|
||||
personnelClassificationName,
|
||||
remark,
|
||||
}
|
||||
editId.value = row.personnelClassificationId
|
||||
dialogConfig.outerTitle = '编辑人员性质'
|
||||
dialogConfig.outerVisible = true
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
type: 'danger',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
proxy.$modal.confirm('是否确认删除该人员性质?').then(async () => {
|
||||
const result = await delPersonNatureAPI({
|
||||
personnelClassificationId: row.personnelClassificationId,
|
||||
})
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
// 新增
|
||||
const onHandleAdd = () => {
|
||||
editId.value = null
|
||||
dialogConfig.outerVisible = true
|
||||
}
|
||||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
dialogConfig.outerVisible = false
|
||||
}
|
||||
|
||||
// 保存
|
||||
const onHandleSave = async () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
addAndEditFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const API = editId.value ? updatePersonNatureAPI : addPersonNatureAPI
|
||||
const params = JSON.parse(JSON.stringify(addAndEditForm.value))
|
||||
editId.value ? (params.personnelClassificationId = editId.value) : null
|
||||
|
||||
const result = await API(params)
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess(editId.value ? '编辑成功' : '新增成功')
|
||||
addAndEditFormRef.value.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
resolve(result)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const onCloseDialogOuter = (visible) => {
|
||||
dialogConfig.outerVisible = visible
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
import { reactive } from 'vue'
|
||||
export default {
|
||||
formColumns: [
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'personnelClassificationName',
|
||||
placeholder: '请输入岗位名称',
|
||||
},
|
||||
],
|
||||
tableColumns: [
|
||||
{
|
||||
prop: 'personnelClassificationName',
|
||||
label: '岗位名称',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
},
|
||||
],
|
||||
|
||||
dialogConfig: reactive({
|
||||
outerVisible: false,
|
||||
outerTitle: '新增岗位',
|
||||
outerWidth: '720px',
|
||||
minHeight: '320px',
|
||||
maxHeight: '80vh',
|
||||
}),
|
||||
}
|
||||
|
|
@ -1,10 +1,156 @@
|
|||
<template>
|
||||
<div>
|
||||
<h1>岗位管理</h1>
|
||||
<div class="app-container">
|
||||
<!-- 岗位管理 -->
|
||||
<ComTable
|
||||
ref="comTableRef"
|
||||
:form-columns="formColumns"
|
||||
:table-columns="tableColumns"
|
||||
:load-data="listPositionAPI"
|
||||
:show-toolbar="true"
|
||||
:show-action="true"
|
||||
:action-columns="actionColumns"
|
||||
:default-query-params="{
|
||||
category: 2, // 0:人员分类 1:人员性质 2:岗位列表
|
||||
}"
|
||||
>
|
||||
<!-- 工具栏插槽 -->
|
||||
<template #toolbar>
|
||||
<ComButton type="primary" icon="Plus" @click="onHandleAdd">新建岗位</ComButton>
|
||||
</template>
|
||||
</ComTable>
|
||||
|
||||
<ComDialog :dialog-config="dialogConfig" @closeDialogOuter="onCloseDialogOuter">
|
||||
<template #outerContent>
|
||||
<el-form
|
||||
size="large"
|
||||
label-width="100px"
|
||||
:model="addAndEditForm"
|
||||
ref="addAndEditFormRef"
|
||||
:rules="addAndEditRules"
|
||||
>
|
||||
<el-form-item label="岗位名称" prop="personnelClassificationName">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入岗位名称"
|
||||
v-model.trim="addAndEditForm.personnelClassificationName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="addAndEditForm.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row class="common-btn-row">
|
||||
<ComButton plain type="info" @click="onHandleCancel">取消</ComButton>
|
||||
<ComButton @click="onHandleSave">保存</ComButton>
|
||||
</el-row>
|
||||
</template>
|
||||
</ComDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Position"></script>
|
||||
<script setup name="Position">
|
||||
import { ref } from 'vue'
|
||||
import {
|
||||
listPositionAPI,
|
||||
addPositionAPI,
|
||||
delPositionAPI,
|
||||
updatePositionAPI,
|
||||
} from '@/api/basicManage/position'
|
||||
import config from './config'
|
||||
import ComTable from '@/components/ComTable/index.vue'
|
||||
import ComButton from '@/components/ComButton/index.vue'
|
||||
import ComDialog from '@/components/ComDialog/index.vue'
|
||||
|
||||
<style></style>
|
||||
const { formColumns, tableColumns, dialogConfig } = config
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const addAndEditFormRef = ref(null)
|
||||
const comTableRef = ref(null)
|
||||
const editId = ref(null)
|
||||
const addAndEditForm = ref({
|
||||
personnelClassificationName: '',
|
||||
remark: '',
|
||||
category: 2,
|
||||
})
|
||||
|
||||
const addAndEditRules = ref({
|
||||
personnelClassificationName: [{ required: true, message: '请输入岗位名称', trigger: 'blur' }],
|
||||
})
|
||||
|
||||
const actionColumns = [
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'primary',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
const { personnelClassificationId, personnelClassificationName, remark } = row
|
||||
addAndEditForm.value = {
|
||||
personnelClassificationId,
|
||||
personnelClassificationName,
|
||||
remark,
|
||||
}
|
||||
editId.value = row.personnelClassificationId
|
||||
dialogConfig.outerTitle = '编辑岗位'
|
||||
dialogConfig.outerVisible = true
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
type: 'danger',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
proxy.$modal.confirm('是否确认删除该岗位?').then(async () => {
|
||||
const result = await delPositionAPI({
|
||||
personnelClassificationId: row.personnelClassificationId,
|
||||
})
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
// 新增
|
||||
const onHandleAdd = () => {
|
||||
editId.value = null
|
||||
dialogConfig.outerVisible = true
|
||||
}
|
||||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
dialogConfig.outerVisible = false
|
||||
}
|
||||
|
||||
// 保存
|
||||
const onHandleSave = async () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
addAndEditFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const API = editId.value ? updatePositionAPI : addPositionAPI
|
||||
const params = JSON.parse(JSON.stringify(addAndEditForm.value))
|
||||
editId.value ? (params.personnelClassificationId = editId.value) : null
|
||||
|
||||
const result = await API(params)
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess(editId.value ? '编辑成功' : '新增成功')
|
||||
addAndEditFormRef.value.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
resolve(result)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const onCloseDialogOuter = (visible) => {
|
||||
dialogConfig.outerVisible = visible
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
import { reactive } from 'vue'
|
||||
export default {
|
||||
formColumns: [
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'inspectionStationName',
|
||||
placeholder: '请输入项目部名称',
|
||||
},
|
||||
],
|
||||
tableColumns: [
|
||||
{
|
||||
prop: 'inspectionStationName',
|
||||
label: '项目部名称',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
},
|
||||
],
|
||||
|
||||
dialogConfig: reactive({
|
||||
outerVisible: false,
|
||||
outerTitle: '新增项目部',
|
||||
outerWidth: '720px',
|
||||
minHeight: '320px',
|
||||
maxHeight: '80vh',
|
||||
}),
|
||||
}
|
||||
|
|
@ -1,10 +1,156 @@
|
|||
<template>
|
||||
<div>
|
||||
<h1>项目部管理</h1>
|
||||
<div class="app-container">
|
||||
<!-- 项目部管理 -->
|
||||
<ComTable
|
||||
ref="comTableRef"
|
||||
:form-columns="formColumns"
|
||||
:table-columns="tableColumns"
|
||||
:load-data="listProjectDeptAPI"
|
||||
:show-toolbar="true"
|
||||
:show-action="true"
|
||||
:action-columns="actionColumns"
|
||||
:default-query-params="{
|
||||
category: 1, // 0: 项目部, 1: 项目部
|
||||
}"
|
||||
>
|
||||
<!-- 工具栏插槽 -->
|
||||
<template #toolbar>
|
||||
<ComButton type="primary" icon="Plus" @click="onHandleAdd">新建项目部</ComButton>
|
||||
</template>
|
||||
</ComTable>
|
||||
|
||||
<ComDialog :dialog-config="dialogConfig" @closeDialogOuter="onCloseDialogOuter">
|
||||
<template #outerContent>
|
||||
<el-form
|
||||
size="large"
|
||||
label-width="100px"
|
||||
:model="addAndEditForm"
|
||||
ref="addAndEditFormRef"
|
||||
:rules="addAndEditRules"
|
||||
>
|
||||
<el-form-item label="项目部名称" prop="inspectionStationName">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入项目部名称"
|
||||
v-model.trim="addAndEditForm.inspectionStationName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="addAndEditForm.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row class="common-btn-row">
|
||||
<ComButton plain type="info" @click="onHandleCancel">取消</ComButton>
|
||||
<ComButton @click="onHandleSave">保存</ComButton>
|
||||
</el-row>
|
||||
</template>
|
||||
</ComDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="ProjectDept"></script>
|
||||
<script setup name="projectDept">
|
||||
import { ref } from 'vue'
|
||||
import {
|
||||
listProjectDeptAPI,
|
||||
addProjectDeptAPI,
|
||||
delProjectDeptAPI,
|
||||
updateProjectDeptAPI,
|
||||
} from '@/api/basicManage/projectDept'
|
||||
import config from './config'
|
||||
import ComTable from '@/components/ComTable/index.vue'
|
||||
import ComButton from '@/components/ComButton/index.vue'
|
||||
import ComDialog from '@/components/ComDialog/index.vue'
|
||||
|
||||
<style></style>
|
||||
const { formColumns, tableColumns, dialogConfig } = config
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const addAndEditFormRef = ref(null)
|
||||
const comTableRef = ref(null)
|
||||
const editId = ref(null)
|
||||
const addAndEditForm = ref({
|
||||
inspectionStationName: '',
|
||||
remark: '',
|
||||
category: 1,
|
||||
})
|
||||
|
||||
const addAndEditRules = ref({
|
||||
inspectionStationName: [{ required: true, message: '请输入项目部名称', trigger: 'blur' }],
|
||||
})
|
||||
|
||||
const actionColumns = [
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'primary',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
const { inspectionStationId, inspectionStationName, remark } = row
|
||||
addAndEditForm.value = {
|
||||
inspectionStationId,
|
||||
inspectionStationName,
|
||||
remark,
|
||||
}
|
||||
editId.value = row.inspectionStationId
|
||||
dialogConfig.outerTitle = '编辑项目部'
|
||||
dialogConfig.outerVisible = true
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
type: 'danger',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
proxy.$modal.confirm('是否确认删除该项目部?').then(async () => {
|
||||
const result = await delProjectDeptAPI({
|
||||
inspectionStationId: row.inspectionStationId,
|
||||
})
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
// 新增
|
||||
const onHandleAdd = () => {
|
||||
editId.value = null
|
||||
dialogConfig.outerVisible = true
|
||||
}
|
||||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
dialogConfig.outerVisible = false
|
||||
}
|
||||
|
||||
// 保存
|
||||
const onHandleSave = async () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
addAndEditFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const API = editId.value ? updateProjectDeptAPI : addProjectDeptAPI
|
||||
const params = JSON.parse(JSON.stringify(addAndEditForm.value))
|
||||
editId.value ? (params.inspectionStationId = editId.value) : null
|
||||
|
||||
const result = await API(params)
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess(editId.value ? '编辑成功' : '新增成功')
|
||||
addAndEditFormRef.value.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
resolve(result)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const onCloseDialogOuter = (visible) => {
|
||||
dialogConfig.outerVisible = visible
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue