更新最新程序

This commit is contained in:
XingCheng3
2026-06-26 13:45:55 +08:00
parent 3ed5f66667
commit 79d5b0f426
3 changed files with 146 additions and 629 deletions

View File

@@ -1,18 +1,13 @@
import request from '@/utils/request'
import state from '@/store'
import router from '@/router'
import Vue from 'vue'
export function getTree(pid) {
return request({
url: '',
method: 'post',
data: {
UserID: state.state.user.id,
ModularID: router.currentRoute.path,
type: 1,
name: '人事档案管理_部门关系_查询节点',
param: '子节点=' + pid + '=int'
}
})
const param = []
param[0] = ['子节点', pid]
const Data = Vue.prototype.CreateData('1', '人事档案管理_部门关系_查询节点', param)
return Vue.prototype.ExecDatabase(Data)
}
export function tree(data, pid) {
const result = []

View File

@@ -416,7 +416,7 @@
</template>
<script>
import { fetchteamviwer, moveGroups, getTree, tree, getTablePeople, getTablePeopleForName, addDepartmentName, delList, editList, fetchEducationData, fetchPostData, addPeople, editPeople, quit, reinstate, searchLeavingList } from '@/api/BasicData/PersonnelManagement'
import { tree } from '@/api/BasicData/PersonnelManagement'
import { uploadPerson } from '@/utils/request'
import { readFile } from '@/utils/request'
import request from '@/utils/request'
@@ -571,7 +571,9 @@ export default {
},
// 获取班组信息
fetchTeamViwer() {
fetchteamviwer().then(response => {
const param = []
const Data = this.CreateData('11', '班组管理_班组查询', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Team.push({
label: response.data[i].班组名称,
@@ -654,16 +656,37 @@ export default {
})
},
fetchEducationData() {
this.getSelect(fetchEducationData, ['学历名称', '学历编号'], 'EducationDate')
const param = []
const Data = this.CreateData('11', '人事档案管理_基础表_学历_查询数据', param)
this.ExecDatabase(Data).then(response => {
this.EducationDate = []
for (let i = 0; i < response.data.length; i++) {
this.EducationDate.push({
label: response.data[i]['学历名称'],
value: response.data[i]['学历编号']
})
}
})
},
fetchPostData() {
this.people_form.Post = ''
this.PostData = []
this.getSelect(fetchPostData, ['岗位名称', '岗位编号'], 'PostData')
const param = []
const Data = this.CreateData('11', '人事档案管理_基础表_人员岗位_查询数据', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.PostData.push({
label: response.data[i]['岗位名称'],
value: response.data[i]['岗位编号']
})
}
})
},
getTreeData() {
getTree(0).then(response => {
// getTree(this.departmentId).then(response => {
const param = []
param[0] = ['子节点', 0]
const Data = this.CreateData('11', '人事档案管理_部门关系_查询节点', param)
this.ExecDatabase(Data).then(response => {
const data = response.data
this.departmentData = tree(data, 0)
})
@@ -675,7 +698,13 @@ export default {
}
},
handleNodeClick() {
this.getTable(getTablePeople, [this.id, this.PageCurrent, this.PageSize], ['List', 'total'])
const param = []
param[0] = ['考核部门编号', this.id]
const Data = this.CreateData('11', '人事档案管理_人员_部门与人员_查询数据_根据部门编号', param, this.PageSize, this.PageCurrent)
this.ExecDatabase(Data).then(response => {
this.List = response.data.rows
this.total = response.data.total
})
},
handleClick(data, checked) {
if (this.$refs.treeForm.getCheckedKeys().length !== 0 && this.$refs.treeForm.getCheckedNodes().length !== 0) {
@@ -751,29 +780,24 @@ export default {
if (valid) {
this.handleAdd_disable = true
this.department_DFV = false
if (this.id) {
addDepartmentName(this.id, this.department_Form.DepartmentName, 0).then(response => {
const param = []
param[0] = ['父节点', this.id || 0]
param[1] = ['节点名称', this.department_Form.DepartmentName]
param[2] = ['子节点', 0]
const Data = this.CreateData('11', '人事档案管理_部门关系_增加节点', param)
this.ExecDatabase(Data).then(response => {
const result = this.getBusinessResult(response)
if (result.success) {
this.getTreeData()
this.$message.success(result.message || '添加成功')
this.i = 0
this.i = this.id ? 0 : 1
} else {
this.$message.error(result.message || '添加失败')
}
}).catch(() => {
this.handleAdd_disable = false
this.$message.error('添加异常')
})
} else {
addDepartmentName(0, this.department_Form.DepartmentName, 0).then(response => {
const result = this.getBusinessResult(response)
if (result.success) {
this.getTreeData()
this.$message.success(result.message || '添加成功')
this.i = 1
} else {
this.$message.error(result.message || '添加失败')
}
})
}
} else {
return false
}
@@ -784,7 +808,11 @@ export default {
if (valid) {
this.handleAdd_disable = true
this.department_DFV = false
editList(this.id, this.department_Form.DepartmentName).then(response => {
const param = []
param[0] = ['子节点', this.id]
param[1] = ['节点名称', this.department_Form.DepartmentName]
const Data = this.CreateData('11', '人事档案管理_部门关系_修改节点', param)
this.ExecDatabase(Data).then(response => {
const result = this.getBusinessResult(response)
if (result.success) {
this.getTreeData()
@@ -792,6 +820,9 @@ export default {
} else {
this.$message.error(result.message || '编辑失败')
}
}).catch(() => {
this.handleAdd_disable = false
this.$message.error('编辑异常')
})
} else {
return false
@@ -805,7 +836,10 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delList(this.id).then(response => {
const param = []
param[0] = ['子节点', this.id]
const Data = this.CreateData('11', '人事档案管理_部门关系_删除节点', param)
this.ExecDatabase(Data).then(response => {
const result = this.getBusinessResult(response)
if (result.success) {
this.getTreeData()
@@ -818,6 +852,8 @@ export default {
} else {
this.$message.error(result.message || '删除失败')
}
}).catch(() => {
this.$message.error('删除异常')
})
}).catch(() => {
this.$message({
@@ -835,9 +871,11 @@ export default {
},
fetchPeopleForName() {
if (this.Name) {
getTablePeopleForName(this.Name).then(response => {
const param = []
param[0] = ['姓名', this.Name]
const Data = this.CreateData('11', '人事档案管理_人员名单_查询数据_根据姓名_MESWORK', param)
this.ExecDatabase(Data).then(response => {
for (let i = 0; i < response.data.length; i++) {
// let Data = response.data
if (response.data[i].入公司时间) {
response.data[i].入公司时间 = response.data[i].入公司时间.split(' ')[0]
}
@@ -867,7 +905,23 @@ export default {
if (valid) {
this.addPeople_disable = true
this.btnLoading = true
addPeople(this.id, this.people_form.Sex, this.people_form.Education, this.people_form.Address, this.people_form.Nation, this.people_form.Post, this.people_form.AccountNumber, this.people_form.Password, this.people_form.Name, this.people_form.IDcard, this.people_form.TimeOfEntry, this.people_form.Birthday, this.people_form.ContactInformation, this.people_form.TeamValue).then(response => {
const param = []
param[0] = ['考核部门编号', this.id]
param[1] = ['性别编号', this.people_form.Sex]
param[2] = ['学历编号', this.people_form.Education]
param[3] = ['家庭住址', this.people_form.Address]
param[4] = ['民族', this.people_form.Nation]
param[5] = ['岗位编号', this.people_form.Post]
param[6] = ['考勤编号', this.people_form.AccountNumber]
param[7] = ['密码', this.people_form.Password]
param[8] = ['姓名', this.people_form.Name]
param[9] = ['身份证号', this.people_form.IDcard]
param[10] = ['入公司时间', this.people_form.TimeOfEntry]
param[11] = ['出生日期', this.people_form.Birthday]
param[12] = ['联系电话', this.people_form.ContactInformation]
param[13] = ['班组', this.people_form.TeamValue]
const Data = this.CreateData('11', '人事档案管理_人员名单_增加数据_MESWORK', param)
this.ExecDatabase(Data).then(response => {
this.btnLoading = false
const result = this.getBusinessResult(response)
if (result.success) {
@@ -923,7 +977,23 @@ export default {
if (valid) {
this.addPeople_disable = true
this.btnLoading = true
editPeople(this.people_form.PeopleID, this.people_form.Sex, this.people_form.Education, this.people_form.Address, this.people_form.Nation, this.people_form.Post, this.people_form.AccountNumber, this.people_form.Password, this.people_form.Name, this.people_form.IDcard, this.people_form.TimeOfEntry, this.people_form.Birthday, this.people_form.ContactInformation, this.people_form.TeamValue).then(response => {
const param = []
param[0] = ['人员编号', this.people_form.PeopleID]
param[1] = ['性别编号', this.people_form.Sex]
param[2] = ['学历编号', this.people_form.Education]
param[3] = ['家庭住址', this.people_form.Address]
param[4] = ['民族', this.people_form.Nation]
param[5] = ['岗位编号', this.people_form.Post]
param[6] = ['考勤编号', this.people_form.AccountNumber]
param[7] = ['密码', this.people_form.Password]
param[8] = ['姓名', this.people_form.Name]
param[9] = ['身份证号', this.people_form.IDcard]
param[10] = ['入公司时间', this.people_form.TimeOfEntry]
param[11] = ['出生日期', this.people_form.Birthday]
param[12] = ['联系电话', this.people_form.ContactInformation]
param[13] = ['班组', this.people_form.TeamValue]
const Data = this.CreateData('11', '人事档案管理_人员名单_修改数据_MESWORK', param)
this.ExecDatabase(Data).then(response => {
this.btnLoading = false
const result = this.getBusinessResult(response)
if (result.success) {
@@ -951,14 +1021,20 @@ export default {
handleSizeChange(val) {
this.PageSize = val
this.PageCurrent = 1
getTablePeople(this.id, this.PageCurrent, this.PageSize).then(response => {
const param = []
param[0] = ['考核部门编号', this.id]
const Data = this.CreateData('11', '人事档案管理_人员_部门与人员_查询数据_根据部门编号', param, this.PageSize, this.PageCurrent)
this.ExecDatabase(Data).then(response => {
this.List = response.data.rows
this.total = response.data.total
})
},
handleCurrentChange(val) {
this.PageCurrent = val
getTablePeople(this.id, this.PageCurrent, this.PageSize).then(response => {
const param = []
param[0] = ['考核部门编号', this.id]
const Data = this.CreateData('11', '人事档案管理_人员_部门与人员_查询数据_根据部门编号', param, this.PageSize, this.PageCurrent)
this.ExecDatabase(Data).then(response => {
this.List = response.data.rows
this.total = response.data.total
})
@@ -966,11 +1042,11 @@ export default {
handleSizeChangeN(val) {
this.PageSizeN = val
this.PageCurrentN = 1
this.getTable(searchLeavingList, [this.PageCurrentN, this.PageSizeN], ['LeavingList', 'totalN'])
this.searchLeavingList()
},
handleCurrentChangeN(val) {
this.PageCurrentN = val
this.getTable(searchLeavingList, [this.PageCurrentN, this.PageSizeN], ['LeavingList', 'totalN'])
this.searchLeavingList()
},
handleSelectionChange(val) {
this.multipleSelection = val
@@ -986,15 +1062,17 @@ export default {
type: 'warning'
}).then(() => {
for (let i = 0; i < this.multipleSelection.length; i++) {
quit(this.multipleSelection[i].人员编号).then(response => {
const param = []
param[0] = ['人员编号', this.multipleSelection[i].人员编号]
const Data = this.CreateData('11', '人事档案管理_人员_离职操作', param)
this.ExecDatabase(Data).then(response => {
const result = this.getBusinessResult(response)
if (result.success) {
this.$message.success(result.message || '离职成功')
getTablePeople(this.id, this.PageCurrent, this.PageSize).then(response => {
this.List = response.data.rows
this.total = response.data.total
})
} else { this.$message.error(result.message || '离职失败') }
this.handleNodeClick()
} else {
this.$message.error(result.message || '离职失败')
}
})
}
}).catch(() => {
@@ -1007,7 +1085,12 @@ export default {
},
searchLeavingList() {
this.LeavingListVisiable = true
this.getTable(searchLeavingList, [this.PageCurrentN, this.PageSizeN], ['LeavingList', 'totalN'])
const param = []
const Data = this.CreateData('11', '人事档案管理_人员_离职人员查询', param, this.PageSizeN, this.PageCurrentN)
this.ExecDatabase(Data).then(response => {
this.LeavingList = response.data.rows
this.totalN = response.data.total
})
},
reinstatePeople(row) {
this.$confirm('确认将该员工复职?', '提示', {
@@ -1015,16 +1098,16 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
reinstate(row.人员编号).then(response => {
const param = []
param[0] = ['人员编号', row.人员编号]
const Data = this.CreateData('11', '人事档案管理_人员_复职操作', param)
this.ExecDatabase(Data).then(response => {
const result = this.getBusinessResult(response)
if (result.success) {
this.$message.success(result.message || '复职成功')
this.searchLeavingList()
if (this.id) {
getTablePeople(this.id, this.PageCurrent, this.PageSize).then(response => {
this.List = response.data.rows
this.total = response.data.total
})
this.handleNodeClick()
}
} else {
this.$message.error(result.message || '复职失败')
@@ -1040,7 +1123,11 @@ export default {
moveGroupConfim() {
this.id = this.node
for (let i = 0; i < this.multipleSelection.length; i++) {
moveGroups(this.multipleSelection[i].人员编号, this.node).then(response => {
const param = []
param[0] = ['人员编号', this.multipleSelection[i].人员编号]
param[1] = ['考核部门编号', this.node]
const Data = this.CreateData('11', '人事档案管理_人员名单_移动数据_MESWORK', param)
this.ExecDatabase(Data).then(response => {
const result = this.getBusinessResult(response)
if (result.success) {
if (i === this.multipleSelection.length - 1) {

View File

@@ -1,565 +0,0 @@
USE [AMES_PDC]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[_部门关系_增加节点]
@ int = null,
@ nvarchar(100) = null,
@ int out
AS
BEGIN
SET NOCOUNT ON
IF ISNULL(@, '') = ''
BEGIN
SELECT 0 AS result, N'部门名称不能为空' AS msg
RETURN
END
IF ISNULL(@, 0) <> 0
AND NOT EXISTS (SELECT 1 FROM _基础表_部门 WHERE = @)
BEGIN
SELECT 0 AS result, N'上级部门不存在' AS msg
RETURN
END
BEGIN TRY
BEGIN TRAN
INSERT INTO [_部门关系]([], )
SELECT ISNULL(@, 0), ISNULL(MAX(), 0) + 1
FROM _部门关系
WHERE = ISNULL(@, 0)
SET @ = SCOPE_IDENTITY()
INSERT INTO _基础表_部门 (, )
VALUES(@, @)
COMMIT TRAN
SELECT 1 AS result, N'添加成功' AS msg
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0 ROLLBACK TRAN
SELECT 0 AS result, ERROR_MESSAGE() AS msg
END CATCH
END
GO
ALTER PROCEDURE [dbo].[_部门关系_修改节点]
@ int,
@ nvarchar(100)
AS
BEGIN
SET NOCOUNT ON
IF ISNULL(@, '') = ''
BEGIN
SELECT 0 AS result, N'部门名称不能为空' AS msg
RETURN
END
IF NOT EXISTS (SELECT 1 FROM _基础表_部门 WHERE = @)
BEGIN
SELECT 0 AS result, N'部门不存在' AS msg
RETURN
END
UPDATE _基础表_部门
SET [] = @
WHERE [] = @
SELECT 1 AS result, N'编辑成功' AS msg
END
GO
ALTER PROCEDURE [dbo].[_部门关系_删除节点]
@ int = null
AS
BEGIN
SET NOCOUNT ON
IF NOT EXISTS (SELECT 1 FROM _部门关系 WHERE = @)
BEGIN
SELECT 0 AS result, N'部门不存在' AS msg
RETURN
END
IF EXISTS (SELECT 1 FROM _部门关系 WHERE = @)
BEGIN
SELECT 0 AS result, N'该部门存在下级部门,请先删除或调整下级部门' AS msg
RETURN
END
IF EXISTS (
SELECT 1
FROM _人员名单
WHERE = @
AND ISNULL(, 0) = 0
AND ISNULL(, 1) = 1
)
BEGIN
SELECT 0 AS result, N'该部门下存在在职人员,请先移动、离职或删除人员' AS msg
RETURN
END
BEGIN TRY
BEGIN TRAN
DELETE FROM _基础表_部门 WHERE [] = @
DELETE FROM [_部门关系] WHERE [] = @
COMMIT TRAN
SELECT 1 AS result, N'删除成功' AS msg
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0 ROLLBACK TRAN
SELECT 0 AS result, ERROR_MESSAGE() AS msg
END CATCH
END
GO
ALTER PROCEDURE [dbo].[_人员名单_增加数据_MESWORK]
@ int = null,
@ int = null,
@ int = null,
@ int = null,
@ nvarchar(50) = null,
@ nvarchar(50) = null,
@ nvarchar(50) = null,
@ nvarchar(50) = null,
@ datetime = null,
@ datetime = null,
@ nvarchar(50) = null,
@ nvarchar(50) = null,
@ nvarchar(10) = null,
@ int = null
AS
BEGIN
SET NOCOUNT ON
DECLARE @ int
IF ISNULL(@, '') = ''
BEGIN
SELECT 0 AS result, N'姓名不能为空' AS msg
RETURN
END
IF ISNULL(@, '') = ''
BEGIN
SELECT 0 AS result, N'工号不能为空' AS msg
RETURN
END
IF TRY_CONVERT(int, @) IS NULL
BEGIN
SELECT 0 AS result, N'工号格式不正确' AS msg
RETURN
END
IF NOT EXISTS (SELECT 1 FROM _基础表_部门 WHERE = @)
BEGIN
SELECT 0 AS result, N'所属部门不存在,请重新选择部门' AS msg
RETURN
END
IF EXISTS (SELECT 1 FROM _人员名单 WHERE = TRY_CONVERT(int, @))
BEGIN
SELECT 0 AS result, N'工号已存在,不能重复新增' AS msg
RETURN
END
BEGIN TRY
BEGIN TRAN
INSERT INTO [dbo].[_人员名单](
[], [], , , , , ,
, , , , , , )
VALUES(
TRY_CONVERT(int, @), @, @, @, @, @, @,
@, @, @, @, @, @, @)
SET @ = SCOPE_IDENTITY()
INSERT INTO [dbo].[_部门与人员](, , )
VALUES(@, @, @)
COMMIT TRAN
SELECT 1 AS result, N'添加成功' AS msg
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0 ROLLBACK TRAN
SELECT 0 AS result, ERROR_MESSAGE() AS msg
END CATCH
END
GO
ALTER PROCEDURE [dbo].[_人员名单_修改数据_MESWORK]
@ int = null,
@ nvarchar(50) = null,
@ nvarchar(50) = null,
@ int = null,
@ int = null,
@ int = null,
@ nvarchar(50) = null,
@ int = null,
@ int = null,
@ nvarchar(50) = null,
@ nvarchar(50) = null,
@ nvarchar(50) = null,
@ nvarchar(50) = null,
@ datetime = null,
@ datetime = null,
@ nvarchar(50) = null,
@ nvarchar(50) = null,
@ nvarchar(10) = null,
@ nvarchar(50) = null
AS
BEGIN
SET NOCOUNT ON
IF NOT EXISTS (SELECT 1 FROM _人员名单 WHERE = @)
BEGIN
SELECT 0 AS result, N'人员不存在' AS msg
RETURN
END
IF ISNULL(@, '') = ''
BEGIN
SELECT 0 AS result, N'姓名不能为空' AS msg
RETURN
END
IF ISNULL(@, '') = ''
BEGIN
SELECT 0 AS result, N'工号不能为空' AS msg
RETURN
END
IF TRY_CONVERT(int, @) IS NULL
BEGIN
SELECT 0 AS result, N'工号格式不正确' AS msg
RETURN
END
IF EXISTS (
SELECT 1
FROM _人员名单
WHERE = TRY_CONVERT(int, @)
AND <> @
)
BEGIN
SELECT 0 AS result, N'工号已存在,不能重复保存' AS msg
RETURN
END
IF(@ = 'NAN') SET @ = null
IF(@ = 'NAN') SET @ = null
IF(@ = 'NAN') SET @ = null
IF(@ = 'NAN') SET @ = null
BEGIN TRY
BEGIN TRAN
UPDATE [dbo].[_人员名单]
SET = TRY_CONVERT(int, @),
= @,
= @,
= @,
= TRY_CONVERT(int, @),
= TRY_CONVERT(int, @),
= @,
= @,
= @,
= @,
= @,
= @,
= TRY_CONVERT(int, @)
WHERE = @
UPDATE [dbo].[_部门与人员]
SET = @
WHERE = @
COMMIT TRAN
SELECT 1 AS result, N'编辑成功' AS msg
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0 ROLLBACK TRAN
SELECT 0 AS result, ERROR_MESSAGE() AS msg
END CATCH
END
GO
ALTER PROCEDURE [dbo].[_人员名单_移动数据_MESWORK]
@ int = null,
@ int = null
AS
BEGIN
SET NOCOUNT ON
IF NOT EXISTS (SELECT 1 FROM _人员名单 WHERE = @)
BEGIN
SELECT 0 AS result, N'人员不存在' AS msg
RETURN
END
IF NOT EXISTS (SELECT 1 FROM _基础表_部门 WHERE = @)
BEGIN
SELECT 0 AS result, N'目标部门不存在' AS msg
RETURN
END
BEGIN TRY
BEGIN TRAN
UPDATE [dbo].[_人员名单]
SET = @
WHERE = @
UPDATE [dbo].[_部门与人员]
SET = @
WHERE = @
COMMIT TRAN
SELECT 1 AS result, N'移组成功' AS msg
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0 ROLLBACK TRAN
SELECT 0 AS result, ERROR_MESSAGE() AS msg
END CATCH
END
GO
ALTER PROCEDURE [dbo].[_人员名单_删除数据_MESWORK]
@ int = null
AS
BEGIN
SET NOCOUNT ON
IF NOT EXISTS (SELECT 1 FROM _人员名单 WHERE = @)
BEGIN
SELECT 0 AS result, N'人员不存在' AS msg
RETURN
END
UPDATE _人员名单
SET = 1,
= 2
WHERE = @
DELETE FROM _人员与角色
WHERE = @
SELECT 1 AS result, N'删除成功' AS msg
END
GO
ALTER PROCEDURE [dbo].[_人员_离职操作]
@ int
AS
BEGIN
SET NOCOUNT ON
IF NOT EXISTS (SELECT 1 FROM _人员名单 WHERE = @)
BEGIN
SELECT 0 AS result, N'人员不存在' AS msg
RETURN
END
IF EXISTS (SELECT 1 FROM _人员名单 WHERE = @ AND ISNULL(, 1) = 2)
BEGIN
SELECT 0 AS result, N'该员工已离职' AS msg
RETURN
END
UPDATE _人员名单
SET = 2
WHERE = @
SELECT 1 AS result, N'离职成功' AS msg
END
GO
CREATE OR ALTER PROCEDURE [dbo].[_人员_复职操作]
@ int
AS
BEGIN
SET NOCOUNT ON
IF NOT EXISTS (SELECT 1 FROM _人员名单 WHERE = @)
BEGIN
SELECT 0 AS result, N'人员不存在' AS msg
RETURN
END
IF EXISTS (SELECT 1 FROM _人员名单 WHERE = @ AND ISNULL(, 0) <> 0)
BEGIN
SELECT 0 AS result, N'该员工已被删除,不能复职' AS msg
RETURN
END
IF EXISTS (SELECT 1 FROM _人员名单 WHERE = @ AND ISNULL(, 1) = 1)
BEGIN
SELECT 0 AS result, N'该员工已是在职状态' AS msg
RETURN
END
UPDATE _人员名单
SET = 1,
= 0
WHERE = @
SELECT 1 AS result, N'复职成功' AS msg
END
GO
ALTER PROCEDURE [dbo].[_离职人员_删除数据]
@ nvarchar(50) = null
AS
BEGIN
SET NOCOUNT ON
DECLARE @ int
SELECT @ =
FROM _人员名单
WHERE = @
IF @ IS NULL
BEGIN
SELECT 0 AS result, N'人员不存在' AS msg
RETURN
END
IF EXISTS (
SELECT 1
FROM _人员名单
WHERE = @
AND ISNULL(, 1) <> 2
)
BEGIN
SELECT 0 AS result, N'只能删除离职人员' AS msg
RETURN
END
BEGIN TRY
BEGIN TRAN
DELETE FROM _人员与角色 WHERE = @
DELETE FROM _部门与人员 WHERE = @
DELETE FROM _人员名单 WHERE = @
COMMIT TRAN
SELECT 1 AS result, N'删除成功' AS msg
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0 ROLLBACK TRAN
SELECT 0 AS result, ERROR_MESSAGE() AS msg
END CATCH
END
GO
ALTER PROCEDURE [dbo].[_项目角色员工综合_增加数据]
@ int = null,
@ int = null,
@ int = null
AS
BEGIN
SET NOCOUNT ON
IF NOT EXISTS (SELECT 1 FROM _人员名单 WHERE = @)
BEGIN
SELECT 0 AS result, N'人员不存在' AS msg
RETURN
END
IF EXISTS (
SELECT 1
FROM _人员名单
WHERE = @
AND (ISNULL(, 0) <> 0 OR ISNULL(, 1) <> 1)
)
BEGIN
SELECT 0 AS result, N'该员工不是在职状态,不能分配角色' AS msg
RETURN
END
IF NOT EXISTS (SELECT 1 FROM _项目角色 WHERE = @)
BEGIN
SELECT 0 AS result, N'角色不存在' AS msg
RETURN
END
IF EXISTS (SELECT 1 FROM _人员与角色 WHERE = @ AND = @)
BEGIN
SELECT 0 AS result, N'该员工已分配该角色,不能重复新增' AS msg
RETURN
END
INSERT INTO [_人员与角色](, , )
VALUES(@, @, GETDATE())
SELECT 1 AS result, N'增加成功' AS msg
END
GO
ALTER PROCEDURE [dbo].[_项目角色员工综合_修改数据]
@ int = null,
@ int = null,
@ int = null
AS
BEGIN
SET NOCOUNT ON
IF NOT EXISTS (SELECT 1 FROM _人员与角色 WHERE = @)
BEGIN
SELECT 0 AS result, N'人员角色关系不存在' AS msg
RETURN
END
IF NOT EXISTS (SELECT 1 FROM _项目角色 WHERE = @)
BEGIN
SELECT 0 AS result, N'角色不存在' AS msg
RETURN
END
IF EXISTS (
SELECT 1
FROM _人员与角色
WHERE = @
AND = @
AND <> @
)
BEGIN
SELECT 0 AS result, N'该员工已分配该角色,不能重复保存' AS msg
RETURN
END
UPDATE [_人员与角色]
SET [] = @,
= GETDATE()
WHERE [] = @
SELECT 1 AS result, N'修改成功' AS msg
END
GO
ALTER PROCEDURE [dbo].[_项目角色员工综合_删除数据]
@ int = null
AS
BEGIN
SET NOCOUNT ON
IF NOT EXISTS (SELECT 1 FROM _人员与角色 WHERE = @)
BEGIN
SELECT 0 AS result, N'人员角色关系不存在或已删除' AS msg
RETURN
END
DELETE FROM _人员与角色
WHERE = @
SELECT 1 AS result, N'删除成功' AS msg
END
GO