detailList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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. <div v-if="$hasPermissions('M_ShowAllCost')" style="display: inline-block;">
  90. 调出总成本:<strong>{{ (totalData && (totalData.outCost || totalData.outCost==0)) ? toThousands(totalData.outCost) : '--' }}</strong>;
  91. </div>
  92. </div>
  93. </a-alert>
  94. <!-- 列表 -->
  95. <s-table
  96. class="sTable"
  97. ref="table"
  98. size="small"
  99. :rowKey="(record) => record.id"
  100. :columns="columns"
  101. :data="loadData"
  102. :defaultLoadData="false"
  103. bordered>
  104. </s-table>
  105. </a-spin>
  106. </template>
  107. <script>
  108. import { commonMixin } from '@/utils/mixin'
  109. import { STable, VSelect } from '@/components'
  110. import rangeDate from '@/views/common/rangeDate.vue'
  111. import { downloadExcel } from '@/libs/JGPrint.js'
  112. import ProductType from '../../common/productType.js'
  113. import ProductBrand from '../../common/productBrand.js'
  114. import supplier from '@/views/common/supplier'
  115. import { storeCallOutTypeAllList } from '@/api/storeCallOutType'
  116. import { reportStoreCallOutDetailList, reportStoreCallOutDetailTotal, reportStoreCallOutDetailExport } from '@/api/reportData'
  117. export default {
  118. components: { STable, VSelect, rangeDate, ProductType, ProductBrand, supplier },
  119. mixins: [commonMixin],
  120. data () {
  121. return {
  122. spinning: false,
  123. labelCol: { span: 8 },
  124. wrapperCol: { span: 16 },
  125. advanced: false, // 高级搜索 展开/关闭
  126. tableHeight: 0,
  127. outWareTime: [],
  128. queryParam: { // 查询条件
  129. time: [],
  130. beginDate: '',
  131. endDate: '',
  132. productEntity: {
  133. productBrandSn: undefined, // 产品品牌
  134. productTypeSn1: '', // 产品一级分类
  135. productTypeSn2: '', // 产品二级分类
  136. productTypeSn3: '', // 产品三级分类
  137. code: '', // 产品编码
  138. name: '' // 产品名称
  139. },
  140. callOutType: undefined,
  141. productType: undefined,
  142. storeCallOutNo: '',
  143. putPersonName: ''
  144. },
  145. rules: {
  146. 'time': [{ required: true, message: '请选择审核时间', trigger: 'change' }]
  147. },
  148. disabled: false, // 查询、重置按钮是否可操作
  149. exportLoading: false,
  150. // 加载数据方法 必须为 Promise 对象
  151. loadData: parameter => {
  152. this.disabled = true
  153. const params = Object.assign(parameter, this.queryParam)
  154. this.spinning = true
  155. delete params.time
  156. return reportStoreCallOutDetailList(params).then(res => {
  157. let data
  158. if (res.status == 200) {
  159. data = res.data
  160. // 总计
  161. this.getCount(params)
  162. const no = (data.pageNo - 1) * data.pageSize
  163. for (var i = 0; i < data.list.length; i++) {
  164. data.list[i].no = no + i + 1
  165. }
  166. this.disabled = false
  167. }
  168. this.spinning = false
  169. return data
  170. })
  171. },
  172. totalData: null, // 合计
  173. storeCallOutTypeList: [] // 调拨类型
  174. }
  175. },
  176. computed: {
  177. columns () {
  178. const _this = this
  179. const arr = [
  180. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  181. { title: '店内调出单号', dataIndex: 'storeCallOutNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
  182. { title: '调往对象', dataIndex: 'putPersonName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  183. { title: '调拨类型', dataIndex: 'callOutTypeName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  184. { title: '产品编码', dataIndex: 'productEntity.code', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
  185. { title: '产品名称', dataIndex: 'productEntity.name', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  186. { title: '单位', dataIndex: 'productEntity.unit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
  187. { title: '数量', dataIndex: 'outQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  188. // { title: '成本', dataIndex: 'outCost', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  189. { title: '审核时间', dataIndex: 'auditTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } }
  190. ]
  191. if (this.$hasPermissions('M_ShowAllCost')) {
  192. arr.splice(8, 0, { title: '成本', dataIndex: 'outCost', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  193. }
  194. return arr
  195. }
  196. },
  197. methods: {
  198. // 合计
  199. getCount (params) {
  200. reportStoreCallOutDetailTotal(params).then(res => {
  201. if (res.status == 200) {
  202. this.totalData = res.data
  203. } else {
  204. this.totalData = null
  205. }
  206. })
  207. },
  208. // 创建时间 change
  209. dateChange (date) {
  210. this.queryParam.time = date
  211. this.queryParam.beginDate = date[0] || ''
  212. this.queryParam.endDate = date[1] || ''
  213. },
  214. outWareDateChange (date) {
  215. this.queryParam.outWarehouseBeginDate = date[0]
  216. this.queryParam.outWarehouseEndDate = date[1]
  217. },
  218. // 查询
  219. handleSearch () {
  220. this.$refs.ruleForm.validate(valid => {
  221. if (valid) {
  222. this.$refs.table.refresh(true)
  223. } else {
  224. console.log('error submit!!')
  225. return false
  226. }
  227. })
  228. },
  229. // 重置
  230. resetSearchForm () {
  231. this.$refs.rangeDate.resetDate()
  232. this.queryParam.time = []
  233. this.queryParam.beginDate = ''
  234. this.queryParam.endDate = ''
  235. this.$refs.outWareRangeDate.resetDate('')
  236. this.outWareTime = []
  237. this.queryParam.outWarehouseBeginDate = ''
  238. this.queryParam.outWarehouseEndDate = ''
  239. this.queryParam.storeCallOutNo = ''
  240. this.queryParam.callOutType = undefined
  241. this.queryParam.putPersonName = ''
  242. this.queryParam.productEntity.productBrandSn = undefined
  243. this.queryParam.productEntity.productTypeSn1 = ''
  244. this.queryParam.productEntity.productTypeSn2 = ''
  245. this.queryParam.productEntity.productTypeSn3 = ''
  246. this.queryParam.productType = []
  247. this.queryParam.productEntity.code = ''
  248. this.queryParam.productEntity.name = ''
  249. this.$refs.ruleForm.resetFields()
  250. this.totalData = null
  251. this.$refs.table.clearTable()
  252. },
  253. // 导出
  254. handleExport () {
  255. const _this = this
  256. this.$refs.ruleForm.validate(valid => {
  257. if (valid) {
  258. const params = _this.queryParam
  259. params.showCost = this.$hasPermissions('M_ShowAllCost') ? '1' : '0'
  260. _this.exportLoading = true
  261. _this.spinning = true
  262. reportStoreCallOutDetailExport(params).then(res => {
  263. downloadExcel(res, '店内调出明细报表')
  264. _this.exportLoading = false
  265. _this.spinning = false
  266. })
  267. } else {
  268. console.log('error submit!!')
  269. return false
  270. }
  271. })
  272. },
  273. // 产品分类 change
  274. changeProductType (val, opt) {
  275. this.queryParam.productEntity.productTypeSn1 = val[0] ? val[0] : ''
  276. this.queryParam.productEntity.productTypeSn2 = val[1] ? val[1] : ''
  277. this.queryParam.productEntity.productTypeSn3 = val[2] ? val[2] : ''
  278. },
  279. // 调拨类型
  280. getStoreCallOutTypeAllList () {
  281. storeCallOutTypeAllList().then(res => {
  282. if (res.status == 200) {
  283. this.storeCallOutTypeList = res.data
  284. } else {
  285. this.storeCallOutTypeList = []
  286. }
  287. })
  288. },
  289. pageInit () {
  290. this.disabled = false
  291. this.spinning = false
  292. this.getStoreCallOutTypeAllList()
  293. }
  294. },
  295. mounted () {
  296. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  297. this.pageInit()
  298. this.resetSearchForm()
  299. }
  300. },
  301. activated () {
  302. // 如果是新页签打开,则重置当前页面
  303. if (this.$store.state.app.isNewTab) {
  304. this.pageInit()
  305. this.resetSearchForm()
  306. }
  307. },
  308. beforeRouteEnter (to, from, next) {
  309. next(vm => {})
  310. }
  311. }
  312. </script>