index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <!-- 币别及汇率 -->
  2. <template>
  3. <div>
  4. <basic-container v-show="isShow" class="page-crad">
  5. <avue-crud
  6. ref="crud"
  7. :option="option"
  8. :data="dataList"
  9. :before-open="beforeOpen"
  10. id="out-table"
  11. :header-cell-class-name="headerClassName"
  12. :page.sync="page"
  13. :search.sync="search"
  14. @search-change="searchChange"
  15. @current-change="currentChange"
  16. @size-change="sizeChange"
  17. @refresh-change="refreshChange"
  18. @on-load="onLoad"
  19. :table-loading="loading"
  20. @saveColumn="saveColumn"
  21. @resetColumn="resetColumn"
  22. @selection-change="selectionChange"
  23. :cell-style="cellStyle"
  24. @search-criteria-switch="searchCriteriaSwitch"
  25. >
  26. <template slot-scope="{ row }" slot="updateUser">
  27. <span>{{ row.updateUserName }}</span>
  28. </template>
  29. <template slot-scope="{ row, index }" slot="menu">
  30. <el-button type="text" size="small" @click.stop="editOpen(row, 1)">
  31. 查看
  32. </el-button>
  33. <!-- <el-button type="text" size="small" @click.stop="editOpen(row, 1)">
  34. 编辑
  35. </el-button> -->
  36. <el-button
  37. type="text"
  38. size="small"
  39. @click.stop="rowDel(row, index)"
  40. :disabled="row.status > 0"
  41. >
  42. 删除
  43. </el-button>
  44. </template>
  45. </avue-crud>
  46. </basic-container>
  47. <detailPage
  48. v-if="!isShow"
  49. ref="detail"
  50. @goBack="goBack"
  51. @copyOrder="copyOrder"
  52. :detailData="detailData"
  53. ></detailPage>
  54. </div>
  55. </template>
  56. <script>
  57. import detailPage from "./detailsPage";
  58. import { getRateList, deleteDetails } from "@/api/iosBasicData/rateManagement";
  59. export default {
  60. name: "index",
  61. components: {
  62. detailPage
  63. },
  64. data() {
  65. return {
  66. selectionList: [],
  67. form: {},
  68. dataList: [],
  69. loading: false,
  70. isShow: true,
  71. detailData: {},
  72. search: {},
  73. page: {
  74. pageSize: 10,
  75. currentPage: 1
  76. },
  77. option: {
  78. searchShow: true,
  79. searchMenuSpan: 6,
  80. align: "center",
  81. border: true,
  82. index: true,
  83. viewBtn: false,
  84. editBtn: false,
  85. delBtn: false,
  86. menuWidth: 120,
  87. tip: false,
  88. selection: true,
  89. searchIcon: true,
  90. searchIndex: 3,
  91. calcHeight: 30,
  92. addBtnText: "新单",
  93. stripe: true,
  94. column: [
  95. {
  96. label: "代码",
  97. prop: "code",
  98. overHidden: true,
  99. search: true
  100. },
  101. {
  102. label: "国际三字码",
  103. prop: "unCode",
  104. overHidden: true,
  105. search: true
  106. },
  107. {
  108. label: "中文名称",
  109. prop: "cnName",
  110. overHidden: true,
  111. search: true
  112. },
  113. {
  114. label: "英文名称",
  115. prop: "enName",
  116. overHidden: true,
  117. search: true
  118. },
  119. {
  120. label: "货币符号",
  121. prop: "symbol",
  122. overHidden: true
  123. },
  124. {
  125. label: "是否本币",
  126. prop: "isLocal",
  127. dicData:[{
  128. label:'非本币',
  129. value:0
  130. },{
  131. label:'本币',
  132. value:1
  133. }],
  134. overHidden: true
  135. },
  136. {
  137. label: "对本币汇率",
  138. prop: "exrate",
  139. overHidden: true
  140. },
  141. {
  142. label: "国家代码",
  143. prop: "cntyCode",
  144. overHidden: true
  145. },
  146. {
  147. label: "国家名称",
  148. prop: "cntyName",
  149. overHidden: true
  150. },
  151. {
  152. label: "状态",
  153. prop: "status",
  154. type: "select",
  155. dicData:[{
  156. label:'启用',
  157. value:0
  158. },{
  159. label:'停用',
  160. value:1
  161. }],
  162. value: 0,
  163. overHidden: true
  164. }
  165. ]
  166. }
  167. };
  168. },
  169. created() {
  170. this.option.height = window.innerHeight - 210;
  171. },
  172. activated() {
  173. if (this.$route.query.check) {
  174. this.isShow = true;
  175. setTimeout(() => {
  176. this.editOpen({ id: this.$route.query.check.billId }, 1);
  177. }, 100);
  178. }
  179. },
  180. methods: {
  181. searchCriteriaSwitch(type) {
  182. if (type) {
  183. this.option.height = this.option.height - 46;
  184. } else {
  185. this.option.height = this.option.height + 46;
  186. }
  187. this.$refs.crud.getTableHeight();
  188. },
  189. cellStyle() {
  190. return "padding:0;height:40px;";
  191. },
  192. selectionChange(list) {
  193. this.selectionList = list;
  194. },
  195. //点击搜索按钮触发
  196. searchChange(params, done) {
  197. this.page.currentPage = 1;
  198. this.onLoad(this.page, params);
  199. done();
  200. },
  201. refreshChange() {
  202. this.onLoad(this.page, this.search);
  203. },
  204. currentChange(val) {
  205. this.page.currentPage = val;
  206. },
  207. sizeChange(val) {
  208. this.page.currentPage = 1;
  209. this.page.pageSize = val;
  210. },
  211. onLoad(page, params = {}) {
  212. this.loading = true;
  213. let queryParams = {
  214. ...params,
  215. ...this.search,
  216. size: page.pageSize,
  217. current: page.currentPage
  218. };
  219. getRateList(queryParams)
  220. .then(res => {
  221. this.dataList = res.data.data.records ? res.data.data.records : [];
  222. this.page.total = res.data.data.total;
  223. })
  224. .finally(() => {
  225. this.loading = false;
  226. });
  227. },
  228. //新增跳转页面
  229. beforeOpen() {
  230. this.isShow = false;
  231. },
  232. editOpen(row, status) {
  233. this.detailData = {
  234. id: row.id,
  235. status: status
  236. };
  237. this.isShow = false;
  238. },
  239. rowDel(row, index, done) {
  240. this.$confirm("确定删除数据?", {
  241. confirmButtonText: "确定",
  242. cancelButtonText: "取消",
  243. type: "warning"
  244. }).then(() => {
  245. deleteDetails(row.id).then(res => {
  246. if (res.data.code == 200) {
  247. this.$message({
  248. type: "success",
  249. message: "删除成功!"
  250. });
  251. this.onLoad(this.page, this.search);
  252. }
  253. });
  254. });
  255. },
  256. goBack() {
  257. if (this.$route.query.check) {
  258. this.$router.$avueRouter.closeTag(this.$route.fullPath);
  259. this.$router.push({
  260. path: "/salaryManagement/primarySchool/index"
  261. });
  262. }
  263. this.detailData = this.$options.data().detailData;
  264. this.onLoad(this.page, this.search);
  265. this.isShow = true;
  266. },
  267. // 更改表格颜色
  268. headerClassName(tab){
  269. //颜色间隔
  270. let back = ""
  271. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  272. if (tab.columnIndex % 2 === 0) {
  273. back = "back-one"
  274. } else if (tab.columnIndex % 2 === 1) {
  275. back = "back-two"
  276. }
  277. }
  278. return back;
  279. },
  280. }
  281. };
  282. </script>
  283. <style lang="scss" scoped>
  284. .page-crad ::v-deep .basic-container__card {
  285. height: 94.2vh;
  286. }
  287. ::v-deep#out-table .back-one {
  288. background: #ecf5ff !important;
  289. }
  290. ::v-deep#out-table .back-two {
  291. background: #ecf5ff !important;
  292. }
  293. /deep/ .el-col-md-8 {
  294. width: 24.33333%;
  295. }
  296. </style>