Commit b4bc89c4 authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents dcad29d3 68b5d834
...@@ -87,6 +87,8 @@ ...@@ -87,6 +87,8 @@
<div style="margin-top: 3px;"> <div style="margin-top: 3px;">
{{ userOptions.length > 0 ? '请选择人员' : '请选择部门' }} {{ userOptions.length > 0 ? '请选择人员' : '请选择部门' }}
</div> </div>
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange"
v-if="userOptions.length > 0">全选</el-checkbox>
<el-checkbox-group v-model="checkedUser"> <el-checkbox-group v-model="checkedUser">
<el-checkbox v-for="i in userOptions" :label="i.staffId" :key="i">{{ i.staffName <el-checkbox v-for="i in userOptions" :label="i.staffId" :key="i">{{ i.staffName
}}</el-checkbox> }}</el-checkbox>
...@@ -105,7 +107,6 @@ ...@@ -105,7 +107,6 @@
<script> <script>
import formCreate from "@form-create/element-ui"; import formCreate from "@form-create/element-ui";
import moment from 'moment'
function formType(val) { function formType(val) {
// (1.单项选择,2.多项选择,3.文本框,4.多项文本框,5.文字,6.上传附件) // (1.单项选择,2.多项选择,3.文本框,4.多项文本框,5.文字,6.上传附件)
switch (val) { switch (val) {
...@@ -174,8 +175,11 @@ export default { ...@@ -174,8 +175,11 @@ export default {
}, },
treeDialog: 0, treeDialog: 0,
isIndeterminate: false,
userOptions: [], userOptions: [],
checkedUser: [], checkedUser: [],
checkAll: false,
checkAllArr: [],
} }
}, },
mounted() { mounted() {
...@@ -203,8 +207,32 @@ export default { ...@@ -203,8 +207,32 @@ export default {
this.$message.warning('请选择人员') this.$message.warning('请选择人员')
} }
}, },
handleCheckAllChange(val) {
console.log(val, this.userOptions)
if (val) {
let arr = []
this.userOptions.forEach(i => {
arr.push(i.staffId)
})
this.checkedUser = Array.from(new Set([...this.checkedUser, ...arr]))
console.log(this.checkedUser)
this.isIndeterminate = false;
} else {
let arr = []
this.userOptions.forEach(i => {
arr.push(i.staffId)
})
let newSet = new Set(this.checkedUser)
arr.forEach(i => {
newSet.delete(i)
})
this.checkedUser = [...newSet]
console.log(this.checkedUser)
}
},
handleNodeClick(data) { handleNodeClick(data) {
if (data.personList) { if (data.personList) {
this.checkAll = false;
this.userOptions = data.personList this.userOptions = data.personList
// console.log(this.userOptions) // console.log(this.userOptions)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment