detailList.vue 12 KB

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