list.vue 9.5 KB

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