Commit ec6f9f5d by yangzhi

fix:预计完成时间

parent b81f421e
......@@ -527,11 +527,11 @@
width='500px'
:close-on-click-modal='false'
>
<el-form size='mini'>
<el-form-item label='预计完成时间'>
<el-form size='mini' :rules='addRules' :model='ruleForm' ref='ruleForm'>
<el-form-item label='预计完成时间' prop='estimateCompleteTime'>
<el-date-picker
style='width: 100%'
v-model='estimateCompleteTime'
v-model='ruleForm.estimateCompleteTime'
value-format='yyyy-MM-dd HH:mm:ss'
type='datetime'
default-time='23:59:59'
......@@ -725,10 +725,28 @@ export default {
},
data() {
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 {
addRules: {
estimateCompleteTime: [
{
validator: validatePass2,
trigger: 'blur',
},
],
},
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now()
return time.getTime() < Date.now() - 8.64e7
},
},
assignFormRules: {
......@@ -808,7 +826,9 @@ export default {
cloneForm: {},
editDialog: false,
completeVisible: false,
estimateCompleteTime: '',
ruleForm: {
estimateCompleteTime: '',
},
currentItem: null,
acceptVisible: false,
acceptFormRules: {
......@@ -1342,7 +1362,7 @@ export default {
},
// 开始工单
async startWorkOrder(item) {
this.estimateCompleteTime = ''
this.ruleForm.estimateCompleteTime = ''
this.completeVisible = true
this.rowId = item.id
this.currentItem = item
......@@ -1576,22 +1596,20 @@ export default {
}
},
async submitTime() {
if (!this.estimateCompleteTime) {
return this.$message.warning('请选择预计完成时间')
}
try {
const res = await startWorder(
this.rowId,
this.estimateCompleteTime,
)
if (res.code === 200) {
this.getlist()
this.getOrderTree()
this.completeVisible = false
this.$refs.ruleForm.validate((valid) => {
if (valid) {
startWorder(
this.rowId,
this.ruleForm.estimateCompleteTime,
).then(res => {
if (res.code === 200) {
this.getlist()
this.getOrderTree()
this.completeVisible = false
}
})
}
} catch (e) {
console.error(e)
}
})
},
async reply() {
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