From 4bf09d8c719570e9c76c41fac368c339687685ae Mon Sep 17 00:00:00 2001
From: Crunchy <3114200645@qq.com>
Date: 星期三, 31 七月 2024 16:49:10 +0800
Subject: [PATCH] 检验下单页面勾选检验项目的时候,样品的待检项数量没有变化-回显
---
src/components/view/person-manage.vue | 264 ++++++++++++++++++++++++----------------------------
1 files changed, 122 insertions(+), 142 deletions(-)
diff --git a/src/components/view/person-manage.vue b/src/components/view/person-manage.vue
index 3e2f59d..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}">
@@ -175,7 +173,7 @@
<el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
</div>
<div class="search_thing" style="display: flex;justify-content: right;margin-right: 10px;">
- <el-button size="small" type="primary" @click="openthirdParty" v-if="selectCompaniesList">鑾峰彇涓夋柟浜哄憳</el-button>
+ <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,30 +199,29 @@
</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-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 @blur="searchFilter2" @clear="searchFilter2" @keyup.enter.native="searchFilter2()">
+ 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);"
- @node-expand="nodeOpen0" :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;">
- <div class="search_thing" style="width: 360px;margin-bottom: 10px;">
- <div class="search_label" style="width: 140px;">鍛樺伐鍙�/鍛樺伐濮撳悕锛�</div>
+ <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="userSearch2"
- @keyup.enter.native="searchPerson()">
- <i slot="suffix" class="el-input__icon el-icon-search" style="cursor: pointer;" @click="searchPerson"></i></el-input>
- </div>
+ <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">
@@ -233,6 +230,8 @@
<el-table-column prop="employeeID" label="鍛樺伐鍙�">
</el-table-column>
<el-table-column prop="name" label="鍛樺伐濮撳悕">
+ </el-table-column>
+ <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">
@@ -265,7 +264,7 @@
datathirdParty: [],
defaultProps: {
children: 'children',
- label: 'label'
+ label: 'companyName'
},
addthirdParty: false,
componentData: {
@@ -273,7 +272,7 @@
name: null,
state: null,
company: null,
- departId: null,
+ roleId: null,
orderBy: {
field: 'id',
order: 'asc'
@@ -289,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: {
@@ -318,27 +319,17 @@
},
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,
@@ -348,24 +339,24 @@
delStandardTree: true,
addDia0: false,
addOb: {
- fatherId: '',
+ fatherId: 10001,
name: '',
},
search: null,
list: [],
selectTree: '',
treeLoad: false,
- expandedKeys: [],
addLoad: false,
personList: [],
- personListCopy:[],
- treeLoad: false,
+ personListCopy: [],
personLoad: false,
search2: '',
multipleSelection: [],
- companiesList:[],
+ companiesList: [],
currentCompaniesList: [],
- userSearch2:''
+ userSearch2: '',
+ searchEmployeeID: null,
+ thirdPartyLoading:false
}
},
// watch: {
@@ -374,47 +365,44 @@
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.companiesList = JSON.parse(JSON.stringify(res.data));
- 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()
@@ -437,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 => {
@@ -477,7 +455,7 @@
if (power[i].menuMethod == 'delDepartment') {
delStandardTree = true
}
- if (power[i].menuMethod == 'addPersonUser') {
+ if (power[i].menuMethod == 'selectCompaniesList') {
addUserPower = true
}
}
@@ -489,11 +467,7 @@
this.addUserPower = addUserPower
},
handleAdd() {
- if (this.addOb.fatherId||this.addOb.name=='鍏ㄩ儴') {
- this.addDia0 = true;
- } else {
- this.$message.error('璇烽�夋嫨涓�涓灦鏋勫眰绾�')
- }
+ this.addDia = true;
},
searchFilter() {
this.$refs.tree.filter(this.search)
@@ -502,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 = ''
@@ -520,24 +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
+ 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("鏄惁鍒犻櫎璇ュ眰绾�", "鎻愮ず", {
@@ -557,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()
})
},
@@ -586,22 +544,21 @@
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) {
- this.currentCompaniesList[node.level-1] = ob.id
- if (ob.id !== 'SC21') {
+ 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
@@ -610,38 +567,38 @@
})
}
},
+ getNodeParent(val) {
+ this.currentCompaniesList[val.level - 1] = val.data.companyId
+ if (val.parent != null) {
+ this.getNodeParent(val.parent)
+ }
+ },
handleSelectionChange(val) {
this.multipleSelection = val;
},
- addUser2(){
- if(this.multipleSelection.length === 0){
+ addUser2() {
+ if (this.multipleSelection.length === 0) {
return this.$message.error('璇烽�夋嫨浜哄憳')
}
- if(this.currentCompaniesList.length === 0){
+ if (this.currentCompaniesList.length === 0) {
return this.$message.error('璇烽�夋嫨缁勭粐')
}
- for (let index = this.currentCompaniesList.length-1; index >1; index--) {
+ /* 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)
- }else{
- return
}
- }
+ } */
let arr = []
- this.currentCompaniesList.forEach(b=>{
- this.companiesList.forEach(a=>{
- if(a.companyId===b){
- console.log(a)
- }
- })
- let obj = this.companiesList.find(a=>a.companyId==b)
+ 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
+ person: this.multipleSelection,
+ roleId: this.componentData.entity.roleId
}, {
headers: {
'Content-Type': 'application/json'
@@ -652,22 +609,45 @@
return
}
this.$message.success('鎿嶄綔鎴愬姛')
- this.refresh()
this.multipleSelection = []
this.$refs.personTable.clearSelection()
- this.addthirdParty = false
+ this.addLoad = false
+ this.userSearch2 = ''
+ this.selectTreeList()
}).catch(e => {
- this.addthirdParty = false
this.addLoad = false
})
},
- searchPerson(){
+ 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)){
+ 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