#
Junjie
2024-07-16 796289b86174721ee41ecba7add7a4526afe5ec4
#
2个文件已添加
6个文件已修改
267 ■■■■■ 已修改文件
zy-asrs-admin/.babelrc 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-admin/package-lock.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-admin/package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-admin/src/utils/tableUtils.jsx 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-admin/src/views/system/language/index.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-admin/src/views/system/operationRecord/index.vue 174 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-framework/src/main/java/com/zy/asrs/framework/generators/VueGenerator.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-framework/src/main/resources/templates/vue/Index.txt 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-admin/.babelrc
New file
@@ -0,0 +1,10 @@
{
  "plugins": [
    [
      "@vue/babel-plugin-jsx",
      {
        "theme": "vue3"
      }
    ]
  ]
}
zy-asrs-admin/package-lock.json
@@ -19,6 +19,7 @@
      },
      "devDependencies": {
        "@vitejs/plugin-vue": "^5.0.5",
        "@vue/babel-plugin-jsx": "^1.2.2",
        "vite": "^5.3.1"
      }
    },
zy-asrs-admin/package.json
@@ -20,6 +20,7 @@
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^5.0.5",
    "@vue/babel-plugin-jsx": "^1.2.2",
    "vite": "^5.3.1"
  }
}
zy-asrs-admin/src/utils/tableUtils.jsx
New file
@@ -0,0 +1,56 @@
import { formatMessage } from '@/utils/localeUtils.js';
import { ref } from 'vue';
export default function useTableSearch() {
    const searchText = ref('');
    const searchedColumn = ref('');
    const handleSearch = (selectedKeys, confirm, dataIndex) => {
      confirm();
      searchText.value = selectedKeys[0];
      searchedColumn.value = dataIndex;
    };
    const handleReset = (clearFilters) => {
      clearFilters({
        confirm: true,
      });
      searchText.value = '';
    };
    const getColumnSearchProps = (dataIndex) => ({
      filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
        <div style="padding: 8px">
          <a-input
            v-model:value={selectedKeys[0]}
            placeholder={formatMessage('common.search.placeholder','请搜索')}
            style="width: 188px; margin-bottom: 8px; display: block;"
            onChange={(e) => setSelectedKeys(e.target.value ? [e.target.value] : [])}
            onPressEnter={() => handleSearch(selectedKeys, confirm, dataIndex)}
          />
          <a-button
            type="primary"
            onClick={() => handleSearch(selectedKeys, confirm, dataIndex)}
            size="small"
            style="width: 90px; margin-right: 8px"
          >
            {formatMessage('common.search','搜索')}
          </a-button>
          <a-button onClick={() => handleReset(clearFilters)} size="small" style="width: 90px">
            {formatMessage('common.reset','重置')}
          </a-button>
        </div>
      ),
      onFilter: (value, record) =>
        record[dataIndex]
          ? record[dataIndex].toString().toLowerCase().includes(value.toLowerCase())
          : '',
    });
    return {
        searchText,
        searchedColumn,
        getColumnSearchProps,
      };
}
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();
@@ -19,42 +20,52 @@
let tableData = ref([]);
getPage();
const {
  getColumnSearchProps,
} = useTableSearch();
const columns = [
  {
    title: formatMessage('db.sys_language.name', '名称'),
    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'),
  },
  {
zy-asrs-admin/src/views/system/operationRecord/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();
@@ -19,85 +20,102 @@
let tableData = ref([]);
getPage();
const {
  getColumnSearchProps,
} = useTableSearch();
const columns = [
        {
            title: formatMessage('db.sys_operation_record.namespace', '名称空间'),
            dataIndex: 'namespace',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.sys_operation_record.url', '接口地址'),
            dataIndex: 'url',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.sys_operation_record.appkey', '平台密钥'),
            dataIndex: 'appkey',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.sys_operation_record.timestamp', '时间戳'),
            dataIndex: 'timestamp',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.sys_operation_record.client_ip', '客户端IP'),
            dataIndex: 'clientIp',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.sys_operation_record.request', '请求内容'),
            dataIndex: 'request',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.sys_operation_record.response', '响应内容'),
            dataIndex: 'response',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.sys_operation_record.spend_time', '消耗时间'),
            dataIndex: 'spendTime',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.sys_operation_record.err', '异常内容'),
            dataIndex: 'err',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.sys_operation_record.result', '结果'),
            dataIndex: 'result$',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.sys_operation_record.user_id', '用户'),
            dataIndex: 'userId$',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.sys_operation_record.create_time', '添加时间'),
            dataIndex: 'createTime$',
            width: 140,
            ellipsis: true,
        },
        {
            title: formatMessage('db.sys_operation_record.memo', '备注'),
            dataIndex: 'memo',
            width: 140,
            ellipsis: true,
        },
  {
    title: formatMessage('db.sys_operation_record.namespace', '名称空间'),
    dataIndex: 'namespace',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('namespace'),
  },
  {
    title: formatMessage('db.sys_operation_record.url', '接口地址'),
    dataIndex: 'url',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('url'),
  },
  {
    title: formatMessage('db.sys_operation_record.appkey', '平台密钥'),
    dataIndex: 'appkey',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('appkey'),
  },
  {
    title: formatMessage('db.sys_operation_record.timestamp', '时间戳'),
    dataIndex: 'timestamp',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('timestamp'),
  },
  {
    title: formatMessage('db.sys_operation_record.client_ip', '客户端IP'),
    dataIndex: 'clientIp',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('clientIp'),
  },
  {
    title: formatMessage('db.sys_operation_record.request', '请求内容'),
    dataIndex: 'request',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('request'),
  },
  {
    title: formatMessage('db.sys_operation_record.response', '响应内容'),
    dataIndex: 'response',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('response'),
  },
  {
    title: formatMessage('db.sys_operation_record.spend_time', '消耗时间'),
    dataIndex: 'spendTime',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('spendTime'),
  },
  {
    title: formatMessage('db.sys_operation_record.err', '异常内容'),
    dataIndex: 'err',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('err'),
  },
  {
    title: formatMessage('db.sys_operation_record.result', '结果'),
    dataIndex: 'result$',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('result$'),
  },
  {
    title: formatMessage('db.sys_operation_record.user_id', '用户'),
    dataIndex: 'userId$',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('userId$'),
  },
  {
    title: formatMessage('db.sys_operation_record.create_time', '添加时间'),
    dataIndex: 'createTime$',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('createTime$'),
  },
  {
    title: formatMessage('db.sys_operation_record.memo', '备注'),
    dataIndex: 'memo',
    width: 140,
    ellipsis: true,
    ...getColumnSearchProps('memo'),
  },
  {
    title: formatMessage('common.operation', '操作'),
zy-asrs-framework/src/main/java/com/zy/asrs/framework/generators/VueGenerator.java
@@ -783,15 +783,18 @@
            sb.append("        {\n")
                    .append("            title: formatMessage('db.").append(table).append(".").append(column.getName()).append("', '").append(column.getComment()).append("'),").append("\n")
                    .append("            dataIndex: '");
            StringBuilder rowKey = new StringBuilder();
            if ("Date".equals(column.getType()) || !Cools.isEmpty(column.getEnums()) || !Cools.isEmpty(column.getForeignKeyMajor())){
                // 时间、枚举  格式化  主键修饰
                sb.append(column.getHumpName()).append("\\$");
                rowKey.append(column.getHumpName()).append("\\$");
            } else {
                sb.append(column.getHumpName());
                rowKey.append(column.getHumpName());
            }
            sb.append(rowKey);
            sb.append("',\n")
                    .append("            width: 140,\n")
                    .append("            ellipsis: true,\n");
                    .append("            ellipsis: true,\n")
                    .append("            ...getColumnSearchProps('").append(rowKey).append("'),\n");
//            if (!Cools.isEmpty(column.getEnums())) {
//                sb.append("                customRender: (column) => {\n");
//                sb.append("                  let typeMap = {");
zy-asrs-framework/src/main/resources/templates/vue/Index.txt
@@ -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();
@@ -19,6 +20,10 @@
let tableData = ref([]);
getPage();
const {
  getColumnSearchProps,
} = useTableSearch();
const columns = [
@{TABLECOLUMNS}
  {