index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <template>
  2. <div class="Box">
  3. <div class="centerBox">
  4. <div class="searchBox">
  5. <Search
  6. :isAdd="false"
  7. @getSearchData="getSearchData"
  8. @clearSearchData="clearSearchData"
  9. :isSlot="true"
  10. >
  11. <el-button v-is="['logintac_btn_add']" class="btnAdd" @click="gotoAdd"
  12. >新增策略</el-button
  13. >
  14. </Search>
  15. </div>
  16. <div class="content-box">
  17. <div v-if="tacList.length" class="contentBox">
  18. <div
  19. v-infinite-scroll="load"
  20. :infinite-scroll-distance="20"
  21. infinite-scroll-disabled="disabled"
  22. class="center-box"
  23. >
  24. <el-row :gutter="16">
  25. <el-col :span="4" v-for="(item, index) in tacList" :key="index">
  26. <el-card class="box-card">
  27. <button
  28. v-is="['logintac_btn_delete']"
  29. type="text"
  30. @click="open(item, index)"
  31. style="
  32. position: absolute;
  33. padding: 3px 0;
  34. border: none;
  35. color: #303133;
  36. width: 20px;
  37. background: #fff;
  38. right: 15px;
  39. top: 31px;
  40. "
  41. >
  42. ×
  43. </button>
  44. <div>
  45. <div class="header-top">
  46. <div class="header-mid">
  47. <span class="title">{{ item.TacName }} </span>
  48. </div>
  49. <div
  50. class="loger"
  51. v-is="['logintac_btn_edit']"
  52. @click="EditStystem(item.TacId)"
  53. ></div>
  54. </div>
  55. <div class="cont-top">
  56. <div class="cont_chid">
  57. <p>开始时间:</p>
  58. <span>{{
  59. item.LoginDateBegins ? item.LoginDateBegins : "--"
  60. }}</span>
  61. </div>
  62. <div class="cont_chid">
  63. <p>截止时间:</p>
  64. <span>{{
  65. item.LoginDateEnds ? item.LoginDateEnds : "--"
  66. }}</span>
  67. </div>
  68. <div class="cont_chid">
  69. <p>登录时段:</p>
  70. <span>{{
  71. item.LoginTimeBegins ? item.LoginTimeBegins : "--"
  72. }}</span>
  73. <span style="margin-left: 5px; margin-right: 5px"
  74. >至</span
  75. >
  76. <span>{{
  77. item.LoginTimeEnds ? item.LoginTimeEnds : "--"
  78. }}</span>
  79. </div>
  80. </div>
  81. </div>
  82. </el-card>
  83. </el-col>
  84. </el-row>
  85. </div>
  86. <template v-if="total > 1">
  87. <p class="center" v-if="loading">加载中...</p>
  88. <p class="center" v-if="noMore">没有更多数据了~</p>
  89. </template>
  90. </div>
  91. <el-empty
  92. v-else
  93. description="没有内容"
  94. style="margin: 0 auto"
  95. ></el-empty>
  96. </div>
  97. </div>
  98. <div class="asideBox">
  99. <el-button @click="gotoSystem">系统基础设置</el-button>
  100. <el-button type="primary">登陆策略</el-button>
  101. </div>
  102. <!--删除弹框-->
  103. <Dialog :flag="flag">
  104. <div class="airportInfoDialog">
  105. <div class="title1">删除策略</div>
  106. <div class="content">是否确认删除该策略?</div>
  107. <div class="foot right t30">
  108. <el-button
  109. size="medium"
  110. @click="remove(item, index)"
  111. type="danger"
  112. class="r24"
  113. >删除</el-button
  114. >
  115. <el-button size="medium" @click="flag = false">取消</el-button>
  116. </div>
  117. </div>
  118. </Dialog>
  119. </div>
  120. </template>
  121. <script>
  122. import Search from "@/layout/components/Search";
  123. import Dialog from "@/layout/components/Dialog";
  124. import { GetTacList, DeleteTac } from "@/api/systemConfiguration";
  125. export default {
  126. components: { Search, Dialog },
  127. data() {
  128. return {
  129. flag: false, //弹框开关
  130. tacList: [],
  131. delItem: null,
  132. delIndex: null,
  133. keyWord: "",
  134. pageNum: 1,
  135. PageSize: 40,
  136. loading: false,
  137. total: null,
  138. dataList: [],
  139. num: null,
  140. };
  141. },
  142. created() {
  143. if (this.$route.query.keyWords) {
  144. this.keyWord = this.$route.query.keyWords;
  145. }
  146. this.getTacList({
  147. QueryName: this.keyWord,
  148. PageSize: this.PageSize,
  149. PageIndex: this.pageNum,
  150. });
  151. },
  152. computed: {
  153. noMore() {
  154. return this.pageNum >= this.total;
  155. },
  156. disabled() {
  157. return this.loading || this.noMore;
  158. },
  159. },
  160. methods: {
  161. getSearchData(data) {
  162. this.keyWord = data;
  163. this.dataList = [];
  164. this.tacList = [];
  165. this.pageNum = 1;
  166. this.getTacList({
  167. QueryName: this.keyWord,
  168. PageSize: this.PageSize,
  169. PageIndex: this.pageNum,
  170. });
  171. },
  172. clearSearchData() {
  173. this.keyWord = "";
  174. this.dataList = [];
  175. this.tacList = [];
  176. this.pageNum = 1;
  177. this.getTacList({
  178. QueryName: this.keyWord,
  179. PageSize: this.PageSize,
  180. PageIndex: this.pageNum,
  181. });
  182. },
  183. getTacList(obj) {
  184. this.loading = true;
  185. return new Promise((resolve, reject) => {
  186. GetTacList(obj)
  187. .then((response) => {
  188. if (response.code === 0) {
  189. const { returnData } = response;
  190. const datas = returnData.records;
  191. this.total = returnData.pages;
  192. this.dataList.push(datas);
  193. const arrs = this.dataList.flat();
  194. this.tacList = arrs;
  195. this.tacList.forEach((element) => {
  196. if (element.LoginDateBegin) {
  197. element.LoginDateBegins =
  198. element.LoginDateBegin.split("T")[0];
  199. }
  200. if (element.LoginDateEnd) {
  201. element.LoginDateEnds = element.LoginDateEnd.split("T")[0];
  202. }
  203. element.LoginTimeBegins =
  204. element.LoginTimeBegin.split(":")[0] +
  205. ":" +
  206. element.LoginTimeBegin.split(":")[1];
  207. element.LoginTimeEnds =
  208. element.LoginTimeEnd.split(":")[0] +
  209. ":" +
  210. element.LoginTimeEnd.split(":")[1];
  211. console.log(element);
  212. });
  213. this.loading = false;
  214. }
  215. resolve();
  216. })
  217. .catch((error) => {
  218. reject(error);
  219. this.loading = false;
  220. });
  221. });
  222. },
  223. gotoSystem() {
  224. this.$router.push("/systemManagement");
  225. },
  226. // 新增页面
  227. gotoAdd() {
  228. this.$router.push("/addSystem");
  229. },
  230. //编辑页面
  231. EditStystem(id) {
  232. this.$router.push({ path: "/EditSystem", query: { TacId: id } });
  233. },
  234. //删除
  235. remove() {
  236. return new Promise((resolve, reject) => {
  237. DeleteTac({ TacId: this.delItem.TacId })
  238. .then((response) => {
  239. if (response.code === 0) {
  240. this.delItem = null;
  241. this.$message.success("删除成功");
  242. this.tacList.splice(this.delIndex, 1);
  243. this.delIndex = null;
  244. this.flag = false;
  245. }
  246. resolve();
  247. })
  248. .catch((error) => {
  249. reject(error);
  250. this.flag = false;
  251. });
  252. });
  253. },
  254. open(data, index) {
  255. this.delItem = data;
  256. this.delIndex = index;
  257. this.flag = true;
  258. },
  259. //滚动加载数据
  260. load() {
  261. this.pageNum += 1;
  262. this.getTacList({
  263. QueryName: this.keyWord,
  264. PageSize: this.PageSize,
  265. PageIndex: this.pageNum,
  266. });
  267. },
  268. },
  269. };
  270. </script>
  271. <style lang="scss" scoped>
  272. .loger {
  273. width: 24px;
  274. height: 24px;
  275. background: url("../../../assets/status/ic_edit.png") no-repeat;
  276. background-size: 100% 100%;
  277. border: 1px solid #e4e7ec;
  278. border-radius: 50%;
  279. margin-right: 24px;
  280. display: inline-block;
  281. }
  282. .cont-top {
  283. width: 100%;
  284. > .cont_chid {
  285. width: 100%;
  286. display: flex;
  287. align-items: center;
  288. margin-bottom: 10px;
  289. > p {
  290. font-size: 14px;
  291. font-family: Microsoft YaHei;
  292. font-weight: 400;
  293. color: #303133;
  294. margin: 0 0 0 0;
  295. }
  296. > span {
  297. font-size: 14px;
  298. font-family: DIN;
  299. font-weight: 500;
  300. color: #909399;
  301. }
  302. }
  303. }
  304. ::v-deep .el-card__body {
  305. padding: 24px;
  306. }
  307. ::v-deep .el-row {
  308. width: 100%;
  309. }
  310. .header-mid {
  311. display: flex;
  312. align-items: center;
  313. }
  314. .loger:hover {
  315. cursor: pointer;
  316. background: url("../../../assets/status/ic_edit_hovar.png") no-repeat;
  317. background-size: 100% 100%;
  318. }
  319. .Box {
  320. width: 100%;
  321. height: 100%;
  322. padding: 0;
  323. display: flex;
  324. padding-top: 32px;
  325. }
  326. .centerBox {
  327. width: calc(100% - 400px);
  328. height: 100%;
  329. margin-right: 52px;
  330. border-radius: 16px;
  331. }
  332. .content-box {
  333. height: 100%;
  334. width: 100%;
  335. display: flex;
  336. }
  337. .contentBox {
  338. width: 100%;
  339. height: 76vh;
  340. }
  341. .center-box {
  342. margin-top: 50px;
  343. display: flex;
  344. justify-content: flex-start;
  345. flex-wrap: wrap;
  346. margin-left: 64px;
  347. width: calc(100% - 95px);
  348. height: 70vh;
  349. overflow-y: auto;
  350. overflow-x: hidden;
  351. padding-bottom: 20px;
  352. }
  353. .colorTitle {
  354. margin-top: 20px;
  355. width: 195px;
  356. height: 20px;
  357. display: flex;
  358. justify-content: space-between;
  359. float: left;
  360. }
  361. .box-card {
  362. width: 100%;
  363. height: 144px;
  364. margin-right: 10px;
  365. box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
  366. border-radius: 8px;
  367. margin-bottom: 16px;
  368. position: relative;
  369. button {
  370. position: absolute;
  371. right: 20px;
  372. top: 50%;
  373. margin-top: -12px;
  374. cursor: pointer;
  375. }
  376. }
  377. // .center-box :hover {
  378. // box-shadow: 0 16px 32px 0 rgba(48, 55, 66, 0.15);
  379. // transform: translate(0, -5px);
  380. // transition-delay: 0s !important;
  381. // }
  382. .header-top {
  383. display: flex;
  384. flex-direction: row;
  385. align-items: center;
  386. justify-content: space-between;
  387. margin-bottom: 18px;
  388. }
  389. .item {
  390. padding: 10px;
  391. }
  392. .title {
  393. // width: 120px;
  394. max-width: 80px;
  395. height: 18px;
  396. font-size: 14px;
  397. font-weight: bold;
  398. color: #303133;
  399. display: inline-block;
  400. white-space: nowrap;
  401. text-overflow: ellipsis;
  402. overflow: hidden;
  403. word-break: break-all;
  404. }
  405. .title1 {
  406. width: 150px;
  407. height: 26px;
  408. font-size: 26px;
  409. margin-bottom: 30px;
  410. font-weight: bold;
  411. color: #303133;
  412. }
  413. .box-card :hover {
  414. box-shadow: none;
  415. transform: none;
  416. }
  417. .searchBox {
  418. float: right;
  419. margin-right: 50px;
  420. }
  421. .asideBox {
  422. margin-top: -35px;
  423. width: 400px;
  424. background: #fff;
  425. box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
  426. // border-radius: 16px;
  427. display: flex;
  428. flex-direction: column;
  429. height: 100vh;
  430. position: fixed;
  431. right: 0;
  432. // top: 0;
  433. // padding-top: 147px;
  434. }
  435. ::v-deep .asideBox {
  436. .el-button--primary {
  437. width: 280px;
  438. height: 48px;
  439. background: linear-gradient(0deg, #6983be, #777dba);
  440. box-shadow: 0px 3px 4px 0px rgba(0, 0, 0, 0.18);
  441. border-radius: 6px;
  442. color: #fff;
  443. border: none;
  444. margin-left: 60px;
  445. }
  446. .el-button--default {
  447. width: 280px;
  448. height: 48px;
  449. background: #f5f7fa;
  450. border: 1px solid #b4b7cb;
  451. border-radius: 6px;
  452. color: #6f81bc;
  453. margin: 35px 0 24px 60px;
  454. }
  455. }
  456. </style>