index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  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" v-if="addForm.adminUserId != userInfoData.adminUserId">
  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" v-if="userInfoData.type != 0">
  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 && userInfoData.type != 0">
  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. userInfoData: JSON.parse(localStorage.getItem('greemall_user')),
  356. dataList: null, // 列表数据
  357. listLoading: true, // 列表加载loading
  358. screenForm: {
  359. // 筛选表单数据
  360. role: '', // 角色
  361. status: '', // 状态
  362. keyword: '', // 关键词
  363. companyWechatName: '' //商户名
  364. },
  365. select_status: [
  366. // 筛选字段 - 状态
  367. { label: '正常', value: true },
  368. { label: '冻结', value: false }
  369. ],
  370. currentPage: 1, // 当前页码
  371. pageSize: 10, // 每页数量
  372. listTotal: 0, // 列表总数
  373. roleList: [], // 角色列表
  374. departmentList: [], // 部门列表
  375. merchantList: [], // 商户列表
  376. resetId: null,
  377. resetForm: {
  378. newPassword: '', // 新密码
  379. confirmPassword: '' // 确认密码
  380. },
  381. resetFormRules: {
  382. newPassword: [{ required: true, validator: validatePass, trigger: 'blur' }],
  383. confirmPassword: [{ required: true, validator: validatePass2, trigger: 'blur' }]
  384. },
  385. editId: null,
  386. addFormType: 'add',
  387. addForm: {
  388. account: '', // 账号
  389. nickName: '', // 用户名
  390. role: '', // 角色组
  391. adminWebsitId: [],
  392. adminDeptId: [],
  393. newPassword: '', // 新密码
  394. confirmPassword: '', // 确认密码
  395. pubNotice: true,
  396. isVender: true,
  397. venderId: '',
  398. linkPhone: '',
  399. rwaide: []
  400. },
  401. addFormRules: {
  402. account: [{ required: true, message: '请输入账号', trigger: 'blur' }],
  403. nickName: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
  404. linkPhone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
  405. role: [{ required: true, message: '请选择角色组', trigger: 'blur' }],
  406. rwaide: [{ required: true, message: '请选择网点', trigger: 'blur' }],
  407. venderId: [{ required: true, message: '请选择网点', trigger: 'blur' }],
  408. newPassword: [{ validator: validatePass3, trigger: 'blur' }],
  409. confirmPassword: [{ validator: validatePass4, trigger: 'blur' }]
  410. },
  411. passwordType1: 'password',
  412. passwordType2: 'password'
  413. }
  414. },
  415. async created() {
  416. await this.getRoleList()
  417. if (this.$route.query.type) {
  418. let index = this.$findElem(this.roleList, 'name', '企业负责人')
  419. this.screenForm.role = this.roleList[index].adminRoleId
  420. }
  421. this.getList()
  422. },
  423. watch: {
  424. 'addForm.role'() {
  425. if (this.addForm.role) {
  426. let index = this.$findElem(this.roleList, 'adminRoleId', this.addForm.role)
  427. }
  428. }
  429. },
  430. methods: {
  431. getList() {
  432. this.listLoading = true
  433. let params = {
  434. roleId: this.screenForm.role,
  435. status: this.screenForm.status,
  436. userName: this.screenForm.keyword,
  437. companyWechatName: this.screenForm.companyWechatName,
  438. pageNum: this.currentPage,
  439. pageSize: this.pageSize,
  440. ...(() => {
  441. if (this.$route.query.companyWechatId) {
  442. return {
  443. companyWechatId: this.$route.query.companyWechatId
  444. }
  445. }
  446. return {}
  447. })()
  448. }
  449. getAccountList(params).then(res => {
  450. this.dataList = res.data.records
  451. this.listTotal = res.data.total
  452. this.listLoading = false
  453. })
  454. },
  455. // 筛选后重新获取列表
  456. getListByScreen() {
  457. this.currentPage = 1
  458. this.getList()
  459. },
  460. // 获取角色列表
  461. async getRoleList() {
  462. const result = await new Promise((resolve, reject) => {
  463. getRoleList({ pageNum: 1, pageSize: 1000 })
  464. .then(res => {
  465. this.roleList = res.data.records
  466. resolve(res.data)
  467. })
  468. .catch(res => {
  469. resolve([])
  470. })
  471. })
  472. return result
  473. },
  474. // 获取部门列表
  475. async getDepartmentList() {
  476. const result = await new Promise((resolve, reject) => {
  477. adminDeptTreeWebsit()
  478. .then(res => {
  479. var list = res.data
  480. if (JSON.parse(localStorage.getItem('greemall_user'))?.type != 2) {
  481. list = list?.[0]?.children
  482. }
  483. resolve(list)
  484. })
  485. .catch(res => {
  486. resolve([])
  487. })
  488. })
  489. return result
  490. },
  491. // 更改每页数量
  492. handleSizeChange(val) {
  493. this.pageSize = val
  494. this.currentPage = 1
  495. this.getList()
  496. },
  497. // 更改当前页
  498. handleCurrentChange(val) {
  499. this.currentPage = val
  500. this.getList()
  501. },
  502. // 操作 - 更改状态(type: 禁用0,启用1)
  503. changeStatus(id, type) {
  504. type = type ? true : false
  505. changeAccountStatus({ adminUserId: id, status: type }).then(res => {
  506. this.getList()
  507. this.$successMsg()
  508. })
  509. },
  510. // 显示隐藏密码
  511. showPwd(num) {
  512. if (num == 1) {
  513. if (this.passwordType1 === 'password') {
  514. this.passwordType1 = ''
  515. } else {
  516. this.passwordType1 = 'password'
  517. }
  518. this.$nextTick(() => {
  519. this.$refs.password1.focus()
  520. })
  521. }
  522. if (num == 2) {
  523. if (this.passwordType2 === 'password') {
  524. this.passwordType2 = ''
  525. } else {
  526. this.passwordType2 = 'password'
  527. }
  528. this.$nextTick(() => {
  529. this.$refs.password2.focus()
  530. })
  531. }
  532. },
  533. // 重置密码
  534. handleReset(id) {
  535. this.$refs.tabPage.addTab({
  536. activeKey: 'resetpassword',
  537. key: 'resetpassword',
  538. label: '重置密码',
  539. triggerEvent: () => {
  540. this.cancelResetForm()
  541. this.$nextTick(() => {
  542. this.resetId = id
  543. })
  544. },
  545. closeEvent: () => {
  546. this.cancelResetForm()
  547. }
  548. })
  549. },
  550. // 取消重置密码
  551. cancelResetForm() {
  552. this.passwordType1 = 'password'
  553. this.passwordType2 = 'password'
  554. this.$refs?.resetForm?.resetFields()
  555. },
  556. // 提交重置密码
  557. submitResetForm(removeTab) {
  558. this.$refs.resetForm.validate(valid => {
  559. if (valid) {
  560. let params = {
  561. password: this.resetForm.newPassword,
  562. adminUserId: this.resetId
  563. }
  564. resetPassword(params).then(res => {
  565. removeTab('list')
  566. this.getList()
  567. this.$successMsg()
  568. })
  569. }
  570. })
  571. },
  572. // 新增编辑 账户
  573. async addOrEdit(type, id) {
  574. this.$refs.tabPage.addTab({
  575. activeKey: type,
  576. key: type,
  577. label: { add: '新增', edit: '编辑' }[type],
  578. triggerEvent: async () => {
  579. listPageV2({
  580. pageNum: 1,
  581. pageSize: -1,
  582. params: [
  583. { param: 'a.status', compare: '=', value: 'ON' },
  584. { param: 'a.vender_type', compare: 'like', value: '辅材' }
  585. ]
  586. }).then(res => {
  587. this.venderList = res.data.records
  588. })
  589. this.cancelAddForm()
  590. this.addFormType = type
  591. this.departmentList = await this.getDepartmentList()
  592. if (type == 'edit') {
  593. this.editId = id
  594. getUserInfo({ adminUserId: id }).then(res => {
  595. this.addForm = {
  596. account: res.data.userName,
  597. role: res.data.roleId,
  598. nickName: res.data.nickName,
  599. pubNotice: res.data.pubNotice,
  600. isVender: res.data.isVender,
  601. venderId: res.data.venderId,
  602. adminWebsitId: res.data.adminWebsitId,
  603. adminDeptId: res.data.adminDeptId,
  604. linkPhone: res.data.linkPhone,
  605. rwaide: [...(res.data.adminWebsitId || []), ...(res.data.adminDeptId || [])]
  606. }
  607. })
  608. }
  609. },
  610. closeEvent: () => {}
  611. })
  612. },
  613. // 取消 新增编辑账户
  614. cancelAddForm() {
  615. this.passwordType1 = 'password'
  616. this.passwordType2 = 'password'
  617. this.$refs?.addForm?.resetFields()
  618. this.$data.addForm = this.$options.data().addForm
  619. },
  620. // 提交 新增编辑账户
  621. submitAddForm(removeTab) {
  622. this.$refs.addForm.validate(valid => {
  623. if (valid) {
  624. let rwaideObjs = (function (node, ids) {
  625. const result = []
  626. function recurse(currentNode) {
  627. if (ids.has(currentNode.adminDeptId)) {
  628. result.push(currentNode)
  629. }
  630. if (currentNode.children) {
  631. currentNode.children.forEach(child => recurse(child))
  632. }
  633. }
  634. for (var item of node) {
  635. recurse(item)
  636. }
  637. return result
  638. })(this.departmentList, new Set([...this.addForm.rwaide]))
  639. let params = {
  640. userName: this.addForm.account,
  641. nickName: this.addForm.nickName,
  642. roleId: this.addForm.role,
  643. password: this.addForm.newPassword,
  644. pubNotice: this.addForm.pubNotice,
  645. isVender: this.addForm.isVender,
  646. venderId: this.addForm.venderId,
  647. linkPhone: this.addForm.linkPhone,
  648. adminDeptId: rwaideObjs.filter(item => !item.isWebsit).map(item => item.adminDeptId),
  649. adminWebsitId: rwaideObjs.filter(item => item.isWebsit).map(item => item.adminDeptId)
  650. }
  651. if (this.addFormType == 'edit') {
  652. params.adminUserId = this.editId
  653. editAccount(params).then(res => {
  654. removeTab('list')
  655. this.getList()
  656. this.$successMsg('编辑成功')
  657. })
  658. } else {
  659. addAccount(params).then(res => {
  660. removeTab('list')
  661. this.getList()
  662. this.$successMsg('新增成功')
  663. })
  664. }
  665. }
  666. })
  667. },
  668. async dengluLogin(row) {
  669. const loading = this.$loading({
  670. lock: true,
  671. text: 'Loading',
  672. spinner: 'el-icon-loading',
  673. background: 'rgba(0, 0, 0, 0.7)'
  674. })
  675. this.$store
  676. .dispatch('user/login', { username: row.userName })
  677. .then(() => {
  678. setTimeout(() => {
  679. loading.close()
  680. window.location.href = '/'
  681. }, 1000)
  682. })
  683. .catch(() => {})
  684. }
  685. }
  686. }
  687. </script>
  688. <style scoped lang="scss">
  689. .show-pwd {
  690. position: absolute;
  691. right: 15px;
  692. top: 0;
  693. font-size: 16px;
  694. cursor: pointer;
  695. user-select: none;
  696. }
  697. </style>