#
Junjie
2025-02-14 ac4341ea6b66ae02427d39d35f41d42d78b2eb2e
zy-asrs-admin/src/views/system/language/index.vue
@@ -6,6 +6,7 @@
import { logout } from '@/config.js';
import EditView from './edit.vue'
import { formatMessage } from '@/utils/localeUtils.js';
import useTableSearch from '@/utils/tableUtils.jsx';
const context = getCurrentInstance()?.appContext.config.globalProperties;
const router = useRouter();
@@ -16,8 +17,17 @@
const searchInput = ref("")
const editChild = ref(null)
const state = reactive({
  selectedRowKeys: [],
  loading: false,
});
let tableData = ref([]);
getPage();
const {
  getColumnSearchProps,
} = useTableSearch();
const columns = [
  {
@@ -25,36 +35,42 @@
    dataIndex: 'name',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('name'),
  },
  {
    title: formatMessage('db.sys_language.language_id', '国际化ID'),
    dataIndex: 'languageId',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('languageId'),
  },
  {
    title: formatMessage('db.sys_language.locale', '地区'),
    dataIndex: 'locale',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('locale'),
  },
  {
    title: formatMessage('db.sys_language.create_time', '添加时间'),
    dataIndex: 'createTime$',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('createTime$'),
  },
  {
    title: formatMessage('db.sys_language.update_time', '修改时间'),
    dataIndex: 'updateTime$',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('updateTime$'),
  },
  {
    title: formatMessage('db.sys_language.memo', '备注'),
    dataIndex: 'memo',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('memo'),
  },
  {
@@ -66,10 +82,6 @@
  },
];
const state = reactive({
  selectedRowKeys: [],
  loading: false,
});
const hasSelected = computed(() => state.selectedRowKeys.length > 0);
const start = () => {
  state.loading = true;
@@ -85,6 +97,8 @@
};
function getPage() {
  state.loading = true;
  post('/api/language/page', {
    current: currentPage,
    pageSize: pageSize,
@@ -94,6 +108,8 @@
    if (result.code == 200) {
      let data = result.data;
      tableData.value = data;
      state.loading = false;
    } else if (result.code === 401) {
      message.error(result.msg);
      logout()
@@ -135,7 +151,9 @@
}
const handleExport = async (intl) => {
  postBlob('/api/language/export', {}).then(result => {
  postBlob('/api/language/export', {
    condition: searchInput.value
  }).then(result => {
    const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' });
    window.location.href = window.URL.createObjectURL(blob);
    return true;
@@ -179,7 +197,7 @@
    <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }"
      :data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id"
      :pagination="{ total: tableData.total, onChange: onPageChange }"
      :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns">
      :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns" :loading="state.loading">
      <template #bodyCell="{ column, text, record }">
        <template v-if="column.dataIndex === 'oper'">
          <div style="display: flex;justify-content: space-evenly;">