# Trae Project Coding Rules
## 1. List Page Architecture
All list pages must follow this standard structure:
```vue
[Action Name]
```
## 2. Component Specifications
### A. Search Component (`components/page-search.vue`)
* **Wrapper**: Must use ``.
* **Core Component**: Use `` or ``.
* **Configuration**:
* `formItems`: Reactive array defining fields (`type`, `label`, `prop`).
* `initKeys`: Object defining default values.
* **Interaction**: Emit `search` event with query parameters.
### B. Table Configuration (`index.vue`)
* **`pageConfig` Object**:
* `pageUrl`: Backend API endpoint for pagination (Required).
* `rowKey`: Unique identifier (usually `'id'`).
* `fileName`: Default filename for exports.
* `cacheKey`: Unique key for column caching.
* **`columns` Array**:
* Standard props: `label`, `prop`, `align: 'center'`, `width/minWidth`.
* Action column: `{ columnKey: 'action', label: '操作', width: 200, fixed: 'right', slot: 'action' }`.
## 3. Common Patterns & Best Practices
### A. Data Dictionary
* Use `` component for status/enum fields.
* Example: ``
### B. User Interface
* **Avatars**: Combine `` with `` in a flex column.
* **Icons**: Import from `@/components/icons` (e.g., `DownloadOutlined`, `PlusOutlined`).
### C. Interaction Logic
* **Refresh**: `pageRef.value?.reload(where)`.
* **Confirmations**: Use built-in table methods:
```javascript
pageRef.value?.messageBoxConfirm({
message: 'Confirm text?',
fetch: () => request.post('/api/path', { id: row.id })
});
```
* **Batch Operations**: Use `pageRef.value?.operatBatch({...})`.
## 4. Permissions
* Use `v-permission` directive on all action buttons.
* Format: `'module:submodule:action'` (e.g., `'customer:blacklist:remove'`).
## 5. Dependencies
* **Request Utility**: `import request from '@/utils/request';`
* **Common Table**: `import CommonTable from '@/components/CommonPage/CommonTable.vue';`