xy 1 year ago
parent 065b8e5335
commit 52ff93a69a

@ -0,0 +1,34 @@
import request from "@/utils/request";
export function index(params) {
return request({
method: 'get',
url: '/api/oa/notice-user/index',
params
})
}
export function show(params) {
return request({
method: 'get',
url: '/api/oa/notice-user/show',
params
})
}
export function save(data, isLoading = true) {
return request({
method: 'post',
url: '/api/oa/notice-user/save',
data,
isLoading
})
}
export function destroy(params, isLoading = true) {
return request({
method: 'get',
url: '/api/oa/notice-user/destroy',
params,
isLoading
})
}

@ -78,3 +78,19 @@ p {
.vxe-loading--default-icon,.vxe-loading--text {
color: var(--theme-color) !important;;
}
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: rgb(239, 239, 239);
}
::-webkit-scrollbar-thumb {
background: #bfbfbf;
border-radius: 10px;
}
.el-table__body-wrapper::-webkit-scrollbar, .el-scrollbar__wrap::-webkit-scrollbar {
width: 10px;
height: 10px;
}

@ -96,7 +96,7 @@ service.interceptors.response.use(
loadingInstance?.close()
console.error('err' + error) // for debug
Message({
message: /Network Error/g.test(error) ? "网络错误" : "系统错误",
message: /Network Error/g.test(error) ? "网络错误" : (/timeout/g.test(error) ? "网络超时" : "系统错误"),
type: 'error',
duration: 5 * 1000
})

@ -0,0 +1,70 @@
<template>
<div>
<card-container>
<vxe-toolbar>
<template #buttons>
<el-input placeholder="请输入关键词" clearable size="small" style="width: 200px;margin-right: 6px;"></el-input>
<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 }"
:data="tableData"
>
<vxe-column type="seq" width="58" align="center" />
<vxe-column field="title" width="170" title="通知提醒" />
<vxe-column field="admin.name" width="140" title="发布人" align="center" />
<vxe-column field="" width="120" title="已读状态" />
<vxe-column field="" width="120" title="回复状态" />
<vxe-column field="created_at" width="180" title="发出时间" align="center" />
<vxe-column field="deadline" width="180" title="截止时间" align="center" />
<vxe-column field="operate" title="操作" min-width="220">
<template #default="{ row }">
<el-button size="small" plain type="success" @click="">编辑</el-button>
</template>
</vxe-column>
</vxe-table>
</card-container>
</div>
</template>
<script>
import { index } from "@/api/noticeUser";
export default {
data() {
return {
loading: false,
tableData: [],
total: 0,
}
},
created() {
this.getList()
},
methods: {
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
}
},
},
computed: {},
}
</script>
<style scoped lang="scss">
</style>

@ -108,7 +108,7 @@
<script>
import { getToken } from "@/utils/auth";
import { save } from "@/api/notice";
import { save, show } from "@/api/notice";
import { PopupManager } from "element-ui/lib/utils/popup";
import { userListNoAuth as index } from "@/api/common";
export default {
@ -121,6 +121,8 @@ export default {
},
data() {
return {
type: 'add',
id: '',
users: [],
zIndex: PopupManager.nextZIndex(),
loading: false,
@ -144,6 +146,13 @@ export default {
isShow(newVal) {
if(newVal) {
this.zIndex = PopupManager.nextZIndex()
if (this.type === 'edit') {
this.getDetail()
}
} else {
this.type = 'add'
this.id = ''
}
}
},
@ -174,6 +183,11 @@ export default {
this.$refs["elForm"].validate(async (valid) => {
if (valid) {
this.loading = true;
if (this.type === 'add') {
delete this.form.id
} else {
this.form.id = this.id
}
try {
this.form.file_ids = this.fileList.map(i => i.response?.data?.id).filter(i => !!i)
await save(this.form);
@ -196,9 +210,34 @@ export default {
})
this.users = res.data
} catch (err) {
}
},
async getDetail () {
try {
if (this.id) {
const res = await show({
id: this.id,
'show_relation[]': 'users'
})
console.log(res)
for (let key in this.form) {
if (res.hasOwnProperty(key)) {
this.form[key] = res[key]
}
}
this.fileList = res.files.map(i => ({
name: i.original_name,
url: i.url,
response: i
}))
this.form.user_ids = res.users.map(i => ({ user_id: i.id }))
}
} catch (err) {
}
}
},
}
};
</script>

@ -20,11 +20,18 @@
:align="allAlign"
:data="tableData"
>
<vxe-column field="users" title="通知人员" type="expand" width="60" align="center">
<template #content="{ row }">
<div style="padding: 10px;white-space: pre-wrap;">
<el-tag v-for="item in row.users" type="success" style="margin: 4px;">{{ item.name }} </el-tag>
</div>
</template>
</vxe-column>
<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="admin.name" width="150" title="发布人" align="center" />
<vxe-column field="created_at" width="140" title="发出时间" align="center" />
<vxe-column field="deadline" width="140" title="截止时间" align="center" :edit-render="{ name: 'input', attrs: { type: 'number' } }" />
<vxe-column field="title" width="170" title="通知提醒" />
<vxe-column field="admin.name" width="140" title="发布人" align="center" />
<vxe-column field="created_at" width="180" title="发出时间" align="center" />
<vxe-column field="deadline" width="180" title="截止时间" align="center" />
<vxe-column field="operate" title="操作" min-width="220">
<template #default="{ row }">
<template v-if="isActiveStatus(row)">
@ -76,7 +83,9 @@ export default {
loading: false,
select: {
page: 1,
page_size: 20
page_size: 20,
'show_relation[0]': 'admin',
'show_relation[1]': 'users',
},
total: 0,
allAlign: null,
@ -109,9 +118,12 @@ export default {
},
methods: {
editRowEvent(row) {
if (this.$refs['table']) {
this.$refs['table'].setEditRow(row)
}
this.$refs['AddNotice'].id = row.id
this.$refs['AddNotice'].type = 'edit'
this.isShowAdd = true
// if (this.$refs['table']) {
// this.$refs['table'].setEditRow(row)
// }
},
cancelRowEvent(row) {
if (this.$refs['table']) {

Loading…
Cancel
Save