PurchaseOrderRecord.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <a-card :bordered="false">
  3. <div v-show="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="6" :sm="24">
  8. <a-form-item label="设备名称">
  9. <a-input v-model.trim="queryParam.sbName" placeholder="请输入设备名称"/>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="24">
  13. <a-form-item label="设备位号">
  14. <a-input v-model.trim="queryParam.positionNo" placeholder="请输入设备位号"/>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="开始时间">
  19. <a-date-picker
  20. :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
  21. v-model="queryParam.createdTimeStart"
  22. placeholder="开始时间"
  23. />
  24. </a-form-item>
  25. </a-col>
  26. <a-col :md="6" :sm="24">
  27. <a-form-item label="结束时间">
  28. <a-date-picker
  29. :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
  30. v-model="queryParam.createdTimeEnd"
  31. placeholder="结束时间"
  32. />
  33. </a-form-item>
  34. </a-col>
  35. <a-col :md="8 || 24" :sm="24">
  36. <span class="table-page-search-submitButtons">
  37. <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
  38. <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
  39. </span>
  40. </a-col>
  41. </a-row>
  42. </a-form>
  43. </div>
  44. <!-- <div class="table-operator" style="margin-bottom: 8px;">
  45. <a-button v-if="$auth('purchase-purchase-orders-add')" type="primary" icon="plus" @click="$refs.baseModal.base()">新增</a-button>
  46. <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('purchase-purchase-orders-del')">
  47. <a-menu slot="overlay">
  48. <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
  49. <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>
  50. </a-popconfirm>
  51. </a-menu>
  52. <a-button style="margin-left: 8px">
  53. 批量操作 <a-icon type="down" />
  54. </a-button>
  55. </a-dropdown>
  56. </div>-->
  57. <s-table
  58. ref="table"
  59. size="default"
  60. rowKey="id"
  61. :columns="columns"
  62. :scroll="{x: 1, y: BaseTool.Constant.scrollY }"
  63. :data="loadData"
  64. :alert="options.alert"
  65. :rowSelection="options.rowSelection"
  66. showPagination="auto"
  67. >
  68. <span slot="action" slot-scope="record">
  69. <template>
  70. </template>
  71. </span>
  72. </s-table>
  73. </div>
  74. <!-- <purchase-dispatch-order ref="dispatchOrder" @ok="handleOk"/>-->
  75. </a-card>
  76. </template>
  77. <script>
  78. import { STable, Ellipsis } from '@/components'
  79. import { getpurchaseRecord, deletePurchaseOrders } from '@/api/purchase/purchase-order'
  80. export default {
  81. name: 'PurchaseOrderList',
  82. components: {
  83. STable,
  84. Ellipsis
  85. },
  86. data () {
  87. return {
  88. // 查询参数
  89. queryParam: {
  90. },
  91. visible: true,
  92. user: this.$store.getters.userInfo,
  93. dollarExchangeRate: this.$store.getters.rmbRate,
  94. // 表头
  95. columns: [
  96. {
  97. title: '序号',
  98. dataIndex: 'index',
  99. checked: true,
  100. width: 70,
  101. customRender: (text, record, index) => {
  102. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  103. }
  104. },
  105. {
  106. title: '存货编码',
  107. dataIndex: 'no',
  108. checked: true,
  109. width: 200
  110. },
  111. {
  112. title: '规格型号',
  113. dataIndex: 'ggxh',
  114. checked: true,
  115. width: 150
  116. },
  117. {
  118. title: '设备信息',
  119. dataIndex: 'sbInfo',
  120. checked: true,
  121. width: 150
  122. },
  123. {
  124. title: '备件名称',
  125. dataIndex: 'spareName',
  126. checked: true,
  127. width: 150
  128. },
  129. {
  130. title: '仓库名称',
  131. dataIndex: 'storeName',
  132. checked: true,
  133. width: 120
  134. },
  135. {
  136. title: '货架号',
  137. dataIndex: 'storePosition',
  138. checked: true,
  139. width: 100
  140. },
  141. {
  142. title: '采购数量',
  143. dataIndex: 'num',
  144. checked: true,
  145. width: 150
  146. },
  147. {
  148. title: '已采购数量',
  149. dataIndex: 'purchasedNum',
  150. checked: true,
  151. width: 150
  152. },
  153. {
  154. title: '已入库数量',
  155. dataIndex: 'inStoreNum',
  156. checked: true,
  157. width: 150
  158. },
  159. {
  160. title: '明细状态',
  161. width: 100,
  162. dataIndex: 'detailStatus',
  163. checked: true,
  164. customRender: (text, record, index) => {
  165. return this.BaseTool.Table.getMapText(this.detailStatusMap, text)
  166. }
  167. },
  168. {
  169. title: '创建人',
  170. dataIndex: 'createdUserName',
  171. checked: true,
  172. width: 120
  173. },
  174. {
  175. title: '创建时间',
  176. dataIndex: 'createdTime',
  177. checked: true,
  178. width: 120
  179. }
  180. // {
  181. // title: '操作',
  182. // key: 'action',
  183. // width: '200px',
  184. // fixed: 'right',
  185. // checked: true,
  186. // align: 'center',
  187. // scopedSlots: { customRender: 'action' }
  188. // }
  189. ],
  190. // 下拉框map
  191. typeMap: {},
  192. statusMap: {},
  193. detailStatusMap: {},
  194. payTypeMap: {},
  195. invoiceTypeMap: {},
  196. moneyTypeMap: {},
  197. // 加载数据方法 必须为 Promise 对象
  198. loadData: parameter => {
  199. this.queryParam.createdTimeStart = this.queryParam.createdTimeStart ? this.BaseTool.Date.formatter(this.queryParam.createdTimeStart, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) + ' 00:00:00' : null
  200. this.queryParam.createdTimeEnd = this.queryParam.createdTimeEnd ? this.BaseTool.Date.formatter(this.queryParam.createdTimeEnd, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) + ' 23:59:59' : null
  201. parameter = {
  202. ...parameter,
  203. ...this.queryParam,
  204. dataScope: {
  205. sortBy: 'desc',
  206. sortName: 'update_time'
  207. }
  208. }
  209. return getpurchaseRecord(Object.assign(parameter, this.queryParam))
  210. .then(res => {
  211. return res.data
  212. })
  213. },
  214. selectedRowKeys: [],
  215. selectedRows: [],
  216. options: {
  217. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  218. rowSelection: {
  219. selectedRowKeys: this.selectedRowKeys,
  220. onChange: this.onSelectChange
  221. }
  222. },
  223. optionAlertShow: false
  224. }
  225. },
  226. created () {
  227. // 下拉框map
  228. this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PURCHASE_APPLY_TYPE)
  229. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PURCHASE_ORDER_STATUS)
  230. this.payTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PURCHASE_PAY_TYPE)
  231. this.invoiceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PURCHASE_INVOICE_TYPE)
  232. this.moneyTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.MONEY_TYPE)
  233. this.detailStatusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.LONG_YAN_PURCHASE_DETAIL_STATUS)
  234. this.tableOption()
  235. },
  236. methods: {
  237. tableOption () {
  238. if (!this.optionAlertShow) {
  239. this.options = {
  240. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  241. rowSelection: {
  242. selectedRowKeys: this.selectedRowKeys,
  243. onChange: this.onSelectChange,
  244. getCheckboxProps: record => ({
  245. props: {
  246. disabled: false,
  247. name: record.id
  248. }
  249. })
  250. }
  251. }
  252. this.optionAlertShow = true
  253. } else {
  254. this.options = {
  255. alert: false,
  256. rowSelection: null
  257. }
  258. this.optionAlertShow = false
  259. }
  260. },
  261. handleOk () {
  262. this.visible = true
  263. this.$refs.table.refresh()
  264. },
  265. onSelectChange (selectedRowKeys, selectedRows) {
  266. this.selectedRowKeys = selectedRowKeys
  267. this.selectedRows = selectedRows
  268. },
  269. resetSearchForm () {
  270. this.queryParam = {
  271. }
  272. this.$refs.table.refresh(true)
  273. },
  274. batchDelete (id) {
  275. let ids = []
  276. if (this.BaseTool.String.isBlank(id)) {
  277. const length = this.selectedRows.length
  278. if (length === 0) {
  279. this.$message.info('请选择要删除的记录')
  280. return
  281. }
  282. ids = this.selectedRows.map(item => item.id)
  283. } else {
  284. ids = [id]
  285. }
  286. deletePurchaseOrders(ids).then(res => {
  287. this.$message.info('删除成功')
  288. this.handleOk()
  289. this.$refs.table.clearSelected()
  290. })
  291. },
  292. handleEnter () {
  293. this.$refs.table.refresh(true)
  294. }
  295. }
  296. }
  297. </script>