| | |
| | | <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button> |
| | | </div> |
| | | <div class="search_thing btns" style="padding-left: 30px;"> |
| | | <el-button size="small" type="primary" v-if="downPower" @click="configTime" :loading="downLoading">时间配置</el-button> |
| | | <el-button size="small" type="primary" v-if="listPower" @click="configTime" :loading="downLoading">时间配置</el-button> |
| | | <el-button size="small" type="primary" v-if="downPower" @click="handleDown" :loading="downLoading">导 出</el-button> |
| | | <el-button size="small" type="primary" @click="schedulingVisible = true" v-if="addPower">排 班</el-button> |
| | | </div> |
| | |
| | | <span style="color:#909399;font-size:14px;position: absolute;left:50%;top: 50%;transform: translate(-59%,-50%);" v-if="(query.month&&list.length==0)||(!query.month&&yearList.length==0)">暂无数据</span> |
| | | </div> |
| | | <el-dialog title="时间配置" :visible.sync="configTimeVisible" width="620px"> |
| | | <div v-loading="configTimeVisibleLoading" ></div> |
| | | <div v-if="!configTimeVisibleLoading"> |
| | | <div v-loading="configTimeVisibleLoading" style="min-height: 200px;"> |
| | | <div v-for="(item, index) in timeQuery"> |
| | | <div class="form_title"> |
| | | <span>{{`班次${transFromNumber(index + 1)}`}}</span> |
| | | <span style="margin-right: 10px"> |
| | | <i class="el-icon-circle-check" v-if="item.isEdit" style="margin-left: 10px; color: #4b79f2" @click="saveEdit(item, index)"></i> |
| | | <i class="el-icon-edit" v-if="!item.isEdit" style="margin-left: 10px; color: #4b79f2" @click="item.isEdit = true"></i> |
| | | <i class="el-icon-delete" v-if="!item.isEdit && timeQuery.length > 1" style="margin-left: 10px; color: #FF4902" @click="deleteTime(item, index)"></i> |
| | | </span> |
| | | </div> |
| | | <div class="form"> |
| | | <div style="margin-bottom: 12px"> |
| | | <div class="form" style="display: flex;justify-content: space-between"> |
| | | <div style="margin-bottom: 12px;width: 200px;"> |
| | | <span class="form_label">班次:</span> |
| | | <span v-if="!item.isEdit"> {{item.type}} </span> |
| | | <span class="form_input" v-if="item.isEdit"> |
| | | <el-select v-model="item.shift" placeholder="请选择" style="width: 70%;" clearable size="small"> |
| | | <el-select v-model="item.shift" placeholder="请选择" style="width: 70%;margin-right: 8px;" clearable size="small"> |
| | | <el-option v-for="obj in timeTypeList" |
| | | :key="obj.value" |
| | | :label="obj.label" |
| | |
| | | </el-select> |
| | | </span> |
| | | </div> |
| | | <div> |
| | | <div style="width: calc(100% - 260px);"> |
| | | <span class="form_label">时间:</span> |
| | | <span v-if="!item.isEdit"> {{item.time === null ? '' : item.time[0] + '~' + item.time[1]}} </span> |
| | | <span class="form_input" v-if="item.isEdit"> |
| | | <el-time-picker |
| | | style="width: 70%;" |
| | | style="width: 200px;" |
| | | is-range |
| | | size="small" |
| | | v-model="item.time" |
| | |
| | | </el-time-picker> |
| | | </span> |
| | | </div> |
| | | <el-divider></el-divider> |
| | | <span> |
| | | <i class="el-icon-circle-check" v-if="item.isEdit" style="margin-left: 10px; color: #4b79f2;cursor: pointer;" @click="saveEdit(item, index)"></i> |
| | | <i class="el-icon-edit" v-if="!item.isEdit" style="margin-left: 10px; color: #4b79f2;cursor: pointer;" @click="item.isEdit = true"></i> |
| | | <i class="el-icon-delete" v-if=" timeQuery.length > 1" style="margin-left: 10px; color: #FF4902;cursor: pointer;" @click="deleteTime(item, index)"></i> |
| | | </span> |
| | | </div> |
| | | <div @click="addTimeForm" style="color: #4b79f2" v-if="index === timeQuery.length - 1">添加时间配置</div> |
| | | <el-divider></el-divider> |
| | | <div @click="addTimeForm" style="color: #4b79f2;cursor: pointer;" v-if="index === timeQuery.length - 1">添加时间配置</div> |
| | | </div> |
| | | <div @click="addTimeForm" style="color: #4b79f2" v-if="timeQuery.length === 0">添加时间配置</div> |
| | | </div> |
| | |
| | | configTimeVisibleLoading: false, // 时间配置弹框loading |
| | | timeTypeList: [], |
| | | timeQuery: [], |
| | | listPower:false |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | this.monthList.push(i) |
| | | } |
| | | this.monthList.reverse() |
| | | // this.getPower() |
| | | this.getPower() |
| | | }, |
| | | methods: { |
| | | refresh(){ |
| | |
| | | let add = false |
| | | let up = false |
| | | let down = false |
| | | let listPower = false |
| | | for (var i = 0; i < power.length; i++) { |
| | | if (power[i].menuMethod == 'update') { |
| | | if (power[i].menuMethod == 'performanceShiftUpdate') { |
| | | up = true |
| | | } |
| | | if (power[i].menuMethod == 'delDeviceParameter') { |
| | | down = true |
| | | } |
| | | if (power[i].menuMethod == 'add') { |
| | | if (power[i].menuMethod == 'performanceShiftAdd') { |
| | | add = true |
| | | } |
| | | if (power[i].menuMethod == 'shiftTimeList') { |
| | | listPower = true |
| | | } |
| | | } |
| | | this.addPower = add |
| | | this.upPower = up |
| | | this.downPower = down |
| | | this.listPower = listPower |
| | | }, |
| | | onMouseEnter(index){ |
| | | this.currentUserIndex = index |
| | |
| | | getTimeList () { |
| | | this.configTimeVisibleLoading = true |
| | | this.$axios.post(this.$api.performanceShift.getList).then(res => { |
| | | if (res.code === 200) { |
| | | this.timeQuery = res.data |
| | | this.timeQuery.forEach(item => { |
| | | if (res.code == 201) return |
| | | if (res.data.length > 0) { |
| | | res.data.forEach(item => { |
| | | item.isEdit = false |
| | | item.time = [] |
| | | item.time.push(item.startTime) |
| | | item.time.push(item.endTime) |
| | | const index = this.timeTypeList.findIndex(val => val.value === item.shift) |
| | | if (index > -1) { |
| | | item.type = this.timeTypeList[index].label |
| | | } |
| | | }) |
| | | this.timeQuery = res.data |
| | | } |
| | | this.configTimeVisibleLoading = false |
| | | }).catch(e => { |
| | |
| | | item.type = this.timeTypeList[index].label |
| | | } |
| | | } |
| | | delete item.orderBy |
| | | const isEmpty = this.isObjectEmpty(item) |
| | | if (isEmpty) { |
| | | this.$message.error('请填写完整') |
| | |
| | | }).then(res => { |
| | | if (res.code == 201) return |
| | | this.$message.success('操作成功') |
| | | this.getTimeList() |
| | | }) |
| | | this.getTimeList() |
| | | }, |
| | | deleteTime (item, index) { |
| | | this.$axios.post(this.$api.performanceShift.shiftRemove, { |
| | | id: item.id |
| | | },{ |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }).then(res => { |
| | | if (res.code == 201) return |
| | | this.$message.success('操作成功') |
| | | }) |
| | | this.getTimeList() |
| | | if(item.id){ |
| | | this.$axios.post(this.$api.performanceShift.shiftRemove, { |
| | | id: item.id |
| | | }).then(res => { |
| | | if (res.code == 201) return |
| | | this.$message.success('操作成功') |
| | | this.getTimeList() |
| | | }) |
| | | }else{ |
| | | this.timeQuery.splice(index, 1) |
| | | } |
| | | }, |
| | | isObjectEmpty(obj) { |
| | | return Object.keys(obj).some(key => !obj[key]); |
| | | }, |
| | | saveTimeQuery () { |
| | | this.timeQuery.forEach(item => { |
| | | if (this.isObjectEmpty(item)) { |
| | | return this.$message.error('请填写完整') |
| | | } |
| | | }) |
| | | console.log('???') |
| | | }, |
| | | closeConfigTimeVisible () { |
| | | this.configTimeVisible = false |
| | | this.timeQuery = [{ |
| | | type: '', |
| | | time: null, |
| | | isEdit: false |
| | | }] |
| | | }, |
| | | handleDown(){ |
| | | let year = this.query.year.getFullYear() |