【修改】夫部门编码

This commit is contained in:
zhoulingpo
2023-05-18 18:55:05 +08:00
parent 9649de30ed
commit a46734b8bd
2 changed files with 223 additions and 34 deletions
+190 -7
View File
@@ -149,6 +149,154 @@
</template>
</template>
</el-dialog>
<el-dialog
v-else-if="iscode"
append-to-body
title="组织机构"
:visible.sync="isVisible"
:close-on-click-modal="false"
class="org-table"
@close="handleClose">
<template >
<div class="search-area search-new">
<el-form
:model="searchForm"
inline
class="label-input-form"
@keyup.enter.native="handleSearch">
<el-row :gutter="24">
<el-col :xl="8" :lg="8">
<el-form-item label="部门名称" class="search-item">
<!-- <el-input :placeholder="'根据角色名查询'" class="search-item" v-model="searchForm.roleName"/>-->
<el-input v-model="searchForm.longName" maxlength="50" placeholder="请输入部门名称"></el-input>
</el-form-item>
</el-col>
<el-col :xl="8" :lg="8">
<el-form-item label="部门编码" class="search-item">
<!-- <el-input-->
<!-- v-model="searchForm.uname"-->
<!-- placeholder="根据姓名查询"-->
<!-- clearable></el-input>-->
<el-input :placeholder="'请输入部门编码'" v-model="searchForm.departmentCode"/>
</el-form-item>
</el-col>
<el-col :xl="8" :lg="24">
<el-form-item class="tag-btns">
<!-- :loading="loading.searching"-->
<el-button
:disabled="loading.searching"
type="primary"
size="small"
@click="handleSearch">查询
</el-button>
<el-button
size="small"
@click="handleReset">重置
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="org-user v-class">
<el-table
v-if="isVisible"
ref="orgTable"
:data="tableData"
tooltip-effect="dark"
style="width: 100%"
border
stripe
:header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }"
height="350"
v-loading="loading.loadData"
:cell-class-name="cellClassName"
@select="selectionRow"
@select-all="selectionRowAll">
<el-table-column v-if="maxSelected && maxSelected == 1" label="" width="35" align="center">
<template slot-scope="scope">
<el-radio class="tableRadio" v-model="tableChecked" @change="radioChange(scope.row)"
:label="scope.row.departmentCode">{{ null }}
</el-radio>
</template>
</el-table-column>
<el-table-column
v-else
type="selection"
width="55"
align="center"
:selectable="isSelectable">
</el-table-column>
<!-- v-if="workNumFlag"-->
<el-table-column
label="部门名称"
prop="longName"
align="center"
show-overflow-tooltip>
</el-table-column>
<el-table-column
label="部门编码"
prop="departmentCode"
align="center"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="leveL"
width="120"
label="部门级别"
align="center"
show-overflow-tooltip>
</el-table-column>
</el-table>
</div>
<el-pagination
class="pagination"
:current-page="page"
:page-sizes="[5, 10, 20]"
:pageSize="pageSize"
:total="total"
@current-change="handlePageChange"
@size-change="handlePageSizeChange"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
<template v-if="btnFlag">
<!-- 已选择的用户 -->
<template v-if="maxSelected !== 1">
<el-divider content-position="left">已选择</el-divider>
<div class="checked-user-list">
<el-tag
size="medium"
closable
v-for="item in checkedList"
:key="item.usid || item.USID || item.id "
@close="handleRemove(item)">{{ item.uname || item.USNAME || item.name || item.longName}}
</el-tag>
<el-button
type="danger"
size="mini"
@click="handleCleanChecked"
v-show="checkedIdList.length > 1">全部删除
</el-button>
</div>
</template>
<div style="text-align: right;" class="dialog-footer">
<el-button size="small"
type="primary"
class="common-button-primary"
@click="handleConfirm">
</el-button>
<el-button size="small"
class="common-button-default"
@click="handleCancel">
</el-button>
</div>
</template>
</template>
</el-dialog>
<el-dialog
v-else
append-to-body
@@ -329,7 +477,6 @@
</template>
</template>
</el-dialog>
<!-- 非弹窗模式使用 -->
<el-col :span="span" v-if="!dialogModel">
<el-form-item
@@ -359,6 +506,10 @@ export default {
name: 'OrgTable',
mixins: [],
props: {
iscode:{
type: Boolean,
default: false
},
isOrg: {
type: Boolean,
default: false
@@ -514,7 +665,8 @@ export default {
checkedName: '',
zNodesRole: [],
repeatFlag: false,
isShowOrg: true
isShowOrg: true,
}
},
methods: {
@@ -685,7 +837,7 @@ export default {
}
// let this.notUserId.length > 0 ? this.notUserId.toString() : null
// getRoleAndUserByOrgIdPage(
if(this.isOrg){
if(this.isOrg ||this.iscode){
this.$api.org.sysOrgList(param).then((res) => {
this.loading.loadData = false
this.loading.searching = false
@@ -694,10 +846,18 @@ export default {
this.tableData = res.data.records
const checkedRow = []
this.tableData.map(dataItem => {
const id = dataItem.usid || dataItem.USID || dataItem.orgId || dataItem.id
if (this.checkedIdList.includes(id)) {
checkedRow.push(dataItem)
if(this.isOrg){
const id = dataItem.usid || dataItem.USID || dataItem.orgId || dataItem.id
if (this.checkedIdList.includes(id)) {
checkedRow.push(dataItem)
}
}else{
const id = dataItem.departmentCode
if (this.checkedIdList.includes(id)) {
checkedRow.push(dataItem)
}
}
})
this.checkedRow(checkedRow)
}
@@ -843,6 +1003,8 @@ export default {
}else if (this.tableData[i].id == row.id && this.isOrg){
this.$refs.orgTable && this.$refs.orgTable.toggleRowSelection(this.tableData[i])
}else if (this.tableData[i].departmentCode == row.departmentCode && this.iscode){
this.$refs.orgTable && this.$refs.orgTable.toggleRowSelection(this.tableData[i])
}
}
})
@@ -942,6 +1104,7 @@ export default {
},
watch: {
visible (val) {
debugger
this.isVisible = val
this.tableChecked = null
if (this.maxSelected === 1) {
@@ -963,7 +1126,15 @@ export default {
longName:nameList[index]
})
})
}else{
}else if(this.isOrg){
idList.map((id, index) => {
checkedList.push({
departmentCode:id
})
})
}
else{
idList.map((id, index) => {
checkedList.push({
USID: id,
@@ -1012,6 +1183,11 @@ export default {
id: this.config.value,
longName: this.config.valueName
}]
}else if(this.iscode){
this.checkedList = [{
departmentCode: this.config.value,
// longName: this.config.valueName
}]
}else{
this.checkedList = [{
USID: this.config.value,
@@ -1034,6 +1210,13 @@ export default {
longName: nameList[index]
})
})
}else if(this.isOrg){
idList.map((id, index) => {
checkedList.push({
departmentCode: id,
// longName: nameList[index]
})
})
}else {
idList.map((id, index) => {
checkedList.push({
+33 -27
View File
@@ -89,13 +89,14 @@
<el-input v-model="form.longName" maxlength="50" show-word-limit placeholder="请输入部门名称"></el-input>
</el-form-item>
<el-form-item label="部门编码:" required>
<el-input v-model="form.departmentCode" :disabled="dialogTitle=='编辑'" maxlength="50" show-word-limit placeholder="请输入部门编码"></el-input>
<el-input v-model="form.departmentCode" :disabled="dialogTitle=='编辑'" maxlength="50" show-word-limit
@click.native="" placeholder="请输入部门编码"></el-input>
</el-form-item>
<el-form-item label="部门级别:" >
<el-input v-model="form.leveL" maxlength="10" show-word-limit placeholder="请输入部门级别"></el-input>
</el-form-item>
<el-form-item label="父部门编码:" >
<el-input v-model="form.parentID" maxlength="50" show-word-limit placeholder="请输入父部门编码"></el-input>
<el-input readonly @click.native="handleClick" v-model="form.parentID" maxlength="50" show-word-limit placeholder="请输入父部门编码"></el-input>
</el-form-item>
<el-form-item label="部门简称:" >
<el-input v-model="form.shortName" maxlength="50" show-word-limit placeholder="请输入部门简称"></el-input>
@@ -106,37 +107,17 @@
<el-form-item label="部门14位码:" >
<el-input v-model="form.bmdm14" maxlength="14" show-word-limit placeholder="部门14位码"></el-input>
</el-form-item>
<!--<el-form-item label="密码:" :required="mode === 'add'" v-if="mode !== 'view'">-->
<!--<el-input v-model="form.password" maxlength="20" type="password" placeholder="请输入密码"></el-input>-->
<!--</el-form-item>-->
<!--<el-form-item label="确认密码:" :required="mode === 'add'" v-if="mode !== 'view'">-->
<!--<el-input v-model="repassword" maxlength="20" type="password" placeholder="请确认密码"></el-input>-->
<!--</el-form-item>-->
<!-- <el-form-item label="手机号:">-->
<!-- <el-input v-model="form.departmentCode" placeholder="请输入手机号"></el-input>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="部门:">-->
<!-- <el-input v-model="form.department" maxlength="50" show-word-limit placeholder="请输入部门"></el-input>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="邮箱:">-->
<!-- <el-input v-model="form.email" placeholder="请输入邮箱"></el-input>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="角色:" required>-->
<!-- <el-select v-model="form.roleIdList[0]" class="icon-auth" placeholder="请选择角色">-->
<!-- <template v-for="item in roleList">-->
<!-- <el-option :label="item.rname" :value="item.rid" :key="item.rid"></el-option>-->
<!-- </template>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="姓名:" required>-->
<!-- <el-input v-model="form.usname" maxlength="20" show-word-limit placeholder="请输入姓名"></el-input>-->
<!-- </el-form-item>-->
</el-form>
<div class="done">
<el-button v-if="mode !== 'view'" type="primary" @click="sysOrgAddOrg">确定</el-button>
</div>
</div>
</el-dialog>
<orgTable :visible.sync="visibleOrgTable" title="人员列表":config="{
value: orgTableVal,
valueName:orgTableValName
}" dialog-model :iscode="true" :workNumFlag="true" :maxSelected="1" @confirm="isTreeOk"></orgTable>
</div>
</template>
@@ -147,6 +128,9 @@ export default {
name: 'User',
data () {
return {
orgTableValName:'',
orgTableVal:'',
visibleOrgTable:false,
q: {
longName: '', // 用户名
// roleName: '', // 角色名称
@@ -172,6 +156,28 @@ export default {
}
},
methods: {
isTreeOk(checkedList) {
const parts = []
const partsName = []
checkedList.map((item, index) => {
parts.push(item.departmentCode)
// partsName.push(item.longName)
})
this.qcrList = checkedList
this.form.parentID = parts.toString()
// this.form.departmentName = partsName.toString()
},
handleClick() {
if (this.dialogTitle == '查看') return
if (this.form.parentID) {
this.orgTableVal = this.form.parentID
this.orgTableValName = ''
}
this.visibleOrgTable = true
},
search () {
this.q.page = 1
this.sysOrgList()