parent
cc2394588b
commit
e34e032aeb
|
@ -602,79 +602,79 @@ export default {
|
|||
//生产需替换
|
||||
//互动管理菜单 - 每8秒检查一个功能下是否有未处理信息 单个重复检测时间为60秒
|
||||
//紧急求助
|
||||
// this.chatNumJjqz = setInterval(() => {
|
||||
// this.dataSelectJjqz()
|
||||
// }, 60000)
|
||||
this.chatNumJjqz = setInterval(() => {
|
||||
this.dataSelectJjqz()
|
||||
}, 60000)
|
||||
// //视频圈
|
||||
// setTimeout(() => {
|
||||
// this.chatNumSpq = setInterval(() => {
|
||||
// this.dataSelectSpq()
|
||||
// }, 60000)
|
||||
// }, 8000);
|
||||
setTimeout(() => {
|
||||
this.chatNumSpq = setInterval(() => {
|
||||
this.dataSelectSpq()
|
||||
}, 60000)
|
||||
}, 8000);
|
||||
// //投诉中心
|
||||
// setTimeout(() => {
|
||||
// this.chatNumQy = setInterval(() => {
|
||||
// this.dataSelectPy()
|
||||
// }, 60000)
|
||||
// }, 16000);
|
||||
setTimeout(() => {
|
||||
this.chatNumQy = setInterval(() => {
|
||||
this.dataSelectPy()
|
||||
}, 60000)
|
||||
}, 16000);
|
||||
// //聊天室
|
||||
// setTimeout(() => {
|
||||
// this.chatNumLts = setInterval(() => {
|
||||
// this.dataSelectLts()
|
||||
// }, 60000)
|
||||
// }, 24000);
|
||||
setTimeout(() => {
|
||||
this.chatNumLts = setInterval(() => {
|
||||
this.dataSelectLts()
|
||||
}, 60000)
|
||||
}, 24000);
|
||||
// //消息中心
|
||||
// setTimeout(() => {
|
||||
// this.chatNumXxzx = setInterval(() => {
|
||||
// this.dataSelectXxzx()
|
||||
// }, 60000)
|
||||
// }, 32000);
|
||||
setTimeout(() => {
|
||||
this.chatNumXxzx = setInterval(() => {
|
||||
this.dataSelectXxzx()
|
||||
}, 60000)
|
||||
}, 32000);
|
||||
// // 新用户注册
|
||||
// setTimeout(() => {
|
||||
// this.chatNumXyhzc = setInterval(() => {
|
||||
// this.dataSelectXyhzc()
|
||||
// }, 60000)
|
||||
// }, 40000);
|
||||
setTimeout(() => {
|
||||
this.chatNumXyhzc = setInterval(() => {
|
||||
this.dataSelectXyhzc()
|
||||
}, 60000)
|
||||
}, 40000);
|
||||
// //实名认证
|
||||
// this.chatNumJl = setInterval(() => {
|
||||
// this.dataSelect()
|
||||
// }, 6000)
|
||||
// this.chatNumYh = setInterval(() => {
|
||||
// this.dataSelectYh()
|
||||
// }, 6000)
|
||||
this.chatNumJl = setInterval(() => {
|
||||
this.dataSelect()
|
||||
}, 6000)
|
||||
this.chatNumYh = setInterval(() => {
|
||||
this.dataSelectYh()
|
||||
}, 6000)
|
||||
// // 目前的逻辑是只有客服账号才有订单相关(新订单、警告订单、超时订单)的提示
|
||||
// if ((this.userId && this.ringOrderId) && (this.userId == this.ringOrderId)) {
|
||||
// this.chatNumJg = setInterval(() => {
|
||||
// this.dataSelectJg()
|
||||
// }, 6000)
|
||||
// this.chatNumCs = setInterval(() => {
|
||||
// this.dataSelectCs()
|
||||
// }, 6000)
|
||||
// this.chatNumXdd = setInterval(() => {
|
||||
// this.dataSelectXdd()
|
||||
// }, 3000)
|
||||
// }
|
||||
if ((this.userId && this.ringOrderId) && (this.userId == this.ringOrderId)) {
|
||||
this.chatNumJg = setInterval(() => {
|
||||
this.dataSelectJg()
|
||||
}, 6000)
|
||||
this.chatNumCs = setInterval(() => {
|
||||
this.dataSelectCs()
|
||||
}, 6000)
|
||||
this.chatNumXdd = setInterval(() => {
|
||||
this.dataSelectXdd()
|
||||
}, 3000)
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
//生产需替换
|
||||
//紧急求助定时任务
|
||||
// clearInterval(this.chatNumJjqz);
|
||||
clearInterval(this.chatNumJjqz);
|
||||
// //视频圈定时任务
|
||||
// clearInterval(this.chatNumSpq);
|
||||
clearInterval(this.chatNumSpq);
|
||||
// //投诉中心定时任务
|
||||
// clearInterval(this.chatNumQy);
|
||||
clearInterval(this.chatNumQy);
|
||||
// //聊天室定时任务
|
||||
// clearInterval(this.chatNumLts);
|
||||
clearInterval(this.chatNumLts);
|
||||
// //消息中心定时任务
|
||||
// clearInterval(this.chatNumXxzx);
|
||||
clearInterval(this.chatNumXxzx);
|
||||
// //新用户注册定时任务
|
||||
// clearInterval(this.chatNumXyhzc);
|
||||
// clearInterval(this.chatNum)
|
||||
// clearInterval(this.chatNumJl);
|
||||
// clearInterval(this.chatNumYh);
|
||||
// clearInterval(this.chatNumJg);
|
||||
// clearInterval(this.chatNumCs);
|
||||
// clearInterval(this.chatNumXdd);
|
||||
clearInterval(this.chatNumXyhzc);
|
||||
clearInterval(this.chatNum)
|
||||
clearInterval(this.chatNumJl);
|
||||
clearInterval(this.chatNumYh);
|
||||
clearInterval(this.chatNumJg);
|
||||
clearInterval(this.chatNumCs);
|
||||
clearInterval(this.chatNumXdd);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,23 +1,45 @@
|
|||
<template>
|
||||
<el-dialog :title="!dataForm.id ? '出行新增' : '出行修改'" :close-on-click-modal="false" :visible.sync="visible">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="140px">
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? '出行新增' : '出行修改'"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible"
|
||||
>
|
||||
<el-form
|
||||
:model="dataForm"
|
||||
:rules="dataRule"
|
||||
ref="dataForm"
|
||||
@keyup.enter.native="dataFormSubmit()"
|
||||
label-width="140px"
|
||||
>
|
||||
<el-row>
|
||||
<!-- 时间选择器添加 type="time" 属性 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="切换时间点1" prop="time1">
|
||||
<el-form-item
|
||||
label="切换时间点1"
|
||||
prop="time1"
|
||||
>
|
||||
<el-time-picker
|
||||
v-model="dataForm.time1"
|
||||
placeholder="选择时间">
|
||||
</el-time-picker>
|
||||
placeholder="选择时间"
|
||||
type="time"
|
||||
></el-time-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="切换时间点2" prop="time2">
|
||||
<el-form-item
|
||||
label="切换时间点2"
|
||||
prop="time2"
|
||||
>
|
||||
<el-time-picker
|
||||
v-model="dataForm.time2"
|
||||
placeholder="选择时间">
|
||||
</el-time-picker>
|
||||
placeholder="选择时间"
|
||||
type="time"
|
||||
></el-time-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 其余表单项保持不变 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="出行方式1" prop="travelType1">
|
||||
<el-radio-group v-model="dataForm.travelType1">
|
||||
|
@ -38,25 +60,42 @@
|
|||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="免费公里数1" prop="travelNum1">
|
||||
<el-input-number v-model="dataForm.travelNum1" controls-position="right" :precision="2" :min="0" :step="1"/>
|
||||
<el-input-number
|
||||
v-model="dataForm.travelNum1"
|
||||
controls-position="right"
|
||||
:precision="2"
|
||||
:min="0"
|
||||
:step="1"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="免费公里数2" prop="travelNum2">
|
||||
<el-input-number v-model="dataForm.travelNum2" controls-position="right" :precision="2" :min="0" :step="1"/>
|
||||
<el-input-number
|
||||
v-model="dataForm.travelNum2"
|
||||
controls-position="right"
|
||||
:precision="2"
|
||||
:min="0"
|
||||
:step="1"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let defReqRule = (message = '不能为空') => { return { required: true, message, trigger: 'blur' } };
|
||||
<script>
|
||||
let defReqRule = (message = '不能为空') => ({
|
||||
required: true,
|
||||
message,
|
||||
trigger: 'blur'
|
||||
});
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
@ -65,8 +104,9 @@
|
|||
dataForm: {
|
||||
id: '',
|
||||
updateTime: '',
|
||||
time1: new Date(1970, 1, 1, 6, 0, 0),
|
||||
time2: new Date(1970, 1, 1, 18, 0, 0),
|
||||
// **初始化为 null 而非默认日期**
|
||||
time1: null,
|
||||
time2: null,
|
||||
pointTime1: '',
|
||||
pointTime2: '',
|
||||
travelType1: '',
|
||||
|
@ -75,31 +115,29 @@
|
|||
travelNum2: '',
|
||||
},
|
||||
dataRule: {
|
||||
pointTime1: [ defReqRule('请选择切换时间点1') ],
|
||||
pointTime2: [ defReqRule('请选择切换时间点2') ],
|
||||
travelType1: [ defReqRule('请选择出行方式1') ],
|
||||
travelType2: [ defReqRule('请选择出行方式2') ],
|
||||
travelNum1: [ defReqRule('请输入免费公里数1') ],
|
||||
travelNum2: [ defReqRule('请输入免费公里数2') ],
|
||||
// **校验字段同步为 time1/time2**
|
||||
time1: [defReqRule('请选择切换时间点1')],
|
||||
time2: [defReqRule('请选择切换时间点2')],
|
||||
travelType1: [defReqRule('请选择出行方式1')],
|
||||
travelType2: [defReqRule('请选择出行方式2')],
|
||||
travelNum1: [defReqRule('请输入免费公里数1')],
|
||||
travelNum2: [defReqRule('请输入免费公里数2')],
|
||||
},
|
||||
index: 0
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isEdit() {
|
||||
return !(this.dataForm || {}).id;
|
||||
},
|
||||
isDisabled() {
|
||||
return !this.isEdit;
|
||||
},
|
||||
return !!this.dataForm.id;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(index, id) {
|
||||
this.index = index
|
||||
this.dataForm.id = id
|
||||
this.visible = true
|
||||
this.index = index;
|
||||
this.dataForm.id = id;
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.$refs['dataForm'].resetFields();
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`travelAdjust/info/${this.dataForm.id}`),
|
||||
|
@ -107,69 +145,63 @@
|
|||
params: this.$http.adornParams()
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm = data.data
|
||||
this.dataForm.time1 = new Date("1970-01-01 "+this.dataForm.pointTime1);
|
||||
this.dataForm.time2 = new Date("1970-01-01 "+this.dataForm.pointTime2);
|
||||
// **使用 ISO 格式转换时间**
|
||||
this.dataForm.time1 = new Date(`1970-01-01T${data.data.pointTime1}`);
|
||||
this.dataForm.time2 = new Date(`1970-01-01T${data.data.pointTime2}`);
|
||||
}
|
||||
})
|
||||
});
|
||||
} else {
|
||||
//重置表单
|
||||
Object.keys(this.dataForm).forEach(x => {
|
||||
this.dataForm[x] = '';
|
||||
})
|
||||
// **显式重置时间字段**
|
||||
this.dataForm.time1 = null;
|
||||
this.dataForm.time2 = null;
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
padZero(num) {
|
||||
return num > 9 ? num : `0${num}`;
|
||||
},
|
||||
formateTime(timeStr) {
|
||||
const date = new Date(timeStr);
|
||||
const hour = this.padZero(date.getHours());
|
||||
const min = this.padZero(date.getMinutes());
|
||||
const second = this.padZero(date.getSeconds());
|
||||
return `${hour}:${min}:${second}`;
|
||||
formatTime(time) { // **时间格式转换方法**
|
||||
if (!time) return '';
|
||||
const date = new Date(time);
|
||||
return `${this.padZero(date.getHours())}:${this.padZero(date.getMinutes())}:${this.padZero(date.getSeconds())}`;
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
let saveData = Object.assign({}, this.dataForm);
|
||||
this.dataForm.pointTime1 = this.formateTime(this.dataForm.time1);
|
||||
this.dataForm.pointTime2 = this.formateTime(this.dataForm.time2);
|
||||
const saveData = { ...this.dataForm };
|
||||
// **转换时间为字符串格式**
|
||||
saveData.pointTime1 = this.formatTime(saveData.time1);
|
||||
saveData.pointTime2 = this.formatTime(saveData.time2);
|
||||
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`travelAdjust/${!saveData.id ? 'add' : 'update'}`),
|
||||
url: this.$http.adornUrl(`${!saveData.id ? 'travelAdjust/add' : 'travelAdjust/update'}`),
|
||||
method: 'post',
|
||||
data: this.$http.adornData({
|
||||
...saveData,
|
||||
'id': saveData.id || undefined,
|
||||
id: saveData.id || undefined
|
||||
})
|
||||
}).then(({
|
||||
data
|
||||
}) => {
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
console.log('this.index', this.index)
|
||||
if (this.index == 1) {
|
||||
this.$emit('refreshDataList')
|
||||
this.visible = false;
|
||||
if (this.index === 1) {
|
||||
this.$emit('refreshDataList');
|
||||
} else {
|
||||
this.$emit('refreshDataLister')
|
||||
this.$emit('refreshDataLister');
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue