freightRate.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <div>
  3. <el-dialog title="提取运价" :visible.sync="dialogVisible" append-to-body width="60%" :before-close="handleClose">
  4. <avue-crud v-if="dialogVisible" :option="option" :table-loading="loading" :data="data" ref="crud"
  5. @current-row-change="handleCurrentRowChange" id="out-table" :header-cell-class-name="headerClassName"
  6. @on-load="onLoad">
  7. </avue-crud>
  8. <span slot="footer" class="dialog-footer">
  9. <el-button @click="dialogVisible = false" size="mini">取 消</el-button>
  10. <el-button type="primary" @click="submit" size="mini">导 入</el-button>
  11. </span>
  12. </el-dialog>
  13. </div>
  14. </template>
  15. <script>
  16. import { MktSlotQuotation, quotationImportBatch } from "@/api/iosBasicData/bills";
  17. export default {
  18. props: {
  19. },
  20. data() {
  21. return {
  22. quotationId: null,
  23. ids: null,
  24. data: [],
  25. dialogVisible: false,
  26. loading: false,
  27. option: {
  28. height: 500,
  29. calcHeight: 30,
  30. border: true,
  31. index: true,
  32. addBtn: false,
  33. viewBtn: false,
  34. delBtn: false,
  35. editBtn: false,
  36. menu: false,
  37. header: false,
  38. highlightCurrentRow: true,
  39. column: [
  40. {
  41. label: "船公司",
  42. prop: "actualShippingCompanyCname",
  43. width: "160",
  44. overHidden: true,
  45. },
  46. {
  47. label: "开船日期",
  48. prop: "etd",
  49. width: "160",
  50. overHidden: true,
  51. },
  52. {
  53. label: "起运港",
  54. prop: "polEnName",
  55. width: "160",
  56. overHidden: true,
  57. },
  58. {
  59. label: "目的港",
  60. prop: "podEnName",
  61. width: "160",
  62. overHidden: true,
  63. },
  64. {
  65. label: "20GP",
  66. prop: "gp20",
  67. width: "160",
  68. overHidden: true,
  69. },
  70. {
  71. label: "40GP",
  72. prop: "gp40",
  73. width: "160",
  74. overHidden: true,
  75. },
  76. {
  77. label: "40HC",
  78. prop: "hc40",
  79. width: "160",
  80. overHidden: true,
  81. },
  82. {
  83. label: "20GP(COST)",
  84. prop: "gp20Cost",
  85. width: "100",
  86. overHidden: true,
  87. },
  88. {
  89. label: "40GP(COST)",
  90. prop: "gp40Cost",
  91. width: "100",
  92. overHidden: true,
  93. },
  94. {
  95. label: "40HC(COST)",
  96. prop: "hc40Cost",
  97. width: "100",
  98. overHidden: true,
  99. }
  100. ]
  101. },
  102. }
  103. },
  104. async created() {
  105. // this.option = await this.getColumnData(this.getColumnName(309.6), this.optionBack);
  106. },
  107. methods: {
  108. openDialog(val, ids) {
  109. this.dialogVisible = true
  110. this.quotationId = null
  111. this.ids = ids
  112. let obj = {
  113. ...val
  114. }
  115. this.loading = true
  116. MktSlotQuotation(obj).then(res => {
  117. this.data = res.data.data
  118. }).finally(() => {
  119. this.loading = false
  120. })
  121. },
  122. handleCurrentRowChange(val) {
  123. this.quotationId = val.id
  124. },
  125. submit() {
  126. if (!this.quotationId) {
  127. return this.$message.error("请选择数据");
  128. }
  129. const obj = {
  130. billsIds: this.ids,
  131. quotationId: this.quotationId
  132. }
  133. const loading = this.$loading({
  134. lock: true,
  135. text: '加载中',
  136. spinner: 'el-icon-loading',
  137. background: 'rgba(255,255,255,0.7)'
  138. });
  139. quotationImportBatch(obj).then(res => {
  140. this.$message.success("操作成功");
  141. this.dialogVisible = false;
  142. this.$emit('refreshPage')
  143. }).finally(() => {
  144. loading.close();
  145. })
  146. },
  147. //自定义列保存
  148. async saveColumn(ref, option, optionBack, code) {
  149. /**
  150. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  151. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  152. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  153. */
  154. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  155. if (inSave) {
  156. this.$message.success("保存成功");
  157. //关闭窗口
  158. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  159. this.searchReset()
  160. }
  161. },
  162. //自定义列重置
  163. async resetColumn(ref, option, optionBack, code) {
  164. this[option] = this[optionBack];
  165. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  166. if (inSave) {
  167. this.$message.success("重置成功");
  168. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  169. }
  170. },
  171. // 更改表格颜色
  172. headerClassName(tab) {
  173. //颜色间隔
  174. let back = ""
  175. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  176. if (tab.columnIndex % 2 === 0) {
  177. back = "back-one"
  178. } else if (tab.columnIndex % 2 === 1) {
  179. back = "back-two"
  180. }
  181. }
  182. return back;
  183. },
  184. }
  185. }
  186. </script>
  187. <style scoped>
  188. ::v-deep#out-table .back-one {
  189. background: #ecf5ff !important;
  190. text-align: center;
  191. padding: 4px 0;
  192. }
  193. ::v-deep#out-table .back-two {
  194. background: #ecf5ff !important;
  195. text-align: center;
  196. padding: 4px 0;
  197. }
  198. </style>