|
@@ -27,12 +27,17 @@
|
|
<el-form-item :label='$t("calssSchedule.table.staffChange.applyTime")+":"' prop="applyTime">
|
|
<el-form-item :label='$t("calssSchedule.table.staffChange.applyTime")+":"' prop="applyTime">
|
|
<el-date-picker v-model="tenant.applyTime" type="date" value-format="yyyy-MM-dd" :placeholder='$t("common.pleaseSelect")' style="width: 100%;" @change="dateChange"></el-date-picker>
|
|
<el-date-picker v-model="tenant.applyTime" type="date" value-format="yyyy-MM-dd" :placeholder='$t("common.pleaseSelect")' style="width: 100%;" @change="dateChange"></el-date-picker>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item :label='$t("calssSchedule.table.staffChange.model")+":"' prop="" style="border-bottom: 1px solid #EEEEEE;">
|
|
|
|
- <template>
|
|
|
|
- <el-checkbox-group v-model="tenant.applyList">
|
|
|
|
- <el-checkbox v-for="item in this.applyCheckbox" :key="item.id" :label="item.id" :value="item.id" @change="changeValue(item, $event)" >{{item.name.data}}</el-checkbox>
|
|
|
|
- </el-checkbox-group>
|
|
|
|
- </template>
|
|
|
|
|
|
+ <el-form-item :label='$t("calssSchedule.table.staffChange.model")+":"' prop="applyList" style="border-bottom: 1px solid #EEEEEE;">
|
|
|
|
+<!-- <template>-->
|
|
|
|
+<!-- <el-checkbox-group v-model="tenant.applyList">-->
|
|
|
|
+<!-- <el-checkbox v-for="item in this.applyCheckbox" :key="item.id" :label="item.id" :value="item.id" @change="checked=>applyValue(checked,item)" >{{item.name.data}}</el-checkbox>-->
|
|
|
|
+<!-- </el-checkbox-group>-->
|
|
|
|
+<!-- </template>-->
|
|
|
|
+ <ul style="list-style: none;">
|
|
|
|
+ <li v-for="item in this.applyCheckbox" :key="item.id" >
|
|
|
|
+ <el-checkbox v-model="item.checked" @change="checked=>applyValue(checked,item)" >{{item.name.data}}</el-checkbox>
|
|
|
|
+ </li>
|
|
|
|
+ </ul>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item :label='$t("calssSchedule.table.staffChange.hours")+":"' prop="changeUserId">
|
|
<el-form-item :label='$t("calssSchedule.table.staffChange.hours")+":"' prop="changeUserId">
|
|
@@ -54,11 +59,16 @@
|
|
<el-date-picker v-model="tenant.changeTime" type="date" value-format="yyyy-MM-dd" :placeholder='$t("common.pleaseSelect")' style="width: 100%;" @change="dateChange2"></el-date-picker>
|
|
<el-date-picker v-model="tenant.changeTime" type="date" value-format="yyyy-MM-dd" :placeholder='$t("common.pleaseSelect")' style="width: 100%;" @change="dateChange2"></el-date-picker>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item :label='$t("calssSchedule.table.staffChange.remark")+":"' prop="changeList">
|
|
<el-form-item :label='$t("calssSchedule.table.staffChange.remark")+":"' prop="changeList">
|
|
- <template>
|
|
|
|
- <el-checkbox-group v-model="tenant.changeList" >
|
|
|
|
- <el-checkbox v-for="item in this.updateCheckbox" :key="item.id" :label="item.id" :value="item.id" @change="changeValue(item, $event)" >{{item.name.data}}</el-checkbox>
|
|
|
|
- </el-checkbox-group>
|
|
|
|
- </template>
|
|
|
|
|
|
+<!-- <template>-->
|
|
|
|
+<!-- <el-checkbox-group v-model="tenant.changeList" >-->
|
|
|
|
+<!-- <el-checkbox v-for="item in this.updateCheckbox" :key="item.id" :label="item.id" :value="item.id" >{{item.name.data}}</el-checkbox>-->
|
|
|
|
+<!-- </el-checkbox-group>-->
|
|
|
|
+<!-- </template>-->
|
|
|
|
+ <ul style="list-style: none;">
|
|
|
|
+ <li v-for="item in this.updateCheckbox" :key="item.id">
|
|
|
|
+ <el-checkbox v-model="item.checked" @change="checked=>changeValue(checked,item)" >{{item.name.data}}</el-checkbox>
|
|
|
|
+ </li>
|
|
|
|
+ </ul>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -74,7 +84,6 @@
|
|
import classesMgrApi from "@/api/classScheduleMgr/classesMgr"
|
|
import classesMgrApi from "@/api/classScheduleMgr/classesMgr"
|
|
// 【部门组织】-API
|
|
// 【部门组织】-API
|
|
import orgApi from "@/api/Org"
|
|
import orgApi from "@/api/Org"
|
|
- import userApi from "@/api/User"
|
|
|
|
// 【日期格式化】组件
|
|
// 【日期格式化】组件
|
|
import moment from "moment"
|
|
import moment from "moment"
|
|
|
|
|
|
@@ -97,8 +106,9 @@ export default {
|
|
screenWidth: 0,
|
|
screenWidth: 0,
|
|
width: this.initWidth(),
|
|
width: this.initWidth(),
|
|
confirmDisabled: false,
|
|
confirmDisabled: false,
|
|
- loginUserId: null,
|
|
|
|
- deptUserList: [],
|
|
|
|
|
|
+ userApplyData: [],
|
|
|
|
+ userChangeData: [],
|
|
|
|
+ deptUserList: [],
|
|
applyCheckbox: [], // 【更换班表-申请人】
|
|
applyCheckbox: [], // 【更换班表-申请人】
|
|
updateCheckbox: [], // 【更换班表-更换人】
|
|
updateCheckbox: [], // 【更换班表-更换人】
|
|
dicts:{
|
|
dicts:{
|
|
@@ -119,10 +129,22 @@ export default {
|
|
{ required: true, message: this.$t("rules.require"), trigger: 'change' }
|
|
{ required: true, message: this.$t("rules.require"), trigger: 'change' }
|
|
],
|
|
],
|
|
applyList: [
|
|
applyList: [
|
|
- { required: true, message: this.$t("rules.require"), trigger: 'change' }
|
|
|
|
|
|
+ { required: true, validator: (rule, value, callback) => {
|
|
|
|
+ if(this.tenant.applyList.length === 0){
|
|
|
|
+ callback(new Error(this.$t("rules.require")))
|
|
|
|
+ }else{
|
|
|
|
+ callback()
|
|
|
|
+ }
|
|
|
|
+ }, trigger: ['change'] }
|
|
],
|
|
],
|
|
changeList: [
|
|
changeList: [
|
|
- { required: true, message: this.$t("rules.require"), trigger: 'change' }
|
|
|
|
|
|
+ { required: true, validator: (rule, value, callback) => {
|
|
|
|
+ if(this.tenant.changeList.length === 0){
|
|
|
|
+ callback(new Error(this.$t("rules.require")))
|
|
|
|
+ }else{
|
|
|
|
+ callback()
|
|
|
|
+ }
|
|
|
|
+ }, trigger: ['change'] }
|
|
],
|
|
],
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -141,7 +163,8 @@ export default {
|
|
return this.$store.state.account.user
|
|
return this.$store.state.account.user
|
|
},
|
|
},
|
|
},
|
|
},
|
|
- created() {
|
|
|
|
|
|
+ created() {
|
|
|
|
+
|
|
},
|
|
},
|
|
mounted () {
|
|
mounted () {
|
|
// this.applyList = this.$constWKS.CASCADERLIST,
|
|
// this.applyList = this.$constWKS.CASCADERLIST,
|
|
@@ -191,7 +214,7 @@ export default {
|
|
this.applyClassList(false, userId, moment(val).format('YYYY-MM-DD'))
|
|
this.applyClassList(false, userId, moment(val).format('YYYY-MM-DD'))
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- initTenant () {
|
|
|
|
|
|
+ initTenant () {
|
|
return {
|
|
return {
|
|
id: '',
|
|
id: '',
|
|
name: '',
|
|
name: '',
|
|
@@ -215,14 +238,13 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
setTenant (val, dicts) {
|
|
setTenant (val, dicts) {
|
|
- if(val){
|
|
|
|
|
|
+ if(val){
|
|
this.queryUserApplyData(val)
|
|
this.queryUserApplyData(val)
|
|
this.queryUserChangeData(val)
|
|
this.queryUserChangeData(val)
|
|
this.tenant = { ...val }
|
|
this.tenant = { ...val }
|
|
this.applyClassList(true, val.applyUserId, val.applyTime)
|
|
this.applyClassList(true, val.applyUserId, val.applyTime)
|
|
this.applyClassList(false, val.changeUserId, val.changeTime)
|
|
this.applyClassList(false, val.changeUserId, val.changeTime)
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
// 字典表
|
|
// 字典表
|
|
this.dicts = dicts
|
|
this.dicts = dicts
|
|
},
|
|
},
|
|
@@ -235,8 +257,28 @@ export default {
|
|
this.$refs.form.resetFields()
|
|
this.$refs.form.resetFields()
|
|
this.tenant = this.initTenant()
|
|
this.tenant = this.initTenant()
|
|
},
|
|
},
|
|
- changeValue(item, event){
|
|
|
|
- console.log(item)
|
|
|
|
|
|
+ applyValue(checked,item){
|
|
|
|
+ if(checked){
|
|
|
|
+ this.tenant.applyList.push(item.id)
|
|
|
|
+ }else{
|
|
|
|
+ for(let i = 0;i< this.tenant.applyList.length; i++){
|
|
|
|
+ if(this.tenant.applyList[i] === item.id){
|
|
|
|
+ console.log('delete')
|
|
|
|
+ this.tenant.applyList.splice(i,1)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ changeValue(checked,item){
|
|
|
|
+ if(checked){
|
|
|
|
+ this.tenant.changeList.push(item.id)
|
|
|
|
+ }else{
|
|
|
|
+ for(let i = 0;i< this.tenant.changeList.length; i++){
|
|
|
|
+ if(this.tenant.changeList[i] === item.id){
|
|
|
|
+ this.tenant.changeList.splice(i,1)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
submitForm () {
|
|
submitForm () {
|
|
this.$refs.form.validate((valid) => {
|
|
this.$refs.form.validate((valid) => {
|
|
@@ -253,7 +295,7 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
save () {
|
|
save () {
|
|
- this.tenant.applyUserId = this.loginUserId
|
|
|
|
|
|
+ this.tenant.applyUserId = this.$store.state.account.user.id
|
|
shiftChangeMgrApi.save(this.tenant)
|
|
shiftChangeMgrApi.save(this.tenant)
|
|
.then((response) => {
|
|
.then((response) => {
|
|
const res = response.data
|
|
const res = response.data
|
|
@@ -274,7 +316,7 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
update () {
|
|
update () {
|
|
- this.tenant.applyUserId = this.loginUserId
|
|
|
|
|
|
+ this.tenant.applyUserId = this.$store.state.account.user.id
|
|
shiftChangeMgrApi.update(this.tenant)
|
|
shiftChangeMgrApi.update(this.tenant)
|
|
.then((response) => {
|
|
.then((response) => {
|
|
const res = response.data
|
|
const res = response.data
|
|
@@ -299,12 +341,35 @@ export default {
|
|
classesMgrApi.getListById({userId: val, date}).then(res => {
|
|
classesMgrApi.getListById({userId: val, date}).then(res => {
|
|
res = res.data
|
|
res = res.data
|
|
if (res.isSuccess) {
|
|
if (res.isSuccess) {
|
|
- // 如果是【申请人-更换班表】
|
|
|
|
- if(flag){
|
|
|
|
- this.applyCheckbox = res.data
|
|
|
|
|
|
+ if(flag){
|
|
|
|
+ // 如果是【申请人-更换班表】
|
|
|
|
+ this.applyCheckbox = res.data
|
|
|
|
+
|
|
|
|
+ this.applyCheckbox.map(item => {
|
|
|
|
+ this.$set(item, 'checked', false)
|
|
|
|
+
|
|
|
|
+ for(var i = 0; i<this.userApplyData.length; i++){
|
|
|
|
+ if(this.userApplyData[i] == item.id){
|
|
|
|
+ this.$set(item, 'checked', true)
|
|
|
|
+ this.$set(item, 'focus', true)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return item
|
|
|
|
+ })
|
|
|
|
+ console.log(this.applyCheckbox)
|
|
}else{ // 如果是【更换人-更换班表】
|
|
}else{ // 如果是【更换人-更换班表】
|
|
this.updateCheckbox = res.data
|
|
this.updateCheckbox = res.data
|
|
- }
|
|
|
|
|
|
+ this.updateCheckbox.map(item => {
|
|
|
|
+ this.$set(item, 'checked', false)
|
|
|
|
+ for(var i = 0; i<this.userChangeData.length; i++){
|
|
|
|
+ if(this.userChangeData[i] == item.id){
|
|
|
|
+ this.$set(item, 'checked', true)
|
|
|
|
+ this.$set(item, 'focus', true)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return item
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -322,8 +387,8 @@ export default {
|
|
response = response.data
|
|
response = response.data
|
|
if (response.isSuccess) {
|
|
if (response.isSuccess) {
|
|
// 返回修改的用户换班信息
|
|
// 返回修改的用户换班信息
|
|
|
|
+ this.userApplyData = response.data
|
|
this.tenant.applyList = response.data
|
|
this.tenant.applyList = response.data
|
|
- console.log(this.tenant.applyList)
|
|
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -332,8 +397,8 @@ export default {
|
|
response = response.data
|
|
response = response.data
|
|
if (response.isSuccess) {
|
|
if (response.isSuccess) {
|
|
// 返回修改的用户换班信息
|
|
// 返回修改的用户换班信息
|
|
|
|
+ this.userChangeData = response.data
|
|
this.tenant.changeList = response.data
|
|
this.tenant.changeList = response.data
|
|
- console.log(this.tenant.changeList)
|
|
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|