PurchaseDispatchOrderListPage.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <a-card :bordered="false" v-if="visible">
  3. <!-- <div class="table-page-search-wrapper" @keyup.enter="handleEnter">-->
  4. <!-- <a-form layout="inline">-->
  5. <!-- <a-row :gutter="48">-->
  6. <!-- <a-col :md="8" :sm="24">-->
  7. <!-- <a-form-item label="关键字">-->
  8. <!-- <a-input v-model="queryParam.keyword" placeholder="请输入名称/类型名称"/>-->
  9. <!-- </a-form-item>-->
  10. <!-- </a-col>-->
  11. <!-- <a-col :md="8 || 24" :sm="24">-->
  12. <!-- <span class="table-page-search-submitButtons">-->
  13. <!-- <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>-->
  14. <!-- <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>-->
  15. <!-- </span>-->
  16. <!-- </a-col>-->
  17. <!-- </a-row>-->
  18. <!-- </a-form>-->
  19. <!-- </div>-->
  20. <div class="table-operator" style="margin-bottom: 8px;">
  21. <!-- <a-button style="margin-left: 8px" v-if="$auth('purchase-purchase-dispatch-order-lists-import')" type="primary" icon="upload" @click="doImport">导入</a-button>-->
  22. <a-button style="margin-left: 8px" v-if="$auth('purchase-purchase-dispatch-order-lists-export')" type="primary" icon="download" @click="doExport">导出</a-button>
  23. </div>
  24. <s-table
  25. ref="table"
  26. size="small"
  27. rowKey="id"
  28. :columns="columns"
  29. :data="loadData"
  30. :scroll="{x: 1, y: BaseTool.Constant.scrollY }"
  31. :alert="options.alert"
  32. :rowSelection="options.rowSelection"
  33. showPagination="auto"
  34. >
  35. </s-table>
  36. <import-form ref="importModal" @ok="handleOk"></import-form>
  37. </a-card>
  38. </template>
  39. <script>
  40. import { STable, Ellipsis } from '@/components'
  41. import ImportForm from './modules/ImportForm'
  42. import { getPurchaseDispatchOrderListPage, exportPurchaseDispatchOrderList } from '@/api/purchase/purchase-dispatch-order-list'
  43. export default {
  44. name: 'PurchaseDispatchOrderListList',
  45. components: {
  46. STable,
  47. ImportForm,
  48. Ellipsis
  49. },
  50. data () {
  51. return {
  52. // 查询参数
  53. queryParam: {
  54. },
  55. visible: false,
  56. dispatchOrderId: '-1',
  57. purchaseOrderId: '-1',
  58. isCreated: false,
  59. // 表头
  60. columns: [
  61. {
  62. title: '序号',
  63. dataIndex: 'index',
  64. checked: true,
  65. width: 70,
  66. customRender: (text, record, index) => {
  67. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  68. }
  69. },
  70. {
  71. title: '编号',
  72. dataIndex: 'no',
  73. checked: true,
  74. width: 200
  75. },
  76. {
  77. title: '名称',
  78. dataIndex: 'name',
  79. checked: true,
  80. width: 150
  81. },
  82. {
  83. title: '规格',
  84. dataIndex: 'specs',
  85. checked: true,
  86. width: 100
  87. },
  88. {
  89. title: '单位',
  90. dataIndex: 'unit',
  91. checked: true,
  92. width: 90
  93. },
  94. {
  95. title: '币种',
  96. dataIndex: 'moneyType',
  97. width: 90,
  98. checked: true,
  99. customRender: (text, record, index) => {
  100. return this.BaseTool.Table.getMapText(this.moneyTypeMap, text)
  101. }
  102. },
  103. {
  104. title: '单价',
  105. dataIndex: 'price',
  106. width: 130,
  107. checked: true,
  108. customRender: (text, record, index) => {
  109. return this.BaseTool.Amount.formatter(text)
  110. }
  111. },
  112. {
  113. title: '总额',
  114. dataIndex: 'totalMoney',
  115. width: 130,
  116. checked: true,
  117. customRender: (text, record, index) => {
  118. return this.BaseTool.Amount.formatter(text)
  119. }
  120. },
  121. {
  122. title: '数量',
  123. dataIndex: 'quantity',
  124. checked: true,
  125. width: 90,
  126. customRender: (text, record, index) => {
  127. return this.BaseTool.Amount.formatter(text)
  128. }
  129. },
  130. {
  131. title: '税额',
  132. dataIndex: 'taxMoney',
  133. width: 90,
  134. checked: true,
  135. customRender: (text, record, index) => {
  136. return this.BaseTool.Amount.formatter(text)
  137. }
  138. },
  139. {
  140. title: '品牌',
  141. dataIndex: 'brand',
  142. width: 90,
  143. checked: true
  144. },
  145. {
  146. title: '适用车型',
  147. dataIndex: 'suitableModel',
  148. width: 150
  149. },
  150. {
  151. title: '车架号',
  152. dataIndex: 'vin',
  153. width: 150
  154. },
  155. {
  156. title: '发动机号',
  157. dataIndex: 'engineNum',
  158. width: 150
  159. },
  160. {
  161. title: '已发运',
  162. dataIndex: 'dispatchedQuantity',
  163. checked: true,
  164. width: 150,
  165. customRender: (text, record, index) => {
  166. return this.BaseTool.Amount.formatter(text)
  167. }
  168. },
  169. {
  170. title: '未发运',
  171. dataIndex: 'notDispatchQuantity',
  172. checked: true,
  173. width: 150,
  174. customRender: (text, record, index) => {
  175. return this.BaseTool.Amount.formatter(text)
  176. }
  177. },
  178. {
  179. title: '产地',
  180. dataIndex: 'producePlace',
  181. width: 90,
  182. checked: true,
  183. customRender: (text, record, index) => {
  184. return this.BaseTool.Table.getMapText(this.areaMap, text)
  185. }
  186. },
  187. {
  188. title: '重量',
  189. dataIndex: 'weight',
  190. width: 100,
  191. checked: true,
  192. customRender: (text, record, index) => {
  193. return this.BaseTool.Amount.formatter(text)
  194. }
  195. },
  196. {
  197. title: '体积',
  198. dataIndex: 'volume',
  199. width: 100,
  200. checked: true,
  201. customRender: (text, record, index) => {
  202. return this.BaseTool.Amount.formatter(text)
  203. }
  204. },
  205. {
  206. title: '外形尺寸',
  207. dataIndex: 'dimension',
  208. width: 100
  209. },
  210. {
  211. title: '备注',
  212. dataIndex: 'remark',
  213. width: 100
  214. },
  215. {
  216. title: '创建人名称',
  217. dataIndex: 'createdUserName',
  218. width: 100
  219. },
  220. {
  221. title: '创建时间',
  222. dataIndex: 'createdTime',
  223. width: 100
  224. }
  225. ],
  226. // 下拉框map
  227. unitMap: {},
  228. areaMap: {},
  229. moneyTypeMap: {},
  230. // 加载数据方法 必须为 Promise 对象
  231. loadData: parameter => {
  232. parameter = {
  233. ...parameter,
  234. ...this.queryParam,
  235. dispatchOrderId: this.dispatchOrderId,
  236. purchaseOrderId: this.purchaseOrderId,
  237. dataScope: {
  238. sortBy: 'desc',
  239. sortName: 'update_time'
  240. }
  241. }
  242. return getPurchaseDispatchOrderListPage(Object.assign(parameter, this.queryParam))
  243. .then(res => {
  244. return res.data
  245. })
  246. },
  247. selectedRowKeys: [],
  248. selectedRows: [],
  249. options: {
  250. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  251. rowSelection: {
  252. selectedRowKeys: this.selectedRowKeys,
  253. onChange: this.onSelectChange
  254. }
  255. },
  256. optionAlertShow: false
  257. }
  258. },
  259. created () {
  260. // 下拉框map
  261. this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
  262. this.areaMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PRODUCER_AREA)
  263. this.moneyTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.MONEY_TYPE)
  264. this.tableOption()
  265. },
  266. methods: {
  267. base (dispatchOrderId, purchaseOrderId) {
  268. this.visible = true
  269. this.dispatchOrderId = dispatchOrderId
  270. this.purchaseOrderId = purchaseOrderId
  271. if (this.isCreated) {
  272. this.handleOk()
  273. } else {
  274. this.tableOption()
  275. this.isCreated = true
  276. }
  277. this.visible = true
  278. },
  279. tableOption () {
  280. if (!this.optionAlertShow) {
  281. this.options = {
  282. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  283. rowSelection: {
  284. selectedRowKeys: this.selectedRowKeys,
  285. onChange: this.onSelectChange,
  286. getCheckboxProps: record => ({
  287. props: {
  288. disabled: false,
  289. name: record.id
  290. }
  291. })
  292. }
  293. }
  294. this.optionAlertShow = true
  295. } else {
  296. this.options = {
  297. alert: false,
  298. rowSelection: null
  299. }
  300. this.optionAlertShow = false
  301. }
  302. },
  303. handleOk () {
  304. this.$nextTick(() => {
  305. this.$refs.table.refresh()
  306. })
  307. },
  308. onSelectChange (selectedRowKeys, selectedRows) {
  309. this.selectedRowKeys = selectedRowKeys
  310. this.selectedRows = selectedRows
  311. },
  312. resetSearchForm () {
  313. this.queryParam = {
  314. dispatchOrderId: this.dispatchOrderId
  315. }
  316. this.$refs.table.refresh(true)
  317. },
  318. doImport () {
  319. this.$refs.importModal.base(this.dispatchOrderId)
  320. },
  321. doExport () {
  322. const parameter = {
  323. ...this.queryParam,
  324. dispatchOrderId: this.dispatchOrderId,
  325. purchaseOrderId: this.purchaseOrderId
  326. }
  327. exportPurchaseDispatchOrderList(parameter).then(file => {
  328. this.BaseTool.UPLOAD.downLoadExportExcel(file)
  329. })
  330. },
  331. handleCancel (values) {
  332. this.visible = false
  333. this.$emit('ok', values)
  334. },
  335. handleEnter () {
  336. this.$refs.table.refresh(true)
  337. }
  338. }
  339. }
  340. </script>