system-settings.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. <div class="system-settings">
  2. <!-- 引入ECharts的CDN -->
  3. <script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
  4. <style>
  5. /* 全局样式 */
  6. :host {
  7. display: block;
  8. padding: 20px;
  9. background-color: #f5f7fa;
  10. min-height: 100vh;
  11. }
  12. /* 统计卡片样式 */
  13. .stats-cards {
  14. display: grid;
  15. grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  16. gap: 20px;
  17. margin-bottom: 24px;
  18. }
  19. .stat-card {
  20. background: white;
  21. padding: 20px;
  22. border-radius: 8px;
  23. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  24. transition: transform 0.3s, box-shadow 0.3s;
  25. }
  26. .stat-card:hover {
  27. transform: translateY(-2px);
  28. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  29. }
  30. .stat-card .label {
  31. font-size: 14px;
  32. color: #666;
  33. margin-bottom: 8px;
  34. }
  35. .stat-card .value {
  36. font-size: 24px;
  37. font-weight: 600;
  38. color: #333;
  39. margin-bottom: 4px;
  40. }
  41. .stat-card .unit {
  42. font-size: 14px;
  43. color: #999;
  44. }
  45. /* 图表容器样式 */
  46. .charts-container {
  47. display: grid;
  48. grid-template-columns: 1fr 1fr;
  49. gap: 24px;
  50. margin-bottom: 24px;
  51. }
  52. .chart-wrapper {
  53. background: white;
  54. padding: 20px;
  55. border-radius: 8px;
  56. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  57. }
  58. .chart-container {
  59. height: 300px;
  60. margin-top: 16px;
  61. }
  62. /* 响应式设计 */
  63. @media (max-width: 1024px) {
  64. .charts-container {
  65. grid-template-columns: 1fr;
  66. }
  67. .stats-cards {
  68. grid-template-columns: repeat(2, 1fr);
  69. }
  70. }
  71. @media (max-width: 768px) {
  72. .stats-cards {
  73. grid-template-columns: 1fr;
  74. }
  75. }
  76. </style>
  77. <!-- 页面标题 -->
  78. <div class="page-header">
  79. <h2 class="page-title">系统设置</h2>
  80. <p class="page-description">配置项目状态流、SOP流程、报价规则、绩效规则等系统设置</p>
  81. </div>
  82. <!-- 标签页导航 -->
  83. <div class="tab-navigation">
  84. <button class="tab-btn" [class.active]="activeTab === 'workflow'"
  85. (click)="switchTab('workflow')">
  86. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  87. <path d="M22 12h-4l-3 9L9 3l-3 9H2"></path>
  88. </svg>
  89. 项目状态流
  90. </button>
  91. <button class="tab-btn" [class.active]="activeTab === 'sop'"
  92. (click)="switchTab('sop')">
  93. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  94. <polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline>
  95. </svg>
  96. SOP流程模板
  97. </button>
  98. <button class="tab-btn" [class.active]="activeTab === 'pricing'"
  99. (click)="switchTab('pricing')">
  100. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  101. <line x1="12" y1="1" x2="12" y2="23"></line>
  102. <path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"></path>
  103. </svg>
  104. 报价规则
  105. </button>
  106. <button class="tab-btn" [class.active]="activeTab === 'performance'"
  107. (click)="switchTab('performance')">
  108. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  109. <path d="M18 8h1a4 4 0 0 1 0 8h-1"></path>
  110. <path d="M2 8h16v9a4 4 0 0 1-4 4H6a4 4 0 0 1-4-4V8z"></path>
  111. <line x1="6" y1="1" x2="6" y2="4"></line>
  112. <line x1="10" y1="1" x2="10" y2="4"></line>
  113. <line x1="14" y1="1" x2="14" y2="4"></line>
  114. </svg>
  115. 绩效规则
  116. </button>
  117. <button class="tab-btn" [class.active]="activeTab === 'system'"
  118. (click)="switchTab('system')">
  119. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  120. <rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect>
  121. <line x1="8" y1="21" x2="16" y2="21"></line>
  122. <line x1="12" y1="17" x2="12" y2="21"></line>
  123. </svg>
  124. 系统配置
  125. </button>
  126. </div>
  127. <!-- 项目状态流标签内容 -->
  128. <div *ngIf="activeTab === 'workflow'" class="tab-content">
  129. <!-- 搜索区域 -->
  130. <div class="search-section">
  131. <div class="search-input-wrapper">
  132. <svg class="search-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  133. <circle cx="11" cy="11" r="8"></circle>
  134. <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
  135. </svg>
  136. <input matInput type="text" placeholder="搜索阶段名称或描述..."
  137. [(ngModel)]="workflowSearchTerm" (keyup.enter)="onWorkflowSearch()"
  138. class="search-input">
  139. <button mat-button *ngIf="workflowSearchTerm" class="clear-search-btn"
  140. (click)="workflowSearchTerm = ''; onWorkflowSearch()">
  141. <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  142. <line x1="18" y1="6" x2="6" y2="18"></line>
  143. <line x1="6" y1="6" x2="18" y2="18"></line>
  144. </svg>
  145. </button>
  146. </div>
  147. <button mat-raised-button color="primary" class="create-btn"
  148. (click)="openWorkflowDialog()">
  149. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  150. <line x1="12" y1="5" x2="12" y2="19"></line>
  151. <line x1="5" y1="12" x2="19" y2="12"></line>
  152. </svg>
  153. 添加阶段
  154. </button>
  155. </div>
  156. <!-- 阶段列表 -->
  157. <div class="workflow-stages-list">
  158. <div *ngFor="let stage of filteredWorkflowStages; let i = index" class="stage-item" [class.disabled]="!stage.isActive">
  159. <div class="stage-header">
  160. <div class="stage-order">{{ stage.order }}</div>
  161. <div class="stage-info">
  162. <h3 class="stage-name">{{ stage.name }}</h3>
  163. <p class="stage-description">{{ stage.description }}</p>
  164. </div>
  165. <div class="stage-controls">
  166. <mat-slide-toggle
  167. [checked]="stage.isActive"
  168. (change)="toggleActive('workflow', stage.id, $event.checked)"
  169. class="stage-toggle">
  170. {{ stage.isActive ? '启用' : '禁用' }}
  171. </mat-slide-toggle>
  172. <div class="action-buttons">
  173. <button mat-icon-button class="action-btn" color="primary"
  174. title="编辑阶段"
  175. (click)="openWorkflowDialog(stage)">
  176. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  177. <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
  178. <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
  179. </svg>
  180. </button>
  181. <button mat-icon-button class="action-btn" color="warn"
  182. title="删除阶段"
  183. (click)="deleteSetting('workflow', stage.id)">
  184. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  185. <polyline points="3,6 5,6 21,6"></polyline>
  186. <path d="M19,6v14a2,2,0,0,1-2,2H7a2,2,0,0,1-2-2V6m3,0V4a2,2,0,0,1,2-2h4a2,2,0,0,1,2,2V6"></path>
  187. </svg>
  188. </button>
  189. </div>
  190. </div>
  191. </div>
  192. <div class="stage-divider" *ngIf="i < filteredWorkflowStages.length - 1">
  193. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#ccc" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">
  194. <polyline points="22 12 13.5 12 13.5 2"></polyline>
  195. <polyline points="1 12 8.5 12 8.5 22"></polyline>
  196. </svg>
  197. </div>
  198. </div>
  199. </div>
  200. <!-- 无数据状态 -->
  201. <div *ngIf="filteredWorkflowStages.length === 0" class="empty-state">
  202. <svg width="80" height="80" viewBox="0 0 24 24" fill="none" stroke="#ccc" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">
  203. <path d="M22 12h-4l-3 9L9 3l-3 9H2"></path>
  204. </svg>
  205. <p>没有找到符合条件的项目阶段</p>
  206. <button mat-button color="primary" (click)="workflowSearchTerm = ''; onWorkflowSearch()">
  207. 清除筛选条件
  208. </button>
  209. </div>
  210. </div>
  211. <!-- SOP流程模板标签内容 -->
  212. <div *ngIf="activeTab === 'sop'" class="tab-content">
  213. <!-- 搜索区域 -->
  214. <div class="search-section">
  215. <div class="search-input-wrapper">
  216. <svg class="search-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  217. <circle cx="11" cy="11" r="8"></circle>
  218. <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
  219. </svg>
  220. <input matInput type="text" placeholder="搜索模板名称、描述或分类..."
  221. [(ngModel)]="sopSearchTerm" (keyup.enter)="onSOPSearch()"
  222. class="search-input">
  223. <button mat-button *ngIf="sopSearchTerm" class="clear-search-btn"
  224. (click)="sopSearchTerm = ''; onSOPSearch()">
  225. <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  226. <line x1="18" y1="6" x2="6" y2="18"></line>
  227. <line x1="6" y1="6" x2="18" y2="18"></line>
  228. </svg>
  229. </button>
  230. </div>
  231. <button mat-raised-button color="primary" class="create-btn"
  232. (click)="openSOPDialog()">
  233. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  234. <line x1="12" y1="5" x2="12" y2="19"></line>
  235. <line x1="5" y1="12" x2="19" y2="12"></line>
  236. </svg>
  237. 添加模板
  238. </button>
  239. </div>
  240. <!-- SOP模板列表 -->
  241. <div class="sop-templates-list">
  242. <div *ngFor="let template of filteredSOPTemplates" class="template-item" [class.disabled]="!template.isActive">
  243. <div class="template-header">
  244. <div class="template-info">
  245. <div class="template-title-row">
  246. <h3 class="template-name">{{ template.name }}</h3>
  247. </div>
  248. <p class="template-description">{{ template.description }}</p>
  249. </div>
  250. <div class="template-controls">
  251. <mat-slide-toggle
  252. [checked]="template.isActive"
  253. (change)="toggleActive('sop', template.id, $event.checked)"
  254. class="template-toggle">
  255. {{ template.isActive ? '启用' : '禁用' }}
  256. </mat-slide-toggle>
  257. <div class="action-buttons">
  258. <button mat-icon-button class="action-btn" color="primary"
  259. title="编辑模板"
  260. (click)="openSOPDialog(template)">
  261. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  262. <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
  263. <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
  264. </svg>
  265. </button>
  266. <button mat-icon-button class="action-btn" color="warn"
  267. title="删除模板"
  268. (click)="deleteSetting('sop', template.id)">
  269. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  270. <polyline points="3,6 5,6 21,6"></polyline>
  271. <path d="M19,6v14a2,2,0,0,1-2,2H7a2,2,0,0,1-2-2V6m3,0V4a2,2,0,0,1,2-2h4a2,2,0,0,1,2,2V6"></path>
  272. </svg>
  273. </button>
  274. </div>
  275. </div>
  276. </div>
  277. <div class="template-steps">
  278. <div class="steps-header">流程步骤:</div>
  279. <div class="steps-list">
  280. <div *ngFor="let step of template.steps; let i = index" class="step-item">
  281. <div class="step-number">{{ i + 1 }}</div>
  282. <div class="step-name">{{ step }}</div>
  283. </div>
  284. </div>
  285. </div>
  286. </div>
  287. </div>
  288. <!-- 无数据状态 -->
  289. <div *ngIf="filteredSOPTemplates.length === 0" class="empty-state">
  290. <svg width="80" height="80" viewBox="0 0 24 24" fill="none" stroke="#ccc" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">
  291. <polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline>
  292. </svg>
  293. <p>没有找到符合条件的SOP模板</p>
  294. <button mat-button color="primary" (click)="sopSearchTerm = ''; onSOPSearch()">
  295. 清除筛选条件
  296. </button>
  297. </div>
  298. </div>
  299. <!-- 报价规则标签内容 -->
  300. <div *ngIf="activeTab === 'pricing'" class="tab-content">
  301. <!-- 搜索区域 -->
  302. <div class="search-section">
  303. <div class="search-input-wrapper">
  304. <svg class="search-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  305. <circle cx="11" cy="11" r="8"></circle>
  306. <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
  307. </svg>
  308. <input matInput type="text" placeholder="搜索规则名称、描述或分类..."
  309. [(ngModel)]="pricingSearchTerm" (keyup.enter)="onPricingSearch()"
  310. class="search-input">
  311. <button mat-button *ngIf="pricingSearchTerm" class="clear-search-btn"
  312. (click)="pricingSearchTerm = ''; onPricingSearch()">
  313. <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  314. <line x1="18" y1="6" x2="6" y2="18"></line>
  315. <line x1="6" y1="6" x2="18" y2="18"></line>
  316. </svg>
  317. </button>
  318. </div>
  319. <button mat-raised-button color="primary" class="create-btn"
  320. (click)="openPricingDialog()">
  321. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  322. <line x1="12" y1="5" x2="12" y2="19"></line>
  323. <line x1="5" y1="12" x2="19" y2="12"></line>
  324. </svg>
  325. 添加规则
  326. </button>
  327. </div>
  328. <!-- 报价规则列表 -->
  329. <div class="pricing-rules-list">
  330. <div *ngFor="let rule of filteredPricingRules" class="rule-item" [class.disabled]="!rule.isActive">
  331. <div class="rule-header">
  332. <div class="rule-info">
  333. <div class="rule-title-row">
  334. <h3 class="rule-name">{{ rule.name }}</h3>
  335. </div>
  336. <p class="rule-description">{{ rule.description }}</p>
  337. </div>
  338. <div class="rule-controls">
  339. <mat-slide-toggle
  340. [checked]="rule.isActive"
  341. (change)="toggleActive('pricing', rule.id, $event.checked)"
  342. class="rule-toggle">
  343. {{ rule.isActive ? '启用' : '禁用' }}
  344. </mat-slide-toggle>
  345. <div class="action-buttons">
  346. <button mat-icon-button class="action-btn" color="primary"
  347. title="编辑规则"
  348. (click)="openPricingDialog(rule)">
  349. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  350. <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
  351. <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
  352. </svg>
  353. </button>
  354. <button mat-icon-button class="action-btn" color="warn"
  355. title="删除规则"
  356. (click)="deleteSetting('pricing', rule.id)">
  357. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  358. <polyline points="3,6 5,6 21,6"></polyline>
  359. <path d="M19,6v14a2,2,0,0,1-2,2H7a2,2,0,0,1-2-2V6m3,0V4a2,2,0,0,1,2-2h4a2,2,0,0,1,2,2V6"></path>
  360. </svg>
  361. </button>
  362. </div>
  363. </div>
  364. </div>
  365. <div class="rule-formula">
  366. <div class="formula-label">条件:</div>
  367. <div class="formula-content">{{ rule.condition }}</div>
  368. <div class="formula-label">价格:</div>
  369. <div class="formula-content">{{ rule.price }} 元</div>
  370. </div>
  371. </div>
  372. </div>
  373. <!-- 无数据状态 -->
  374. <div *ngIf="filteredPricingRules.length === 0" class="empty-state">
  375. <svg width="80" height="80" viewBox="0 0 24 24" fill="none" stroke="#ccc" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">
  376. <line x1="12" y1="1" x2="12" y2="23"></line>
  377. <path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"></path>
  378. </svg>
  379. <p>没有找到符合条件的报价规则</p>
  380. <button mat-button color="primary" (click)="pricingSearchTerm = ''; onPricingSearch()">
  381. 清除筛选条件
  382. </button>
  383. </div>
  384. </div>
  385. <!-- 绩效规则标签内容 -->
  386. <div *ngIf="activeTab === 'performance'" class="tab-content">
  387. <!-- 搜索区域 -->
  388. <div class="search-section">
  389. <div class="search-input-wrapper">
  390. <svg class="search-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  391. <circle cx="11" cy="11" r="8"></circle>
  392. <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
  393. </svg>
  394. <input matInput type="text" placeholder="搜索规则名称、描述或指标..."
  395. [(ngModel)]="performanceSearchTerm" (keyup.enter)="onPerformanceSearch()"
  396. class="search-input">
  397. <button mat-button *ngIf="performanceSearchTerm" class="clear-search-btn"
  398. (click)="performanceSearchTerm = ''; onPerformanceSearch()">
  399. <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  400. <line x1="18" y1="6" x2="6" y2="18"></line>
  401. <line x1="6" y1="6" x2="18" y2="18"></line>
  402. </svg>
  403. </button>
  404. </div>
  405. <button mat-raised-button color="primary" class="create-btn"
  406. (click)="openPerformanceDialog()">
  407. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  408. <line x1="12" y1="5" x2="12" y2="19"></line>
  409. <line x1="5" y1="12" x2="19" y2="12"></line>
  410. </svg>
  411. 添加规则
  412. </button>
  413. </div>
  414. <!-- 绩效规则列表 -->
  415. <div class="performance-rules-list">
  416. <div *ngFor="let rule of filteredPerformanceRules" class="rule-item" [class.disabled]="!rule.isActive">
  417. <div class="rule-header">
  418. <div class="rule-info">
  419. <div class="rule-title-row">
  420. <h3 class="rule-name">{{ rule.name }}</h3>
  421. <span class="rule-metric">{{ rule.metric }}</span>
  422. </div>
  423. <p class="rule-description">{{ rule.description }}</p>
  424. </div>
  425. <div class="rule-controls">
  426. <mat-slide-toggle
  427. [checked]="rule.isActive"
  428. (change)="toggleActive('performance', rule.id, $event.checked)"
  429. class="rule-toggle">
  430. {{ rule.isActive ? '启用' : '禁用' }}
  431. </mat-slide-toggle>
  432. <div class="action-buttons">
  433. <button mat-icon-button class="action-btn" color="primary"
  434. title="编辑规则"
  435. (click)="openPerformanceDialog(rule)">
  436. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  437. <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
  438. <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
  439. </svg>
  440. </button>
  441. <button mat-icon-button class="action-btn" color="warn"
  442. title="删除规则"
  443. (click)="deleteSetting('performance', rule.id)">
  444. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  445. <polyline points="3,6 5,6 21,6"></polyline>
  446. <path d="M19,6v14a2,2,0,0,1-2,2H7a2,2,0,0,1-2-2V6m3,0V4a2,2,0,0,1,2-2h4a2,2,0,0,1,2,2V6"></path>
  447. </svg>
  448. </button>
  449. </div>
  450. </div>
  451. </div>
  452. <div class="rule-details">
  453. <div class="detail-row">
  454. <div class="detail-label">阈值:</div>
  455. <div class="detail-value">{{ rule.threshold }}%</div>
  456. </div>
  457. <div class="detail-row">
  458. <div class="detail-label">奖励方式:</div>
  459. <div class="detail-value">{{ rule.reward }}</div>
  460. </div>
  461. </div>
  462. </div>
  463. </div>
  464. <!-- 无数据状态 -->
  465. <div *ngIf="filteredPerformanceRules.length === 0" class="empty-state">
  466. <svg width="80" height="80" viewBox="0 0 24 24" fill="none" stroke="#ccc" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">
  467. <path d="M18 8h1a4 4 0 0 1 0 8h-1"></path>
  468. <path d="M2 8h16v9a4 4 0 0 1-4 4H6a4 4 0 0 1-4-4V8z"></path>
  469. <line x1="6" y1="1" x2="6" y2="4"></line>
  470. <line x1="10" y1="1" x2="10" y2="4"></line>
  471. <line x1="14" y1="1" x2="14" y2="4"></line>
  472. </svg>
  473. <p>没有找到符合条件的绩效规则</p>
  474. <button mat-button color="primary" (click)="performanceSearchTerm = ''; onPerformanceSearch()">
  475. 清除筛选条件
  476. </button>
  477. </div>
  478. </div>
  479. <!-- 系统配置标签内容 -->
  480. <div *ngIf="activeTab === 'system'" class="tab-content">
  481. <!-- 统计卡片 -->
  482. <div class="stats-cards">
  483. <div class="stat-card">
  484. <div class="label">总存储容量</div>
  485. <div class="value">{{ systemStats.totalDataSize }}</div>
  486. <div class="unit">GB</div>
  487. </div>
  488. <div class="stat-card">
  489. <div class="label">已用存储</div>
  490. <div class="value">{{ systemStats.usedDataSize }}</div>
  491. <div class="unit">GB</div>
  492. </div>
  493. <div class="stat-card">
  494. <div class="label">备份次数</div>
  495. <div class="value">{{ systemStats.backupCount }}</div>
  496. <div class="unit">次</div>
  497. </div>
  498. <div class="stat-card">
  499. <div class="label">活跃用户</div>
  500. <div class="value">{{ systemStats.activeUsers }}</div>
  501. <div class="unit">人</div>
  502. </div>
  503. <div class="stat-card">
  504. <div class="label">系统可用率</div>
  505. <div class="value">{{ systemStats.systemUptime }}</div>
  506. </div>
  507. <div class="stat-card">
  508. <div class="label">上次备份</div>
  509. <div class="value">{{ systemStats.lastBackup }}</div>
  510. </div>
  511. </div>
  512. <!-- 图表区域 -->
  513. <div class="charts-container">
  514. <div class="chart-wrapper">
  515. <div #dataUsageChart class="chart-container"></div>
  516. </div>
  517. <div class="chart-wrapper">
  518. <div #backupHistoryChart class="chart-container"></div>
  519. </div>
  520. <div class="chart-wrapper" style="grid-column: span 2;">
  521. <div #systemPerformanceChart class="chart-container"></div>
  522. </div>
  523. </div>
  524. <div class="system-config-section">
  525. <h3 class="section-title">基础配置</h3>
  526. <div class="config-items">
  527. <div class="config-item">
  528. <div class="config-info">
  529. <div class="config-name">启用系统审计日志</div>
  530. <div class="config-description">记录用户操作日志,用于安全审计和问题追踪</div>
  531. </div>
  532. <mat-slide-toggle
  533. [(ngModel)]="systemOptions.enableAuditLog"
  534. class="config-toggle">
  535. </mat-slide-toggle>
  536. </div>
  537. <div class="config-item">
  538. <div class="config-info">
  539. <div class="config-name">启用系统通知</div>
  540. <div class="config-description">向用户发送项目状态变更、任务提醒等通知</div>
  541. </div>
  542. <mat-slide-toggle
  543. [(ngModel)]="systemOptions.enableNotification"
  544. class="config-toggle">
  545. </mat-slide-toggle>
  546. </div>
  547. <div class="config-item">
  548. <div class="config-info">
  549. <div class="config-name">启用自动备份</div>
  550. <div class="config-description">定期自动备份系统数据,确保数据安全</div>
  551. </div>
  552. <mat-slide-toggle
  553. [(ngModel)]="systemOptions.autoBackupEnabled"
  554. class="config-toggle">
  555. </mat-slide-toggle>
  556. </div>
  557. </div>
  558. </div>
  559. <div class="system-config-section">
  560. <h3 class="section-title">数据管理</h3>
  561. <div class="config-items">
  562. <div class="config-item">
  563. <div class="config-info">
  564. <div class="config-name">备份频率</div>
  565. <div class="config-description">设置数据自动备份的时间间隔</div>
  566. </div>
  567. <mat-select [(ngModel)]="systemOptions.backupFrequency" class="config-select">
  568. <mat-option value="daily">每日</mat-option>
  569. <mat-option value="weekly">每周</mat-option>
  570. <mat-option value="monthly">每月</mat-option>
  571. </mat-select>
  572. </div>
  573. <div class="config-item">
  574. <div class="config-info">
  575. <div class="config-name">数据保留天数</div>
  576. <div class="config-description">设置系统日志和备份数据的保留期限</div>
  577. </div>
  578. <mat-form-field appearance="outline" class="config-input">
  579. <input matInput type="number" [(ngModel)]="systemOptions.dataRetentionDays" min="7" max="3650">
  580. <span matSuffix>天</span>
  581. </mat-form-field>
  582. </div>
  583. <div class="config-item">
  584. <div class="config-info">
  585. <div class="config-name">启用数据导出</div>
  586. <div class="config-description">允许用户导出系统数据为Excel等格式</div>
  587. </div>
  588. <mat-slide-toggle
  589. [(ngModel)]="systemOptions.enableDataExport"
  590. class="config-toggle">
  591. </mat-slide-toggle>
  592. </div>
  593. </div>
  594. </div>
  595. <div class="system-config-actions">
  596. <button mat-raised-button color="primary" class="save-btn"
  597. (click)="saveSystemOptions()">
  598. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  599. <path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"></path>
  600. <polyline points="17 21 17 13 7 13 7 21"></polyline>
  601. <polyline points="7 3 7 8 15 8"></polyline>
  602. </svg>
  603. 保存配置
  604. </button>
  605. <button mat-button class="reset-btn" (click)="loadWorkflowStages(); loadSOPTemplates(); loadPricingRules(); loadPerformanceRules()">
  606. <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  607. <polyline points="1 4 1 10 7 10"></polyline>
  608. <polyline points="23 20 23 14 17 14"></polyline>
  609. <path d="M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15"></path>
  610. </svg>
  611. 重置设置
  612. </button>
  613. </div>
  614. </div>
  615. </div>