流程页面基本完成

This commit is contained in:
zhoulingpo
2023-04-17 17:03:58 +08:00
parent c8db1229dc
commit f87f00b2e7
10 changed files with 270 additions and 368 deletions
+157 -254
View File
@@ -9,15 +9,7 @@
:close-on-click-modal="false"
class="org-table"
@close="handleClose">
<el-tabs v-model="activeName" class="customElTabs hasLine" @tab-click="handleClick" v-if="isShowOrg">
<el-tab-pane label="人员" name="first">
</el-tab-pane>
<el-tab-pane label="部门" name="second" v-if="isShowOrg">
</el-tab-pane>
</el-tabs>
<template v-if="activeName=='first'">
<template >
<div class="search-area search-new">
<el-form
:model="searchForm"
@@ -116,7 +108,7 @@
<el-table-column v-if="maxSelected && maxSelected == 1" label="" width="55" align="center">
<template slot-scope="scope">
<el-radio class="tableRadio" v-model="tableChecked" @change="radioChange(scope.row)"
:label="scope.row.userId">{{ null }}
:label="scope.row.USID">{{ null }}
</el-radio>
</template>
</el-table-column>
@@ -138,7 +130,7 @@
<el-table-column
label="姓名"
width="120"
:prop="presets ? 'personName':'userName'"
:prop="presets ? 'personName':'USNAME'"
align="center"
show-overflow-tooltip>
</el-table-column>
@@ -193,8 +185,8 @@
size="medium"
closable
v-for="item in checkedList"
:key="item.usid || item.userId || item.id"
@close="handleRemove(item)">{{ item.uname || item.userName || item.name }}
:key="item.usid || item.USID || item.id"
@close="handleRemove(item)">{{ item.uname || item.USNAME || item.name }}
</el-tag>
<el-button
type="danger"
@@ -242,7 +234,7 @@
</template>
<script>
import {mapGetters} from 'vuex'
import { mapGetters } from 'vuex'
export default {
name: 'OrgTable',
@@ -346,23 +338,23 @@ export default {
type: String,
default: null
},
//preset 审定人员审查人员的接口
// preset 审定人员审查人员的接口
preset: {
type: Boolean,
default: false
},
//people 控制是审查还是审定
// people 控制是审查还是审定
showTable: {
type: String,
default: ''
},
//哪个流程的制修订
// 哪个流程的制修订
zy: {
type: Number,
default: 0
}
},
data() {
data () {
return {
activeName: 'first',
menuTreeLoading: false,
@@ -374,7 +366,7 @@ export default {
searchForm: {
orgId: '',
orgName: '',
userName: '',
USNAME: '',
uname: ''
},
tableData: [],
@@ -402,9 +394,9 @@ export default {
},
methods: {
// 查询二级菜单
selectMenu() {
let url = 'sys/org/getTree'
let parmas = {
selectMenu () {
const url = 'sys/org/getTree'
const parmas = {
// sorDivide: 'OUT',
// cancel: 0 // 作废 1 不作废 0
}
@@ -413,10 +405,10 @@ export default {
_this: this
}, res => {
this.menuTreeLoading = false
let treeNode = []
const treeNode = []
res.data.map((item, index) => {
let treeItem = {}
for (let key in item) {
const treeItem = {}
for (const key in item) {
if (key === 'orgName') {
treeItem.name = item[key]
} else {
@@ -425,84 +417,81 @@ export default {
}
treeNode[OrgTable] = treeItem
})
// console.log(treeNode)
// console.log(treeNode)
this.zNodesTree = treeNode
}, e => {
})
},
/** 获取选择体系的数据 进行赋值*/
handleEOCheck(checkedList) {
console.log(checkedList, "pooooooo")
/** 获取选择体系的数据 进行赋值 */
handleEOCheck (checkedList) {
console.log(checkedList, 'pooooooo')
// checkedList.children.forEach(item=>{
// item.check
// })
this.EOCheckList = checkedList
},
treeClick(treeNode, className) {
treeClick (treeNode, className) {
// console.log(treeNode)
if (this.lawsTree == 0 && className.indexOf('ico_docu') < 0) {
this.$message.warning('请选择节点!')
this.EOCheckList = ''
return false
}
console.log(className, "pppppiiiii")
console.log(className, 'pppppiiiii')
this.EOCheckList = [treeNode]
},
handleClick(tab) {
tab.name == 'first' ? this.getRoleAndUserByOrgIdPage() : this.selectMenu();
handleClick (tab) {
tab.name == 'first' ? this.getRoleAndUserByOrgIdPage() : this.selectMenu()
},
handleClose() {
handleClose () {
this.searchForm = {
orgId: '',
orgName: '',
userName: '',
USNAME: '',
uname: '',
roleId: '',
roleName: '',
roleName: ''
}
this.page = 1
this.checkedList = []
this.checkedIdList = []
this.$refs['orgTable'].clearSelection()
this.$refs.orgTable.clearSelection()
},
handleCancel() {
handleCancel () {
this.isVisible = false
},
getUser(ids) {
getUser (ids) {
this.$http.postData('sys/user/UserViewPage', {
pageSize: 1000,
orgIds: ids
}, {
_this: this,
loading: 'loadData'
},
res => {
if (res.ok) {
this.EOCheckList = res.data.list
let orgName = []
this.EOCheckList.forEach(item => {
if (orgName.indexOf(item.orgName) == -1) {
orgName.push(item.orgName)
pageSize: 1000,
orgIds: ids
}, {
_this: this,
loading: 'loadData'
},
res => {
if (res.ok) {
this.EOCheckList = res.data.list
const orgName = []
this.EOCheckList.forEach(item => {
if (orgName.indexOf(item.orgName) == -1) {
orgName.push(item.orgName)
} else {
// delete item['orgName']
}
item.uname = item.uname + '_' + item.account + '_' + (item.departmentName ? item.departmentName : item.orgName)
item.USNAME = item.USNAME + '_' + item.account + '_' + (item.departmentName ? item.departmentName : item.orgName)
})
console.log(this.EOCheckList)
// 重新整合数组
this.$emit('confirm', this.EOCheckList)
}
}, e => {
} else {
// delete item['orgName']
}
item.uname = item.uname + '_' + item.account + '_' + (item.departmentName ? item.departmentName : item.orgName)
item.userName = item.userName + '_' + item.account + '_' + (item.departmentName ? item.departmentName : item.orgName)
})
console.log(this.EOCheckList)
//重新整合数组
this.$emit('confirm', this.EOCheckList)
}
}, e => {
})
})
},
handleConfirm() {
handleConfirm () {
if (this.dialogModel) {
if (this.maxSelected && this.maxSelected > -1 && this.checkedList.length > this.maxSelected) {
this.$message.warning(this.maxSelectedTips || `${this.title} 只能选择一个用户`)
@@ -511,29 +500,27 @@ export default {
const checkedIdList = []
if (this.activeName == 'second') {
console.log(this.EOCheckList, "popopop")
let ids = []
console.log(this.EOCheckList, 'popopop')
const ids = []
this.EOCheckList.forEach(item => {
ids.push(item.id)
})
this.getUser(ids.join(','))
//如果是按照部门 就渲染
// 如果是按照部门 就渲染
} else {
this.checkedList.map(chkItem => {
checkedIdList.push(chkItem.usid || chkItem.userId || chkItem.id)
checkedIdList.push(chkItem.usid || chkItem.USID || chkItem.id)
console.log(chkItem.uname, chkItem)
if (chkItem.uname) {
chkItem.uname = chkItem.uname + '_' + chkItem.account
chkItem.userName = chkItem.userName + '_' + chkItem.account
chkItem.USNAME = chkItem.USNAME + '_' + chkItem.account
chkItem.orgName = chkItem.departmentName ? chkItem.departmentName : chkItem.orgName
} else if (!chkItem.uname && chkItem.userName) {
chkItem.uname = chkItem.userName
chkItem.userName = chkItem.userName
} else if (!chkItem.uname && chkItem.USNAME) {
chkItem.uname = chkItem.USNAME
chkItem.USNAME = chkItem.USNAME
}
})
this.$emit('confirm', this.checkedList, checkedIdList)
}
this.isVisible = false
}
@@ -548,8 +535,8 @@ export default {
this.$message.warning(`${this.config.attrName} 只能选择一个用户`)
} else {
const dataItem = this.checkedList[0]
this.checkedName = dataItem.uname || dataItem.userName || dataItem.orgName
const id = dataItem.id || dataItem.userId || dataItem.usid
this.checkedName = dataItem.uname || dataItem.USNAME || dataItem.orgName
const id = dataItem.id || dataItem.USID || dataItem.usid
this.$emit('input', id)
this.$emit('on-checked', this.checkedName)
this.$emit('on-dept', dataItem.pOrgId, dataItem.pOrgName)
@@ -561,34 +548,34 @@ export default {
}
},
handlePageChange(page) {
handlePageChange (page) {
this.page = page
this.getRoleAndUserByOrgIdPage()
},
handlePageSizeChange(pageSize) {
handlePageSizeChange (pageSize) {
this.pageSize = pageSize
this.getRoleAndUserByOrgIdPage()
},
handleSearch() {
handleSearch () {
this.page = 1
this.loading.searching = true
this.getRoleAndUserByOrgIdPage()
},
handleReset() {
handleReset () {
this.page = 1
this.searchForm = {
orgId: '',
orgName: '',
userName: '',
USNAME: '',
uname: ''
}
this.getRoleAndUserByOrgIdPage()
},
handleSearchOrgChecked(treeId, treeNode) {
handleSearchOrgChecked (treeId, treeNode) {
this.searchForm.orgId = treeNode.id
this.searchForm.orgName = treeNode.oldname || treeNode.name
$('#orgInput').click()
@@ -599,8 +586,8 @@ export default {
* @author: chenxiaoxi
* @time: 2021-03-21 14:40:59
*/
getOrg() {
this.$http.get('sys/org/getTree', {}, {_this: this},
getOrg () {
this.$http.get('sys/org/getTree', {}, { _this: this },
res => {
if (res.ok) {
res.data.map(item => {
@@ -618,9 +605,9 @@ export default {
* @author: chenxiaoxi
* @time: 2021-03-21 17:08:06
*/
getRoleAndUserByOrgIdPage(types) {
console.log(types, "types")
console.log(this.preset, "types")
getRoleAndUserByOrgIdPage (types) {
console.log(types, 'types')
console.log(this.preset, 'types')
if (!types) {
this.presets = this.preset
}
@@ -631,8 +618,8 @@ export default {
this.searchForm.orgId = this.orgId
}
}
let url = ''
let param = {
const url = ''
const param = {
page: this.page,
pageSize: this.pageSize,
...this.searchForm,
@@ -641,149 +628,66 @@ export default {
idList: this.idList.length > 0 ? this.idList.toString() : null,
disableFlag: 0
}
if (this.pageUrl == 'productItem') {
url = `newlaws/productItem/info/${this.pageId}/userPage`
} else if (this.sarTask) {
url = 'newlaws/sarTask/userPage/' + this.sarTask
} else if (this.presets && !types) {
url = 'perset/perset/selectUnamePage'
param = {
page: this.page,
pageSize: this.pageSize,
orgId: this.searchForm.orgId,
orgName: this.searchForm.orgName,
personName: this.searchForm.uname,
workNum: this.searchForm.workNum,
type: this.showTable == 'scry' ? '1' : '2',
zy: this.zy
}
} else {
url = 'sys/user/UserViewPage'
}
// let this.notUserId.length > 0 ? this.notUserId.toString() : null
// getRoleAndUserByOrgIdPage(
if (this.presets && !types) {
this.$http.postData(url, param, {
_this: this,
}, res => {
this.loading.loadData = false
this.loading.searching = false
if (res.ok) {
this.total = res.data.total
if (this.total == 0) {
this.presets = false
this.getRoleAndUserByOrgIdPage(true)
} else {
this.getOrg()
this.tableData = res.data.records
const checkedRow = []
this.tableData.map(dataItem => {
const id = dataItem.usid || dataItem.userId || dataItem.orgId || dataItem.personId
dataItem.userId = dataItem.personId
dataItem.userName = dataItem.personName
if (this.checkedIdList.includes(id)) {
checkedRow.push(dataItem)
}
})
this.checkedRow(checkedRow)
this.$api.user.sysUserList(param).then((res) => {
this.loading.loadData = false
this.loading.searching = false
if (res.ok) {
this.getOrg()
this.total = res.data.count
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)
}
}
}, e => {
this.loading.loadData = false
this.loading.searching = false
})
} else if (this.sarTask) {
this.$http.get(url, param, {
_this: this,
}, res => {
this.loading.loadData = false
this.loading.searching = false
if (res.ok) {
this.getOrg()
this.total = res.data.count
this.tableData = this.pageUrl == 'productItem' ? res.data : res.data.list
const checkedRow = []
this.tableData.map(dataItem => {
const id = dataItem.usid || dataItem.userId || dataItem.orgId || dataItem.id
if (this.checkedIdList.includes(id)) {
checkedRow.push(dataItem)
}
})
this.checkedRow(checkedRow)
}
}, e => {
this.loading.loadData = false
this.loading.searching = false
})
} else {
this.$http.postData(url, param, {
_this: this,
}, res => {
this.loading.loadData = false
this.loading.searching = false
if (res.ok) {
this.getOrg()
this.total = res.data.count
this.tableData = this.pageUrl == 'productItem' ? res.data : res.data.list
const checkedRow = []
this.tableData.map(dataItem => {
const id = dataItem.usid || dataItem.userId || dataItem.orgId || dataItem.id
if (this.checkedIdList.includes(id)) {
checkedRow.push(dataItem)
}
})
this.checkedRow(checkedRow)
}
}, e => {
this.loading.loadData = false
this.loading.searching = false
})
}
})
this.checkedRow(checkedRow)
}
})
},
// handleRowSelect(selection, row) {
// const id = row.userId || row.id
// const id = row.USID || row.id
// // 当前行选中/取消选中,其他相同用户(角色不同)被选中/取消选中
// this.tableData.map(dataItem => {
// if (dataItem.userId === id || dataItem.id === id) {
// if (dataItem.USID === id || dataItem.id === id) {
// this.$refs['orgTable'].toggleRowSelection(dataItem, selection.includes(row))
// }
// })
// console.log(this.checkedList)
// },
radioChange(e) {
radioChange (e) {
// console.log(e)
this.checkedIdList = [];
this.checkedList = [];
this.checkedIdList.push(e.userId)
this.checkedList.push(e);
this.checkedIdList = []
this.checkedList = []
this.checkedIdList.push(e.USID)
this.checkedList.push(e)
},
selectionRow(selection, row) {
let selected = selection.length && selection.indexOf(row) !== -1; //为true时选中,为 0 时(false)未选中
selectionRow (selection, row) {
const selected = selection.length && selection.indexOf(row) !== -1 // 为true时选中,为 0 时(false)未选中
if (selected) {
selection.map(selItem => {
const id = selItem.userId
const id = selItem.USID
if (!this.checkedIdList.includes(id)) {
this.checkedIdList.push(id)
this.checkedList.push(row);
this.checkedList.push(row)
}
})
} else {
this.handleRemove(row, 'table')
}
},
selectionRowAll(selection) {
selectionRowAll (selection) {
if (selection.length > 0) {
selection.map(selItem => {
const id = selItem.userId
const id = selItem.USID
if (!this.checkedIdList.includes(id)) {
this.checkedIdList.push(id)
this.checkedList.push(selItem);
this.checkedList.push(selItem)
}
})
} else {
@@ -793,10 +697,10 @@ export default {
}
},
handleSelectionChange(selection) {
handleSelectionChange (selection) {
if (selection.length) {
selection.map(selItem => {
const id = selItem.usid || selItem.userId || selItem.orgId || selItem.id
const id = selItem.usid || selItem.USID || selItem.orgId || selItem.id
// 如果exclude不含当前行
if (!this.excludeIdList.includes(id)) {
// 如果下面列表没有,就填到下面列表里
@@ -815,12 +719,12 @@ export default {
}
},
handleRemove(user, type) {
handleRemove (user, type) {
let delIndex = -1
this.checkedList.map((checkedItem, chkIndex) => {
if (user.userId === checkedItem.userId) {
if (user.USID === checkedItem.USID) {
delIndex = chkIndex
if (type !== "table") {
if (type !== 'table') {
this.checkedRow([checkedItem])
}
return false
@@ -830,7 +734,7 @@ export default {
this.checkedIdList.splice(delIndex, 1)
},
handleOrgDel() {
handleOrgDel () {
this.searchForm.orgId = ''
this.searchForm.orgName = ''
},
@@ -840,41 +744,41 @@ export default {
* @author: chenxiaoxi
* @time: 2021-03-22 10:06:03
*/
checkedRow(rows) {
checkedRow (rows) {
this.$nextTick(() => {
if (rows.length) {
rows.forEach(row => {
/*双重for循环,为了解决,第二次点击弹框得时候,删除已选择里面得人员,表格勾选没有取消问题*/
/* 双重for循环,为了解决,第二次点击弹框得时候,删除已选择里面得人员,表格勾选没有取消问题 */
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].userId == row.userId) {
if (this.tableData[i].USID == row.USID) {
// console.log(this.tableData[i], '666')
this.$refs['orgTable'] && this.$refs['orgTable'].toggleRowSelection(this.tableData[i])
this.$refs.orgTable && this.$refs.orgTable.toggleRowSelection(this.tableData[i])
}
}
});
})
} else {
this.$refs['orgTable'] && this.$refs['orgTable'].clearSelection()
this.$refs.orgTable && this.$refs.orgTable.clearSelection()
}
})
},
cellClassName({row, column, rowIndex, columnIndex}) {
cellClassName ({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 3) {
return 'tag-column'
}
},
isSelectable(row, index) {
return !this.excludeIdList.includes(row.userId)
isSelectable (row, index) {
return !this.excludeIdList.includes(row.USID)
},
handleChooseByDialog() {
handleChooseByDialog () {
if (!this.dialogModel) {
this.checkedName = this.config.valueName || ''
if (this.config.value) {
this.checkedList = [{
userId: this.config.value,
userName: this.config.valueName
USID: this.config.value,
USNAME: this.config.valueName
}]
}
const idList = this.config.value === '' || !this.config.value ? [] : this.config.value.split(',')
@@ -884,17 +788,17 @@ export default {
this.getRoleAndUserByOrgIdPage()
},
handleMouseEnter() {
handleMouseEnter () {
if (this.searchForm.orgName !== '') {
this.visibleOrgClearBtn = true
}
},
handleMouseLeave() {
handleMouseLeave () {
this.visibleOrgClearBtn = false
},
handleCleanChecked() {
handleCleanChecked () {
this.$confirm('您是否确定移除全部已选中', '确定移除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@@ -904,45 +808,45 @@ export default {
}).then(() => {
this.checkedList = []
this.checkedIdList = []
this.$refs['orgTable'].clearSelection()
this.$refs.orgTable.clearSelection()
}).catch(e => {
})
}
},
computed: {
configContent() {
configContent () {
return this.userInfo.configContent
},
placeholder() {
placeholder () {
return !this.dialogModel && `请选择${this.config.attrName}`
},
showMessage() {
showMessage () {
return !this.dialogModel && `${this.config.attrName}不能为空`
},
isRequired() {
isRequired () {
return !this.dialogModel && !!this.config.isMust
},
isString(str) {
isString (str) {
return (typeof str === 'string') && str.constructor === String
},
isFO() {
isFO () {
return !this.dialogModel && this.config.attrField === 'FO'
},
ZRBM() {
return this.dataModel['ZRBM'] || ''
ZRBM () {
return this.dataModel.ZRBM || ''
},
showTitle() {
showTitle () {
return this.dialogModel ? this.title : this.config.attrName
},
excludeIdList() {
excludeIdList () {
return this.excludeUser && this.excludeUser !== '' ? (this.excludeUser instanceof Array ? this.excludeUser : this.excludeUser.split(',')) : []
},
...mapGetters(['userInfo'])
},
watch: {
visible(val) {
visible (val) {
this.isVisible = val
this.tableChecked = null
if (this.maxSelected === 1) {
@@ -955,8 +859,8 @@ export default {
if (this.config.value && this.config.value !== '') {
let idListDepartment = []
let nameListDepartment = []
let idRoleList = [];
let nameRoleList = [];
let idRoleList = []
let nameRoleList = []
const idList = this.config.value instanceof Array ? this.config.value : (this.config.value === '' ? [] : this.config.value.split(','))
const nameList = this.config.valueName instanceof Array ? this.config.valueName.split(',') : (this.config.valueName === '' ? [] : this.config.valueName.split(','))
if (this.config.valueDepartment) {
@@ -973,18 +877,18 @@ export default {
const checkedList = []
idList.map((id, index) => {
checkedList.push({
userId: id,
userName: nameList[OrgTable],
USID: id,
USNAME: nameList[OrgTable],
orgId: idListDepartment[OrgTable],
orgName: nameListDepartment[OrgTable],
roleId: idRoleList[OrgTable],
roleName: nameRoleList[OrgTable],
roleName: nameRoleList[OrgTable]
})
})
if (this.maxSelected == 1) {
// debugger
this.tableChecked = this.config.value;
this.tableChecked = this.config.value
this.isShowOrg = false
}
// console.log(checkedList, 'checkedList', 'idListDepartment===', idListDepartment, 'nameListDepartment===', nameListDepartment)
@@ -1001,27 +905,26 @@ export default {
this.selectMenu()
}
},
isVisible(val) {
isVisible (val) {
this.$emit('update:visible', val)
},
value(newVal, oldVal) {
value (newVal, oldVal) {
this.checkedName = newVal !== '' ? this.checkedName : ''
},
deptZNodes: {
handler(val) {
handler (val) {
this.orgZNodes = val
}
}
},
mounted() {
mounted () {
this.isVisible = this.visible
if (!this.dialogModel) {
this.checkedName = this.config.valueName || ''
if (this.config.value !== '') {
this.checkedList = [{
userId: this.config.value,
userName: this.config.valueName
USID: this.config.value,
USNAME: this.config.valueName
}]
const idList = this.config.value === '' ? [] : this.config.value.split(',')
this.checkedIdList = [...idList]
@@ -1033,8 +936,8 @@ export default {
const checkedList = []
idList.map((id, index) => {
checkedList.push({
userId: id,
userName: nameList[OrgTable]
USID: id,
USNAME: nameList[OrgTable]
})
})
this.checkedList = checkedList