index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  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.replace(/\s+/g, "");
  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. if (element.LoginTimeBegin) {
  204. element.LoginTimeBegins =
  205. element.LoginTimeBegin.split(":")[0] +
  206. ":" +
  207. element.LoginTimeBegin.split(":")[1];
  208. }
  209. if (element.LoginTimeEnd) {
  210. element.LoginTimeEnds =
  211. element.LoginTimeEnd.split(":")[0] +
  212. ":" +
  213. element.LoginTimeEnd.split(":")[1];
  214. }
  215. });
  216. this.loading = false;
  217. }
  218. resolve();
  219. })
  220. .catch((error) => {
  221. reject(error);
  222. this.loading = false;
  223. });
  224. });
  225. },
  226. gotoSystem() {
  227. this.$router.push("/systemManagement");
  228. },
  229. // 新增页面
  230. gotoAdd() {
  231. this.$router.push("/addSystem");
  232. },
  233. //编辑页面
  234. EditStystem(id) {
  235. this.$router.push({ path: "/EditSystem", query: { TacId: id } });
  236. },
  237. //删除
  238. remove() {
  239. return new Promise((resolve, reject) => {
  240. DeleteTac({ TacId: this.delItem.TacId })
  241. .then((response) => {
  242. if (response.code === 0) {
  243. this.delItem = null;
  244. this.$message.success("删除成功");
  245. this.tacList.splice(this.delIndex, 1);
  246. this.delIndex = null;
  247. this.flag = false;
  248. }
  249. resolve();
  250. })
  251. .catch((error) => {
  252. reject(error);
  253. this.flag = false;
  254. });
  255. });
  256. },
  257. open(data, index) {
  258. this.delItem = data;
  259. this.delIndex = index;
  260. this.flag = true;
  261. },
  262. //滚动加载数据
  263. load() {
  264. this.pageNum += 1;
  265. this.getTacList({
  266. QueryName: this.keyWord,
  267. PageSize: this.PageSize,
  268. PageIndex: this.pageNum,
  269. });
  270. },
  271. },
  272. };
  273. </script>
  274. <style lang="scss" scoped>
  275. .loger {
  276. width: 24px;
  277. height: 24px;
  278. background: url("../../../assets/status/ic_edit.png") no-repeat;
  279. background-size: 100% 100%;
  280. border: 1px solid #e4e7ec;
  281. border-radius: 50%;
  282. margin-right: 24px;
  283. display: inline-block;
  284. }
  285. .cont-top {
  286. width: 100%;
  287. > .cont_chid {
  288. width: 100%;
  289. display: flex;
  290. align-items: center;
  291. margin-bottom: 10px;
  292. > p {
  293. font-size: 14px;
  294. font-family: Microsoft YaHei;
  295. font-weight: 400;
  296. color: #303133;
  297. margin: 0 0 0 0;
  298. }
  299. > span {
  300. font-size: 14px;
  301. font-family: DIN;
  302. font-weight: 500;
  303. color: #909399;
  304. }
  305. }
  306. }
  307. ::v-deep .el-card__body {
  308. padding: 24px;
  309. }
  310. ::v-deep .el-row {
  311. width: 100%;
  312. }
  313. .header-mid {
  314. display: flex;
  315. align-items: center;
  316. }
  317. .loger:hover {
  318. cursor: pointer;
  319. background: url("../../../assets/status/ic_edit_hovar.png") no-repeat;
  320. background-size: 100% 100%;
  321. }
  322. .Box {
  323. width: 100%;
  324. height: 100%;
  325. padding: 0;
  326. display: flex;
  327. padding-top: 32px;
  328. }
  329. .centerBox {
  330. width: calc(100% - 400px);
  331. height: 100%;
  332. margin-right: 52px;
  333. border-radius: 16px;
  334. }
  335. .content-box {
  336. height: 100%;
  337. width: 100%;
  338. display: flex;
  339. }
  340. .contentBox {
  341. width: 100%;
  342. height: 76vh;
  343. }
  344. .center-box {
  345. margin-top: 50px;
  346. display: flex;
  347. justify-content: flex-start;
  348. flex-wrap: wrap;
  349. margin-left: 64px;
  350. width: calc(100% - 95px);
  351. height: 70vh;
  352. overflow-y: auto;
  353. overflow-x: hidden;
  354. padding-bottom: 20px;
  355. }
  356. .colorTitle {
  357. margin-top: 20px;
  358. width: 195px;
  359. height: 20px;
  360. display: flex;
  361. justify-content: space-between;
  362. float: left;
  363. }
  364. .box-card {
  365. width: 100%;
  366. height: 144px;
  367. margin-right: 10px;
  368. box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
  369. border-radius: 8px;
  370. margin-bottom: 16px;
  371. position: relative;
  372. button {
  373. position: absolute;
  374. right: 20px;
  375. top: 50%;
  376. margin-top: -12px;
  377. cursor: pointer;
  378. }
  379. }
  380. // .center-box :hover {
  381. // box-shadow: 0 16px 32px 0 rgba(48, 55, 66, 0.15);
  382. // transform: translate(0, -5px);
  383. // transition-delay: 0s !important;
  384. // }
  385. .header-top {
  386. display: flex;
  387. flex-direction: row;
  388. align-items: center;
  389. justify-content: space-between;
  390. margin-bottom: 18px;
  391. }
  392. .item {
  393. padding: 10px;
  394. }
  395. .title {
  396. // width: 120px;
  397. max-width: 80px;
  398. height: 18px;
  399. font-size: 14px;
  400. font-weight: bold;
  401. color: #303133;
  402. display: inline-block;
  403. white-space: nowrap;
  404. text-overflow: ellipsis;
  405. overflow: hidden;
  406. word-break: break-all;
  407. }
  408. .title1 {
  409. width: 150px;
  410. height: 26px;
  411. font-size: 26px;
  412. margin-bottom: 30px;
  413. font-weight: bold;
  414. color: #303133;
  415. }
  416. .box-card :hover {
  417. box-shadow: none;
  418. transform: none;
  419. }
  420. .searchBox {
  421. float: right;
  422. margin-right: 50px;
  423. }
  424. .asideBox {
  425. margin-top: -35px;
  426. width: 400px;
  427. background: #fff;
  428. box-shadow: 0px 6px 7px 0px rgba(0, 0, 0, 0.06);
  429. // border-radius: 16px;
  430. display: flex;
  431. flex-direction: column;
  432. height: 100vh;
  433. position: fixed;
  434. right: 0;
  435. // top: 0;
  436. // padding-top: 147px;
  437. }
  438. ::v-deep .asideBox {
  439. .el-button--primary {
  440. width: 280px;
  441. height: 48px;
  442. background: linear-gradient(0deg, #6983be, #777dba);
  443. box-shadow: 0px 3px 4px 0px rgba(0, 0, 0, 0.18);
  444. border-radius: 6px;
  445. color: #fff;
  446. border: none;
  447. margin-left: 60px;
  448. }
  449. .el-button--default {
  450. width: 280px;
  451. height: 48px;
  452. background: #f5f7fa;
  453. border: 1px solid #b4b7cb;
  454. border-radius: 6px;
  455. color: #6f81bc;
  456. margin: 35px 0 24px 60px;
  457. }
  458. }
  459. </style>