|
|
@@ -1,7 +1,92 @@
|
|
|
<!-- 基础数据管理-错误码管理 -->
|
|
|
<template>
|
|
|
- <app-view></app-view>
|
|
|
+ <app-view>
|
|
|
+ <template #header>
|
|
|
+ <app-filter :option="filterOption" />
|
|
|
+ </template>
|
|
|
+ <app-table :data="dataList" showIndex :columns="tableColumns" :loading="loading">
|
|
|
+ <!-- 操作 -->
|
|
|
+ <template #operate="{ row }">
|
|
|
+ <app-operation size="small" :data-list="getActionButtons(['base_errorcode_modify'])"
|
|
|
+ @click="(code: string) => openComponent(code, row)" circle />
|
|
|
+ </template>
|
|
|
+ <template #footer>
|
|
|
+ <app-pagination :total="total" v-model:page-size="pageSize" v-model:page-index="pageIndex"
|
|
|
+ @change="onSearch" />
|
|
|
+ </template>
|
|
|
+ </app-table>
|
|
|
+ <component :is="componentMap.get(componentId)" v-bind="{ record }" @closed="closeComponent"
|
|
|
+ v-if="componentId" />
|
|
|
+ </app-view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
+import { ref } from 'vue'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
+import { useDataFilter } from '@/hooks/datatable-v2'
|
|
|
+import { useRequest } from '@/hooks/request'
|
|
|
+import { useOperation } from '@/hooks/operation'
|
|
|
+import { queryError } from '@/services/api/base'
|
|
|
+import { i18n } from '@/stores'
|
|
|
+import { useEnum } from '@/hooks/enum'
|
|
|
+import AppTable from '@pc/components/base/table/index.vue'
|
|
|
+import AppPagination from '@pc/components/base/pagination/index.vue'
|
|
|
+import AppOperation from '@pc/components/base/operation/index.vue'
|
|
|
+import AppFilter from '@pc/components/base/table-filter-v2/index.vue'
|
|
|
+
|
|
|
+const { global: { t } } = i18n
|
|
|
+// 状态
|
|
|
+const iptypeEnum = useEnum('iptype')
|
|
|
+
|
|
|
+const { componentMap, componentId, record, openComponent, closeComponent, getActionButtons } = useOperation<Base.ErrorRsp>({
|
|
|
+ onClose: () => onSearch()
|
|
|
+})
|
|
|
+
|
|
|
+const { dataList, total, pageSize, pageIndex, loading, run } = useRequest(queryError, {
|
|
|
+ params: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 20
|
|
|
+ },
|
|
|
+ onError: (err) => {
|
|
|
+ ElMessage.error(err)
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const tableColumns = ref<Model.TableColumn[]>([
|
|
|
+ { field: 'errorid', label: 'base.errorcode.errorid' },
|
|
|
+ { field: 'errorcode', label: 'base.errorcode.errorcode', formatValue: (val) => iptypeEnum.getEnumTypeName(val) },
|
|
|
+ { field: 'operatecode', label: 'base.errorcode.operatecode', formatValue: (val) => iptypeEnum.getEnumTypeName(val) },
|
|
|
+ { field: 'description', label: 'base.errorcode.description', formatValue: (val) => iptypeEnum.getEnumTypeName(val) },
|
|
|
+ { field: 'operate', label: 'common.operate', fixed: 'right' }
|
|
|
+])
|
|
|
+
|
|
|
+const { filterOption, getQueryParams, resetFilters } = useDataFilter<Base.ErrorReq>({
|
|
|
+ filters: [
|
|
|
+ {
|
|
|
+ field: 'errorid',
|
|
|
+ label: '错误号',
|
|
|
+ placeholder: t('base.errorcode.placeholder'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'errorcode',
|
|
|
+ label: '错误代码',
|
|
|
+ placeholder: t('common.placeholder'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'description',
|
|
|
+ label: '错误描述',
|
|
|
+ placeholder: t('common.placeholder'),
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ buttons: [
|
|
|
+ { label: t('operation.search'), className: 'el-button--primary', onClick: () => onSearch() },
|
|
|
+ { label: t('operation.reset'), className: 'el-button--primary', validateEvent: false, onClick: () => resetFilters() }
|
|
|
+ ]
|
|
|
+})
|
|
|
+
|
|
|
+const onSearch = () => {
|
|
|
+ const qs = getQueryParams()
|
|
|
+ run(qs)
|
|
|
+}
|
|
|
+
|
|
|
</script>
|