index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <div>
  3. <basic-container v-if="isShow">
  4. <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :search.sync="query"
  5. v-model="form" id="out-table" :header-cell-class-name="headerClassName" ref="crud" @row-del="rowDel"
  6. @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
  7. @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"
  8. @resetColumn="resetColumn('crud', 'option', 'optionBack', 383)"
  9. @saveColumn="saveColumn('crud', 'option', 'optionBack', 383)" @on-load="onLoad">
  10. <template slot="menu" slot-scope="{ row, index }">
  11. <el-button size="small" icon="el-icon-edit" type="text" @click="rowEdit(row)">编辑</el-button>
  12. </template>
  13. <template slot="businessNo" slot-scope="{ row }">
  14. <span style="color: #1e9fff" @click="rowEdit(row)">{{ row.businessNo }}</span>
  15. </template>
  16. </avue-crud>
  17. </basic-container>
  18. <detailsPage v-if="!isShow" :detailData="detailData" @goBack="goBack"></detailsPage>
  19. </div>
  20. </template>
  21. <script>
  22. import { getList, remove, copyAgent } from "@/api/tradeAgency/exchangePurchasing";
  23. import detailsPage from "./detailsPage";
  24. export default {
  25. data() {
  26. return {
  27. detailData: {},
  28. isShow: true,
  29. form: {},
  30. query: {
  31. businessType: 'MYDL-STL',
  32. dc: 'C'
  33. },
  34. loading: false,
  35. page: {
  36. pageSize: 10,
  37. currentPage: 1,
  38. total: 0,
  39. },
  40. selectionList: [],
  41. option: {},
  42. optionBack: {
  43. height: 'auto',
  44. calcHeight: 30,
  45. menuWidth: 80,
  46. searchShow: true,
  47. searchMenuSpan: 12,
  48. border: true,
  49. index: true,
  50. addBtn: false,
  51. viewBtn: false,
  52. editBtn: false,
  53. delBtn: false,
  54. searchIcon: true,
  55. searchIndex: 3,
  56. column: [
  57. {
  58. label: "客户名称",
  59. prop: "corpId",
  60. overHidden: true,
  61. search: true,
  62. type: 'select',
  63. filterable: true,
  64. remote: true,
  65. dicUrl: "/api/blade-los/bcorps/listByType?corpTypeName=客户&cnName={{key}}",
  66. props: {
  67. label: 'cnName',
  68. value: 'id',
  69. res: 'data.records'
  70. },
  71. hide: true,
  72. showColumn: false,
  73. searchOrder: 1,
  74. },
  75. {
  76. label: "客户名称",
  77. prop: "corpName",
  78. width: "120",
  79. overHidden: true,
  80. },
  81. {
  82. label: "业务号",
  83. prop: "businessNo",
  84. overHidden: true,
  85. search: true,
  86. searchOrder: 2,
  87. },
  88. {
  89. label: '合同号',
  90. prop: "contractNo",
  91. overHidden: true,
  92. search: true,
  93. searchOrder: 3,
  94. },
  95. {
  96. label: '提单号',
  97. prop: "billNoJoin",
  98. search: true,
  99. searchOrder: 4,
  100. overHidden: true,
  101. },
  102. {
  103. label: "业务日期",
  104. prop: "businessDate",
  105. type: "date",
  106. search: true,
  107. searchOrder: 5,
  108. searchProp: "businessDateList",
  109. unlinkPanels: true,
  110. searchRange: true,
  111. format: "yyyy-MM-dd",
  112. valueFormat: "yyyy-MM-dd HH:mm:ss",
  113. searchDefaultTime: ["00:00:00", "23:59:59"],
  114. overHidden: true,
  115. },
  116. {
  117. label: "金额",
  118. prop: "goodsValue",
  119. overHidden: true,
  120. },
  121. {
  122. label: '付汇美元金额',
  123. prop: "paymentInUsd",
  124. width: '140',
  125. overHidden: true,
  126. },
  127. {
  128. label: '当天汇率',
  129. prop: "exchangeRate",
  130. overHidden: true,
  131. },
  132. {
  133. label: '实付金额',
  134. prop: "actualAmount",
  135. overHidden: true,
  136. },
  137. {
  138. label: '邮电费',
  139. prop: "postElectricFee",
  140. overHidden: true,
  141. },
  142. {
  143. label: '手续费',
  144. prop: "serviceCharge",
  145. overHidden: true,
  146. },
  147. {
  148. label: '申报单号',
  149. prop: "declarationNumber",
  150. search: true,
  151. searchOrder: 6,
  152. overHidden: true,
  153. },
  154. {
  155. label: "备注",
  156. prop: "remarks",
  157. overHidden: true
  158. }
  159. ]
  160. },
  161. data: [],
  162. };
  163. },
  164. components: {
  165. detailsPage,
  166. },
  167. async created() {
  168. this.option = await this.getColumnData(this.getColumnName(383), this.optionBack);
  169. },
  170. activated() {
  171. setTimeout(() => {
  172. if (this.$route.query.billNo || this.$route.query.params) {
  173. this.isShow = false
  174. this.$store.commit("IN_EXPUR_DETAIL");
  175. }
  176. }, 100);
  177. },
  178. methods: {
  179. rowEdit(row) {
  180. this.detailData = {
  181. id: row.id
  182. };
  183. this.isShow = false
  184. this.$store.commit("IN_EXPUR_DETAIL");
  185. },
  186. // 编辑
  187. inEdit(row) {
  188. },
  189. searchReset() {
  190. this.query = this.$options.data().query;
  191. this.onLoad(this.page);
  192. },
  193. // 搜索按钮点击
  194. searchChange(params, done) {
  195. this.page.currentPage = 1;
  196. this.onLoad(this.page, this.query);
  197. done();
  198. },
  199. selectionChange(list) {
  200. this.selectionList = list;
  201. },
  202. currentChange(currentPage) {
  203. this.page.currentPage = currentPage;
  204. },
  205. sizeChange(pageSize) {
  206. this.page.pageSize = pageSize;
  207. },
  208. refreshChange() {
  209. this.onLoad(this.page, this.query);
  210. },
  211. onLoad(page, params = {}) {
  212. let obj = {}
  213. obj = {
  214. ...Object.assign(params, this.query),
  215. }
  216. console.log(obj)
  217. this.loading = true;
  218. getList(page.currentPage, page.pageSize, obj).then(res => {
  219. this.data = res.data.data.records;
  220. this.page.total = res.data.data.total;
  221. this.$nextTick(() => {
  222. this.$refs.crud.doLayout();
  223. this.$refs.crud.dicInit();
  224. });
  225. }).finally(() => {
  226. this.loading = false;
  227. })
  228. },
  229. // 详情的返回列表
  230. goBack() {
  231. // 初始化数据
  232. if (JSON.stringify(this.$route.query) != "{}") {
  233. this.$router.$avueRouter.closeTag();
  234. this.$router.push({
  235. path: "/tradeAgency/exchangePurchasing/index"
  236. });
  237. }
  238. this.$store.commit("OUT_EXPUR_DETAIL");
  239. this.detailData = {}
  240. this.isShow = true;
  241. this.onLoad(this.page, this.search);
  242. },
  243. //自定义列保存
  244. async saveColumn(ref, option, optionBack, code) {
  245. /**
  246. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  247. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  248. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  249. */
  250. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  251. if (inSave) {
  252. this.$message.success("保存成功");
  253. //关闭窗口
  254. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  255. this.searchReset()
  256. }
  257. },
  258. //自定义列重置
  259. async resetColumn(ref, option, optionBack, code) {
  260. this[option] = this[optionBack];
  261. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  262. if (inSave) {
  263. this.$message.success("重置成功");
  264. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  265. this.searchReset()
  266. }
  267. },
  268. // 更改表格颜色
  269. headerClassName(tab) {
  270. //颜色间隔
  271. let back = ""
  272. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  273. if (tab.columnIndex % 2 === 0) {
  274. back = "back-one"
  275. } else if (tab.columnIndex % 2 === 1) {
  276. back = "back-two"
  277. }
  278. }
  279. return back;
  280. },
  281. }
  282. }
  283. </script>
  284. <style scoped>
  285. ::v-deep#out-table .back-one {
  286. background: #ecf5ff !important;
  287. text-align: center;
  288. }
  289. ::v-deep#out-table .back-two {
  290. background: #ecf5ff !important;
  291. text-align: center;
  292. }
  293. .pointerClick {
  294. cursor: pointer;
  295. color: #1e9fff;
  296. }
  297. ::v-deep .el-col-md-8 {
  298. width: 24.33333%;
  299. }
  300. </style>