rollback
parent
6bc62282b4
commit
903751043f
@ -0,0 +1,44 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export function index(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/oa/meeting/index',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function show(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/oa/meeting/show',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function save(data, isLoading = true) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: '/api/oa/meeting/save',
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy(params, isLoading = true) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/oa/meeting/destroy',
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function check(params,isLoading=true) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/oa/meeting/check-time',
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
import request from "@/utils/request";
|
||||
export function index(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/oa/meeting-room/index',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function show(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/oa/meeting-room/show',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function save(data, isLoading = true) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: '/api/oa/meeting-room/save',
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy(params, isLoading = true) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/oa/meeting-room/destroy',
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
import request from "@/utils/request";
|
||||
export function index(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/oa/notice/index',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function show(params) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/oa/notice/show',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function save(data, isLoading = true) {
|
||||
return request({
|
||||
method: 'post',
|
||||
url: '/api/oa/notice/save',
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy(params, isLoading = true) {
|
||||
return request({
|
||||
method: 'get',
|
||||
url: '/api/oa/notice/destroy',
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
After Width: | Height: | Size: 845 B |
@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<div>
|
||||
<vxe-modal
|
||||
:value="isShow"
|
||||
show-footer
|
||||
title="会议室"
|
||||
show-confirm-button
|
||||
:width="600"
|
||||
:height="400"
|
||||
esc-closable
|
||||
:fullscreen="$store.getters.device === 'mobile'"
|
||||
@input="e => $emit('update:isShow',e)"
|
||||
>
|
||||
<el-form ref="elForm" :model="form" :rules="rules" label-position="top" label-width="100">
|
||||
<el-form-item label="名字" prop="name">
|
||||
<el-input v-model="form.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="myindex">
|
||||
<el-input-number v-model="form.myindex" controls-position="right" :precision="0" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button type="primary" :loading="loading" @click="submit">确认</el-button>
|
||||
</template>
|
||||
</vxe-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { save } from '@/api/meetingRoom'
|
||||
export default {
|
||||
props: {
|
||||
isShow: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
form: {
|
||||
name: '',
|
||||
myindex: 0
|
||||
},
|
||||
rules: {}
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
submit() {
|
||||
this.$refs['elForm'].validate(async valid => {
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
try {
|
||||
await save(this.form)
|
||||
this.$message.success('新增成功')
|
||||
this.$emit('refresh')
|
||||
this.$emit('update:isShow', false)
|
||||
this.loading = false
|
||||
this.$refs['elForm'].resetFields()
|
||||
} catch (err) {
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
@ -0,0 +1,190 @@
|
||||
<template>
|
||||
<div>
|
||||
<card-container>
|
||||
<vxe-toolbar>
|
||||
<template #buttons>
|
||||
<el-button icon="el-icon-plus" type="primary" size="small" @click="isShowAdd = true">新增</el-button>
|
||||
<el-button icon="el-icon-search" type="primary" plain size="small" @click="getList">搜索</el-button>
|
||||
</template>
|
||||
</vxe-toolbar>
|
||||
<vxe-table
|
||||
ref="table"
|
||||
stripe
|
||||
style="margin-top: 10px;"
|
||||
:loading="loading"
|
||||
keep-source
|
||||
show-overflow
|
||||
:column-config="{ resizable: true }"
|
||||
:edit-rules="validRules"
|
||||
:edit-config="{ trigger: 'manual', mode: 'row', showStatus: true, isHover: true, autoClear: false }"
|
||||
:align="allAlign"
|
||||
:data="tableData"
|
||||
>
|
||||
<vxe-column type="seq" width="58" align="center" />
|
||||
<vxe-column field="name" width="170" title="名字" :edit-render="{ name: 'input', attrs: { type: 'text' } }" />
|
||||
<vxe-column field="myindex" width="80" title="排序" align="center" :edit-render="{ name: 'input', attrs: { type: 'number' } }" />
|
||||
<vxe-column field="operate" title="操作" min-width="220">
|
||||
<template #default="{ row }">
|
||||
<template v-if="isActiveStatus(row)">
|
||||
<el-button size="small" type="primary" @click="saveRowEvent(row)">保存</el-button>
|
||||
<el-button size="small" type="primary" plain @click="cancelRowEvent(row)">取消</el-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button size="small" type="warning" @click="editRowEvent(row)">编辑</el-button>
|
||||
<el-button size="small" type="danger" @click="destroyRowEvent(row)">删除</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
|
||||
<el-pagination
|
||||
style="margin-top: 10px;"
|
||||
:current-page="select.page"
|
||||
:page-sizes="[20, 30, 40, 50]"
|
||||
:page-size="select.page_size"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
@size-change="e => {
|
||||
select.page_size = e;
|
||||
select.page = 1;
|
||||
getList();
|
||||
}"
|
||||
@current-change="e => {
|
||||
select.page = e;
|
||||
getList();
|
||||
}"
|
||||
/>
|
||||
</card-container>
|
||||
<add-meeting-room ref="AddMeetingRoom" :is-show.sync="isShowAdd" @refresh="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { deepCopy } from '@/utils'
|
||||
import { index, save, destroy } from '@/api/meetingRoom'
|
||||
import AddMeetingRoom from './components/AddMeetingRoom.vue'
|
||||
export default {
|
||||
components: {
|
||||
AddMeetingRoom
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShowAdd: false,
|
||||
|
||||
loading: false,
|
||||
select: {
|
||||
page: 1,
|
||||
page_size: 20
|
||||
},
|
||||
total: 0,
|
||||
allAlign: null,
|
||||
tableData: [],
|
||||
validRules: {},
|
||||
form: {
|
||||
id: '',
|
||||
name: '',
|
||||
myindex: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isActiveStatus() {
|
||||
return function(row) {
|
||||
if (this.$refs['table']) {
|
||||
return this.$refs['table'].isEditByRow(row)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
editRowEvent(row) {
|
||||
if (this.$refs['table']) {
|
||||
this.$refs['table'].setEditRow(row)
|
||||
}
|
||||
},
|
||||
cancelRowEvent(row) {
|
||||
if (this.$refs['table']) {
|
||||
this.$refs['table'].clearEdit().then(() => {
|
||||
// 还原行数据
|
||||
this.$refs['table'].revertData(row)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
async getList() {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await index(this.select)
|
||||
this.tableData = res.data
|
||||
this.total = res.total
|
||||
this.loading = false
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async saveRowEvent(row) {
|
||||
try {
|
||||
const errMap = await this.$refs['table'].validate()
|
||||
if (errMap) {
|
||||
throw new Error(errMap)
|
||||
}
|
||||
await this.$confirm('确认保存?', '提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消'
|
||||
})
|
||||
await this.$refs['table'].clearEdit()
|
||||
const form = deepCopy(this.form)
|
||||
for (const key in form) {
|
||||
form[key] = row[key]
|
||||
}
|
||||
if (!form.password) {
|
||||
delete form.password
|
||||
}
|
||||
this.loading = true
|
||||
await save(form)
|
||||
await this.getList()
|
||||
this.loading = false
|
||||
} catch (err) {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
async destroyRowEvent(row) {
|
||||
try {
|
||||
await this.$confirm('确认删除?', '提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消'
|
||||
})
|
||||
this.loading = true
|
||||
if (row.id) {
|
||||
await destroy({
|
||||
id: row.id
|
||||
})
|
||||
await this.getList()
|
||||
} else {
|
||||
console.log(row)
|
||||
this.tableData.splice(this.tableData.findIndex(i => i._X_ROW_KEY === row._X_ROW_KEY), 1)
|
||||
}
|
||||
this.loading = false
|
||||
} catch (err) {
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.total {
|
||||
color: #666;
|
||||
text-align: right;
|
||||
line-height: 3;
|
||||
}
|
||||
::v-deep .el-tag + .el-tag {
|
||||
margin-left: 4px;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,193 @@
|
||||
<template>
|
||||
<div>
|
||||
<vxe-modal
|
||||
:value="isShow"
|
||||
show-footer
|
||||
:z-index="zIndex"
|
||||
title="会议使用审核"
|
||||
show-confirm-button
|
||||
:width="640"
|
||||
:height="580"
|
||||
esc-closable
|
||||
:fullscreen="$store.getters.device === 'mobile'"
|
||||
@input="(e) => $emit('update:isShow', e)"
|
||||
>
|
||||
<el-form
|
||||
ref="elForm"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="top"
|
||||
label-width="100"
|
||||
>
|
||||
<el-form-item label="会议/活动名称" prop="title">
|
||||
<el-input v-model="form.title" />
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间" prop="start_time">
|
||||
<el-date-picker
|
||||
style="width: 100%;"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
v-model="form.start_time"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间" prop="end_time">
|
||||
<el-date-picker
|
||||
style="width: 100%;"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
v-model="form.end_time"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="会议室" prop="room_id">
|
||||
<el-select
|
||||
style="width: 100%;"
|
||||
v-model="form.room_id"
|
||||
@change="
|
||||
(e) =>
|
||||
(form.address = rooms.find((i) => i.id === e)
|
||||
? rooms.find((i) => i.id === e).name
|
||||
: '')
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in rooms"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
:label="item.name"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="会议/活动地址" prop="address">
|
||||
<el-input v-model="form.address" />
|
||||
</el-form-item>
|
||||
<el-form-item label="主要议程" prop="content">
|
||||
<el-input
|
||||
v-model="form.content"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="附件上传">
|
||||
<el-upload
|
||||
:action="action"
|
||||
:headers="{
|
||||
Authorization: `Bearer ${getToken()}`,
|
||||
}"
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="uploadSuccess"
|
||||
multiple
|
||||
:file-list="fileList"
|
||||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" class="el-upload__tip">上传文件不超过10Mb</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户选择" prop="user_ids">
|
||||
<el-transfer
|
||||
filterable
|
||||
:titles="['未选用户', '已选用户']"
|
||||
filter-placeholder="请输入关键字"
|
||||
:value="form.user_ids.map(i => i.user_id)"
|
||||
:props="{
|
||||
key: 'id',
|
||||
label: 'name'
|
||||
}"
|
||||
:data="users"
|
||||
@input="e => form.user_ids = e.map(i => ({ user_id: i }))">
|
||||
</el-transfer>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button type="primary" :loading="loading" @click="submit"
|
||||
>确认</el-button
|
||||
>
|
||||
</template>
|
||||
</vxe-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { save } from "@/api/meeting";
|
||||
import { PopupManager } from "element-ui/lib/utils/popup";
|
||||
export default {
|
||||
props: {
|
||||
isShow: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true,
|
||||
},
|
||||
rooms: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
users: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
zIndex: PopupManager.nextZIndex(),
|
||||
loading: false,
|
||||
form: {
|
||||
title: "",
|
||||
start_time: "",
|
||||
end_time: "",
|
||||
address: "",
|
||||
room_id: "",
|
||||
content: "",
|
||||
meeting_status: 0,
|
||||
files: [],
|
||||
user_ids: [],
|
||||
},
|
||||
action: process.env.VUE_APP_UPLOAD_API,
|
||||
fileList: [],
|
||||
rules: {},
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
isShow(newVal) {
|
||||
if(newVal) {
|
||||
this.zIndex = PopupManager.nextZIndex()
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
beforeUpload(file) {
|
||||
const isLt10M = file.size / 1024 / 1024 < 10
|
||||
if (!isLt10M) {
|
||||
this.$message.error('上传文件大小不能超过 10MB!')
|
||||
}
|
||||
return isLt10M
|
||||
},
|
||||
uploadSuccess(response, file, fileList) {
|
||||
this.fileList = fileList
|
||||
},
|
||||
|
||||
getToken,
|
||||
submit() {
|
||||
this.$refs["elForm"].validate(async (valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
try {
|
||||
this.form.files = this.fileList.map(i => i.response?.data?.id).filter(i => !!i)
|
||||
await save(this.form);
|
||||
this.$message.success("新增成功");
|
||||
this.$emit("refresh");
|
||||
this.$emit("update:isShow", false);
|
||||
this.loading = false;
|
||||
this.$refs["elForm"].resetFields();
|
||||
} catch (err) {
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
@ -0,0 +1,354 @@
|
||||
<template>
|
||||
<div>
|
||||
<card-container>
|
||||
<vxe-toolbar>
|
||||
<template #buttons>
|
||||
<el-button
|
||||
icon="el-icon-plus"
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="isShowAdd = true"
|
||||
>新增</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="el-icon-search"
|
||||
type="primary"
|
||||
plain
|
||||
size="small"
|
||||
@click="getList"
|
||||
>搜索</el-button
|
||||
>
|
||||
</template>
|
||||
</vxe-toolbar>
|
||||
<vxe-table
|
||||
ref="table"
|
||||
stripe
|
||||
style="margin-top: 10px"
|
||||
:loading="loading"
|
||||
keep-source
|
||||
show-overflow
|
||||
:column-config="{ resizable: true }"
|
||||
:edit-rules="validRules"
|
||||
:edit-config="{
|
||||
trigger: 'manual',
|
||||
mode: 'row',
|
||||
showStatus: true,
|
||||
isHover: true,
|
||||
autoClear: false,
|
||||
}"
|
||||
:align="allAlign"
|
||||
:data="tableData"
|
||||
>
|
||||
<vxe-column type="seq" width="58" align="center" />
|
||||
<vxe-column
|
||||
field="title"
|
||||
width="170"
|
||||
title="会议标题"
|
||||
:edit-render="{ name: 'input', attrs: { type: 'text' } }"
|
||||
/>
|
||||
<vxe-column
|
||||
field="start_time"
|
||||
width="180"
|
||||
title="会议开始时间"
|
||||
:edit-render="{}"
|
||||
>
|
||||
<template #edit="{ row }">
|
||||
<el-date-picker style="width: 100%;" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" v-model="row.start_time"></el-date-picker>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column
|
||||
field="end_time"
|
||||
width="180"
|
||||
title="会议结束时间"
|
||||
:edit-render="{}"
|
||||
>
|
||||
<template #edit="{ row }">
|
||||
<el-date-picker style="width: 100%;" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" v-model="row.end_time"></el-date-picker>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column
|
||||
field="address"
|
||||
width="170"
|
||||
title="会议地址"
|
||||
:edit-render="{ name: 'input', attrs: { type: 'text' } }"
|
||||
/>
|
||||
<vxe-column
|
||||
field="room_id"
|
||||
width="180"
|
||||
title="会议室"
|
||||
:edit-render="{}"
|
||||
>
|
||||
<template #edit="{ row }">
|
||||
<el-select
|
||||
style="width: 100%;"
|
||||
v-model="row.room_id"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in rooms"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
:label="item.name"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column
|
||||
field="content"
|
||||
min-width="200"
|
||||
title="主要议程"
|
||||
:edit-render="{ name: 'input', attrs: { type: 'text' } }"
|
||||
/>
|
||||
<vxe-column
|
||||
field="user_ids"
|
||||
width="220"
|
||||
title="参会用户"
|
||||
:edit-render="{}"
|
||||
>
|
||||
<template #edit="{ row }">
|
||||
<el-select
|
||||
filterable
|
||||
multiple
|
||||
style="width: 100%;"
|
||||
v-model="row.user_ids"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in users"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
:label="item.name"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="operate" title="操作" min-width="220">
|
||||
<template #default="{ row }">
|
||||
<template v-if="isActiveStatus(row)">
|
||||
<el-button size="small" type="primary" @click="saveRowEvent(row)"
|
||||
>保存</el-button
|
||||
>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
plain
|
||||
@click="cancelRowEvent(row)"
|
||||
>取消</el-button
|
||||
>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button size="small" type="primary" @click=""
|
||||
>审核</el-button
|
||||
>
|
||||
<el-button size="small" type="warning" @click="editRowEvent(row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
size="small"
|
||||
type="danger"
|
||||
@click="destroyRowEvent(row)"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
|
||||
<el-pagination
|
||||
style="margin-top: 10px"
|
||||
:current-page="select.page"
|
||||
:page-sizes="[20, 30, 40, 50]"
|
||||
:page-size="select.page_size"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
@size-change="
|
||||
(e) => {
|
||||
select.page_size = e;
|
||||
select.page = 1;
|
||||
getList();
|
||||
}
|
||||
"
|
||||
@current-change="
|
||||
(e) => {
|
||||
select.page = e;
|
||||
getList();
|
||||
}
|
||||
"
|
||||
/>
|
||||
</card-container>
|
||||
<add-meeting
|
||||
ref="AddMeeting"
|
||||
:rooms="rooms"
|
||||
:users="users"
|
||||
:is-show.sync="isShowAdd"
|
||||
@refresh="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { deepCopy } from "@/utils";
|
||||
import { destroy, index, save } from "@/api/meeting";
|
||||
import { index as meetingRoomIndex } from "@/api/meetingRoom";
|
||||
import { index as userIndex } from "@/api/user";
|
||||
import AddMeeting from "./components/AddMeeting.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
AddMeeting,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShowAdd: false,
|
||||
rooms: [],
|
||||
users: [],
|
||||
|
||||
loading: false,
|
||||
select: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
total: 0,
|
||||
allAlign: null,
|
||||
tableData: [],
|
||||
validRules: {},
|
||||
form: {
|
||||
id: "",
|
||||
title: "",
|
||||
start_time: "",
|
||||
end_time: "",
|
||||
address: "",
|
||||
room_id: "",
|
||||
content: "",
|
||||
meeting_status: "",
|
||||
files: [],
|
||||
user_ids: [],
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isActiveStatus() {
|
||||
return function (row) {
|
||||
if (this.$refs["table"]) {
|
||||
return this.$refs["table"].isEditByRow(row);
|
||||
}
|
||||
};
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getRooms();
|
||||
this.getUsers();
|
||||
},
|
||||
methods: {
|
||||
editRowEvent(row) {
|
||||
if (this.$refs["table"]) {
|
||||
this.$refs["table"].setEditRow(row);
|
||||
}
|
||||
},
|
||||
cancelRowEvent(row) {
|
||||
if (this.$refs["table"]) {
|
||||
this.$refs["table"].clearEdit().then(() => {
|
||||
// 还原行数据
|
||||
this.$refs["table"].revertData(row);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
async getRooms() {
|
||||
try {
|
||||
this.rooms = (await meetingRoomIndex({
|
||||
page: 1,
|
||||
page_size: 9999,
|
||||
})).data
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
},
|
||||
|
||||
async getUsers() {
|
||||
try {
|
||||
this.users = (await userIndex({
|
||||
page: 1,
|
||||
rows: 9999,
|
||||
})).data
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
},
|
||||
|
||||
async getList() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const res = await index(this.select);
|
||||
this.tableData = res.data;
|
||||
this.total = res.total;
|
||||
this.loading = false;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
|
||||
async saveRowEvent(row) {
|
||||
try {
|
||||
const errMap = await this.$refs["table"].validate();
|
||||
if (errMap) {
|
||||
throw new Error(errMap);
|
||||
}
|
||||
await this.$confirm("确认保存?", "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
});
|
||||
await this.$refs["table"].clearEdit();
|
||||
const form = deepCopy(this.form);
|
||||
for (const key in form) {
|
||||
form[key] = row[key];
|
||||
}
|
||||
if (!form.password) {
|
||||
delete form.password;
|
||||
}
|
||||
this.loading = true;
|
||||
await save(form);
|
||||
await this.getList();
|
||||
this.loading = false;
|
||||
} catch (err) {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
async destroyRowEvent(row) {
|
||||
try {
|
||||
await this.$confirm("确认删除?", "提示", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
});
|
||||
this.loading = true;
|
||||
if (row.id) {
|
||||
await destroy({
|
||||
id: row.id,
|
||||
});
|
||||
await this.getList();
|
||||
} else {
|
||||
console.log(row);
|
||||
this.tableData.splice(
|
||||
this.tableData.findIndex((i) => i._X_ROW_KEY === row._X_ROW_KEY),
|
||||
1
|
||||
);
|
||||
}
|
||||
this.loading = false;
|
||||
} catch (err) {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.total {
|
||||
color: #666;
|
||||
text-align: right;
|
||||
line-height: 3;
|
||||
}
|
||||
::v-deep .el-tag + .el-tag {
|
||||
margin-left: 4px;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,212 @@
|
||||
<template>
|
||||
<div>
|
||||
<card-container>
|
||||
<vxe-toolbar>
|
||||
<template #buttons>
|
||||
<el-button icon="el-icon-plus" type="primary" size="small" @click="isShowAdd = true">新增</el-button>
|
||||
<el-button icon="el-icon-search" type="primary" plain size="small" @click="getList">搜索</el-button>
|
||||
</template>
|
||||
</vxe-toolbar>
|
||||
<vxe-table
|
||||
ref="table"
|
||||
stripe
|
||||
style="margin-top: 10px;"
|
||||
:loading="loading"
|
||||
keep-source
|
||||
show-overflow
|
||||
:column-config="{ resizable: true }"
|
||||
:edit-rules="validRules"
|
||||
:edit-config="{ trigger: 'manual', mode: 'row', showStatus: true, isHover: true, autoClear: false }"
|
||||
:align="allAlign"
|
||||
:data="tableData"
|
||||
>
|
||||
<vxe-column type="seq" width="58" align="center" />
|
||||
<vxe-column field="name" width="170" title="名字" :edit-render="{ name: 'input', attrs: { type: 'text' } }" />
|
||||
<vxe-column field="key" width="150" title="标识" :edit-render="{ name: 'input', attrs: { type: 'text' } }" />
|
||||
<vxe-column field="value" width="150" title="值" :edit-render="{ name: 'input', attrs: { type: 'text' } }" />
|
||||
<vxe-column field="mysort" width="80" title="排序" align="center" :edit-render="{ name: 'input', attrs: { type: 'number' } }" />
|
||||
<vxe-column field="operate" title="操作" min-width="220">
|
||||
<template #default="{ row }">
|
||||
<template v-if="isActiveStatus(row)">
|
||||
<el-button size="small" type="primary" @click="saveRowEvent(row)">保存</el-button>
|
||||
<el-button size="small" type="primary" plain @click="cancelRowEvent(row)">取消</el-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button size="small" type="warning" @click="editRowEvent(row)">编辑</el-button>
|
||||
<el-button size="small" type="danger" @click="destroyRowEvent(row)">删除</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
|
||||
<el-pagination
|
||||
style="margin-top: 10px;"
|
||||
:current-page="select.page"
|
||||
:page-sizes="[20, 30, 40, 50]"
|
||||
:page-size="select.page_size"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
@size-change="e => {
|
||||
select.page_size = e;
|
||||
select.page = 1;
|
||||
getList();
|
||||
}"
|
||||
@current-change="e => {
|
||||
select.page = e;
|
||||
getList();
|
||||
}"
|
||||
/>
|
||||
</card-container>
|
||||
<add-notice ref="AddNotice" :users="users" :is-show.sync="isShowAdd" @refresh="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { deepCopy } from '@/utils'
|
||||
import { index, save, destroy } from '@/api/notice'
|
||||
import AddNotice from './components/AddNotice.vue'
|
||||
import { index as userIndex } from "@/api/user";
|
||||
export default {
|
||||
components: {
|
||||
AddNotice
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
users: [],
|
||||
isShowAdd: false,
|
||||
|
||||
loading: false,
|
||||
select: {
|
||||
page: 1,
|
||||
page_size: 20
|
||||
},
|
||||
total: 0,
|
||||
allAlign: null,
|
||||
tableData: [],
|
||||
validRules: {},
|
||||
form: {
|
||||
id: '',
|
||||
title: '',
|
||||
content: '',
|
||||
files: '',
|
||||
deal_type: '',
|
||||
reply_fields: '',
|
||||
reply_need_files: '',
|
||||
deadline: '',
|
||||
user_ids: []
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isActiveStatus() {
|
||||
return function(row) {
|
||||
if (this.$refs['table']) {
|
||||
return this.$refs['table'].isEditByRow(row)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getUsers()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
editRowEvent(row) {
|
||||
if (this.$refs['table']) {
|
||||
this.$refs['table'].setEditRow(row)
|
||||
}
|
||||
},
|
||||
cancelRowEvent(row) {
|
||||
if (this.$refs['table']) {
|
||||
this.$refs['table'].clearEdit().then(() => {
|
||||
// 还原行数据
|
||||
this.$refs['table'].revertData(row)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
async getUsers() {
|
||||
try {
|
||||
this.users = (await userIndex({
|
||||
page: 1,
|
||||
rows: 9999,
|
||||
})).data
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
},
|
||||
|
||||
async getList() {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await index(this.select)
|
||||
this.tableData = res.data
|
||||
this.total = res.total
|
||||
this.loading = false
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async saveRowEvent(row) {
|
||||
try {
|
||||
const errMap = await this.$refs['table'].validate()
|
||||
if (errMap) {
|
||||
throw new Error(errMap)
|
||||
}
|
||||
await this.$confirm('确认保存?', '提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消'
|
||||
})
|
||||
await this.$refs['table'].clearEdit()
|
||||
const form = deepCopy(this.form)
|
||||
for (const key in form) {
|
||||
form[key] = row[key]
|
||||
}
|
||||
if (!form.password) {
|
||||
delete form.password
|
||||
}
|
||||
this.loading = true
|
||||
await save(form)
|
||||
await this.getList()
|
||||
this.loading = false
|
||||
} catch (err) {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
async destroyRowEvent(row) {
|
||||
try {
|
||||
await this.$confirm('确认删除?', '提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消'
|
||||
})
|
||||
this.loading = true
|
||||
if (row.id) {
|
||||
await destroy({
|
||||
id: row.id
|
||||
})
|
||||
await this.getList()
|
||||
} else {
|
||||
console.log(row)
|
||||
this.tableData.splice(this.tableData.findIndex(i => i._X_ROW_KEY === row._X_ROW_KEY), 1)
|
||||
}
|
||||
this.loading = false
|
||||
} catch (err) {
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.total {
|
||||
color: #666;
|
||||
text-align: right;
|
||||
line-height: 3;
|
||||
}
|
||||
::v-deep .el-tag + .el-tag {
|
||||
margin-left: 4px;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue