|
|
|
|
@ -154,27 +154,41 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<!-- <template v-slot:door>
|
|
|
|
|
<div class="xy-table-item">
|
|
|
|
|
<template v-if="isSystemAdmin" v-slot:door>
|
|
|
|
|
<div class="xy-table-item technical-field">
|
|
|
|
|
<div class="xy-table-item-label" style="font-weight: bold;">
|
|
|
|
|
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>第三方门禁信息(技术填写):
|
|
|
|
|
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>门禁信息(door):
|
|
|
|
|
</div>
|
|
|
|
|
<div class="xy-table-item-content">
|
|
|
|
|
<div>{{form.door}}</div>
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="form.door"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:rows="8"
|
|
|
|
|
placeholder="请输入达实门禁 JSON,例如包含 doorName 字段"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 100%;">
|
|
|
|
|
</el-input>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:room>
|
|
|
|
|
<div class="xy-table-item">
|
|
|
|
|
<template v-if="isSystemAdmin" v-slot:room>
|
|
|
|
|
<div class="xy-table-item technical-field">
|
|
|
|
|
<div class="xy-table-item-label" style="font-weight: bold;">
|
|
|
|
|
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>第三方会议室信息(技术人员填写):
|
|
|
|
|
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>会议室信息(room):
|
|
|
|
|
</div>
|
|
|
|
|
<div class="xy-table-item-content">
|
|
|
|
|
<div>{{form.room}}</div>
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="form.room"
|
|
|
|
|
type="textarea"
|
|
|
|
|
:rows="8"
|
|
|
|
|
placeholder="请输入爱预约会议室 JSON,例如包含 code、address 字段"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 100%;">
|
|
|
|
|
</el-input>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template> -->
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
</xy-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
@ -182,6 +196,7 @@
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import myMixins from "@/mixin/selectMixin.js";
|
|
|
|
|
import { mapGetters } from 'vuex'
|
|
|
|
|
import {
|
|
|
|
|
show,
|
|
|
|
|
save
|
|
|
|
|
@ -192,6 +207,12 @@
|
|
|
|
|
export default {
|
|
|
|
|
mixins: [myMixins],
|
|
|
|
|
components: {},
|
|
|
|
|
computed: {
|
|
|
|
|
...mapGetters(['roleNames']),
|
|
|
|
|
isSystemAdmin() {
|
|
|
|
|
return (this.roleNames || []).includes('系统管理员')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
isShow: false,
|
|
|
|
|
@ -209,12 +230,9 @@
|
|
|
|
|
status: 1,
|
|
|
|
|
use_student: 1,
|
|
|
|
|
show_front:0,
|
|
|
|
|
// dateRange: ['09:00','17:30'],
|
|
|
|
|
file_ids: [],
|
|
|
|
|
// start_time:'09:00',
|
|
|
|
|
// end_time:'17:30',
|
|
|
|
|
// door:'',
|
|
|
|
|
// room:''
|
|
|
|
|
door: '',
|
|
|
|
|
room: ''
|
|
|
|
|
},
|
|
|
|
|
action: `${process.env.VUE_APP_UPLOAD_API}`,
|
|
|
|
|
types_options:[],
|
|
|
|
|
@ -242,14 +260,28 @@
|
|
|
|
|
})
|
|
|
|
|
this.types_options = res.data
|
|
|
|
|
},
|
|
|
|
|
changeDateRange(e) {
|
|
|
|
|
console.log(e)
|
|
|
|
|
if (e) {
|
|
|
|
|
this.form.start_time = e[0]
|
|
|
|
|
this.form.end_time = e[1]
|
|
|
|
|
} else {
|
|
|
|
|
this.form.start_time = ''
|
|
|
|
|
this.form.end_time = ''
|
|
|
|
|
formatJsonField(value) {
|
|
|
|
|
if (!value) {
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
if (typeof value === 'object') {
|
|
|
|
|
return JSON.stringify(value, null, 2)
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
return JSON.stringify(JSON.parse(value), null, 2)
|
|
|
|
|
} catch (error) {
|
|
|
|
|
return value
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
normalizeJsonField(value, label) {
|
|
|
|
|
if (value === null || value === undefined || value === '') {
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
return JSON.stringify(JSON.parse(value))
|
|
|
|
|
} catch (error) {
|
|
|
|
|
this.$message.error(`${label} JSON 格式不正确`)
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
uploadSuccesspublic(response, file, fileList) {
|
|
|
|
|
@ -275,9 +307,25 @@
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
this.form.file_ids = _files
|
|
|
|
|
save({
|
|
|
|
|
const payload = {
|
|
|
|
|
...this.form
|
|
|
|
|
}).then(res => {
|
|
|
|
|
}
|
|
|
|
|
if (this.isSystemAdmin) {
|
|
|
|
|
const door = this.normalizeJsonField(this.form.door, '门禁信息')
|
|
|
|
|
if (door === null) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const room = this.normalizeJsonField(this.form.room, '会议室信息')
|
|
|
|
|
if (room === null) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
payload.door = door
|
|
|
|
|
payload.room = room
|
|
|
|
|
} else {
|
|
|
|
|
delete payload.door
|
|
|
|
|
delete payload.room
|
|
|
|
|
}
|
|
|
|
|
save(payload).then(res => {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'success',
|
|
|
|
|
message: '保存预约场地成功'
|
|
|
|
|
@ -298,9 +346,8 @@
|
|
|
|
|
this.form.status = res.status ? res.status : 0
|
|
|
|
|
// this.form.use_student = res.use_student ? res.use_student : 0
|
|
|
|
|
this.form.show_front = res.show_front ? res.show_front : 0
|
|
|
|
|
// this.form.dateRange = res.start_time?[res.start_time,res.end_time]:['','']
|
|
|
|
|
// this.form.door = res.door?JSON.parse(res.door):''
|
|
|
|
|
// this.form.room = res.room?JSON.parse(res.room):''
|
|
|
|
|
this.form.door = this.isSystemAdmin ? this.formatJsonField(res.door) : ''
|
|
|
|
|
this.form.room = this.isSystemAdmin ? this.formatJsonField(res.room) : ''
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
@ -327,10 +374,9 @@
|
|
|
|
|
status: 1,
|
|
|
|
|
use_student: 1,
|
|
|
|
|
show_front:0,
|
|
|
|
|
// dateRange: ['09:00','17:30'],
|
|
|
|
|
file_ids: [],
|
|
|
|
|
// start_time:'09:00',
|
|
|
|
|
// end_time:'17:30'
|
|
|
|
|
door: '',
|
|
|
|
|
room: ''
|
|
|
|
|
}
|
|
|
|
|
this.$refs['dialog'].reset()
|
|
|
|
|
}
|
|
|
|
|
@ -341,7 +387,8 @@
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
::v-deep .file_ids{
|
|
|
|
|
::v-deep .file_ids,
|
|
|
|
|
::v-deep .technical-field {
|
|
|
|
|
flex-basis: 100%;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|