Commit ec6f9f5d by yangzhi

fix:预计完成时间

parent b81f421e
...@@ -527,11 +527,11 @@ ...@@ -527,11 +527,11 @@
width='500px' width='500px'
:close-on-click-modal='false' :close-on-click-modal='false'
> >
<el-form size='mini'> <el-form size='mini' :rules='addRules' :model='ruleForm' ref='ruleForm'>
<el-form-item label='预计完成时间'> <el-form-item label='预计完成时间' prop='estimateCompleteTime'>
<el-date-picker <el-date-picker
style='width: 100%' style='width: 100%'
v-model='estimateCompleteTime' v-model='ruleForm.estimateCompleteTime'
value-format='yyyy-MM-dd HH:mm:ss' value-format='yyyy-MM-dd HH:mm:ss'
type='datetime' type='datetime'
default-time='23:59:59' default-time='23:59:59'
...@@ -725,10 +725,28 @@ export default { ...@@ -725,10 +725,28 @@ export default {
}, },
data() { data() {
const userInfo = localStorage.getItem('user') const userInfo = localStorage.getItem('user')
var validatePass2 = (rule, value, callback) => {
const start = new Date(value)
if (!value) {
callback(new Error('请选择预计完成时间'))
} else if (start < Date.now()) {
callback(new Error('预计完成时间要大于当前时间!'))
} else {
callback()
}
}
return { return {
addRules: {
estimateCompleteTime: [
{
validator: validatePass2,
trigger: 'blur',
},
],
},
pickerOptions: { pickerOptions: {
disabledDate(time) { disabledDate(time) {
return time.getTime() < Date.now() return time.getTime() < Date.now() - 8.64e7
}, },
}, },
assignFormRules: { assignFormRules: {
...@@ -808,7 +826,9 @@ export default { ...@@ -808,7 +826,9 @@ export default {
cloneForm: {}, cloneForm: {},
editDialog: false, editDialog: false,
completeVisible: false, completeVisible: false,
estimateCompleteTime: '', ruleForm: {
estimateCompleteTime: '',
},
currentItem: null, currentItem: null,
acceptVisible: false, acceptVisible: false,
acceptFormRules: { acceptFormRules: {
...@@ -1342,7 +1362,7 @@ export default { ...@@ -1342,7 +1362,7 @@ export default {
}, },
// 开始工单 // 开始工单
async startWorkOrder(item) { async startWorkOrder(item) {
this.estimateCompleteTime = '' this.ruleForm.estimateCompleteTime = ''
this.completeVisible = true this.completeVisible = true
this.rowId = item.id this.rowId = item.id
this.currentItem = item this.currentItem = item
...@@ -1576,22 +1596,20 @@ export default { ...@@ -1576,22 +1596,20 @@ export default {
} }
}, },
async submitTime() { async submitTime() {
if (!this.estimateCompleteTime) { this.$refs.ruleForm.validate((valid) => {
return this.$message.warning('请选择预计完成时间') if (valid) {
} startWorder(
try { this.rowId,
const res = await startWorder( this.ruleForm.estimateCompleteTime,
this.rowId, ).then(res => {
this.estimateCompleteTime, if (res.code === 200) {
) this.getlist()
if (res.code === 200) { this.getOrderTree()
this.getlist() this.completeVisible = false
this.getOrderTree() }
this.completeVisible = false })
} }
} catch (e) { })
console.error(e)
}
}, },
async reply() { async reply() {
if (!this.textarea) { if (!this.textarea) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment