index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <div>
  3. <basic-container v-show="isShow" class="page-crad">
  4. <avue-crud
  5. ref="crud"
  6. :option="option"
  7. :data="dataList"
  8. :before-open="beforeOpen"
  9. :page.sync="page"
  10. :search.sync="search"
  11. @search-change="searchChange"
  12. @current-change="currentChange"
  13. @size-change="sizeChange"
  14. @refresh-change="refreshChange"
  15. @on-load="onLoad"
  16. :table-loading="loading"
  17. @saveColumn="saveColumn"
  18. @resetColumn="resetColumn"
  19. @selection-change="selectionChange"
  20. :cell-style="cellStyle"
  21. @search-criteria-switch="searchCriteriaSwitch"
  22. >
  23. <template slot-scope="{ row }" slot="updateUser">
  24. <span>{{ row.updateUserName }}</span>
  25. </template>
  26. <template slot-scope="{ row, index }" slot="menu">
  27. <el-button type="text" size="small" @click.stop="editOpen(row, 1)">
  28. 查看
  29. </el-button>
  30. <!-- <el-button type="text" size="small" @click.stop="editOpen(row, 1)">
  31. 编辑
  32. </el-button> -->
  33. <el-button
  34. type="text"
  35. size="small"
  36. @click.stop="rowDel(row, index)"
  37. :disabled="row.status > 0"
  38. >
  39. 删除
  40. </el-button>
  41. </template>
  42. </avue-crud>
  43. </basic-container>
  44. <detailPage
  45. v-if="!isShow"
  46. ref="detail"
  47. @goBack="goBack"
  48. @copyOrder="copyOrder"
  49. :detailData="detailData"
  50. ></detailPage>
  51. </div>
  52. </template>
  53. <script>
  54. import detailPage from "./detailsPage";
  55. import { getRateList, deleteDetails } from "@/api/basicData/rateManagement";
  56. export default {
  57. name: "index",
  58. components: {
  59. detailPage
  60. },
  61. data() {
  62. return {
  63. selectionList: [],
  64. form: {},
  65. dataList: [],
  66. loading: false,
  67. isShow: true,
  68. detailData: {},
  69. search: {},
  70. page: {
  71. pageSize: 10,
  72. currentPage: 1
  73. },
  74. option: {
  75. searchShow: true,
  76. searchMenuSpan: 16,
  77. align: "center",
  78. searchSpan: 8,
  79. border: true,
  80. index: true,
  81. viewBtn: false,
  82. editBtn: false,
  83. delBtn: false,
  84. menuWidth: 120,
  85. tip: false,
  86. selection: true,
  87. searchIcon: true,
  88. searchIndex: 2,
  89. addBtnText: "新单",
  90. stripe: true,
  91. column: [
  92. {
  93. label: "货币币别",
  94. prop: "code",
  95. overHidden: true,
  96. search: true
  97. },
  98. {
  99. label: "名称",
  100. prop: "cname",
  101. overHidden: true
  102. },
  103. {
  104. label: "符号",
  105. prop: "symbol",
  106. overHidden: true
  107. },
  108. {
  109. label: "本位币",
  110. prop: "standardMoney",
  111. overHidden: true
  112. },
  113. {
  114. label: "默认汇率",
  115. prop: "parities",
  116. overHidden: true
  117. },
  118. {
  119. label: "默认汇率",
  120. prop: "paritiesType",
  121. overHidden: true
  122. },
  123. {
  124. label: "汇率年度",
  125. prop: "annual",
  126. overHidden: true
  127. },
  128. {
  129. label: "月份",
  130. prop: "moon",
  131. overHidden: true
  132. },
  133. {
  134. label: "备注",
  135. prop: "remarks",
  136. overHidden: true
  137. }
  138. ]
  139. }
  140. };
  141. },
  142. created() {
  143. this.option.height = window.innerHeight - 210;
  144. },
  145. activated() {
  146. if (this.$route.query.check) {
  147. this.isShow = true;
  148. setTimeout(() => {
  149. this.editOpen({ id: this.$route.query.check.billId }, 1);
  150. }, 100);
  151. }
  152. },
  153. methods: {
  154. searchCriteriaSwitch(type) {
  155. if (type) {
  156. this.option.height = this.option.height - 46;
  157. } else {
  158. this.option.height = this.option.height + 46;
  159. }
  160. this.$refs.crud.getTableHeight();
  161. },
  162. cellStyle() {
  163. return "padding:0;height:40px;";
  164. },
  165. selectionChange(list) {
  166. this.selectionList = list;
  167. },
  168. //点击搜索按钮触发
  169. searchChange(params, done) {
  170. this.page.currentPage = 1;
  171. this.onLoad(this.page, params);
  172. done();
  173. },
  174. refreshChange() {
  175. this.onLoad(this.page, this.search);
  176. },
  177. currentChange(val) {
  178. this.page.currentPage = val;
  179. },
  180. sizeChange(val) {
  181. this.page.currentPage = 1;
  182. this.page.pageSize = val;
  183. },
  184. onLoad(page, params = {}) {
  185. this.loading = true;
  186. let queryParams = {
  187. ...params,
  188. ...this.search,
  189. size: page.pageSize,
  190. current: page.currentPage
  191. };
  192. getRateList(queryParams)
  193. .then(res => {
  194. this.dataList = res.data.data.records ? res.data.data.records : [];
  195. this.page.total = res.data.data.total;
  196. })
  197. .finally(() => {
  198. this.loading = false;
  199. });
  200. },
  201. //新增跳转页面
  202. beforeOpen() {
  203. this.isShow = false;
  204. },
  205. editOpen(row, status) {
  206. this.detailData = {
  207. id: row.id,
  208. status: status
  209. };
  210. this.isShow = false;
  211. },
  212. rowDel(row, index, done) {
  213. this.$confirm("确定删除数据?", {
  214. confirmButtonText: "确定",
  215. cancelButtonText: "取消",
  216. type: "warning"
  217. }).then(() => {
  218. deleteDetails(row.id).then(res => {
  219. if (res.data.code == 200) {
  220. this.$message({
  221. type: "success",
  222. message: "删除成功!"
  223. });
  224. this.onLoad(this.page, this.search);
  225. }
  226. });
  227. });
  228. },
  229. goBack() {
  230. if (this.$route.query.check) {
  231. this.$router.$avueRouter.closeTag(this.$route.fullPath);
  232. this.$router.push({
  233. path: "/salaryManagement/primarySchool/index"
  234. });
  235. }
  236. this.detailData = this.$options.data().detailData;
  237. this.onLoad(this.page, this.search);
  238. this.isShow = true;
  239. }
  240. }
  241. };
  242. </script>
  243. <style scoped>
  244. .page-crad ::v-deep .basic-container__card {
  245. height: 94.2vh;
  246. }
  247. </style>