|
|
@@ -39,9 +39,8 @@
|
|
|
size="mini"
|
|
|
label-width="120px">
|
|
|
<el-checkbox-group v-model="selectLocal">
|
|
|
- <el-checkbox v-for="(item,index) in LocalList"
|
|
|
+ <el-checkbox v-for="item in LocalList"
|
|
|
:label="item.ItemValue"
|
|
|
- @change="getDetailData(index,item)"
|
|
|
:key="item.ItemValue">{{item.ItemName}}</el-checkbox>
|
|
|
</el-checkbox-group>
|
|
|
</el-form-item>
|
|
|
@@ -62,11 +61,11 @@
|
|
|
<el-button size="mini"
|
|
|
@click="addList()"
|
|
|
type="success"
|
|
|
- style="margin-right:6px">生成表格</el-button>
|
|
|
+ style="margin-right:6px">生成值班表</el-button>
|
|
|
<el-button size="mini"
|
|
|
type="primary"
|
|
|
style="margin-left:10px"
|
|
|
- @click="addDuytDetail()">保存</el-button>
|
|
|
+ @click="addDuytDetail()">保存值班表</el-button>
|
|
|
<el-button size="mini"
|
|
|
type="warning"
|
|
|
style="margin-right:6px"
|
|
|
@@ -253,44 +252,40 @@ export default {
|
|
|
if (this.selectLocal == 0 && this.selectTime.length == 0) {
|
|
|
return
|
|
|
}
|
|
|
- this.list = []
|
|
|
+ // 清空已选择
|
|
|
this.selectcell = new Map()
|
|
|
- let _this = this
|
|
|
+ let _this = this; let listMap = new Map(); let newList = []
|
|
|
+ this.list.forEach(row => {
|
|
|
+ listMap.set(row.Local + '_' + row.Time, row)
|
|
|
+ })
|
|
|
this.selectLocal.forEach(function (value, key) {
|
|
|
_this.selectTime.forEach(function (valuee, keyy) {
|
|
|
- _this.list.push({
|
|
|
- DutyId: _this.dutyDetail.Id,
|
|
|
- Local: value,
|
|
|
- Time: valuee,
|
|
|
- Monday: 0,
|
|
|
- Tuesday: 0,
|
|
|
- Wednesday: 0,
|
|
|
- Thursday: 0,
|
|
|
- Friday: 0,
|
|
|
- Saturday: 0,
|
|
|
- Sunday: 0
|
|
|
- })
|
|
|
+ if (listMap.get(value + '_' + valuee)) {
|
|
|
+ newList.push(listMap.get(value + '_' + valuee))
|
|
|
+ } else {
|
|
|
+ newList.push({
|
|
|
+ DutyId: _this.dutyDetail.Id,
|
|
|
+ Local: value,
|
|
|
+ Time: valuee,
|
|
|
+ Monday: 0,
|
|
|
+ Tuesday: 0,
|
|
|
+ Wednesday: 0,
|
|
|
+ Thursday: 0,
|
|
|
+ Friday: 0,
|
|
|
+ Saturday: 0,
|
|
|
+ Sunday: 0
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
})
|
|
|
+ this.list = newList
|
|
|
},
|
|
|
// 保存值班子表信息
|
|
|
addDuytDetail () {
|
|
|
- let _this = this
|
|
|
if (this.dutyDetail.Id) {
|
|
|
DutyApi.Saves({ DataList: this.list, DutyId: this.dutyDetail.Id })
|
|
|
.then(res => {
|
|
|
- // console.log(res, 11111111111)
|
|
|
- // if (res.code == 0) {
|
|
|
- // _this.$message({
|
|
|
- // type: 'success',
|
|
|
- // message: res.message
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // _this.$message({
|
|
|
- // type: 'warning',
|
|
|
- // message: res.message
|
|
|
- // })
|
|
|
- // }
|
|
|
+
|
|
|
})
|
|
|
.catch(err => {
|
|
|
// handle error
|
|
|
@@ -427,7 +422,6 @@ export default {
|
|
|
},
|
|
|
// 获取学期名称
|
|
|
getTerm () {
|
|
|
- let termName = ''
|
|
|
let _this = this
|
|
|
_this.termList.forEach(function (value, key) {
|
|
|
if (_this.dutyDetail.Term == value.ItemValue) {
|