list.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <a-spin :spinning="spinning" tip="Loading...">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form-model
  6. id="chainTransferInReport-form"
  7. ref="ruleForm"
  8. class="form-model-con"
  9. layout="inline"
  10. :model="queryParam"
  11. :rules="rules"
  12. :labelCol="labelCol"
  13. :wrapperCol="wrapperCol"
  14. @keyup.enter.native="handleSearch" >
  15. <a-row :gutter="15">
  16. <a-col :md="6" :sm="24">
  17. <a-form-model-item label="入库时间" prop="time">
  18. <rangeDate ref="rangeDate" @change="dateChange" />
  19. </a-form-model-item>
  20. </a-col>
  21. <a-col :md="6" :sm="24">
  22. <a-form-model-item label="连锁调入单号">
  23. <a-input id="chainTransferInReport-allocationLinkagePutNo" v-model.trim="queryParam.allocationLinkagePutNo" allowClear placeholder="请输入连锁调入单号"/>
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :md="4" :sm="24">
  27. <a-form-item label="调出对象">
  28. <outTenant id="chainTransferInReport-outTenantSn" v-model="queryParam.outTenantSn"></outTenant>
  29. </a-form-item>
  30. </a-col>
  31. <a-col :md="4" :sm="24">
  32. <a-form-item label="调拨产品类型">
  33. <v-select
  34. v-model="queryParam.allocationType"
  35. ref="allocationType"
  36. id="chainTransferInReport-allocationType"
  37. code="ALLOCATION_LINKAGE_PRODUCT_TYPE"
  38. placeholder="请选择调拨产品类型"
  39. allowClear></v-select>
  40. </a-form-item>
  41. </a-col>
  42. <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
  43. <a-button type="primary" @click="handleSearch" :disabled="disabled" id="chainTransferInReport-refresh">查询</a-button>
  44. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chainTransferInReport-reset">重置</a-button>
  45. <a-button
  46. type="primary"
  47. style="margin-left: 5px"
  48. @click="handleExport"
  49. :disabled="disabled"
  50. :loading="exportLoading"
  51. v-if="$hasPermissions('M_chainTransferInReportExport')"
  52. class="button-warning"
  53. id="chainTransferInReport-export-btn">导出</a-button>
  54. </a-col>
  55. </a-row>
  56. </a-form-model>
  57. </div>
  58. <!-- 合计 -->
  59. <a-alert type="info" style="margin-bottom:10px">
  60. <div class="ftext" slot="message">
  61. 总单数:<strong>{{ (totalData && (totalData.totalCount || totalData.totalCount==0)) ? totalData.totalCount : '--' }}</strong>;
  62. 产品总数量:<strong>{{ (totalData && (totalData.productTotalQty || totalData.productTotalQty==0)) ? totalData.productTotalQty : '--' }}</strong>;
  63. <div v-if="$hasPermissions('M_ShowAllCost')" style="display: inline-block;">
  64. 调入总成本:<strong>{{ (totalData && (totalData.productTotalCost || totalData.productTotalCost==0)) ? toThousands(totalData.productTotalCost) : '--' }}</strong>;
  65. </div>
  66. </div>
  67. </a-alert>
  68. <!-- 列表 -->
  69. <s-table
  70. class="sTable"
  71. ref="table"
  72. size="small"
  73. :rowKey="(record) => record.id"
  74. :columns="columns"
  75. :data="loadData"
  76. :defaultLoadData="false"
  77. bordered>
  78. </s-table>
  79. </a-spin>
  80. </template>
  81. <script>
  82. import { commonMixin } from '@/utils/mixin'
  83. import { STable, VSelect } from '@/components'
  84. import rangeDate from '@/views/common/rangeDate.vue'
  85. import { downloadExcel } from '@/libs/JGPrint.js'
  86. import outTenant from '@/views/common/outTenant.js'
  87. import { reportAllocLinkagePutList, reportAllocLinkagePutCount, reportAllocLinkagePutExport } from '@/api/reportData'
  88. export default {
  89. components: { STable, VSelect, rangeDate, outTenant },
  90. mixins: [commonMixin],
  91. data () {
  92. return {
  93. spinning: false,
  94. labelCol: { span: 8 },
  95. wrapperCol: { span: 16 },
  96. advanced: false, // 高级搜索 展开/关闭
  97. tableHeight: 0,
  98. queryParam: { // 查询条件
  99. time:[],
  100. beginDate: '',
  101. endDate: '',
  102. outTenantSn:undefined,
  103. allocationType: undefined,
  104. allocationLinkagePutNo: ''
  105. },
  106. rules: {
  107. 'time': [{ required: true, message: '请选择入库时间', trigger: 'change' }]
  108. },
  109. disabled: false, // 查询、重置按钮是否可操作
  110. exportLoading: false,
  111. // 加载数据方法 必须为 Promise 对象
  112. loadData: parameter => {
  113. this.disabled = true
  114. const params = Object.assign(parameter, this.queryParam)
  115. this.spinning = true
  116. delete params.time
  117. return reportAllocLinkagePutList(params).then(res => {
  118. let data
  119. if (res.status == 200) {
  120. data = res.data
  121. // 总计
  122. this.getCount(params)
  123. const no = (data.pageNo - 1) * data.pageSize
  124. for (var i = 0; i < data.list.length; i++) {
  125. data.list[i].no = no + i + 1
  126. }
  127. this.disabled = false
  128. }
  129. this.spinning = false
  130. return data
  131. })
  132. },
  133. totalData: null, // 合计
  134. storeCallOutTypeList: [] // 调拨类型
  135. }
  136. },
  137. computed: {
  138. columns () {
  139. const _this = this
  140. const arr = [
  141. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  142. { title: '连锁调入单号', dataIndex: 'allocationLinkagePutNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  143. { title: '调出对象', dataIndex: 'outTenantName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  144. { title: '款数', dataIndex: 'productTotalCategory', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  145. { title: '数量', dataIndex: 'productTotalQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  146. { title: '入库时间', dataIndex: 'putWarehouseTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  147. { title: '调拨产品类型', dataIndex: 'allocationTypeDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
  148. ]
  149. if (this.$hasPermissions('M_ShowAllCost')) {
  150. arr.splice(5, 0, { title: '成本', dataIndex: 'productTotalCost', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  151. }
  152. return arr
  153. }
  154. },
  155. methods: {
  156. // 合计
  157. getCount (params) {
  158. reportAllocLinkagePutCount(params).then(res => {
  159. if (res.status == 200) {
  160. this.totalData = res.data
  161. } else {
  162. this.totalData = null
  163. }
  164. })
  165. },
  166. // 创建时间 change
  167. dateChange (date) {
  168. this.queryParam.time = date
  169. this.queryParam.beginDate = date[0] || ''
  170. this.queryParam.endDate = date[1] || ''
  171. },
  172. // 查询
  173. handleSearch () {
  174. this.$refs.ruleForm.validate(valid => {
  175. if (valid) {
  176. this.$refs.table.refresh(true)
  177. } else {
  178. return false
  179. }
  180. })
  181. },
  182. // 重置
  183. resetSearchForm () {
  184. this.queryParam.time = []
  185. this.$refs.rangeDate.resetDate()
  186. this.queryParam.beginDate = ''
  187. this.queryParam.endDate = ''
  188. this.queryParam.allocationType = undefined
  189. this.queryParam.outTenantSn = undefined
  190. this.queryParam.allocationLinkagePutNo = ''
  191. this.$refs.ruleForm.resetFields()
  192. this.totalData = null
  193. this.$refs.table.clearTable()
  194. },
  195. // 导出
  196. handleExport () {
  197. const _this = this
  198. this.$refs.ruleForm.validate(valid => {
  199. if (valid) {
  200. const params = _this.queryParam
  201. params.costFlag = this.$hasPermissions('M_ShowAllCost') ? '1' : '0'
  202. _this.exportLoading = true
  203. _this.spinning = true
  204. reportAllocLinkagePutExport(params).then(res => {
  205. downloadExcel(res, '连锁调入报表')
  206. _this.exportLoading = false
  207. _this.spinning = false
  208. })
  209. } else {
  210. return false
  211. }
  212. })
  213. },
  214. },
  215. mounted () {
  216. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  217. this.resetSearchForm()
  218. }
  219. },
  220. activated () {
  221. // 如果是新页签打开,则重置当前页面
  222. if (this.$store.state.app.isNewTab) {
  223. this.resetSearchForm()
  224. }
  225. },
  226. beforeRouteEnter (to, from, next) {
  227. next(vm => {})
  228. }
  229. }
  230. </script>