index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <div class="oing pagePadding">
  3. <ex-table
  4. v-loading="loading"
  5. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  6. :table="table"
  7. :data="tableData"
  8. :columns="columns"
  9. :page="pageInfo"
  10. :size="size"
  11. @page-curr-change="handlePageChange"
  12. @page-size-change="handleSizeChange"
  13. @screen-reset="
  14. pageInfo.curr = 1;
  15. parmValue.page = 1;
  16. searchList();
  17. "
  18. @screen-submit="
  19. pageInfo.curr = 1;
  20. parmValue.page = 1;
  21. searchList();
  22. "
  23. >
  24. <template #table-header="{}">
  25. <div style="width: 100%; height: 30px">
  26. <el-row :gutter="10">
  27. <el-col :span="24">
  28. <el-col :span="3" style="width: 66px; float: right">
  29. <el-button
  30. type="primary"
  31. :size="searchSize"
  32. style="float: right"
  33. @click="searchList"
  34. >
  35. 刷新
  36. </el-button>
  37. </el-col>
  38. <el-col
  39. :span="3"
  40. style="width: 66px; float: right"
  41. v-if="powers.some((item) => item == '003')"
  42. >
  43. <el-button
  44. :size="searchSize"
  45. type="success"
  46. style="float: right"
  47. @click="openModal('add', false)"
  48. >
  49. 添加
  50. </el-button>
  51. </el-col>
  52. </el-col>
  53. </el-row>
  54. </div>
  55. </template>
  56. <!-- <template #status="{ scope }">
  57. <el-tag
  58. :size="tablebtnSize"
  59. :type="scope.row.status == '0' ? 'warning' : ''"
  60. v-text="
  61. (statusOptions.find((item) => item.id == scope.row.status) || {})
  62. .label || '--'
  63. "
  64. ></el-tag>
  65. </template> -->
  66. <template #operation="{ scope }">
  67. <el-tooltip
  68. v-if="powers.some((item) => item == '007')"
  69. effect="dark"
  70. content="详情"
  71. placement="top"
  72. >
  73. <i class="el-icon-view tb-icon" @click="getRouter(scope.row)"></i>
  74. </el-tooltip>
  75. </template>
  76. </ex-table>
  77. <no-auth v-else></no-auth>
  78. </div>
  79. </template>
  80. <script>
  81. import asyncRequest from "@/apis/service/process/oing";
  82. import mixinPage from "@/mixins/elPaginationHandle";
  83. import { mapGetters } from "vuex";
  84. import resToken from "@/mixins/resToken";
  85. import { routerList, columns } from "@/views/process/columns";
  86. export default {
  87. name: "role",
  88. mixins: [mixinPage, resToken],
  89. computed: {
  90. //组件SIZE设置
  91. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  92. powers() {
  93. let tran =
  94. this.$store.getters.btnList.find((item) => item.menu_route == "oing") ||
  95. {};
  96. if (tran && tran.action && tran.action.length > 0) {
  97. return tran.action;
  98. } else {
  99. return [];
  100. }
  101. },
  102. },
  103. data() {
  104. return {
  105. process_router_list: JSON.parse(JSON.stringify(routerList)),
  106. loading: true,
  107. modelId: 0,
  108. parmValue: {
  109. page: 1, // 页码
  110. size: 15, // 每页显示条数
  111. },
  112. // 表格 - 数据
  113. tableData: [],
  114. // 表格 - 参数
  115. table: {
  116. stripe: true,
  117. border: true,
  118. _defaultHeader_: ["setcol"],
  119. },
  120. // 表格 - 分页
  121. pageInfo: {
  122. size: 15,
  123. curr: 1,
  124. total: 0,
  125. },
  126. // 表格 - 列参数
  127. columns: columns,
  128. };
  129. },
  130. mounted() {
  131. console.log(this.process_router_list);
  132. this.searchProList();
  133. this.searchList();
  134. },
  135. methods: {
  136. getRouter(row) {
  137. const { order_type, order_id, order_code } = row;
  138. let index = this.process_router_list.findIndex(
  139. (y) => y.type === order_type
  140. );
  141. if (index !== -1) {
  142. const { toRouter, to } = this.process_router_list[index];
  143. let model = {
  144. type: "view",
  145. id: to === "code" ? order_code : order_id,
  146. };
  147. this.routeGoto(toRouter, model);
  148. } else {
  149. this.$message.warning("暂未找到相关流程!");
  150. }
  151. },
  152. restSearch() {
  153. // 表格 - 分页
  154. this.pageInfo = {
  155. size: 15,
  156. curr: 1,
  157. total: 0,
  158. };
  159. this.parmValue = {
  160. page: 1, // 页码
  161. size: 15, // 每页显示条数
  162. };
  163. this.searchProList();
  164. this.searchList();
  165. },
  166. // 刷新表格
  167. async searchList() {
  168. this.loading = true;
  169. const res = await asyncRequest.list(this.parmValue);
  170. if (res && res.code === 0 && res.data) {
  171. this.tableData = res.data.list;
  172. // this.tableData.forEach((v, i) => {
  173. // let index = this.process_router_list.findIndex(
  174. // (y) => y.type === v.order_type
  175. // );
  176. // if (index !== -1) {
  177. // const { name, toRouter, to } = this.process_router_list[index];
  178. // this.tableData[i].process_name = name;
  179. // this.tableData[i].toRouter = toRouter;
  180. // this.tableData[i].typetoRouter = toRouter;
  181. // this.tableData[i].queryId =
  182. // to == "code" ? v.order_code : v.order_id;
  183. // } else {
  184. // this.tableData[i].process_name = "";
  185. // this.tableData[i].toRouter = "";
  186. // this.tableData[i].queryId = "";
  187. // }
  188. // });
  189. this.pageInfo.total = Number(res.data.count);
  190. } else if (res && res.code >= 100 && res.code <= 104) {
  191. await this.logout();
  192. } else {
  193. this.tableData = [];
  194. this.pageInfo.total = 0;
  195. }
  196. this.loading = false;
  197. },
  198. // 刷新表格
  199. async searchProList() {
  200. this.loading = true;
  201. const res = await asyncRequest.processList({
  202. page: 1, // 页码
  203. size: 50, // 每页显示条数
  204. });
  205. if (res && res.code === 0 && res.data) {
  206. console.log(res.data);
  207. } else if (res && res.code >= 100 && res.code <= 104) {
  208. await this.logout();
  209. } else {
  210. this.tableData = [];
  211. this.pageInfo.total = 0;
  212. }
  213. this.loading = false;
  214. },
  215. },
  216. };
  217. </script>
  218. <style lang="scss" scoped>
  219. </style>