3 changed files with 352 additions and 258 deletions
-
311src/views/modules/production/dailyPlan.vue
-
33src/views/modules/production/dailyPlanCirculation.vue
-
238src/views/modules/sys/shiftData.vue
@ -0,0 +1,238 @@ |
|||||
|
<template> |
||||
|
<div class="mod-config"> |
||||
|
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -5px;"> |
||||
|
<el-button type="primary" @click="searchShift()">查询</el-button> |
||||
|
<el-button type="primary" @click="newShift()">新增班次</el-button> |
||||
|
</el-form> |
||||
|
<el-table |
||||
|
:height="height" |
||||
|
:data="shiftData" |
||||
|
border |
||||
|
style="width: 100%"> |
||||
|
<el-table-column |
||||
|
prop="shiftno" |
||||
|
header-align="center" |
||||
|
align="left" |
||||
|
label="班次编码"> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
prop="shiftdesc" |
||||
|
header-align="center" |
||||
|
align="left" |
||||
|
label="班次名称"> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
prop="startexacttime" |
||||
|
header-align="center" |
||||
|
align="left" |
||||
|
label="上班时间"> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
prop="endexacttime" |
||||
|
header-align="center" |
||||
|
align="left" |
||||
|
label="下班时间"> |
||||
|
</el-table-column> |
||||
|
<el-table-column |
||||
|
prop="" |
||||
|
header-align="center" |
||||
|
align="center" |
||||
|
label="操作"> |
||||
|
<template slot-scope="scope"> |
||||
|
<a type="text" size="small" @click="editShift(scope.row)">编辑</a> |
||||
|
<a type="text" size="small" @click="deleteShift(scope.row)">删除</a> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<el-dialog title="维护班次" :close-on-click-modal="false" v-drag :visible.sync="newShiftFlag" width="341px" > |
||||
|
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> |
||||
|
<el-form-item :label="'班次编码:'"> |
||||
|
<el-input v-model="newShiftData.shiftno" :disabled="newShiftFlag1" style="width: 130px"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item :label="'班次名称:'"> |
||||
|
<el-input v-model="newShiftData.shiftdesc" style="width: 130px"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item :label="'上班时间:'"> |
||||
|
<el-time-picker |
||||
|
format="HH:mm" |
||||
|
arrow-control |
||||
|
style="width: 130px" |
||||
|
v-model="newShiftData.startexacttime" |
||||
|
placeholder="请选择" |
||||
|
value-format="HH:mm"> |
||||
|
</el-time-picker> |
||||
|
</el-form-item> |
||||
|
<el-form-item :label="'下班时间:'" > |
||||
|
<el-time-picker |
||||
|
arrow-control |
||||
|
format="HH:mm" |
||||
|
style="width: 130px" |
||||
|
v-model="newShiftData.endexacttime" |
||||
|
placeholder="请选择" |
||||
|
value-format="HH:mm"> |
||||
|
</el-time-picker> |
||||
|
</el-form-item> |
||||
|
</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-footer> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
<script> |
||||
|
import { |
||||
|
getShiftData, |
||||
|
saveNewShift, |
||||
|
deleteShift |
||||
|
} 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, |
||||
|
}, |
||||
|
} |
||||
|
}, |
||||
|
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; |
||||
|
}, |
||||
|
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; |
||||
|
} |
||||
|
if (this.newShiftData.shiftdesc == "" || null == this.newShiftData.shiftdesc) { |
||||
|
this.$alert("请输入班次名称!", '错误', { |
||||
|
confirmButtonText: '确定', |
||||
|
}); |
||||
|
return false; |
||||
|
} |
||||
|
if (this.newShiftData.startexacttime == "") { |
||||
|
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'; |
||||
|
saveNewShift(list).then(({data}) => { |
||||
|
this.newShiftData.startexacttime=time1; |
||||
|
this.newShiftData.endexacttime=time2; |
||||
|
if (data && data.code === 0) { |
||||
|
this.newShiftFlag=false; |
||||
|
getShiftData().then(({data}) => { |
||||
|
this.shiftData = data.rows; |
||||
|
}) |
||||
|
this.$message({ |
||||
|
message: '操作成功', |
||||
|
type: 'success', |
||||
|
duration: 1500, |
||||
|
onClose: () => { |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
this.$alert(data.msg, '错误', { |
||||
|
confirmButtonText: '确定', |
||||
|
}); |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
searchShift(){ |
||||
|
getShiftData().then(({data}) => { |
||||
|
this.shiftData = data.rows; |
||||
|
}) |
||||
|
}, |
||||
|
deleteShift(row){ |
||||
|
|
||||
|
this.$confirm(`是否删除此条班次信息?`, '提示', { |
||||
|
confirmButtonText: '确定', |
||||
|
cancelButtonText: '取消', |
||||
|
type: 'warning' |
||||
|
}).then(() => { |
||||
|
let inData={ |
||||
|
id:row.id |
||||
|
} |
||||
|
deleteShift(inData).then(({data}) => { |
||||
|
if (data && data.code === 0) { |
||||
|
getShiftData().then(({data}) => { |
||||
|
this.shiftData = data.rows; |
||||
|
}) |
||||
|
this.$message({ |
||||
|
message: '操作成功', |
||||
|
type: 'success', |
||||
|
duration: 1500, |
||||
|
|
||||
|
onClose: () => { |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
this.$alert(data.msg, '错误', { |
||||
|
confirmButtonText: '确定', |
||||
|
}); |
||||
|
} |
||||
|
}) |
||||
|
}).catch(() => { |
||||
|
}) |
||||
|
}, |
||||
|
}, |
||||
|
created() { |
||||
|
this.searchShift(); |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
|
||||
|
</style> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue