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.

1728 lines
56 KiB

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