123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
- <div class="app-container">
- <SearchBoxVue :data="searchData" :objects="objects" :departments="departments" @search="handleSearch" @reset="handleReset" />
- <TableBoxVue :loading="loading" :data="tableData" :objects="objects" :departments="departments" @refresh="handleRefresh" />
- <pagination
- :auto-scroll="false"
- :total="paginationData.total"
- :page="paginationData.page"
- :limit="paginationData.limit"
- @pagination="handlePagination"
- />
- </div>
- </template>
- <script>
- import SearchBoxVue from './components/SearchBox.vue'
- import TableBoxVue from './components/TableBox.vue'
- import { get_select_object, get_select_department, get_rule_list } from '@/api/rule/config'
- export default {
- components: {
- SearchBoxVue,
- TableBoxVue
- },
- data() {
- return {
- loading: false,
- searchData: {
- changjing: [],
- department: [],
- object: '',
- type: '',
- is_not: '',
- description: '',
- score: undefined,
- error_level: '',
- status: ''
- },
- tableData: [],
- paginationData: {
- total: 0,
- page: 1,
- limit: 10
- },
- objects: [],
- departments: []
- }
- },
- created() {
- this.getObjectData()
- this.getDepartmentData()
- this.getList()
- },
- methods: {
- // 质控项目
- getObjectData() {
- get_select_object().then(res => {
- const { p } = res
- this.objects = Array.isArray(p) ? p : []
- console.log(this.objects)
- })
- },
- // 质控科室
- getDepartmentData() {
- get_select_department().then(res => {
- const { p } = res
- this.departments = Array.isArray(p) ? p : []
- })
- },
- handleRefresh() {
- this.getList()
- },
- async getList() {
- const { page, limit } = this.paginationData
- const params = {
- ...this.searchData,
- page,
- page_size: limit
- }
- this.loading = true
- get_rule_list(params).then(res => {
- const { p } = res
- this.paginationData.total = p.count
- this.tableData = p.list
- }).catch(error => {
- console.log(error)
- }).finally(() => {
- this.loading = false
- })
- },
- handlePagination(param) {
- this.paginationData.page = param.page
- this.paginationData.limit = param.limit
- this.getList()
- },
- handleSearch() {
- this.paginationData.page = 1
- this.getList()
- },
- handleReset() {
- this.searchData = {
- changjing: [],
- department: [],
- object: '',
- type: '',
- is_not: '',
- description: '',
- score: undefined,
- error_level: '',
- status: ''
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|