You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1390 lines
45 KiB

3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="box">
  3. <div>
  4. <div class="middlebox">
  5. <div class="contenttitle">
  6. 权限管理 /
  7. <span class="contenttitleBold">用户管理</span>
  8. </div>
  9. <!-- <div class="seachinput">
  10. <el-select
  11. v-model="department"
  12. placeholder="请选择项目类别"
  13. filterable
  14. :filter-method="remoteMethodes"
  15. default-first-option
  16. @change="quckDepartments"
  17. clearable
  18. size="small"
  19. >
  20. <el-option
  21. v-for="item in quckDepartment"
  22. :key="item.id"
  23. :label="item.displayName"
  24. :value="item.id"
  25. >
  26. </el-option>
  27. </el-select>
  28. </div> -->
  29. </div>
  30. <div>
  31. <div style="display: flex; margin-top: 7px">
  32. <div
  33. :style="
  34. 'width: 208px;overflow: scroll;height:' +
  35. (window.pageHeight < 600 ? 480 : window.pageHeight - 100) +
  36. 'px;background-color: #fff; border-radius: 8px'
  37. "
  38. >
  39. <div style="margin-top: 10px">
  40. <el-tree
  41. :data="treedata"
  42. :props="defaultProps"
  43. @node-click="handleNodeClick"
  44. highlight-current
  45. >
  46. <span class="custom-tree-node" slot-scope="{ node, data }">
  47. <div>
  48. <span class="treeicons">
  49. <!-- <i
  50. class="el-icon-document-remove"
  51. v-if="data.parentId == null"
  52. ></i> -->
  53. <img
  54. style="width: 20px; height: 20px; vertical-align: sub"
  55. src="@/assets/images/order.png"
  56. v-if="!data.parentId"
  57. />
  58. </span>
  59. <span :class="!data.parentId ? 'maxtitle' : 'mintitle'">{{
  60. node.label
  61. }}</span>
  62. </div>
  63. </span>
  64. </el-tree>
  65. </div>
  66. </div>
  67. <div style="display: block">
  68. <div style="margin-left: 15px; display: flex">
  69. <div
  70. :style="
  71. 'width:' +
  72. (window.pageWidth - 200 - 110 - 50 - 14) +
  73. 'px;padding: 15px;background-color: #fff;border-radius: 8px;'
  74. "
  75. >
  76. <el-table
  77. :data="tableData"
  78. row-key="id"
  79. :height="
  80. window.pageHeight < 600 ? 450 : window.pageHeight - 130
  81. "
  82. class="el-table__body-wrapper tbody"
  83. highlight-current-row
  84. @row-click="rowick"
  85. ref="tableData"
  86. >
  87. <el-table-column
  88. type="index"
  89. label="序号"
  90. min-width="50"
  91. align="center"
  92. ></el-table-column>
  93. <el-table-column prop="userName" label="账号" min-width="100">
  94. </el-table-column>
  95. <el-table-column prop="email" label="邮箱" min-width="150">
  96. </el-table-column>
  97. <!-- <el-table-column prop="email" label="所属角色" width=""> </el-table-column> -->
  98. <el-table-column
  99. prop="phoneNumber"
  100. label="手机号"
  101. min-width="130"
  102. >
  103. </el-table-column>
  104. <el-table-column prop="surname" label="姓名" min-width="100">
  105. </el-table-column>
  106. <!-- <el-table-column label="操作" min-width="400">
  107. <template slot-scope="scope">
  108. <el-button
  109. type="primary"
  110. @click="newlyincreased"
  111. size="small">新增</el-button
  112. >
  113. <el-button type="primary" @click="editmony(scope.row)"
  114. size="small">编辑</el-button
  115. >
  116. <el-button type="primary" @click="deleates(scope.row)"
  117. size="small">删除</el-button
  118. >
  119. <el-button type="primary" @click="bandinuser(scope.row)"
  120. size="small">绑定角色</el-button
  121. >
  122. <el-button type="primary" @click="editpassword(scope.row)"
  123. size="small">修改密码</el-button
  124. >
  125. <el-button type="primary" @click="btnMenu(scope.row)"
  126. size="small">菜单权限</el-button
  127. >
  128. </template>
  129. </el-table-column> -->
  130. </el-table>
  131. </div>
  132. <!-- 按钮区域 -->
  133. <div style="margin-left: 10px">
  134. <el-button type="" @click="newlyincreased" class="commonbutton"
  135. >新增</el-button
  136. >
  137. <div style="margin-top: 10px">
  138. <el-button type="" @click="editmony" class="commonbutton"
  139. >编辑</el-button
  140. >
  141. </div>
  142. <div style="margin-top: 10px">
  143. <el-button type="" @click="deleates" class="deleteButton"
  144. >删除</el-button
  145. >
  146. </div>
  147. <div style="margin-top: 10px">
  148. <el-button type="" @click="bandinuser" class="commonbutton"
  149. >绑定角色</el-button
  150. >
  151. </div>
  152. <div style="margin-top: 10px">
  153. <el-button type="" @click="editpassword" class="commonbutton"
  154. >修改密码</el-button
  155. >
  156. </div>
  157. <div style="margin-top: 10px">
  158. <el-button type="" @click="btnMenu" class="commonbutton"
  159. >菜单权限</el-button
  160. >
  161. </div>
  162. </div>
  163. </div>
  164. </div>
  165. </div>
  166. </div>
  167. <!-- 编辑 -->
  168. <el-dialog
  169. :title="title == 1 ? '新增用户' : '修改用户'"
  170. :visible.sync="dialogVisible"
  171. width="700px"
  172. :close-on-click-modal="false"
  173. >
  174. <el-tabs
  175. v-model="activeName"
  176. v-if="title == 2 ? true : false"
  177. @tab-click="handleClick"
  178. style="height: 400px"
  179. >
  180. <el-tab-pane label="用户信息" name="first">
  181. <el-form
  182. v-if="dialogVisible"
  183. ref="form"
  184. :model="form"
  185. label-width="80px"
  186. :rules="ruless"
  187. >
  188. <el-row>
  189. <el-col :span="12">
  190. <el-form-item label="姓名" prop="surname">
  191. <el-input
  192. v-model="form.surname"
  193. size="small"
  194. /> </el-form-item
  195. ></el-col>
  196. <el-col :span="12">
  197. <el-form-item label="用户名" prop="userName">
  198. <el-input
  199. v-model="form.userName"
  200. size="small"
  201. /> </el-form-item
  202. ></el-col>
  203. <!-- <el-col :span="12">
  204. <el-form-item label="名称" prop="name">
  205. <el-input v-model="form.name"></el-input> </el-form-item
  206. ></el-col> -->
  207. <el-col :span="12">
  208. <el-form-item label="手机号" prop="phoneNumber">
  209. <el-input
  210. v-model="form.phoneNumber"
  211. size="small"
  212. /> </el-form-item
  213. ></el-col>
  214. <el-col :span="12">
  215. <el-form-item label="科室">
  216. <!--
  217. <div style="margin-top: -30px">
  218. 当前选中的组织<span> {{ orgIds }}</span>
  219. </div>
  220. -->
  221. <el-cascader
  222. v-model="orgId"
  223. :options="organizationalstructure"
  224. ref="example"
  225. popper-class="example"
  226. @change="cascaderchang"
  227. :props="{
  228. expandTrigger: 'hover',
  229. label: 'displayName',
  230. children: 'treeChildren',
  231. checkStrictly: true,
  232. value: 'id',
  233. }"
  234. size="small"
  235. style="width: 100%"
  236. />
  237. </el-form-item>
  238. </el-col>
  239. <!-- <el-col :span="12">
  240. <el-form-item label="邮箱" >
  241. <el-input v-model="form.email"></el-input> </el-form-item
  242. ></el-col> -->
  243. <el-col>
  244. <el-form-item label="是否激活">
  245. <el-checkbox
  246. v-model="form.isActive"
  247. true-label="true"
  248. false-label="false"
  249. ></el-checkbox>
  250. </el-form-item>
  251. </el-col>
  252. <el-col :span="12">
  253. <el-form-item
  254. label="密码"
  255. prop="password"
  256. v-if="title == 1 ? true : false"
  257. >
  258. <el-input v-model="form.password"></el-input> </el-form-item
  259. ></el-col>
  260. </el-row>
  261. </el-form>
  262. </el-tab-pane>
  263. <!-- 选择角色 -->
  264. <el-tab-pane label="角色">
  265. <el-checkbox-group v-model="form.roleNames">
  266. <el-checkbox
  267. v-model="item.id"
  268. :label="item.name"
  269. v-for="(item, index) in checkList"
  270. :key="index"
  271. @change="handleCheckAllChange"
  272. >
  273. </el-checkbox>
  274. </el-checkbox-group>
  275. </el-tab-pane>
  276. <el-tab-pane label="科室操作权限">
  277. <div style="overflow-y: scroll; height: 350px">
  278. <el-tree
  279. :props="{
  280. label: 'displayName',
  281. children: 'treeChildren',
  282. }"
  283. :default-checked-keys="department"
  284. :default-expand-all="true"
  285. show-checkbox
  286. :data="setupdepartments"
  287. node-key="id"
  288. @check="iscrentddepartment"
  289. ref="department"
  290. size="small"
  291. />
  292. </div>
  293. </el-tab-pane>
  294. <el-tab-pane label="项目类别权限">
  295. <div style="overflow-y: scroll; height: 350px">
  296. <el-tree
  297. :props="{
  298. label: 'displayName',
  299. children: 'treeChildren',
  300. }"
  301. :default-checked-keys="haveitemtype"
  302. :default-expand-all="true"
  303. show-checkbox
  304. :data="itemtype"
  305. node-key="id"
  306. @check="iscrentditemtype"
  307. ref="haveitemtype"
  308. size="small"
  309. />
  310. </div>
  311. </el-tab-pane>
  312. </el-tabs>
  313. <!-- //新增 -->
  314. <el-form
  315. v-show="title == 1 ? true : false"
  316. v-if="dialogVisible"
  317. ref="form"
  318. :model="form"
  319. label-width="80px"
  320. :rules="rules"
  321. >
  322. <el-tabs style="height: 400px">
  323. <el-tab-pane label="用户信息">
  324. <el-row>
  325. <el-col :span="12">
  326. <el-form-item label="姓名" prop="surname">
  327. <el-input
  328. v-model="form.surname"
  329. size="small"
  330. ></el-input> </el-form-item
  331. ></el-col>
  332. <el-col :span="12">
  333. <el-form-item label="用户名" prop="userName">
  334. <el-input
  335. v-model="form.userName"
  336. size="small"
  337. ></el-input> </el-form-item
  338. ></el-col>
  339. <!-- <el-col :span="12">
  340. <el-form-item label="名称" prop="userName">
  341. <el-input
  342. v-model="form.usesurnamerName"
  343. ></el-input> </el-form-item
  344. ></el-col> -->
  345. <!-- <el-col :span="12">
  346. <el-form-item label="名称" prop="name">
  347. <el-input v-model="form.name"></el-input> </el-form-item
  348. ></el-col> -->
  349. <el-col :span="12">
  350. <el-form-item label="手机号" prop="phoneNumber">
  351. <el-input
  352. v-model="form.phoneNumber"
  353. size="small"
  354. ></el-input> </el-form-item
  355. ></el-col>
  356. <!-- <el-col :span="12">
  357. <el-form-item label="邮箱" >
  358. <el-input v-model="form.email"></el-input> </el-form-item
  359. ></el-col> -->
  360. <el-col :span="12">
  361. <el-form-item
  362. label="密码"
  363. prop="password"
  364. v-if="title == 1 ? true : false"
  365. >
  366. <el-input
  367. show-password
  368. v-model="form.password"
  369. type="password"
  370. autocomplete="new-password"
  371. size="small"
  372. ></el-input> </el-form-item
  373. ></el-col>
  374. <el-col :span="12">
  375. <el-form-item label="是否激活">
  376. <el-checkbox
  377. v-model="form.isActive"
  378. true-label="true"
  379. false-label="false"
  380. ></el-checkbox>
  381. </el-form-item>
  382. </el-col>
  383. </el-row>
  384. </el-tab-pane>
  385. <!-- 角色111 -->
  386. <el-tab-pane label="角色">
  387. <el-checkbox-group v-model="form.roleNames">
  388. <el-checkbox
  389. v-model="item.id"
  390. :label="item.name"
  391. v-for="(item, index) in options"
  392. :key="index"
  393. >
  394. </el-checkbox>
  395. </el-checkbox-group>
  396. </el-tab-pane>
  397. <!-- 组织11 -->
  398. <el-tab-pane label="所属科室">
  399. <el-cascader
  400. v-model="orgId"
  401. :options="organizationalstructure"
  402. :show-all-levels="false"
  403. ref="example"
  404. popper-class="example"
  405. @change="cascaderchang"
  406. :props="{
  407. label: 'displayName',
  408. children: 'treeChildren',
  409. checkStrictly: true,
  410. value: 'id',
  411. expandTrigger: 'hover',
  412. }"
  413. size="small"
  414. ></el-cascader>
  415. <!-- <el-tree
  416. :data="newachitecture"
  417. show-checkbox
  418. :default-expand-all="true"
  419. @check="ischesc"
  420. node-key="id"
  421. ref="tree"
  422. :default-expanded-keys="nodekes"
  423. :default-checked-keys="[5]"
  424. :props="{ label: 'displayName', children: 'treeChildren' }"
  425. >
  426. </el-tree> -->
  427. </el-tab-pane>
  428. <el-tab-pane label="科室操作权限">
  429. <div style="overflow-y: scroll; height: 350px">
  430. <el-tree
  431. :data="newdepartment"
  432. show-checkbox
  433. :default-expand-all="true"
  434. @check="iscrentddepartments"
  435. node-key="id"
  436. ref="tree"
  437. :props="{ label: 'displayName', children: 'treeChildren' }"
  438. size="small"
  439. >
  440. </el-tree>
  441. </div>
  442. </el-tab-pane>
  443. <el-tab-pane label="项目类别权限">
  444. <div style="overflow-y: scroll; height: 350px">
  445. <el-tree
  446. :data="newitemtype"
  447. show-checkbox
  448. :default-expand-all="true"
  449. @check="iscrentditemtypes"
  450. node-key="id"
  451. ref="newitemtype"
  452. :props="{ label: 'displayName', children: 'treeChildren' }"
  453. size="small"
  454. >
  455. </el-tree>
  456. </div>
  457. </el-tab-pane>
  458. </el-tabs>
  459. </el-form>
  460. <span slot="footer" class="dialog-footer">
  461. <el-button @click="cancellation" class="difference"> </el-button>
  462. <el-button type="primary" @click="addlsit" class="commonbutton"
  463. > </el-button
  464. >
  465. </span>
  466. </el-dialog>
  467. <!-- 绑定用户组织弹框 -->
  468. <el-dialog
  469. title="绑定组织"
  470. :visible.sync="bindingdialogVisible"
  471. width="30%"
  472. :close-on-click-modal="false"
  473. >
  474. <el-row>
  475. <el-col :span="8">当前组织:</el-col>
  476. <!-- <el-col :span="16" v-for="(item, index) in values" :key="index">{{
  477. item.displayName
  478. }}</el-col> -->
  479. <el-col :span="8" v-for="(item, index) in values" :key="index">{{
  480. item
  481. }}</el-col>
  482. </el-row>
  483. <el-cascader
  484. style="margin-top: 10px"
  485. v-model="values"
  486. :options="option"
  487. :props="{
  488. value: 'displayName',
  489. label: 'displayName',
  490. children: 'treeChildren',
  491. checkStrictly: true,
  492. }"
  493. @change="handleChange"
  494. ></el-cascader>
  495. <span slot="footer" class="dialog-footer">
  496. <el-button @click="bindingdialogVisible = false"> </el-button>
  497. <el-button type="primary" @click="binduser"> </el-button>
  498. </span>
  499. </el-dialog>
  500. <!-- 用户绑定管理弹框 -->
  501. <el-dialog
  502. title="绑定角色"
  503. :visible.sync="useerdialogVisible"
  504. width="30%"
  505. :close-on-click-modal="false"
  506. >
  507. <el-row>
  508. <el-col :span="8">所属角色:</el-col>
  509. <el-col :span="16" v-for="(item, index) in bingdusers" :key="index">{{
  510. item.name
  511. }}</el-col>
  512. </el-row>
  513. <el-select
  514. v-model="uservalue"
  515. multiple
  516. placeholder="请选择"
  517. style="margin-top: 15px"
  518. size="small"
  519. >
  520. <el-option
  521. v-for="item in useroptions"
  522. :key="item.id"
  523. :label="item.name"
  524. :value="item.name"
  525. >
  526. </el-option>
  527. </el-select>
  528. <span slot="footer" class="dialog-footer">
  529. <el-button @click="useerdialogVisible = false" class="difference"
  530. > </el-button
  531. >
  532. <el-button type="primary" @click="Identifyusers" class="commonbutton"
  533. > </el-button
  534. >
  535. </span>
  536. </el-dialog>
  537. <!-- 修改密码弹框 -->
  538. <el-dialog
  539. :title="'修改密码' + '用户' + usersName"
  540. :visible.sync="editpassworddialogVisible"
  541. width="30%"
  542. :close-on-click-modal="false"
  543. >
  544. <el-form ref="form" :model="form" label-width="80px">
  545. <el-form-item label="新密码">
  546. <el-input
  547. v-model="newPassWord"
  548. max="16"
  549. min="6"
  550. size="small"
  551. ></el-input>
  552. </el-form-item>
  553. </el-form>
  554. <el-form ref="form" :model="form" label-width="80px">
  555. <el-form-item label="确认密码">
  556. <el-input
  557. v-model="confarmPassWord"
  558. max="16"
  559. min="6"
  560. size="small"
  561. ></el-input>
  562. </el-form-item>
  563. </el-form>
  564. <span slot="footer" class="dialog-footer">
  565. <el-button
  566. @click="editpassworddialogVisible = false"
  567. class="difference"
  568. > </el-button
  569. >
  570. <el-button type="primary" @click="Changepassword" class="commonbutton"
  571. > </el-button
  572. >
  573. </span>
  574. </el-dialog>
  575. <!--查看用户菜单权限-->
  576. <el-dialog
  577. title="查看用户菜单权限"
  578. :visible.sync="dialogWin.MenuPageSet"
  579. width="300px"
  580. :close-on-click-modal="false"
  581. >
  582. <MenuPageSet :params="dialogParams.MenuPageSet" />
  583. </el-dialog>
  584. </div>
  585. </div>
  586. </template>
  587. <script>
  588. import {
  589. usreslist,
  590. newlists,
  591. delestsid,
  592. editmodify,
  593. getbook,
  594. userorganizat,
  595. organizationtree,
  596. userbind,
  597. usersroles,
  598. useraffiliation,
  599. reverseselection,
  600. usersinits,
  601. selectbinding,
  602. lognis,
  603. } from "../../request/ruquset";
  604. import { mapState } from "vuex";
  605. import { isValid } from "@/utlis/validate";
  606. import { getapi, postapi } from "@/api/api";
  607. import { tcdate, deepCopy, objCopy } from "../../utlis/proFunc";
  608. import MenuPageSet from "../../components/menuPage/MenuPageSet.vue";
  609. // let validatePassword = (rule, value, callback) => {
  610. // var reg1 =
  611. // /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*.])[\da-zA-Z~!@#$%^&*.]{6,}$/; //密码必须是8位以上、必须含有字母、数字、特殊符号
  612. // var reg2 = /(123|234|345|456|567|678|789|012)/; //不能有3个连续数字
  613. // if (!reg1.test(value)) {
  614. // callback(new Error("密码必须是6位以上、必须含有字母、数字、特殊符号"));
  615. // } else if (reg2.test(value)) {
  616. // callback(new Error("不能有3个连续数字"));
  617. // } else {
  618. // callback();
  619. // }
  620. // };
  621. // let validatePassword = /^[a-zA-Z0-9@\$\^\.\*\\?]\{6,15}$/;
  622. export default {
  623. components: {
  624. MenuPageSet,
  625. },
  626. data() {
  627. return {
  628. treedata: [],
  629. defaultProps: {
  630. children: "treeChildren",
  631. label: "displayName",
  632. },
  633. orgIds: "",
  634. orgId: "",
  635. confarmPassWord: "", //确认密码
  636. usersName: "", //用户名
  637. department: [], //选中的科室
  638. setupdepartments: [], //设置科室
  639. newPassWord: "", //新密码
  640. editpassworddialogVisible: false, //修改密码
  641. nodekes: [],
  642. activeName: "first",
  643. chaxunform: {
  644. surname: "",
  645. phoneNumber: "",
  646. userName: "",
  647. },
  648. useroptions: [],
  649. options: [],
  650. uservalue: [],
  651. useerdialogVisible: false,
  652. bindingdialogVisible: false,
  653. values: [],
  654. option: [],
  655. crdetcascader: [], //绑定组织显示
  656. dialogParams: {
  657. MenuPageSet: { opra: "role" }, //默认角色
  658. },
  659. //表单校验
  660. rules: {
  661. password: [
  662. {
  663. required: true,
  664. trigger: "blur",
  665. message: "密码不能为空",
  666. },
  667. {
  668. min: 6,
  669. max: 15,
  670. message: "长度在 6 到 15 个字符",
  671. trigger: "blur",
  672. },
  673. // {
  674. // required: true,
  675. // trigger: "blur",
  676. // validator: validatePassword,
  677. // },
  678. ],
  679. email: [
  680. {
  681. required: true,
  682. message: "请输入邮箱地址",
  683. trigger: "blur",
  684. },
  685. {
  686. type: "email",
  687. message: "请输入正确的邮箱地址",
  688. trigger: ["blur", "change"],
  689. },
  690. ],
  691. phoneNumber: [
  692. { required: true, message: "请输入手机号", trigger: "blur" },
  693. ],
  694. userName: [
  695. { required: true, message: "请输入用户名", trigger: "blur" },
  696. ],
  697. surname: [
  698. { required: true, message: "请输入用户名称", trigger: "change" },
  699. ],
  700. roleNames: [
  701. { required: true, message: "请选择所属用户", trigger: "change" },
  702. ],
  703. nam: [{ required: true, message: "请输入名", trigger: "change" }],
  704. },
  705. ruless: {
  706. password: [
  707. {
  708. required: true,
  709. trigger: "blur",
  710. message: "密码不能为空",
  711. },
  712. {
  713. min: 6,
  714. max: 15,
  715. message: "长度在 6 到 15 个字符",
  716. trigger: "blur",
  717. },
  718. ],
  719. email: [
  720. {
  721. required: true,
  722. message: "请输入邮箱地址",
  723. trigger: "blur",
  724. },
  725. {
  726. type: "email",
  727. message: "请输入正确的邮箱地址",
  728. trigger: ["blur", "change"],
  729. },
  730. ],
  731. phoneNumber: [
  732. { required: true, message: "请输入手机号", trigger: "blur" },
  733. ],
  734. userName: [
  735. { required: true, message: "请输入用户名", trigger: "blur" },
  736. ],
  737. surname: [
  738. { required: true, message: "请输入用户名称", trigger: "change" },
  739. ],
  740. roleNames: [
  741. { required: true, message: "请选择所属用户", trigger: "change" },
  742. ],
  743. nam: [{ required: true, message: "请输入名", trigger: "change" }],
  744. },
  745. tableData: [],
  746. optionsArr: [],
  747. dialogVisible: false,
  748. modetype: "",
  749. total: 0,
  750. form: {
  751. surname: "",
  752. name: "",
  753. email: "",
  754. surname: "",
  755. phoneNumber: "",
  756. password: "",
  757. roleNames: [],
  758. userName: "",
  759. password: "",
  760. isActive: true,
  761. },
  762. roleNames: [],
  763. are: [],
  764. checkList: [], //多选框
  765. pages: {
  766. SkipCount: 0,
  767. MaxResultCount: 1000,
  768. },
  769. title: 1,
  770. rowid: "",
  771. userid: "",
  772. bingdusers: [], //s所属用户角色
  773. organizationalstructure: [], //组织架构
  774. defaultKeys: [], //选中的
  775. newachitecture: [], //新增弹框获取组织数据
  776. // customer:[]
  777. password: "",
  778. passwordid: "",
  779. newdepartment: [], //新增科室
  780. curRow: {},
  781. itemtype: [],
  782. haveitemtype: [],
  783. newitemtype: [],
  784. };
  785. },
  786. computed: {
  787. ...mapState(["window", "dialogWin", "dataTransOpts", "changepassword"]),
  788. },
  789. created() {
  790. this.password = this.changepassword;
  791. this.btnQuery();
  792. this.gettreedata();
  793. this.idkes = window.sessionStorage.getItem("dataidkes");
  794. },
  795. methods: {
  796. cancellation() {
  797. this.dialogVisible = false;
  798. this.form = this.$options.data().form;
  799. this.roleNames = this.$options.data().roleNames;
  800. this.department = this.$options.data().department;
  801. this.orgId = this.$options.data().orgId;
  802. this.haveitemtype = this.$options.data().haveitemtype;
  803. },
  804. cascaderchang(v) {
  805. if (v.length > 1) {
  806. this.orgId = this.orgId.slice(-1)[0];
  807. } else {
  808. this.orgId = this.orgId[0];
  809. }
  810. this.$refs.example.toggleDropDownVisible();
  811. },
  812. gettreedata() {
  813. getapi("/api/app/organization-units/by-code-all").then((res) => {
  814. if (res.code != -1) {
  815. this.treedata = res.data;
  816. }
  817. });
  818. },
  819. handleNodeClick(data) {
  820. this.department = data.displayName;
  821. getapi(
  822. `/api/identity/users/getlistinorganizationunit?OrganizationUnitId=${data.id}`
  823. ).then((res) => {
  824. if (res.code != -1) {
  825. this.tableData = res.data;
  826. }
  827. });
  828. },
  829. rowick(row) {
  830. this.curRow = row;
  831. // posjrctid(row.id).then((res) => {
  832. // this.curRow = { ...res.data };
  833. // });
  834. },
  835. iscrentddepartment() {
  836. this.department = this.$refs.department.getCheckedKeys(true);
  837. },
  838. iscrentddepartments() {
  839. this.department = this.$refs.tree.getCheckedKeys(true);
  840. },
  841. iscrentditemtype() {
  842. this.haveitemtype = this.$refs.haveitemtype.getCheckedKeys(true);
  843. },
  844. iscrentditemtypes() {
  845. this.haveitemtype = this.$refs.newitemtype.getCheckedKeys(true);
  846. },
  847. //修改密码确定按钮
  848. Changepassword() {
  849. if (this.newPassWord == "") {
  850. this.$message.warning("请输入新密码");
  851. } else if (this.confarmPassWord == "") {
  852. this.$message.warning("请输入确认密码");
  853. } else if (this.newPassWord != this.confarmPassWord) {
  854. this.$message.warning("二次输入密码不一致");
  855. } else {
  856. postapi("/api/identity/users/resetpassword", {
  857. userId: this.passwordid,
  858. newPassWord: this.newPassWord,
  859. }).then((res) => {
  860. if (res.code != -1) {
  861. this.editpassworddialogVisible = false;
  862. this.$message.success("修改成功");
  863. }
  864. });
  865. }
  866. },
  867. //修改密码
  868. editpassword() {
  869. if (this.curRow.id == undefined) {
  870. this.$message.warning("请选择操作的数据");
  871. } else {
  872. this.editpassworddialogVisible = true;
  873. this.passwordid = curRow.id;
  874. this.usersName = curRow.userName;
  875. }
  876. },
  877. // 查看用户菜单权限
  878. btnMenu(row) {
  879. if (this.curRow.id == undefined) {
  880. this.$message.warning("请选择操作的数据");
  881. } else {
  882. this.dialogParams.MenuPageSet.opra = "user";
  883. this.dataTransOpts.tableS.adp_users.id = this.curRow.id;
  884. this.dialogWin.MenuPageSet = true;
  885. setTimeout(() => {
  886. this.dataTransOpts.refresh.role_menu_info.M++;
  887. }, 20);
  888. }
  889. },
  890. //新增选择的
  891. ischesc() {
  892. this.nodekes = this.$refs.tree.getCheckedKeys(true);
  893. },
  894. //选中的组织
  895. iscrentd() {
  896. this.defaultKeys = this.$refs.trees.getCheckedKeys(true);
  897. // console.log("222", this.$refs.tree.defaultKeys(true));
  898. },
  899. //选中适合的值
  900. handleCheckAllChange() {
  901. // this.form.roleNames = this.roleNames;
  902. // console.log(this.activeName);
  903. },
  904. //table页切换
  905. handleClick() {
  906. if (this.activeName == "1") {
  907. //获取当前绑定用户
  908. useraffiliation(this.form.id).then((res) => {
  909. if (res.code != -1) {
  910. if (res.data.items && res.data.items.length > 0) {
  911. let val = res.data.items.map((item) => {
  912. return item.name;
  913. });
  914. this.$set(this.form, "roleNames", val);
  915. } else {
  916. this.$set(this.form, "roleNames", []);
  917. }
  918. }
  919. });
  920. }
  921. },
  922. //用户列表查询
  923. // inquireabout() {
  924. // this.btnQuery();
  925. // // usreslist()
  926. // },
  927. btnQuery() {
  928. getapi("/api/identity/users/getlist", this.pages).then((res) => {
  929. if (res.code != -1) {
  930. this.tableData = res.data.items;
  931. }
  932. });
  933. },
  934. onchang(v) {
  935. // this.form.roleNames[0] = v;
  936. },
  937. //级联选择器
  938. handleChange(value) {
  939. this.values = value;
  940. },
  941. // getlist() {
  942. // usreslist(this.pages).then((res) => {
  943. // this.tableData = res.data.items;
  944. // this.total = res.data.totalCount;
  945. // console.log(res);
  946. // });
  947. // },
  948. //绑定
  949. binding(row) {
  950. this.bindingdialogVisible = true;
  951. this.rowid = row.id;
  952. organizationtree().then((res) => {
  953. if (res.code != -1) {
  954. this.option = res.data;
  955. }
  956. });
  957. // reverseselection(row.id).then((res) => {
  958. // this.crdetcascader = res.data;
  959. // console.log(res);
  960. // });
  961. // userorganizat(row.id, this.idkes ).then((res) => {
  962. // console.log(res);
  963. // });
  964. },
  965. //绑定用户角色
  966. bandinuser() {
  967. if (this.curRow.id == undefined) {
  968. this.$message.warning("请选择操作的数据");
  969. } else {
  970. this.useerdialogVisible = true;
  971. this.userid = this.curRow.id;
  972. usersroles().then((res) => {
  973. if (res.code != -1) {
  974. this.useroptions = res.data.items;
  975. }
  976. });
  977. useraffiliation(this.curRow.id).then((res) => {
  978. if (res.code != -1) {
  979. res.data.items.forEach((element) => {
  980. this.uservalue = element[name];
  981. });
  982. // this.uservalue=res.data.items[name]
  983. this.bingdusers = res.data.items;
  984. }
  985. // console.log(res);
  986. });
  987. // this.form.roleNames.push(row.userName)
  988. // userbind(row.id,{roleNames:this.form.roleNames}).then(res=>{
  989. // console.log(res)
  990. // })
  991. // console.log(row);
  992. }
  993. },
  994. //确定绑定
  995. Identifyusers() {
  996. // let are = [];
  997. // console.log(this.uservalue);
  998. // are.push(this.uservalue);
  999. // this.uservalue = are;
  1000. if (this.uservalue !== "") {
  1001. userbind(this.userid, { roleNames: this.uservalue }).then((res) => {
  1002. if (res.code != -1) {
  1003. this.btnQuery();
  1004. this.useerdialogVisible = false;
  1005. this.$message.success("绑定成功");
  1006. }
  1007. });
  1008. } else {
  1009. this.$message.warning("请选择用户");
  1010. }
  1011. },
  1012. //绑定
  1013. binduser() {
  1014. if (this.values.length == 0) {
  1015. this.$message.warning("请选中");
  1016. } else {
  1017. userorganizat(this.rowid, this.idkes).then((res) => {
  1018. if (res.code != -1) {
  1019. this.bindingdialogVisible = false;
  1020. this.btnQuery();
  1021. this.$message.success("操作成功");
  1022. }
  1023. // this.values = [];
  1024. // console.log(res);
  1025. });
  1026. }
  1027. },
  1028. //新增用户
  1029. newlyincreased() {
  1030. this.dialogVisible = true;
  1031. this.title = 1;
  1032. if (this.title == 1) {
  1033. this.form = this.$options.data().form;
  1034. this.orgId = this.department;
  1035. }
  1036. getbook().then((res) => {
  1037. // res.data.items.forEach((element) => {
  1038. // this.form.roleNames = element.name;
  1039. // console.log(element);
  1040. // });
  1041. if (res.code != -1) {
  1042. this.options = res.data.items;
  1043. }
  1044. });
  1045. organizationtree().then((res) => {
  1046. if (res.code != -1) {
  1047. this.newachitecture = res.data;
  1048. this.newdepartment = res.data;
  1049. this.organizationalstructure = res.data;
  1050. tcdate(this.organizationalstructure);
  1051. }
  1052. });
  1053. getapi("/api/app/item-type/by-code-all").then((res) => {
  1054. if (res.code != -1) {
  1055. this.newitemtype = [...res.data];
  1056. }
  1057. });
  1058. },
  1059. //确定添加或修改
  1060. addlsit() {
  1061. this.$refs.form.validate((valid) => {
  1062. if (valid) {
  1063. if (this.title == 1) {
  1064. let arrs = [];
  1065. // arrs.push(this.roleNames);
  1066. // console.log(arrs)
  1067. let obj = {
  1068. userName: this.form.userName,
  1069. name: this.form.name,
  1070. surname: this.form.surname,
  1071. email: this.form.email,
  1072. usesurnamerName: this.form.usesurnamerName,
  1073. phoneNumber: this.form.phoneNumber,
  1074. password: this.form.password,
  1075. roleNames: this.form.roleNames,
  1076. isActive: this.form.isActive,
  1077. };
  1078. if (this.form.roleNames.length == 0) {
  1079. this.$message.warning("请选择角色");
  1080. } else if (this.orgId == "" || this.orgId == null) {
  1081. this.$message.warning("请选择科室");
  1082. } else {
  1083. newlists(obj).then((res) => {
  1084. if (res.code != -1) {
  1085. this.form = res.data;
  1086. postapi(
  1087. `/api/app/abpuserdepartment/createmany?UserId=${this.form.id}`,
  1088. this.department
  1089. ).then((res) => {
  1090. if (res.code != -1) {
  1091. postapi(
  1092. "/api/app/organization-units/user-organization-unit",
  1093. { userId: this.form.id, orgId: this.orgId }
  1094. ).then((res) => {
  1095. if (res.code != -1) {
  1096. postapi(
  1097. `/api/app/UserItemType/CreateMany?UserId=${this.form.id}`,
  1098. this.haveitemtype
  1099. ).then((res) => {
  1100. if (res.code != -1) {
  1101. this.dialogVisible = false;
  1102. this.$message.success("新增成功");
  1103. this.form = this.$options.data().form;
  1104. this.roleNames = this.$options.data().roleNames;
  1105. this.department = this.$options.data().department;
  1106. this.curRow = this.$options.data().curRow;
  1107. this.orgId = this.$options.data().orgId;
  1108. this.haveitemtype =this.$options.data().haveitemtype;
  1109. this.$refs["tableData"].setCurrentRow("");
  1110. this.btnQuery();
  1111. }
  1112. });
  1113. }
  1114. });
  1115. }
  1116. });
  1117. }
  1118. });
  1119. }
  1120. } else if (this.title == 2) {
  1121. // this.roleNames=arrs
  1122. let obj = {
  1123. userName: this.form.userName,
  1124. name: this.form.name,
  1125. surname: this.form.surname,
  1126. email: this.form.email,
  1127. usesurnamerName: this.form.usesurnamerName,
  1128. phoneNumber: this.form.phoneNumber,
  1129. password: this.form.password,
  1130. roleNames: this.form.roleNames,
  1131. isActive: this.form.isActive,
  1132. // roleNames: this.form.roleNames,
  1133. };
  1134. if (this.orgId == "" || this.orgId == null) {
  1135. return this.$message.warning("请选择科室");
  1136. }
  1137. if (this.form.roleNames.length == 0) {
  1138. this.$message.warning("请选则用户角色");
  1139. return;
  1140. }
  1141. let msg = "";
  1142. //更新用户与所属角色
  1143. postapi(`/api/identity/users/update?id=${this.form.id}`, obj).then(
  1144. (res) => {
  1145. if (res.code != -1) {
  1146. //更新科室权限
  1147. postapi(
  1148. `/api/app/abpuserdepartment/createmany?UserId=${this.form.id}`,
  1149. this.department
  1150. ).then((res) => {
  1151. if (res.code != -1) {
  1152. postapi(
  1153. "/api/app/organization-units/user-organization-unit",
  1154. { userId: this.form.id, orgId: this.orgId }
  1155. ).then((res) => {
  1156. if (res.code != -1) {
  1157. postapi(
  1158. `/api/app/UserItemType/CreateMany?UserId=${this.form.id}`,
  1159. this.haveitemtype
  1160. ).then((res) => {
  1161. if (res.code != -1) {
  1162. this.dialogVisible = false;
  1163. this.form = this.$options.data().form;
  1164. this.roleNames = this.$options.data().roleNames;
  1165. this.department = this.$options.data().department;
  1166. this.curRow = this.$options.data().curRow;
  1167. this.orgId = this.$options.data().orgId;
  1168. this.haveitemtype =this.$options.data().haveitemtype;
  1169. this.$refs["tableData"].setCurrentRow("");
  1170. this.$message.success("操作成功!");
  1171. this.btnQuery();
  1172. }
  1173. });
  1174. }
  1175. });
  1176. }
  1177. });
  1178. }
  1179. }
  1180. );
  1181. }
  1182. }
  1183. });
  1184. },
  1185. //删除方法
  1186. deleates() {
  1187. if (this.curRow.id == undefined) {
  1188. this.$message.warning("请选择删除的数据");
  1189. } else {
  1190. let id = this.curRow.id.id;
  1191. // delestsid(id).then((res) => {
  1192. // console.log(res);
  1193. // this.btnQuery();
  1194. // console.log("删除成功");
  1195. // });
  1196. this.$confirm("是否确定删除, 是否继续?", "提示", {
  1197. confirmButtonText: "确定",
  1198. cancelButtonText: "取消",
  1199. type: "warning",
  1200. cancelButtonClass: "difference",
  1201. confirmButtonClass: "commonbutton",
  1202. })
  1203. .then(() => {
  1204. postapi(`/api/identity/users/delete?id=${this.curRow.id}`).then(
  1205. (res) => {
  1206. if (res.code != -1) {
  1207. this.btnQuery();
  1208. this.curRow = this.$options.data().curRow;
  1209. this.$message.success("删除成功");
  1210. }
  1211. }
  1212. );
  1213. })
  1214. .catch(() => {});
  1215. }
  1216. },
  1217. //编辑修改
  1218. editmony() {
  1219. if (this.curRow.id == undefined) {
  1220. this.$message.warning("请选择操作的数据");
  1221. } else {
  1222. this.dialogVisible = true;
  1223. this.title = 2;
  1224. // this.form.roleNames = this.roleNames;
  1225. if (this.title == 2) {
  1226. // row里面没有roleNames字段
  1227. //const form = JSON.parse(JSON.stringify(row));
  1228. const form = deepCopy(this.curRow);
  1229. this.form = {
  1230. ...form,
  1231. roleNames: [],
  1232. };
  1233. this.form.roleNames = [];
  1234. //获取组织架构
  1235. organizationtree().then((res) => {
  1236. if (res.code != -1) {
  1237. this.organizationalstructure = res.data;
  1238. tcdate(this.organizationalstructure);
  1239. this.setupdepartments = res.data;
  1240. }
  1241. });
  1242. // postapi(`/api/app/abpuserdepartment/createmany?UserId=${this.form.id}`,{orgId:this.orgId[0]}).then(res=>{
  1243. // console.log(res,'wwwwwwwwwwwww');
  1244. // })
  1245. useraffiliation(this.form.id).then((res) => {
  1246. if (res.code != -1) {
  1247. if (res.data.items && res.data.items.length > 0) {
  1248. let val = res.data.items.map((item) => {
  1249. return item.name;
  1250. });
  1251. this.$set(this.form, "roleNames", val);
  1252. } else {
  1253. this.$set(this.form, "roleNames", []);
  1254. }
  1255. }
  1256. });
  1257. //根据用户ID查组织信息
  1258. getapi(
  1259. `/api/app/organization-units/organization-unit-by-user-id/${this.curRow.id}`
  1260. ).then((res) => {
  1261. if (res.code != -1 && res.data.length > 0) {
  1262. this.orgId = res.data[0].id;
  1263. }
  1264. });
  1265. //获取科室权限 编辑
  1266. getapi(
  1267. `/api/app/abpuserdepartment/getuserdepartment?UserId=${this.curRow.id}`
  1268. ).then((res) => {
  1269. // default-checked-keys
  1270. if (res.code != -1) {
  1271. this.department = res.data;
  1272. }
  1273. });
  1274. }
  1275. // useraffiliation(row.id).then((res) => {
  1276. // this.form.roleNames = res.data.items[0].name;
  1277. // // res.data.items.forEach(item=>{
  1278. // // this.form.roleNames=item.name
  1279. // // console.log(item)
  1280. // // })
  1281. // console.log("form", this.form);
  1282. // // console.log(res);
  1283. // console.log(res, "=====10010");
  1284. // this.$forceUpdate();
  1285. // });
  1286. getbook().then((res) => {
  1287. const { code, data } = res;
  1288. if (code != -1) {
  1289. let options = data.items;
  1290. this.checkList = options;
  1291. // console.log(this.checkList, "checkList");
  1292. this.options = options;
  1293. // this.options = options.map((item, index) => {
  1294. // return {
  1295. // id: item.name,
  1296. // name: item.name,
  1297. // };
  1298. // });
  1299. }
  1300. });
  1301. getapi("/api/app/item-type/by-code-all").then((res) => {
  1302. if (res.code != -1) {
  1303. this.itemtype = [...res.data];
  1304. }
  1305. });
  1306. postapi(
  1307. `/api/app/UserItemType/GetUserItemType?UserId=${this.curRow.id}`
  1308. ).then((res) => {
  1309. if (res.code != -1) {
  1310. this.haveitemtype = [...res.data];
  1311. }
  1312. });
  1313. }
  1314. },
  1315. //分页
  1316. handleSizeChange(v) {
  1317. this.pages.MaxResultCount = v;
  1318. this.btnQuery();
  1319. },
  1320. handleCurrentChange(v) {
  1321. this.pages.SkipCount = v;
  1322. this.btnQuery();
  1323. },
  1324. },
  1325. };
  1326. </script>
  1327. <style scoped>
  1328. @import "../../assets/css/global_button.css";
  1329. @import "../../assets/css/global_dialog.css";
  1330. @import "../../assets/css/global_table.css";
  1331. @import "../../assets/css/global_form.css";
  1332. @import "../../assets/css/global_input.css";
  1333. @import "../../assets/css/global.css";
  1334. .box {
  1335. display: flex;
  1336. flex-direction: column;
  1337. }
  1338. .layeredleftright {
  1339. width: 100%;
  1340. display: flex;
  1341. flex-direction: column;
  1342. }
  1343. :deep .el-form-item {
  1344. margin-bottom: 14px;
  1345. }
  1346. /* el-dialog的头部样式 */
  1347. :deep .el-dialog__header {
  1348. padding: 11px 20px 11px;
  1349. }
  1350. /* el-dialog的主体样式 */
  1351. :deep .el-dialog__body {
  1352. padding: 0px 20px 0px;
  1353. }
  1354. /* el-divider样式 */
  1355. :deep .el-divider--horizontal {
  1356. margin: 0px 0 12px;
  1357. }
  1358. /* el-dialog的底部样式 */
  1359. :deep .el-dialog__footer {
  1360. padding: 0px 20px 14px;
  1361. }
  1362. :deep .el-table tr {
  1363. height: 33px;
  1364. }
  1365. </style>