|
@@ -458,7 +458,10 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="部门">
|
|
|
<template slot-scope="scope">
|
|
|
- <div>
|
|
|
+ <div v-if="scope.row.dname==null">
|
|
|
+ <div>全公司</div>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
<div v-if="user.userNameNeedTranslate == 1">
|
|
|
<ww-open-data type='departmentName' :openid='scope.row.dname'></ww-open-data>
|
|
|
</div>
|
|
@@ -485,14 +488,23 @@
|
|
|
<el-form-item :label="$t('time.endTime')">
|
|
|
<el-time-picker v-model="restTime.endTime" :placeholder="$t('message.Pleaseselectatime')" format="HH:mm" value-format="HH:mm" @change="timeRule(1)"></el-time-picker>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
- <div v-if="setupItemId == null" style="max-height: 280px;overflow: auto;">
|
|
|
+ <el-form-item label="有效范围">
|
|
|
+ <template>
|
|
|
+ <el-radio v-model="restTime.type" label="1">全公司</el-radio>
|
|
|
+ <el-radio v-model="restTime.type" label="2">部门</el-radio>
|
|
|
+ </template>
|
|
|
+ </el-form-item>
|
|
|
+ <div style="max-height: 280px;overflow: auto;">
|
|
|
<el-tree
|
|
|
+ v-if="restTime.type == 2"
|
|
|
ref="deptTree"
|
|
|
:props="deptProps"
|
|
|
:data="options"
|
|
|
+ :check-strictly = "checkStrictly"
|
|
|
node-key="id"
|
|
|
- :default-expanded-keys="[-1]"
|
|
|
+ :default-expanded-keys="expandedKeys"
|
|
|
+ :default-checked-keys = checkedKeys
|
|
|
+ @check-change="handleNodeClick"
|
|
|
show-checkbox>
|
|
|
<span class="custom-tree-node" slot-scope="{ node }">
|
|
|
<span v-if="!user.userNameNeedTranslate == 1">{{ node.label }} </span>
|
|
@@ -561,6 +573,16 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ expandedKeys: [],
|
|
|
+ checkStrictly: false,
|
|
|
+ checkedKeys:[],
|
|
|
+ restTime: {
|
|
|
+ dId: null,
|
|
|
+ type: 1,
|
|
|
+ departmentId: null,
|
|
|
+ startTime: null,
|
|
|
+ endTime: null
|
|
|
+ },
|
|
|
deptProps:{
|
|
|
children: 'children',
|
|
|
label: 'label'
|
|
@@ -649,11 +671,6 @@
|
|
|
iptss: '',
|
|
|
setupRestDialog: false,
|
|
|
setupRestAppendDialog: false,
|
|
|
- restTime: {
|
|
|
- departmentId:null,
|
|
|
- startTime: null,
|
|
|
- endTime: null
|
|
|
- },
|
|
|
restList: [],
|
|
|
setupItemId: null,
|
|
|
|
|
@@ -709,7 +726,7 @@
|
|
|
},res => {
|
|
|
if(res.code == 'ok'){
|
|
|
console.log(res.data)
|
|
|
- var all = {id:-1,label: '全选',children:[]}
|
|
|
+ var all = {id:-1,label: '全选',disabled:false,children:[]}
|
|
|
all.children = JSON.parse(JSON.stringify(res.data))
|
|
|
this.options.unshift(all)
|
|
|
}else {
|
|
@@ -724,6 +741,11 @@
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
+ },
|
|
|
+ handleNodeClick(data, checked){
|
|
|
+ if(checked && this.setupItemId != null){
|
|
|
+ this.$refs.deptTree.setCheckedNodes([data])
|
|
|
+ }
|
|
|
},
|
|
|
myCustomNextStepCallback(currentStep) {
|
|
|
console.log(currentStep, '看看')
|
|
@@ -804,15 +826,30 @@
|
|
|
},
|
|
|
setupRestNew(){
|
|
|
this.setupItemId = null
|
|
|
+ this.options[0].disabled = false
|
|
|
+ this.checkedKeys = []
|
|
|
+ this.checkStrictly = false
|
|
|
+ this.expandedKeys = [-1]
|
|
|
+ this.restTime = {startTime: null, endTime: null, type: "1"}
|
|
|
this.setupRestAppendDialog = true
|
|
|
- this.restTime = {startTime: null, endTime: null}
|
|
|
},
|
|
|
setupRestEdit(item){
|
|
|
+ this.checkStrictly = true
|
|
|
this.setupItemId = item.id
|
|
|
this.setupRestAppendDialog = true
|
|
|
let Jitem = JSON.parse(JSON.stringify(item))
|
|
|
+ if(item.did == null){
|
|
|
+ this.restTime.type = '1'
|
|
|
+ this.expandedKeys = [-1]
|
|
|
+ }else{
|
|
|
+ this.restTime.type = '2'
|
|
|
+ this.checkedKeys = [item.did]
|
|
|
+ this.expandedKeys = [item.did]
|
|
|
+ }
|
|
|
+ this.options[0].disabled = true
|
|
|
this.restTime = {
|
|
|
departmentId:Jitem.departmentId,
|
|
|
+ type: this.restTime.type,
|
|
|
startTime: Jitem.startTime,
|
|
|
endTime: Jitem.endTime
|
|
|
}
|
|
@@ -841,7 +878,11 @@
|
|
|
})
|
|
|
},
|
|
|
setupRestSure(){
|
|
|
- if(this.setupItemId == null){
|
|
|
+ if(this.restTime.startTime == null || this.restTime.endTime == null){
|
|
|
+ this.$message(this.$t('qing-xuan-ze-shi-jian-duan'))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(this.restTime.type == 2){
|
|
|
var data = this.$refs.deptTree.getCheckedNodes()
|
|
|
var deptId = [];
|
|
|
for(var i in data){
|
|
@@ -849,26 +890,27 @@
|
|
|
deptId.push(data[i].id)
|
|
|
}
|
|
|
}
|
|
|
+ this.restTime.departmentId = deptId
|
|
|
+ if(this.restTime.departmentId.length == 0){
|
|
|
+ this.$message("请选择部门")
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
- this.restTime.departmentId = deptId
|
|
|
if(this.setupItemId != null){
|
|
|
this.restTime.id = this.setupItemId
|
|
|
}
|
|
|
- if(this.setupItemId == null && this.restTime.departmentId.length == 0){
|
|
|
- this.$message("请选择部门")
|
|
|
- return
|
|
|
- }
|
|
|
- if(this.restTime.startTime == null || this.restTime.endTime == null){
|
|
|
- this.$message(this.$t('qing-xuan-ze-shi-jian-duan'))
|
|
|
- return
|
|
|
- }
|
|
|
this.http.post('/time-auto-exclude/addOrMod',this.restTime,
|
|
|
res => {
|
|
|
if(res.code == 'ok'){
|
|
|
+ if(res.msg){
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ }
|
|
|
this.getRestList()
|
|
|
this.setupRestAppendDialog = false
|
|
|
}else {
|
|
|
- this.setupRestAppendDialog = false
|
|
|
this.$message({
|
|
|
message: res.msg,
|
|
|
type: 'error'
|