index.vue 14 KB

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