detailList.vue 12 KB

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