index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  1. <template>
  2. <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
  3. <template slot-scope="{ activeKey, data }">
  4. <div
  5. :style="{
  6. width: '100%',
  7. height: activeKey == 'list' ? '100%' : '0px',
  8. overflow: activeKey == 'list' ? 'auto' : 'hidden'
  9. }"
  10. >
  11. <div class="app-container">
  12. <div class="setting_title">账户管理</div>
  13. <el-divider></el-divider>
  14. <div class="mymain-container">
  15. <div class="btn-group clearfix">
  16. <div class="fl">
  17. <el-button size="small" type="primary" icon="el-icon-plus" @click="addOrEdit('add')"
  18. >新增账户</el-button
  19. >
  20. </div>
  21. <div class="fr">
  22. <el-select
  23. v-model="screenForm.role"
  24. placeholder="全部"
  25. size="small"
  26. style="width: 120px; margin-right: 10px"
  27. @change="getListByScreen"
  28. >
  29. <el-option label="全部角色" value=""></el-option>
  30. <el-option
  31. :label="item.name"
  32. :value="item.adminRoleId"
  33. v-for="(item, index) in roleList"
  34. :key="index"
  35. ></el-option>
  36. </el-select>
  37. <el-select
  38. v-model="screenForm.status"
  39. placeholder="全部"
  40. size="small"
  41. style="width: 120px; margin-right: 10px"
  42. @change="getListByScreen"
  43. >
  44. <el-option label="全部状态" value=""></el-option>
  45. <el-option
  46. :label="item.label"
  47. :value="item.value"
  48. v-for="(item, index) in select_status"
  49. :key="index"
  50. ></el-option>
  51. </el-select>
  52. <el-input
  53. placeholder="商户名称"
  54. v-model="screenForm.companyWechatName"
  55. size="small"
  56. style="width: 180px"
  57. ></el-input>
  58. <el-input placeholder="账号" v-model="screenForm.keyword" size="small" style="width: 180px">
  59. <el-button slot="append" icon="el-icon-search" size="small" @click="getListByScreen"></el-button>
  60. </el-input>
  61. <el-button
  62. size="small"
  63. @click="
  64. screenForm.companyWechatName = ''
  65. screenForm.keyword = ''
  66. screenForm.role = ''
  67. screenForm.status = ''
  68. getListByScreen()
  69. "
  70. >清空</el-button
  71. >
  72. </div>
  73. </div>
  74. <div class="table">
  75. <el-table
  76. v-loading="listLoading"
  77. :data="dataList"
  78. element-loading-text="Loading"
  79. border
  80. fit
  81. highlight-current-row
  82. stripe
  83. >
  84. <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
  85. <el-table-column align="center" label="商户" prop="companyName" min-width="160"></el-table-column>
  86. <el-table-column align="center" label="账号" prop="userName" min-width="120"></el-table-column>
  87. <el-table-column align="center" label="用户名" prop="nickName" min-width="160"></el-table-column>
  88. <el-table-column align="center" label="角色" prop="roleName" min-width="100"></el-table-column>
  89. <el-table-column align="center" label="创建时间" prop="createTime" min-width="160"></el-table-column>
  90. <el-table-column
  91. align="center"
  92. label="最后登录时间"
  93. prop="lastLoginTime"
  94. min-width="160"
  95. ></el-table-column>
  96. <el-table-column align="center" label="状态" class-name="status-col">
  97. <template slot-scope="scope">
  98. <el-tag :type="scope.row.status ? 'success' : 'danger'">{{
  99. scope.row.status ? '正常' : '冻结'
  100. }}</el-tag>
  101. </template>
  102. </el-table-column>
  103. <el-table-column align="center" label="操作" min-width="160">
  104. <template slot-scope="scope">
  105. <el-popconfirm
  106. v-if="scope.row.status"
  107. style="margin-right: 10px"
  108. title="确定冻结吗?"
  109. @confirm="changeStatus(scope.row.adminUserId, 0)"
  110. >
  111. <el-button slot="reference" type="text">冻结</el-button>
  112. </el-popconfirm>
  113. <el-popconfirm
  114. v-else
  115. style="margin-right: 10px"
  116. title="确定恢复吗?"
  117. @confirm="changeStatus(scope.row.adminUserId, 1)"
  118. >
  119. <el-button slot="reference" type="text">恢复</el-button>
  120. </el-popconfirm>
  121. <el-button type="text" @click="addOrEdit('edit', scope.row.adminUserId)">编辑</el-button>
  122. <el-button type="text" @click="handleReset(scope.row.adminUserId)">重置密码</el-button>
  123. <el-button v-if="userName == 'admin'" type="text" @click="dengluLogin(scope.row)">登入</el-button>
  124. </template>
  125. </el-table-column>
  126. </el-table>
  127. </div>
  128. <div class="pagination clearfix">
  129. <div class="fr">
  130. <el-pagination
  131. @size-change="handleSizeChange"
  132. @current-change="handleCurrentChange"
  133. :current-page="currentPage"
  134. :page-sizes="[10, 20, 30, 50]"
  135. :page-size="10"
  136. layout="total, sizes, prev, pager, next, jumper"
  137. :total="listTotal"
  138. >
  139. </el-pagination>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. <div v-if="~['add', 'edit'].indexOf(activeKey)" style="box-sizing: border-box; padding: 16px">
  146. <el-form ref="addForm" :model="addForm" :rules="addFormRules" label-position="left" label-width="100px">
  147. <el-row :gutter="20">
  148. <el-col :md="6">
  149. <el-form-item label="账号" prop="account">
  150. <el-input v-model="addForm.account" autocomplete="off" placeholder="请输入账号"></el-input>
  151. </el-form-item>
  152. </el-col>
  153. <el-col :md="6">
  154. <el-form-item label="用户名" prop="nickName">
  155. <el-input v-model="addForm.nickName" autocomplete="off" placeholder="请输入用户名"></el-input>
  156. </el-form-item>
  157. </el-col>
  158. <el-col :md="6">
  159. <el-form-item label="手机号" prop="linkPhone">
  160. <el-input v-model="addForm.linkPhone" autocomplete="off" placeholder="请输入手机号"></el-input>
  161. </el-form-item>
  162. </el-col>
  163. <el-col :md="6">
  164. <el-form-item label="角色组" prop="role">
  165. <el-select v-model="addForm.role" placeholder="请选择角色组" style="width: 100%">
  166. <el-option
  167. :label="item.name"
  168. :value="item.adminRoleId"
  169. v-for="(item, index) in roleList"
  170. :key="index"
  171. ></el-option>
  172. </el-select>
  173. </el-form-item>
  174. </el-col>
  175. <el-col :md="6">
  176. <el-form-item label="密码" prop="newPassword">
  177. <el-input
  178. v-model="addForm.newPassword"
  179. ref="password1"
  180. autocomplete="off"
  181. placeholder="请输入密码"
  182. :type="passwordType1"
  183. ></el-input>
  184. <span class="show-pwd" @click="showPwd(1)">
  185. <svg-icon :icon-class="passwordType1 === 'password' ? 'eye' : 'eye-open'" />
  186. </span>
  187. </el-form-item>
  188. </el-col>
  189. <el-col :md="6">
  190. <el-form-item label="确认密码" prop="confirmPassword">
  191. <el-input
  192. v-model="addForm.confirmPassword"
  193. ref="password2"
  194. autocomplete="off"
  195. placeholder="请再次输入密码"
  196. :type="passwordType2"
  197. ></el-input>
  198. <span class="show-pwd" @click="showPwd(2)">
  199. <svg-icon :icon-class="passwordType2 === 'password' ? 'eye' : 'eye-open'" />
  200. </span>
  201. </el-form-item>
  202. </el-col>
  203. <el-col :md="6">
  204. <el-form-item label="是否供应商" prop="isVender" label-width="120px">
  205. <el-switch v-model="addForm.isVender" active-color="#13ce66" inactive-color="#ff4949"> </el-switch>
  206. </el-form-item>
  207. </el-col>
  208. <el-col :md="6" v-if="addForm.isVender">
  209. <el-form-item label="供应商" prop="venderId">
  210. <el-select v-model="addForm.venderId" placeholder="请选择供应商" style="width: 100%" filterable>
  211. <el-option
  212. v-for="(item, index) in venderList"
  213. :key="index"
  214. :label="item.venderName"
  215. :value="item.venderId"
  216. :disabled="item.status !== 'ON'"
  217. />
  218. </el-select>
  219. </el-form-item>
  220. </el-col>
  221. <el-col :md="6">
  222. <el-form-item label="是否公众号通知" prop="pubNotice" label-width="120px">
  223. <el-switch v-model="addForm.pubNotice" active-color="#13ce66" inactive-color="#ff4949"> </el-switch>
  224. </el-form-item>
  225. </el-col>
  226. <el-col :md="6">
  227. <el-form-item label="部门/网点" prop="rwaide">
  228. <el-cascader
  229. style="width: 100%"
  230. :options="departmentList"
  231. :props="{
  232. checkStrictly: true,
  233. emitPath: false,
  234. multiple: true,
  235. filterable: true,
  236. value: 'adminDeptId',
  237. label: 'deptName'
  238. }"
  239. filterable
  240. v-model="addForm.rwaide"
  241. clearable
  242. >
  243. <template slot-scope="{ node, data }">
  244. <span
  245. >{{ data.pid == '0' ? '' : data.pid == '1' ? '商户-' : data.isWebsit ? '网点-' : '部门-'
  246. }}{{ data.deptName }}</span
  247. >
  248. </template>
  249. </el-cascader>
  250. </el-form-item>
  251. </el-col>
  252. </el-row>
  253. </el-form>
  254. <div slot="footer" class="dialog-footer">
  255. <el-button @click="data.removeTab()">取 消</el-button>
  256. <el-button type="primary" @click="submitAddForm(data.removeTab)">确 定</el-button>
  257. </div>
  258. </div>
  259. <div v-if="~['resetpassword'].indexOf(activeKey)" style="box-sizing: border-box; padding: 16px">
  260. <el-form ref="resetForm" :model="resetForm" :rules="resetFormRules" label-position="left" label-width="100px">
  261. <el-form-item label="输入新密码" prop="newPassword">
  262. <el-input
  263. v-model="resetForm.newPassword"
  264. ref="password1"
  265. autocomplete="off"
  266. placeholder="请输入新密码"
  267. :type="passwordType1"
  268. ></el-input>
  269. <span class="show-pwd" @click="showPwd(1)">
  270. <svg-icon :icon-class="passwordType1 === 'password' ? 'eye' : 'eye-open'" />
  271. </span>
  272. </el-form-item>
  273. <el-form-item label="确认密码" prop="confirmPassword">
  274. <el-input
  275. v-model="resetForm.confirmPassword"
  276. ref="password2"
  277. autocomplete="off"
  278. placeholder="请再次输入新密码"
  279. :type="passwordType2"
  280. ></el-input>
  281. <span class="show-pwd" @click="showPwd(2)">
  282. <svg-icon :icon-class="passwordType2 === 'password' ? 'eye' : 'eye-open'" />
  283. </span>
  284. </el-form-item>
  285. </el-form>
  286. <div slot="footer" class="dialog-footer">
  287. <el-button @click="data.removeTab()">取 消</el-button>
  288. <el-button type="primary" @click="submitResetForm(data.removeTab)">确 定</el-button>
  289. </div>
  290. </div>
  291. </template>
  292. </zj-tab-page>
  293. </template>
  294. <script>
  295. import {
  296. getAccountList,
  297. getRoleList,
  298. changeAccountStatus,
  299. resetPassword,
  300. addAccount,
  301. editAccount,
  302. getUserInfo,
  303. getDepartmentList,
  304. getMerchantList
  305. } from '@/api/setting'
  306. import { adminDeptTreeWebsit } from '@/api/departmentManagement.js'
  307. import { listPageV2 } from '@/api/auxiliaryFittings/supplier'
  308. export default {
  309. data() {
  310. var validatePass = (rule, value, callback) => {
  311. if (value === '') {
  312. callback(new Error('请输入新密码'))
  313. } else if (value && value.length < 6) {
  314. callback(new Error('密码长度至少6位'))
  315. } else {
  316. if (this.resetForm.confirmPassword !== '') {
  317. this.$refs.resetForm.validateField('confirmPassword')
  318. }
  319. callback()
  320. }
  321. }
  322. var validatePass2 = (rule, value, callback) => {
  323. if (value === '') {
  324. callback(new Error('请再次输入密码'))
  325. } else if (value !== this.resetForm.newPassword) {
  326. callback(new Error('两次输入密码不一致'))
  327. } else {
  328. callback()
  329. }
  330. }
  331. var validatePass3 = (rule, value, callback) => {
  332. if (!value) {
  333. callback(new Error('请输入新密码'))
  334. } else if (value && value.length < 6) {
  335. callback(new Error('密码长度至少6位'))
  336. } else {
  337. if (this.addForm.confirmPassword !== '') {
  338. this.$refs.addForm.validateField('confirmPassword')
  339. }
  340. callback()
  341. }
  342. }
  343. var validatePass4 = (rule, value, callback) => {
  344. if (!value) {
  345. callback(new Error('请再次输入密码'))
  346. } else if (value !== this.addForm.newPassword) {
  347. callback(new Error('两次输入密码不一致'))
  348. } else {
  349. callback()
  350. }
  351. }
  352. return {
  353. venderList: [],
  354. userName: JSON.parse(localStorage.getItem('greemall_user')).userName,
  355. dataList: null, // 列表数据
  356. listLoading: true, // 列表加载loading
  357. screenForm: {
  358. // 筛选表单数据
  359. role: '', // 角色
  360. status: '', // 状态
  361. keyword: '', // 关键词
  362. companyWechatName: '' //商户名
  363. },
  364. select_status: [
  365. // 筛选字段 - 状态
  366. { label: '正常', value: true },
  367. { label: '冻结', value: false }
  368. ],
  369. currentPage: 1, // 当前页码
  370. pageSize: 10, // 每页数量
  371. listTotal: 0, // 列表总数
  372. roleList: [], // 角色列表
  373. departmentList: [], // 部门列表
  374. merchantList: [], // 商户列表
  375. resetId: null,
  376. resetForm: {
  377. newPassword: '', // 新密码
  378. confirmPassword: '' // 确认密码
  379. },
  380. resetFormRules: {
  381. newPassword: [{ required: true, validator: validatePass, trigger: 'blur' }],
  382. confirmPassword: [{ required: true, validator: validatePass2, trigger: 'blur' }]
  383. },
  384. editId: null,
  385. addFormType: 'add',
  386. addForm: {
  387. account: '', // 账号
  388. nickName: '', // 用户名
  389. role: '', // 角色组
  390. adminWebsitId: [],
  391. adminDeptId: [],
  392. newPassword: '', // 新密码
  393. confirmPassword: '', // 确认密码
  394. pubNotice: true,
  395. isVender: true,
  396. venderId: '',
  397. linkPhone: '',
  398. rwaide: []
  399. },
  400. addFormRules: {
  401. account: [{ required: true, message: '请输入账号', trigger: 'blur' }],
  402. nickName: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
  403. linkPhone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
  404. role: [{ required: true, message: '请选择角色组', trigger: 'blur' }],
  405. rwaide: [{ required: true, message: '请选择网点', trigger: 'blur' }],
  406. venderId: [{ required: true, message: '请选择网点', trigger: 'blur' }],
  407. newPassword: [{ validator: validatePass3, trigger: 'blur' }],
  408. confirmPassword: [{ validator: validatePass4, trigger: 'blur' }]
  409. },
  410. passwordType1: 'password',
  411. passwordType2: 'password'
  412. }
  413. },
  414. async created() {
  415. await this.getRoleList()
  416. if (this.$route.query.type) {
  417. let index = this.$findElem(this.roleList, 'name', '企业负责人')
  418. this.screenForm.role = this.roleList[index].adminRoleId
  419. }
  420. this.getList()
  421. },
  422. watch: {
  423. 'addForm.role'() {
  424. if (this.addForm.role) {
  425. let index = this.$findElem(this.roleList, 'adminRoleId', this.addForm.role)
  426. }
  427. }
  428. },
  429. methods: {
  430. getList() {
  431. this.listLoading = true
  432. let params = {
  433. roleId: this.screenForm.role,
  434. status: this.screenForm.status,
  435. userName: this.screenForm.keyword,
  436. companyWechatName: this.screenForm.companyWechatName,
  437. pageNum: this.currentPage,
  438. pageSize: this.pageSize,
  439. ...(() => {
  440. if (this.$route.query.companyWechatId) {
  441. return {
  442. companyWechatId: this.$route.query.companyWechatId
  443. }
  444. }
  445. return {}
  446. })()
  447. }
  448. getAccountList(params).then(res => {
  449. this.dataList = res.data.records
  450. this.listTotal = res.data.total
  451. this.listLoading = false
  452. })
  453. },
  454. // 筛选后重新获取列表
  455. getListByScreen() {
  456. this.currentPage = 1
  457. this.getList()
  458. },
  459. // 获取角色列表
  460. async getRoleList() {
  461. const result = await new Promise((resolve, reject) => {
  462. getRoleList({ pageNum: 1, pageSize: 1000 })
  463. .then(res => {
  464. this.roleList = res.data.records
  465. resolve(res.data)
  466. })
  467. .catch(res => {
  468. resolve([])
  469. })
  470. })
  471. return result
  472. },
  473. // 获取部门列表
  474. async getDepartmentList() {
  475. const result = await new Promise((resolve, reject) => {
  476. adminDeptTreeWebsit()
  477. .then(res => {
  478. var list = res.data
  479. if (JSON.parse(localStorage.getItem('greemall_user'))?.type != 2) {
  480. list = list?.[0]?.children
  481. }
  482. resolve(list)
  483. })
  484. .catch(res => {
  485. resolve([])
  486. })
  487. })
  488. return result
  489. },
  490. // 更改每页数量
  491. handleSizeChange(val) {
  492. this.pageSize = val
  493. this.currentPage = 1
  494. this.getList()
  495. },
  496. // 更改当前页
  497. handleCurrentChange(val) {
  498. this.currentPage = val
  499. this.getList()
  500. },
  501. // 操作 - 更改状态(type: 禁用0,启用1)
  502. changeStatus(id, type) {
  503. type = type ? true : false
  504. changeAccountStatus({ adminUserId: id, status: type }).then(res => {
  505. this.getList()
  506. this.$successMsg()
  507. })
  508. },
  509. // 显示隐藏密码
  510. showPwd(num) {
  511. if (num == 1) {
  512. if (this.passwordType1 === 'password') {
  513. this.passwordType1 = ''
  514. } else {
  515. this.passwordType1 = 'password'
  516. }
  517. this.$nextTick(() => {
  518. this.$refs.password1.focus()
  519. })
  520. }
  521. if (num == 2) {
  522. if (this.passwordType2 === 'password') {
  523. this.passwordType2 = ''
  524. } else {
  525. this.passwordType2 = 'password'
  526. }
  527. this.$nextTick(() => {
  528. this.$refs.password2.focus()
  529. })
  530. }
  531. },
  532. // 重置密码
  533. handleReset(id) {
  534. this.$refs.tabPage.addTab({
  535. activeKey: 'resetpassword',
  536. key: 'resetpassword',
  537. label: '重置密码',
  538. triggerEvent: () => {
  539. this.cancelResetForm()
  540. this.$nextTick(() => {
  541. this.resetId = id
  542. })
  543. },
  544. closeEvent: () => {
  545. this.cancelResetForm()
  546. }
  547. })
  548. },
  549. // 取消重置密码
  550. cancelResetForm() {
  551. this.passwordType1 = 'password'
  552. this.passwordType2 = 'password'
  553. this.$refs?.resetForm?.resetFields()
  554. },
  555. // 提交重置密码
  556. submitResetForm(removeTab) {
  557. this.$refs.resetForm.validate(valid => {
  558. if (valid) {
  559. let params = {
  560. password: this.resetForm.newPassword,
  561. adminUserId: this.resetId
  562. }
  563. resetPassword(params).then(res => {
  564. removeTab('list')
  565. this.getList()
  566. this.$successMsg()
  567. })
  568. }
  569. })
  570. },
  571. // 新增编辑 账户
  572. async addOrEdit(type, id) {
  573. this.$refs.tabPage.addTab({
  574. activeKey: type,
  575. key: type,
  576. label: { add: '新增', edit: '编辑' }[type],
  577. triggerEvent: async () => {
  578. listPageV2({
  579. pageNum: 1,
  580. pageSize: -1,
  581. params: [
  582. { param: 'a.status', compare: '=', value: 'ON' },
  583. { param: 'a.vender_type', compare: 'like', value: '辅材' }
  584. ]
  585. }).then(res => {
  586. this.venderList = res.data.records
  587. })
  588. this.cancelAddForm()
  589. this.addFormType = type
  590. this.departmentList = await this.getDepartmentList()
  591. if (type == 'edit') {
  592. this.editId = id
  593. getUserInfo({ adminUserId: id }).then(res => {
  594. this.addForm = {
  595. account: res.data.userName,
  596. role: res.data.roleId,
  597. nickName: res.data.nickName,
  598. pubNotice: res.data.pubNotice,
  599. isVender: res.data.isVender,
  600. venderId: res.data.venderId,
  601. adminWebsitId: res.data.adminWebsitId,
  602. adminDeptId: res.data.adminDeptId,
  603. linkPhone: res.data.linkPhone,
  604. rwaide: [...(res.data.adminWebsitId || []), ...(res.data.adminDeptId || [])]
  605. }
  606. })
  607. }
  608. },
  609. closeEvent: () => {}
  610. })
  611. },
  612. // 取消 新增编辑账户
  613. cancelAddForm() {
  614. this.passwordType1 = 'password'
  615. this.passwordType2 = 'password'
  616. this.$refs?.addForm?.resetFields()
  617. this.$data.addForm = this.$options.data().addForm
  618. },
  619. // 提交 新增编辑账户
  620. submitAddForm(removeTab) {
  621. this.$refs.addForm.validate(valid => {
  622. if (valid) {
  623. let rwaideObjs = (function (node, ids) {
  624. const result = []
  625. function recurse(currentNode) {
  626. if (ids.has(currentNode.adminDeptId)) {
  627. result.push(currentNode)
  628. }
  629. if (currentNode.children) {
  630. currentNode.children.forEach(child => recurse(child))
  631. }
  632. }
  633. for (var item of node) {
  634. recurse(item)
  635. }
  636. return result
  637. })(this.departmentList, new Set([...this.addForm.rwaide]))
  638. let params = {
  639. userName: this.addForm.account,
  640. nickName: this.addForm.nickName,
  641. roleId: this.addForm.role,
  642. password: this.addForm.newPassword,
  643. pubNotice: this.addForm.pubNotice,
  644. isVender: this.addForm.isVender,
  645. venderId: this.addForm.venderId,
  646. linkPhone: this.addForm.linkPhone,
  647. adminDeptId: rwaideObjs.filter(item => !item.isWebsit).map(item => item.adminDeptId),
  648. adminWebsitId: rwaideObjs.filter(item => item.isWebsit).map(item => item.adminDeptId)
  649. }
  650. if (this.addFormType == 'edit') {
  651. params.adminUserId = this.editId
  652. editAccount(params).then(res => {
  653. removeTab('list')
  654. this.getList()
  655. this.$successMsg('编辑成功')
  656. })
  657. } else {
  658. addAccount(params).then(res => {
  659. removeTab('list')
  660. this.getList()
  661. this.$successMsg('新增成功')
  662. })
  663. }
  664. }
  665. })
  666. },
  667. async dengluLogin(row) {
  668. const loading = this.$loading({
  669. lock: true,
  670. text: 'Loading',
  671. spinner: 'el-icon-loading',
  672. background: 'rgba(0, 0, 0, 0.7)'
  673. })
  674. this.$store
  675. .dispatch('user/login', { username: row.userName })
  676. .then(() => {
  677. setTimeout(() => {
  678. loading.close()
  679. window.location.href = '/'
  680. }, 1000)
  681. })
  682. .catch(() => {})
  683. }
  684. }
  685. }
  686. </script>
  687. <style scoped lang="scss">
  688. .show-pwd {
  689. position: absolute;
  690. right: 15px;
  691. top: 0;
  692. font-size: 16px;
  693. cursor: pointer;
  694. user-select: none;
  695. }
  696. </style>