You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

229 lines
6.0 KiB

2 years ago
<template>
<el-card id="todo-card" class="box-card" shadow="hover">
<div slot="header" class="clearfix">
2 years ago
<SvgIcon style="color: var(--theme-color);width: 22px;height: 22px;" icon-class="notice" />
2 years ago
<span
style="padding-left: 15px"
>待办事项</span>
<i class="el-icon-more" style="margin-left: auto; font-size: 20px" />
</div>
<div style="position: relative;height: 100%;width: 100%;">
<div style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;">
2 years ago
<el-table
v-loading="loading"
style="width: 100%;"
size="mini"
:header-cell-style="{
2 years ago
'font-weight': '600',
'background': '#f8f8f9',
'color': '#515a6e'
}"
2 years ago
element-loading-text="拼命加载中"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(255, 255, 255, 0.8)"
2 years ago
:show-header="false"
:height="tableHeight"
:loading="loading"
2 years ago
:data="list"
2 years ago
>
<el-table-column type="index" width="46" align="center" />
<el-table-column
v-for="(item, index) in table"
:key="index"
:width="item.width"
:label="item.title"
:prop="item.key"
:show-overflow-tooltip="item['show-overflow-tooltip']"
header-align="center"
:align="item.align"
:formatter="item.formatter"
/>
2 years ago
<el-table-column label="操作" header-align="center" min-width="122" fixed="right">
2 years ago
<template #default="{ row }">
2 years ago
<el-button size="mini" style="padding: 5px 10px;" @click="read(row)"></el-button>
2 years ago
<el-button size="mini" type="primary" style="padding: 5px 10px;" @click="handle(row)"></el-button>
</template>
</el-table-column>
</el-table>
2 years ago
</div>
</div>
2 years ago
<vxe-modal
v-model="isShowModal"
2 years ago
:z-index="zIndex"
2 years ago
transfer
show-zoom
2 years ago
:fullscreen="$store.getters.device === 'mobile'"
2 years ago
title="办理"
width="86vw"
height="80vh"
esc-closable
>
2 years ago
<iframe :src="modalUrl" style="width: 100%;height: 100%" frameborder="0" />
2 years ago
</vxe-modal>
2 years ago
</el-card>
</template>
<script>
2 years ago
import { PopupManager } from 'element-ui/lib/utils/popup'
2 years ago
import SvgIcon from '@/components/SvgIcon/index.vue'
import ElementResize from 'element-resize-detector'
2 years ago
import axios from 'axios'
import { getToken } from '@/utils/auth'
2 years ago
export default {
name: 'ToDo',
2 years ago
components: {
SvgIcon
},
layout: {
x: 4,
y: 0,
w: 6,
h: 4,
i: 'ToDo',
2 years ago
name: '待办事项'
},
data() {
return {
2 years ago
zIndex: PopupManager.nextZIndex(),
2 years ago
isShowModal: false,
modalUrl: '/',
2 years ago
select: {
page: 1,
page_size: 10
},
tableHeight: 120,
loading: false,
list: [],
total: 0,
table: [
{
title: '收件时间',
key: 'created_at',
2 years ago
width: 156,
2 years ago
align: 'center',
2 years ago
formatter: (row, column, cellValue) => {
return this.$moment(cellValue).format('YYYY-MM-DD HH:mm:ss')
2 years ago
}
},
{
title: '内容',
2 years ago
key: 'data.title',
2 years ago
align: 'left',
2 years ago
'show-overflow-tooltip': true,
2 years ago
minWidth: 200
2 years ago
}
]
}
},
computed: {},
2 years ago
watch: {
isShowModal(newVal) {
if (newVal) {
this.zIndex = PopupManager.nextZIndex()
2 years ago
} else {
this.modalUrl = ''
2 years ago
}
}
},
2 years ago
created() {
this.getNotices()
},
mounted() {
this.init()
},
methods: {
2 years ago
test() {
console.log(this.list.abc.ddd)
},
2 years ago
async getNotices() {
try {
this.loading = true
2 years ago
const res = await axios.get(`${process.env.VUE_APP_BASE_API}/api/notification/todo`, {
2 years ago
headers: {
'Authorization': `Bearer ${getToken()}`
},
params: this.select
})
if (res.status === 200) {
2 years ago
this.list = res.data.data?.data
2 years ago
}
2 years ago
this.loading = false
2 years ago
} catch (err) {
console.error(err)
2 years ago
this.loading = false
}
},
init() {
const cardDom = document.getElementById('todo-card')
const cardTitleH = 59
2 years ago
const elementResize = ElementResize({
strategy: 'scroll'
})
elementResize.listenTo(cardDom, (ele) => {
this.tableHeight =
cardDom.getBoundingClientRect().height -
40 -
cardTitleH
})
2 years ago
},
2 years ago
async read(row) {
try {
this.loading = true
const res = await axios.get(`${process.env.VUE_APP_BASE_API}/api/notification/read`, {
headers: {
'Authorization': `Bearer ${getToken()}`
},
params: {
id: row.id
}
})
if (res.status === 200) {
await this.getNotices()
}
this.loading = false
} catch (err) {
console.error(err)
this.loading = false
2 years ago
}
},
handle(row) {
2 years ago
try {
2 years ago
const data = row.data
2 years ago
if (data.from === 'ht') {
1 year ago
this.modalUrl = `/${data.from}/#/contract/contractList?auth_token=${window.encodeURIComponent(getToken())}&module_name=${data.from}&keyword=${(/\[(.*?)]/.exec(data.title) ? /\[(.*?)]/.exec(data.title)[1] : '')}&isSinglePage=1`
2 years ago
} else if (data.from === 'oa') {
1 year ago
this.modalUrl = `/${data.from}/#/flow/create?auth_token=${window.encodeURIComponent(getToken())}&module_name=${data.from}&flow_id=${data.other?.flow_id}&isSinglePage=1`
2 years ago
}
console.log(this.modalUrl)
this.isShowModal = true
} catch (err) {
this.$message.warning('未找到流程')
console.error(err)
2 years ago
}
2 years ago
}
}
}
</script>
<style scoped lang="scss">
::v-deep .el-card__body {
width: 100%;
height: calc(100% - 58px);
}
2 years ago
::v-deep .el-table th,::v-deep .el-table td {
2 years ago
border-bottom-style: dashed;
}
.clearfix {
display: flex;
align-items: center;
}
2 years ago
::v-deep .vxe-modal--content {
padding: 0;
}
2 years ago
</style>