fix:预定页面提取
This commit is contained in:
parent
c1fbda96f0
commit
db46b1d878
|
@ -69,11 +69,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
delete: {
|
delete: {
|
||||||
url: `${config.API_URL}/ofm/mroom/delete/`,
|
name: "删除",
|
||||||
name: "批量物理删除",
|
req: async function (id) {
|
||||||
req: async function(data){
|
return await http.delete(`${config.API_URL}/ofm/mroom/${id}/`);
|
||||||
return await http.post(this.url, data);
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mroombooking: {
|
mroombooking: {
|
||||||
|
@ -106,11 +105,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
delete: {
|
delete: {
|
||||||
url: `${config.API_URL}/ofm/mroombooking/delete/`,
|
name: "删除",
|
||||||
name: "批量物理删除",
|
req: async function (id) {
|
||||||
req: async function(data){
|
return await http.delete(`${config.API_URL}/ofm/mroombooking/${id}/`);
|
||||||
return await http.post(this.url, data);
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mroomslot: {
|
mroomslot: {
|
||||||
|
|
|
@ -1,64 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-main>
|
||||||
<div class="left-panel-group">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
icon="el-icon-plus"
|
|
||||||
@click="handleAdd"
|
|
||||||
></el-button>
|
|
||||||
</div>
|
|
||||||
<div class="right-panel">
|
|
||||||
<el-input
|
|
||||||
v-model="query.search"
|
|
||||||
placeholder="会议室名称"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
></el-input>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
icon="el-icon-search"
|
|
||||||
@click="handleQuery"
|
|
||||||
></el-button>
|
|
||||||
</div>
|
|
||||||
</el-header>
|
|
||||||
<el-main class="nopadding">
|
|
||||||
<scTable ref="table" :apiObj="apiObj" row-key="id">
|
|
||||||
<el-table-column label="#" type="index"></el-table-column>
|
|
||||||
<el-table-column label="标题" prop="title"></el-table-column>
|
|
||||||
<el-table-column label="会议室名称" prop="mroom_name"></el-table-column>
|
|
||||||
<el-table-column label="预约日期" prop="mdate"></el-table-column>
|
|
||||||
<el-table-column label="预约时间" prop="time_ranges">
|
|
||||||
<template #default="scope">
|
|
||||||
<span v-for="item in scope.row.time_ranges" :key="item">{{ item }}、</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" fixed="right" align="center" width="250">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button
|
|
||||||
link
|
|
||||||
size="small"
|
|
||||||
type="primary"
|
|
||||||
@click="handleEidt(scope.row)"
|
|
||||||
>编辑</el-button>
|
|
||||||
<el-popconfirm
|
|
||||||
title="确定删除吗?"
|
|
||||||
@confirm="handleDel(scope.row)"
|
|
||||||
>
|
|
||||||
<template #reference>
|
|
||||||
<el-button
|
|
||||||
link
|
|
||||||
size="small"
|
|
||||||
type="danger"
|
|
||||||
>删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-popconfirm>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</scTable>
|
|
||||||
</el-main>
|
|
||||||
</el-container>
|
|
||||||
<el-drawer :title="titleMap[type]" v-model="limitedVisible" :size="'80%'">
|
|
||||||
<el-form
|
<el-form
|
||||||
:model="form"
|
:model="form"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
|
@ -94,24 +36,44 @@
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<el-footer v-show="mode!=='show'">
|
||||||
<el-button @click="handleCancel">取 消</el-button>
|
<ticketd_b_start
|
||||||
<el-button
|
:workflow_key="'booking'"
|
||||||
v-if="type !== 'show'"
|
:title="bookingTitle"
|
||||||
type="primary"
|
:t_id="form.id"
|
||||||
:loading="isSaving"
|
:ticketId="form.ticket"
|
||||||
@click="submitHandle()"
|
@success="()=>{$emit('success')}"
|
||||||
>确定</el-button>
|
:submit_b_func="submit_b_func"
|
||||||
</template>
|
ref="ticketd_b_start"
|
||||||
</el-drawer>
|
></ticketd_b_start>
|
||||||
|
<el-button @click="$emit('closed')">取消</el-button>
|
||||||
|
</el-footer>
|
||||||
|
</el-main>
|
||||||
|
<el-aside width="20%" v-if="form.ticket">
|
||||||
|
<ticketd :ticketId="form.ticket" @success="$emit('success')"></ticketd>
|
||||||
|
</el-aside>
|
||||||
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import ticketd_b_start from "@/views/wf/ticketd_b_start.vue";
|
||||||
|
import ticketd from '@/views/wf/ticketd.vue'
|
||||||
export default {
|
export default {
|
||||||
|
emits: ["success", "closed"],
|
||||||
name: "index",
|
name: "index",
|
||||||
|
components: {
|
||||||
|
ticketd_b_start, ticketd
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
t_id: {
|
||||||
|
type: String,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
apiObj: this.$API.ofm.mroombooking.list,
|
apiObj: this.$API.ofm.mroombooking.list,
|
||||||
|
bookingTitle: "会议预定",
|
||||||
query: {},
|
query: {},
|
||||||
editId: null,
|
editId: null,
|
||||||
isSaving: false,
|
isSaving: false,
|
||||||
|
@ -190,6 +152,7 @@ export default {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getmRoomList();
|
this.getmRoomList();
|
||||||
|
this.getTid();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getmRoomList(){
|
getmRoomList(){
|
||||||
|
@ -198,13 +161,21 @@ export default {
|
||||||
that.mRoomList = res;
|
that.mRoomList = res;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//添加
|
getTid (){
|
||||||
handleAdd() {
|
var that = this;
|
||||||
this.type = "add";
|
if (that.t_id) {
|
||||||
this.limitedVisible = true;
|
that.$API.wpm.handover.item.req(that.t_id).then(res=>{
|
||||||
},
|
that.setData(res);
|
||||||
handleCancel() {
|
if(res.ticket_.state_.type == 1 && res.create_by == that.$TOOL.data.get("USER_INFO").id ) {
|
||||||
this.limitedVisible = false;
|
that.mode = "edit";
|
||||||
|
}else{
|
||||||
|
that.mode = "show";
|
||||||
|
}
|
||||||
|
that.$nextTick(()=>{
|
||||||
|
that.$refs.ticketd_b_start.init();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
selectTime(index){
|
selectTime(index){
|
||||||
let that = this;
|
let that = this;
|
||||||
|
@ -225,6 +196,15 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
async submit_b_func() {
|
||||||
|
let that = this;
|
||||||
|
if(that.mode == "add") {
|
||||||
|
let res = await that.$API.ofm.mroombooking.create.req(that.form);
|
||||||
|
that.form.id = res.id;
|
||||||
|
} else if (that.mode == "edit") {
|
||||||
|
await that.$API.ofm.mroombooking.update.req(that.form.id, that.form);
|
||||||
|
}
|
||||||
|
},
|
||||||
async submit() {
|
async submit() {
|
||||||
let that = this,res = null;
|
let that = this,res = null;
|
||||||
console.log('that.form',that.form);
|
console.log('that.form',that.form);
|
||||||
|
@ -255,17 +235,6 @@ export default {
|
||||||
that.form = Object.assign({}, row);
|
that.form = Object.assign({}, row);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async handleDel(row) {
|
|
||||||
var id = row.id;
|
|
||||||
var res = await this.$API.ofm.mroom.delete.req(id);
|
|
||||||
if (res.err_msg) {
|
|
||||||
this.$message.error(res.err_msg);
|
|
||||||
} else {
|
|
||||||
this.$refs.table.refresh();
|
|
||||||
this.$message.success("删除成功");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
//搜索
|
//搜索
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.$refs.table.queryData(this.query);
|
this.$refs.table.queryData(this.query);
|
||||||
|
|
|
@ -41,16 +41,15 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handleEidt(scope.row)"
|
@click="handleEidt(scope.row)"
|
||||||
>编辑</el-button>
|
>编辑</el-button>
|
||||||
<el-popconfirm
|
<!-- <el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
|
||||||
title="确定删除吗?"
|
|
||||||
@confirm="handleDel(scope.row)"
|
|
||||||
>
|
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-button
|
<el-button link size="small">删除</el-button>
|
||||||
link
|
</template>
|
||||||
size="small"
|
</el-popconfirm> -->
|
||||||
type="danger"
|
|
||||||
>删除</el-button>
|
<el-popconfirm title="确定删除吗?" @confirm="handleDel(scope.row)">
|
||||||
|
<template #reference>
|
||||||
|
<el-button link size="small" type="danger">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
</template>
|
</template>
|
||||||
|
@ -59,56 +58,21 @@
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
<el-drawer :title="titleMap[type]" v-model="limitedVisible" :size="'80%'">
|
<el-drawer :title="titleMap[type]" v-model="limitedVisible" :size="'80%'">
|
||||||
<el-form
|
<bookingDialog
|
||||||
:model="form"
|
:type="type"
|
||||||
:rules="rules"
|
:id="editId"
|
||||||
ref="addForm"
|
:timeselectList="timeselectList"
|
||||||
label-width="100px"
|
@success="handleSuccess"
|
||||||
>
|
@cancel="handleCancel"
|
||||||
<el-form-item label="标题" prop="title">
|
></bookingDialog>
|
||||||
<el-input v-model="form.title" clearable></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="会议室" prop="mroom">
|
|
||||||
<el-select v-model="form.mroom" placeholder="请选择" style="width: 100%;">
|
|
||||||
<el-option
|
|
||||||
v-for="item in mRoomList"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.id"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="时间" prop="mdate">
|
|
||||||
<el-date-picker v-model="form.mdate" type="date" value-format="YYYY-MM-DD" style="width: 100%;"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row>
|
|
||||||
<div v-for="(item,$index) in timesList" :key="item.value">
|
|
||||||
<div v-if="item.isSelect" class="timeBlock selectedTimeBlock" @click="selectTime($index)">{{ item.label }}</div>
|
|
||||||
<div v-else class="timeBlock" @click="selectTime($index)">{{ item.label }}</div>
|
|
||||||
</div>
|
|
||||||
</el-row>
|
|
||||||
</el-form>
|
|
||||||
<template #footer>
|
|
||||||
<el-button @click="handleCancel">取 消</el-button>
|
|
||||||
<el-button
|
|
||||||
v-if="type !== 'show'"
|
|
||||||
type="primary"
|
|
||||||
:loading="isSaving"
|
|
||||||
@click="submitHandle()"
|
|
||||||
>确定</el-button>
|
|
||||||
</template>
|
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import bookingDialog from "./booking_form.vue";
|
||||||
export default {
|
export default {
|
||||||
name: "index",
|
name: "index",
|
||||||
|
components: { bookingDialog },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
apiObj: this.$API.ofm.mroombooking.list,
|
apiObj: this.$API.ofm.mroombooking.list,
|
||||||
|
@ -122,82 +86,11 @@ export default {
|
||||||
edit: "编辑会议预定",
|
edit: "编辑会议预定",
|
||||||
show: "查看会议预定",
|
show: "查看会议预定",
|
||||||
},
|
},
|
||||||
//表单数据
|
|
||||||
form: {
|
|
||||||
mroom: "",
|
|
||||||
mdate: "",
|
|
||||||
title: "",
|
|
||||||
slots: [],
|
|
||||||
},
|
|
||||||
//验证规则
|
|
||||||
rules: {
|
|
||||||
mroom: [{ required: true, message: "请输入会议室名称", trigger: "blur" }],
|
|
||||||
mdate: [{ required: true, message: "请输入地点", trigger: "blur" }],
|
|
||||||
title: [{ required: true, message: "请输入容纳人数", trigger: "blur" }],
|
|
||||||
},
|
|
||||||
timesList:[
|
|
||||||
{value:0,label:'00:00-00:30',isSelect:false},
|
|
||||||
{value:1,label:'00:30-01:00',isSelect:false},
|
|
||||||
{value:2,label:'01:00-01:30',isSelect:false},
|
|
||||||
{value:3,label:'01:30-02:00',isSelect:false},
|
|
||||||
{value:4,label:'02:00-02:30',isSelect:false},
|
|
||||||
{value:5,label:'02:30-03:00',isSelect:false},
|
|
||||||
{value:6,label:'03:00-03:30',isSelect:false},
|
|
||||||
{value:7,label:'03:30-04:00',isSelect:false},
|
|
||||||
{value:8,label:'04:00-04:30',isSelect:false},
|
|
||||||
{value:9,label:'04:30-05:00',isSelect:false},
|
|
||||||
{value:10,label:'05:00-05:30',isSelect:false},
|
|
||||||
{value:11,label:'05:30-06:00',isSelect:false},
|
|
||||||
{value:12,label:'06:00-06:30',isSelect:false},
|
|
||||||
{value:13,label:'06:30-07:00',isSelect:false},
|
|
||||||
{value:14,label:'07:00-07:30',isSelect:false},
|
|
||||||
{value:15,label:'07:30-08:00',isSelect:false},
|
|
||||||
{value:16,label:'08:00-08:30',isSelect:false},
|
|
||||||
{value:17,label:'08:30-09:00',isSelect:false},
|
|
||||||
{value:18,label:'09:00-09:30',isSelect:false},
|
|
||||||
{value:19,label:'09:30-10:00',isSelect:false},
|
|
||||||
{value:20,label:'10:00-10:30',isSelect:false},
|
|
||||||
{value:21,label:'10:30-11:00',isSelect:false},
|
|
||||||
{value:22,label:'11:00-11:30',isSelect:false},
|
|
||||||
{value:23,label:'11:30-12:00',isSelect:false},
|
|
||||||
{value:24,label:'12:00-12:30',isSelect:false},
|
|
||||||
{value:25,label:'12:30-13:00',isSelect:false},
|
|
||||||
{value:26,label:'13:00-13:30',isSelect:false},
|
|
||||||
{value:27,label:'13:30-14:00',isSelect:false},
|
|
||||||
{value:28,label:'14:00-14:30',isSelect:false},
|
|
||||||
{value:29,label:'14:30-15:00',isSelect:false},
|
|
||||||
{value:30,label:'15:00-15:30',isSelect:false},
|
|
||||||
{value:31,label:'15:30-16:00',isSelect:false},
|
|
||||||
{value:32,label:'16:00-16:30',isSelect:false},
|
|
||||||
{value:33,label:'16:30-17:00',isSelect:false},
|
|
||||||
{value:34,label:'17:00-17:30',isSelect:false},
|
|
||||||
{value:35,label:'17:30-18:00',isSelect:false},
|
|
||||||
{value:36,label:'18:00-18:30',isSelect:false},
|
|
||||||
{value:37,label:'18:30-19:00',isSelect:false},
|
|
||||||
{value:38,label:'19:00-19:30',isSelect:false},
|
|
||||||
{value:39,label:'19:30-20:00',isSelect:false},
|
|
||||||
{value:40,label:'20:00-20:30',isSelect:false},
|
|
||||||
{value:41,label:'20:30-21:00',isSelect:false},
|
|
||||||
{value:42,label:'21:00-21:30',isSelect:false},
|
|
||||||
{value:43,label:'21:30-22:00',isSelect:false},
|
|
||||||
{value:44,label:'22:00-22:30',isSelect:false},
|
|
||||||
{value:45,label:'22:30-23:00',isSelect:false},
|
|
||||||
{value:46,label:'23:00-23:30',isSelect:false},
|
|
||||||
{value:47,label:'23:30-24:00',isSelect:false}
|
|
||||||
],
|
|
||||||
mRoomList: []
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getmRoomList();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getmRoomList(){
|
|
||||||
let that = this;
|
|
||||||
that.$API.ofm.mroom.list.req({page:0}).then(res=>{
|
|
||||||
that.mRoomList = res;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
//添加
|
//添加
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.type = "add";
|
this.type = "add";
|
||||||
|
@ -206,58 +99,20 @@ export default {
|
||||||
handleCancel() {
|
handleCancel() {
|
||||||
this.limitedVisible = false;
|
this.limitedVisible = false;
|
||||||
},
|
},
|
||||||
selectTime(index){
|
|
||||||
let that = this;
|
|
||||||
that.form.slots = [];
|
|
||||||
that.timesList[index].isSelect = !that.timesList[index].isSelect;
|
|
||||||
that.timesList.forEach(item=>{
|
|
||||||
if(item.isSelect){
|
|
||||||
that.form.slots.push(item.value);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
submitHandle() {
|
|
||||||
let that = this;
|
|
||||||
this.$refs.addForm.validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
that.isSaving = true;
|
|
||||||
that.submit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
async submit() {
|
|
||||||
let that = this,res = null;
|
|
||||||
console.log('that.form',that.form);
|
|
||||||
try {
|
|
||||||
if (that.type === "add") {
|
|
||||||
res = await that.$API.ofm.mroombooking.create.req(that.form);
|
|
||||||
} else {
|
|
||||||
res = await that.$API.ofm.mroombooking.update.req(that.form.id,that.form);
|
|
||||||
}
|
|
||||||
that.isSaving = false;
|
|
||||||
that.limitedVisible = false;
|
|
||||||
that.$refs.table.refresh();
|
|
||||||
} catch (e) {
|
|
||||||
that.isSaving = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleEidt(row) {
|
handleEidt(row) {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.type = "edit";
|
that.type = "edit";
|
||||||
that.editId = row.id;
|
that.editId = row.id;
|
||||||
|
that.bookingIitem = row;
|
||||||
that.$API.ofm.mroomslot.list.req({booking:row.id,page:0}).then(res=>{
|
that.$API.ofm.mroomslot.list.req({booking:row.id,page:0}).then(res=>{
|
||||||
console.log('mroomslotres',res);
|
that.timeselectList = res;
|
||||||
res.forEach(item=>{
|
|
||||||
that.timesList[item.slot].isSelect = true;
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
that.limitedVisible = true;
|
that.limitedVisible = true;
|
||||||
that.form = Object.assign({}, row);
|
that.form = Object.assign({}, row);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async handleDel(row) {
|
async handleDel(row) {
|
||||||
var id = row.id;
|
var id = row.id;
|
||||||
var res = await this.$API.ofm.mroom.delete.req(id);
|
var res = await this.$API.ofm.mroombooking.delete.req(id);
|
||||||
if (res.err_msg) {
|
if (res.err_msg) {
|
||||||
this.$message.error(res.err_msg);
|
this.$message.error(res.err_msg);
|
||||||
} else {
|
} else {
|
||||||
|
@ -265,12 +120,12 @@ export default {
|
||||||
this.$message.success("删除成功");
|
this.$message.success("删除成功");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//搜索
|
//搜索
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.$refs.table.queryData(this.query);
|
this.$refs.table.queryData(this.query);
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.left-panel-group {
|
.left-panel-group {
|
||||||
|
@ -279,21 +134,5 @@ export default {
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
.timeBlock{
|
|
||||||
width: 100px;
|
|
||||||
height: 40px;
|
|
||||||
cursor: pointer;
|
|
||||||
margin-top: 10px;
|
|
||||||
line-height: 40px;
|
|
||||||
margin-right: 10px;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 5px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-color: #b9f0cb;
|
|
||||||
}
|
|
||||||
.selectedTimeBlock{
|
|
||||||
background-color: #00a870;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue