index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <div class="container">
  3. <save-form
  4. inline
  5. :model="search"
  6. @submit="FetchList"
  7. @reset="reset"
  8. saveKey="/main/main/reminders"
  9. >
  10. <el-form-item prop="organIds">
  11. <el-select
  12. clearable
  13. filterable
  14. placeholder="请选择分部"
  15. v-model="search.organId"
  16. >
  17. <el-option
  18. v-for="(item, index) in selects.branchs"
  19. :key="index"
  20. :label="item.name"
  21. :value="item.id"
  22. ></el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-button native-type="submit" type="primary">搜索</el-button>
  26. <el-button native-type="reset" type="danger">重置</el-button>
  27. </save-form>
  28. <empty desc="暂无需要处理异常" v-if="!list.length" />
  29. <div v-else class="buttonWrap">
  30. <el-button
  31. @click="handle(item)"
  32. style="width: 100%; color: #303133"
  33. v-for="(item, index) in list"
  34. :key="index"
  35. :disabled="item.num ? false : true"
  36. type="text"
  37. >
  38. <title-item
  39. type="warning"
  40. :data="[
  41. {
  42. name: item.desc,
  43. num: item.num,
  44. errorType: item.errorType,
  45. num2: item.num2,
  46. },
  47. ]"
  48. >
  49. <span
  50. style="color: var(--color-primary)"
  51. v-if="
  52. !errorType[item.errorType] ||
  53. (errorType[item.errorType] &&
  54. permission(errorType[item.errorType].permission))
  55. "
  56. >立即处理<i class="el-icon-d-arrow-right"
  57. /></span>
  58. </title-item>
  59. </el-button>
  60. </div>
  61. </div>
  62. </template>
  63. <script>
  64. import { Searchs } from "@/helpers";
  65. import { getRemindMatterData } from "@/views/main/api";
  66. import title from "../abnormal/title";
  67. import { errorType } from "@/views/main/constant";
  68. import { permission } from "@/utils/directivePage";
  69. const initSearch = {
  70. organId: null,
  71. };
  72. export default {
  73. components: {
  74. "title-item": title,
  75. },
  76. data() {
  77. return {
  78. search: {
  79. ...initSearch,
  80. },
  81. list: [],
  82. errorType: errorType,
  83. listByType: {},
  84. };
  85. },
  86. async mounted() {
  87. await this.$store.dispatch("setBranchs");
  88. // this.$set(this.search, "organId", this.selects.branchs[0].id);
  89. this.FetchList();
  90. },
  91. methods: {
  92. permission,
  93. handle(item) {
  94. // 添加判断权限
  95. if (
  96. errorType[item.errorType] &&
  97. !this.permission(errorType[item.errorType]?.permission)
  98. ) {
  99. return;
  100. }
  101. new Searchs().removeByKey(item.url);
  102. this.$router.push({
  103. path: item.url,
  104. query: {
  105. ...item.query,
  106. filter_type: item.errorType,
  107. organId: this.search.organId || undefined,
  108. [item.resultKey]: item.resultKey
  109. ? (item.result || []).join(",")
  110. : undefined,
  111. },
  112. });
  113. // this.$router.push({
  114. // path: "/teamList",
  115. // query: {
  116. // filter_type: item.errorType,
  117. // searchType: "WAIT_CREATE_PAYMENT_CALENDER",
  118. // organId: this.search.organId || undefined,
  119. // form: "reminders",
  120. // },
  121. // });
  122. },
  123. async FetchList() {
  124. try {
  125. const res = await getRemindMatterData({
  126. ...this.search,
  127. });
  128. this.list = this.formatData(res.data || []);
  129. } catch (error) {
  130. console.log(error);
  131. }
  132. },
  133. reset() {
  134. this.search = { ...initSearch };
  135. this.FetchList();
  136. },
  137. formatData(data) {
  138. let list = data.map((item) => {
  139. return {
  140. ...item,
  141. ...(errorType[item.errorType] || {}),
  142. };
  143. });
  144. return list;
  145. },
  146. },
  147. };
  148. </script>
  149. <style lang="less" scoped>
  150. .container {
  151. /deep/ .is-disabled {
  152. .title {
  153. > span {
  154. color: #c0c4cc !important;
  155. }
  156. }
  157. }
  158. .buttonWrap {
  159. .el-button + .el-button {
  160. margin-left: 0;
  161. }
  162. }
  163. }
  164. </style>