list.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <a-card :bordered="false" class="outboundOrderList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  6. <a-row :gutter="15">
  7. <a-col :md="8" :sm="24">
  8. <a-form-item label="审核时间">
  9. <a-range-picker
  10. style="width:100%"
  11. id="outboundOrderList-creatTime"
  12. :disabledDate="disabledDate"
  13. v-model="time"
  14. :format="dateFormat"
  15. :placeholder="['开始时间', '结束时间']" />
  16. </a-form-item>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="6" :sm="24">
  20. <a-form-item label="客户名称">
  21. <a-select
  22. id="outboundOrderList-bundleName"
  23. placeholder="请选择"
  24. allowClear
  25. v-model="queryParam.dataSourceNo"
  26. :showSearch="true"
  27. option-filter-prop="children"
  28. :filter-option="filterOption">
  29. <a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
  30. </a-select>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="5" :sm="24">
  34. <a-form-item label="出库类型">
  35. <v-select
  36. v-model="queryParam.outType"
  37. ref="outType"
  38. id="outboundOrderList-outType"
  39. code="PAYMENT_TYPE"
  40. placeholder="请选择出库类型"
  41. allowClear></v-select>
  42. </a-form-item>
  43. </a-col>
  44. <template v-if="advanced">
  45. <a-col :md="5" :sm="24">
  46. <a-form-item label="单据状态">
  47. <v-select
  48. v-model="queryParam.billStatus"
  49. ref="billStatus"
  50. id="outboundOrderList-billStatus"
  51. code="PAYMENT_TYPE"
  52. placeholder="请选择单据状态"
  53. allowClear></v-select>
  54. </a-form-item>
  55. </a-col>
  56. </template>
  57. <a-col :md="5" :sm="24">
  58. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="outboundOrderList-refresh">查询</a-button>
  59. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="outboundOrderList-reset">重置</a-button>
  60. <a @click="advanced=!advanced" style="margin-left: 8px">
  61. {{ advanced ? '收起' : '展开' }}
  62. <a-icon :type="advanced ? 'up' : 'down'"/>
  63. </a>
  64. </a-col>
  65. </a-row>
  66. </a-form>
  67. </div>
  68. <!-- 列表 -->
  69. <div style="margin-bottom: 15px">
  70. <a-button type="primary" id="outboundOrder-export" :disabled="!hasSelected" :loading="loading" @click="handleOutbounds">
  71. 批量出库
  72. </a-button>
  73. <span style="margin-left: 8px">
  74. <template v-if="hasSelected">
  75. {{ `已选 ${selectedRowKeys.length} 项` }}
  76. </template>
  77. </span>
  78. </div>
  79. <s-table
  80. class="sTable"
  81. ref="table"
  82. size="default"
  83. :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  84. :rowKey="(record) => record.id"
  85. :columns="columns"
  86. :data="loadData"
  87. :showPagination="false"
  88. bordered>
  89. <!-- 状态 -->
  90. <template slot="state" slot-scope="text, record">
  91. <span :class="[record.state == 1 ? 'green' : 'red']">{{ record.state == 1 ? '已出库' : '未出库' }}</span>
  92. </template>
  93. <!-- 操作 -->
  94. <template slot="action" slot-scope="text, record">
  95. <a-button size="small" type="primary" @click="handleOutbound(record)" id="outboundOrderList-out-btn">出库</a-button>
  96. <a-button size="small" @click="handleDetail(record)" style="margin-left: 10px;" id="outboundOrderList-detail-btn">明细</a-button>
  97. </template>
  98. </s-table>
  99. </a-card>
  100. </template>
  101. <script>
  102. import moment from 'moment'
  103. // import { customerBundleDelayList, customerBundleExportDelay } from '@/api/FinancialManagement'
  104. import { STable, VSelect } from '@/components'
  105. export default {
  106. components: { STable, VSelect },
  107. data () {
  108. return {
  109. advanced: false, // 高级搜索 展开/关闭
  110. queryParam: { // 查询条件
  111. bundleName: '', // 供应商名称
  112. state: undefined // 状态
  113. },
  114. disabled: false, // 查询、重置按钮是否可操作
  115. dateFormat: 'YYYY-MM-DD',
  116. time: [], // 创建时间
  117. brandData: [], // 客户 下拉数据
  118. columns: [
  119. { title: '序号', dataIndex: 'no', width: 100, align: 'center' },
  120. { title: '创建时间', dataIndex: 'inventoryMoneys', width: 180, align: 'center' },
  121. { title: '关联单号', dataIndex: 'productName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
  122. { title: '客户名称', dataIndex: 'productBrand', width: 200, align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
  123. { title: '总款数', dataIndex: 'productType', width: 200, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  124. { title: '总数量', dataIndex: 'inventoryNum', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  125. { title: '总售价', dataIndex: 'totalPrice', width: 180, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  126. { title: '审核时间', dataIndex: 'authTime', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
  127. { title: '出库时间', dataIndex: 'outTime', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
  128. { title: '出库状态', scopedSlots: { customRender: 'state' }, width: 180, align: 'center' },
  129. { title: '操作', scopedSlots: { customRender: 'action' }, width: 240, align: 'center' }
  130. ],
  131. selectedRowKeys: [], // Check here to configure the default column
  132. loading: false,
  133. // 加载数据方法 必须为 Promise 对象
  134. loadData: parameter => {
  135. this.disabled = true
  136. // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
  137. // const data = res.data
  138. // const no = (data.pageNo - 1) * data.pageSize
  139. // for (var i = 0; i < data.list.length; i++) {
  140. // data.list[i].no = no + i + 1
  141. // }
  142. // this.disabled = false
  143. // return data
  144. // })
  145. const _this = this
  146. return new Promise(function (resolve, reject) {
  147. const data = {
  148. pageNo: 1,
  149. pageSize: 10,
  150. list: [
  151. { id: '1', productNum: 'jgqp11111111111', productName: '产品1', productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', productType: '产品分类1', inventoryNum: '5', inventoryMoney: '122' }
  152. ]
  153. }
  154. const no = (data.pageNo - 1) * data.pageSize
  155. for (var i = 0; i < data.list.length; i++) {
  156. data.list[i].no = no + i + 1
  157. }
  158. _this.disabled = false
  159. resolve(data)
  160. })
  161. }
  162. }
  163. },
  164. computed: {
  165. hasSelected () {
  166. return this.selectedRowKeys.length > 0
  167. }
  168. },
  169. methods: {
  170. // 不可选日期
  171. disabledDate (date, dateStrings) {
  172. return date && date.valueOf() > Date.now()
  173. },
  174. filterOption (input, option) {
  175. return (
  176. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  177. )
  178. },
  179. // 重置
  180. resetSearchForm () {
  181. this.queryParam.orderBundleNo = ''
  182. this.queryParam.orderBundle.custMobile = ''
  183. this.queryParam.bundleName = ''
  184. this.queryParam.itemName = ''
  185. this.oldTime = undefined
  186. this.newTime = undefined
  187. this.$refs.table.refresh(true)
  188. },
  189. // 详情
  190. handleDetail (row) {
  191. this.$router.push({ name: 'outboundOrderDetail', params: { id: row.id } })
  192. },
  193. // 单个出库
  194. handleOutbound (row) {
  195. this.$confirm({
  196. title: '提升',
  197. content: '确认要出库吗?',
  198. onOk () {
  199. console.log('OK')
  200. },
  201. onCancel () {
  202. console.log('Cancel')
  203. }
  204. })
  205. },
  206. // 批量出库
  207. handleOutbounds () {
  208. this.loading = true
  209. // ajax request after empty completing
  210. setTimeout(() => {
  211. this.loading = false
  212. this.selectedRowKeys = []
  213. }, 1000)
  214. },
  215. onSelectChange (selectedRowKeys) {
  216. console.log('selectedRowKeys changed: ', selectedRowKeys)
  217. this.selectedRowKeys = selectedRowKeys
  218. }
  219. }
  220. }
  221. </script>
  222. <style lang="less">
  223. .outboundOrderList-wrap{
  224. .sTable{
  225. margin-top: 20px;
  226. table{
  227. width: auto;
  228. }
  229. }
  230. .red{
  231. color: #ff0000;
  232. }
  233. .green{
  234. color: #19be6b;
  235. }
  236. }
  237. </style>