mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
fix(web): repair merge-corrupted views and restore build
- global.scss: restore scrollbar-style mixin and dialog overlay tiers
- ModelConfig/ModelEditDialog/home: replace /deep/ with ::v-deep, fix CSS
comments and malformed template nesting
- AgentTemplateManagement/DictManagement/ParamsManagement/VoiceCloneManagement:
restore script blocks corrupted by merge conflict resolution
- package.json: re-add v-code-diff; npm run build passes cleanly
- router: drop KnowledgeFileUpload route (view removed upstream in 0eb0a600)
- login/register: point legal links at -en pages, delete duplicate CN html
This commit is contained in:
parent
a72af7e55f
commit
bb74a719a1
15 changed files with 898 additions and 1996 deletions
64
main/manager-web/package-lock.json
generated
64
main/manager-web/package-lock.json
generated
|
|
@ -18,6 +18,7 @@
|
|||
"opus-decoder": "^0.7.7",
|
||||
"opus-recorder": "^8.0.5",
|
||||
"sm-crypto": "^0.4.0",
|
||||
"v-code-diff": "^1.16.0",
|
||||
"vue": "^2.6.14",
|
||||
"vue-axios": "^3.5.2",
|
||||
"vue-i18n": "^8.28.2",
|
||||
|
|
@ -2275,9 +2276,6 @@
|
|||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -2900,9 +2898,6 @@
|
|||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -2917,9 +2912,6 @@
|
|||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -2934,9 +2926,6 @@
|
|||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -2951,9 +2940,6 @@
|
|||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -2968,9 +2954,6 @@
|
|||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -2985,9 +2968,6 @@
|
|||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3002,9 +2982,6 @@
|
|||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3019,9 +2996,6 @@
|
|||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3036,9 +3010,6 @@
|
|||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3053,9 +3024,6 @@
|
|||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3070,9 +3038,6 @@
|
|||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3087,9 +3052,6 @@
|
|||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -3104,9 +3066,6 @@
|
|||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -13595,6 +13554,27 @@
|
|||
"uuid": "bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/v-code-diff": {
|
||||
"version": "1.16.0",
|
||||
"resolved": "https://registry.npmmirror.com/v-code-diff/-/v-code-diff-1.16.0.tgz",
|
||||
"integrity": "sha512-xNhzfK/OHgVs86T1Wnjb1YqSAYHXhmwAAYm8G7yVWuc96j9QWyIhG1xirWMjrzlkJr3KRGR+TUKqG23P5bl8Pg==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"diff": "^5.2.2",
|
||||
"diff-match-patch": "^1.0.5",
|
||||
"highlight.js": "^11.12.0",
|
||||
"vue-demi": "^0.14.10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vue/composition-api": "^1.4.9",
|
||||
"vue": "^2.6.0 || >=3.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@vue/composition-api": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/validate-npm-package-license": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
"opus-decoder": "^0.7.7",
|
||||
"opus-recorder": "^8.0.5",
|
||||
"sm-crypto": "^0.4.0",
|
||||
"v-code-diff": "^1.16.0",
|
||||
"vue": "^2.6.14",
|
||||
"vue-axios": "^3.5.2",
|
||||
"vue-i18n": "^8.28.2",
|
||||
|
|
|
|||
|
|
@ -1,98 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Privacy Policy - Xiao Zhi Backend Service</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
|
||||
line-height: 1.8;
|
||||
color: #333;
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
padding: 20px 30px;
|
||||
background: #f9f9fb;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2 {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 18px;
|
||||
margin-top: 30px;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 8px 0;
|
||||
text-indent: 2em;
|
||||
}
|
||||
|
||||
.update-date {
|
||||
text-align: center;
|
||||
color: #888;
|
||||
font-size: 14px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Privacy Policy</h1>
|
||||
<div class="update-date">Last updated: March 10, 2026</div>
|
||||
|
||||
<h2>Introduction</h2>
|
||||
<p>Welcome to the Xiao Zhi backend service (the "Service"). We are committed to protecting your personal information. This Policy explains what information we collect, how we use it, and how we protect it when you use the Service.</p>
|
||||
<p class="bold">Please read this Policy carefully before using the Service. By using the Service, you agree to the practices described here.</p>
|
||||
|
||||
<h2>1. Information We Collect</h2>
|
||||
<p>We may collect account information, device identifiers, device model and firmware data, agent configuration data, voice interaction data, image data, chat history, knowledge base content, voiceprint samples, logs, and verification information when needed to operate the Service.</p>
|
||||
<p>When you use voice, vision, memory, knowledge base, or OTA features, we may process the related content to provide those features.</p>
|
||||
|
||||
<h2>2. How We Use Information</h2>
|
||||
<p>We use the information we collect to provide, maintain, and improve the Service, manage accounts and devices, support AI interactions, store summaries and history, deliver support, and meet legal obligations.</p>
|
||||
<p class="bold">We do not use your personal information for purposes unrelated to the Service unless we have your consent or are otherwise permitted by law.</p>
|
||||
|
||||
<h2>3. Sharing and Disclosure</h2>
|
||||
<p class="bold">We do not sell your personal information.</p>
|
||||
<p>We may share information with third-party service providers only when necessary to provide AI, speech, or vision features, comply with law, protect safety and security, or with your consent.</p>
|
||||
|
||||
<h2>4. Storage and Protection</h2>
|
||||
<p>Your information may be stored on the servers used to operate the Service, including databases and caches. We use reasonable technical and administrative safeguards such as encryption, access control, and auditing to help protect that information.</p>
|
||||
<p class="bold">No method of transmission or storage is completely secure. Please avoid entering sensitive personal or financial information unless it is necessary for the feature you are using.</p>
|
||||
|
||||
<h2>5. Open Source and Deployment Modes</h2>
|
||||
<p>The Service is an open source project and can be self-hosted or operated as a managed test platform. If you self-host the Service, you are responsible for your own deployment and data protection practices. If you use a deployment run by another party, that operator is responsible for their own data handling practices.</p>
|
||||
|
||||
<h2>6. Cross-Border Processing</h2>
|
||||
<p>Some features may rely on third-party AI providers located in other jurisdictions. If you choose to use those providers, your data may be transferred and processed outside your local region, subject to the provider's own policies and the applicable law.</p>
|
||||
|
||||
<h2>7. Your Rights</h2>
|
||||
<p>Depending on your location, you may have rights to access, correct, delete, or restrict the use of your personal information. You may also have the right to object to or request portability of your information, subject to applicable law.</p>
|
||||
|
||||
<h2>8. Minors</h2>
|
||||
<p>The Service is not intended for children under the age required by applicable law. If a minor uses the Service, a parent or legal guardian should supervise the use and help protect the minor's privacy.</p>
|
||||
|
||||
<h2>9. Changes to This Policy</h2>
|
||||
<p>We may update this Policy from time to time. We will publish the updated version and change the "Last updated" date above when we do so.</p>
|
||||
|
||||
<h2>10. Contact</h2>
|
||||
<p>If you have questions about this Policy, please contact the operator of the Service through the support channels provided in the product or project documentation.</p>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -1,143 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>User Agreement - Xiao Zhi Backend Service</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
|
||||
line-height: 1.8;
|
||||
color: #333;
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
padding: 20px 30px;
|
||||
background: #f9f9fb;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 18px;
|
||||
margin-top: 30px;
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 8px 0;
|
||||
text-indent: 2em;
|
||||
}
|
||||
|
||||
.update-date {
|
||||
text-align: center;
|
||||
color: #888;
|
||||
font-size: 14px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>User Agreement</h1>
|
||||
<div class="update-date">Last updated: March 10, 2026</div>
|
||||
|
||||
<h2>Notice</h2>
|
||||
<p>Welcome to the Xiao Zhi backend service (the "Service"). The Service provides backend support for connected AI hardware, including voice interaction, visual understanding, intent recognition, memory, knowledge base access, device management, and agent management. The Service is operated by the party that deploys and administers it (the "Operator", "we", or "us").</p>
|
||||
<p class="bold">Please read this Agreement carefully before registering, logging in, or otherwise using the Service. Certain terms, including disclaimers and limitations of liability, may affect your legal rights and deserve special attention.</p>
|
||||
<p class="bold">By creating an account, logging in, or otherwise using the Service, you confirm that you have read, understood, and agreed to this Agreement. If you do not agree, do not use the Service.</p>
|
||||
<p>This Agreement may be updated from time to time. Updated terms will be announced through the Service or related channels and become effective when published. Continued use of the Service after publication means you accept the updated terms.</p>
|
||||
|
||||
<h2>1. Definitions</h2>
|
||||
<p><span class="bold">Service:</span> The Xiao Zhi backend service and the systems it operates, including the admin console, API interfaces, WebSocket services, and related components.</p>
|
||||
<p><span class="bold">Admin Console:</span> The web management interface used for device management, agent configuration, and user management.</p>
|
||||
<p><span class="bold">User:</span> Any individual, organization, or entity that accesses or uses the Service.</p>
|
||||
<p><span class="bold">Agent:</span> An AI role configured in the Service, combining capabilities such as language models, speech recognition, speech synthesis, visual understanding, intent recognition, memory, and knowledge base access.</p>
|
||||
<p><span class="bold">Device:</span> An ESP32 or similar hardware device connected through the Service.</p>
|
||||
|
||||
<h2>2. Scope</h2>
|
||||
<p>This Agreement governs your use of the Service. It applies to all activity conducted through the Admin Console or any other supported interface.</p>
|
||||
<p>The Service is open source and subject to its own license terms. This Agreement governs your use of the Service and does not limit your rights under the applicable open source license.</p>
|
||||
|
||||
<h2>3. Account Registration and Use</h2>
|
||||
<p><span class="bold">3.1 Eligibility:</span> You confirm that you have the legal capacity to enter into this Agreement. If you are a minor, you should use the Service only with the guidance and consent of a parent or legal guardian.</p>
|
||||
<p><span class="bold">3.2 Registration:</span> You may register and log in using supported methods such as a phone verification code or username and password. You must provide accurate, complete, and up-to-date information.</p>
|
||||
<p><span class="bold">3.3 Account Security:</span> You are responsible for safeguarding your account credentials. Any loss caused by disclosure, misuse, or unauthorized access resulting from your own actions is your responsibility.</p>
|
||||
<p><span class="bold">3.4 Use Restrictions:</span> Your account is for your own use only. You may not transfer, lease, or lend it to any third party without the Operator's consent.</p>
|
||||
<p><span class="bold">3.5 Account Deletion:</span> You may delete your account through the account settings or by contacting the Operator. Deleted data may not be recoverable, so please act carefully.</p>
|
||||
|
||||
<h2>4. Service Content</h2>
|
||||
<p><span class="bold">4.1 Overview:</span> The Service uses AI technologies and third-party model APIs to provide interactive functionality for connected devices, including voice activity detection, speech recognition, language modeling, speech synthesis, visual understanding, intent recognition, memory, and knowledge base retrieval.</p>
|
||||
<p><span class="bold">4.2 Agent Management:</span> You may create and configure agents, including role templates, model selection, speech settings, intent rules, knowledge bases, memory, and plugin settings. Agent content must not violate applicable law.</p>
|
||||
<p><span class="bold">4.3 Device Management:</span> You may bind and manage devices, update firmware, and perform OTA upgrades. You must ensure that the devices you manage are lawfully owned or authorized for your use.</p>
|
||||
<p><span class="bold">4.4 Visual Understanding:</span> If you use camera-based features, you must comply with applicable laws and respect the privacy of others.</p>
|
||||
<p><span class="bold">4.5 Intent Recognition:</span> The Service may interpret user intent and trigger corresponding actions or services, such as device control or information lookup.</p>
|
||||
<p><span class="bold">4.6 Memory:</span> The Service may store summaries of interactions to improve continuity and personalization. You may manage or delete this data through the Admin Console.</p>
|
||||
<p><span class="bold">4.7 Knowledge Base:</span> You may upload documents or text to build a knowledge base. You are responsible for ensuring the uploaded content does not infringe third-party rights or violate applicable law.</p>
|
||||
<p><span class="bold">4.8 Voiceprint Recognition:</span> The Service may support voiceprint enrollment for identity verification and personalization.</p>
|
||||
<p><span class="bold">4.9 Voice Cloning:</span> The Service may support custom voice cloning from audio samples. You may not use cloned voices to impersonate others or engage in unlawful activity.</p>
|
||||
<p><span class="bold">4.10 MCP Access:</span> The Service may operate as an MCP server or client to integrate with external systems in a standardized way.</p>
|
||||
<p><span class="bold">4.11 Context Providers:</span> The Service may retrieve external information such as weather, news, or stock data to enrich agent responses.</p>
|
||||
<p><span class="bold">4.12 MQTT:</span> The Service may use MQTT for message exchange with IoT devices.</p>
|
||||
<p><span class="bold">4.13 Service Notice:</span> Outputs from third-party AI models are for reference only and do not constitute professional advice.</p>
|
||||
<p class="bold">4.14 Pricing: The Service is provided as an open source project and does not charge usage fees for the platform itself. Any third-party service fees are governed by the relevant provider.</p>
|
||||
<p><span class="bold">4.15 Changes:</span> The Operator may modify, upgrade, or discontinue the Service from time to time and will attempt to provide advance notice when reasonable.</p>
|
||||
|
||||
<h2>5. User Conduct</h2>
|
||||
<p><span class="bold">5.1 Lawful Use:</span> You must comply with applicable laws and may not use the Service for unlawful, abusive, or harmful activity.</p>
|
||||
<p class="bold">5.2 Prohibited Conduct: You must not:</p>
|
||||
<p>1. Publish, transmit, or store unlawful, harmful, or infringing content.</p>
|
||||
<p>2. Interfere with the Service, including attacks, malware, or abusive resource consumption.</p>
|
||||
<p>3. Reverse engineer, decompile, or otherwise attempt to extract source code except as allowed by the open source license.</p>
|
||||
<p>4. Use automation to abuse quotas or system resources.</p>
|
||||
<p>5. Enter unlawful, offensive, or abusive content into agent configuration or prompts.</p>
|
||||
<p>6. Harm or attempt to harm minors.</p>
|
||||
<p>7. Engage in any other conduct that violates law, this Agreement, or the rights of others.</p>
|
||||
|
||||
<h2>6. Intellectual Property</h2>
|
||||
<p><span class="bold">6.1 Open Source License:</span> The source code is provided under its applicable open source license.</p>
|
||||
<p><span class="bold">6.2 Service Materials:</span> Interface designs, icons, copy, and other original materials created by the Operator remain the Operator's property unless otherwise stated.</p>
|
||||
<p><span class="bold">6.3 User Content:</span> Rights in content you upload, submit, or generate are determined under applicable law. You grant the Operator the rights necessary to store and process content for maintenance and improvement of the Service.</p>
|
||||
<p><span class="bold">6.4 Third-Party Rights:</span> You must respect the intellectual property and other legal rights of third parties.</p>
|
||||
|
||||
<h2>7. Privacy</h2>
|
||||
<p><span class="bold">7.1 Data Collection:</span> To provide the Service, the Operator may collect account information, device information, and usage logs. See the Privacy Policy for details.</p>
|
||||
<p><span class="bold">7.2 Protection:</span> The Operator will take reasonable technical and administrative measures to protect personal information, but cannot guarantee absolute security.</p>
|
||||
<p class="bold">7.3 Security Reminder: Do not share sensitive information such as bank details, passwords, or account credentials with AI systems while using the Service.</p>
|
||||
|
||||
<h2>8. Disclaimer</h2>
|
||||
<p class="bold">8.1 AI Output: Third-party AI models may produce inaccurate, incomplete, or inappropriate results. The Operator makes no guarantee regarding the accuracy or completeness of AI-generated content.</p>
|
||||
<p class="bold">8.2 Service Interruptions: The Operator is not responsible for interruptions or failures caused by force majeure, network outages, third-party service failures, maintenance, security incidents, or legal or regulatory changes.</p>
|
||||
<p><span class="bold">8.3 Third-Party Services:</span> The Service may integrate with third-party language, speech, visual, or intent services. You are responsible for complying with those providers' terms.</p>
|
||||
<p class="bold">8.4 As-Is: The Service is provided "as is" to the maximum extent permitted by law, without warranties of merchantability, fitness for a particular purpose, or non-infringement.</p>
|
||||
<p class="bold">8.5 Open Source Notice: The Service does not maintain custody of account keys, process funds, or guarantee third-party service quality or financial safety.</p>
|
||||
<p class="bold">8.6 Security Notice: The project may be incomplete and has not undergone full security certification. Do not deploy it in production without appropriate safeguards.</p>
|
||||
|
||||
<h2>9. Minors</h2>
|
||||
<p>Users under the age of 18 should use the Service only with parental or guardian guidance and consent.</p>
|
||||
<p>Guardians should supervise minors' use of the Service and encourage responsible use.</p>
|
||||
|
||||
<h2>10. Termination</h2>
|
||||
<p><span class="bold">10.1 User Termination:</span> You may stop using the Service and delete your account at any time.</p>
|
||||
<p><span class="bold">10.2 Operator Termination:</span> The Operator may suspend or terminate access if you violate this Agreement, use the Service unlawfully, or if required by law or operational necessity.</p>
|
||||
<p><span class="bold">10.3 Effect of Termination:</span> After termination, the Operator has no obligation to retain your account data, subject to applicable law.</p>
|
||||
|
||||
<h2>11. Governing Law and Disputes</h2>
|
||||
<p>This Agreement is governed by the laws applicable to the Operator's place of business, unless otherwise required by mandatory law.</p>
|
||||
<p>Any dispute should first be resolved through good-faith negotiation. If negotiation fails, the parties may seek resolution in a court of competent jurisdiction.</p>
|
||||
|
||||
<h2>12. Miscellaneous</h2>
|
||||
<p>This Agreement constitutes the entire agreement between you and the Operator regarding the Service.</p>
|
||||
<p>If any provision is held unenforceable, the remaining provisions remain in effect.</p>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -364,57 +364,92 @@ export default {
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@/styles/global.scss';
|
||||
|
||||
.model-edit-dialog {
|
||||
::v-deep .el-dialog__body {
|
||||
padding: 24px 40px;
|
||||
}
|
||||
|
||||
.header-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
margin-bottom: 10px;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: #3d4566;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.custom-close-btn:hover {
|
||||
color: #409EFF;
|
||||
border-color: #409EFF;
|
||||
.custom-dialog {
|
||||
position: relative;
|
||||
border-radius: 20px;
|
||||
overflow: hidden;
|
||||
background: white;
|
||||
padding-bottom: 17px;
|
||||
}
|
||||
|
||||
.switch-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.custom-dialog .el-dialog__header {
|
||||
padding: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
&.hidden {
|
||||
display: none;
|
||||
}
|
||||
.center-dialog {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.switch-label {
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
.custom-close-btn {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
border-radius: 50%;
|
||||
border: 2px solid #cfcfcf;
|
||||
background: none;
|
||||
font-size: 30px;
|
||||
font-weight: lighter;
|
||||
color: #cfcfcf;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1;
|
||||
padding: 0;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.section-divider {
|
||||
height: 1px;
|
||||
background: #e9e9e9;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
.custom-close-btn:hover {
|
||||
color: #409eff;
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.custom-select .el-input__suffix {
|
||||
background: #e6e8ea;
|
||||
right: 6px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
top: 9px;
|
||||
}
|
||||
|
||||
.custom-select .el-input__suffix-inner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.custom-select .el-icon-arrow-up:before {
|
||||
content: "";
|
||||
display: inline-block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 5px solid transparent;
|
||||
border-right: 5px solid transparent;
|
||||
border-top: 7px solid #c0c4cc;
|
||||
position: relative;
|
||||
top: -2px;
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.custom-form .el-form-item {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.custom-form .el-form-item__label {
|
||||
color: #3d4566;
|
||||
font-weight: normal;
|
||||
text-align: right;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.custom-form .el-form-item.prop-remark .el-form-item__label {
|
||||
margin-top: -4px;
|
||||
|
|
@ -460,7 +495,7 @@ export default {
|
|||
background-color: white;
|
||||
top: 3px;
|
||||
left: 4px;
|
||||
transition: all .3s;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.custom-switch.is-checked .el-switch__core {
|
||||
|
|
@ -493,4 +528,4 @@ export default {
|
|||
text-align: right;
|
||||
padding-right: 20px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -98,17 +98,6 @@ const routes = [
|
|||
title: 'Knowledge Base'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/knowledge-file-upload',
|
||||
name: 'KnowledgeFileUpload',
|
||||
component: function () {
|
||||
return import('../views/KnowledgeFileUpload.vue')
|
||||
},
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
title: 'Document Upload'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
path: '/server-side-management',
|
||||
|
|
|
|||
|
|
@ -11,4 +11,64 @@ select:-webkit-autofill:focus {
|
|||
-webkit-box-shadow: 0 0 0px 1000px transparent inset;
|
||||
transition: background-color 5000s ease-in-out 0s;
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.el-footer {
|
||||
height: 35px !important; /* !important ensures this overrides the default styles */
|
||||
}
|
||||
|
||||
.el-icon-video-play, .el-icon-video-pause {
|
||||
font-size: 18px !important;
|
||||
}
|
||||
|
||||
.is-light {
|
||||
border: 1px solid #e4e7ed !important;
|
||||
color: #595959;
|
||||
font-size: 14px;
|
||||
background: #fafcfe !important;
|
||||
.popper__arrow {
|
||||
border-top-color: #e4e7ed !important;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin scrollbar-style {
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: #a1c9fd;
|
||||
border-radius: 3px;
|
||||
}
|
||||
&::-webkit-scrollbar-track {
|
||||
background: #f0f3fe;
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
// Width tier for large dialogs (used by table dialogs)
|
||||
:root {
|
||||
--dialog-table-max: 1280px;
|
||||
}
|
||||
|
||||
/* Global dialog overlay */
|
||||
.v-modal {
|
||||
background: rgba(15, 23, 42, 0.55) !important;
|
||||
backdrop-filter: blur(2px);
|
||||
}
|
||||
|
||||
/* Center the wrapper of global dialogs */
|
||||
.el-dialog__wrapper.custom-dialog {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* Center the delete-agent confirm dialog wrapper on the home page
|
||||
(not a CustomDialog, so it needs its own selector) */
|
||||
.el-dialog__wrapper.delete-agent-dialog {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: auto;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
:cell-style="{ padding: '10px 20px' }"
|
||||
>
|
||||
<!-- Remove @row-click="handleRowClick" -->
|
||||
<!-- Custom selection column, header shows "Select" text, data rows show checkboxes -->
|
||||
<!-- Customize the selection column: header text 'Select', data rows with checkboxes -->
|
||||
<el-table-column
|
||||
:label="$t('agentTemplateManagement.select')"
|
||||
align="center"
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
<span>{{ scope.row.agentName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- Changed to serial number column and moved here -->
|
||||
<!-- Change to index column and move here -->
|
||||
<el-table-column
|
||||
:label="$t('agentTemplateManagement.serialNumber')"
|
||||
min-width="120"
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- Table bottom operation bar -->
|
||||
<!-- Table bottom action bar -->
|
||||
<div class="table_bottom">
|
||||
<div class="ctrl_btn">
|
||||
<el-button
|
||||
|
|
@ -130,126 +130,69 @@
|
|||
@size-change="handlePageSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
<CustomButton icon="el-icon-search" type="confirm" @click="handleSearch">
|
||||
{{ $t("agentTemplateManagement.search") }}
|
||||
</CustomButton>
|
||||
</div>
|
||||
</div>
|
||||
<CustomTable
|
||||
ref="templateTable"
|
||||
:data="templateList"
|
||||
:columns="tableColumns"
|
||||
:loading="templateLoading"
|
||||
:show-selection="true"
|
||||
:show-operations="true"
|
||||
:operations-label="$t('agentTemplateManagement.action')"
|
||||
:total="total"
|
||||
:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
:page-size-options="pageSizeOptions"
|
||||
@size-change="handlePageSizeChange"
|
||||
@page-change="handlePageChange"
|
||||
>
|
||||
<template slot="selection" slot-scope="scope">
|
||||
<el-checkbox v-model="scope.row.selected" @change="handleRowSelectionChange(scope.row)"></el-checkbox>
|
||||
</template>
|
||||
<template slot="serialNumber" slot-scope="scope">
|
||||
<span>{{ (currentPage - 1) * pageSize + scope.$index + 1 }}</span>
|
||||
</template>
|
||||
<template slot="operations" slot-scope="scope">
|
||||
<el-button size="mini" type="text" @click="editTemplate(scope.row)">
|
||||
{{ $t("agentTemplateManagement.editTemplate") }}
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" @click="deleteTemplate(scope.row)">
|
||||
{{ $t("agentTemplateManagement.deleteTemplate") }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot="footer-btns">
|
||||
<div class="ctrl_btn">
|
||||
<CustomButton :icon="isAllSelected ? 'el-icon-circle-close' : 'el-icon-circle-check'" size="small" @click="handleSelectAll">
|
||||
{{ isAllSelected ? $t("agentTemplateManagement.deselectAll") : $t("agentTemplateManagement.selectAll") }}
|
||||
</CustomButton>
|
||||
<CustomButton type="add" icon="el-icon-plus" size="small" @click="showAddTemplateDialog">
|
||||
{{ $t("agentTemplateManagement.createTemplate") }}
|
||||
</CustomButton>
|
||||
<CustomButton size="small" type="delete" icon="el-icon-delete" @click="batchDeleteTemplate">
|
||||
{{ $t("agentTemplateManagement.batchDelete") }}
|
||||
</CustomButton>
|
||||
</div>
|
||||
</template>
|
||||
</CustomTable>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-footer>
|
||||
<version-footer />
|
||||
</el-footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HeaderBar from "@/components/HeaderBar";
|
||||
import agentApi from "@/apis/module/agent";
|
||||
import VersionFooter from "@/components/VersionFooter.vue";
|
||||
|
||||
export default {
|
||||
name: "AgentTemplateManagement",
|
||||
components: {
|
||||
HeaderBar,
|
||||
VersionFooter
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
// Template related
|
||||
// Template-related
|
||||
templateList: [],
|
||||
templateLoading: false,
|
||||
selectedTemplates: [],
|
||||
isAllSelected: false, // Add select all state
|
||||
isAllSelected: false, // Add select-all state
|
||||
|
||||
search: "",
|
||||
// Pagination related data
|
||||
// Pagination-related data
|
||||
pageSizeOptions: [10, 20, 50, 100],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
tableColumns: [],
|
||||
dialogVisible: false,
|
||||
dialogTitle: "",
|
||||
confirmLoading: false,
|
||||
form: {
|
||||
id: null,
|
||||
agentCode: "Xiaozhi",
|
||||
agentName: "",
|
||||
systemPrompt: "",
|
||||
sort: 0,
|
||||
model: { ...DEFAULT_MODEL_CONFIG }
|
||||
},
|
||||
formRules: {
|
||||
agentName: [
|
||||
{ required: true, message: "Enter assistant nickname", trigger: "blur" }
|
||||
],
|
||||
systemPrompt: [
|
||||
{ required: true, message: "Enter role description", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
originalForm: null
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.initTableColumns();
|
||||
this.loadTemplateList();
|
||||
},
|
||||
// Add hasSelected property in computed section
|
||||
// Add hasSelected property to the computed section
|
||||
computed: {
|
||||
pageCount() {
|
||||
return Math.ceil(this.total / this.pageSize);
|
||||
},
|
||||
visiblePages() {
|
||||
return this.getVisiblePages();
|
||||
},
|
||||
hasSelected() {
|
||||
return this.selectedTemplates.length > 0;
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// Load template list
|
||||
// Improve error handling logic for loadTemplateList method
|
||||
// Improve error handling in the loadTemplateList method
|
||||
loadTemplateList() {
|
||||
this.templateLoading = true;
|
||||
const params = {
|
||||
page: this.currentPage,
|
||||
limit: this.pageSize
|
||||
limit: this.pageSize,
|
||||
};
|
||||
if (this.search) {
|
||||
params.agentName = this.search;
|
||||
|
|
@ -263,7 +206,7 @@ export default {
|
|||
if (res && typeof res === "object") {
|
||||
if (res.data && res.data.code === 0) {
|
||||
const responseData = res.data.data || {};
|
||||
// Add selected property to each template
|
||||
// Add a selected property to each template
|
||||
this.templateList = Array.isArray(responseData.list)
|
||||
? responseData.list.map((item) => ({ ...item, selected: false }))
|
||||
: [];
|
||||
|
|
@ -288,29 +231,36 @@ export default {
|
|||
(error) => {
|
||||
this.templateList = [];
|
||||
this.total = 0;
|
||||
this.$message.error(res?.data?.msg || this.$t("agentTemplateManagement.fetchTemplateFailed"));
|
||||
this.templateLoading = false;
|
||||
this.$message.error(this.$t("common.networkError"));
|
||||
}
|
||||
this.templateLoading = false;
|
||||
},
|
||||
(error) => {
|
||||
this.templateList = [];
|
||||
this.total = 0;
|
||||
this.templateLoading = false;
|
||||
this.$message.error(this.$t("common.networkError"));
|
||||
}
|
||||
);
|
||||
);
|
||||
} catch (error) {
|
||||
this.templateList = [];
|
||||
this.total = 0;
|
||||
this.templateLoading = false;
|
||||
this.$message.error(this.$t("agentTemplateManagement.fetchTemplateBackendError"));
|
||||
}
|
||||
},
|
||||
|
||||
// Search templates
|
||||
handleSearch() {
|
||||
this.currentPage = 1;
|
||||
this.loadTemplateList();
|
||||
if (this.search) {
|
||||
const searchValue = this.search.toLowerCase();
|
||||
const filteredList = this.templateList.filter((template) =>
|
||||
template.agentName.toLowerCase().includes(searchValue)
|
||||
);
|
||||
this.templateList = filteredList;
|
||||
this.total = filteredList.length;
|
||||
} else {
|
||||
this.loadTemplateList();
|
||||
}
|
||||
},
|
||||
|
||||
// Modify showAddTemplateDialog method to navigate to same page as edit page
|
||||
// Modify showAddTemplateDialog to navigate to the same page as the edit page
|
||||
// Show add template dialog
|
||||
showAddTemplateDialog() {
|
||||
// Navigate to template quick config page, not passing templateId parameter means add new
|
||||
// Navigate to the template quick config page. Omitting templateId indicates a new entry
|
||||
this.$router.push({
|
||||
path: "/template-quick-config",
|
||||
});
|
||||
|
|
@ -318,15 +268,12 @@ export default {
|
|||
|
||||
// Edit template
|
||||
editTemplate(row) {
|
||||
// Navigate to template quick config page and pass template ID parameter
|
||||
// Navigate to the template quick config page and pass the template ID parameter
|
||||
this.$router.push({
|
||||
path: "/template-quick-config",
|
||||
query: { templateId: row.id },
|
||||
});
|
||||
},
|
||||
handleDialogConfirm() {
|
||||
this.$refs.dialogForm.validate((valid) => {
|
||||
if (!valid) return;
|
||||
|
||||
// Delete template
|
||||
deleteTemplate(row) {
|
||||
|
|
@ -336,7 +283,7 @@ export default {
|
|||
{
|
||||
confirmButtonText: this.$t("common.confirm"),
|
||||
cancelButtonText: this.$t("common.cancel"),
|
||||
type: "warning"
|
||||
type: "warning",
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
|
|
@ -352,7 +299,7 @@ export default {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res?.data?.msg || this.$t("agentTemplateManagement.deleteFailed"));
|
||||
this.$message.error(this.$t("agentTemplateManagement.deleteBackendError"));
|
||||
}
|
||||
});
|
||||
})
|
||||
|
|
@ -367,18 +314,22 @@ export default {
|
|||
this.$message.warning(this.$t("agentTemplateManagement.selectTemplate"));
|
||||
return;
|
||||
}
|
||||
|
||||
this.$confirm(
|
||||
this.$t("agentTemplateManagement.confirmBatchDelete", { count: this.selectedTemplates.length }),
|
||||
this.$t("agentTemplateManagement.confirmBatchDelete", {
|
||||
count: this.selectedTemplates.length,
|
||||
}),
|
||||
this.$t("common.warning"),
|
||||
{
|
||||
confirmButtonText: this.$t("common.confirm"),
|
||||
cancelButtonText: this.$t("common.cancel"),
|
||||
type: "warning"
|
||||
type: "warning",
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
// Ensure parameter format is correct - use id array as request body
|
||||
// Ensure correct parameter format - send id array as request body
|
||||
const ids = this.selectedTemplates.map((template) => template.id);
|
||||
|
||||
agentApi.batchDeleteAgentTemplate(ids, (res) => {
|
||||
if (res && typeof res === "object") {
|
||||
if (res.data && res.data.code === 0) {
|
||||
|
|
@ -387,7 +338,7 @@ export default {
|
|||
);
|
||||
// Reload template list
|
||||
this.loadTemplateList();
|
||||
// Clear selected state
|
||||
// Clear selection state
|
||||
this.selectedTemplates = [];
|
||||
this.isAllSelected = false;
|
||||
} else {
|
||||
|
|
@ -396,7 +347,7 @@ export default {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res?.data?.msg || this.$t("agentTemplateManagement.batchDeleteFailed"));
|
||||
this.$message.error(this.$t("agentTemplateManagement.deleteBackendError"));
|
||||
}
|
||||
});
|
||||
})
|
||||
|
|
@ -405,11 +356,12 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// Complete pagination related methods
|
||||
// Improve pagination-related methods
|
||||
handlePageChange(page) {
|
||||
this.currentPage = page;
|
||||
this.loadTemplateList();
|
||||
},
|
||||
|
||||
handlePageSizeChange(size) {
|
||||
this.pageSize = size;
|
||||
this.currentPage = 1;
|
||||
|
|
@ -464,7 +416,7 @@ export default {
|
|||
return pages;
|
||||
},
|
||||
|
||||
// Modify handleSelectAll method
|
||||
// Modify the handleSelectAll method
|
||||
handleSelectAll() {
|
||||
this.isAllSelected = !this.isAllSelected;
|
||||
this.templateList.forEach((row) => {
|
||||
|
|
@ -476,49 +428,47 @@ export default {
|
|||
|
||||
// Handle row selection change
|
||||
handleRowSelectionChange(row) {
|
||||
// Find selected templates
|
||||
// Find selected template
|
||||
this.selectedTemplates = this.templateList.filter((template) => template.selected);
|
||||
// Update select all state
|
||||
// Update select-all state
|
||||
this.isAllSelected =
|
||||
this.templateList.length > 0 &&
|
||||
this.selectedTemplates.length === this.templateList.length;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
/* Basic background and layout settings */
|
||||
.welcome {
|
||||
min-width: 900px;
|
||||
min-height: 506px;
|
||||
height: 100vh;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
position: relative;
|
||||
flex-direction: column;
|
||||
background: #eff4ff;
|
||||
position: relative;
|
||||
background: linear-gradient(to bottom right, #dce8ff, #e4eeff, #e6cbfd) center;
|
||||
background-size: cover;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Operation bar styles */
|
||||
/* Action bar styles */
|
||||
.operation-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 0 16px 0;
|
||||
align-items: center;
|
||||
padding: 16px 24px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-weight: 500;
|
||||
font-size: 24px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.right-operations {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
|
|
@ -533,11 +483,10 @@ export default {
|
|||
|
||||
/* Main container styles */
|
||||
.main-wrapper {
|
||||
margin: 5px 22px;
|
||||
// Top 63px, bottom 35px, query 72px
|
||||
height: calc(100vh - 63px - 35px - 72px);
|
||||
margin: 0 22px;
|
||||
border-radius: 15px;
|
||||
min-height: calc(100vh - 24vh);
|
||||
height: auto;
|
||||
max-height: 80vh;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
position: relative;
|
||||
background: rgba(237, 242, 255, 0.5);
|
||||
|
|
@ -546,9 +495,10 @@ export default {
|
|||
}
|
||||
|
||||
.content-panel {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
border-radius: 15px;
|
||||
background: transparent;
|
||||
border: 1px solid #fff;
|
||||
|
|
@ -556,26 +506,25 @@ export default {
|
|||
|
||||
.content-area {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
min-width: 600px;
|
||||
overflow: auto;
|
||||
overflow-x: auto;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Template card styles */
|
||||
.template-card {
|
||||
background: white;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
overflow: hidden;
|
||||
|
||||
::v-deep .el-card__body {
|
||||
padding: 14px 20px;
|
||||
:deep(.el-card__body) {
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
|
|
@ -628,7 +577,7 @@ export default {
|
|||
color: #5a64b5;
|
||||
}
|
||||
|
||||
/* Cell text styles */
|
||||
/* Cell text style */
|
||||
.cell {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
|
|
@ -636,13 +585,13 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
/* Table bottom operation bar */
|
||||
/* Table bottom action bar */
|
||||
.table_bottom {
|
||||
display: flex;
|
||||
justify-content: space-between !important;
|
||||
align-items: center;
|
||||
margin-top: auto;
|
||||
padding: 0 20px 15px !important;
|
||||
padding: 0 20px !important;
|
||||
width: 100% !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
|
|
@ -650,13 +599,39 @@ export default {
|
|||
/* Control button styles */
|
||||
.ctrl_btn {
|
||||
display: flex;
|
||||
}
|
||||
gap: 8px;
|
||||
padding-left: 0 !important;
|
||||
margin-left: 0 !important;
|
||||
|
||||
:deep(.el-table .el-button--text) {
|
||||
color: #7079aa;
|
||||
}
|
||||
.el-button {
|
||||
min-width: 72px;
|
||||
height: 32px;
|
||||
padding: 7px 12px 7px 10px;
|
||||
font-size: 12px;
|
||||
border-radius: 4px;
|
||||
line-height: 1;
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
||||
|
||||
:deep(.el-table .el-button--text:hover) {
|
||||
color: #5a64b5;
|
||||
&:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
}
|
||||
|
||||
.el-button--primary {
|
||||
background: #5f70f3;
|
||||
color: white;
|
||||
}
|
||||
.el-button--success {
|
||||
background: #5bc98c;
|
||||
color: white;
|
||||
}
|
||||
.el-button--danger {
|
||||
background: #fd5b63;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,23 +1,24 @@
|
|||
<template>
|
||||
<div class="welcome">
|
||||
<HeaderBar />
|
||||
<div class="main-wrapper">
|
||||
<el-card class="main-card" shadow="never">
|
||||
<div class="operation-header">
|
||||
<h2 class="page-title">{{ $t('dictManagement.pageTitle') }}</h2>
|
||||
<div class="right-operations">
|
||||
<el-input :placeholder="$t('dictManagement.searchPlaceholder')" v-model="search" class="search-input"
|
||||
@keyup.enter.native="handleSearch" clearable />
|
||||
<CustomButton icon="el-icon-search" type="confirm" @click="handleSearch">
|
||||
{{ $t('dictManagement.search') }}
|
||||
</CustomButton>
|
||||
</div>
|
||||
<div class="welcome">
|
||||
<HeaderBar />
|
||||
|
||||
<div class="operation-bar">
|
||||
<h2 class="page-title">{{ $t('dictManagement.pageTitle') }}</h2>
|
||||
<div class="action-group">
|
||||
<div class="search-group">
|
||||
<el-input :placeholder="$t('dictManagement.searchPlaceholder')" v-model="search" class="search-input" clearable
|
||||
@keyup.enter.native="handleSearch" style="width: 240px" />
|
||||
<el-button class="btn-search" @click="handleSearch">
|
||||
{{ $t('dictManagement.search') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="main-wrapper">
|
||||
<div class="content-panel">
|
||||
<!-- Left side dictionary type list -->
|
||||
<!-- Left-side dictionary type list -->
|
||||
<div class="dict-type-panel">
|
||||
<div class="dict-type-header">
|
||||
<el-button type="success" size="mini" @click="showAddDictTypeDialog">{{ $t('dictManagement.addDictType') }}</el-button>
|
||||
|
|
@ -41,13 +42,13 @@
|
|||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- Right side dictionary data list -->
|
||||
<!-- Right-side dictionary data list -->
|
||||
<div class="content-area">
|
||||
<el-card class="dict-data-card" shadow="never">
|
||||
<el-table ref="dictDataTable" :data="dictDataList" style="width: 100%"
|
||||
v-loading="dictDataLoading" element-loading-text="Loading..."
|
||||
element-loading-spinner="el-icon-loading"
|
||||
element-loading-background="rgba(255, 255, 255, 0.7)" class="data-table"
|
||||
element-loading-background="rgba(255, 255, 255, 0.7)" class="transparent-table"
|
||||
header-row-class-name="table-header">
|
||||
<el-table-column :label="$t('modelConfig.select')" align="center" width="70">
|
||||
<template slot-scope="scope">
|
||||
|
|
@ -108,58 +109,6 @@
|
|||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dict-type-checkbox" v-loading="dictTypeLoading">
|
||||
<el-checkbox class="dict-type-all" :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">{{ $t('common.selectAll') }}</el-checkbox>
|
||||
<el-checkbox-group v-model="checkedDictTypesIds" @change="handleDictTypeSelectionChange">
|
||||
<div
|
||||
class="dict-type-item"
|
||||
:class="{ 'dict-type-active': selectedDictType?.id === item.id }"
|
||||
v-for="item in dictTypeList"
|
||||
:key="item.id"
|
||||
>
|
||||
<el-checkbox :label="item.dictName" :key="item.id">
|
||||
</el-checkbox>
|
||||
<div class="dict-type-item-content" @click="handleDictTypeRowClick(item)">
|
||||
<span class="dict-type-name">{{item.dictName}}</span>
|
||||
<el-button class="dict-type-edit-btn" type="text" icon="el-icon-edit" size="mini" @click.stop="editDictType(item)"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Right-side dictionary data list -->
|
||||
<div class="content-area">
|
||||
<CustomTable :data="dictDataList" :columns="tableColumns" :loading="dictDataLoading" :show-selection="true"
|
||||
:show-operations="true" :operations-label="$t('dictManagement.operation')" :total="total"
|
||||
:current-page="currentPage" :page-size="pageSize" :page-size-options="pageSizeOptions"
|
||||
@size-change="handlePageSizeChange" @page-change="goToPage">
|
||||
<template slot="selection" slot-scope="scope">
|
||||
<el-checkbox v-model="scope.row.selected"></el-checkbox>
|
||||
</template>
|
||||
<template slot="operations" slot-scope="scope">
|
||||
<el-button type="text" size="mini" @click="editDictData(scope.row)">
|
||||
{{ $t('dictManagement.edit') }}
|
||||
</el-button>
|
||||
<el-button type="text" size="mini" @click="deleteDictData(scope.row)">
|
||||
{{ $t('dictManagement.delete') }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot="footer-btns">
|
||||
<div class="ctrl_btn">
|
||||
<CustomButton :icon="isAllDictDataSelected ? 'el-icon-circle-close' : 'el-icon-circle-check'"
|
||||
size="small" @click="selectAllDictData">
|
||||
{{ isAllDictDataSelected ? $t('dictManagement.deselectAll') : $t('dictManagement.selectAll') }}
|
||||
</CustomButton>
|
||||
<CustomButton type="add" icon="el-icon-plus" size="small" @click="showAddDictDataDialog">
|
||||
{{ $t('dictManagement.addDictData') }}
|
||||
</CustomButton>
|
||||
<CustomButton size="small" type="delete" icon="el-icon-delete" @click="batchDeleteDictData">
|
||||
{{ $t('dictManagement.batchDeleteDictData') }}
|
||||
</CustomButton>
|
||||
</div>
|
||||
</template>
|
||||
</CustomTable>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Use dictionary type edit dialog component -->
|
||||
|
|
@ -173,18 +122,6 @@
|
|||
<version-footer />
|
||||
</el-footer>
|
||||
</div>
|
||||
|
||||
<!-- Use dictionary type edit dialog component -->
|
||||
<DictTypeDialog :visible.sync="dictTypeDialogVisible" :title="dictTypeDialogTitle" :dictTypeData="dictTypeForm"
|
||||
@save="saveDictType" />
|
||||
|
||||
<!-- Use dictionary data edit dialog component -->
|
||||
<DictDataDialog :visible.sync="dictDataDialogVisible" :title="dictDataDialogTitle" :dictData="dictDataForm"
|
||||
:dictTypeId="selectedDictType?.id" @save="saveDictData" />
|
||||
<el-footer style="flex-shrink:unset;">
|
||||
<version-footer />
|
||||
</el-footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -193,8 +130,6 @@ import DictDataDialog from '@/components/DictDataDialog.vue'
|
|||
import DictTypeDialog from '@/components/DictTypeDialog.vue'
|
||||
import HeaderBar from '@/components/HeaderBar.vue'
|
||||
import VersionFooter from '@/components/VersionFooter.vue'
|
||||
import CustomButton from '@/components/CustomButton.vue'
|
||||
import CustomTable from '@/components/CustomTable.vue'
|
||||
export default {
|
||||
name: 'DictManagement',
|
||||
components: {
|
||||
|
|
@ -232,7 +167,7 @@ export default {
|
|||
sort: 0
|
||||
},
|
||||
search: '',
|
||||
// Add pagination related data
|
||||
// Add pagination-related data
|
||||
pageSizeOptions: [10, 20, 50, 100],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
|
|
@ -416,20 +351,20 @@ export default {
|
|||
},
|
||||
handleSearch() {
|
||||
if (!this.selectedDictType) {
|
||||
this.$message.warning('Please select dictionary type first')
|
||||
this.$message.warning('Please select a dictionary type first')
|
||||
return
|
||||
}
|
||||
this.currentPage = 1
|
||||
this.loadDictDataList(this.selectedDictType.id)
|
||||
},
|
||||
// Add pagination related methods
|
||||
// Add pagination-related methods
|
||||
handlePageSizeChange(val) {
|
||||
this.pageSize = val;
|
||||
this.currentPage = 1;
|
||||
this.loadDictDataList(this.selectedDictType?.id);
|
||||
},
|
||||
|
||||
// Update selection list header translation text
|
||||
// Update selection header translation text
|
||||
updateSelectionHeaderText() {
|
||||
const thElement = document.querySelector(`.el-table__header th:nth-child(1) .cell`);
|
||||
if (thElement) {
|
||||
|
|
@ -456,16 +391,16 @@ export default {
|
|||
this.currentPage = page;
|
||||
this.loadDictDataList(this.selectedDictType?.id);
|
||||
},
|
||||
// Table header cell style class name for selection column
|
||||
// Header cell style class name for column selection
|
||||
headerCellClassName({ columnIndex }) {
|
||||
if (columnIndex === 0) {
|
||||
return 'custom-selection-header';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
// Cell style class name for setting selection list header translation text
|
||||
// Cell style class name for setting the translation text of the selection column header
|
||||
selectionCellClassName({ row, column, rowIndex, columnIndex }) {
|
||||
// Only set data-content for header rows
|
||||
// Set data-content only for the header row
|
||||
if (rowIndex === undefined) {
|
||||
setTimeout(() => {
|
||||
this.updateSelectionHeaderText();
|
||||
|
|
@ -476,14 +411,14 @@ export default {
|
|||
},
|
||||
|
||||
mounted() {
|
||||
// Ensure table header translation text displays correctly after component mount
|
||||
// Ensure header translation text displays correctly after component mount
|
||||
setTimeout(() => {
|
||||
this.updateSelectionHeaderText();
|
||||
}, 100);
|
||||
},
|
||||
|
||||
updated() {
|
||||
// Reset table header translation text after component update
|
||||
// Reset header translation text after component update
|
||||
this.updateSelectionHeaderText();
|
||||
},
|
||||
|
||||
|
|
@ -507,260 +442,29 @@ export default {
|
|||
return pages;
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initTableColumns()
|
||||
this.loadDictTypeList()
|
||||
},
|
||||
methods: {
|
||||
handleCheckAllChange(val) {
|
||||
// Determine whether to select all or deselect all based on current selection state
|
||||
const isAllSelected = this.checkedDictTypesIds.length === this.dictTypeList.length;
|
||||
if (isAllSelected) {
|
||||
// All selected, deselect all
|
||||
this.checkedDictTypesIds = [];
|
||||
this.checkAll = false;
|
||||
this.selectedDictTypes = [];
|
||||
} else {
|
||||
// Not all selected, select all
|
||||
this.checkedDictTypesIds = this.dictTypeList.map(item => item.dictName);
|
||||
this.checkAll = true;
|
||||
this.selectedDictTypes = [...this.dictTypeList];
|
||||
}
|
||||
// Reset indeterminate state
|
||||
this.isIndeterminate = false;
|
||||
},
|
||||
handleDictTypeSelectionChange(checkedIds) {
|
||||
// Update selected dictionary type list
|
||||
this.selectedDictTypes = this.dictTypeList.filter(item => checkedIds.includes(item.dictName));
|
||||
// When partially selected, checkAll is true and isIndeterminate is true to display the indeterminate state
|
||||
this.checkAll = checkedIds.length > 0;
|
||||
this.isIndeterminate = checkedIds.length > 0 && checkedIds.length < this.dictTypeList.length;
|
||||
},
|
||||
initTableColumns() {
|
||||
this.tableColumns = [
|
||||
{
|
||||
prop: 'dictLabel',
|
||||
label: this.$t('dictManagement.dictLabel'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'dictValue',
|
||||
label: this.$t('dictManagement.dictValue'),
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'sort',
|
||||
label: this.$t('dictManagement.sort'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
},
|
||||
// Dictionary type related methods
|
||||
loadDictTypeList() {
|
||||
this.dictTypeLoading = true
|
||||
dictApi.getDictTypeList({
|
||||
page: 1,
|
||||
limit: 100,
|
||||
dictName: this.search
|
||||
}, ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.dictTypeList = data.data.list
|
||||
if (this.dictTypeList.length > 0) {
|
||||
this.selectedDictType = this.dictTypeList[0]
|
||||
this.loadDictDataList(this.dictTypeList[0].id)
|
||||
}
|
||||
}
|
||||
this.dictTypeLoading = false
|
||||
})
|
||||
},
|
||||
handleDictTypeRowClick(row) {
|
||||
this.selectedDictType = row
|
||||
this.loadDictDataList(row.id)
|
||||
},
|
||||
showAddDictTypeDialog() {
|
||||
this.dictTypeDialogTitle = this.$t('dictManagement.addDictType')
|
||||
this.dictTypeForm = {
|
||||
id: null,
|
||||
dictName: '',
|
||||
dictType: ''
|
||||
}
|
||||
this.dictTypeDialogVisible = true
|
||||
},
|
||||
editDictType(row) {
|
||||
this.dictTypeDialogTitle = this.$t('dictManagement.editDictType')
|
||||
this.dictTypeForm = { ...row }
|
||||
this.dictTypeDialogVisible = true
|
||||
},
|
||||
saveDictType(formData) {
|
||||
const api = formData.id ? dictApi.updateDictType : dictApi.addDictType
|
||||
api(formData, ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.$message.success(this.$t('dictManagement.saveSuccess'))
|
||||
this.dictTypeDialogVisible = false
|
||||
this.loadDictTypeList()
|
||||
}
|
||||
})
|
||||
},
|
||||
batchDeleteDictType() {
|
||||
if (this.selectedDictTypes.length === 0) {
|
||||
this.$message.warning(this.$t('dictManagement.selectDictTypeToDelete'))
|
||||
return
|
||||
}
|
||||
|
||||
this.$confirm(this.$t('dictManagement.confirmDeleteDictType'), this.$t('dictManagement.confirm'), {
|
||||
confirmButtonText: this.$t('dictManagement.confirm'),
|
||||
cancelButtonText: this.$t('dictManagement.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const ids = this.selectedDictTypes.map(item => item.id)
|
||||
dictApi.deleteDictType(ids, ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.$message.success(this.$t('dictManagement.deleteSuccess'))
|
||||
this.loadDictTypeList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// Dictionary data related methods
|
||||
loadDictDataList(dictTypeId) {
|
||||
if (!dictTypeId) return
|
||||
this.dictDataLoading = true
|
||||
dictApi.getDictDataList({
|
||||
dictTypeId,
|
||||
page: this.currentPage,
|
||||
limit: this.pageSize,
|
||||
dictLabel: this.search,
|
||||
dictValue: ''
|
||||
}, ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.dictDataList = data.data.list.map(item => ({
|
||||
...item,
|
||||
selected: false
|
||||
}))
|
||||
this.total = data.data.total
|
||||
} else {
|
||||
this.$message.error(data.msg || this.$t('dictManagement.getDictDataFailed'))
|
||||
}
|
||||
this.dictDataLoading = false
|
||||
})
|
||||
},
|
||||
selectAllDictData() {
|
||||
this.isAllDictDataSelected = !this.isAllDictDataSelected
|
||||
this.dictDataList.forEach(row => {
|
||||
row.selected = this.isAllDictDataSelected
|
||||
})
|
||||
},
|
||||
showAddDictDataDialog() {
|
||||
if (!this.selectedDictType) {
|
||||
this.$message.warning(this.$t('dictManagement.selectDictTypeFirst'))
|
||||
return
|
||||
}
|
||||
this.dictDataDialogTitle = this.$t('dictManagement.addDictData')
|
||||
this.dictDataForm = {
|
||||
id: null,
|
||||
dictTypeId: this.selectedDictType.id,
|
||||
dictLabel: '',
|
||||
dictValue: '',
|
||||
sort: 0
|
||||
}
|
||||
this.dictDataDialogVisible = true
|
||||
},
|
||||
editDictData(row) {
|
||||
this.dictDataDialogTitle = this.$t('dictManagement.editDictData')
|
||||
this.dictDataForm = { ...row }
|
||||
this.dictDataDialogVisible = true
|
||||
},
|
||||
saveDictData(formData) {
|
||||
const api = formData.id ? dictApi.updateDictData : dictApi.addDictData
|
||||
api(formData, ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.$message.success(this.$t('dictManagement.saveSuccess'))
|
||||
this.dictDataDialogVisible = false
|
||||
this.loadDictDataList(formData.dictTypeId)
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteDictData(row) {
|
||||
this.$confirm(this.$t('dictManagement.confirmDeleteDictData'), this.$t('dictManagement.confirm'), {
|
||||
confirmButtonText: this.$t('dictManagement.confirm'),
|
||||
cancelButtonText: this.$t('dictManagement.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
dictApi.deleteDictData([row.id], ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.$message.success(this.$t('dictManagement.deleteSuccess'))
|
||||
this.loadDictDataList(row.dictTypeId)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
batchDeleteDictData() {
|
||||
const selectedRows = this.dictDataList.filter(row => row.selected)
|
||||
if (selectedRows.length === 0) {
|
||||
this.$message.warning(this.$t('dictManagement.selectDictDataToDelete'))
|
||||
return
|
||||
}
|
||||
|
||||
this.$confirm(this.$t('dictManagement.confirmBatchDeleteDictData', { count: selectedRows.length }), this.$t('dictManagement.confirm'), {
|
||||
confirmButtonText: this.$t('dictManagement.confirm'),
|
||||
cancelButtonText: this.$t('dictManagement.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const ids = selectedRows.map(item => item.id)
|
||||
dictApi.deleteDictData(ids, ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.$message.success(this.$t('dictManagement.deleteSuccess'))
|
||||
this.loadDictDataList(this.selectedDictType.id)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
handleSearch() {
|
||||
if (!this.selectedDictType) {
|
||||
this.$message.warning(this.$t('dictManagement.selectDictTypeFirst'))
|
||||
return
|
||||
}
|
||||
this.currentPage = 1
|
||||
this.loadDictDataList(this.selectedDictType.id)
|
||||
},
|
||||
handlePageSizeChange(val) {
|
||||
this.pageSize = val
|
||||
this.currentPage = 1
|
||||
this.loadDictDataList(this.selectedDictType?.id)
|
||||
},
|
||||
goToPage(page) {
|
||||
if (page !== this.currentPage) {
|
||||
this.currentPage = page
|
||||
this.loadDictDataList(this.selectedDictType?.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.welcome {
|
||||
min-width: 900px;
|
||||
min-height: 506px;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
position: relative;
|
||||
flex-direction: column;
|
||||
background-size: cover;
|
||||
background: #eff4ff;
|
||||
-webkit-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
overflow: hidden;
|
||||
min-width: 900px;
|
||||
min-height: 506px;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
position: relative;
|
||||
flex-direction: column;
|
||||
background-size: cover;
|
||||
background: linear-gradient(to bottom right, #dce8ff, #e4eeff, #e6cbfd) center;
|
||||
-webkit-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.main-wrapper {
|
||||
margin: 5px 22px;
|
||||
// Top 63px, bottom 35px, query 72px
|
||||
height: calc(100vh - 63px - 35px - 72px);
|
||||
margin: 0 22px;
|
||||
border-radius: 15px;
|
||||
min-height: calc(100vh - 24vh);
|
||||
height: auto;
|
||||
max-height: 80vh;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
position: relative;
|
||||
background: rgba(237, 242, 255, 0.5);
|
||||
|
|
@ -819,145 +523,102 @@ export default {
|
|||
}
|
||||
|
||||
.content-panel {
|
||||
flex: 1;
|
||||
gap: 16px;
|
||||
padding: 0 20px;
|
||||
display: flex;
|
||||
min-height: 0;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
border-radius: 15px;
|
||||
background: transparent;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
|
||||
.dict-type-panel {
|
||||
width: 340px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 0 12px rgba(74, 124, 253, 0.12);
|
||||
border-radius: 6px;
|
||||
.dict-type-checkbox {
|
||||
flex: 1;
|
||||
padding: 16px 10px;
|
||||
width: 300px;
|
||||
background: white;
|
||||
border-right: 1px solid #ebeef5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
.dict-type-all {
|
||||
margin-left: 10px;
|
||||
}
|
||||
::v-deep .el-checkbox-group {
|
||||
width: 100%;
|
||||
gap: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
.el-checkbox__label {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.dict-type-item {
|
||||
padding: 0 10px;
|
||||
padding-right: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
&:hover {
|
||||
background: #4998ff;
|
||||
.dict-type-name, .dict-type-edit-btn {
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
.dict-type-item-content {
|
||||
flex: 1;
|
||||
padding: 8px 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.dict-type-name {
|
||||
margin-left: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.dict-type-edit-btn {
|
||||
color: #303133;
|
||||
padding: 6px 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
.dict-type-active {
|
||||
background-color: #4998ff;
|
||||
.dict-type-name, .dict-type-edit-btn {
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dict-type-header {
|
||||
display: flex;
|
||||
padding: 10px 16px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.dict-type-title {
|
||||
margin: 0;
|
||||
font-weight: 500;
|
||||
}
|
||||
> div {
|
||||
.el-button {
|
||||
border-radius: 6px;
|
||||
padding: 7px 8px;
|
||||
}
|
||||
}
|
||||
padding: 16px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.dict-type-table {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.content-area {
|
||||
flex: 1;
|
||||
padding: 24px;
|
||||
padding: 24px 24px 0;
|
||||
height: 100%;
|
||||
min-width: 600px;
|
||||
overflow: hidden;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.main-card {
|
||||
background: white;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: none;
|
||||
border-radius: 15px;
|
||||
overflow: hidden;
|
||||
.dict-data-card {
|
||||
background: white;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.data-table {
|
||||
border-radius: 6px;
|
||||
overflow-y: hidden;
|
||||
background-color: transparent !important;
|
||||
--table-max-height: calc(100vh - 40vh);
|
||||
max-height: var(--table-max-height);
|
||||
:deep(.transparent-table) {
|
||||
background: white;
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
:deep(.el-table__body-wrapper) {
|
||||
max-height: calc(var(--table-max-height) - 40px);
|
||||
.el-table__body-wrapper {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
max-height: none !important;
|
||||
}
|
||||
|
||||
:deep(.el-table__body) {
|
||||
tr:last-child td {
|
||||
border-bottom: none;
|
||||
.el-table__header-wrapper {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.el-table__header th {
|
||||
background: white !important;
|
||||
color: black;
|
||||
font-weight: 600;
|
||||
height: 40px;
|
||||
padding: 8px 0;
|
||||
font-size: 14px;
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
}
|
||||
|
||||
.el-table__body tr {
|
||||
background-color: white;
|
||||
|
||||
td {
|
||||
border-top: 1px solid rgba(0, 0, 0, 0.04);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.04);
|
||||
padding: 8px 0;
|
||||
height: 40px;
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-table) {
|
||||
&::before {
|
||||
display: none;
|
||||
.el-table__row:hover>td {
|
||||
background-color: #f5f7fa !important;
|
||||
}
|
||||
|
||||
&::after {
|
||||
&::before {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
|
@ -966,7 +627,6 @@ export default {
|
|||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16px 0;
|
||||
width: 100%;
|
||||
flex-shrink: 0;
|
||||
min-height: 60px;
|
||||
|
|
@ -1248,61 +908,24 @@ export default {
|
|||
}
|
||||
|
||||
:deep(.el-card__body) {
|
||||
padding: 15px;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.operation-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16px 20px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-weight: 500;
|
||||
font-size: 24px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.right-operations {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
.ctrl_btn {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
:deep(.el-table .el-button--text) {
|
||||
color: #7079aa;
|
||||
}
|
||||
|
||||
:deep(.el-table .el-button--text:hover) {
|
||||
color: #5a64b5;
|
||||
}
|
||||
|
||||
:deep(.el-checkbox__inner) {
|
||||
background-color: #ffffff !important;
|
||||
border-color: #cccccc !important;
|
||||
background-color: #ffffff !important;
|
||||
border-color: #cccccc !important;
|
||||
}
|
||||
|
||||
:deep(.el-checkbox__inner:hover) {
|
||||
border-color: #cccccc !important;
|
||||
border-color: #cccccc !important;
|
||||
}
|
||||
|
||||
:deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
|
||||
background-color: #5f70f3 !important;
|
||||
border-color: #5f70f3 !important;
|
||||
background-color: #5f70f3 !important;
|
||||
border-color: #5f70f3 !important;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
@ -560,7 +560,7 @@ export default {
|
|||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style lang="scss" scoped>
|
||||
.el-switch {
|
||||
height: 23px;
|
||||
}
|
||||
|
|
@ -727,7 +727,7 @@ export default {
|
|||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.data-table /deep/ .el-table__row {
|
||||
.data-table ::v-deep .el-table__row {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
|
|
@ -796,7 +796,7 @@ export default {
|
|||
// background: linear-gradient(135deg, #3a8ee6, #5a7cff);
|
||||
// }
|
||||
|
||||
.el-table th /deep/ .el-table__cell {
|
||||
.el-table th ::v-deep .el-table__cell {
|
||||
overflow: hidden;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
|
|
|
|||
|
|
@ -1,29 +1,15 @@
|
|||
<template>
|
||||
<div class="welcome">
|
||||
<HeaderBar />
|
||||
<div class="main-wrapper">
|
||||
<div class="content-panel">
|
||||
<div class="content-area">
|
||||
<el-card class="params-card" shadow="never">
|
||||
<div class="operation-header">
|
||||
<div class="title-block">
|
||||
<h2 class="page-title">{{ $t('paramManagement.pageTitle') }}</h2>
|
||||
<span class="total-hint">{{ $t('paramManagement.totalRecords', { total: filteredTotal }) }}</span>
|
||||
</div>
|
||||
<div class="right-operations">
|
||||
<el-input
|
||||
:placeholder="$t('paramManagement.searchPlaceholder')"
|
||||
v-model="searchCode"
|
||||
class="search-input"
|
||||
@keyup.enter.native="handleSearch"
|
||||
@clear="handleSearch"
|
||||
clearable
|
||||
/>
|
||||
<CustomButton icon="el-icon-search" type="confirm" @click="handleSearch">
|
||||
{{ $t('paramManagement.search') }}
|
||||
</CustomButton>
|
||||
</div>
|
||||
<div class="welcome">
|
||||
<HeaderBar />
|
||||
|
||||
<div class="operation-bar">
|
||||
<h2 class="page-title">{{ $t('paramManagement.pageTitle') }}</h2>
|
||||
<div class="right-operations">
|
||||
<el-input :placeholder="$t('paramManagement.searchPlaceholder')" v-model="searchCode"
|
||||
class="search-input" @keyup.enter.native="handleSearch" clearable />
|
||||
<el-button class="btn-search" @click="handleSearch">{{ $t('paramManagement.search') }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-wrapper">
|
||||
<div class="content-panel">
|
||||
|
|
@ -44,8 +30,9 @@
|
|||
show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<div v-if="isSensitiveParam(scope.row.paramCode)">
|
||||
<span v-if="!scope.row.showValue">{{ maskSensitiveValue(scope.row.paramValue)
|
||||
}}</span>
|
||||
<span v-if="!scope.row.showValue">
|
||||
{{ maskSensitiveValue(scope.row.paramValue) }}
|
||||
</span>
|
||||
<span v-else>{{ scope.row.paramValue }}</span>
|
||||
<el-button size="mini" type="text" @click="toggleSensitiveValue(scope.row)">
|
||||
{{ scope.row.showValue ? $t('paramManagement.hide') :
|
||||
|
|
@ -104,6 +91,7 @@
|
|||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add/Edit parameter dialog -->
|
||||
<param-dialog ref="paramDialog" :title="dialogTitle" :visible.sync="dialogVisible" :form="paramForm"
|
||||
|
|
@ -112,19 +100,6 @@
|
|||
<version-footer />
|
||||
</el-footer>
|
||||
</div>
|
||||
|
||||
<param-dialog
|
||||
ref="paramDialog"
|
||||
:title="dialogTitle"
|
||||
:visible.sync="dialogVisible"
|
||||
:form="paramForm"
|
||||
@submit="handleSubmit"
|
||||
@cancel="dialogVisible = false"
|
||||
/>
|
||||
<el-footer>
|
||||
<version-footer />
|
||||
</el-footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -132,15 +107,6 @@ import Api from "@/apis/api";
|
|||
import HeaderBar from "@/components/HeaderBar.vue";
|
||||
import ParamDialog from "@/components/ParamDialog.vue";
|
||||
import VersionFooter from "@/components/VersionFooter.vue";
|
||||
import CustomButton from "@/components/CustomButton.vue";
|
||||
|
||||
const TOP_GROUP_ORDER = ['server', 'plugins', 'log', 'session_state', 'general'];
|
||||
const FETCH_LIMIT = 500;
|
||||
|
||||
const SERVER_SUB_ORDER = [
|
||||
'_root', 'auth', 'connection', 'registry', 'resilience', 'metrics', 'tracing'
|
||||
];
|
||||
|
||||
export default {
|
||||
components: { HeaderBar, ParamDialog, VersionFooter },
|
||||
data() {
|
||||
|
|
@ -153,9 +119,9 @@ export default {
|
|||
pageSizeOptions: [10, 20, 50, 100],
|
||||
total: 0,
|
||||
dialogVisible: false,
|
||||
dialogTitle: "Add Parameter",
|
||||
dialogTitle: "Add parameter",
|
||||
isAllSelected: false,
|
||||
sensitive_keys: ["api_key", "personal_access_token", "access_token", "token", "secret", "access_key_secret", "secret_key"],
|
||||
sensitive_keys: ["api_key", "personal_access_token", "access_token", "token", "secret", "access_key_secret", "secret_key", "password", "mqtt_signature_key", "private_key"],
|
||||
paramForm: {
|
||||
id: null,
|
||||
paramCode: "",
|
||||
|
|
@ -165,11 +131,30 @@ export default {
|
|||
},
|
||||
};
|
||||
},
|
||||
filteredTotal() {
|
||||
return this.filteredParams.length;
|
||||
created() {
|
||||
this.fetchParams();
|
||||
|
||||
},
|
||||
selectedCount() {
|
||||
return this.filteredParams.filter(item => item.selected).length;
|
||||
|
||||
computed: {
|
||||
pageCount() {
|
||||
return Math.ceil(this.total / this.pageSize);
|
||||
},
|
||||
visiblePages() {
|
||||
const pages = [];
|
||||
const maxVisible = 3;
|
||||
let start = Math.max(1, this.currentPage - 1);
|
||||
let end = Math.min(this.pageCount, start + maxVisible - 1);
|
||||
|
||||
if (end - start + 1 < maxVisible) {
|
||||
start = Math.max(1, end - maxVisible + 1);
|
||||
}
|
||||
|
||||
for (let i = start; i <= end; i++) {
|
||||
pages.push(i);
|
||||
}
|
||||
return pages;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handlePageSizeChange(val) {
|
||||
|
|
@ -231,7 +216,7 @@ export default {
|
|||
id: row.id,
|
||||
paramCode: row.paramCode,
|
||||
paramValue: row.paramValue,
|
||||
valueType: row.valueType || "string", // Ensure has value
|
||||
valueType: row.valueType || "string", // Ensure a value is present
|
||||
remark: row.remark
|
||||
};
|
||||
this.dialogVisible = true;
|
||||
|
|
@ -251,7 +236,7 @@ export default {
|
|||
message: data.msg || this.$t('paramManagement.updateFailed'),
|
||||
showClose: true
|
||||
});
|
||||
// Call ParamDialog resetSaving method to reset save status
|
||||
// Call ParamDialog's resetSaving method to reset the saving state
|
||||
if (this.$refs.paramDialog && typeof this.$refs.paramDialog.resetSaving === 'function') {
|
||||
this.$refs.paramDialog.resetSaving();
|
||||
}
|
||||
|
|
@ -271,7 +256,7 @@ export default {
|
|||
message: data.msg || this.$t('paramManagement.addFailed'),
|
||||
showClose: true
|
||||
});
|
||||
// Call ParamDialog resetSaving method to reset save status
|
||||
// Call ParamDialog's resetSaving method to reset the saving state
|
||||
if (this.$refs.paramDialog && typeof this.$refs.paramDialog.resetSaving === 'function') {
|
||||
this.$refs.paramDialog.resetSaving();
|
||||
}
|
||||
|
|
@ -377,400 +362,29 @@ export default {
|
|||
return 'header-cell';
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
displaySections: {
|
||||
immediate: true,
|
||||
handler(sections) {
|
||||
const keys = sections.map(s => s.key);
|
||||
if (!keys.length) {
|
||||
this.activeCollapse = [];
|
||||
this.isAllSelected = false;
|
||||
return;
|
||||
}
|
||||
// Expand all groups if few; expand first few by default if many
|
||||
const preferOpen = keys.length <= 5 ? keys.slice() : keys.slice(0, 3);
|
||||
const stillValid = (this.activeCollapse || []).filter(k => keys.includes(k));
|
||||
this.activeCollapse = stillValid.length ? stillValid : preferOpen;
|
||||
this.syncSelectAllState();
|
||||
}
|
||||
},
|
||||
categoryTabs(tabs) {
|
||||
if (!tabs.some(t => t.key === this.activeCategory)) {
|
||||
this.activeCategory = 'all';
|
||||
this.activeSubCategory = 'all';
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchParams();
|
||||
},
|
||||
methods: {
|
||||
getTopGroup(paramCode = '') {
|
||||
if (paramCode.startsWith('server.')) return 'server';
|
||||
if (paramCode.startsWith('plugins.')) return 'plugins';
|
||||
if (paramCode.startsWith('log.')) return 'log';
|
||||
if (paramCode.startsWith('session_state.')) return 'session_state';
|
||||
return 'general';
|
||||
},
|
||||
getSubGroup(paramCode = '') {
|
||||
const top = this.getTopGroup(paramCode);
|
||||
const parts = paramCode.split('.');
|
||||
if (top === 'server') {
|
||||
return parts.length >= 3 ? parts[1] : '_root';
|
||||
}
|
||||
if (top === 'plugins') {
|
||||
return parts.length >= 3 ? parts[1] : '_root';
|
||||
}
|
||||
if (top === 'log' || top === 'session_state') {
|
||||
return '_all';
|
||||
}
|
||||
return '_all';
|
||||
},
|
||||
getTopGroupLabel(key) {
|
||||
const map = {
|
||||
server: 'paramManagement.group.server',
|
||||
plugins: 'paramManagement.group.plugins',
|
||||
log: 'paramManagement.group.log',
|
||||
session_state: 'paramManagement.group.session',
|
||||
general: 'paramManagement.group.general'
|
||||
};
|
||||
return this.$t(map[key] || 'paramManagement.group.general');
|
||||
},
|
||||
getSubGroupLabel(top, sub) {
|
||||
if (sub === '_all') return this.getTopGroupLabel(top);
|
||||
if (sub === '_root') return this.$t('paramManagement.subgroup.root');
|
||||
|
||||
const known = {
|
||||
'server.auth': 'paramManagement.subgroup.auth',
|
||||
'server.connection': 'paramManagement.subgroup.connection',
|
||||
'server.registry': 'paramManagement.subgroup.registry',
|
||||
'server.resilience': 'paramManagement.subgroup.resilience',
|
||||
'server.metrics': 'paramManagement.subgroup.metrics',
|
||||
'server.tracing': 'paramManagement.subgroup.tracing'
|
||||
};
|
||||
const i18nKey = known[`${top}.${sub}`];
|
||||
if (i18nKey) return this.$t(i18nKey);
|
||||
|
||||
if (top === 'plugins') {
|
||||
return this.$t('paramManagement.subgroup.plugin', { name: sub });
|
||||
}
|
||||
return sub;
|
||||
},
|
||||
orderSubKeys(keys, top) {
|
||||
if (top === 'server') {
|
||||
return [
|
||||
...SERVER_SUB_ORDER.filter(k => keys.includes(k)),
|
||||
...keys.filter(k => !SERVER_SUB_ORDER.includes(k)).sort()
|
||||
];
|
||||
}
|
||||
return keys.slice().sort((a, b) => {
|
||||
if (a === '_root' || a === '_all') return -1;
|
||||
if (b === '_root' || b === '_all') return 1;
|
||||
return a.localeCompare(b);
|
||||
});
|
||||
},
|
||||
buildSections(items, withinTopCategory) {
|
||||
const bucket = {};
|
||||
items.forEach(item => {
|
||||
const top = this.getTopGroup(item.paramCode);
|
||||
const sub = this.getSubGroup(item.paramCode);
|
||||
const key = withinTopCategory ? `${top}.${sub}` : `${top}.${sub}`;
|
||||
if (!bucket[key]) {
|
||||
bucket[key] = {
|
||||
key,
|
||||
top,
|
||||
sub,
|
||||
items: []
|
||||
};
|
||||
}
|
||||
bucket[key].items.push(item);
|
||||
});
|
||||
|
||||
const sections = Object.values(bucket).map(section => {
|
||||
const label = withinTopCategory
|
||||
? this.getSubGroupLabel(section.top, section.sub)
|
||||
: (section.sub === '_all' || section.sub === '_root'
|
||||
? this.getTopGroupLabel(section.top)
|
||||
: `${this.getTopGroupLabel(section.top)} · ${this.getSubGroupLabel(section.top, section.sub)}`);
|
||||
return {
|
||||
key: section.key,
|
||||
label,
|
||||
hint: withinTopCategory ? null : null,
|
||||
items: section.items.slice().sort((a, b) => a.paramCode.localeCompare(b.paramCode)),
|
||||
_top: section.top,
|
||||
_sub: section.sub
|
||||
};
|
||||
});
|
||||
|
||||
sections.sort((a, b) => {
|
||||
const topDiff = TOP_GROUP_ORDER.indexOf(a._top) - TOP_GROUP_ORDER.indexOf(b._top);
|
||||
if (topDiff !== 0) return topDiff;
|
||||
const orderA = this.orderSubKeys([a._sub, b._sub], a._top);
|
||||
return orderA.indexOf(a._sub) - orderA.indexOf(b._sub);
|
||||
});
|
||||
|
||||
return sections;
|
||||
},
|
||||
selectCategory(key) {
|
||||
if (this.activeCategory === key) return;
|
||||
this.activeCategory = key;
|
||||
this.activeSubCategory = 'all';
|
||||
this.isAllSelected = false;
|
||||
this.allParams.forEach(row => { row.selected = false; });
|
||||
},
|
||||
selectSubCategory(key) {
|
||||
if (this.activeSubCategory === key) return;
|
||||
this.activeSubCategory = key;
|
||||
this.isAllSelected = false;
|
||||
this.filteredParams.forEach(row => { row.selected = false; });
|
||||
this.syncSelectAllState();
|
||||
},
|
||||
fetchParamsPage(page) {
|
||||
return new Promise((resolve, reject) => {
|
||||
Api.admin.getParamsList(
|
||||
{
|
||||
page,
|
||||
limit: FETCH_LIMIT,
|
||||
paramCode: ""
|
||||
},
|
||||
({ data }) => {
|
||||
if (data.code === 0) {
|
||||
resolve(data.data || {});
|
||||
} else {
|
||||
reject(new Error(data.msg || this.$t('paramManagement.getParamsListFailed')));
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
async fetchParams() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const collected = [];
|
||||
let page = 1;
|
||||
let total = Infinity;
|
||||
// Loop through all pages by total to avoid missing data in the aggregated view when exceeding FETCH_LIMIT
|
||||
while (collected.length < total) {
|
||||
const pageData = await this.fetchParamsPage(page);
|
||||
const list = pageData.list || [];
|
||||
total = typeof pageData.total === 'number' ? pageData.total : collected.length + list.length;
|
||||
collected.push(...list);
|
||||
if (!list.length) break;
|
||||
page += 1;
|
||||
// Defense: Avoid infinite loops on abnormal total or API errors
|
||||
if (page > 200) break;
|
||||
}
|
||||
|
||||
this.allParams = collected.map(item => ({
|
||||
...item,
|
||||
valueType: item.valueType || "string",
|
||||
selected: false,
|
||||
showValue: false
|
||||
}));
|
||||
this.isAllSelected = false;
|
||||
|
||||
// If the current category has no data, fall back to all
|
||||
const exists = this.categoryTabs.some(t => t.key === this.activeCategory);
|
||||
if (!exists) {
|
||||
this.activeCategory = 'all';
|
||||
this.activeSubCategory = 'all';
|
||||
}
|
||||
} catch (err) {
|
||||
this.$message.error({
|
||||
message: (err && err.message) || this.$t('paramManagement.getParamsListFailed'),
|
||||
showClose: true
|
||||
});
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
handleSearch() {
|
||||
this.appliedSearch = this.searchCode;
|
||||
this.activeSubCategory = 'all';
|
||||
this.$nextTick(() => {
|
||||
if (!this.categoryTabs.some(t => t.key === this.activeCategory)) {
|
||||
this.activeCategory = 'all';
|
||||
}
|
||||
this.syncSelectAllState();
|
||||
});
|
||||
},
|
||||
syncSelectAllState() {
|
||||
const list = this.filteredParams;
|
||||
this.isAllSelected = list.length > 0 && list.every(row => row.selected);
|
||||
},
|
||||
handleSelectAll() {
|
||||
this.isAllSelected = !this.isAllSelected;
|
||||
this.filteredParams.forEach(row => {
|
||||
row.selected = this.isAllSelected;
|
||||
});
|
||||
},
|
||||
formatValue(value) {
|
||||
if (value == null) return '';
|
||||
const text = String(value);
|
||||
return text.length > 120 ? `${text.slice(0, 120)}…` : text;
|
||||
},
|
||||
showAddDialog() {
|
||||
this.dialogTitle = this.$t('paramManagement.addParam');
|
||||
this.paramForm = {
|
||||
id: null,
|
||||
paramCode: "",
|
||||
paramValue: "",
|
||||
valueType: "string",
|
||||
remark: ""
|
||||
};
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
editParam(row) {
|
||||
this.dialogTitle = this.$t('paramManagement.editParam');
|
||||
this.paramForm = {
|
||||
id: row.id,
|
||||
paramCode: row.paramCode,
|
||||
paramValue: row.paramValue,
|
||||
valueType: row.valueType || "string",
|
||||
remark: row.remark
|
||||
};
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
handleSubmit(form) {
|
||||
if (form.id) {
|
||||
Api.admin.updateParam(form, ({ data }) => {
|
||||
this.dialogVisible = false;
|
||||
this.fetchParams();
|
||||
this.$message.success({
|
||||
message: this.$t('paramManagement.updateSuccess'),
|
||||
showClose: true
|
||||
});
|
||||
}, ({ data }) => {
|
||||
this.$message.error({
|
||||
message: data.msg || this.$t('paramManagement.updateFailed'),
|
||||
showClose: true
|
||||
});
|
||||
if (this.$refs.paramDialog && typeof this.$refs.paramDialog.resetSaving === 'function') {
|
||||
this.$refs.paramDialog.resetSaving();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Api.admin.addParam(form, ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.dialogVisible = false;
|
||||
this.fetchParams();
|
||||
this.$message.success({
|
||||
message: this.$t('paramManagement.addSuccess'),
|
||||
showClose: true
|
||||
});
|
||||
} else {
|
||||
this.$message.error({
|
||||
message: data.msg || this.$t('paramManagement.addFailed'),
|
||||
showClose: true
|
||||
});
|
||||
if (this.$refs.paramDialog && typeof this.$refs.paramDialog.resetSaving === 'function') {
|
||||
this.$refs.paramDialog.resetSaving();
|
||||
}
|
||||
}
|
||||
}, ({ data }) => {
|
||||
this.$message.error({
|
||||
message: data.msg || this.$t('paramManagement.updateFailed'),
|
||||
showClose: true
|
||||
});
|
||||
if (this.$refs.paramDialog && typeof this.$refs.paramDialog.resetSaving === 'function') {
|
||||
this.$refs.paramDialog.resetSaving();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
deleteSelectedParams() {
|
||||
const selectedParams = this.filteredParams.filter(row => row.selected);
|
||||
if (selectedParams.length === 0) {
|
||||
this.$message.warning({
|
||||
message: this.$t('paramManagement.selectParamsFirst'),
|
||||
showClose: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.deleteParams(selectedParams);
|
||||
},
|
||||
deleteParam(row) {
|
||||
if (!row.id) {
|
||||
this.$message.warning({
|
||||
message: this.$t('paramManagement.selectParamsFirst'),
|
||||
showClose: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.deleteParams([row]);
|
||||
},
|
||||
deleteParams(params) {
|
||||
const paramCount = params.length;
|
||||
const paramIds = params.map(param => param.id).filter(id => id);
|
||||
if (paramIds.length === 0) {
|
||||
this.$message.error({
|
||||
message: this.$t('paramManagement.invalidParamId'),
|
||||
showClose: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.$confirm(this.$t('paramManagement.confirmBatchDelete', { paramCount }), this.$t('message.warning'), {
|
||||
confirmButtonText: this.$t('button.ok'),
|
||||
cancelButtonText: this.$t('button.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
Api.admin.deleteParam(paramIds, ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.fetchParams();
|
||||
this.$message.success({
|
||||
message: this.$t('paramManagement.batchDeleteSuccess', { paramCount }),
|
||||
showClose: true
|
||||
});
|
||||
} else {
|
||||
this.$message.error({
|
||||
message: data.msg || this.$t('paramManagement.deleteFailed'),
|
||||
showClose: true
|
||||
});
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('paramManagement.operationCancelled'),
|
||||
duration: 1000
|
||||
});
|
||||
});
|
||||
},
|
||||
isSensitiveParam(paramCode) {
|
||||
return this.sensitive_keys.some(key => paramCode.toLowerCase().includes(key));
|
||||
},
|
||||
maskSensitiveValue(value) {
|
||||
if (!value || value.length <= 4) {
|
||||
return '****';
|
||||
}
|
||||
return value.substring(0, 2) + '****' + value.substring(value.length - 2);
|
||||
},
|
||||
toggleSensitiveValue(row) {
|
||||
row.showValue = !row.showValue;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.welcome {
|
||||
min-width: 900px;
|
||||
min-height: 506px;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
position: relative;
|
||||
flex-direction: column;
|
||||
background: #eff4ff;
|
||||
overflow: hidden;
|
||||
min-width: 900px;
|
||||
min-height: 506px;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
position: relative;
|
||||
flex-direction: column;
|
||||
background-size: cover;
|
||||
background: linear-gradient(to bottom right, #dce8ff, #e4eeff, #e6cbfd) center;
|
||||
-webkit-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.main-wrapper {
|
||||
margin: 5px 22px;
|
||||
// Top 63px, bottom 35px, query 72px
|
||||
height: calc(100vh - 63px - 35px - 72px);
|
||||
margin: 0 22px;
|
||||
border-radius: 15px;
|
||||
min-height: calc(100vh - 24vh);
|
||||
height: auto;
|
||||
max-height: 80vh;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
position: relative;
|
||||
background: rgba(237, 242, 255, 0.5);
|
||||
|
|
@ -778,77 +392,70 @@ export default {
|
|||
flex-direction: column;
|
||||
}
|
||||
|
||||
.operation-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 0 12px 0;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.title-block {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 12px;
|
||||
.operation-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16px 24px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-weight: 500;
|
||||
font-size: 24px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.total-hint {
|
||||
color: #8b93b5;
|
||||
font-size: 13px;
|
||||
font-size: 24px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.right-operations {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-left: auto;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
width: 280px;
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
.btn-search {
|
||||
background: linear-gradient(135deg, #6b8cff, #a966ff);
|
||||
border: none;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.content-panel {
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
border-radius: 15px;
|
||||
background: transparent;
|
||||
border: 1px solid #fff;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
border-radius: 15px;
|
||||
background: transparent;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
|
||||
.content-area {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
min-width: 600px;
|
||||
overflow: hidden;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
min-width: 600px;
|
||||
overflow: auto;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.params-card {
|
||||
background: white;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
overflow: hidden;
|
||||
|
||||
::v-deep .el-card__body {
|
||||
padding: 14px 20px;
|
||||
background: white;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
::v-deep .el-card__body {
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.table_bottom {
|
||||
|
|
@ -856,27 +463,186 @@ export default {
|
|||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
// padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.ctrl_btn {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding-left: 26px;
|
||||
|
||||
.el-button {
|
||||
min-width: 72px;
|
||||
height: 32px;
|
||||
padding: 7px 12px 7px 10px;
|
||||
font-size: 12px;
|
||||
border-radius: 4px;
|
||||
line-height: 1;
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
}
|
||||
|
||||
.el-button--primary {
|
||||
background: #5f70f3;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.el-button--danger {
|
||||
background: #fd5b63;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
.footer-meta {
|
||||
color: #8b93b5;
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
.custom-pagination {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
|
||||
.sep {
|
||||
margin: 0 6px;
|
||||
}
|
||||
.el-select {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.pagination-btn:first-child,
|
||||
.pagination-btn:nth-child(2),
|
||||
.pagination-btn:nth-last-child(2),
|
||||
.pagination-btn:nth-child(3) {
|
||||
min-width: 60px;
|
||||
height: 32px;
|
||||
padding: 0 12px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #e4e7ed;
|
||||
background: #dee7ff;
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
background: #d7dce6;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.pagination-btn:not(:first-child):not(:nth-child(3)):not(:nth-child(2)):not(:nth-last-child(2)) {
|
||||
min-width: 28px;
|
||||
height: 32px;
|
||||
padding: 0;
|
||||
border-radius: 4px;
|
||||
border: 1px solid transparent;
|
||||
background: transparent;
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
background: rgba(245, 247, 250, 0.3);
|
||||
}
|
||||
}
|
||||
|
||||
.pagination-btn.active {
|
||||
background: #5f70f3 !important;
|
||||
color: #ffffff !important;
|
||||
border-color: #5f70f3 !important;
|
||||
|
||||
&:hover {
|
||||
background: #6d7cf5 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.total-text {
|
||||
color: #909399;
|
||||
font-size: 14px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.transparent-table) {
|
||||
background: white;
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.el-table__body-wrapper {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
max-height: none !important;
|
||||
}
|
||||
|
||||
.el-table__header-wrapper {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.el-table__header th {
|
||||
background: white !important;
|
||||
color: black;
|
||||
}
|
||||
|
||||
&::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.el-table__body tr {
|
||||
background-color: white;
|
||||
|
||||
td {
|
||||
border-top: 1px solid rgba(0, 0, 0, 0.04);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
:deep(.el-checkbox__inner) {
|
||||
background-color: #ffffff !important;
|
||||
border-color: #cccccc !important;
|
||||
}
|
||||
|
||||
:deep(.el-checkbox__inner:hover) {
|
||||
border-color: #cccccc !important;
|
||||
}
|
||||
|
||||
:deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
|
||||
background-color: #5f70f3 !important;
|
||||
border-color: #5f70f3 !important;
|
||||
}
|
||||
|
||||
@media (min-width: 1144px) {
|
||||
.table_bottom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
:deep(.transparent-table) {
|
||||
.el-table__body tr {
|
||||
td {
|
||||
padding-top: 16px;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
|
||||
&+tr {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-table .el-button--text) {
|
||||
color: #7079aa;
|
||||
color: #7079aa;
|
||||
}
|
||||
|
||||
:deep(.el-table .el-button--text:hover) {
|
||||
|
|
@ -945,7 +711,7 @@ export default {
|
|||
}
|
||||
|
||||
.el-table {
|
||||
--table-max-height: calc(100vh - 40vh);
|
||||
// --table-max-height: calc(100vh - 40vh);
|
||||
max-height: var(--table-max-height);
|
||||
|
||||
.el-table__body-wrapper {
|
||||
|
|
|
|||
|
|
@ -1,24 +1,19 @@
|
|||
<template>
|
||||
<div class="welcome">
|
||||
<HeaderBar />
|
||||
<div class="main-wrapper">
|
||||
<div class="content-panel">
|
||||
<div class="content-area">
|
||||
<el-card class="params-card" shadow="never">
|
||||
<div class="operation-header">
|
||||
<h2 class="page-title">{{ $t('voiceClone.title') }}</h2>
|
||||
<div class="right-operations">
|
||||
<div class="welcome">
|
||||
<HeaderBar />
|
||||
<div class="operation-bar">
|
||||
<h2 class="page-title">{{ $t('voiceClone.title') }}</h2>
|
||||
<div class="right-operations">
|
||||
<el-input :placeholder="$t('voiceClone.searchPlaceholder')" v-model="searchName" class="search-input"
|
||||
@keyup.enter.native="handleSearch" clearable />
|
||||
<CustomButton type="confirm" icon="el-icon-search" @click="handleSearch">{{ $t('voiceClone.search') }}</CustomButton>
|
||||
</div>
|
||||
@keyup.enter.native="handleSearch" clearable />
|
||||
<el-button class="btn-search" @click="handleSearch">{{ $t('voiceClone.search') }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-wrapper">
|
||||
<div class="content-panel">
|
||||
<div class="content-area">
|
||||
<!-- Show the table or the empty state -->
|
||||
<!-- Show table or empty state -->
|
||||
<el-card class="params-card" shadow="never" v-if="total > 0">
|
||||
<el-table ref="paramsTable" :data="voiceCloneList" class="transparent-table" v-loading="loading"
|
||||
element-loading-text="Loading" element-loading-spinner="el-icon-loading"
|
||||
|
|
@ -103,7 +98,7 @@
|
|||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- Empty state -->
|
||||
<!-- Empty state message -->
|
||||
<div v-else-if="!loading" class="empty-state-wrapper">
|
||||
<div class="empty-state">
|
||||
<div class="empty-icon">
|
||||
|
|
@ -116,43 +111,18 @@
|
|||
{{ $t('voiceClone.contactAdmin') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-right" :class="{ 'info-right--centered': !item.hasVoice }">
|
||||
<el-tooltip :content="getTooltipContent(item)" placement="top" effect="light">
|
||||
<div class="status-button" :class="getStatusButtonClass(item)">
|
||||
<span>{{ getTrainStatusText(item) }}</span>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
<div v-if="item.hasVoice" class="voice-wave" :class="{ 'is-playing': playingRowId === item.id }">
|
||||
<span class="wave-bar"></span>
|
||||
<span class="wave-bar"></span>
|
||||
<span class="wave-bar"></span>
|
||||
<span class="wave-bar"></span>
|
||||
<span class="wave-bar"></span>
|
||||
<span class="wave-bar"></span>
|
||||
<span class="wave-bar"></span>
|
||||
<span class="wave-bar"></span>
|
||||
<span class="wave-bar"></span>
|
||||
<span class="wave-bar"></span>
|
||||
<span class="wave-bar"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-footer>
|
||||
<version-footer />
|
||||
</el-footer>
|
||||
|
||||
<!-- Clone dialog -->
|
||||
<VoiceCloneDialog :visible.sync="cloneDialogVisible" :voiceCloneData="currentVoiceClone"
|
||||
@success="handleCloneSuccess" />
|
||||
</div>
|
||||
|
||||
<el-footer>
|
||||
<version-footer />
|
||||
</el-footer>
|
||||
|
||||
<VoiceCloneDialog :visible.sync="cloneDialogVisible" :voiceCloneData="currentVoiceClone"
|
||||
@success="handleCloneSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -160,8 +130,6 @@ import Api from "@/apis/api";
|
|||
import HeaderBar from "@/components/HeaderBar.vue";
|
||||
import VersionFooter from "@/components/VersionFooter.vue";
|
||||
import VoiceCloneDialog from "@/components/VoiceCloneDialog.vue";
|
||||
import CustomButton from "@/components/CustomButton.vue";
|
||||
import CustomPagination from "@/components/CustomPagination.vue";
|
||||
import { formatDate } from "@/utils/format";
|
||||
|
||||
export default {
|
||||
|
|
@ -184,24 +152,13 @@ export default {
|
|||
voiceIds: [],
|
||||
userId: null
|
||||
},
|
||||
// Audio playback state
|
||||
// Audio playback related
|
||||
currentAudio: null, // Audio object currently playing
|
||||
playingRowId: null // ID of the row currently playing
|
||||
playingRowId: null // ID of the currently playing row
|
||||
};
|
||||
},
|
||||
handleViewDetails(row) {
|
||||
console.log('View details:', row);
|
||||
},
|
||||
handlePageSizeChange(val) {
|
||||
this.pageSize = val;
|
||||
this.currentPage = 1;
|
||||
this.fetchVoiceCloneList();
|
||||
},
|
||||
goToPage(page) {
|
||||
if (page !== this.currentPage) {
|
||||
this.currentPage = page;
|
||||
created() {
|
||||
this.fetchVoiceCloneList();
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
|
@ -231,11 +188,11 @@ export default {
|
|||
}
|
||||
switch (row.trainStatus) {
|
||||
case 0:
|
||||
return 'Pending clone';
|
||||
return 'Pending cloning';
|
||||
case 2:
|
||||
return 'Training successful';
|
||||
return 'Training succeeded';
|
||||
case 3:
|
||||
// Show the training error when available.
|
||||
// Display intelligently based on error message when training fails
|
||||
if (row.trainError) {
|
||||
return `Training failed: ${row.trainError}`;
|
||||
}
|
||||
|
|
@ -246,7 +203,7 @@ export default {
|
|||
},
|
||||
handleViewDetails(row) {
|
||||
console.log('View details:', row);
|
||||
// Add detail-view logic here if needed.
|
||||
// Add logic to view details here
|
||||
},
|
||||
handlePageSizeChange(val) {
|
||||
this.pageSize = val;
|
||||
|
|
@ -318,7 +275,7 @@ export default {
|
|||
return '';
|
||||
}
|
||||
},
|
||||
// Get the status button style
|
||||
// Get status button style
|
||||
getStatusButtonClass(row) {
|
||||
if (!row.hasVoice || row.trainStatus === 0) {
|
||||
return 'status-waiting';
|
||||
|
|
@ -329,7 +286,7 @@ export default {
|
|||
}
|
||||
return '';
|
||||
},
|
||||
// Handle the clone action
|
||||
// Handle cloning operation
|
||||
handleClone(row) {
|
||||
// Prevent duplicate submissions
|
||||
if (row._cloning) {
|
||||
|
|
@ -346,31 +303,32 @@ export default {
|
|||
res = res.data;
|
||||
if (res.code === 0) {
|
||||
this.$message.success(this.$t('message.success'));
|
||||
// Refresh after a successful clone.
|
||||
// Refresh list after successful cloning
|
||||
this.fetchVoiceCloneList();
|
||||
} else {
|
||||
// Refresh to pick up the full error details.
|
||||
console.log('API returned an error; refreshing to fetch details');
|
||||
// Refresh list on clone failure to get complete error information
|
||||
console.log('API returned an error. Refreshing list to get detailed error info.');
|
||||
this.$message.error(res.msg || this.$t('message.error'));
|
||||
// Refresh list to get full error details saved by the backend
|
||||
this.fetchVoiceCloneList();
|
||||
}
|
||||
} catch (error) {
|
||||
// Refresh if response handling fails.
|
||||
console.error('Error handling response:', error);
|
||||
this.$message.error('Error handling response');
|
||||
// Response processing error, refresh list
|
||||
console.error('Error processing response:', error);
|
||||
this.$message.error('Error processing response');
|
||||
this.fetchVoiceCloneList();
|
||||
} finally {
|
||||
this.$set(row, '_cloning', false);
|
||||
}
|
||||
}, (error) => {
|
||||
// Refresh on API failure so the latest status is visible.
|
||||
// API call failed, refresh list to get the latest status
|
||||
console.error('API call failed:', error);
|
||||
this.$message.error('Clone failed. Hover over the error message to view details.');
|
||||
this.fetchVoiceCloneList();
|
||||
this.$set(row, '_cloning', false);
|
||||
});
|
||||
} catch (error) {
|
||||
// Refresh if the API call throws unexpectedly.
|
||||
// API call error, refresh list
|
||||
console.error('Error calling API:', error);
|
||||
this.$message.error('Error calling API');
|
||||
this.fetchVoiceCloneList();
|
||||
|
|
@ -378,52 +336,52 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
// Update row state and refresh the view
|
||||
// Update row status and trigger view update
|
||||
updateRowStatus(row, status, statusCode = null) {
|
||||
// Directly mutating an object inside an array may not trigger a Vue update
|
||||
// In Vue, directly modifying object properties in an array may not trigger view updates
|
||||
const index = this.voiceCloneList.findIndex(item => item.id === row.id);
|
||||
const updateData = {
|
||||
trainStatus: status
|
||||
};
|
||||
|
||||
// Update status code metadata when provided
|
||||
// If a status code is provided, update the status code info as well
|
||||
if (statusCode !== null) {
|
||||
updateData.statusCode = statusCode;
|
||||
}
|
||||
|
||||
if (index !== -1) {
|
||||
// Use Vue.set to guarantee reactive updates
|
||||
// Use Vue.set to ensure reactive updates
|
||||
this.$set(this.voiceCloneList, index, {
|
||||
...this.voiceCloneList[index],
|
||||
...updateData
|
||||
});
|
||||
// Force the table to re-render
|
||||
// Force table re-render
|
||||
if (this.$refs.paramsTable) {
|
||||
this.$refs.paramsTable.doLayout();
|
||||
}
|
||||
} else {
|
||||
// If the index cannot be found, update the row object directly
|
||||
// If the index is not found, update the row object directly
|
||||
row.trainStatus = status;
|
||||
if (statusCode !== null) {
|
||||
row.statusCode = statusCode;
|
||||
}
|
||||
// Force the entire table to re-render
|
||||
// Force full table re-render
|
||||
this.$forceUpdate();
|
||||
}
|
||||
console.log('Updating row status:', row.id, 'status:', status, 'status code:', statusCode);
|
||||
console.log('Updating row status:', row.id, 'Status:', status, 'Status code:', statusCode);
|
||||
},
|
||||
// Callback after a successful clone.
|
||||
// Callback after successful cloning
|
||||
handleCloneSuccess() {
|
||||
this.fetchVoiceCloneList();
|
||||
},
|
||||
// Enter edit mode.
|
||||
// Enter edit mode
|
||||
handleEditName(row) {
|
||||
this.$set(row, 'isEdit', true);
|
||||
this.$nextTick(() => {
|
||||
// Focus the input field.
|
||||
// Focus input field
|
||||
const input = this.$refs.nameInput;
|
||||
if (input) {
|
||||
// nameInput may be an array.
|
||||
// nameInput may be an array
|
||||
if (Array.isArray(input)) {
|
||||
const idx = this.voiceCloneList.indexOf(row);
|
||||
if (input[idx]) {
|
||||
|
|
@ -435,9 +393,9 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
// Submit the name change.
|
||||
// Submit name change
|
||||
submitName(row) {
|
||||
// Prevent duplicate submissions.
|
||||
// Prevent duplicate submissions
|
||||
if (row._submitting) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -453,55 +411,56 @@ export default {
|
|||
if (res.code === 0) {
|
||||
this.$message.success(this.$t('voiceClone.updateNameSuccess') || 'Name updated successfully');
|
||||
} else {
|
||||
this.$message.error(res.msg || this.$t('voiceClone.updateNameFailed') || 'Failed to update name');
|
||||
this.$message.error(res.msg || this.$t('voiceClone.updateNameFailed') || 'Name update failed');
|
||||
// Restore original value on failure
|
||||
this.fetchVoiceCloneList();
|
||||
}
|
||||
row._submitting = false;
|
||||
});
|
||||
},
|
||||
// Submit when the name input loses focus.
|
||||
// Name input: submit on blur
|
||||
onNameBlur(row) {
|
||||
row.isEdit = false;
|
||||
setTimeout(() => {
|
||||
this.submitName(row);
|
||||
}, 100); // Small delay avoids the enter+blur overlap.
|
||||
}, 100); // Delay 100ms to avoid the window where enter and blur trigger simultaneously
|
||||
},
|
||||
// Submit when Enter is pressed in the name input.
|
||||
// Name input: submit on Enter
|
||||
onNameEnter(row) {
|
||||
row.isEdit = false;
|
||||
this.submitName(row);
|
||||
},
|
||||
// Play audio.
|
||||
// Play audio
|
||||
handlePlay(row) {
|
||||
// Stop if the clicked row is already playing.
|
||||
// If the clicked row is currently playing, stop playback
|
||||
if (this.playingRowId === row.id && this.currentAudio) {
|
||||
this.stopCurrentAudio();
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop any currently playing audio.
|
||||
// Stop the currently playing audio (if any)
|
||||
this.stopCurrentAudio();
|
||||
|
||||
// Fetch the audio download ID first.
|
||||
// Fetch audio download ID first
|
||||
Api.voiceClone.getAudioId(row.id, (res) => {
|
||||
res = res.data;
|
||||
if (res.code === 0) {
|
||||
const uuid = res.data;
|
||||
// Play the audio using the returned UUID.
|
||||
// Play audio using the retrieved uuid
|
||||
const audioUrl = Api.voiceClone.getPlayVoiceUrl(uuid);
|
||||
const audio = new Audio(audioUrl);
|
||||
|
||||
// Mark this row as playing.
|
||||
// Set current playback status
|
||||
this.currentAudio = audio;
|
||||
this.playingRowId = row.id;
|
||||
|
||||
// Clear state when playback ends.
|
||||
// Clear state when playback ends
|
||||
audio.addEventListener('ended', () => {
|
||||
this.playingRowId = null;
|
||||
this.currentAudio = null;
|
||||
});
|
||||
|
||||
// Clear state on playback error.
|
||||
// Clear state on playback error
|
||||
audio.addEventListener('error', () => {
|
||||
this.playingRowId = null;
|
||||
this.currentAudio = null;
|
||||
|
|
@ -514,11 +473,11 @@ export default {
|
|||
this.currentAudio = null;
|
||||
});
|
||||
} else {
|
||||
this.$message.error(res.msg || this.$t('voiceClone.audioNotExist') || 'Audio does not exist');
|
||||
this.$message.error(res.msg || this.$t('voiceClone.audioNotExist') || 'Audio not found');
|
||||
}
|
||||
});
|
||||
},
|
||||
// Stop the current audio playback.
|
||||
// Stop current audio playback
|
||||
stopCurrentAudio() {
|
||||
if (this.currentAudio) {
|
||||
this.currentAudio.pause();
|
||||
|
|
@ -527,196 +486,32 @@ export default {
|
|||
}
|
||||
this.playingRowId = null;
|
||||
},
|
||||
// Upload audio.
|
||||
// Upload audio
|
||||
handleUpload(row) {
|
||||
this.currentVoiceClone = row;
|
||||
this.cloneDialogVisible = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleSearch() {
|
||||
this.currentPage = 1;
|
||||
this.fetchVoiceCloneList();
|
||||
},
|
||||
formatDate,
|
||||
getTrainStatusText(row) {
|
||||
if (!row.hasVoice) {
|
||||
return this.$t('voiceClone.waitingUpload');
|
||||
}
|
||||
switch (row.trainStatus) {
|
||||
case 0:
|
||||
return this.$t('voiceClone.waitingTraining');
|
||||
case 2:
|
||||
return this.$t('voiceClone.trainSuccess');
|
||||
case 3:
|
||||
return this.$t('voiceClone.trainFailed');
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
},
|
||||
getStatusButtonClass(row) {
|
||||
if (!row.hasVoice || row.trainStatus === 0) {
|
||||
return 'status-waiting';
|
||||
} else if (row.trainStatus === 2) {
|
||||
return 'status-success';
|
||||
} else if (row.trainStatus === 3) {
|
||||
return 'status-failed';
|
||||
}
|
||||
return '';
|
||||
},
|
||||
handleClone(row) {
|
||||
if (row._cloning) {
|
||||
return;
|
||||
}
|
||||
this.$set(row, '_cloning', true);
|
||||
const params = { cloneId: row.id };
|
||||
try {
|
||||
Api.voiceClone.cloneAudio(params, (res) => {
|
||||
try {
|
||||
res = res.data;
|
||||
if (res.code === 0) {
|
||||
this.$message.success(this.$t('message.success'));
|
||||
this.fetchVoiceCloneList();
|
||||
} else {
|
||||
this.$message.error(res.msg || this.$t('message.error'));
|
||||
this.fetchVoiceCloneList();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error processing response:', error);
|
||||
this.$message.error('Error processing response');
|
||||
this.fetchVoiceCloneList();
|
||||
} finally {
|
||||
this.$set(row, '_cloning', false);
|
||||
}
|
||||
}, (error) => {
|
||||
console.error('API call failed:', error);
|
||||
this.$message.error(this.$t('voiceClone.cloneErrorTip'));
|
||||
this.fetchVoiceCloneList();
|
||||
this.$set(row, '_cloning', false);
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error calling API:', error);
|
||||
this.$message.error(this.$t('voiceClone.apiError'));
|
||||
this.fetchVoiceCloneList();
|
||||
this.$set(row, '_cloning', false);
|
||||
}
|
||||
},
|
||||
handleCloneSuccess() {
|
||||
this.fetchVoiceCloneList();
|
||||
},
|
||||
handleEditName(row) {
|
||||
this.$set(row, 'isEdit', true);
|
||||
this.$nextTick(() => {
|
||||
const input = this.$refs.nameInput;
|
||||
if (input) {
|
||||
if (Array.isArray(input)) {
|
||||
const idx = this.voiceCloneList.indexOf(row);
|
||||
if (input[idx]) {
|
||||
input[idx].focus();
|
||||
}
|
||||
} else {
|
||||
input.focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
submitName(row) {
|
||||
if (row._submitting) {
|
||||
return;
|
||||
}
|
||||
row._submitting = true;
|
||||
const params = { id: row.id, name: row.name };
|
||||
Api.voiceClone.updateName(params, (res) => {
|
||||
res = res.data;
|
||||
if (res.code === 0) {
|
||||
this.$message.success(this.$t('voiceClone.updateNameSuccess') || 'Name updated successfully');
|
||||
} else {
|
||||
this.$message.error(res.msg || this.$t('voiceClone.updateNameFailed') || 'Name update failed');
|
||||
this.fetchVoiceCloneList();
|
||||
}
|
||||
row._submitting = false;
|
||||
});
|
||||
},
|
||||
handleEditButtonClick(row) {
|
||||
if (row.isEdit) {
|
||||
row.isEdit = false;
|
||||
this.submitName(row);
|
||||
} else {
|
||||
this.handleEditName(row);
|
||||
}
|
||||
},
|
||||
onNameEnter(row) {
|
||||
row.isEdit = false;
|
||||
this.submitName(row);
|
||||
},
|
||||
handlePlay(row) {
|
||||
if (this.playingRowId === row.id && this.currentAudio) {
|
||||
this.stopCurrentAudio();
|
||||
return;
|
||||
}
|
||||
this.stopCurrentAudio();
|
||||
Api.voiceClone.getAudioId(row.id, (res) => {
|
||||
res = res.data;
|
||||
if (res.code === 0) {
|
||||
const uuid = res.data;
|
||||
const audioUrl = Api.voiceClone.getPlayVoiceUrl(uuid);
|
||||
const audio = new Audio(audioUrl);
|
||||
this.currentAudio = audio;
|
||||
this.playingRowId = row.id;
|
||||
audio.addEventListener('ended', () => {
|
||||
this.playingRowId = null;
|
||||
this.currentAudio = null;
|
||||
});
|
||||
audio.addEventListener('error', () => {
|
||||
this.playingRowId = null;
|
||||
this.currentAudio = null;
|
||||
});
|
||||
audio.play().catch(err => {
|
||||
console.error('Playback failed:', err);
|
||||
this.$message.error(this.$t('voiceClone.playFailed') || 'Playback failed');
|
||||
this.playingRowId = null;
|
||||
this.currentAudio = null;
|
||||
});
|
||||
} else {
|
||||
this.$message.error(res.msg || this.$t('voiceClone.audioNotExist') || 'Audio not found');
|
||||
}
|
||||
});
|
||||
},
|
||||
stopCurrentAudio() {
|
||||
if (this.currentAudio) {
|
||||
this.currentAudio.pause();
|
||||
this.currentAudio.currentTime = 0;
|
||||
this.currentAudio = null;
|
||||
}
|
||||
this.playingRowId = null;
|
||||
},
|
||||
handleUpload(row) {
|
||||
this.currentVoiceClone = row;
|
||||
this.cloneDialogVisible = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@/styles/global.scss';
|
||||
|
||||
.welcome {
|
||||
min-width: 900px;
|
||||
min-height: 506px;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
position: relative;
|
||||
flex-direction: column;
|
||||
background-size: cover;
|
||||
background: #eff4ff;
|
||||
-webkit-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
overflow: hidden;
|
||||
min-width: 900px;
|
||||
min-height: 506px;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
position: relative;
|
||||
flex-direction: column;
|
||||
background-size: cover;
|
||||
background: linear-gradient(to bottom right, #dce8ff, #e4eeff, #e6cbfd) center;
|
||||
-webkit-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.main-wrapper {
|
||||
// Top 63px, bottom 35px, search 72px
|
||||
// Top 63px, bottom 35px, query 72px
|
||||
height: calc(100vh - 63px - 35px - 72px);
|
||||
margin: 0 22px;
|
||||
border-radius: 15px;
|
||||
|
|
@ -727,64 +522,70 @@ export default {
|
|||
flex-direction: column;
|
||||
}
|
||||
|
||||
.operation-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 0 16px 0;
|
||||
.operation-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16px 24px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-weight: 500;
|
||||
font-size: 24px;
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.right-operations {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-left: auto;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
width: 240px;
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
.btn-search {
|
||||
background: linear-gradient(135deg, #6b8cff, #a966ff);
|
||||
border: none;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.content-panel {
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
border-radius: 15px;
|
||||
background: transparent;
|
||||
border: 1px solid #fff;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
border-radius: 15px;
|
||||
background: transparent;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
|
||||
.content-area {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
min-width: 600px;
|
||||
overflow: auto;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
min-width: 600px;
|
||||
overflow: auto;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.params-card {
|
||||
background: white;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
overflow: hidden;
|
||||
|
||||
::v-deep .el-card__body {
|
||||
padding: 14px 20px;
|
||||
background: white;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
::v-deep .el-card__body {
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.table_bottom {
|
||||
|
|
@ -975,204 +776,105 @@ export default {
|
|||
|
||||
/* Status button styles */
|
||||
.status-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 4px 10px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 4px 10px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.status-waiting {
|
||||
background-color: #f5f7fa;
|
||||
color: #909399;
|
||||
border: 1px solid #e4e7ed;
|
||||
background-color: #f5f7fa;
|
||||
color: #909399;
|
||||
border: 1px solid #e4e7ed;
|
||||
}
|
||||
|
||||
.status-success {
|
||||
background-color: #f6ffed;
|
||||
color: #52c41a;
|
||||
border: 1px solid #b7eb8f;
|
||||
background-color: #f6ffed;
|
||||
color: #52c41a;
|
||||
border: 1px solid #b7eb8f;
|
||||
}
|
||||
|
||||
.status-failed {
|
||||
background-color: #fff2f0;
|
||||
color: #ff4d4f;
|
||||
border: 1px solid #ffccc7;
|
||||
background-color: #fff2f0;
|
||||
color: #ff4d4f;
|
||||
border: 1px solid #ffccc7;
|
||||
}
|
||||
|
||||
.voice-clone-grid {
|
||||
padding: 10px 16px;
|
||||
margin-bottom: 20px;
|
||||
height: calc(100% - 90px);
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
|
||||
gap: 16px;
|
||||
align-content: start;
|
||||
min-height: 200px;
|
||||
overflow: auto;
|
||||
@include scrollbar-style;
|
||||
}
|
||||
|
||||
.voice-clone-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
padding: 16px 16px 8px;
|
||||
background: #fff;
|
||||
box-shadow: 0 0 10px 0 #e8ecf5;
|
||||
border-radius: 8px;
|
||||
transition: box-shadow 0.2s, border-color 0.2s;
|
||||
|
||||
&:hover {
|
||||
border-color: #c0caff;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
}
|
||||
|
||||
.card-top {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.voice-wave {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 5px;
|
||||
flex: 1;
|
||||
min-height: 40px;
|
||||
width: 100%;
|
||||
padding: 0 4px;
|
||||
|
||||
.wave-bar {
|
||||
width: 3px;
|
||||
height: 50%;
|
||||
max-height: 80px;
|
||||
background: linear-gradient(to top, #a5b4fc 0%, #c4b5fd 100%);
|
||||
border-radius: 2px;
|
||||
transform-origin: center;
|
||||
animation: voice-wave 1.2s ease-in-out infinite paused;
|
||||
|
||||
&:nth-child(1) { animation-delay: -0s; }
|
||||
&:nth-child(2) { animation-delay: -0.12s; }
|
||||
&:nth-child(3) { animation-delay: -0.24s; }
|
||||
&:nth-child(4) { animation-delay: -0.36s; }
|
||||
&:nth-child(5) { animation-delay: -0.48s; }
|
||||
&:nth-child(6) { animation-delay: -0.6s; }
|
||||
&:nth-child(7) { animation-delay: -0.72s; }
|
||||
&:nth-child(8) { animation-delay: -0.84s; }
|
||||
&:nth-child(9) { animation-delay: -0.96s; }
|
||||
&:nth-child(10) { animation-delay: -1.08s; }
|
||||
&:nth-child(11) { animation-delay: -1.2s; }
|
||||
}
|
||||
|
||||
&.is-playing .wave-bar {
|
||||
animation-play-state: running;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes voice-wave {
|
||||
0%, 100% { transform: scaleY(0.2); }
|
||||
50% { transform: scaleY(0.95); }
|
||||
}
|
||||
|
||||
.card-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.info-left {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.info-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 10px;
|
||||
flex-shrink: 0;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.info-title {
|
||||
min-width: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
|
||||
.name-text {
|
||||
line-height: 28px;
|
||||
text-align: left;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
margin-right: 10px;
|
||||
color: #909399;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
color: #303133;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px 8px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid #f0f2f5;
|
||||
|
||||
::v-deep .el-button {
|
||||
display: flex;
|
||||
.name-view {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
gap: 6px;
|
||||
cursor: pointer;
|
||||
|
||||
::v-deep .el-button--text {
|
||||
color: #7079aa;
|
||||
}
|
||||
i {
|
||||
color: #909399;
|
||||
font-size: 14px;
|
||||
|
||||
::v-deep .el-button--text:hover {
|
||||
color: #5a64b5;
|
||||
}
|
||||
&:hover {
|
||||
color: #5a64b5;
|
||||
}
|
||||
}
|
||||
|
||||
span {
|
||||
&:hover {
|
||||
color: #5a64b5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
grid-column: 1 / -1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 60px 0;
|
||||
color: #909399;
|
||||
font-size: 14px;
|
||||
:deep(.el-checkbox__inner) {
|
||||
background-color: #ffffff !important;
|
||||
border-color: #cccccc !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
:deep(.el-checkbox__inner:hover) {
|
||||
border-color: #cccccc !important;
|
||||
}
|
||||
|
||||
:deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
|
||||
background-color: #5f70f3 !important;
|
||||
border-color: #5f70f3 !important;
|
||||
}
|
||||
|
||||
:deep(.el-loading-mask) {
|
||||
background-color: rgba(255, 255, 255, 0.6) !important;
|
||||
backdrop-filter: blur(2px);
|
||||
}
|
||||
|
||||
:deep(.el-loading-spinner .path) {
|
||||
stroke: #6b8cff;
|
||||
}
|
||||
|
||||
.el-table {
|
||||
--table-max-height: calc(100vh - 40vh);
|
||||
// max-height: var(--table-max-height);
|
||||
|
||||
.el-table__body-wrapper {
|
||||
max-height: calc(var(--table-max-height) - 40px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1144px) {
|
||||
.table_bottom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
:deep(.transparent-table) {
|
||||
.el-table__body tr {
|
||||
td {
|
||||
padding-top: 16px;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
|
||||
&+tr {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -446,16 +446,20 @@ export default {
|
|||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.left-add {
|
||||
width: 105px;
|
||||
height: 34px;
|
||||
border-radius: 17px;
|
||||
background: #5778ff;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
line-height: 34px;
|
||||
.search-container {
|
||||
width: 360px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.search-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.custom-search-input {
|
||||
&::v-deep .el-input__inner {
|
||||
border-radius: 20px;
|
||||
border: 1px solid transparent;
|
||||
box-shadow: 0 2px 2px 0 #cfe1fb;
|
||||
}
|
||||
&::v-deep .el-input__suffix {
|
||||
right: 10px;
|
||||
|
|
|
|||
|
|
@ -121,11 +121,13 @@
|
|||
</div>
|
||||
<div style="font-size: 14px; color: #979db1">
|
||||
{{ $t("login.agreeTo") }}
|
||||
<div style="display: inline-block; color: #5778ff; cursor: pointer">
|
||||
<div style="display: inline-block; color: #5778ff; cursor: pointer"
|
||||
@click="openPage('/user-agreement-en.html')">
|
||||
{{ $t("login.userAgreement") }}
|
||||
</div>
|
||||
{{ $t("login.and") }}
|
||||
<div style="display: inline-block; color: #5778ff; cursor: pointer">
|
||||
<div style="display: inline-block; color: #5778ff; cursor: pointer"
|
||||
@click="openPage('/privacy-policy-en.html')">
|
||||
{{ $t("login.privacyPolicy") }}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -330,6 +332,9 @@ export default {
|
|||
goToForgetPassword() {
|
||||
goToPage("/retrieve-password");
|
||||
},
|
||||
openPage(url) {
|
||||
window.open(url, "_blank");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -102,9 +102,9 @@
|
|||
<!-- Keep the same agreement statement -->
|
||||
<div style="font-size: 14px;color: #979db1;">
|
||||
{{ $t('register.agreeTo') }}
|
||||
<div style="display: inline-block;color: #5778FF;cursor: pointer;">{{ $t('register.userAgreement') }}</div>
|
||||
<div style="display: inline-block;color: #5778FF;cursor: pointer;" @click="openPage('/user-agreement-en.html')">{{ $t('register.userAgreement') }}</div>
|
||||
{{ $t('register.and') }}
|
||||
<div style="display: inline-block;color: #5778FF;cursor: pointer;">{{ $t('register.privacyPolicy') }}</div>
|
||||
<div style="display: inline-block;color: #5778FF;cursor: pointer;" @click="openPage('/privacy-policy-en.html')">{{ $t('register.privacyPolicy') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-main>
|
||||
|
|
@ -314,6 +314,9 @@ export default {
|
|||
|
||||
goToLogin() {
|
||||
goToPage('/login')
|
||||
},
|
||||
openPage(url) {
|
||||
window.open(url, '_blank')
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue