detailList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <a-spin :spinning="spinning" tip="Loading...">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form-model
  6. id="storeTransOutDetailReport-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="4" :sm="24">
  27. <a-form-model-item label="店内调出单号">
  28. <a-input id="storeTransOutReport-storeCallOutNo" v-model.trim="queryParam.storeCallOutNo" allowClear placeholder="请输入店内调出单号"/>
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :md="4" :sm="24">
  32. <a-form-item label="调往对象">
  33. <a-input id="sstoreTransOutReport-putPersonName" v-model.trim="queryParam.putPersonName" allowClear placeholder="请输入调往对象"/>
  34. </a-form-item>
  35. </a-col>
  36. <a-col :md="4" :sm="24">
  37. <a-form-item label="调拨类型">
  38. <a-select id="sstoreTransOutReport-callOutType" v-model="queryParam.callOutType" placeholder="请选择调拨类型" allowClear >
  39. <a-select-option v-for="item in storeCallOutTypeList" :key="item.storeCallOutTypeSn" :value="item.storeCallOutTypeSn">{{ item.name }}</a-select-option>
  40. </a-select>
  41. </a-form-item>
  42. </a-col>
  43. <template v-if="advanced">
  44. <a-col :md="4" :sm="24">
  45. <a-form-model-item label="产品编码">
  46. <a-input id="storeTransOutDetailReport-code" v-model.trim="queryParam.productEntity.code" allowClear placeholder="请输入产品编码"/>
  47. </a-form-model-item>
  48. </a-col>
  49. <a-col :md="4" :sm="24">
  50. <a-form-model-item label="产品名称">
  51. <a-input id="storeTransOutDetailReport-name" v-model.trim="queryParam.productEntity.name" allowClear placeholder="请输入产品名称"/>
  52. </a-form-model-item>
  53. </a-col>
  54. <a-col :md="4" :sm="24">
  55. <a-form-item label="产品品牌">
  56. <ProductBrand id="storeTransOutDetailReport-productBrandSn" placeholder="请选择产品品牌" v-model="queryParam.productEntity.productBrandSn"></ProductBrand>
  57. </a-form-item>
  58. </a-col>
  59. <a-col :md="4" :sm="24">
  60. <a-form-model-item label="产品分类">
  61. <ProductType id="storeTransOutDetailReport-productType" placeholder="请选择产品分类" :isDealer="true" @change="changeProductType" v-model="queryParam.productType"></ProductType>
  62. </a-form-model-item>
  63. </a-col>
  64. </template>
  65. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  66. <a-button type="primary" @click="handleSearch" :disabled="disabled" id="storeTransOutDetailReport-refresh">查询</a-button>
  67. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="storeTransOutDetailReport-reset">重置</a-button>
  68. <a-button
  69. type="primary"
  70. style="margin-left: 5px"
  71. @click="handleExport"
  72. :disabled="disabled"
  73. :loading="exportLoading"
  74. v-if="$hasPermissions('M_storeTransferOutReportExport')"
  75. class="button-warning"
  76. id="storeTransOutDetailReport-export-btn">导出</a-button>
  77. <a @click="advanced=!advanced" style="margin-left: 5px">
  78. {{ advanced ? '收起' : '展开' }}
  79. <a-icon :type="advanced ? 'up' : 'down'"/>
  80. </a>
  81. </a-col>
  82. </a-row>
  83. </a-form-model>
  84. </div>
  85. <!-- 合计 -->
  86. <a-alert type="info" style="margin-bottom:10px">
  87. <div class="ftext" slot="message">
  88. 产品总数量:<strong>{{ (totalData && (totalData.outQty || totalData.outQty==0)) ? totalData.outQty : '--' }}</strong>;
  89. 调出总成本:<strong>{{ (totalData && (totalData.outCost || totalData.outCost==0)) ? '¥'+totalData.outCost : '--' }}</strong>;
  90. </div>
  91. </a-alert>
  92. <!-- 列表 -->
  93. <s-table
  94. class="sTable"
  95. ref="table"
  96. size="small"
  97. :rowKey="(record) => record.id"
  98. :columns="columns"
  99. :data="loadData"
  100. :defaultLoadData="false"
  101. bordered>
  102. </s-table>
  103. </a-spin>
  104. </template>
  105. <script>
  106. import { commonMixin } from '@/utils/mixin'
  107. import { STable, VSelect } from '@/components'
  108. import rangeDate from '@/views/common/rangeDate.vue'
  109. import { downloadExcel } from '@/libs/JGPrint.js'
  110. import ProductType from '../../common/productType.js'
  111. import ProductBrand from '../../common/productBrand.js'
  112. import supplier from '@/views/common/supplier'
  113. import { storeCallOutTypeAllList } from '@/api/storeCallOutType'
  114. import { reportStoreCallOutDetailList, reportStoreCallOutDetailTotal, reportStoreCallOutDetailExport } from '@/api/reportData'
  115. export default {
  116. components: { STable, VSelect, rangeDate, ProductType, ProductBrand, supplier },
  117. mixins: [commonMixin],
  118. data () {
  119. return {
  120. spinning: false,
  121. labelCol: { span: 8 },
  122. wrapperCol: { span: 16 },
  123. advanced: false, // 高级搜索 展开/关闭
  124. tableHeight: 0,
  125. outWareTime: [],
  126. queryParam: { // 查询条件
  127. time: [],
  128. beginDate: '',
  129. endDate: '',
  130. productEntity: {
  131. productBrandSn: undefined, // 产品品牌
  132. productTypeSn1: '', // 产品一级分类
  133. productTypeSn2: '', // 产品二级分类
  134. productTypeSn3: '', // 产品三级分类
  135. code: '', // 产品编码
  136. name: '' // 产品名称
  137. },
  138. callOutType: undefined,
  139. productType: undefined,
  140. storeCallOutNo: '',
  141. putPersonName: ''
  142. },
  143. rules: {
  144. 'time': [{ required: true, message: '请选择审核时间', trigger: 'change' }]
  145. },
  146. disabled: false, // 查询、重置按钮是否可操作
  147. exportLoading: false,
  148. columns: [
  149. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  150. { title: '店内调出单号', dataIndex: 'storeCallOutNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  151. { title: '调往对象', dataIndex: 'putPersonName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  152. { title: '调拨类型', dataIndex: 'callOutTypeName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  153. { title: '产品编码', dataIndex: 'productEntity.code', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
  154. { title: '产品名称', dataIndex: 'productEntity.name', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  155. { title: '单位', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  156. { title: '数量', dataIndex: 'outQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  157. { title: '成本', dataIndex: 'outCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  158. { title: '审核时间', dataIndex: 'auditTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } }
  159. ],
  160. // 加载数据方法 必须为 Promise 对象
  161. loadData: parameter => {
  162. this.disabled = true
  163. const params = Object.assign(parameter, this.queryParam)
  164. this.spinning = true
  165. delete params.time
  166. return reportStoreCallOutDetailList(params).then(res => {
  167. let data
  168. if (res.status == 200) {
  169. data = res.data
  170. // 总计
  171. this.getCount(params)
  172. const no = (data.pageNo - 1) * data.pageSize
  173. for (var i = 0; i < data.list.length; i++) {
  174. data.list[i].no = no + i + 1
  175. }
  176. this.disabled = false
  177. }
  178. this.spinning = false
  179. return data
  180. })
  181. },
  182. totalData: null, // 合计
  183. storeCallOutTypeList: [] // 调拨类型
  184. }
  185. },
  186. methods: {
  187. // 合计
  188. getCount (params) {
  189. reportStoreCallOutDetailTotal(params).then(res => {
  190. if (res.status == 200) {
  191. this.totalData = res.data
  192. } else {
  193. this.totalData = null
  194. }
  195. })
  196. },
  197. // 创建时间 change
  198. dateChange (date) {
  199. this.queryParam.time = date
  200. this.queryParam.beginDate = date[0] || ''
  201. this.queryParam.endDate = date[1] || ''
  202. },
  203. outWareDateChange (date) {
  204. this.queryParam.outWarehouseBeginDate = date[0]
  205. this.queryParam.outWarehouseEndDate = date[1]
  206. },
  207. // 查询
  208. handleSearch () {
  209. this.$refs.ruleForm.validate(valid => {
  210. if (valid) {
  211. this.$refs.table.refresh(true)
  212. } else {
  213. console.log('error submit!!')
  214. return false
  215. }
  216. })
  217. },
  218. // 重置
  219. resetSearchForm () {
  220. this.$refs.rangeDate.resetDate()
  221. this.queryParam.time = []
  222. this.queryParam.beginDate = ''
  223. this.queryParam.endDate = ''
  224. this.$refs.outWareRangeDate.resetDate('')
  225. this.outWareTime = []
  226. this.queryParam.outWarehouseBeginDate = ''
  227. this.queryParam.outWarehouseEndDate = ''
  228. this.queryParam.storeCallOutNo = ''
  229. this.queryParam.callOutType = undefined
  230. this.queryParam.putPersonName = ''
  231. this.queryParam.productEntity.productBrandSn = undefined
  232. this.queryParam.productEntity.productTypeSn1 = ''
  233. this.queryParam.productEntity.productTypeSn2 = ''
  234. this.queryParam.productEntity.productTypeSn3 = ''
  235. this.queryParam.productType = []
  236. this.queryParam.productEntity.code = ''
  237. this.queryParam.productEntity.name = ''
  238. this.$refs.ruleForm.resetFields()
  239. this.totalData = null
  240. this.$refs.table.clearTable()
  241. },
  242. // 导出
  243. handleExport () {
  244. const _this = this
  245. this.$refs.ruleForm.validate(valid => {
  246. if (valid) {
  247. const params = _this.queryParam
  248. _this.exportLoading = true
  249. _this.spinning = true
  250. reportStoreCallOutDetailExport(params).then(res => {
  251. downloadExcel(res, '店内调出明细报表')
  252. _this.exportLoading = false
  253. _this.spinning = false
  254. })
  255. } else {
  256. console.log('error submit!!')
  257. return false
  258. }
  259. })
  260. },
  261. // 产品分类 change
  262. changeProductType (val, opt) {
  263. this.queryParam.productEntity.productTypeSn1 = val[0] ? val[0] : ''
  264. this.queryParam.productEntity.productTypeSn2 = val[1] ? val[1] : ''
  265. this.queryParam.productEntity.productTypeSn3 = val[2] ? val[2] : ''
  266. },
  267. // 调拨类型
  268. getStoreCallOutTypeAllList () {
  269. storeCallOutTypeAllList().then(res => {
  270. if (res.status == 200) {
  271. this.storeCallOutTypeList = res.data
  272. } else {
  273. this.storeCallOutTypeList = []
  274. }
  275. })
  276. },
  277. pageInit () {
  278. this.disabled = false
  279. this.spinning = false
  280. this.getStoreCallOutTypeAllList()
  281. }
  282. },
  283. mounted () {
  284. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  285. this.pageInit()
  286. this.resetSearchForm()
  287. }
  288. },
  289. activated () {
  290. // 如果是新页签打开,则重置当前页面
  291. if (this.$store.state.app.isNewTab) {
  292. this.pageInit()
  293. this.resetSearchForm()
  294. }
  295. },
  296. beforeRouteEnter (to, from, next) {
  297. next(vm => {})
  298. }
  299. }
  300. </script>