Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

admin.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <div>
  6. <el-button
  7. type="primary"
  8. size="small"
  9. icon="el-icon-circle-plus-outline"
  10. style="float:left"
  11. @click="openForm(0)">新增</el-button>
  12. <el-button
  13. type="primary"
  14. size="small"
  15. @click="BatchDelete"
  16. >医药师登记</el-button>
  17. <!-- <el-button
  18. type="primary"
  19. size="small"
  20. icon="el-icon-circle-plus-outline"
  21. style="float:left"
  22. @click="toTest">短信</el-button> -->
  23. <!-- <el-button
  24. type="primary"
  25. size="small"
  26. icon="el-icon-circle-plus-outline"
  27. style="float:left"
  28. @click="toTestOne">创建个人用户实名</el-button> -->
  29. <!-- <el-button
  30. type="primary"
  31. size="small"
  32. icon="el-icon-circle-plus-outline"
  33. style="float:left"
  34. @click="toTestFive">创建企业用户并实名</el-button> -->
  35. <!-- <el-button
  36. type="primary"
  37. size="small"
  38. icon="el-icon-circle-plus-outline"
  39. style="float:left"
  40. @click="toTestFour">添加企业成员</el-button> -->
  41. <!-- <el-button
  42. type="primary"
  43. size="small"
  44. icon="el-icon-circle-plus-outline"
  45. style="float:left"
  46. @click="toTestTwo">创建个人印章</el-button> -->
  47. <!-- <el-button
  48. type="primary"
  49. size="small"
  50. icon="el-icon-circle-plus-outline"
  51. style="float:left"
  52. @click="toTestThree">创建合同</el-button>
  53. <el-button
  54. type="primary"
  55. size="small"
  56. icon="el-icon-circle-plus-outline"
  57. style="float:left"
  58. @click="toTestSeven">添加合同签署人</el-button> -->
  59. <!-- <el-button
  60. type="primary"
  61. size="small"
  62. icon="el-icon-circle-plus-outline"
  63. style="float:left"
  64. @click="toTestNight">后台签署</el-button> -->
  65. <!-- <el-button type="primary"
  66. size="small"
  67. icon="el-icon-circle-plus-outline"
  68. style="float:left" @click="toTestEight">
  69. 脚本
  70. </el-button> -->
  71. </div>
  72. </div>
  73. <div class="app-container">
  74. <el-table
  75. :row-style="{ color: '#303133' }"
  76. :header-cell-style="{
  77. backgroundColor: 'rgb(245, 247, 250)',
  78. color: '#606266'
  79. }"
  80. style="width:100%;"
  81. ref="table"
  82. border
  83. :data="admins"
  84. v-loading="is_loading_admins"
  85. @selection-change="handleSelectionChange"
  86. >
  87. <el-table-column
  88. align="center"
  89. type="selection"
  90. width="55">
  91. </el-table-column>
  92. <el-table-column
  93. label="用户名"
  94. prop="user_name"
  95. min-width="160"
  96. align="center"
  97. ></el-table-column>
  98. <el-table-column label="医保医师编码" prop="doctor_number" min-width="160" align="center">
  99. <template slot-scope="scope">
  100. <span v-if="scope.row.doctor_number== 0"></span>
  101. <span v-if="scope.row.doctor_number!= 0">{{scope.row.doctor_number}}</span>
  102. </template>
  103. </el-table-column>
  104. <el-table-column
  105. label="最后登录IP"
  106. prop="ip"
  107. min-width="150"
  108. align="center"
  109. ></el-table-column>
  110. <el-table-column
  111. label="最后登录时间"
  112. prop="last_login_time"
  113. min-width="170"
  114. align="center"
  115. >
  116. <template slot-scope="scope">
  117. <span>{{
  118. scope.row.last_login_time == 0
  119. ? ""
  120. : _parseTime(scope.row.last_login_time, "{y}-{m}-{d} {h}:{i}")
  121. }}</span>
  122. </template>
  123. </el-table-column>
  124. <el-table-column
  125. label="角色"
  126. prop="role_name"
  127. min-width="160"
  128. align="center"
  129. ></el-table-column>
  130. <el-table-column label="状态" min-width="100" align="center">
  131. <template slot-scope="scope">
  132. <div
  133. v-if="scope.row.status == 1"
  134. style="color: #67C23A; font-size:20px;"
  135. >
  136. <li class="el-icon-success"></li>
  137. </div>
  138. <div v-else style="color: #F56C6C; font-size:20px;">
  139. <li class="el-icon-error"></li>
  140. </div>
  141. </template>
  142. </el-table-column>
  143. <el-table-column label="操作" width="240" align="center">
  144. <template slot-scope="scope">
  145. <!-- <router-link :to="{ path:'/role/admin/edit', query:{ id:scope.row.user_id }}"> -->
  146. <el-tooltip
  147. class="item"
  148. effect="dark"
  149. content="编辑"
  150. placement="top"
  151. >
  152. <el-button
  153. type="primary"
  154. icon="el-icon-edit-outline"
  155. size="small"
  156. @click="openForm(scope.row.user_id)"
  157. ></el-button>
  158. </el-tooltip>
  159. <!-- </router-link> -->
  160. <el-tooltip
  161. class="item"
  162. effect="dark"
  163. content="移除"
  164. placement="top"
  165. >
  166. <el-button
  167. type="danger"
  168. size="small"
  169. icon="el-icon-delete"
  170. v-if="
  171. scope.row.status == 1 &&
  172. org.creator != scope.row.user_id &&
  173. scope.row.user_id != local_user_id
  174. "
  175. @click="disableAdminAction(scope.row)"
  176. ></el-button>
  177. </el-tooltip>
  178. <el-tooltip
  179. class="item"
  180. effect="dark"
  181. content="恢复"
  182. placement="top"
  183. >
  184. <el-button
  185. size="small"
  186. type="info"
  187. icon="el-icon-refresh"
  188. v-if="
  189. scope.row.status == 0 &&
  190. org.creator != scope.row.user_id &&
  191. scope.row.user_id != local_user_id
  192. "
  193. @click="recoverAdminAction(scope.row)"
  194. ></el-button>
  195. </el-tooltip>
  196. <span v-if="scope.row.user_type == 2">
  197. <el-button type="primary" size="small" icon="el-icon-refresh-left" @click="toReturn(scope.row.user_id,scope.row.is_mark)">
  198. <span v-if="scope.row.is_mark ==0">登记</span>
  199. <span v-if="scope.row.is_mark ==1">撤销</span>
  200. </el-button>
  201. </span>
  202. </template>
  203. </el-table-column>
  204. </el-table>
  205. <el-row style="margin-top: 15px;" v-if="admin_total_count > 10">
  206. <el-col :span="24">
  207. <el-pagination
  208. :total="admin_total_count"
  209. :current-page.sync="current_page"
  210. @current-change="pageChange"
  211. :page-size="10"
  212. layout="total, prev, pager, next, jumper"
  213. ></el-pagination>
  214. </el-col>
  215. </el-row>
  216. <admin-info-form ref="admininfoform"></admin-info-form>
  217. </div>
  218. </div>
  219. </template>
  220. <script>
  221. import { adminMainView, getAdmins, setAdminStatus,toSign,toTestOne,toTestTwo,toTestThree,toTestFour,toTestFive,toTestSeven,toTestEight,toTestNight } from "@/api/role/admin";
  222. import { getRoles } from "@/api/role/role";
  223. import { parseTime } from "@/utils";
  224. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  225. import AdminInfoForm from "./components/AdminInfoForm";
  226. import axios from 'axios'
  227. export default {
  228. name: "adminManage",
  229. data() {
  230. return {
  231. crumbs: [
  232. { path: false, name: "管理中心" },
  233. { path: false, name: "员工管理" }
  234. ],
  235. is_loading_admins: true,
  236. admins: [], // [{user_id, user_name, role_name, title_name, ip, last_login_time, status}]
  237. admin_total_count: 0,
  238. current_page: 1,
  239. roles: [],
  240. is_exist_role: false,
  241. org: null,
  242. isSubSuperAdmin: false,
  243. local_user_id: 0,
  244. selectDrug:[]
  245. };
  246. },
  247. components: {
  248. BreadCrumb,
  249. AdminInfoForm
  250. },
  251. created: function() {
  252. this.local_user_id = this.$store.getters.xt_user.user.id;
  253. let page = 1;
  254. this.getRoles(page);
  255. adminMainView()
  256. .then(rs => {
  257. this.is_loading_admins = false;
  258. var resp = rs.data;
  259. if (resp.state === 1) {
  260. var adminData = resp.data.admins
  261. console.log("数据",adminData)
  262. this.admins.push(...adminData);
  263. this.admin_total_count = resp.data.total_count;
  264. this.is_exist_role = resp.data.is_exist_role;
  265. this.current_page = 1;
  266. this.org = resp.data.org;
  267. this.isSubSuperAdmin = resp.data.isSubSuperAdmin;
  268. //能进入当前页面的角色只有超级管理员和子管理员,如果当前角色是子管理员,需要把超级管理员和其他子管理员的信息去除,子管理员不能编辑超级管理员和其他子管理员信息,
  269. if (this.isSubSuperAdmin) {
  270. //去除管理员信息
  271. for (let i = 0; i < this.admins.length; i++) {
  272. if (this.admins[i].user_id == this.org.creator) {
  273. this.admins.splice(i, 1);
  274. i--;
  275. }
  276. }
  277. //去除其他子管理员信息
  278. for (let i = 0; i < this.admins.length; i++) {
  279. if (
  280. this.admins[i].user_id != this.local_user_id &&
  281. this.admins[i].is_sub_super_admin
  282. ) {
  283. //将自己排除在外
  284. console.log(this.admins[i]);
  285. this.admins.splice(i, 1);
  286. i--;
  287. }
  288. }
  289. }
  290. } else {
  291. this.$message.error(resp.msg);
  292. }
  293. })
  294. .catch(err => {
  295. this.is_loading_admins = false;
  296. this.$message.error(err);
  297. });
  298. },
  299. computed: {
  300. should_update_admins() {
  301. return this.$store.getters.xt_role_temps.did_admins_changed;
  302. }
  303. },
  304. methods: {
  305. getRoles(page) {
  306. getRoles(page)
  307. .then(rs => {
  308. this.loading_roles = false;
  309. const resp = rs.data;
  310. if (resp.state === 1) {
  311. this.roles.push(...resp.data.roles);
  312. } else {
  313. this.$message.error(resp.msg);
  314. }
  315. })
  316. .catch(err => {
  317. this.loading_roles = false;
  318. this.$message.error(err);
  319. });
  320. },
  321. openForm(adminId) {
  322. this.$refs["admininfoform"].open(adminId, this.roles);
  323. },
  324. _parseTime(time, format) {
  325. return parseTime(time, format);
  326. },
  327. requestAdminsWithPage: function(page) {
  328. this.admins.splice(0, this.admins.length);
  329. this.is_loading_admins = true;
  330. getAdmins(page)
  331. .then(rs => {
  332. this.is_loading_admins = false;
  333. const resp = rs.data;
  334. console.log(resp);
  335. if (resp.state === 1) {
  336. var admindata = resp.data.admins
  337. this.admins.push(...admindata);
  338. this.admin_total_count = resp.data.total_count;
  339. } else {
  340. this.$message.error(resp.msg);
  341. }
  342. })
  343. .catch(err => {
  344. this.is_loading_admins = false;
  345. this.$message.error(err);
  346. });
  347. },
  348. addAdminAction: function() {
  349. this.$router.push({ path: "/role/admin/create" });
  350. },
  351. disableAdminAction: function(row) {
  352. this.$msgbox({
  353. title: "提示",
  354. message: "是否确定要移除该用户",
  355. showCancelButton: true,
  356. confirmButtonText: "确定",
  357. cancelButtonText: "取消",
  358. type: "warning",
  359. beforeClose: (action, instance, done) => {
  360. if (action === "confirm") {
  361. instance.confirmButtonLoading = true;
  362. instance.confirmButtonText = "删除中...";
  363. setAdminStatus(row.user_id, false)
  364. .then(rs => {
  365. done();
  366. instance.confirmButtonLoading = false;
  367. const resp = rs.data;
  368. if (resp.state === 1) {
  369. row.status = 0;
  370. } else {
  371. this.$message.error(resp.msg);
  372. }
  373. })
  374. .catch(err => {
  375. done();
  376. instance.confirmButtonLoading = false;
  377. this.$message.error(err);
  378. });
  379. } else {
  380. done();
  381. }
  382. }
  383. });
  384. },
  385. recoverAdminAction: function(row) {
  386. const loading = this.$loading({
  387. lock: true,
  388. text: "正在恢复管理员...",
  389. spinner: "el-icon-loading",
  390. background: "rgba(0, 0, 0, 0.7)"
  391. });
  392. setAdminStatus(row.user_id, true)
  393. .then(rs => {
  394. loading.close();
  395. const resp = rs.data;
  396. if (resp.state === 1) {
  397. row.status = 1;
  398. } else {
  399. this.$message.error(resp.msg);
  400. }
  401. })
  402. .catch(err => {
  403. loading.close();
  404. this.$message.error(err);
  405. });
  406. },
  407. pageChange: function(nextPage) {
  408. this.requestAdminsWithPage(nextPage);
  409. },
  410. // toLogin(){
  411. // var that = this
  412. // axios.get('http://127.0.0.1:9532/sz/api/doctor/get').then(function(response) {
  413. // if (response.data.state == 0) {
  414. // that.$message.error(response.data.msg)
  415. // return false
  416. // } else {
  417. // that.$message({ message: '登记成功', type: 'success' })
  418. // }
  419. // }).catch(function(error) {
  420. // })
  421. // },
  422. BatchDelete() {
  423. if (this.selectDrug.length == 0) {
  424. this.$message.error("请选择要登记的信息");
  425. return false;
  426. }
  427. this.$confirm(
  428. "确认要登记所选记录吗? <br>",
  429. "备案提示",
  430. {
  431. dangerouslyUseHTMLString: true,
  432. confirmButtonText: "确定",
  433. cancelButtonText: "取消",
  434. type: "warning"
  435. }
  436. ).then(() => {
  437. var ids = [];
  438. var idMap = {};
  439. console.log("3333333",this.selectDrug)
  440. for (const index in this.selectDrug) {
  441. ids.push(this.selectDrug[index].user_id);
  442. idMap[this.selectDrug[index].user_id] = this.selectDrug[index].user_id;
  443. }
  444. var idss = ids.join(',')
  445. let params = {
  446. ids:idss,
  447. admin_user_id:this.$store.getters.xt_user.user.id
  448. }
  449. console.log("prams222",params)
  450. var that = this
  451. axios.get('http://127.0.0.1:9532/sz/api/doctor/get',{ params: params }).then(function(response) {
  452. if (response.data.state == 0) {
  453. that.$message.error(response.data.data.msg)
  454. return false
  455. } else {
  456. that.$message.error(response.data.data.msg)
  457. if(response.data.data.msg == ""){
  458. that.$message.success("登记成功!")
  459. that.adminMainView()
  460. }
  461. if(response.data.data.msg!=""){
  462. that.$message.error(response.data.data.msg)
  463. that.adminMainView()
  464. }
  465. }
  466. }).catch(function(error) {
  467. })
  468. });
  469. },
  470. toReturn(id,is_mark){
  471. var that = this
  472. let params = {
  473. 'id':id,
  474. "is_mark":is_mark,
  475. "admin_user_id":this.$store.getters.xt_user.user.id
  476. }
  477. axios.get('http://127.0.0.1:9532/sz/api/medical/get',{params:params}).then(function(response) {
  478. if (response.data.state == 0) {
  479. that.$message.error(response.data.data.msg)
  480. return false
  481. } else {
  482. if(response.data.data.msg == ""){
  483. that.$message.success("登记成功!")
  484. that.adminMainView()
  485. }
  486. if(response.data.data.msg!=""){
  487. that.$message.error(response.data.data.msg)
  488. that.adminMainView()
  489. }
  490. }
  491. }).catch(function(error) {
  492. })
  493. },
  494. handleSelectionChange(val) {
  495. this.selectDrug = val;
  496. },
  497. toTest(){
  498. toSign().then(response=>{
  499. if(response.data.state ==1){
  500. var sign = response.data.data.sign
  501. console.log("sign",sign)
  502. }
  503. })
  504. },
  505. toTestOne(){
  506. toTestOne().then(response=>{
  507. if(response.data.state==1){
  508. var sign = response.data.data.sign
  509. console.log("sign",sign)
  510. }
  511. })
  512. },
  513. toTestTwo(){
  514. toTestTwo().then(response=>{
  515. if(response.data.state ==1){
  516. var sign = response.data.data.sign
  517. console.log("sign",sign)
  518. }
  519. })
  520. },
  521. toTestThree(){
  522. toTestThree().then(response=>{
  523. if(response.data.state ==1){
  524. var sign = response.data.data.sign
  525. console.log("sign",sign)
  526. }
  527. })
  528. },
  529. toTestFour(){
  530. toTestFour().then(response=>{
  531. if(response.data.state==1){
  532. var sign = response.data.data.sign
  533. console.log("sign",sign)
  534. }
  535. })
  536. },
  537. toTestFive(){
  538. toTestFive().then(response=>{
  539. if(response.data.state==1){
  540. var sign = response.data.data.sign
  541. console.log("sign",sign)
  542. }
  543. })
  544. },
  545. toTestSeven(){
  546. toTestSeven().then(response=>{
  547. if(response.data.state ==1){
  548. var sign = response.data.data.sign
  549. console.log("sign",sign)
  550. }
  551. })
  552. },
  553. toTestEight(){
  554. toTestEight().then(response=>{
  555. if(response.data.state== 1){
  556. var sign = response.data.data.sign
  557. console.log("sign",sign)
  558. this.$message.success("保存")
  559. }
  560. })
  561. },
  562. toTestNight(){
  563. toTestNight().then(response=>{
  564. if(response.data.state == 1){
  565. var sign = response.data.data.sign
  566. console.log("sign",sign)
  567. this.$message.success("保存")
  568. }
  569. })
  570. }
  571. },
  572. watch: {
  573. should_update_admins(should_change) {
  574. if (should_change) {
  575. this.requestAdminsWithPage(this.current_page);
  576. }
  577. }
  578. }
  579. };
  580. </script>
  581. <style rel="stylesheet/scss" lang="scss" scoped>
  582. .el-button + .el-button {
  583. margin-left: 0 !important;
  584. }
  585. </style>
  586. <style>
  587. .el-table td,
  588. .el-table th.is-leaf,
  589. .el-table--border,
  590. .el-table--group {
  591. border-color: #d0d3da;
  592. }
  593. .el-table--border::after,
  594. .el-table--group::after,
  595. .el-table::before {
  596. background-color: #d0d3da;
  597. }
  598. </style>