1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<template>
<div class="app-content" style="height:70vh;overflow:auto;">
<div class="submit-btn">
<a-button type="primary" @click="recordClick(null,'create')">添加</a-button>
</div>
<a-table :dataSource="tableData" :columns="columns" rowKey="id" :pagination="false" :loading="loading">
<template slot="state" slot-scope="record">
{{record.state}}
</template>
<template slot="option" slot-scope="record">
<a-button type="link" size="small" @click="recordClick(record,'edit')">修改</a-button>
<a-popconfirm title="删除后不可恢复,确定要删除吗?" ok-text="确定" cancel-text="取消" @confirm="recordClick(record,'del')">
<a-button type="link" size="small">删除</a-button>
</a-popconfirm>
</template>
</a-table>
<a-pagination v-if="pagination.total > 0" :total="pagination.total" show-size-changer show-quick-jumper v-model="pagination.pageIndex" :page-size="pagination.pageSize" :page-size-options="pagination.pageSizeOptions" @showSizeChange="showSizeChange" @change="change" :showTotal="() => `共 ${pagination.total} 条`" />
<a-modal v-model="visible" title="添加/修改" width="60%" :dialog-style="{ top: '14%' }" :footer="null" destroyOnClose>
<record-edit v-model="auditObjectId" :obj="obj" @close="closeWindow" />
</a-modal>
</div>
</template>
<script>
import moment from 'moment'
import { isEmptyParams } from '@/views/utils/common'
import recordEdit from '@/views/manager/project/components/recordEdit';
export default {
name: 'auditRecord',
components: {
recordEdit
},
data () {
return {
form: this.$form.createForm(this, { name: 'assign_search' }),
searchForm: { auditObjectId: null },
tableData: [],
columns: [
{ title: '年度', dataIndex: 'reportYear', align: 'center' },
{ title: '审核单位', dataIndex: 'unitName', align: 'center' },
{ title: '审核人', dataIndex: 'personName', align: 'center' },
{ title: '审核内容', dataIndex: 'auditContent', align: 'center' },
{ title: '审核类型', dataIndex: 'auditTypeName', align: 'center' },
{ title: '审核方式', dataIndex: 'auditMethodName', align: 'center' },
{ title: '审核顺序', dataIndex: 'showIndex', align: 'center' },
{ title: '审核结果', dataIndex: 'auditResultName', align: 'center' },
{ title: '添加时间', dataIndex: 'created', align: 'center' },
{ title: '修改时间', dataIndex: 'updated', align: 'center' },
{ title: '操作', scopedSlots: { customRender: 'option' }, align: 'center', fixed: 'right', width: 120, },
],
pagination: { pageIndex: 1, pageSize: this.$defaultPageSize, total: 0, pageSizeOptions: this.$defaultPageSizeOptions },
loading: true,
visible: false,
auditObjectId: null,
obj: null
}
},
props: {
value: {
type: String,
default: () => {
return null
}
}
},
created () {
this.getListByPage()
},
methods: {
moment,
getListByPage () {
if (!!this.value) {
this.loading = true
this.searchForm.auditObjectId = this.value
let par = { ...this.searchForm, pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize }
this.$api.auditManager.getListByPage(par).then(({ data = {} }) => {
if (data) {
const { dataList = [], total = 0 } = data
this.tableData = dataList
this.pagination.total = total
this.loading = false
}
}).catch(() => {
this.loading = false
})
} else {
this.loading = false
}
},
change () {
this.getListByPage()
},
showSizeChange (current, pageSize) {
this.pagination.pageIndex = current
this.pagination.pageSize = pageSize
this.getListByPage()
},
search () {
this.pagination.pageIndex = 1
this.getListByPage()
},
reset () {
this.pagination.pageIndex = 1
this.getListByPage()
},
recordClick (record, type) {
if (type === 'create') {
this.auditObjectId = this.value
this.obj = null
this.visible = true
}
if (type === 'edit') {
this.auditObjectId = this.value
this.obj = record
this.visible = true
} else if (type === 'del') {
this.loading = true
this.$api.auditManager.deleteRecord({ id: record.id }).then(({ data = {} }) => {
if (data) {
this.$message.success('删除成功')
this.getListByPage()
}
this.loading = false
}).catch(() => {
this.loading = false
})
}
},
closeWindow (value) {
if (value === 'edit') {
this.visible = false
this.getListByPage()
}
},
},
}
</script>