1、开启声音定时任务

2、出行调整代码完善
This commit is contained in:
1378012178@qq.com 2025-03-18 17:28:38 +08:00
parent cc2394588b
commit e34e032aeb
2 changed files with 257 additions and 225 deletions

View File

@ -602,79 +602,79 @@ export default {
// //
// - 8 60 // - 8 60
// //
// this.chatNumJjqz = setInterval(() => { this.chatNumJjqz = setInterval(() => {
// this.dataSelectJjqz() this.dataSelectJjqz()
// }, 60000) }, 60000)
// // // //
// setTimeout(() => { setTimeout(() => {
// this.chatNumSpq = setInterval(() => { this.chatNumSpq = setInterval(() => {
// this.dataSelectSpq() this.dataSelectSpq()
// }, 60000) }, 60000)
// }, 8000); }, 8000);
// // // //
// setTimeout(() => { setTimeout(() => {
// this.chatNumQy = setInterval(() => { this.chatNumQy = setInterval(() => {
// this.dataSelectPy() this.dataSelectPy()
// }, 60000) }, 60000)
// }, 16000); }, 16000);
// // // //
// setTimeout(() => { setTimeout(() => {
// this.chatNumLts = setInterval(() => { this.chatNumLts = setInterval(() => {
// this.dataSelectLts() this.dataSelectLts()
// }, 60000) }, 60000)
// }, 24000); }, 24000);
// // // //
// setTimeout(() => { setTimeout(() => {
// this.chatNumXxzx = setInterval(() => { this.chatNumXxzx = setInterval(() => {
// this.dataSelectXxzx() this.dataSelectXxzx()
// }, 60000) }, 60000)
// }, 32000); }, 32000);
// // // //
// setTimeout(() => { setTimeout(() => {
// this.chatNumXyhzc = setInterval(() => { this.chatNumXyhzc = setInterval(() => {
// this.dataSelectXyhzc() this.dataSelectXyhzc()
// }, 60000) }, 60000)
// }, 40000); }, 40000);
// // // //
// this.chatNumJl = setInterval(() => { this.chatNumJl = setInterval(() => {
// this.dataSelect() this.dataSelect()
// }, 6000) }, 6000)
// this.chatNumYh = setInterval(() => { this.chatNumYh = setInterval(() => {
// this.dataSelectYh() this.dataSelectYh()
// }, 6000) }, 6000)
// // // //
// if ((this.userId && this.ringOrderId) && (this.userId == this.ringOrderId)) { if ((this.userId && this.ringOrderId) && (this.userId == this.ringOrderId)) {
// this.chatNumJg = setInterval(() => { this.chatNumJg = setInterval(() => {
// this.dataSelectJg() this.dataSelectJg()
// }, 6000) }, 6000)
// this.chatNumCs = setInterval(() => { this.chatNumCs = setInterval(() => {
// this.dataSelectCs() this.dataSelectCs()
// }, 6000) }, 6000)
// this.chatNumXdd = setInterval(() => { this.chatNumXdd = setInterval(() => {
// this.dataSelectXdd() this.dataSelectXdd()
// }, 3000) }, 3000)
// } }
}, },
beforeDestroy() { 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.chatNumXyhzc);
// clearInterval(this.chatNum) clearInterval(this.chatNum)
// clearInterval(this.chatNumJl); clearInterval(this.chatNumJl);
// clearInterval(this.chatNumYh); clearInterval(this.chatNumYh);
// clearInterval(this.chatNumJg); clearInterval(this.chatNumJg);
// clearInterval(this.chatNumCs); clearInterval(this.chatNumCs);
// clearInterval(this.chatNumXdd); clearInterval(this.chatNumXdd);
} }
} }
</script> </script>

View File

