page-user.component.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. <nz-page-header>
  2. <nz-page-header-title
  3. >用户列表
  4. <br />
  5. <div class="subtitle">
  6. 使用“十四五”高等教育国家规划教材申报系统的所有用户,在这里你可以对用户账号进行统一管理。
  7. </div>
  8. </nz-page-header-title>
  9. <nz-page-header-extra>
  10. @if (this.tbookSer.profile.identity == '国家级管理员') {
  11. <nz-space>
  12. <button
  13. style="background: #3e49b3; border: 1px #3e49b3"
  14. *nzSpaceItem
  15. nz-button
  16. nzType="primary"
  17. (click)="addMember()"
  18. >
  19. 创建用户
  20. </button>
  21. </nz-space>
  22. }
  23. </nz-page-header-extra>
  24. </nz-page-header>
  25. <div class="content">
  26. <div class="tool">
  27. <div class="tool-left">
  28. <div class="search">
  29. <nz-input-group style="width: 300px" [nzPrefix]="prefixTemplateUser">
  30. <input
  31. type="text"
  32. nz-input
  33. placeholder="输入用户姓名/手机号/邮箱/用户名搜索"
  34. [(ngModel)]="searchValue"
  35. (ngModelChange)="getProfile()"
  36. />
  37. </nz-input-group>
  38. <ng-template #prefixTemplateUser
  39. ><span nz-icon nzType="search"></span
  40. ></ng-template>
  41. </div>
  42. <div class=""></div>
  43. </div>
  44. <div class="tool-right">
  45. <!-- <button
  46. [ngClass]="{ 'form-button': setOfCheckedId.size }"
  47. nz-button
  48. [disabled]="!setOfCheckedId.size"
  49. nzType="primary"
  50. (click)="createUser()"
  51. >
  52. 导出
  53. <span nz-icon nzType="down" nzTheme="outline"></span>
  54. </button> -->
  55. </div>
  56. </div>
  57. <nz-table
  58. #tableData
  59. [nzData]="profiles"
  60. [nzTotal]="profileLength"
  61. [nzPageSize]="pageSize"
  62. [nzPageIndex]="pageIndex"
  63. style="margin: 10px 0"
  64. [nzLoading]="loading"
  65. nzSize="middle"
  66. [nzFrontPagination]="false"
  67. [nzNoResult]="emptyResult"
  68. nzTableLayout="fixed"
  69. (nzPageIndexChange)="pageIndexChange($event)"
  70. >
  71. <thead>
  72. <tr>
  73. <th
  74. nzWidth="50px"
  75. nzLeft
  76. [nzChecked]="checkedAll"
  77. [nzIndeterminate]="indeterminate"
  78. nzLabel="Select all"
  79. (nzCheckedChange)="onAllChecked($event)"
  80. ></th>
  81. <th nzWidth="120px">用户</th>
  82. <th nzWidth="120px">手机号</th>
  83. <th nzWidth="120px">邮箱</th>
  84. <th
  85. nzWidth="120px"
  86. [nzShowFilter]="true"
  87. [nzFilters]="listOfColumns.identity.listOfFilter"
  88. (nzFilterChange)="onChangeFilter($event, 'identity')"
  89. >
  90. 人员类型
  91. </th>
  92. <th
  93. nzWidth="80px"
  94. [nzShowFilter]="true"
  95. [nzFilters]="listOfColumns.accountState.listOfFilter"
  96. (nzFilterChange)="onChangeFilter($event, 'accountState')"
  97. >
  98. 认证状态
  99. </th>
  100. <th
  101. nzWidth="150px"
  102. nzEllipsis
  103. [nzShowFilter]="true"
  104. [nzFilters]="listOfColumns.companyType.listOfFilter"
  105. (nzFilterChange)="onChangeFilter($event, 'companyType')"
  106. >
  107. 单位类型
  108. </th>
  109. <th nzWidth="50px" nzRight>操作</th>
  110. </tr>
  111. </thead>
  112. <tbody>
  113. @for (data of profiles; track data.id) {
  114. <tr>
  115. <td
  116. nzLeft
  117. [nzChecked]="setOfCheckedId.has(data.id)"
  118. (nzCheckedChange)="onItemChecked(data.id, $event)"
  119. ></td>
  120. <td
  121. nzEllipsis
  122. (click)="goDateil(data.get('user')?.id)"
  123. class="activeTd"
  124. >
  125. <nz-avatar nzIcon="user"></nz-avatar>
  126. {{ data?.get("user")?.get("name") || "-" }}
  127. </td>
  128. <td>
  129. {{ data?.get("user")?.get("phone") || "-" }}
  130. </td>
  131. <td nzEllipsis>
  132. <div class="email">
  133. <span
  134. class="state"
  135. [style.background]="
  136. data?.get('user')?.get('accountState') == '已认证'
  137. ? '#1EB76D'
  138. : '#C9CDD4'
  139. "
  140. ></span>
  141. <div class="text">
  142. {{ data?.get("user")?.get("email") || data?.get("email") }}
  143. </div>
  144. </div>
  145. </td>
  146. <td>
  147. {{ data?.get("identity") }}
  148. </td>
  149. <td>
  150. @switch (data?.get('user')?.get('accountState')) { @case ('待认证') {
  151. <nz-tag [nzBordered]="false" [nzColor]="'geekblue'">待认证</nz-tag>
  152. } @case ('已认证') {
  153. <nz-tag [nzBordered]="false" [nzColor]="'success'">已认证</nz-tag>
  154. } @case ('已禁用') {
  155. <nz-tag [nzBordered]="false" [nzColor]="'error'">已禁用</nz-tag>
  156. } }
  157. </td>
  158. <td nzEllipsis>
  159. {{ data?.get("companyType") }}
  160. </td>
  161. <td nzRight>
  162. <button
  163. nz-button
  164. nz-dropdown
  165. [nzDropdownMenu]="menu"
  166. [nzPlacement]="'bottomLeft'"
  167. >
  168. <span nz-icon nzType="ellipsis" nzTheme="outline"></span>
  169. </button>
  170. <nz-dropdown-menu #menu="nzDropdownMenu">
  171. <ul nz-menu>
  172. @if (data?.get('user')?.get('accountState') == '待认证') {
  173. <li nz-menu-item>
  174. <button
  175. nz-button
  176. nzType="link"
  177. style="color: #231c1f"
  178. (click)="updateUser(data, '通过认证')"
  179. >
  180. <span
  181. nz-icon
  182. nzType="safety-certificate"
  183. nzTheme="outline"
  184. ></span
  185. >通过认证
  186. </button>
  187. </li>
  188. }
  189. <!-- @if (data?.user.accountState != '已禁用') {
  190. <li nz-menu-item>
  191. <button
  192. nz-button
  193. nzType="link"
  194. (click)="updateUser(data, '禁用')"
  195. style="color: #231c1f"
  196. >
  197. <span nz-icon nzType="stop" nzTheme="outline"></span>禁用账号
  198. </button>
  199. </li>
  200. } -->
  201. <li nz-menu-item>
  202. <button
  203. (click)="updateUser(data, '删除')"
  204. nz-button
  205. nzType="link"
  206. style="color: #231c1f"
  207. >
  208. <span nz-icon nzType="delete" nzTheme="outline"></span
  209. >删除账号
  210. </button>
  211. </li>
  212. <!-- <li nz-menu-item>
  213. <button
  214. nz-button
  215. nzType="link"
  216. style="color: #231c1f"
  217. (click)="goDateil(data.user?.objectId)"
  218. >
  219. <span
  220. nz-icon
  221. nzType="user"
  222. nzTheme="outline"
  223. ></span
  224. >用户详情
  225. </button>
  226. </li> -->
  227. </ul>
  228. </nz-dropdown-menu>
  229. </td>
  230. </tr>
  231. }
  232. </tbody>
  233. </nz-table>
  234. <ng-template #emptyResult>
  235. <nz-empty nzNotFoundImage="/img/group-empty.png"></nz-empty>
  236. </ng-template>
  237. </div>
  238. <nz-modal
  239. [(nzVisible)]="accountIsVisible"
  240. nzTitle="创建账号(手机号及邮箱请至少填写一个,将发送登录账号)"
  241. (nzOnCancel)="handleCancel()"
  242. nzWidth="800px"
  243. nzCentered
  244. >
  245. <ng-container *nzModalContent>
  246. <div nz-row class="depart-modal">
  247. <div nz-col nzSpan="12">
  248. <div class="row" style="margin-bottom: 6px">
  249. <div class="label">
  250. 选择所属部门 <span style="color: #e8353e">*</span>
  251. </div>
  252. <div class="value">
  253. <input
  254. nz-input
  255. placeholder="请选择所属部门"
  256. [ngModel]="account.department?.title"
  257. (ngModelChange)="onSearchNodes($event)"
  258. type="text"
  259. />
  260. </div>
  261. </div>
  262. <div class="select">
  263. <div class="bar">
  264. @if (this.tbookSer.profile.identity == '国家级管理员') {
  265. <a style="color: #86909c" (click)="onPre()">所有部门</a>
  266. }@else {
  267. <a style="color: #86909c">所有部门</a>
  268. } @for (data of parentMap; track data.title) {
  269. <span style="margin: 0 10px">/</span>
  270. @if (this.tbookSer.profile.identity == '国家级管理员' ||
  271. data?.verify) {
  272. <a (click)="onPre(data, $index)">{{ data.title }}</a>
  273. }@else {
  274. <a style="color: #86909c">{{ data.title }}</a>
  275. } }
  276. </div>
  277. <div class="tree">
  278. @if(parentList.length > 0){ @for (data of parentList; track $index)
  279. {
  280. <div class="li" (click)="onCheckedDepart(data)">
  281. <label
  282. nz-radio
  283. [ngModel]="data.key == radio"
  284. [nzValue]="data.key"
  285. (click)="onCheckedDepart(data, true)"
  286. >{{ data.title }}</label
  287. >
  288. @if (!data.isLeaf) {
  289. <span nz-icon nzType="right" nzTheme="outline"></span>
  290. }
  291. </div>
  292. } }@else {
  293. <nz-empty nzNotFoundContent="暂无下级部门"></nz-empty>
  294. }
  295. </div>
  296. </div>
  297. <div class="row">
  298. <div class="label">人员类型(需要先选择所属部门)</div>
  299. <div class="value">
  300. <nz-select
  301. style="width: 100%"
  302. nzShowSearch
  303. nzAllowClear
  304. [disabled]="!this.account.department?.id"
  305. [(ngModel)]="account.identity"
  306. nzPlaceHolder="请选择身份类型"
  307. >
  308. @for(item of userType; track item;let index = $index){
  309. <nz-option nzCustomContent [nzValue]="item" [nzLabel]="item">{{
  310. item
  311. }}</nz-option>
  312. }
  313. </nz-select>
  314. </div>
  315. </div>
  316. </div>
  317. <div nz-col nzSpan="12">
  318. <div class="row">
  319. <div class="label">姓名 <span style="color: #e8353e">*</span></div>
  320. <div class="value">
  321. <input
  322. nz-input
  323. placeholder="请输入姓名"
  324. [(ngModel)]="account.name"
  325. type="text"
  326. />
  327. </div>
  328. </div>
  329. <div class="row">
  330. <div class="label">账号</div>
  331. <div class="value">
  332. <input
  333. nz-input
  334. maxlength="28"
  335. placeholder="请填写账号"
  336. [(ngModel)]="account.username"
  337. type="text"
  338. />
  339. </div>
  340. </div>
  341. <div class="row">
  342. <div class="label">手机号 <span style="color: #e8353e">*</span></div>
  343. <div class="value">
  344. <input
  345. nz-input
  346. maxlength="11"
  347. placeholder="请输入手机号"
  348. [(ngModel)]="account.phone"
  349. type="text"
  350. />
  351. </div>
  352. </div>
  353. <div class="row">
  354. <div class="label">邮箱 <span style="color: #e8353e">*</span></div>
  355. <div class="value">
  356. <input
  357. nz-input
  358. placeholder="请输入邮箱"
  359. [(ngModel)]="account.email"
  360. type="email"
  361. />
  362. </div>
  363. </div>
  364. <div class="row">
  365. <div class="label">密码 <span style="color: #e8353e">*</span></div>
  366. <div class="value">
  367. <nz-input-group nzSearch [nzAddOnAfter]="">
  368. <input
  369. type="password"
  370. [(ngModel)]="account.password"
  371. nz-input
  372. placeholder="请输入密码"
  373. />
  374. </nz-input-group>
  375. <!-- <ng-template #suffixIconButton>
  376. <button
  377. nz-button
  378. (click)="randomPassword()"
  379. nzType="primary"
  380. nzSearch
  381. >
  382. 自动生成密码
  383. </button>
  384. </ng-template> -->
  385. </div>
  386. </div>
  387. </div>
  388. </div>
  389. </ng-container>
  390. <div *nzModalFooter>
  391. <button nz-button nzType="default" (click)="handleCancel()">取消</button>
  392. <button
  393. nz-button
  394. nzType="primary"
  395. [nzLoading]="isLoadingOne"
  396. style="background: #3e49b3; border: 1px #3e49b3"
  397. (click)="accountComplete()"
  398. >
  399. 确定
  400. </button>
  401. </div>
  402. </nz-modal>
  403. <!-- 全选操作:批量操作 -->
  404. <div class="batch-toolbar-modal" *ngIf="setOfCheckedId?.size">
  405. <div class="batch-toolbar">
  406. <div class="styles_counter__18S08">
  407. <span>已选</span>
  408. <span class="styles_num__178Wa">{{ setOfCheckedId.size }}</span>
  409. </div>
  410. <div class="batch-toolbar-actions">
  411. <div class="ant-space ant-space-horizontal ant-space-align-center">
  412. <div class="ant-space-item" style="margin-right: 16px">
  413. <button nz-button nzType="text" (click)="deleteSelected()">
  414. <span nz-icon nzType="delete"></span>
  415. 删除
  416. </button>
  417. </div>
  418. </div>
  419. </div>
  420. <div class="styles_cancel__AARoT">
  421. <button nz-button nzType="text" (click)="resetChange()">取消选中</button>
  422. </div>
  423. </div>
  424. </div>