更新最新程序
This commit is contained in:
@@ -1,18 +1,13 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
import state from '@/store'
|
import state from '@/store'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
export function getTree(pid) {
|
export function getTree(pid) {
|
||||||
return request({
|
const param = []
|
||||||
url: '',
|
param[0] = ['子节点', pid]
|
||||||
method: 'post',
|
const Data = Vue.prototype.CreateData('1', '人事档案管理_部门关系_查询节点', param)
|
||||||
data: {
|
return Vue.prototype.ExecDatabase(Data)
|
||||||
UserID: state.state.user.id,
|
|
||||||
ModularID: router.currentRoute.path,
|
|
||||||
type: 1,
|
|
||||||
name: '人事档案管理_部门关系_查询节点',
|
|
||||||
param: '子节点=' + pid + '=int'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
export function tree(data, pid) {
|
export function tree(data, pid) {
|
||||||
const result = []
|
const result = []
|
||||||
|
|||||||
@@ -416,7 +416,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 { uploadPerson } from '@/utils/request'
|
||||||
import { readFile } from '@/utils/request'
|
import { readFile } from '@/utils/request'
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
@@ -571,7 +571,9 @@ export default {
|
|||||||
},
|
},
|
||||||
// 获取班组信息
|
// 获取班组信息
|
||||||
fetchTeamViwer() {
|
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++) {
|
for (let i = 0; i < response.data.length; i++) {
|
||||||
this.Team.push({
|
this.Team.push({
|
||||||
label: response.data[i].班组名称,
|
label: response.data[i].班组名称,
|
||||||
@@ -654,16 +656,37 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
fetchEducationData() {
|
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() {
|
fetchPostData() {
|
||||||
this.people_form.Post = ''
|
this.people_form.Post = ''
|
||||||
this.PostData = []
|
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() {
|
getTreeData() {
|
||||||
getTree(0).then(response => {
|
const param = []
|
||||||
// getTree(this.departmentId).then(response => {
|
param[0] = ['子节点', 0]
|
||||||
|
const Data = this.CreateData('11', '人事档案管理_部门关系_查询节点', param)
|
||||||
|
this.ExecDatabase(Data).then(response => {
|
||||||
const data = response.data
|
const data = response.data
|
||||||
this.departmentData = tree(data, 0)
|
this.departmentData = tree(data, 0)
|
||||||
})
|
})
|
||||||
@@ -675,7 +698,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleNodeClick() {
|
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) {
|
handleClick(data, checked) {
|
||||||
if (this.$refs.treeForm.getCheckedKeys().length !== 0 && this.$refs.treeForm.getCheckedNodes().length !== 0) {
|
if (this.$refs.treeForm.getCheckedKeys().length !== 0 && this.$refs.treeForm.getCheckedNodes().length !== 0) {
|
||||||
@@ -751,29 +780,24 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
this.handleAdd_disable = true
|
this.handleAdd_disable = true
|
||||||
this.department_DFV = false
|
this.department_DFV = false
|
||||||
if (this.id) {
|
const param = []
|
||||||
addDepartmentName(this.id, this.department_Form.DepartmentName, 0).then(response => {
|
param[0] = ['父节点', this.id || 0]
|
||||||
const result = this.getBusinessResult(response)
|
param[1] = ['节点名称', this.department_Form.DepartmentName]
|
||||||
if (result.success) {
|
param[2] = ['子节点', 0]
|
||||||
this.getTreeData()
|
const Data = this.CreateData('11', '人事档案管理_部门关系_增加节点', param)
|
||||||
this.$message.success(result.message || '添加成功')
|
this.ExecDatabase(Data).then(response => {
|
||||||
this.i = 0
|
const result = this.getBusinessResult(response)
|
||||||
} else {
|
if (result.success) {
|
||||||
this.$message.error(result.message || '添加失败')
|
this.getTreeData()
|
||||||
}
|
this.$message.success(result.message || '添加成功')
|
||||||
})
|
this.i = this.id ? 0 : 1
|
||||||
} else {
|
} else {
|
||||||
addDepartmentName(0, this.department_Form.DepartmentName, 0).then(response => {
|
this.$message.error(result.message || '添加失败')
|
||||||
const result = this.getBusinessResult(response)
|
}
|
||||||
if (result.success) {
|
}).catch(() => {
|
||||||
this.getTreeData()
|
this.handleAdd_disable = false
|
||||||
this.$message.success(result.message || '添加成功')
|
this.$message.error('添加异常')
|
||||||
this.i = 1
|
})
|
||||||
} else {
|
|
||||||
this.$message.error(result.message || '添加失败')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -784,7 +808,11 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
this.handleAdd_disable = true
|
this.handleAdd_disable = true
|
||||||
this.department_DFV = false
|
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)
|
const result = this.getBusinessResult(response)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
this.getTreeData()
|
this.getTreeData()
|
||||||
@@ -792,6 +820,9 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.$message.error(result.message || '编辑失败')
|
this.$message.error(result.message || '编辑失败')
|
||||||
}
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.handleAdd_disable = false
|
||||||
|
this.$message.error('编辑异常')
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
@@ -805,7 +836,10 @@ export default {
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).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)
|
const result = this.getBusinessResult(response)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
this.getTreeData()
|
this.getTreeData()
|
||||||
@@ -818,6 +852,8 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.$message.error(result.message || '删除失败')
|
this.$message.error(result.message || '删除失败')
|
||||||
}
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message.error('删除异常')
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
@@ -835,9 +871,11 @@ export default {
|
|||||||
},
|
},
|
||||||
fetchPeopleForName() {
|
fetchPeopleForName() {
|
||||||
if (this.Name) {
|
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++) {
|
for (let i = 0; i < response.data.length; i++) {
|
||||||
// let Data = response.data
|
|
||||||
if (response.data[i].入公司时间) {
|
if (response.data[i].入公司时间) {
|
||||||
response.data[i].入公司时间 = response.data[i].入公司时间.split(' ')[0]
|
response.data[i].入公司时间 = response.data[i].入公司时间.split(' ')[0]
|
||||||
}
|
}
|
||||||
@@ -867,7 +905,23 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
this.addPeople_disable = true
|
this.addPeople_disable = true
|
||||||
this.btnLoading = 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
|
this.btnLoading = false
|
||||||
const result = this.getBusinessResult(response)
|
const result = this.getBusinessResult(response)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
@@ -923,7 +977,23 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
this.addPeople_disable = true
|
this.addPeople_disable = true
|
||||||
this.btnLoading = 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
|
this.btnLoading = false
|
||||||
const result = this.getBusinessResult(response)
|
const result = this.getBusinessResult(response)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
@@ -951,14 +1021,20 @@ export default {
|
|||||||
handleSizeChange(val) {
|
handleSizeChange(val) {
|
||||||
this.PageSize = val
|
this.PageSize = val
|
||||||
this.PageCurrent = 1
|
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.List = response.data.rows
|
||||||
this.total = response.data.total
|
this.total = response.data.total
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleCurrentChange(val) {
|
handleCurrentChange(val) {
|
||||||
this.PageCurrent = 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.List = response.data.rows
|
||||||
this.total = response.data.total
|
this.total = response.data.total
|
||||||
})
|
})
|
||||||
@@ -966,11 +1042,11 @@ export default {
|
|||||||
handleSizeChangeN(val) {
|
handleSizeChangeN(val) {
|
||||||
this.PageSizeN = val
|
this.PageSizeN = val
|
||||||
this.PageCurrentN = 1
|
this.PageCurrentN = 1
|
||||||
this.getTable(searchLeavingList, [this.PageCurrentN, this.PageSizeN], ['LeavingList', 'totalN'])
|
this.searchLeavingList()
|
||||||
},
|
},
|
||||||
handleCurrentChangeN(val) {
|
handleCurrentChangeN(val) {
|
||||||
this.PageCurrentN = val
|
this.PageCurrentN = val
|
||||||
this.getTable(searchLeavingList, [this.PageCurrentN, this.PageSizeN], ['LeavingList', 'totalN'])
|
this.searchLeavingList()
|
||||||
},
|
},
|
||||||
handleSelectionChange(val) {
|
handleSelectionChange(val) {
|
||||||
this.multipleSelection = val
|
this.multipleSelection = val
|
||||||
@@ -986,15 +1062,17 @@ export default {
|
|||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
for (let i = 0; i < this.multipleSelection.length; i++) {
|
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)
|
const result = this.getBusinessResult(response)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
this.$message.success(result.message || '离职成功')
|
this.$message.success(result.message || '离职成功')
|
||||||
getTablePeople(this.id, this.PageCurrent, this.PageSize).then(response => {
|
this.handleNodeClick()
|
||||||
this.List = response.data.rows
|
} else {
|
||||||
this.total = response.data.total
|
this.$message.error(result.message || '离职失败')
|
||||||
})
|
}
|
||||||
} else { this.$message.error(result.message || '离职失败') }
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
@@ -1007,7 +1085,12 @@ export default {
|
|||||||
},
|
},
|
||||||
searchLeavingList() {
|
searchLeavingList() {
|
||||||
this.LeavingListVisiable = true
|
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) {
|
reinstatePeople(row) {
|
||||||
this.$confirm('确认将该员工复职?', '提示', {
|
this.$confirm('确认将该员工复职?', '提示', {
|
||||||
@@ -1015,16 +1098,16 @@ export default {
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).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)
|
const result = this.getBusinessResult(response)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
this.$message.success(result.message || '复职成功')
|
this.$message.success(result.message || '复职成功')
|
||||||
this.searchLeavingList()
|
this.searchLeavingList()
|
||||||
if (this.id) {
|
if (this.id) {
|
||||||
getTablePeople(this.id, this.PageCurrent, this.PageSize).then(response => {
|
this.handleNodeClick()
|
||||||
this.List = response.data.rows
|
|
||||||
this.total = response.data.total
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(result.message || '复职失败')
|
this.$message.error(result.message || '复职失败')
|
||||||
@@ -1040,7 +1123,11 @@ export default {
|
|||||||
moveGroupConfim() {
|
moveGroupConfim() {
|
||||||
this.id = this.node
|
this.id = this.node
|
||||||
for (let i = 0; i < this.multipleSelection.length; i++) {
|
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)
|
const result = this.getBusinessResult(response)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
if (i === this.multipleSelection.length - 1) {
|
if (i === this.multipleSelection.length - 1) {
|
||||||
|
|||||||
565
人员管理业务修复.sql
565
人员管理业务修复.sql
@@ -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
|
|
||||||
Reference in New Issue
Block a user