@ -1,23 +1,45 @@
<template> <template>
<el-dialog :title="!dataForm.id ? '出行新增' : '出行修改'" :close-on-click-modal="false" :visible.sync="visible"> <el-dialog
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="140px"> :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> <el-row>
<!-- 时间选择器添加 type="time" 属性 -->
<el-col :span="12"> <el-col :span="12">
<el-form-item label="切换时间点1" prop="time1"> <el-form-item
label="切换时间点1"
prop="time1"
>
<el-time-picker <el-time-picker
v-model="dataForm.time1" v-model="dataForm.time1"
placeholder="选择时间"> placeholder="选择时间"
</el-time-picker> type="time"
></el-time-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="切换时间点2" prop="time2"> <el-form-item
label="切换时间点2"
prop="time2"
>
<el-time-picker <el-time-picker
v-model="dataForm.time2" v-model="dataForm.time2"
placeholder="选择时间"> placeholder="选择时间"
</el-time-picker> type="time"
></el-time-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 其余表单项保持不变 -->
<el-col :span="12"> <el-col :span="12">
<el-form-item label="出行方式1" prop="travelType1"> <el-form-item label="出行方式1" prop="travelType1">
<el-radio-group v-model="dataForm.travelType1"> <el-radio-group v-model="dataForm.travelType1">
@ -38,16 +60,29 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="免费公里数1" prop="travelNum1"> <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-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="免费公里数2" prop="travelNum2"> <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-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button> <el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button> <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
@ -56,7 +91,11 @@
</template> </template>
<script> <script>
let defReqRule = (message = '不能为空') => { return { required: true, message, trigger: 'blur' } }; let defReqRule = (message = '不能为空') => ({
required: true,
message,
trigger: 'blur'
});
export default { export default {
data() { data() {
@ -65,8 +104,9 @@
dataForm: { dataForm: {
id: '', id: '',
updateTime: '', updateTime: '',
time1: new Date(1970, 1, 1, 6, 0, 0), // ** null **
time2: new Date(1970, 1, 1, 18, 0, 0), time1: null,
time2: null,
pointTime1: '', pointTime1: '',
pointTime2: '', pointTime2: '',
travelType1: '', travelType1: '',
@ -75,31 +115,29 @@
travelNum2: '', travelNum2: '',
}, },
dataRule: { dataRule: {
pointTime1: [ defReqRule('请选择切换时间点1') ], // ** time1/time2**
pointTime2: [ defReqRule('请选择切换时间点2') ], time1: [defReqRule('请选择切换时间点1')],
time2: [defReqRule('请选择切换时间点2')],
travelType1: [defReqRule('请选择出行方式1')], travelType1: [defReqRule('请选择出行方式1')],
travelType2: [defReqRule('请选择出行方式2')], travelType2: [defReqRule('请选择出行方式2')],
travelNum1: [defReqRule('请输入免费公里数1')], travelNum1: [defReqRule('请输入免费公里数1')],
travelNum2: [defReqRule('请输入免费公里数2')], travelNum2: [defReqRule('请输入免费公里数2')],
}, },
index: 0 index: 0
} };
}, },
computed: { computed: {
isEdit() { isEdit() {
return !(this.dataForm || {}).id; return !!this.dataForm.id;
}, }
isDisabled() {
return !this.isEdit;
},
}, },
methods: { methods: {
init(index, id) { init(index, id) {
this.index = index this.index = index;
this.dataForm.id = id this.dataForm.id = id;
this.visible = true this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields();
if (this.dataForm.id) { if (this.dataForm.id) {
this.$http({ this.$http({
url: this.$http.adornUrl(`travelAdjust/info/${this.dataForm.id}`), url: this.$http.adornUrl(`travelAdjust/info/${this.dataForm.id}`),
@ -107,69 +145,63 @@
params: this.$http.adornParams() params: this.$http.adornParams()
}).then(({ data }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataForm = data.data // **使 ISO **
this.dataForm.time1 = new Date("1970-01-01 "+this.dataForm.pointTime1); this.dataForm.time1 = new Date(`1970-01-01T${data.data.pointTime1}`);
this.dataForm.time2 = new Date("1970-01-01 "+this.dataForm.pointTime2); this.dataForm.time2 = new Date(`1970-01-01T${data.data.pointTime2}`);
} }
}) });
} else { } else {
// // ****
Object.keys(this.dataForm).forEach(x => { this.dataForm.time1 = null;
this.dataForm[x] = ''; this.dataForm.time2 = null;
})
} }
}) });
}, },
padZero(num) { padZero(num) {
return num > 9 ? num : `0${num}`; return num > 9 ? num : `0${num}`;
}, },
formateTime(timeStr) { formatTime(time) { // ****
const date = new Date(timeStr); if (!time) return '';
const hour = this.padZero(date.getHours()); const date = new Date(time);
const min = this.padZero(date.getMinutes()); return `${this.padZero(date.getHours())}:${this.padZero(date.getMinutes())}:${this.padZero(date.getSeconds())}`;
const second = this.padZero(date.getSeconds());
return `${hour}:${min}:${second}`;
}, },
//
dataFormSubmit() { dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate(valid => {
if (valid) { if (valid) {
let saveData = Object.assign({}, this.dataForm); const saveData = { ...this.dataForm };
this.dataForm.pointTime1 = this.formateTime(this.dataForm.time1); // ****
this.dataForm.pointTime2 = this.formateTime(this.dataForm.time2); saveData.pointTime1 = this.formatTime(saveData.time1);
saveData.pointTime2 = this.formatTime(saveData.time2);
this.$http({ this.$http({
url: this.$http.adornUrl(`travelAdjust/${!saveData.id ? 'add' : 'update'}`), url: this.$http.adornUrl(`${!saveData.id ? 'travelAdjust/add' : 'travelAdjust/update'}`),
method: 'post', method: 'post',
data: this.$http.adornData({ data: this.$http.adornData({
...saveData, ...saveData,
'id': saveData.id || undefined, id: saveData.id || undefined
}) })
}).then(({ }).then(({ data }) => {
data
}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message({ this.$message({
message: '操作成功', message: '操作成功',
type: 'success', type: 'success',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.visible = false this.visible = false;
console.log('this.index', this.index) if (this.index === 1) {
if (this.index == 1) { this.$emit('refreshDataList');
this.$emit('refreshDataList')
} else { } else {
this.$emit('refreshDataLister') this.$emit('refreshDataLister');
} }
} }
}) });
} else { } else {
this.$message.error(data.msg) this.$message.error(data.msg);
} }
}) });
}
})
} }
});
} }
} }
};
</script> </script>