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

admin.vue 19KB

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