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
//
// 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>

View File

@ -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>