|
|
|
@ -76,7 +76,7 @@ |
|
|
|
</el-form> |
|
|
|
<el-footer style="height:40px;margin-top: 20px;text-align:center" > |
|
|
|
<el-button type="primary" @click="newShiftSave()">保存</el-button> |
|
|
|
<el-button type="primary" @click="newShiftFlag = false">取消</el-button> |
|
|
|
<el-button type="primary" @click="newShiftFlag = false">关闭</el-button> |
|
|
|
</el-footer> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
@ -86,94 +86,94 @@ |
|
|
|
getShiftData, |
|
|
|
saveNewShift, |
|
|
|
deleteShift |
|
|
|
} from "@/api/prd.js"; |
|
|
|
export default { |
|
|
|
} from '@/api/prd.js' |
|
|
|
export default { |
|
|
|
name: 'shiftData', |
|
|
|
data () { |
|
|
|
return { |
|
|
|
height: 200, |
|
|
|
shiftData:[], |
|
|
|
newShiftFlag:false, |
|
|
|
newShiftFlag1:true, |
|
|
|
newShiftData:{ |
|
|
|
shiftno:'', |
|
|
|
shiftdesc:'', |
|
|
|
startexacttime:'', |
|
|
|
endexacttime:'', |
|
|
|
id:'', |
|
|
|
site:this.$store.state.user.site, |
|
|
|
}, |
|
|
|
shiftData: [], |
|
|
|
newShiftFlag: false, |
|
|
|
newShiftFlag1: true, |
|
|
|
newShiftData: { |
|
|
|
shiftno: '', |
|
|
|
shiftdesc: '', |
|
|
|
startexacttime: '', |
|
|
|
endexacttime: '', |
|
|
|
id: '', |
|
|
|
site: this.$store.state.user.site |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.$nextTick(()=>{ |
|
|
|
this.height = window.innerHeight - 210; |
|
|
|
mounted () { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.height = window.innerHeight - 210 |
|
|
|
}) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
newShift () { |
|
|
|
this.newShiftFlag1 = false; |
|
|
|
this.newShiftData.shiftno = ''; |
|
|
|
this.newShiftData.shiftdesc = ''; |
|
|
|
this.newShiftData.startexacttime = ''; |
|
|
|
this.newShiftData.endexacttime = ''; |
|
|
|
this.newShiftData.id = 0; |
|
|
|
this.newShiftFlag = true; |
|
|
|
this.newShiftFlag1 = false |
|
|
|
this.newShiftData.shiftno = '' |
|
|
|
this.newShiftData.shiftdesc = '' |
|
|
|
this.newShiftData.startexacttime = '' |
|
|
|
this.newShiftData.endexacttime = '' |
|
|
|
this.newShiftData.id = 0 |
|
|
|
this.newShiftFlag = true |
|
|
|
}, |
|
|
|
editShift(row){ |
|
|
|
this.newShiftData.shiftno = row.shiftno; |
|
|
|
this.newShiftData.shiftdesc = row.shiftdesc; |
|
|
|
this.newShiftData.startexacttime = row.startexacttime; |
|
|
|
this.newShiftData.endexacttime = row.endexacttime; |
|
|
|
this.newShiftData.id = row.id; |
|
|
|
this.newShiftFlag1 = true; |
|
|
|
this.newShiftFlag = true; |
|
|
|
editShift (row) { |
|
|
|
this.newShiftData.shiftno = row.shiftno |
|
|
|
this.newShiftData.shiftdesc = row.shiftdesc |
|
|
|
this.newShiftData.startexacttime = row.startexacttime |
|
|
|
this.newShiftData.endexacttime = row.endexacttime |
|
|
|
this.newShiftData.id = row.id |
|
|
|
this.newShiftFlag1 = true |
|
|
|
this.newShiftFlag = true |
|
|
|
}, |
|
|
|
newShiftSave(){ |
|
|
|
if (this.newShiftData.shiftno == "" || null == this.newShiftData.shiftno) { |
|
|
|
this.$alert("请输入班次编码!", '错误', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
}); |
|
|
|
return false; |
|
|
|
newShiftSave () { |
|
|
|
if (this.newShiftData.shiftno == '' || this.newShiftData.shiftno == null) { |
|
|
|
this.$alert('请输入班次编码!', '错误', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
return false |
|
|
|
} |
|
|
|
if (this.newShiftData.shiftdesc == "" || null == this.newShiftData.shiftdesc) { |
|
|
|
this.$alert("请输入班次名称!", '错误', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
}); |
|
|
|
return false; |
|
|
|
if (this.newShiftData.shiftdesc == '' || this.newShiftData.shiftdesc == null) { |
|
|
|
this.$alert('请输入班次名称!', '错误', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
return false |
|
|
|
} |
|
|
|
if (this.newShiftData.startexacttime == "") { |
|
|
|
this.$alert("请输入上班时间!", '错误', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
}); |
|
|
|
return false; |
|
|
|
if (this.newShiftData.startexacttime == '') { |
|
|
|
this.$alert('请输入上班时间!', '错误', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
return false |
|
|
|
} |
|
|
|
if (this.newShiftData.endexacttime == "") { |
|
|
|
this.$alert("请输入下班时间!", '错误', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
}); |
|
|
|
return false; |
|
|
|
if (this.newShiftData.endexacttime == '') { |
|
|
|
this.$alert('请输入下班时间!', '错误', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
let time1=this.newShiftData.startexacttime; |
|
|
|
let time2=this.newShiftData.endexacttime; |
|
|
|
let list={ |
|
|
|
shiftno:this.newShiftData.shiftno, |
|
|
|
shiftdesc:this.newShiftData.shiftdesc, |
|
|
|
startexacttime:'2020-01-01 '+this.newShiftData.startexacttime+':00', |
|
|
|
endexacttime:'2020-01-01 '+this.newShiftData.endexacttime+':00', |
|
|
|
id:this.newShiftData.id, |
|
|
|
site:this.$store.state.user.site, |
|
|
|
}; |
|
|
|
// this.newShiftData.startexacttime='2020-01-01 '+this.newShiftData.startexacttime+':00'; |
|
|
|
// this.newShiftData.endexacttime='2020-01-01 '+this.newShiftData.endexacttime+':00'; |
|
|
|
let time1 = this.newShiftData.startexacttime |
|
|
|
let time2 = this.newShiftData.endexacttime |
|
|
|
let list = { |
|
|
|
shiftno: this.newShiftData.shiftno, |
|
|
|
shiftdesc: this.newShiftData.shiftdesc, |
|
|
|
startexacttime: '2020-01-01 ' + this.newShiftData.startexacttime + ':00', |
|
|
|
endexacttime: '2020-01-01 ' + this.newShiftData.endexacttime + ':00', |
|
|
|
id: this.newShiftData.id, |
|
|
|
site: this.$store.state.user.site |
|
|
|
} |
|
|
|
// this.newShiftData.startexacttime='2020-01-01 '+this.newShiftData.startexacttime+':00'; |
|
|
|
// this.newShiftData.endexacttime='2020-01-01 '+this.newShiftData.endexacttime+':00'; |
|
|
|
saveNewShift(list).then(({data}) => { |
|
|
|
this.newShiftData.startexacttime=time1; |
|
|
|
this.newShiftData.endexacttime=time2; |
|
|
|
this.newShiftData.startexacttime = time1 |
|
|
|
this.newShiftData.endexacttime = time2 |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.newShiftFlag=false; |
|
|
|
this.newShiftFlag = false |
|
|
|
getShiftData().then(({data}) => { |
|
|
|
this.shiftData = data.rows; |
|
|
|
this.shiftData = data.rows |
|
|
|
}) |
|
|
|
this.$message({ |
|
|
|
message: '操作成功', |
|
|
|
@ -184,30 +184,29 @@ |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.$alert(data.msg, '错误', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
}); |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
searchShift(){ |
|
|
|
searchShift () { |
|
|
|
getShiftData().then(({data}) => { |
|
|
|
this.shiftData = data.rows; |
|
|
|
this.shiftData = data.rows |
|
|
|
}) |
|
|
|
}, |
|
|
|
deleteShift(row){ |
|
|
|
|
|
|
|
deleteShift (row) { |
|
|
|
this.$confirm(`是否删除此条班次信息?`, '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(() => { |
|
|
|
let inData={ |
|
|
|
id:row.id |
|
|
|
let inData = { |
|
|
|
id: row.id |
|
|
|
} |
|
|
|
deleteShift(inData).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
getShiftData().then(({data}) => { |
|
|
|
this.shiftData = data.rows; |
|
|
|
this.shiftData = data.rows |
|
|
|
}) |
|
|
|
this.$message({ |
|
|
|
message: '操作成功', |
|
|
|
@ -219,17 +218,17 @@ |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.$alert(data.msg, '错误', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
}); |
|
|
|
confirmButtonText: '确定' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.searchShift(); |
|
|
|
} |
|
|
|
created () { |
|
|
|
this.searchShift() |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
|