index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. const { back } = this.$route.query;
  132. if (back) {
  133. this.parmValue = JSON.parse(back);
  134. const {page,size}=this.parmValue
  135. this.pageInfo= {
  136. size: size,
  137. curr: page,
  138. total: 0,
  139. }
  140. }
  141. // this.searchProList();
  142. this.searchList();
  143. },
  144. methods: {
  145. getRouter(row) {
  146. const { order_type, order_id, order_code } = row;
  147. let index = this.process_router_list.findIndex(
  148. (y) => y.type === order_type
  149. );
  150. if (index !== -1) {
  151. const { toRouter, to } = this.process_router_list[index];
  152. let model = {
  153. type: "view",
  154. id: to === "code" ? order_code : order_id,
  155. };
  156. console.log(this.parmValue);
  157. let routerModel = {
  158. options: JSON.parse(JSON.stringify(this.parmValue)),
  159. router: this.$route.fullPath,
  160. };
  161. model.preModel = JSON.stringify(routerModel);
  162. this.routeGoto(toRouter, model);
  163. } else {
  164. this.$message.warning("暂未找到相关流程!");
  165. }
  166. },
  167. restSearch() {
  168. // 表格 - 分页
  169. this.pageInfo = {
  170. size: 15,
  171. curr: 1,
  172. total: 0,
  173. };
  174. this.parmValue = {
  175. page: 1, // 页码
  176. size: 15, // 每页显示条数
  177. };
  178. this.searchProList();
  179. this.searchList();
  180. },
  181. // 刷新表格
  182. async searchList() {
  183. this.loading = true;
  184. const res = await asyncRequest.list(this.parmValue);
  185. if (res && res.code === 0 && res.data) {
  186. this.tableData = res.data.list;
  187. // this.tableData.forEach((v, i) => {
  188. // let index = this.process_router_list.findIndex(
  189. // (y) => y.type === v.order_type
  190. // );
  191. // if (index !== -1) {
  192. // const { name, toRouter, to } = this.process_router_list[index];
  193. // this.tableData[i].process_name = name;
  194. // this.tableData[i].toRouter = toRouter;
  195. // this.tableData[i].typetoRouter = toRouter;
  196. // this.tableData[i].queryId =
  197. // to == "code" ? v.order_code : v.order_id;
  198. // } else {
  199. // this.tableData[i].process_name = "";
  200. // this.tableData[i].toRouter = "";
  201. // this.tableData[i].queryId = "";
  202. // }
  203. // });
  204. this.pageInfo.total = Number(res.data.count);
  205. } else if (res && res.code >= 100 && res.code <= 104) {
  206. await this.logout();
  207. } else {
  208. this.tableData = [];
  209. this.pageInfo.total = 0;
  210. }
  211. this.loading = false;
  212. },
  213. // 刷新表格
  214. async searchProList() {
  215. this.loading = true;
  216. const res = await asyncRequest.processList({
  217. page: 1, // 页码
  218. size: 50, // 每页显示条数
  219. });
  220. if (res && res.code === 0 && res.data) {
  221. console.log(res.data);
  222. } else if (res && res.code >= 100 && res.code <= 104) {
  223. await this.logout();
  224. } else {
  225. this.tableData = [];
  226. this.pageInfo.total = 0;
  227. }
  228. this.loading = false;
  229. },
  230. },
  231. };
  232. </script>
  233. <style lang="scss" scoped>
  234. </style>