detailList.vue 12 KB

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