index.ftl 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>用户</title>
  5. <#include "../../include/head-file.ftl">
  6. </head>
  7. <body>
  8. <div id="index" v-cloak class="ms-index">
  9. <el-header class="ms-header" height="50px">
  10. <el-col :span=12>
  11. <@shiro.hasPermission name="people:user:save">
  12. <el-button type="primary" class="el-icon-plus" size="default" @click="save()">新增</el-button>
  13. </@shiro.hasPermission>
  14. <@shiro.hasPermission name="people:user:del">
  15. <el-button type="danger" class="el-icon-delete" size="default" @click="del(selectionList)"
  16. :disabled="!selectionList.length">删除
  17. </el-button>
  18. </@shiro.hasPermission>
  19. </el-col>
  20. </el-header>
  21. <div class="ms-search" style="padding: 20px 10px 20px 10px;">
  22. <el-row>
  23. <el-form :model="form" ref="searchForm" :rules="rules" label-width="80px" size="default">
  24. <el-row>
  25. <el-col :span=8>
  26. <el-form-item label="账号" prop="peopleName">
  27. <el-input v-model="form.peopleName"
  28. :disabled="false"
  29. :style="{width: '100%'}"
  30. :clearable="true"
  31. placeholder="请输入账号">
  32. </el-input>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span=8>
  36. <el-form-item label="昵称" prop="puNickname">
  37. <el-input v-model="form.puNickname"
  38. :disabled="false"
  39. :style="{width: '100%'}"
  40. :clearable="true"
  41. placeholder="请输入昵称">
  42. </el-input>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span=8>
  46. <el-form-item label="真实姓名" prop="puRealName">
  47. <el-input v-model="form.puRealName"
  48. :disabled="false"
  49. :style="{width: '100%'}"
  50. :clearable="true"
  51. placeholder="请输入真实姓名">
  52. </el-input>
  53. </el-form-item>
  54. </el-col>
  55. </el-row>
  56. <el-row>
  57. <el-col :span=8>
  58. <el-form-item label="手机号码" prop="peoplePhone">
  59. <el-input v-model="form.peoplePhone"
  60. :disabled="false"
  61. :style="{width: '100%'}"
  62. :clearable="true"
  63. placeholder="请输入手机号码">
  64. </el-input>
  65. </el-form-item>
  66. </el-col>
  67. <el-col :span=8>
  68. <el-form-item label="邮箱" prop="peopleMail">
  69. <el-input v-model="form.peopleMail"
  70. :disabled="false"
  71. :style="{width: '100%'}"
  72. :clearable="true"
  73. placeholder="请输入邮箱">
  74. </el-input>
  75. </el-form-item>
  76. </el-col>
  77. <el-col :span=8>
  78. <el-form-item label="注册时间" prop="peopleDateTimes">
  79. <el-date-picker
  80. v-model="peopleDateTimes"
  81. value-format="YYYY-MM-DD HH:mm:ss"
  82. format="YYYY-MM-DD"
  83. type="daterange"
  84. :style="{width: '100%'}"
  85. start-placeholder="开始日期"
  86. end-placeholder="结束日期">
  87. </el-date-picker>
  88. </el-form-item>
  89. </el-col>
  90. </el-row>
  91. <el-row>
  92. <el-col :span=8>
  93. <!--公司名称-->
  94. <el-form-item label="公司名称" prop="companyName">
  95. <el-input
  96. v-model="form.companyName"
  97. :disabled="false"
  98. :readonly="false"
  99. :style="{width: '100%'}"
  100. :clearable="true"
  101. placeholder="请输入公司名称">
  102. </el-input>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span=8>
  106. <!--职位-->
  107. <el-form-item label="职位" prop="position">
  108. <el-input
  109. v-model="form.position"
  110. :disabled="false"
  111. :readonly="false"
  112. :style="{width: '100%'}"
  113. :clearable="true"
  114. placeholder="请输入职位">
  115. </el-input>
  116. </el-form-item>
  117. </el-col>
  118. <el-col :span=8>
  119. <!--了解渠道-->
  120. <el-form-item label="了解渠道" prop="channel">
  121. <ms-dict v-model="form.channel"
  122. :style="{width: '100%'}"
  123. dict-type="注册-了解渠道"
  124. :filterable="false"
  125. :disabled="false"
  126. :multiple="false" :clearable="true"
  127. placeholder="请选择了解渠道">
  128. </ms-dict>
  129. </el-form-item>
  130. </el-col>
  131. </el-row>
  132. <el-row>
  133. <el-col :span=8>
  134. <!--参观目的-->
  135. <el-form-item label="参观目的" prop="purpose">
  136. <ms-dict v-model="form.purpose"
  137. :style="{width: '100%'}"
  138. dict-type="注册-参观目的"
  139. :filterable="false"
  140. :disabled="false"
  141. :multiple="false" :clearable="true"
  142. placeholder="请选择参观目的">
  143. </ms-dict>
  144. </el-form-item>
  145. </el-col>
  146. <el-col :span=8>
  147. <el-form-item label="用户ID" prop="peopleId">
  148. <el-input v-model="form.peopleId"
  149. :disabled="false"
  150. :style="{width: '100%'}"
  151. :clearable="true"
  152. placeholder="请输入用户ID">
  153. </el-input>
  154. </el-form-item>
  155. </el-col>
  156. <el-col :span=8 style="text-align:right;">
  157. <el-button type="primary" class="el-icon-search" size="default" @click="loading=true;currentPage=1;list()">查询
  158. </el-button>
  159. <el-button @click="rest" class="el-icon-refresh" size="default">重置</el-button>
  160. </el-col>
  161. </el-row>
  162. </el-form>
  163. </el-row>
  164. </div>
  165. <el-main class="ms-container">
  166. <el-table v-loading="loading" ref="multipleTable" height="calc(100vh-68px)" class="ms-table-pagination" border :data="treeList"
  167. tooltip-effect="dark" @selection-change="handleSelectionChange">
  168. <template #empty>
  169. {{emptyText}}
  170. </template>
  171. <el-table-column type="selection" width="40"></el-table-column>
  172. <el-table-column label="ID" align="center" prop="id">
  173. </el-table-column>
  174. <el-table-column width="80" label="头像" align="center">
  175. <template #default="scope">
  176. <el-image v-if="scope.row.puIcon !=null" :src="scope.row.puIcon" style="width: 50px;height: 50px;line-height: 50px;font-size: 50px">
  177. <template #error>
  178. <div class="image-slot">
  179. <i class="el-icon-picture-outline"></i>
  180. </div>
  181. </template>
  182. </el-image>
  183. </template>
  184. </el-table-column>
  185. <el-table-column label="账号" align="left" prop="peopleName">
  186. </el-table-column>
  187. <el-table-column label="真实姓名" align="left" prop="puRealName">
  188. </el-table-column>
  189. <el-table-column label="昵称" align="left" prop="puNickname">
  190. </el-table-column>
  191. <el-table-column label="手机号码" width="130" align="center" prop="peoplePhone">
  192. </el-table-column>
  193. <el-table-column label="邮箱" width="200" align="center" prop="peopleMail">
  194. </el-table-column>
  195. <el-table-column label="注册时间" width="180" align="center" prop="peopleDateTime">
  196. </el-table-column>
  197. <el-table-column label="用户状态" width="100" align="center" prop="peopleState">
  198. <template #default="scope">
  199. {{scope.row.peopleState==0?'未审':'已审'}}
  200. </template>
  201. </el-table-column>
  202. <el-table-column label="邀请数" align="left" prop="invNum">
  203. </el-table-column>
  204. <el-table-column label="用户等级" align="left" prop="puLevelName">
  205. </el-table-column>
  206. <el-table-column label="公司名称" align="left" prop="companyName">
  207. </el-table-column>
  208. <el-table-column label="职位" align="left" prop="position">
  209. </el-table-column>
  210. <el-table-column label="了解渠道" align="left" prop="channel" :formatter="channelFormat">
  211. </el-table-column>
  212. <el-table-column label="参观目的" align="left" prop="purpose" :formatter="purposeFormat">
  213. </el-table-column>
  214. <@shiro.hasPermission name="people:user:update">
  215. <el-table-column label="操作" width="180px" align="center">
  216. <template #default="scope">
  217. <@shiro.hasPermission name="people:user:update">
  218. <el-link :underline="false" type="primary" @click="save(scope.row.id)">编辑</el-link>
  219. </@shiro.hasPermission>
  220. <@shiro.hasPermission name="people:user:del">
  221. <el-link :underline="false" type="primary" @click="del([scope.row])">删除</el-link>
  222. </@shiro.hasPermission>
  223. </template>
  224. </el-table-column>
  225. </@shiro.hasPermission>
  226. </el-table>
  227. <el-pagination
  228. background
  229. :page-sizes="[10, 50, 100]"
  230. layout="total, sizes, prev, pager, next, jumper"
  231. :current-page="currentPage"
  232. :page-size="pageSize"
  233. :total="total"
  234. class="ms-pagination"
  235. @current-change='currentChange'
  236. @size-change="sizeChange">
  237. </el-pagination>
  238. </el-main>
  239. </div>
  240. </body>
  241. </html>
  242. <script>
  243. var indexVue = new _Vue({
  244. el: '#index',
  245. data: function (){
  246. return {
  247. treeList: [],
  248. //用户列表
  249. selectionList: [],
  250. //用户列表选中
  251. loading: true,
  252. emptyText: '',
  253. total: 0,
  254. //总记录数量
  255. pageSize: 50,
  256. //页面数量
  257. currentPage: 1,
  258. //初始页
  259. mananger: ms.manager,
  260. //搜索表单
  261. form: {
  262. // id
  263. id: '',
  264. // 用户名
  265. peopleName: '',
  266. // 密码
  267. peoplePassword: '',
  268. // 昵称
  269. puNickname: '',
  270. // 性别
  271. puSex: '',
  272. // 真实姓名
  273. puRealName: '',
  274. // 身份证
  275. puCard: '',
  276. // 手机号码
  277. peoplePhone: '',
  278. // 邮箱
  279. peopleMail: '',
  280. // 头像
  281. // 地址
  282. puAddress: ''
  283. },
  284. // 了解渠道
  285. channelOptions:[],
  286. // 参观目的
  287. purposeOptions:[],
  288. peopleDateTimes: null,
  289. puSexOptions: [{
  290. "value": 1,
  291. "label": "男"
  292. }, {
  293. "value": 2,
  294. "label": "女"
  295. }],
  296. peopleStateOptions: [{
  297. "value": 0,
  298. "label": "未审"
  299. }, {
  300. "value": 1,
  301. "label": "已审"
  302. }],
  303. rules: {peopleId: [{max: 20, message: '长度不能超过20位', trigger: 'blur'}]},
  304. historyKey: "people_people_user_history"
  305. }
  306. },
  307. methods: {
  308. //查询列表
  309. list: function () {
  310. var that = this;
  311. var page = {
  312. pageNo: that.currentPage,
  313. pageSize: that.pageSize
  314. };
  315. var form = JSON.parse(JSON.stringify(that.form));
  316. if (that.peopleDateTimes) {
  317. form.peopleDateTimes = that.peopleDateTimes[0] + '至' + that.peopleDateTimes[1];
  318. } else {
  319. form.peopleDateTimes = null;
  320. }
  321. for (var key in form) {
  322. if (!form[key]) {
  323. delete form[key];
  324. }
  325. }
  326. sessionStorage.setItem(this.historyKey,JSON.stringify({form: form, page: page}));
  327. that.$refs.searchForm.validate(function (valid) {
  328. if (valid){
  329. setTimeout(function () {
  330. ms.http.get(ms.manager + "/people/peopleUser/auditList.do", Object.assign({}, form, page))
  331. .then(function (data) {
  332. if(data.result){
  333. if (data.data.total <= 0) {
  334. that.loading = false;
  335. that.emptyText = '暂无数据';
  336. that.treeList = [];
  337. } else {
  338. that.emptyText = '';
  339. that.loading = false;
  340. that.total = data.data.total;
  341. that.treeList = data.data.rows;
  342. that.treeList.forEach(function (item) {
  343. // 如果puIcon为空,则设置为null并返回
  344. if (!item.puIcon) {
  345. item.puIcon = null;
  346. return;
  347. }
  348. if(!item.puIcon.startsWith("http://") && !item.puIcon.startsWith("https://")) {
  349. item.puIcon = ms.contextpath + item.puIcon;
  350. }
  351. });
  352. }
  353. }
  354. }).catch(function (err) {
  355. that.$notify({
  356. type: 'warning',
  357. msg: err.msg,
  358. title: '失败'
  359. })
  360. that.loading = false;
  361. // console.log(err);
  362. });
  363. }, 500);
  364. }else {
  365. that.loading = false;
  366. }
  367. })
  368. },
  369. //用户列表选中
  370. handleSelectionChange: function (val) {
  371. this.selectionList = val;
  372. },
  373. //删除
  374. del: function (row) {
  375. var that = this;
  376. that.$confirm('此操作将永久删除所选内容, 是否继续?', '提示', {
  377. confirmButtonText: '确定',
  378. cancelButtonText: '取消',
  379. type: 'warning'
  380. }).then(function () {
  381. ms.http.post(ms.manager + "/people/peopleUser/delete.do", row.length ? row : [row], {
  382. headers: {
  383. 'Content-Type': 'application/json'
  384. }
  385. }).then(function (data) {
  386. if (data.result) {
  387. that.$notify({
  388. title:'成功',
  389. type: 'success',
  390. message: '删除成功!'
  391. }); //删除成功,刷新列表
  392. that.list();
  393. } else {
  394. that.$notify({
  395. title: '失败',
  396. message: data.msg,
  397. type: 'warning'
  398. });
  399. }
  400. });
  401. });
  402. },
  403. //更新用户审核状态
  404. updateUserState: function (row) {
  405. var that = this;
  406. that.$confirm('此操作将审核用户, 是否继续?', '提示', {
  407. confirmButtonText: '确定',
  408. cancelButtonText: '取消',
  409. type: 'warning'
  410. }).then(function () {
  411. ms.http.post(ms.manager + "/people/updateState.do", row.length ? row : [row], {
  412. headers: {
  413. 'Content-Type': 'application/json'
  414. }
  415. }).then(function (data) {
  416. if (data.result) {
  417. that.$notify({
  418. title:'成功',
  419. type: 'success',
  420. message: '审核成功!'
  421. }); //审核成功,刷新列表
  422. that.list();
  423. }
  424. });
  425. });
  426. },
  427. //新增
  428. save: function (id) {
  429. if (id) {
  430. ms.util.openSystemUrl("/people/peopleUser/form.do?peopleId=" + id);
  431. } else {
  432. ms.util.openSystemUrl("/people/peopleUser/form.do");
  433. }
  434. },
  435. //pageSize改变时会触发
  436. sizeChange: function (pagesize) {
  437. this.loading = true;
  438. this.pageSize = pagesize;
  439. this.list();
  440. },
  441. //currentPage改变时会触发
  442. currentChange: function (currentPage) {
  443. this.loading = true;
  444. this.currentPage = currentPage;
  445. this.list();
  446. },
  447. //重置表单
  448. rest: function () {
  449. this.currentPage = 1;
  450. this.loading = true;
  451. this.$refs.searchForm.resetFields();
  452. this.peopleDateTimes = null;
  453. this.list();
  454. },
  455. //了解渠道 列表格式化
  456. channelFormat:function(row, column, cellValue, index){
  457. var value="";
  458. if(cellValue){
  459. var data = this.channelOptions.find(function(value){
  460. return value.dictValue==cellValue;
  461. })
  462. if(data&&data.dictLabel){
  463. value = data.dictLabel;
  464. }
  465. }
  466. return value;
  467. },
  468. //获取channel数据源
  469. channelOptionsGet:function() {
  470. var that = this;
  471. ms.http.get(ms.base+'/mdiy/dict/list.do', {dictType:'注册-了解渠道',pageSize:99999}).then(function (res) {
  472. that.channelOptions = res.data.rows;
  473. }).catch(function (err) {
  474. console.log(err);
  475. });
  476. },
  477. //参观目的 列表格式化
  478. purposeFormat:function(row, column, cellValue, index){
  479. var value="";
  480. if(cellValue){
  481. var data = this.purposeOptions.find(function(value){
  482. return value.dictValue==cellValue;
  483. })
  484. if(data&&data.dictLabel){
  485. value = data.dictLabel;
  486. }
  487. }
  488. return value;
  489. },
  490. //获取purpose数据源
  491. purposeOptionsGet:function() {
  492. var that = this;
  493. ms.http.get(ms.base+'/mdiy/dict/list.do', {dictType:'注册-参观目的',pageSize:99999}).then(function (res) {
  494. that.purposeOptions = res.data.rows;
  495. }).catch(function (err) {
  496. console.log(err);
  497. });
  498. },
  499. },
  500. mounted: function () {
  501. //如果存在历史参数,恢复页面结果
  502. if(sessionStorage.getItem(this.historyKey) && ms.util.getParameter("isBack") == 'true') {
  503. var _history = JSON.parse(sessionStorage.getItem(this.historyKey))
  504. this.form = _history.form;
  505. this.total = parseInt(_history.total);
  506. this.currentPage = parseInt(_history.page.pageNo);
  507. this.pageSize = parseInt(_history.page.pageSize);
  508. }
  509. this.list();
  510. },
  511. created:function(){
  512. var that = this;
  513. //加载了解渠道 数据
  514. this.channelOptionsGet();
  515. //加载参观目的 数据
  516. this.purposeOptionsGet();
  517. }
  518. });
  519. </script>
  520. <style>
  521. #index .ms-search {
  522. padding: 20px 0;
  523. }
  524. </style>