PurchaseDispatchFee.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <a-card :bordered="false">
  3. <div v-if="visible">
  4. <!-- <div class="table-page-search-wrapper" @keyup.enter="handleEnter">-->
  5. <!-- <a-form layout="inline">-->
  6. <!-- <a-row :gutter="48">-->
  7. <!-- <a-col :md="8" :sm="24">-->
  8. <!-- <a-form-item label="关键字">-->
  9. <!-- <a-input v-model="queryParam.keyword" placeholder="请输入名称/类型名称"/>-->
  10. <!-- </a-form-item>-->
  11. <!-- </a-col>-->
  12. <!-- <a-col :md="8 || 24" :sm="24">-->
  13. <!-- <span class="table-page-search-submitButtons">-->
  14. <!-- <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>-->
  15. <!-- <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>-->
  16. <!-- </span>-->
  17. <!-- </a-col>-->
  18. <!-- </a-row>-->
  19. <!-- </a-form>-->
  20. <!-- </div>-->
  21. <!-- <div class="table-operator" style="margin-bottom: 8px;">-->
  22. <!-- <a-button v-if="$auth('purchase-purchase-dispatch-fees-add')" type="primary" icon="plus" @click="$refs.baseModal.base()">新增</a-button>-->
  23. <!-- <a-button style="margin-left: 8px" v-if="$auth('purchase-purchase-dispatch-fees-export')" type="primary" icon="download" @click="doExport">导出</a-button>-->
  24. <!-- <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('purchase-purchase-dispatch-fees-del')">-->
  25. <!-- <a-menu slot="overlay">-->
  26. <!-- <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">-->
  27. <!-- <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>-->
  28. <!-- </a-popconfirm>-->
  29. <!-- </a-menu>-->
  30. <!-- <a-button style="margin-left: 8px">-->
  31. <!-- 批量操作 <a-icon type="down" />-->
  32. <!-- </a-button>-->
  33. <!-- </a-dropdown>-->
  34. <!-- </div>-->
  35. <s-table
  36. ref="table"
  37. size="small"
  38. rowKey="id"
  39. :columns="columns"
  40. :scroll="{ y: BaseTool.Constant.scrollY }"
  41. :data="loadData"
  42. :showSizeChanger="showSizeChanger"
  43. :showPagination="showSizeChanger"
  44. >
  45. </s-table>
  46. <base-form ref="baseModal" @ok="handleOk"/>
  47. <detail ref="detailModal"/>
  48. </div>
  49. </a-card>
  50. </template>
  51. <script>
  52. import { STable, Ellipsis } from '@/components'
  53. import BaseForm from './modules/BaseForm'
  54. import Detail from './modules/Detail'
  55. import { getPurchaseDispatchFeePage, deletePurchaseDispatchFees, fetchPurchaseDispatchFee, exportPurchaseDispatchFee } from '@/api/purchase/purchase-dispatch-fee'
  56. export default {
  57. name: 'PurchaseDispatchFeeList',
  58. components: {
  59. STable,
  60. Ellipsis,
  61. BaseForm,
  62. Detail
  63. },
  64. data () {
  65. return {
  66. // 查询参数
  67. queryParam: {
  68. pageSize: 9999
  69. },
  70. visible: false,
  71. dispatchOrderId: '-1',
  72. showSizeChanger: false,
  73. // 表头
  74. columns: [
  75. {
  76. title: '序号',
  77. dataIndex: 'index',
  78. customRender: (text, record, index) => {
  79. return `${index + 1}`
  80. }
  81. },
  82. {
  83. title: '费用类别',
  84. dataIndex: 'feeType',
  85. customRender: (text, record, index) => {
  86. return this.BaseTool.Table.getMapText(this.feeTypeMap, text)
  87. }
  88. },
  89. {
  90. title: '公司/单位',
  91. dataIndex: 'mainItem'
  92. },
  93. {
  94. title: '船运/保单号/摘要',
  95. dataIndex: 'subItem'
  96. },
  97. {
  98. title: '费用',
  99. dataIndex: 'money',
  100. customRender: (text, record, index) => {
  101. return this.BaseTool.Amount.formatter(text)
  102. }
  103. },
  104. {
  105. title: '费用(按项目主币)',
  106. dataIndex: 'accountMoney',
  107. customRender: (text, record, index) => {
  108. return this.BaseTool.Amount.formatter(text)
  109. }
  110. },
  111. {
  112. title: '币种',
  113. dataIndex: 'moneyType',
  114. customRender: (text, record, index) => {
  115. return this.BaseTool.Table.getMapText(this.moneyTypeMap, text)
  116. }
  117. },
  118. {
  119. title: '汇率',
  120. dataIndex: 'exchangeRate',
  121. customRender: (text, record, index) => {
  122. return this.BaseTool.Amount.formatter(text)
  123. }
  124. }
  125. ],
  126. // 下拉框map
  127. moneyTypeMap: {},
  128. feeTypeMap: {},
  129. // 加载数据方法 必须为 Promise 对象
  130. loadData: parameter => {
  131. parameter = {
  132. ...parameter,
  133. ...this.queryParam,
  134. dispatchOrderId: this.dispatchOrderId,
  135. dataScope: {
  136. sortBy: 'desc',
  137. sortName: 'update_time'
  138. }
  139. }
  140. return getPurchaseDispatchFeePage(parameter)
  141. .then(res => {
  142. return res.data
  143. })
  144. },
  145. selectedRowKeys: [],
  146. selectedRows: [],
  147. isCreated: false,
  148. options: {
  149. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  150. rowSelection: {
  151. selectedRowKeys: this.selectedRowKeys,
  152. onChange: this.onSelectChange
  153. }
  154. },
  155. optionAlertShow: false
  156. }
  157. },
  158. created () {
  159. // 下拉框map
  160. this.moneyTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.MONEY_TYPE)
  161. this.feeTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PURCHASE_DISPATCH_FEE_TYPE)
  162. this.tableOption()
  163. },
  164. methods: {
  165. base (id) {
  166. this.visible = true
  167. this.dispatchOrderId = id
  168. if (this.isCreated) {
  169. this.handleOk()
  170. } else {
  171. this.tableOption()
  172. this.isCreated = true
  173. }
  174. this.visible = true
  175. },
  176. tableOption () {
  177. if (!this.optionAlertShow) {
  178. this.options = {
  179. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  180. rowSelection: {
  181. selectedRowKeys: this.selectedRowKeys,
  182. onChange: this.onSelectChange,
  183. getCheckboxProps: record => ({
  184. props: {
  185. disabled: false,
  186. name: record.id
  187. }
  188. })
  189. }
  190. }
  191. this.optionAlertShow = true
  192. } else {
  193. this.options = {
  194. alert: false,
  195. rowSelection: null
  196. }
  197. this.optionAlertShow = false
  198. }
  199. },
  200. batchDelete (id) {
  201. let ids = []
  202. if (this.BaseTool.String.isBlank(id)) {
  203. const length = this.selectedRows.length
  204. if (length === 0) {
  205. this.$message.info('请选择要删除的记录')
  206. return
  207. }
  208. ids = this.selectedRows.map(item => item.id)
  209. } else {
  210. ids = [id]
  211. }
  212. deletePurchaseDispatchFees(ids).then(res => {
  213. this.$message.info('删除成功')
  214. this.handleOk()
  215. this.$refs.table.clearSelected()
  216. })
  217. },
  218. handleEdit (record) {
  219. fetchPurchaseDispatchFee({ id: record.id }).then(res => {
  220. const modal = this.$refs.baseModal
  221. modal.base(res.data)
  222. })
  223. },
  224. handleView (record) {
  225. fetchPurchaseDispatchFee({ id: record.id }).then(res => {
  226. const modal = this.$refs.detailModal
  227. modal.base(res.data)
  228. })
  229. },
  230. handleOk () {
  231. this.$refs.table.refresh()
  232. },
  233. onSelectChange (selectedRowKeys, selectedRows) {
  234. this.selectedRowKeys = selectedRowKeys
  235. this.selectedRows = selectedRows
  236. },
  237. resetSearchForm () {
  238. this.queryParam = {
  239. }
  240. this.$refs.table.refresh(true)
  241. },
  242. doExport () {
  243. const parameter = {
  244. ...this.queryParam
  245. }
  246. exportPurchaseDispatchFee(parameter).then(file => {
  247. this.BaseTool.UPLOAD.downLoadExportExcel(file)
  248. })
  249. },
  250. handleEnter () {
  251. this.$refs.table.refresh(true)
  252. }
  253. }
  254. }
  255. </script>