makeInventory.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <div class="makeInventory-wrap">
  3. <a-page-header :ghost="false" @back="handleBack" class="makeInventory-back">
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="makeInventory-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
  7. </template>
  8. <!-- 操作区,位于 title 行的行尾 -->
  9. <!-- <template slot="extra">
  10. <a-button key="1" type="primary" id="makeInventory-print-btn">快速打印</a-button>
  11. <a-button key="2" id="makeInventory-preview-btn">打印预览</a-button>
  12. <a-button key="3" type="danger" @click="handleExport" :loading="exportLoading" id="makeInventory-export-btn">导出</a-button>
  13. <a-button key="4" @click="handleImport" id="makeInventory-import-btn">导入</a-button>
  14. <a-button key="5" type="link" @click="handleDownImport" id="makeInventory-down-import-btn">下载导入模板</a-button>
  15. </template> -->
  16. </a-page-header>
  17. <!-- 详情 -->
  18. <a-card size="small" :bordered="false" class="makeInventory-cont">
  19. <!-- 筛选条件 -->
  20. <div class="table-page-search-wrapper">
  21. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  22. <a-row :gutter="15">
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="产品编码">
  25. <a-input id="makeInventory-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入产品编码"/>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :md="6" :sm="24">
  29. <a-form-item label="产品名称">
  30. <a-input id="makeInventory-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="请输入产品名称"/>
  31. </a-form-item>
  32. </a-col>
  33. <a-col :md="6" :sm="24">
  34. <a-form-item label="产品类别">
  35. <a-cascader :options="typeData" id="makeInventory-state" placeholder="请选择产品类别" allowClear v-model="queryParam.brand" />
  36. </a-form-item>
  37. </a-col>
  38. <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
  39. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="makeInventory-refresh">查询</a-button>
  40. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="makeInventory-reset">重置</a-button>
  41. </a-col>
  42. </a-row>
  43. </a-form>
  44. </div>
  45. <!-- 列表 -->
  46. <s-table
  47. class="sTable"
  48. ref="table"
  49. size="small"
  50. :rowKey="(record) => record.id"
  51. :columns="columns"
  52. :data="loadData"
  53. :scroll="{ x: 1070 }"
  54. bordered>
  55. <!-- 盘点数量 -->
  56. <template slot="outOfStockNum" slot-scope="text, record">
  57. <a-input-number
  58. id="makeInventory-outOfStockNum"
  59. :value="record.outOfStockNum"
  60. :precision="0"
  61. :min="0"
  62. :max="999999"
  63. placeholder="请输入" />
  64. </template>
  65. </s-table>
  66. </a-card>
  67. <a-affix :offset-bottom="0">
  68. <div style="text-align: center;width: 100%;background-color: #fff;padding: 30px 0;box-shadow: 0 0 20px #dcdee2;">
  69. <a-button type="primary" id="makeInventory-submit" size="large" @click="handleSubmit" style="padding: 0 60px;">提交</a-button>
  70. </div>
  71. </a-affix>
  72. </div>
  73. </template>
  74. <script>
  75. import { STable, VSelect } from '@/components'
  76. export default {
  77. components: { STable, VSelect },
  78. data () {
  79. return {
  80. queryParam: {
  81. dataSourceNo: undefined
  82. },
  83. exportLoading: false, // 导出loading
  84. disabled: false, // 查询、重置按钮是否可操作
  85. // 表头
  86. columns: [
  87. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  88. { title: '产品编码', dataIndex: 'creatDate', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  89. { title: '产品名称', dataIndex: 'custName', align: 'center', customRender: function (text) { return text || '--' } },
  90. { title: '单位', dataIndex: 'mementPay', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  91. { title: '仓库', dataIndex: 'memsentPay', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  92. { title: '仓位', dataIndex: 'memendtPay', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  93. { title: '库存数量', dataIndex: 'tostalP', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  94. { title: '盘点数量', scopedSlots: { customRender: 'outOfStockNum' }, width: 150, align: 'center' },
  95. { title: '盈亏数量', dataIndex: 'totalNums', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  96. ],
  97. // 加载数据方法 必须为 Promise 对象
  98. loadData: parameter => {
  99. this.disabled = true
  100. // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
  101. // const data = res.data
  102. // const no = (data.pageNo - 1) * data.pageSize
  103. // for (var i = 0; i < data.list.length; i++) {
  104. // data.list[i].no = no + i + 1
  105. // }
  106. // this.disabled = false
  107. // return data
  108. // })
  109. const _this = this
  110. return new Promise(function (resolve, reject) {
  111. const data = {
  112. pageNo: 1,
  113. pageSize: 10,
  114. list: [
  115. { id: '1', purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
  116. ],
  117. count: 10
  118. }
  119. const no = (data.pageNo - 1) * data.pageSize
  120. for (var i = 0; i < data.list.length; i++) {
  121. data.list[i].no = no + i + 1
  122. }
  123. _this.disabled = false
  124. resolve(data)
  125. })
  126. },
  127. typeData: []
  128. }
  129. },
  130. methods: {
  131. // 返回列表
  132. handleBack () {
  133. this.$router.push({ path: '/inventoryManagement/inventoryChecking/list', query: { closeLastOldTab: true } })
  134. },
  135. // 导入
  136. handleImport () {},
  137. // 下载导入模板
  138. handleDownImport () {},
  139. // 提交
  140. handleSubmit () {},
  141. // 重置
  142. resetSearchForm () {},
  143. // 导出
  144. handleExport () {
  145. const params = this.queryParam
  146. if (this.oldTime && this.oldTime.length > 0) {
  147. params.beginOldExpiryDate = moment(this.oldTime[0]).format('YYYY-MM-DD')
  148. params.endOldExpirydDate = moment(this.oldTime[1]).format('YYYY-MM-DD')
  149. } else {
  150. params.beginOldExpiryDate = ''
  151. params.endOldExpirydDate = ''
  152. }
  153. if (this.newTime && this.newTime.length > 0) {
  154. params.beginDate = moment(this.newTime[0]).format('YYYY-MM-DD')
  155. params.endDate = moment(this.newTime[1]).format('YYYY-MM-DD')
  156. } else {
  157. params.beginDate = ''
  158. params.endDate = ''
  159. }
  160. this.exportLoading = true
  161. customerBundleExportDelay(params).then(res => {
  162. this.exportLoading = false
  163. this.download(res)
  164. })
  165. },
  166. download (data) {
  167. if (!data) { return }
  168. const url = window.URL.createObjectURL(new Blob([data]))
  169. const link = document.createElement('a')
  170. link.style.display = 'none'
  171. link.href = url
  172. const a = moment().format('YYYYMMDDHHmmss')
  173. const fname = '仓库调拨' + a
  174. link.setAttribute('download', fname + '.xlsx')
  175. document.body.appendChild(link)
  176. link.click()
  177. }
  178. }
  179. }
  180. </script>
  181. <style lang="less">
  182. .makeInventory-cont, .makeInventory-back{
  183. margin-bottom: 10px;
  184. }
  185. </style>