diff --git a/back/src/views/modules/myAgent/ConferenceRoom.vue b/back/src/views/modules/myAgent/ConferenceRoom.vue index 547c02ea..6233aaf1 100644 --- a/back/src/views/modules/myAgent/ConferenceRoom.vue +++ b/back/src/views/modules/myAgent/ConferenceRoom.vue @@ -65,6 +65,8 @@ - + @@ -144,7 +149,7 @@ >
- 支持图片类型,且不超过500kb + 支持图片jpg、jpeg、png类型,只能上传一张图片且不超过100MB
@@ -156,6 +161,7 @@ :on-preview="handlePictureCardPreview" :on-success="onSuccess" :on-remove="onRemove" + :on-exceed="beforeUpload" :file-list="fileList" list-type="picture-card" :limit="1" @@ -240,13 +246,19 @@ export default { ], area: [ { required: true, message: '请输入会议室面积', trigger: 'blur' }, - { min: 1, trigger: 'blur' }, + { min: 1, type: 'number', trigger: 'blur' }, ], description: [ { required: true, message: '请填写描述内容', trigger: 'blur' }, + { + min: 1, + max: 500, + message: '长度在 1 到 500 个字符', + trigger: 'blur', + }, ], }, - formLabelWidth: '100px', + formLabelWidth: '120px', checkImgSuccess: true, dialogVisible: false, flge: '', @@ -285,11 +297,21 @@ export default { this.dialogImageUrl = file.url this.dialogVisible = true }, + //上传个数限制 + beforeUpload(file, fileList) { + this.$message.error('最多只能上传一张图片!') + }, //图片上传成功时钩子 onSuccess(response, file, fileList) { - this.ruleForm.pic = response.data - // this.$refs.ruleForm.clearValidate() //上传成功清除校验 - this.checkImgSuccess = true + const isLt2M = file.size / 1024 / 1024 < 100 + if (!isLt2M) { + this.$message.error('上传图片大小不能超过100MB!') + this.fileList = [] + } else { + this.ruleForm.pic = response.data + // this.$refs.ruleForm.clearValidate() //上传成功清除校验 + this.checkImgSuccess = true + } }, //图片删除时钩子 onRemove(file, fileList) { @@ -302,13 +324,16 @@ export default { }, // 保存 submitForm(formName, i) { - console.log(i, 9999999) this.$refs[formName].validate((valid) => { if (valid) { if (i === 'add') { this.dialogFormVisible = false this.$http.post('/meeting', this.ruleForm).then(({ data: res }) => { - this.queryData() + if (res.msg === 'success') { + this.queryData() + } else { + this.$message.error('保存接口调用失败') + } }) } else if (i === 'edit') { this.dialogFormVisible = false @@ -356,11 +381,25 @@ export default { }, //删除图片 taskDelete(row) { - console.log(row, '点击了删除') - this.$http - .put(`/meeting`, { delFlag: 1, id: row.id }) - .then(({ data: res }) => { - this.queryData() + this.$confirm('此操作将永久删除该会议室, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then(() => { + this.$http.put(`/meeting`, { delFlag: 1, id: row.id }).then(() => { + this.queryData() + this.$message({ + type: 'success', + message: '删除成功!', + }) + }) + }) + .catch(() => { + this.$message({ + type: 'info', + message: '已取消删除', + }) }) }, //监听关闭按钮时间 @@ -378,4 +417,8 @@ export default { ::v-deep .el-dialog__footer { text-align: center; } +::v-deep .el-image { + width: 100%; + height: 100%; +} diff --git a/front/src/main.js b/front/src/main.js index 7b3ccf72..eaa47128 100644 --- a/front/src/main.js +++ b/front/src/main.js @@ -5,7 +5,9 @@ * @LastEditTime: 2022-08-06 15:00:49 * @Description: 告诉大家这是什么 */ -import { createApp } from 'vue' +import { + createApp +} from 'vue' import Antd from 'ant-design-vue' import mitt from 'mitt' import App from './App' @@ -15,7 +17,8 @@ import store from './store' import 'ant-design-vue/dist/antd.css' import '@/vab' import * as echarts from 'echarts' -import * as moment from 'moment' +import * as moment from "moment" +import "dayjs/locale/zh-cn"; import vue3videoPlay from 'vue3-video-play-emiyagm' // 引入组件 import 'vue3-video-play-emiyagm/dist/style.css' // 引入css import ElementPlus from 'element-plus' diff --git a/front/src/views/home/infrastructurePage.vue b/front/src/views/home/infrastructurePage.vue index a2d7392e..1fcdb901 100644 --- a/front/src/views/home/infrastructurePage.vue +++ b/front/src/views/home/infrastructurePage.vue @@ -78,11 +78,17 @@ v-model:value="roomCreateTime" placeholder="开始时间" value-format="HH:mm:ss" + :disabledHours="disabledStartHours" + :disabledMinutes="disabledStartMinutes" + :disabledSeconds="disabledStartSeconds" /> @@ -102,8 +108,8 @@
{{ item.name }}
房间号:{{ item.num }} - 可容纳人数:{{ item.capacity }} - 面积:{{ item.area }} + 可容纳人数:{{ item.capacity }}人 + 面积:{{ item.area }}m²
{{ item.description }} @@ -291,6 +297,9 @@ v-model:value="formState.startTime" placeholder="开始时间" value-format="HH:mm:ss" + :disabledHours="disabledTimeHours" + :disabledMinutes="disabledTimeMinutes" + :disabledSeconds="disabledTimeSeconds" /> @@ -299,6 +308,9 @@ v-model:value="formState.endTime" placeholder="结束时间" value-format="HH:mm:ss" + :disabledHours="disabledTimeEndHours" + :disabledMinutes="disabledTimeEndMinutes" + :disabledSeconds="disabledTimeEndSeconds" /> @@ -641,6 +653,7 @@ import mybus from '@/myplugins/mybus' import dayjs from 'dayjs' import { Form } from 'ant-design-vue' + import moment from 'moment' const props = defineProps({ // 模糊查 searchValue: { type: String, default: '' }, @@ -739,12 +752,7 @@ message: '请输入预约人', }, ], - matter: [ - { - required: true, - message: '请输入内容', - }, - ], + matter: [{ min: 1, max: 500, required: true, message: '可输入500字内容' }], phone: [ { required: true, @@ -949,6 +957,168 @@ searchData() chengguoSearch() } + // 时间选择器限制----可用时间查询 + //获取不可选择的小时 + const disabledStartHours = () => { + if (roomEndTime.value) { + let hours = [] + let hour = moment().hour() + for (let i = hour + 1; i < 24; i++) { + hours.push(i) + } + return hours + } + } + //获取不可选择的分钟 + const disabledStartMinutes = (selectedHour) => { + if (roomEndTime) { + let minutes = [] + let hour = moment().hour() + let minute = moment().minute() + if (selectedHour === hour) { + for (let i = minute + 1; i < 60; i++) { + minutes.push(i) + } + } + return minutes + } + } + //获取不可选择的秒 + const disabledStartSeconds = (selectedHour, selectedMinute) => { + if (roomEndTime) { + let seconds = [] + let hour = moment().hour() + let minute = moment().minute() + let second = moment().second() + if (selectedHour === hour && selectedMinute.value === minute) { + for (let i = second + 1; i < 60; i++) { + seconds.push(i) + } + } + return seconds + } + } + //获取不可选择的小时 + const disabledEndHours = () => { + if (roomCreateTime.value) { + let hours = [] + let hour = moment().hour() + for (let i = 0; i < hour; i++) { + hours.push(i) + } + return hours + } + } + //获取不可选择的分钟 + const disabledEndMinutes = (selectedHour) => { + if (roomCreateTime) { + let minutes = [] + let hour = moment().hour() + let minute = moment().minute() + if (selectedHour === hour) { + for (let i = 0; i < minute; i++) { + minutes.push(i) + } + } + return minutes + } + } + //获取不可选择的秒 + const disabledEndSeconds = (selectedHour, selectedMinute) => { + if (roomCreateTime) { + let seconds = [] + let hour = moment().hour() + let minute = moment().minute() + let second = moment().second() + if (selectedHour === hour && selectedMinute.value === minute) { + for (let i = 0; i < second; i++) { + seconds.push(i) + } + } + return seconds + } + } + // 时间选择器限制----会议室预约时段 + //获取不可选择的小时 + const disabledTimeHours = () => { + if (formState.endTime) { + let hours = [] + let hour = moment().hour() + for (let i = hour + 1; i < 24; i++) { + hours.push(i) + } + return hours + } + } + //获取不可选择的分钟 + const disabledTimeMinutes = (selectedHour) => { + if (formState.endTime) { + let minutes = [] + let hour = moment().hour() + let minute = moment().minute() + if (selectedHour === hour) { + for (let i = minute + 1; i < 60; i++) { + minutes.push(i) + } + } + return minutes + } + } + //获取不可选择的秒 + const disabledTimeSeconds = (selectedHour, selectedMinute) => { + if (formState.endTime) { + let seconds = [] + let hour = moment().hour() + let minute = moment().minute() + let second = moment().second() + if (selectedHour === hour && selectedMinute.value === minute) { + for (let i = second + 1; i < 60; i++) { + seconds.push(i) + } + } + return seconds + } + } + //获取不可选择的小时 + const disabledTimeEndHours = () => { + if (formState.startTime) { + let hours = [] + let hour = moment().hour() + for (let i = 0; i < hour; i++) { + hours.push(i) + } + return hours + } + } + //获取不可选择的分钟 + const disabledTimeEndMinutes = (selectedHour) => { + if (formState.startTime) { + let minutes = [] + let hour = moment().hour() + let minute = moment().minute() + if (selectedHour === hour) { + for (let i = 0; i < minute; i++) { + minutes.push(i) + } + } + return minutes + } + } + //获取不可选择的秒 + const disabledTimeEndSeconds = (selectedHour, selectedMinute) => { + if (formState.startTime) { + let seconds = [] + let hour = moment().hour() + let minute = moment().minute() + let second = moment().second() + if (selectedHour === hour && selectedMinute.value === minute) { + for (let i = 0; i < second; i++) { + seconds.push(i) + } + } + return seconds + } + } //分页 const onRoomChange = (pageNumber) => { roomPage.value = pageNumber