AuthedAdmin.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <div>
  3. <crumbs title="已认证超管信息">
  4. <el-form :inline="true">
  5. <el-form-item label="审核时间:">
  6. <el-date-picker v-model="filter.time"
  7. size="mini"
  8. value-format="yyyy-MM-dd HH:mm:ss"
  9. :default-time="['00:00:01', '23:59:59']"
  10. type="daterange"
  11. start-placeholder="开始日期"
  12. end-placeholder="结束日期"></el-date-picker>
  13. </el-form-item>
  14. <el-form-item label="机构名称:">
  15. <el-input v-model="filter.orgName" clearable size="mini" placeholder="机构名称"></el-input>
  16. </el-form-item>
  17. <el-form-item label="手机号:">
  18. <el-input v-model="filter.userName" clearable size="mini" placeholder="手机号"></el-input>
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button size="mini" @click="filterDatas">确认</el-button>
  22. <el-button size="mini" type="primary" @click="exportData">导出</el-button>
  23. </el-form-item>
  24. </el-form>
  25. </crumbs>
  26. <div class="contents">
  27. <el-table :data="list"
  28. border
  29. @expand-change="showPickup"
  30. :row-class-name="proLineRow">
  31. <el-table-column
  32. type="index"
  33. :index="indexMethod"
  34. label="编号"
  35. width="60">
  36. </el-table-column>
  37. <el-table-column
  38. prop="userGmtCreate"
  39. label="注册时间"
  40. :show-overflow-tooltip="true"
  41. width="120">
  42. </el-table-column>
  43. <el-table-column
  44. prop="passauthTime"
  45. :show-overflow-tooltip="true"
  46. label="审核通过时间"
  47. width="120">
  48. </el-table-column>
  49. <el-table-column
  50. prop="linkman"
  51. label="超管名称">
  52. </el-table-column>
  53. <el-table-column
  54. prop="orgName"
  55. label="所在机构"
  56. width="120"
  57. >
  58. </el-table-column>
  59. <el-table-column
  60. prop="position"
  61. label="岗位名称">
  62. </el-table-column>
  63. <el-table-column
  64. prop="userName"
  65. label="手机号"
  66. :show-overflow-tooltip="true"
  67. width="100">
  68. </el-table-column>
  69. <el-table-column
  70. prop="email"
  71. :show-overflow-tooltip="true"
  72. width="140"
  73. label="邮箱">
  74. </el-table-column>
  75. <el-table-column
  76. prop="authStatusStr"
  77. label="状态">
  78. </el-table-column>
  79. <el-table-column
  80. label="操作"
  81. width="100">
  82. <template slot-scope="scope">
  83. <el-button type="text" size="small" @click="toEditAdmin(scope.row)">修改</el-button>
  84. <span style="margin:0 3px;">|</span>
  85. <el-button type="text" size="small" @click="showDelDialog(scope.row.userId)">删除</el-button>
  86. </template>
  87. </el-table-column>
  88. <el-table-column
  89. label="已开通功能"
  90. width="100">
  91. <template slot-scope="scope">
  92. <el-button type="text" size="small" :disabled="!scope.row.userAndProdutUDTO||scope.row.userAndProdutUDTO.length==0">{{scope.row.isExpand?"收起":"展开"}}</el-button>
  93. </template>
  94. </el-table-column>
  95. <el-table-column type="expand" width="15">
  96. <!---------详情展开内容------------>
  97. <template slot-scope="scope" v-if="scope.row.userAndProdutUDTO&&scope.row.userAndProdutUDTO.length>0">
  98. <el-table :data="scope.row.userAndProdutUDTO">
  99. <el-table-column label="编号"
  100. type="index"
  101. width="60"
  102. :index="indexMethod"></el-table-column>
  103. <!--<el-table-column label="开通时间" prop="startTime" width="180"></el-table-column>-->
  104. <el-table-column label="接入方式">
  105. <template slot-scope="access">
  106. {{access.row.accessType.join(',')}}
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="结算方式">
  110. <template slot-scope="charge">
  111. {{charge.row.chargeType.join(',')}}
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="开通功能" prop="productName"></el-table-column>
  115. <el-table-column label="产品服务有效期" prop="endTime" width="260">
  116. <template slot-scope="times">
  117. {{times.row.startTime.substr(0,10)}}~{{times.row.endTime.substr(0,10)}}
  118. </template>
  119. </el-table-column>
  120. <!--<el-table-column label="操作">
  121. <template slot-scope="detail">
  122. <el-popover
  123. placement="top-start"
  124. width="180"
  125. trigger="click">
  126. <el-form label-position="top" :inline="true">
  127. <el-form-item label="服务开始时间">
  128. <el-date-picker size="mini" type="date"
  129. :value-format="yyyy-MM-dd"
  130. placeholder="选择开始时间"
  131. v-model="startT"
  132. style="width: 100%;"></el-date-picker>
  133. </el-form-item>
  134. <el-form-item label="服务结束时间">
  135. <el-date-picker size="mini" type="date"
  136. value-format="yyyy-MM-dd"
  137. placeholder="选择结束时间"
  138. v-model="endT"
  139. style="width: 100%;"></el-date-picker>
  140. </el-form-item>
  141. <div style="text-align: center">
  142. <el-button type="primary" size="mini" @click="reBuyProduct(scope.row.productId,scope.row.userId)">确定</el-button>
  143. </div>
  144. </el-form>
  145. <el-button slot="reference" size="mini">续费</el-button>
  146. </el-popover>
  147. <el-button type="text" size="small" @click="showDelDetail(detail.row,scope.row.userAndProdutUDTO,detail.$index)">删除功能</el-button>
  148. </template>
  149. </el-table-column>-->
  150. <el-table-column label="状态" width="80">
  151. <template slot-scope="scope">
  152. <span v-if="scope.row.serviceStatus==0">已停用</span>
  153. <span v-if="scope.row.serviceStatus==1">已启用</span>
  154. </template>
  155. </el-table-column>
  156. <el-table-column label="操作" width="60">
  157. <template slot-scope="scope">
  158. <el-button v-if="scope.row.serviceStatus==0" type="text" size="small" @click="updateServiceStatus(scope.row,1)">启用</el-button>
  159. <el-button v-if="scope.row.serviceStatus==1" type="text" size="small" @click="updateServiceStatus(scope.row,0)">停用</el-button>
  160. </template>
  161. </el-table-column>
  162. </el-table>
  163. </template>
  164. <!---------详情展开内容end------------>
  165. </el-table-column>
  166. </el-table>
  167. </div>
  168. <el-pagination v-if="total>pageSize"
  169. :current-page.sync="currentPage"
  170. @current-change="currentChange"
  171. background
  172. :page-size="pageSize"
  173. layout="total,prev, pager, next, jumper"
  174. :total="total">
  175. </el-pagination>
  176. </div>
  177. </template>
  178. <script>
  179. import api from '@api/admin.js';
  180. import utils from '@api/utils.js';
  181. export default {
  182. name: 'authed-admin',
  183. data: function () {
  184. return {
  185. dialogFormVisible: false,
  186. rejectReason: '',
  187. startT:'',
  188. endT:'',
  189. type:'',
  190. currentId: '',
  191. status:'',
  192. list: [],
  193. cacheData: {},
  194. currentPage: 1,
  195. pageSize: 10,
  196. total: 0,
  197. filter: {
  198. time: [],
  199. orgName: '',
  200. userName: ''
  201. }
  202. }
  203. },
  204. created() {
  205. const cur = this.$route.params&&this.$route.params.currentPage;
  206. if(cur){
  207. this.currentPage = cur;
  208. }
  209. this.getDataList();
  210. },
  211. methods: {
  212. showPickup(row){
  213. row.isExpand = !row.isExpand;
  214. },
  215. proLineRow(row){
  216. const disable = row.row.userAndProdutUDTO&&row.row.userAndProdutUDTO.length>0;
  217. if(!disable){ //不能展开
  218. return 'pro-line-disable';
  219. }else{
  220. return '';
  221. }
  222. },
  223. warning(msg,type){
  224. this.$message({
  225. showClose: true,
  226. message:msg,
  227. type:type||'warning'
  228. })
  229. },
  230. showConfirmDialog(msg,resolve){
  231. this.$alert(msg, '提示', {
  232. confirmButtonText: '确定',
  233. type: 'warning'
  234. }).then(() => {
  235. resolve();
  236. }).catch(() => {});
  237. },
  238. reBuyProduct(productId,userId){
  239. const param = {
  240. productId,
  241. userId,
  242. endTime:this.endT
  243. };
  244. api.reBuyProduct(param).then((res) => {
  245. if (res.data.code == '0') {
  246. this.warning(res.data.msg || '操作成功', 'success');
  247. } else {
  248. this.warning(res.data.msg || '操作失败');
  249. }
  250. }).catch((error) => {
  251. this.warning("服务器正忙...");
  252. });
  253. },
  254. showDelDetail(row,data,index){
  255. this.showConfirmDialog('确定要删除该功能吗?',()=> {
  256. api.delAdminDetail({productId:row.productId, userId:row.userId}).then((res) => {
  257. if (res.data.code == '0') {
  258. this.warning(res.data.msg || '操作成功', 'success');
  259. data.splice(index,1); //删除成功后删除数据
  260. } else {
  261. this.warning(res.data.msg || '操作失败');
  262. }
  263. }).catch((error) => {
  264. this.warning("服务器正忙...");
  265. });
  266. });
  267. },
  268. updateServiceStatus(row,serviceStatus){
  269. const status=serviceStatus==0?'停用':'启用';
  270. this.showConfirmDialog('确定要'+status+'该功能吗?',()=> {
  271. api.startAndendByuserId({productId:row.productId,userId: row.userId, serviceStatus}).then((res) => {
  272. if (res.data.code == '0') {
  273. row.serviceStatus = serviceStatus;
  274. this.warning(res.data.msg || '操作成功', 'success');
  275. } else {
  276. this.warning(res.data.msg || '操作失败');
  277. }
  278. }).catch((error) => {
  279. this.warning("服务器正忙...");
  280. });
  281. });
  282. },
  283. toEditAdmin(row){
  284. //传参必须用命名路由
  285. this.$router.push({
  286. name:'addAdmin',
  287. params:{info:row,currentPage:this.currentPage}
  288. })
  289. },
  290. showDelDialog(id){
  291. this.$alert('确定要删除吗?', '提示', {
  292. confirmButtonText: '确定',
  293. callback: action => {
  294. if(action == 'confirm'){
  295. api.delSuperAdmin({id}).then((res)=>{
  296. if(res.data.code=='0'){
  297. this.warning(res.data.msg||'操作成功','success');
  298. this.getDataList(); //操作成功刷新列表
  299. }else{
  300. this.warning(res.data.msg);
  301. }
  302. }).catch((error)=>{
  303. this.warning("服务器正忙...");
  304. });
  305. }
  306. }
  307. });
  308. },
  309. indexMethod(index) {
  310. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  311. },
  312. filterDatas(){
  313. this.currentPage = 1;
  314. this.getDataList();
  315. },
  316. getDataList() {
  317. const param = this.getFilterItems();
  318. api.getAuthenticated(param).then((res) => {
  319. if (res.data.code == '0') {
  320. const data = res.data.data;
  321. this.list = data.records; //当前页显示的数据
  322. this.cacheData[param.current] = data.records; //缓存数据
  323. this.total = data.total;
  324. }
  325. }).catch((error) => {
  326. console.log(error);
  327. });
  328. },
  329. currentChange(next) { //切换当前页
  330. this.currentPage = next;
  331. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  332. this.list = this.cacheData[next];
  333. } else {
  334. this.getDataList();
  335. }
  336. },
  337. getFilterItems() { //筛选
  338. const time = this.filter.time;
  339. const startTime = time&&time[0]||undefined;
  340. const endTime = time&&time[1]||undefined;
  341. const param = {
  342. startTime,
  343. endTime,
  344. userName: this.filter.userName||undefined,
  345. orgName: this.filter.orgName||undefined,
  346. current: this.currentPage,
  347. size: this.pageSize
  348. };
  349. return param;
  350. },
  351. exportData() { //导出
  352. const canExport = utils.exportCondition(this.filter.time);
  353. if(typeof canExport == 'string'){
  354. this.$message({
  355. showClose: true,
  356. message:canExport,
  357. type:'warning'
  358. });
  359. return;
  360. }
  361. let param = this.getFilterItems();
  362. param.autStatus = 1; //已认证
  363. api.exportAuthedAdmin(param).then((res) => {
  364. if (res.data.code = '0') {
  365. utils.downloadExportedData(res.data, '已认证超管信息表.xls');
  366. this.$message({showClose: true,message: "导出成功", type: 'success'});
  367. } else {
  368. this.$message({
  369. showClose: true,
  370. message: res.data.msg,
  371. type: 'warning'
  372. });
  373. }
  374. }).catch((error) => {
  375. this.$message({
  376. showClose: true,
  377. message: "服务器正忙...",
  378. type: 'warning'
  379. });
  380. });
  381. }
  382. }
  383. }
  384. </script>
  385. <style lang="less">
  386. @import "../../less/admin.less";
  387. .pro-line-disable{
  388. .el-table__expand-column .cell{
  389. display: none;
  390. }
  391. }
  392. </style>