list.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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="6" :sm="24">
  33. <a-form-item label="调往对象">
  34. <getTenantList id="chainCallReportExport-putTenantSn" type="out" state="FINISH" placeholder="请选择调往对象" v-model="queryParam.putTenantSn"></getTenantList>
  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)) ? toThousands(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 getTenantList from '@/views/common/getTenantList.js'
  98. import { reportAllocLinkageOutList, reportAllocLinkageOutCount, reportAllocLinkageOutExport } from '@/api/reportData'
  99. export default {
  100. components: { STable, VSelect, rangeDate, getTenantList },
  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 _this = this
  153. const arr = [
  154. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  155. { title: '连锁调出单号', dataIndex: 'allocationLinkageOutNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  156. { title: '调往对象', dataIndex: 'putTenantName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  157. { title: '款数', dataIndex: 'productTotalCategory', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  158. { title: '数量', dataIndex: 'productTotalQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  159. { title: '审核时间', dataIndex: 'auditTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  160. { title: '出库时间', dataIndex: 'outWarehouseTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  161. { title: '调拨类型', dataIndex: 'allocationTypeDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
  162. ]
  163. if (this.$hasPermissions('M_ShowAllCost')) {
  164. arr.splice(5, 0, { title: '成本', dataIndex: 'productTotalCost', width: '7%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  165. }
  166. return arr
  167. }
  168. },
  169. methods: {
  170. // 合计
  171. getCount (params) {
  172. reportAllocLinkageOutCount(params).then(res => {
  173. if (res.status == 200) {
  174. this.totalData = res.data
  175. } else {
  176. this.totalData = null
  177. }
  178. })
  179. },
  180. // 创建时间 change
  181. dateChange (date) {
  182. this.queryParam.time = date
  183. this.queryParam.auditBeginDate = date[0] || ''
  184. this.queryParam.auditEndDate = date[1] || ''
  185. },
  186. outWareDateChange (date) {
  187. this.queryParam.outWarehouseBeginDate = date[0]
  188. this.queryParam.outWarehouseEndDate = date[1]
  189. },
  190. // 查询
  191. handleSearch () {
  192. this.$refs.ruleForm.validate(valid => {
  193. if (valid) {
  194. this.$refs.table.refresh(true)
  195. } else {
  196. return false
  197. }
  198. })
  199. },
  200. // 重置
  201. resetSearchForm () {
  202. this.$refs.rangeDate.resetDate()
  203. this.queryParam.time = []
  204. this.queryParam.auditBeginDate = ''
  205. this.queryParam.auditEndDate = ''
  206. this.$refs.outWareRangeDate.resetDate('')
  207. this.outWareTime = []
  208. this.queryParam.outWarehouseBeginDate = ''
  209. this.queryParam.outWarehouseEndDate = ''
  210. this.queryParam.allocationType = undefined
  211. this.queryParam.putTenantSn = undefined
  212. this.queryParam.allocationLinkageOutNo = ''
  213. this.$refs.ruleForm.resetFields()
  214. this.totalData = null
  215. this.$refs.table.clearTable()
  216. },
  217. // 导出
  218. handleExport () {
  219. const _this = this
  220. this.$refs.ruleForm.validate(valid => {
  221. if (valid) {
  222. const params = _this.queryParam
  223. params.costFlag = this.$hasPermissions('M_ShowAllCost') ? '1' : '0'
  224. _this.exportLoading = true
  225. _this.spinning = true
  226. reportAllocLinkageOutExport(params).then(res => {
  227. downloadExcel(res, '连锁调出报表')
  228. _this.exportLoading = false
  229. _this.spinning = false
  230. })
  231. } else {
  232. return false
  233. }
  234. })
  235. },
  236. },
  237. mounted () {
  238. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  239. this.resetSearchForm()
  240. }
  241. },
  242. activated () {
  243. // 如果是新页签打开,则重置当前页面
  244. if (this.$store.state.app.isNewTab) {
  245. this.resetSearchForm()
  246. }
  247. },
  248. beforeRouteEnter (to, from, next) {
  249. next(vm => {})
  250. }
  251. }
  252. </script>