From 9b0a82931d2d4ef6fa877ebba59737a65ba37103 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期三, 07 八月 2024 11:18:53 +0800
Subject: [PATCH] 检验下单-检验项要求值校验修改
---
src/components/view/person-manage.vue | 282 ++++++++++++++++++++++++++++++++++---------------------
1 files changed, 174 insertions(+), 108 deletions(-)
diff --git a/src/components/view/person-manage.vue b/src/components/view/person-manage.vue
index 52a3211..8c0e23c 100644
--- a/src/components/view/person-manage.vue
+++ b/src/components/view/person-manage.vue
@@ -119,8 +119,7 @@
<el-row>
<el-col :span="20">
<el-input placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�" suffix-icon="el-icon-search" v-model="search" size="small"
- style="margin-bottom: 5px;" clearable @blur="searchFilter" @clear="searchFilter"
- @keyup.enter.native="searchFilter()"></el-input>
+ style="margin-bottom: 5px;" clearable @clear="searchFilter" @keyup.enter.native="searchFilter()"></el-input>
</el-col>
<el-col :span="4" style="text-align: center;line-height: 30px;" v-if="addPower">
<el-button type="primary" icon="el-icon-plus" size="mini" circle @click="handleAdd"></el-button>
@@ -128,8 +127,7 @@
</el-row>
<el-tree :data="list" ref="tree" :props="{ children: 'children', label: 'name' }" node-key="id"
:filter-node-method="filterNode" @node-click="handleNodeClick" highlight-current @node-expand="nodeOpen"
- @node-collapse="nodeClose" v-loading="treeLoad" :expand-on-click-node="false"
- :default-expanded-keys="expandedKeys" :default-checked-keys="[1]">
+ @node-collapse="nodeClose" v-loading="treeLoad" :expand-on-click-node="false" default-expand-all>
<div class="custom-tree-node" slot-scope="{ node, data }">
<el-row style="width: 100%;">
<el-col :span="21" :class="{sort:node.level>3}">
@@ -174,8 +172,8 @@
<el-button size="small" @click="refresh()">閲� 缃�</el-button>
<el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
</div>
- <div class="search_thing">
- <el-button size="small" type="primary" @click="openthirdParty">鑾峰彇涓夋柟浜哄憳</el-button>
+ <div class="search_thing" style="display: flex;justify-content: right;margin-right: 10px;">
+ <el-button size="small" type="primary" @click="openthirdParty" v-if="addUserPower">鑾峰彇涓夋柟浜哄憳</el-button>
<el-button size="small" type="primary" @click="opeaAdd" v-if="addPower">鏂板鐢ㄦ埛</el-button>
</div>
</div>
@@ -201,18 +199,31 @@
</span>
</el-dialog>
<el-dialog title="鑾峰彇浜轰簨绯荤粺浜哄憳淇℃伅" :visible.sync="addthirdParty" width="70%">
- <div class="body">
+ <div class="body" v-loading="thirdPartyLoading">
<el-row>
- <el-col :span="9" style="height: 70vh;overflow: hidden;">
- <el-input placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" v-model="search2" size="small" style="width: 90%;padding: 0 5% 10px 5%;"
- clearable @blur="searchFilter2" @clear="searchFilter2" @keyup.enter.native="searchFilter2()">
+ <el-col :span="8" style="height: 70vh;overflow: hidden;" v-if="companiesList.length!=1">
+ <el-input placeholder="杈撳叆鍏抽敭瀛楁悳绱�" v-model="search2" size="small" style="width: 90%;padding: 0 5% 10px 5%;"
+ clearable @clear="searchFilter2" @keyup.enter.native="searchFilter2()">
</el-input>
- <el-tree :data="datathirdParty" node-key="id" :props="defaultProps" @node-click="nodeClick2"
- style="height: calc(100% - 42px);" :filter-node-method="filterNode2" ref="tree2" highlight-current>
+ <el-tree :data="datathirdParty" node-key="companyId" :props="defaultProps" @node-click="nodeClick2"
+ style="height: calc(100% - 42px);" @node-expand="nodeOpen0" :filter-node-method="filterNode2" ref="tree2"
+ highlight-current>
</el-tree>
</el-col>
- <el-col :span="15" style="height: 70vh;padding-left: 8px;">
- <el-table height="70vh" border stripe :data="personList" v-loading="personLoad" ref="personTable"
+ <el-col :span="companiesList.length==1?24:16" style="height: 70vh;padding-left: 8px;">
+ <div class="search_thing" style="width: 100%;margin-bottom: 10px;justify-content: right;">
+ <div class="search_label" style="width: 200px;">鍛樺伐鍙�/鍛樺伐濮撳悕锛�</div>
+ <div class="search_input" style="width: 250px;">
+ <el-input size="small" placeholder="璇疯緭鍏ュ伐鍙�/鍛樺伐濮撳悕" @clear="searchPerson" clearable v-model="userSearch2"
+ @keyup.enter.native="searchPerson()"></el-input>
+ </div>
+ <!-- <div class="search_label" style="width: 200px;">鍛樺伐鍙凤細</div>
+ <div class="search_input">
+ <el-input size="small" placeholder="璇疯緭鍏ュ伐鍙�" @clear="searchPerson" clearable v-model="searchEmployeeID"
+ @keyup.enter.native="searchPerson2()"></el-input>
+ </div> -->
+ </div>
+ <el-table height="67vh" border stripe :data="personList" v-loading="personLoad" ref="personTable"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="50">
</el-table-column>
@@ -220,9 +231,11 @@
</el-table-column>
<el-table-column prop="name" label="鍛樺伐濮撳悕">
</el-table-column>
- <el-table-column prop="isLive" label="鏄惁鍚屾" width="100">
+ <el-table-column prop="department" label="閮ㄩ棬" min-width="200">
+ </el-table-column>
+ <el-table-column prop="isLive" label="宸插瓨鍦�" width="80" align="center">
<template slot-scope="scope">
- <el-tag type="success" v-if="scope.row.isLive === 1">鏄�</el-tag>
+ <el-tag type="success" effect="dark" v-if="scope.row.isLive === 1">鈭�</el-tag>
</template>
</el-table-column>
</el-table>
@@ -251,7 +264,7 @@
datathirdParty: [],
defaultProps: {
children: 'children',
- label: 'label'
+ label: 'companyName'
},
addthirdParty: false,
componentData: {
@@ -259,7 +272,7 @@
name: null,
state: null,
company: null,
- departId: null,
+ roleId: null,
orderBy: {
field: 'id',
order: 'asc'
@@ -275,7 +288,9 @@
font: '缂栬緫',
type: 'text',
method: 'doDiy',
- field: ['createUserName', 'updateUserName', 'roleName', '瑙掕壊=roleId', '瀵嗙爜=password']
+ field: ['roleName', '瑙掕壊=roleId', '瀵嗙爜=password',
+ '濮撳悕EN=nameEn', '骞撮緞=age', '閭=email', '鍗曚綅=company', '绛惧悕=signatureUrl', '涓汉鐓х墖=pictureUrl'
+ ]
}],
tagField: {
state: {
@@ -304,94 +319,90 @@
},
roleId: {
select: []
- }
- },
- /* cascaderField:{
- departId:{
- tree:[]
},
- // 瀛楁閰嶇疆
- props:{
- value:'id',
- label:'name',
- checkStrictly: true
- }
- }, */
+ company: {select: []}
+ },
requiredAdd: ['account', 'name', 'state', 'roleId', 'password', 'nameEn', 'phone'],
requiredUp: ['account', 'name', 'state', 'roleId', 'nameEn', 'phone'],
- // disabledUp:['departId'],
addUpload: ['pictureUrl', 'signatureUrl'],
addUploadConfig: {
accept: '.png, .jpg, .jpeg, .gif',
url: this.$api.deviceScope.uploadFile
},
+ needSort: ['name', 'state'],
},
entityCopy: {},
upIndex: 0,
addDia: false,
addPower: true,
+ addUserPower: true,
delStandardTree: true,
addDia0: false,
addOb: {
- fatherId: '',
+ fatherId: 10001,
name: '',
},
search: null,
list: [],
selectTree: '',
treeLoad: false,
- expandedKeys: [],
addLoad: false,
personList: [],
- treeLoad: false,
+ personListCopy: [],
personLoad: false,
search2: '',
- multipleSelection: []
+ multipleSelection: [],
+ companiesList: [],
+ currentCompaniesList: [],
+ userSearch2: '',
+ searchEmployeeID: null,
+ thirdPartyLoading:false
}
},
+ // watch: {
+ // userSearch2(val){}
+ // },
mounted() {
this.selectTreeList()
this.selectRole()
+ this.selectCustomEnum()
this.entityCopy = this.HaveJson(this.componentData.entity)
this.getPower()
},
methods: {
openthirdParty() {
this.addthirdParty = true;
+ this.thirdPartyLoading = true;
this.$axios.get(this.$api.companies.selectCompaniesList).then(res => {
- this.datathirdParty = []
- for (let ai = 0; ai < res.data.length; ai++) {
- let a = res.data[ai]
- if (a.parentCompanyId === 'ROOT') {
- this.datathirdParty.push({
- id: a.companyId,
- label: a.companyName,
- children: []
- })
- res.data.splice(ai, 1)
- ai--
- } else {
- this.getOrganizational(a, ai, this.datathirdParty, res.data)
- }
- }
- })
- },
- getOrganizational(a, ai, children, list) {
- for (let bi = 0; bi < children.length; bi++) {
- let b = children[bi]
- if (a.parentCompanyId === b.id) {
- b.children.push({
- id: a.companyId,
- label: a.companyName,
- children: []
+ this.companiesList = this.HaveJson(res.data);
+ if(this.companiesList.length ==1){
+ this.$axios.post(this.$api.companies.selectSimpleList, {
+ companyId: this.companiesList[0].companyId
+ }).then(res => {
+ this.thirdPartyLoading = false;
+ this.personListCopy = JSON.parse(JSON.stringify(res.data))
+ this.personList = res.data
+ this.$refs.personTable.doLayout()
})
- list.splice(ai, 1)
- ai--
- break
- } else {
- this.getOrganizational(a, ai, b.children, list)
+ }else{
+ this.thirdPartyLoading = false;
}
- }
+ this.datathirdParty = this.tranListToTreeData(res.data, "ROOT");
+ })
+ if(this.componentData.entity.roleId > 10000)this.$message.warning('鐢变簬鏈�変腑鍏蜂綋瑙掕壊锛屾柊澧炵敤鎴峰皢鎴愪负榛樿瑙掕壊')
+ },
+ tranListToTreeData(list, rootValue) {
+ const arr = [];
+ list.forEach((item) => {
+ if (item.parentCompanyId === rootValue) {
+ const children = this.tranListToTreeData(list, item.companyId);
+ if (children.length) {
+ item.children = children;
+ }
+ arr.push(item);
+ }
+ });
+ return arr;
},
refreshTable() {
this.$refs['ValueTable'].selectList()
@@ -414,18 +425,8 @@
})
},
opeaAdd() {
- if (!this.addOb.fatherId || this.selectTree == '' || this.selectTree == '鍏ㄩ儴') {
- this.$message.error('璇烽�夋嫨涓�涓粍缁�')
- return
- }
this.$refs.ValueTable.openAddDia(this.$api.user.addUser);
this.$refs['ValueTable'].upData.departId = this.selectTree
- },
- selectTreeList() {
- /* this.$axios.get(this.$api.department.selectDepartment).then(res => {
- this.componentData.cascaderField.departId.tree = this.handleTree(res.data[0].children)
- }) */
- this.$refs.ValueTable.selectList()
},
handleTree(arr) {
arr.forEach(a => {
@@ -442,6 +443,7 @@
let power = JSON.parse(sessionStorage.getItem('power'))
let up = false
let add = false
+ let addUserPower = false
let delStandardTree = false
for (var i = 0; i < power.length; i++) {
if (power[i].menuMethod == 'updateUser') {
@@ -453,19 +455,19 @@
if (power[i].menuMethod == 'delDepartment') {
delStandardTree = true
}
+ if (power[i].menuMethod == 'selectCompaniesList') {
+ addUserPower = true
+ }
}
if (!up) {
this.componentData.do.splice(0, 1)
}
this.delStandardTree = delStandardTree
this.addPower = add
+ this.addUserPower = addUserPower
},
handleAdd() {
- if (this.addOb.fatherId) {
- this.addDia0 = true;
- } else {
- this.$message.error('璇烽�夋嫨涓�涓灦鏋勫眰绾�')
- }
+ this.addDia = true;
},
searchFilter() {
this.$refs.tree.filter(this.search)
@@ -474,13 +476,12 @@
this.$refs.tree2.filter(this.search2)
},
filterNode(value, data) {
- console.log(data);
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
filterNode2(value, data) {
if (!value) return true;
- return data.label.indexOf(value) !== -1;
+ return data['companyName'].indexOf(value) !== -1;
},
handleNodeClick(val, node, el) { //鏍戠殑鍊�
this.selectTree = ''
@@ -492,21 +493,17 @@
data2 += " - " + data[index]
}
this.selectTree = data2.replace(' - ', '')
- this.addOb.fatherId = val.id;
- this.componentData.entity.departId = val.id;
+ this.componentData.entity.roleId = val.id;
this.refreshTable()
},
nodeOpen(data, node, el) {
$($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder-opened')
},
+ nodeOpen0(data, node, el) {
+ this.currentCompaniesList[node.level - 1] = data.id
+ },
nodeClose(data, node, el) {
$($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder')
- },
- getNodeParent(val) {
- if (val.parent != null) {
- this.selectTree += ' - ' + val.label
- this.getNodeParent(val.parent)
- }
},
remove(node, data) {
this.$confirm("鏄惁鍒犻櫎璇ュ眰绾�", "鎻愮ず", {
@@ -526,16 +523,8 @@
this.treeLoad = true
this.$axios.get(this.$api.department.selectDepartment).then(res => {
this.list = res.data
- this.list.forEach(a => {
- a.children.forEach(b => {
- b.children.forEach(c => {
- this.expandedKeys.push(c.id)
- })
- })
- })
this.treeLoad = false
- this.componentData.entity.departId = this.list[0].id;
- this.selectTree = '鍏ㄩ儴'
+ this.componentData.entity.roleId = this.list[0].id;
this.refreshTable()
})
},
@@ -555,33 +544,110 @@
return
}
this.$message.success('娣诲姞鎴愬姛')
- this.addDia0 = false
+ this.addDia = false
this.selectTreeList()
this.addLoad = false
this.addOb.name = ''
- this.addOb.fatherId = ''
}).catch(e => {
- this.addDia0 = false
+ this.addDia = false
this.addLoad = false
})
},
nodeClick2(ob, node, el) {
- if (ob.children.length === 0) {
+ this.getNodeParent(node)
+ if (ob.companyId !== 'SC21') {
this.personLoad = true
this.$axios.post(this.$api.companies.selectSimpleList, {
- companyId: ob.id
+ companyId: ob.companyId
}).then(res => {
+ this.personListCopy = JSON.parse(JSON.stringify(res.data))
this.personList = res.data
this.personLoad = false
this.$refs.personTable.doLayout()
})
}
},
+ getNodeParent(val) {
+ this.currentCompaniesList[val.level - 1] = val.data.companyId
+ if (val.parent != null) {
+ this.getNodeParent(val.parent)
+ }
+ },
handleSelectionChange(val) {
this.multipleSelection = val;
- console.log(this.multipleSelection);
},
- addUser2(){
+ addUser2() {
+ if (this.multipleSelection.length === 0) {
+ return this.$message.error('璇烽�夋嫨浜哄憳')
+ }
+ if (this.currentCompaniesList.length === 0) {
+ return this.$message.error('璇烽�夋嫨缁勭粐')
+ }
+ /* for (let index = this.currentCompaniesList.length-1; index >1; index--) {
+ let obj = this.multipleSelection.find(a=>a.companyId==this.currentCompaniesList[index])
+ if(!obj){
+ this.currentCompaniesList.splice(index,1)
+ }
+ } */
+ let arr = []
+ this.currentCompaniesList.forEach(b => {
+ let obj = this.companiesList.find(a => a.companyId == b)
+ arr.push(obj)
+ })
+ this.addLoad = true
+ this.$axios.post(this.$api.companies.addPersonUser, {
+ company: arr,
+ person: this.multipleSelection,
+ roleId: this.componentData.entity.roleId
+ }, {
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ }).then(res => {
+ if (res.code === 201) {
+ this.addLoad = false
+ return
+ }
+ this.$message.success('鎿嶄綔鎴愬姛')
+ this.multipleSelection = []
+ this.$refs.personTable.clearSelection()
+ this.addLoad = false
+ this.userSearch2 = ''
+ this.selectTreeList()
+ }).catch(e => {
+ this.addLoad = false
+ })
+ },
+ searchPerson() {
+ let arr = JSON.parse(JSON.stringify(this.personListCopy))
+ this.personList = arr.filter(a => {
+ if (a.employeeID.includes(this.userSearch2) || a.name.includes(this.userSearch2)) {
+ return true
+ }
+ })
+ },
+ searchPerson2(){
+ if(this.searchEmployeeID===null||this.searchEmployeeID===''){
+ this.searchPerson()
+ return
+ }
+ this.$axios.post(this.$api.companies.selectPersonUser, {
+ code: this.searchEmployeeID
+ }).then(res=>{
+ this.personList = []
+ this.personList.push(res.data)
+ })
+ },
+ selectCustomEnum(){
+ this.$axios.get(this.$api.user.selectCustomEnum).then(res=>{
+ this.componentData.selectField.company.select = []
+ res.data.forEach(a=>{
+ this.componentData.selectField.company.select.push({
+ label: a.company,
+ value: a.id
+ })
+ })
+ })
}
}
}
--
Gitblit v1.9.3