detailList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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 id="chainCallReportExport-time" 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="chainCallReportExport-allocationLinkageOutNo" v-model.trim="queryParam.allocationLinkageOutNo" allowClear placeholder="请输入连锁调出单号"/>
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :md="6" :sm="24">
  27. <a-form-item label="调往对象">
  28. <getTenantList id="chainCallReportExport-putTenantSn" type="out" state="FINISH" placeholder="请选择调往对象" v-model="queryParam.putTenantSn"></getTenantList>
  29. </a-form-item>
  30. </a-col>
  31. <template v-if="advanced">
  32. <a-col :md="6" :sm="24">
  33. <a-form-model-item label="产品编码">
  34. <a-input id="chainCallReportExport-code" v-model.trim="queryParam.productEntity.code" allowClear placeholder="请输入产品编码"/>
  35. </a-form-model-item>
  36. </a-col>
  37. <a-col :md="6" :sm="24">
  38. <a-form-item label="出库时间">
  39. <rangeDate id="chainCallReportExport-outTime" ref="outWareRangeDate" :value="outWareTime" @change="outWareDateChange" />
  40. </a-form-item>
  41. </a-col>
  42. <a-col :md="6" :sm="24">
  43. <a-form-item label="调拨产品类型">
  44. <v-select
  45. v-model="queryParam.allocationType"
  46. ref="allocationType"
  47. id="chainCallReportExport-allocationType"
  48. code="ALLOCATION_LINKAGE_PRODUCT_TYPE"
  49. placeholder="请选择调拨产品类型"
  50. allowClear></v-select>
  51. </a-form-item>
  52. </a-col>
  53. <a-col :md="6" :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="6" :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="6" :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="6" :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" id="chainCallReportExport-advanced">
  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 getTenantList from '@/views/common/getTenantList.js'
  120. import { reportAllocLinkageOutDetailList, reportAllocLinkageOutDetailCount, reportAllocLinkageOutDetailExport } from '@/api/reportData'
  121. export default {
  122. components: { STable, VSelect, rangeDate, ProductType, ProductBrand, supplier, getTenantList },
  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: 'auditTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  193. { title: '出库时间', dataIndex: 'outWarehouseTime', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
  194. { title: '调拨类型', dataIndex: 'allocationTypeDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
  195. ]
  196. if (this.$hasPermissions('M_ShowAllCost')) {
  197. arr.splice(7, 0, { title: '成本', dataIndex: 'outCost', width: '5%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  198. }
  199. return arr
  200. }
  201. },
  202. methods: {
  203. // 合计
  204. getCount (params) {
  205. reportAllocLinkageOutDetailCount(params).then(res => {
  206. if (res.status == 200) {
  207. this.totalData = res.data
  208. } else {
  209. this.totalData = null
  210. }
  211. })
  212. },
  213. // 创建时间 change
  214. dateChange (date) {
  215. this.queryParam.time = date
  216. this.queryParam.auditBeginDate = date[0] || ''
  217. this.queryParam.auditEndDate = date[1] || ''
  218. },
  219. // 出库时间
  220. outWareDateChange (date) {
  221. this.queryParam.outWarehouseBeginDate = date[0]
  222. this.queryParam.outWarehouseEndDate = date[1]
  223. },
  224. // 查询
  225. handleSearch () {
  226. this.$refs.ruleForm.validate(valid => {
  227. if (valid) {
  228. this.$refs.table.refresh(true)
  229. } else {
  230. return false
  231. }
  232. })
  233. },
  234. // 重置
  235. resetSearchForm () {
  236. this.$refs.rangeDate.resetDate()
  237. this.queryParam.time = []
  238. this.queryParam.auditBeginDate = ''
  239. this.queryParam.auditEndDate = ''
  240. this.$refs.outWareRangeDate.resetDate('')
  241. this.outWareTime = []
  242. this.queryParam.outWarehouseBeginDate = ''
  243. this.queryParam.outWarehouseEndDate = ''
  244. this.queryParam.allocationType = undefined
  245. this.queryParam.putTenantSn = undefined
  246. this.queryParam.allocationLinkageOutNo = ''
  247. this.queryParam.productEntity.productBrandSn = undefined
  248. this.queryParam.productEntity.productTypeSn1 = ''
  249. this.queryParam.productEntity.productTypeSn2 = ''
  250. this.queryParam.productEntity.productTypeSn3 = ''
  251. this.queryParam.productType = []
  252. this.queryParam.productEntity.code = ''
  253. this.queryParam.productEntity.name = ''
  254. this.$refs.ruleForm.resetFields()
  255. this.totalData = null
  256. this.$refs.table.clearTable()
  257. },
  258. // 导出
  259. handleExport () {
  260. const _this = this
  261. this.$refs.ruleForm.validate(valid => {
  262. if (valid) {
  263. const params = _this.queryParam
  264. params.costFlag = this.$hasPermissions('M_ShowAllCost') ? '1' : '0'
  265. _this.exportLoading = true
  266. _this.spinning = true
  267. reportAllocLinkageOutDetailExport(params).then(res => {
  268. downloadExcel(res, '连锁调出明细报表')
  269. _this.exportLoading = false
  270. _this.spinning = false
  271. })
  272. } else {
  273. return false
  274. }
  275. })
  276. },
  277. // 产品分类 change
  278. changeProductType (val, opt) {
  279. this.queryParam.productEntity.productTypeSn1 = val[0] ? val[0] : ''
  280. this.queryParam.productEntity.productTypeSn2 = val[1] ? val[1] : ''
  281. this.queryParam.productEntity.productTypeSn3 = val[2] ? val[2] : ''
  282. },
  283. pageInit () {
  284. this.disabled = false
  285. this.spinning = false
  286. }
  287. },
  288. mounted () {
  289. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  290. this.pageInit()
  291. this.resetSearchForm()
  292. }
  293. },
  294. activated () {
  295. // 如果是新页签打开,则重置当前页面
  296. if (this.$store.state.app.isNewTab) {
  297. this.pageInit()
  298. this.resetSearchForm()
  299. }
  300. },
  301. beforeRouteEnter (to, from, next) {
  302. next(vm => {})
  303. }
  304. }
  305. </script>